jsHint enhancements

This commit is contained in:
Tobias Reich 2014-02-25 23:37:05 +01:00
parent 00e52e483a
commit 2d66c445da
17 changed files with 54 additions and 54 deletions

File diff suppressed because one or more lines are too long

View File

@ -339,4 +339,4 @@ album = {
} }
} };

View File

@ -85,4 +85,4 @@ albums = {
} }
} };

View File

@ -150,7 +150,7 @@ build = {
modal += "<div class='message center'" + custom_style + ">"; modal += "<div class='message center'" + custom_style + ">";
modal += "<h1>" + title + "</h1>"; modal += "<h1>" + title + "</h1>";
if (closeButton!=false) { if (closeButton!==false) {
modal += "<a class='close icon-remove-sign'></a>"; modal += "<a class='close icon-remove-sign'></a>";
@ -160,7 +160,7 @@ build = {
$.each(button, function(index) { $.each(button, function(index) {
if (this[0]!="") { if (this[0]!=="") {
if (index===0) modal += "<a class='button active'>" + this[0] + "</a>"; if (index===0) modal += "<a class='button active'>" + this[0] + "</a>";
else modal += "<a class='button'>" + this[0] + "</a>"; else modal += "<a class='button'>" + this[0] + "</a>";
@ -334,7 +334,7 @@ build = {
$.each(infos, function(index) { $.each(infos, function(index) {
if (infos[index][1]===""||infos[index][1]==undefined||infos[index][1]==null) infos[index][1] = "-"; if (infos[index][1]===""||infos[index][1]===undefined||infos[index][1]===null) infos[index][1] = "-";
switch (infos[index][0]) { switch (infos[index][0]) {
@ -426,7 +426,7 @@ build = {
$.each(infos, function(index) { $.each(infos, function(index) {
if (infos[index][1]===""||infos[index][1]==undefined||infos[index][1]==null) infos[index][1] = "-"; if (infos[index][1]===""||infos[index][1]===undefined||infos[index][1]===null) infos[index][1] = "-";
if (infos[index][0]==="") { if (infos[index][0]==="") {
@ -453,4 +453,4 @@ build = {
} }
} };

View File

@ -19,7 +19,7 @@ contextMenu = {
// Do not leave the screen // Do not leave the screen
if ((mouse_x+$(".contextmenu").outerWidth(true))>$("html").width()) orientation = "left"; if ((mouse_x+$(".contextmenu").outerWidth(true))>$("html").width()) orientation = "left";
if ((mouse_y+$(".contextmenu").outerHeight(true))>$("html").height()) mouse_y -= (mouse_y+$(".contextmenu").outerHeight(true)-$("html").height()) if ((mouse_y+$(".contextmenu").outerHeight(true))>$("html").height()) mouse_y -= (mouse_y+$(".contextmenu").outerHeight(true)-$("html").height());
if (mouse_x>$(document).width()) mouse_x = $(document).width(); if (mouse_x>$(document).width()) mouse_x = $(document).width();
if (mouse_x<0) mouse_x = 0; if (mouse_x<0) mouse_x = 0;
@ -30,10 +30,10 @@ contextMenu = {
if (mouse_x===null|| if (mouse_x===null||
mouse_x===undefined|| mouse_x===undefined||
mouse_x===NaN|| isNaN(mouse_x)||
mouse_y===null|| mouse_y===null||
mouse_y===undefined|| mouse_y===undefined||
mouse_y===NaN) { isNaN(mouse_y)) {
mouse_x = "10px"; mouse_x = "10px";
mouse_y = "10px"; mouse_y = "10px";
} }
@ -41,7 +41,7 @@ contextMenu = {
$(".contextmenu").css({ $(".contextmenu").css({
"top": mouse_y, "top": mouse_y,
"left": mouse_x, "left": mouse_x,
"opacity": .98 "opacity": 0.98
}); });
}, },
@ -330,4 +330,4 @@ contextMenu = {
} }
} };

View File

@ -45,8 +45,8 @@ $(document).ready(function(){
/* Clear Search */ /* Clear Search */
$("#clearSearch").on(event_name, function () { $("#clearSearch").on(event_name, function () {
$("#search").focus(); $("#search").focus();
search.reset(); search.reset();
}); });
/* Back Buttons */ /* Back Buttons */
@ -116,8 +116,8 @@ $(document).ready(function(){
/* Modal */ /* Modal */
.on(event_name, ".message .close", modal.close) .on(event_name, ".message .close", modal.close)
.on(event_name, ".message .button:first", function() { if (modal.fns!=null) modal.fns[0](); if (!visible.signin()) modal.close() }) .on(event_name, ".message .button:first", function() { if (modal.fns!==null) modal.fns[0](); if (!visible.signin()) modal.close() })
.on(event_name, ".message .button:last", function() { if (modal.fns!=null) modal.fns[1](); if (!visible.signin()) modal.close() }) .on(event_name, ".message .button:last", function() { if (modal.fns!==null) modal.fns[1](); if (!visible.signin()) modal.close() })
/* Add Dialog */ /* Add Dialog */
.on(event_name, ".button_add", function(e) { contextMenu.add(e) }) .on(event_name, ".button_add", function(e) { contextMenu.add(e) })

View File

@ -15,7 +15,7 @@ loadingBar = {
loadingBar.status = "error"; loadingBar.status = "error";
if (!errorText) errorText = "Whoops, it looks like something went wrong. Please reload the site and try again!" if (!errorText) errorText = "Whoops, it looks like something went wrong. Please reload the site and try again!";
lychee.loadingBar lychee.loadingBar
.removeClass("loading uploading error") .removeClass("loading uploading error")
@ -28,7 +28,7 @@ loadingBar = {
clearTimeout(lychee.loadingBar.data("timeout")); clearTimeout(lychee.loadingBar.data("timeout"));
lychee.loadingBar.data("timeout", setTimeout(function() { loadingBar.hide(true) }, 3000)); lychee.loadingBar.data("timeout", setTimeout(function() { loadingBar.hide(true) }, 3000));
} else if (loadingBar.status==null) { } else if (loadingBar.status===null) {
loadingBar.status = "loading"; loadingBar.status = "loading";
@ -47,7 +47,7 @@ loadingBar = {
hide: function(force_hide) { hide: function(force_hide) {
if ((loadingBar.status!=="error"&&loadingBar.status!=null)||force_hide) { if ((loadingBar.status!=="error"&&loadingBar.status!==null)||force_hide) {
loadingBar.status = null; loadingBar.status = null;
clearTimeout(lychee.loadingBar.data("timeout")); clearTimeout(lychee.loadingBar.data("timeout"));
@ -59,4 +59,4 @@ loadingBar = {
} }
} };

View File

@ -73,7 +73,7 @@ var lychee = {
api: function(params, callback, loading) { api: function(params, callback, loading) {
if (loading==undefined) loadingBar.show(); if (loading===undefined) loadingBar.show();
$.ajax({ $.ajax({
type: "POST", type: "POST",
@ -135,7 +135,7 @@ var lychee = {
$("#username").focus(); $("#username").focus();
if (localStorage) { if (localStorage) {
local_username = localStorage.getItem("username"); local_username = localStorage.getItem("username");
if (local_username!=null) { if (local_username!==null) {
if (local_username.length>0) $("#username").val(local_username); if (local_username.length>0) $("#username").val(local_username);
$("#password").focus(); $("#password").focus();
} }
@ -154,7 +154,7 @@ var lychee = {
goto: function(url) { goto: function(url) {
if (url==undefined) url = ""; if (url===undefined) url = "";
document.location.hash = url; document.location.hash = url;
}, },
@ -323,7 +323,7 @@ var lychee = {
settings.setDropboxKey(callback); settings.setDropboxKey(callback);
}; }
}, },
@ -336,4 +336,4 @@ var lychee = {
} }
} };

View File

@ -12,7 +12,7 @@ modal = {
show: function(title, text, buttons, marginTop, closeButton) { show: function(title, text, buttons, marginTop, closeButton) {
if (!buttons) { if (!buttons) {
var buttons = [ buttons = [
["", function() {}], ["", function() {}],
["", function() {}] ["", function() {}]
]; ];
@ -32,4 +32,4 @@ modal = {
} }
} };

View File

@ -21,7 +21,7 @@ multiselect = {
if (mobileBrowser()) return false; if (mobileBrowser()) return false;
if (lychee.publicMode) return false; if (lychee.publicMode) return false;
if (visible.search()) return false; if (visible.search()) return false;
if ($('.album:hover, .photo:hover').length!=0) return false; if ($('.album:hover, .photo:hover').length!==0) return false;
if (visible.multiselect()) $('#multiselect').remove(); if (visible.multiselect()) $('#multiselect').remove();
multiselect.position.top = e.pageY; multiselect.position.top = e.pageY;
@ -109,7 +109,7 @@ multiselect = {
left: $('#multiselect').offset().left, left: $('#multiselect').offset().left,
width: parseInt($('#multiselect').css('width').replace('px', '')), width: parseInt($('#multiselect').css('width').replace('px', '')),
height: parseInt($('#multiselect').css('height').replace('px', '')) height: parseInt($('#multiselect').css('height').replace('px', ''))
} };
}, },
@ -146,8 +146,8 @@ multiselect = {
}); });
if (ids.length!=0&&visible.album()) contextMenu.photoMulti(ids, e); if (ids.length!==0&&visible.album()) contextMenu.photoMulti(ids, e);
else if (ids.length!=0&&visible.albums()) contextMenu.albumMulti(ids, e); else if (ids.length!==0&&visible.albums()) contextMenu.albumMulti(ids, e);
else multiselect.close(); else multiselect.close();
}, },
@ -168,4 +168,4 @@ multiselect = {
} }
} };

View File

@ -105,4 +105,4 @@ password = {
} }
} };

View File

@ -33,7 +33,7 @@ photo = {
checkPasswd = function() { checkPasswd = function() {
if (password.value!=="") photo.load(photoID, albumID); if (password.value!=="") photo.load(photoID, albumID);
else setTimeout(checkPasswd, 250); else setTimeout(checkPasswd, 250);
} };
checkPasswd(); checkPasswd();
return false; return false;
} }
@ -69,7 +69,7 @@ photo = {
// Get title if only one photo is selected // Get title if only one photo is selected
if (visible.photo()) photoTitle = photo.json.title; if (visible.photo()) photoTitle = photo.json.title;
else photoTitle = album.json.content[photoIDs].title; else photoTitle = album.json.content[photoIDs].title;
if (photoTitle=="") photoTitle = "Untitled"; if (photoTitle==="") photoTitle = "Untitled";
} }
buttons = [ buttons = [
@ -411,15 +411,15 @@ photo = {
isSmall: function() { isSmall: function() {
var size = [ var size = {
["width", false], width: false,
["height", false] height: false
]; };
if (photo.json.width<$(window).width()-60) size["width"] = true; if (photo.json.width<$(window).width()-60) size.width = true;
if (photo.json.height<$(window).height()-100) size["height"] = true; if (photo.json.height<$(window).height()-100) size.height = true;
if (size["width"]&&size["height"]) return true; if (size.width&&size.height) return true;
else return false; else return false;
}, },
@ -450,4 +450,4 @@ photo = {
} }
} };

View File

@ -90,4 +90,4 @@ search = {
} }
} };

View File

@ -230,7 +230,7 @@ var settings = {
order.\ order.\
", buttons); ", buttons);
if (lychee.sorting!="") { if (lychee.sorting!=="") {
sorting = lychee.sorting.replace("ORDER BY ", "").replace(" ", ";").split(";"); sorting = lychee.sorting.replace("ORDER BY ", "").replace(" ", ";").split(";");
$("select#settings_type").val(sorting[0]); $("select#settings_type").val(sorting[0]);
$("select#settings_order").val(sorting[1]); $("select#settings_order").val(sorting[1]);
@ -267,4 +267,4 @@ var settings = {
} }
} };

View File

@ -42,9 +42,9 @@ upload = {
if (!window.webkitNotifications) return false; if (!window.webkitNotifications) return false;
if (window.webkitNotifications.checkPermission()!=0) window.webkitNotifications.requestPermission(); if (window.webkitNotifications.checkPermission()!==0) window.webkitNotifications.requestPermission();
if (window.webkitNotifications.checkPermission()==0&&title) { if (window.webkitNotifications.checkPermission()===0&&title) {
popup = window.webkitNotifications.createNotification("", title, "You can now manage your new photo(s)."); popup = window.webkitNotifications.createNotification("", title, "You can now manage your new photo(s).");
popup.show(); popup.show();
} }
@ -270,4 +270,4 @@ upload = {
} }
} };

View File

@ -471,4 +471,4 @@ view = {
} }
} };

View File

@ -57,4 +57,4 @@ visible = {
else return false; else return false;
} }
} };