More JSHint fixes.
This commit is contained in:
parent
1eb4217c01
commit
b9047be3ce
30
util.js
30
util.js
|
@ -103,10 +103,10 @@ function htmlEscape(str) {
|
||||||
function getTagList () {
|
function getTagList () {
|
||||||
var tagList = {};
|
var tagList = {};
|
||||||
$(".se").each (function(){
|
$(".se").each (function(){
|
||||||
if ($(this).parents (".filtered").length > 0) return;
|
if ($(this).parents (".filtered").length > 0) { return; }
|
||||||
var taglist = $(this).text();
|
var taglist = $(this).text();
|
||||||
|
|
||||||
var tagarray = taglist.split (",")
|
var tagarray = taglist.split (",");
|
||||||
for (var i in tagarray) {
|
for (var i in tagarray) {
|
||||||
var tag = tagarray [i].replace(/^\s+/g,'').replace(/\s+$/g,'');
|
var tag = tagarray [i].replace(/^\s+/g,'').replace(/\s+$/g,'');
|
||||||
tagList [tag] = 1;
|
tagList [tag] = 1;
|
||||||
|
@ -117,7 +117,7 @@ function getTagList () {
|
||||||
|
|
||||||
function doFilter () {
|
function doFilter () {
|
||||||
$(".books").removeClass("filtered");
|
$(".books").removeClass("filtered");
|
||||||
if (jQuery.isEmptyObject(filterList)) return;
|
if (jQuery.isEmptyObject(filterList)) { return; }
|
||||||
|
|
||||||
$(".se").each (function(){
|
$(".se").each (function(){
|
||||||
var taglist = ", " + $(this).text() + ", ";
|
var taglist = ", " + $(this).text() + ", ";
|
||||||
|
@ -136,7 +136,7 @@ function doFilter () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (toBeFiltered) $(this).parents (".books").addClass ("filtered");
|
if (toBeFiltered) { $(this).parents (".books").addClass ("filtered"); }
|
||||||
});
|
});
|
||||||
updateFilters ();
|
updateFilters ();
|
||||||
}
|
}
|
||||||
|
@ -157,10 +157,10 @@ function updateFilters () {
|
||||||
// Update the filter -1 to remove, 1 to add, 0 already there
|
// Update the filter -1 to remove, 1 to add, 0 already there
|
||||||
for (var tag in tagList) {
|
for (var tag in tagList) {
|
||||||
var tagValue = tagList [tag];
|
var tagValue = tagList [tag];
|
||||||
if (tagValue == -1) {
|
if (tagValue === -1) {
|
||||||
$("#filter ul li:contains('" + tag + "')").remove();
|
$("#filter ul li:contains('" + tag + "')").remove();
|
||||||
}
|
}
|
||||||
if (tagValue == 1) {
|
if (tagValue === 1) {
|
||||||
$("#filter ul").append ("<li>" + tag + "</li>");
|
$("#filter ul").append ("<li>" + tag + "</li>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ function updatePage (data) {
|
||||||
var result;
|
var result;
|
||||||
filterList = {};
|
filterList = {};
|
||||||
data ["const"] = currentData ["const"];
|
data ["const"] = currentData ["const"];
|
||||||
if (false && $("section").length && currentData.isPaginated == 0 && data.isPaginated == 0) {
|
if (false && $("section").length && currentData.isPaginated == 0 && data.isPaginated === 0) {
|
||||||
// Partial update (for now disabled)
|
// Partial update (for now disabled)
|
||||||
debug_log ("Partial update");
|
debug_log ("Partial update");
|
||||||
result = templateMain (data);
|
result = templateMain (data);
|
||||||
|
@ -233,8 +233,8 @@ function updatePage (data) {
|
||||||
|
|
||||||
debug_log (elapsed ());
|
debug_log (elapsed ());
|
||||||
|
|
||||||
if ($.cookie('toolbar') == 1) $("#tool").show ();
|
if ($.cookie('toolbar') === 1) { $("#tool").show (); }
|
||||||
if (currentData.containsBook == 1) {
|
if (currentData.containsBook === 1) {
|
||||||
$("#sortForm").show ();
|
$("#sortForm").show ();
|
||||||
$("#filter ul").empty ();
|
$("#filter ul").empty ();
|
||||||
updateFilters ();
|
updateFilters ();
|
||||||
|
@ -243,12 +243,12 @@ function updatePage (data) {
|
||||||
$("#sortForm").hide ();
|
$("#sortForm").hide ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentData.page != 19) ajaxifyLinks ();
|
if (currentData.page !== 19) { ajaxifyLinks (); }
|
||||||
|
|
||||||
$("#sort").click(function(){
|
$("#sort").click(function(){
|
||||||
$('.books').sortElements(function(a, b){
|
$('.books').sortElements(function(a, b){
|
||||||
var test = 1;
|
var test = 1;
|
||||||
if ($("#sortorder").val() == "desc")
|
if ($("#sortorder").val() === "desc")
|
||||||
{
|
{
|
||||||
test = -1;
|
test = -1;
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ function updatePage (data) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (getCurrentOption ("use_fancyapps") == 1) {
|
if (getCurrentOption ("use_fancyapps") === 1) {
|
||||||
$(".fancydetail").click(function(event){
|
$(".fancydetail").click(function(event){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
before = new Date ();
|
before = new Date ();
|
||||||
|
@ -302,7 +302,7 @@ function updatePage (data) {
|
||||||
function ajaxifyLinks () {
|
function ajaxifyLinks () {
|
||||||
if (isPushStateEnabled) {
|
if (isPushStateEnabled) {
|
||||||
var links = $("a[href^='index']");
|
var links = $("a[href^='index']");
|
||||||
if (getCurrentOption ("use_fancyapps") == 1) links = links.not (".fancydetail");
|
if (getCurrentOption ("use_fancyapps") === 1) { links = links.not (".fancydetail"); }
|
||||||
links.click (function (event) {
|
links.click (function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
@ -326,10 +326,10 @@ window.onpopstate = function(event) {
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).keydown(function(e){
|
$(document).keydown(function(e){
|
||||||
if (e.keyCode == 37 && $("#prevLink").length > 0) {
|
if (e.keyCode === 37 && $("#prevLink").length > 0) {
|
||||||
navigateTo ($("#prevLink").attr('href'));
|
navigateTo ($("#prevLink").attr('href'));
|
||||||
}
|
}
|
||||||
if (e.keyCode == 39 && $("#nextLink").length > 0) {
|
if (e.keyCode === 39 && $("#nextLink").length > 0) {
|
||||||
navigateTo ($("#nextLink").attr('href'));
|
navigateTo ($("#nextLink").attr('href'));
|
||||||
}
|
}
|
||||||
});
|
});
|
Loading…
Reference in a new issue