@@ -41,7 +41,7 @@ edsConfig.pluginhttppath = "[% PLUGIN_HTTP_PATH %]";
4141var searchBlockCount = 3;
4242
4343// DO NOT TOUCH - controlled by build.py
44- var versionEDSKoha = "21.11004 ";
44+ var versionEDSKoha = "22.11001 ";
4545///////////////////////////////////////
4646
4747if (document.title == "") {
@@ -134,20 +134,32 @@ else { console.log('JS debug enabled') }// keep executing if there is an error.}
134134///// Language data setup /////
135135function getLanguage(code, callback) {
136136 // Use cache
137+ if (edsConfig.logerrors == "yes"){
138+ console.log("Running getLanguage()...");
139+ }
140+
137141 var sessionLang = eds_sessionStorage.get('lang_' + code);
138142 if (sessionLang) {
143+ if (edsConfig.logerrors == "yes"){
144+ console.log("sessionLang is already set...");
145+ }
139146 callback(sessionLang);
140147 return;
141148 // If custom language, and there's no language file for it
142149 } else if (code != 'default' && eds_sessionStorage.get('nolang_' + code)) {
150+ if (edsConfig.logerrors == "yes"){
151+ console.log("sessionLang is not set...");
152+ }
143153 getLanguage('default', callback);
144154 return;
145155 }
146156
147157 // Fetch the language file
148158 jQuery.ajax({ url: "[% PLUGIN_HTTP_PATH %]/bootstrap/includes/lang/" + code + ".inc", dataType: "script", cache: true })
149159 .done(function (data) {
150-
160+ if (edsConfig.logerrors == "yes"){
161+ console.log("Fetching language file...");
162+ }
151163 // Parse language file
152164 var langData = {};
153165 var lineData = data.split("var EDSLANG =")[1].split("\n");
@@ -159,12 +171,17 @@ function getLanguage(code, callback) {
159171 langData[key] = val;
160172 }
161173 }
162-
174+ if (edsConfig.logerrors == "yes"){
175+ console.log("langData: " + langData);
176+ }
163177 eds_sessionStorage.set('lang_' + code, langData);
164178 callback(langData);
165179
166180 // No language file, try default
167181 }).fail(function () {
182+ if (edsConfig.logerrors == "yes"){
183+ console.log("Failed to fetch language file...");
184+ }
168185 if (code == 'default') {
169186 callback(null);
170187 } else {
@@ -339,7 +356,13 @@ function ConfigData(data) {
339356
340357 if (data.defaultsearch != "off") {
341358 var currentDefaultSearchValue = eds_sessionStorage.get('defaultsearch');
359+ if (edsConfig.logerrors == "yes"){
360+ console.log("currentDefaultSearchValue : " + currentDefaultSearchValue);
361+ }
342362 if (!currentDefaultSearchValue) {
363+ if (edsConfig.logerrors == "yes"){
364+ console.log("No currentDefaultSearchValue!");
365+ }
343366 eds_sessionStorage.set('defaultsearch', data.defaultsearch);
344367 }
345368 GoDiscovery();
@@ -443,6 +466,9 @@ function SetEDSOptions(data) {
443466}
444467
445468function SetEDS(showInfo) {
469+ if (edsConfig.logerrors == "yes"){
470+ console.log("In SetEDS...");
471+ }
446472 jQuery('#searchform').submit(function () { return false; });
447473 jQuery('#searchsubmit').click(SearchEDS);
448474 jQuery('#masthead_search option').each(function () { jQuery(this).remove(); });
@@ -455,8 +481,10 @@ function SetEDS(showInfo) {
455481 jQuery('#transl1').removeClass('placeholder');
456482 //advSearch
457483 if (document.URL.indexOf("[% PLUGIN_HTTP_PATH %]/opac/eds-search.pl") != -1 && QueryString('q') == "") {
484+ console.log('koha switchtext');
458485 jQuery('a[href="/cgi-bin/koha/opac-search.pl"]').attr('title', kohaSwitchText);
459- } else if (document.URL.indexOf("/cgi-bin/koha/opac-search.pl") != -1 && QueryString('q') == "") {
486+ } else if (document.URL.indexOf("/cgi-bin/koha/opac-search.pl") != -1 && QueryString('q') == "") {RTCEncodedVideoFrame
487+ console.log('eds switchtext');
460488 jQuery('a[href="/cgi-bin/koha/opac-search.pl"]').attr('title', edsSwitchText);
461489 jQuery('a[href="/cgi-bin/koha/opac-search.pl"]').attr('href', '[% PLUGIN_HTTP_PATH %]/opac/eds-search.pl');
462490 } else {
@@ -467,12 +495,13 @@ function SetEDS(showInfo) {
467495 jQuery('#masthead_search option[value="JN"]').prop('selected', true);
468496 knownItem = "JN";
469497 }
470-
471- EDSAutoComp();
498+ if (edsConfig.autocomplete == "yes") {
499+ EDSAutoComp();
500+ }
472501}
473502
474503function SetKoha(showInfo) {
475- jQuery('#searchform').unbind('submit');
504+ jQuery('#searchform').unbind('submit');EDSAutoComp
476505 jQuery('#searchsubmit').unbind('click');
477506 jQuery('#masthead_search option').each(function () { jQuery(this).remove(); });
478507 if (showInfo) { ShowInfo(kohaSelectInfo); }
@@ -493,6 +522,9 @@ function SetKoha(showInfo) {
493522}
494523
495524function ShowInfo(msg) {
525+ if (edsConfig.logerrors == "yes"){
526+ console.log("In ShowInfo...");
527+ }
496528 var topPos = jQuery('#masthead_search').offset().top;
497529 var leftPos = jQuery('#masthead_search').offset().left;
498530 var cartMsg = jQuery("#cartDetails").html();
@@ -1243,7 +1275,7 @@ function EDSAutoComp() {
12431275 console.log("Running creds false...");
12441276 }
12451277 jQuery.getJSON('[% PLUGIN_HTTP_PATH %]/opac/eds-ac.pl?type=auth', function (data) {
1246- eds_sessionStorage.set('autoComp ', data);
1278+ eds_sessionStorage.set('autoComtranslControl1p ', data);
12471279 eds_sessionStorage.set('autoComp_expiry', Math.round(Date.now() / 1000) + parseInt(data.AuthTimeout) - 30);
12481280 EDSAutoComp();
12491281 if (edsConfig.logerrors == "yes"){
@@ -1255,9 +1287,9 @@ function EDSAutoComp() {
12551287 console.log("Running creds true...");
12561288 console.log("Running autocomplete...");
12571289 }
1258-
12591290 jQuery('#translControl1').autocomplete({
12601291 source: function (request, response) {
1292+ console.log("In function within .autocomplete()...");
12611293 var promise = jQuery.ajax(creds.Autocomplete.Url, {
12621294 data: {
12631295 token: creds.Autocomplete.Token,
@@ -1269,9 +1301,11 @@ function EDSAutoComp() {
12691301 }])
12701302 }
12711303 });
1272-
1304+ console.log("Data in promise: " + promise);
12731305 promise.done(function (data) {
1306+ console.log("promise completed...");
12741307 if (data.error) {
1308+ console.log("data.error : " + data.error);
12751309 eds_sessionStorage.remove('autoComp');
12761310 eds_sessionStorage.remove('autoComp_expiry');
12771311
@@ -1280,6 +1314,7 @@ function EDSAutoComp() {
12801314 var terms = data.terms.map(function (wrapper) {
12811315 return wrapper.term;
12821316 });
1317+ console.log("no data.error, terms : " + terms);
12831318 response(terms);
12841319 }
12851320 });
0 commit comments