summaryrefslogtreecommitdiff
path: root/htroot/js/yacysort.js
diff options
context:
space:
mode:
authorluccioman <luccioman@users.noreply.github.com>2017-09-13 08:23:19 +0200
committerluccioman <luccioman@users.noreply.github.com>2017-09-13 08:23:19 +0200
commitc7149acb48172df45f51f763f71c22ba8e0ba142 (patch)
tree56828436793a4cc15697fad3d25c14c376064387 /htroot/js/yacysort.js
parentb50700c35f957d9fe47dcfb7638e8b45ba2dbef6 (diff)
Disabled as default verbose browser console logs in yacysort.js
Diffstat (limited to 'htroot/js/yacysort.js')
-rw-r--r--htroot/js/yacysort.js48
1 files changed, 36 insertions, 12 deletions
diff --git a/htroot/js/yacysort.js b/htroot/js/yacysort.js
index 2c5be23d1..bdd2c7578 100644
--- a/htroot/js/yacysort.js
+++ b/htroot/js/yacysort.js
@@ -23,6 +23,9 @@
var itemCount = 0;
var highestRanking = Infinity;
+/* Set to true to enable browser console log traces */
+var logEnabled = false;
+
var displayPage = function() {
// For every search item that has already been displayed...
$("#resultscontainer").find(".searchresults").each( function(i) {
@@ -65,7 +68,11 @@ var displayPage = function() {
//latestinfo();
- console.log("Showing results " + ($("#resultscontainer").find(".searchresults.earlierpage").length + 1) + " - " + ($("#resultscontainer").find(".searchresults.earlierpage").length + requestedResults) + " out of " + $("#resultscontainer").find(".searchresults").length + "; notEarlierPage = " + $("#resultscontainer").find(".searchresults:not(.earlierpage)").length);
+ if(logEnabled) {
+ console.log("Showing results " + ($("#resultscontainer").find(".searchresults.earlierpage").length + 1)
+ + " - " + ($("#resultscontainer").find(".searchresults.earlierpage").length + requestedResults)
+ + " out of " + $("#resultscontainer").find(".searchresults").length + "; notEarlierPage = " + $("#resultscontainer").find(".searchresults:not(.earlierpage)").length);
+ }
};
var earlierPage = function() {
@@ -80,7 +87,9 @@ var earlierPage = function() {
else {
var earlierItem = allEarlierItems.get().reverse()[ requestedResults - 1 ];
highestRanking = parseFloat($(earlierItem).data("ranking"));
- console.log("highestRanking is now " + highestRanking);
+ if(logEnabled) {
+ console.log("highestRanking is now " + highestRanking);
+ }
}
// Update the display to show the new page.
@@ -99,7 +108,9 @@ var laterPage = function() {
else {
var laterItem = allCurrentAndLaterItems.get(requestedResults);
highestRanking = parseFloat($(laterItem).data("ranking"));
- console.log("highestRanking is now " + highestRanking);
+ if(logEnabled) {
+ console.log("highestRanking is now " + highestRanking);
+ }
}
// Update the display to show the new page.
@@ -127,7 +138,9 @@ var numberedPage = function(pageNumber) {
highestRanking = parseFloat($(item).data("ranking"));
}
- console.log("highestRanking is now " + highestRanking);
+ if(logEnabled) {
+ console.log("highestRanking is now " + highestRanking);
+ }
// Update the display to show the new page.
displayPage();
@@ -141,8 +154,10 @@ var processSidebarNavProtocols = function(navProtocolsOld, navProtocolsNew) {
// Check whether the protocol has been removed in the new sidebar.
if (newProtocol.length === 0) {
- console.log("Deleting nav-protocol...");
- $(oldProtocol).hide(1000);
+ if(logEnabled) {
+ console.log("Deleting nav-protocol...");
+ }
+ $(oldProtocol).hide(1000);
}
} );
@@ -205,23 +220,31 @@ var processSidebar = function(data) {
/*
if( old_sidebar.html() == data ) {
- console.log("Sidebar unchanged.");
+ if(logEnabled) {
+ console.log("Sidebar unchanged.");
+ }
return;
}
*/
/*
if( $.trim(old_sidebar.html()) == $.trim(data) ) {
- console.log("Sidebar unchanged.");
+ if(logEnabled) {
+ console.log("Sidebar unchanged.");
+ }
return;
}
*/
//else if( $.trim(old_sidebar.html()) == $.trim("") ) {
if( oldSidebar.children().length === 0 ) {
- console.log("Initializing sidebar...");
+ if(logEnabled) {
+ console.log("Initializing sidebar...");
+ }
oldSidebar.html(newSidebar.html());
}
else {
- console.log("Sidebar has changed, updating...");
+ if(logEnabled) {
+ console.log("Sidebar has changed, updating...");
+ }
var navProtocolsOld = $("#nav-protocols");
var navProtocolsNew = newSidebar.find("#nav-protocols");
@@ -298,7 +321,6 @@ var processItem = function(data) {
// If we didn't get a valid response from YaCy, wait 1 second and try again.
if( ! newItem.data("ranking") ) {
- //console.log("Got undefined item, waiting 1 second...");
setTimeout(function() {
$.get(
"yacysearchitem.html",
@@ -333,7 +355,9 @@ var processItem = function(data) {
else {
// Insert new item at the end
newItem.appendTo("#resultscontainer");
- console.log("Hiding search result because ranking " + newItem.data("ranking") + " too low.");
+ if(logEnabled) {
+ console.log("Hiding search result because ranking " + newItem.data("ranking") + " too low.");
+ }
return false;
}
}