Skip to content

Commit 0b787f0

Browse files
authored
Merge pull request #173 from theparthshukla/main
Remove unused variables from tool.js
2 parents 3bf7c08 + 6718273 commit 0b787f0

File tree

1 file changed

+10
-57
lines changed

1 file changed

+10
-57
lines changed

gutenbergtozim/templates/js/tools.js

+10-57
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
var sortMethod = "popularity";
22
var booksUrl = "full_by_popularity.js";
33
var bookshelves = "bookshelves.js";
4-
var inBooksLooadingLoop = false;
54
var booksTable = null;
65
var title_dict = null;
76
var globalShelvesTable = null;
@@ -13,21 +12,6 @@ var persist_options = {
1312
debug: true,
1413
};
1514

16-
17-
function queryParams(key) {
18-
var qd = {};
19-
if (location.search) location.search.substr(1).split("&").forEach(function(item) {
20-
var s = item.split("="),
21-
k = s[0],
22-
v = s[1] && decodeURIComponent(s[1]);
23-
(qd[k] = qd[k] || []).push(v)
24-
})
25-
if (key == undefined)
26-
return qd;
27-
else
28-
return qd[key];
29-
}
30-
3115
function getPersistedPage() {
3216
var pp = $("#page_record").val();
3317
try {
@@ -41,19 +25,6 @@ function getPersistedPage() {
4125
}
4226
}
4327

44-
function getRequestedPage() {
45-
var qp = queryParams("page");
46-
try {
47-
return parseInt(qp) - 1;
48-
} catch (e) {
49-
if (qp) {
50-
console.log(e);
51-
console.warn("Unable to work with requested page `" + qp + "`");
52-
}
53-
return 0;
54-
}
55-
}
56-
5728
function onTablePageChange(e, settings, table) {
5829
// record global ref to table
5930
if (table)
@@ -68,25 +39,13 @@ function goToAuthor(name) {
6839
showBooks();
6940
}
7041

71-
function goToTitle(title) {
72-
$("#title_filter").val(title);
73-
}
74-
75-
7642
function minimizeUI() {
7743
console.log("minimizeUI");
7844
$("#hide-precontent").val("true");
7945
$("#hide-precontent").change();
8046
$(".precontent").slideUp(300);
8147
}
8248

83-
function maximizeUI() {
84-
console.log("maximizeUI");
85-
$("#hide-precontent").val("");
86-
$("#hide-precontent").change();
87-
$(".precontent").slideDown(300);
88-
}
89-
9049
function loadScript(url, nodeId, callback) {
9150
console.log("requesting script for #" + nodeId + " from " + url);
9251
if (document.getElementById(nodeId)) {
@@ -197,10 +156,6 @@ function is_cover_page() {
197156
return $("body").hasClass("cover");
198157
}
199158

200-
function is_bookshelf_page() {
201-
return $("body").hasClass("individual_book_shelf");
202-
}
203-
204159
function is_bookshelves_page() {
205160
return $('#bookshelvesDisplay').length != 0;
206161
}
@@ -234,7 +189,7 @@ function showBooks() {
234189

235190
$(document).ready(function() {
236191
booksTable = $("#books_table").dataTable({
237-
initComplete: function(settings, json) {
192+
initComplete: function() {
238193
var requestedPage = getPersistedPage();
239194
if (requestedPage) {
240195
this.api()
@@ -269,7 +224,7 @@ function showBooks() {
269224
},
270225
{
271226
targets: 0,
272-
render: function(data, type, full, meta) {
227+
render: function(data, type, full) {
273228
img = '<img class="pure-u-1-8 book-cover-pre" src= "' + full[3] + '_cover_image.jpg"' +
274229
'onerror="this.onerror=null;this.style.height=\'50px\';this.src=\'' + 'favicon.png\'" >';
275230
div = '<div class="list-stripe"></div>';
@@ -292,13 +247,13 @@ function showBooks() {
292247
},
293248
{
294249
targets: 1,
295-
render: function(data, type, full, meta) {
250+
render: function() {
296251
return "";
297252
}
298253
},
299254
{
300255
targets: 2,
301-
render: function(data, type, full, meta) {
256+
render: function(data, type, full) {
302257
var html = "";
303258
var urlBase =
304259
full[0].replace("/", "-").substring(0, 230) + "." + full[3];
@@ -353,7 +308,6 @@ function showBooks() {
353308
);
354309
} else if (event.which == 2) {
355310
/* Middle click */
356-
var href = $(this).attr("data-href");
357311
var link = $(
358312
"<a href='" +
359313
encodeURIComponent(titre.replace("/", "-").substring(0, 230)) +
@@ -428,7 +382,7 @@ function showBookshelf(bookshelfURL) {
428382

429383
$(document).ready(function() {
430384
booksTable = $("#books_table").dataTable({
431-
initComplete: function(settings, json) {
385+
initComplete: function() {
432386
var requestedPage = getPersistedPage();
433387
if (requestedPage) {
434388
this.api()
@@ -463,7 +417,7 @@ function showBookshelf(bookshelfURL) {
463417
},
464418
{
465419
targets: 0,
466-
render: function(data, type, full, meta) {
420+
render: function(data, type, full) {
467421
img = '<img class="pure-u-1-8 book-cover-pre" src= "' + full[3] + '_cover_image.jpg"' +
468422
'onerror="this.onerror=null;this.style.height=\'50px\';this.src=\'' + 'favicon.png\'" >';
469423
div = '<div class="list-stripe"></div>';
@@ -486,13 +440,13 @@ function showBookshelf(bookshelfURL) {
486440
},
487441
{
488442
targets: 1,
489-
render: function(data, type, full, meta) {
443+
render: function() {
490444
return "";
491445
}
492446
},
493447
{
494448
targets: 2,
495-
render: function(data, type, full, meta) {
449+
render: function(data, type, full) {
496450
var html = "";
497451
var urlBase =
498452
full[0].replace("/", "-").substring(0, 230) + "." + full[3];
@@ -547,7 +501,6 @@ function showBookshelf(bookshelfURL) {
547501
);
548502
} else if (event.which == 2) {
549503
/* Middle click */
550-
var href = $(this).attr("data-href");
551504
var link = $(
552505
"<a href='" +
553506
encodeURIComponent(titre.replace("/", "-").substring(0, 230)) +
@@ -600,7 +553,7 @@ function onLocalized() {
600553
// console.debug("no persisted lang or equal to browser, updating select");
601554
l10nselect.val(detectedLang);
602555
}
603-
l10nselect.on("change", function(e) {
556+
l10nselect.on("change", function() {
604557
// console.debug("on change, setting lang " + $(this).val());
605558
$.persistValue("l10nselect", $(this).val(), persist_options);
606559
l10n.setLanguage($(this).val());
@@ -654,7 +607,7 @@ function init() {
654607
create_options(language_filter, languages_json_data);
655608
}
656609

657-
language_filter.on("change", function(e) {
610+
language_filter.on("change", function() {
658611
minimizeUI();
659612
if (globalShelvesTable == null) {
660613
showBooks();

0 commit comments

Comments
 (0)