@@ -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();
@@ -650,6 +682,9 @@ function QueryString(key) {
650682
651683//BASKET START---------
652684function InitCartWithEDS() {
685+ if (edsConfig.logerrors == "yes"){
686+ console.log("Cart initialized...");
687+ }
653688 jQuery('#addto').change(function () { CheckEDSRecordsforAddToList(); });
654689 jQuery('.addto input:submit').click(function () { CheckEDSRecordsforAddToList(); });
655690
@@ -664,14 +699,18 @@ function InitCartWithEDS() {
664699}
665700
666701async function PrepareItems() {
667-
702+ if (edsConfig.logerrors == "yes"){
703+ console.log("Running PrepareItems()...");
704+ }
668705 //Get Bib numbers from the url
669706 var recordList = document.URL;
670707 recordList = QueryString("bib_list").toString();
671708
672709 //Split bib list into array on /
673710 var recordId = recordList.split("/");
674-
711+ if (edsConfig.logerrors == "yes"){
712+ console.log(recordId);
713+ }
675714 //Iterate through all the record IDs
676715 for (var edsItemCount = 0; edsItemCount < recordId.length - 1; edsItemCount++) {
677716 //Check that it doesn't have the catalogue dbid
@@ -1248,7 +1287,6 @@ function EDSAutoComp() {
12481287 console.log("Running creds true...");
12491288 console.log("Running autocomplete...");
12501289 }
1251-
12521290 jQuery('#translControl1').autocomplete({
12531291 source: function (request, response) {
12541292 var promise = jQuery.ajax(creds.Autocomplete.Url, {
@@ -1262,7 +1300,6 @@ function EDSAutoComp() {
12621300 }])
12631301 }
12641302 });
1265-
12661303 promise.done(function (data) {
12671304 if (data.error) {
12681305 eds_sessionStorage.remove('autoComp');
0 commit comments