Fixes some lint issues (#3786)
Fixes lint issues in /home/yash/GitHub/dev.to/app/assets/javascripts/utilities/ - browserStoreCache.js - checkUserLoggedIn.js - createAjaxReq.js - getCurrentPage.js - getImageForLink.js - insertAfter.js - localDateTime.js - localStorageTest.js - preventDefaultAction.js Signed-off-by: Amorpheuz <mail2ypd@gmail.com>
This commit is contained in:
parent
d093667198
commit
773982e210
9 changed files with 42 additions and 21 deletions
|
|
@ -1,3 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
function browserStoreCache(action, userData) {
|
||||
try {
|
||||
switch (action) {
|
||||
|
|
@ -19,4 +21,5 @@ function browserStoreCache(action, userData) {
|
|||
browserStoreCache('remove');
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
function checkUserLoggedIn() {
|
||||
const body = document.getElementsByTagName('body')[0];
|
||||
if (!body) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
function createAjaxReq() {
|
||||
if (window.XMLHttpRequest) {
|
||||
return new XMLHttpRequest();
|
||||
} else {
|
||||
return new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
return new window.ActiveXObject('Microsoft.XMLHTTP');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
function getCurrentPage(classString) {
|
||||
return document.querySelectorAll("[data-current-page='"+classString+"']").length > 0
|
||||
}
|
||||
return (
|
||||
document.querySelectorAll("[data-current-page='" + classString + "']")
|
||||
.length > 0
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
var $fetchedImageUrls = [];
|
||||
function getImageForLink(elem){
|
||||
var imageUrl = elem.getAttribute('data-preload-image')
|
||||
if (imageUrl && $fetchedImageUrls.indexOf(imageUrl) == -1) {
|
||||
function getImageForLink(elem) {
|
||||
var imageUrl = elem.getAttribute('data-preload-image');
|
||||
if (imageUrl && $fetchedImageUrls.indexOf(imageUrl) === -1) {
|
||||
var img = new Image();
|
||||
img.src = imageUrl;
|
||||
$fetchedImageUrls.push(imageUrl);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
function insertAfter(newNode, referenceNode) {
|
||||
if (referenceNode && referenceNode.parentNode){
|
||||
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
||||
}
|
||||
if (referenceNode && referenceNode.parentNode) {
|
||||
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
/* Local date/time utilities */
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
function localStorageTest(){
|
||||
var test = 'devtolocalstoragetestforavaialbility';
|
||||
try {
|
||||
localStorage.setItem(test, test);
|
||||
localStorage.removeItem(test);
|
||||
return true;
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
'use strict';
|
||||
|
||||
function localStorageTest() {
|
||||
var test = 'devtolocalstoragetestforavaialbility';
|
||||
try {
|
||||
localStorage.setItem(test, test);
|
||||
localStorage.removeItem(test);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
function preventDefaultAction(event){
|
||||
'use strict';
|
||||
|
||||
function preventDefaultAction(event) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue