PageSourceSearch

https://queenslibrary.org/modules/custom/qbpl_list/js/qbpl_list_assets.js?tl8z8n

js queenslibrary.org collected 2026-09-24 08:47:36 UTC 14,585 bytes, 297 lines download raw bytes

1
2
3
4(function ($) {
5  //For HERO Carousel Overlay esc key event
6  $(document).keyup(function (e) {
7    if (e.which == 27) { // on esc for hero carousel overlay
8      if (document.getElementById("HomePageVideoOverlay").style.width == "100%")
9        closeHomePageVideoOverlay();
10    }
11  });
12
13  //For Quickview opening on enter event
14  $('.ql-list-wqv-slider .ql-list-card').keypress(function (e) {
15    if (e.which == 13) { //on enter
16      QBPLListQuickView($(this).attr("currBlock"), $(this).attr("blockID"), JSON.parse($(this).attr("data")));
17    }
18  });
19
20  //For QuickView on click
21  $('.ql-list-wqv-slider .ql-list-card').on("click", function (e) {
22    QBPLListQuickView($(this).attr("currBlock"), $(this).attr("blockID"), JSON.parse($(this).attr("data")));
23  });
24
25})(jQuery);
26
27function openHomePageVideoOverlay(dataSource) {
28  (function ($) {
29    if ($(window).width() < 980) {
30      document.getElementById("HomePageVideoOverlayContent").innerHTML = '<iframe src="https://player.vimeo.com/video/' + dataSource + '?autoplay=1&loop=1&autopause=0"' +
31        'width="' + ($(window).width() - 14) + '" height="' + $(window).width() * (3.0 / 4.0) + '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allow=autoplay></iframe>';
32    } else {
33      document.getElementById("HomePageVideoOverlayContent").innerHTML = '<iframe src="https://player.vimeo.com/video/' + dataSource + '?autoplay=1&loop=1&autopause=0"' +
34        'width="980" height="700" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allow=autoplay></iframe>';
35    }
36
37    document.getElementById("HomePageVideoOverlay").style.width = "100%";
38    $("#hero-carousel-toggle").prop("checked", true);
39    // $('.homepage-carousel-thumbnail-slider').slick('slickPause');
40    // $('#homepage_carousel_button_play > i').attr('class', "glyphicon glyphicon-play"); 
41    // $('#playpause_text').html(" Play");
42    $('.homepage-carousel-thumbnail-slider').slick('slickPlay');
43    $('#homepage_carousel_button_play > i').attr('class', "glyphicon glyphicon-pause");
44    $('#playpause_text').html(" Pause");
45  })(jQuery);
46}
47
48
49function closeHomePageVideoOverlay() {
50  (function ($) {
51    document.getElementById("HomePageVideoOverlayContent").innerHTML = "";
52    document.getElementById("HomePageVideoOverlay").style.width = "0%";
53    $("#hero-carousel-toggle").prop("checked", false);
54    // $('.homepage-carousel-thumbnail-slider').slick('slickPlay');
55    // $('#homepage_carousel_button_play > i').attr('class', "glyphicon glyphicon-pause"); 
56    // $('#playpause_text').html(" Pause");
57    $('.homepage-carousel-thumbnail-slider').slick('slickPause');
58    $('#homepage_carousel_button_play > i').attr('class', "glyphicon glyphicon-play");
59    $('#playpause_text').html(" Play");
60  })(jQuery);
61}
62
63function carouselSummaryStrip(html) {
64  var tmp = document.createElement("DIV");
65  tmp.innerHTML = html;
66  return ((tmp.textContent || tmp.innerText).length > 300 ? (tmp.textContent || tmp.innerText).slice(0, 300) + " ..." : (tmp.textContent || tmp.innerText));
67}
68
69function ellipses(text, max) {
70  return text.length > max ? text.slice(0, max) + " ..." : text;
71}
72
73
74function generateAuthorSearch(author) {
75  var currURL = "/search/everything?searchField=" + author + "&category=book&searchFilter=";
76  return currURL;
77}
78
79function getQVRating(currItem, data) {
80  (function ($) {
81    var $star_rating = $('#' + currItem + ' .glyphicon');
82    var SetRatingStar = function () {
83      return $star_rating.each(function () {
84        if ((parseInt(data) + 1) >= parseInt($(this).data('rating'))) {
85          return $(this).addClass('star-yellow');
86        } else {
87          return $(this).removeClass('star-yellow');
88        }
89      });
90    };
91    SetRatingStar();
92    $('#' + currItem).css("width", "" + 20 * parseFloat(data) + "%");
93  })(jQuery);
94}
95
96function closeAndGoNext(id, blockID) {
97  quickViewClose();
98  $('#' + id + '_' + blockID + '_QuickView').next().focus();
99}
100
101//to display QuickView with the given params
102function QBPLListQuickView(currBlock, blockID, data) {
103  var quickView = "";
104  var author = [];
105  var img = data.img.replace('img-category', 'img-node-level').replace('208x178.png', '259x396.png');
106
107  quickView = '<div class="ql-list-qw-wrapper">';
108  quickView += '<div class="ql-list-qw-close row" style=><p><span tabindex="0" role="button" onkeypress="closeAndGoNext(' + data.id + ', \'' + blockID + '\')" onclick="quickViewClose()">X</span></p></div>';
109  quickView += '<div class="ql-list-qw-maincontent row">';
110  quickView += '<div class="col-xs-5 col-sm-4 col-md-3 col-lg-3"><div class="QuickView-img" ><img class="img img-responsive" src="' + img + '" alt="' + data.title + '"></div></div>';
111  quickView += '<div class="kickPopUpInfo col-xs-7 col-sm-8 col-md-4 col-lg-4">';
112  quickView += '<p class="QuickView-type">' + data.type + '</p>';
113  quickView += '<p class="QuickView-title">' + ellipses(data.title, 100) + '</p>';
114
115  if (data.author.length > 1) {
116    author = data.author.split("/");
117
118    if (data.vendor.toLowerCase() == "zinio") {
119      quickView += '<p class="QuickView-summary">' + '<a class="QuickView-author" href="' + generateAuthorSearch(data.author) + '">' + data.author + '</a></p>';
120    } else if (author.length > 1) {//logic to handle foreign language for author
121      quickView += '<p class="QuickView-summary">By ' + author[0] + ' / <a class="QuickView-author" href="' + generateAuthorSearch(author[1]) + '">' + author[1] + '</a></p>';
122    } else {
123      quickView += '<p class="QuickView-summary">By ' + '<a class="QuickView-author" href="' + generateAuthorSearch(author[0]) + '">' + author[0] + '</a></p>';
124    }
125  }
126
127  if (data.vendor.toLowerCase() != "freegal" && data.vendor.toLowerCase() != "zinio" && data.ratings != 0) {
128    quickView += '<p class="QuickView-ratings">' +
129      '<p class="item-rate">' +
130      '<div class="star-ratings star-ratings">' +
131      '<div class="star-ratings-top" id="' + currBlock + '_quickView_rate">' +
132      '<span class="glyphicon glyphicon-star" data-rating="1"></span>' +
133      '<span class="glyphicon glyphicon-star" data-rating="2"></span>' +
134      '<span class="glyphicon glyphicon-star" data-rating="3"></span>' +
135      '<span class="glyphicon glyphicon-star" data-rating="4"></span>' +
136      '<span class="glyphicon glyphicon-star" data-rating="5"></span>' +
137      '</div>' +
138      '<div class="star-ratings-bottom">' +
139      '<span class="glyphicon glyphicon-star"></span>' +
140      '<span class="glyphicon glyphicon-star"></span>' +
141      '<span class="glyphicon glyphicon-star"></span>' +
142      '<span class="glyphicon glyphicon-star"></span>' +
143      '<span class="glyphicon glyphicon-star"></span>' +
144      '</div>' +
145      '</div>' +
146      //'<span class="qv-rating-text"> ('+ data.ratings +' Goodread reviews)</span>'+
147      '</p>' +
148      '</p>';
149  }
150  /*else{
151    quickView += '<p class="QuickView-author">' + data.author + '</p>';
152  }*/
153  quickView += '<div class="quickview-desktop-only">';
154  quickView += '<p class="quickview-desktop-summary QuickView-summary">' + carouselSummaryStrip(data.summary) + ' </p>';
155  //quickView += '<p class="QuickView-link"><a href="'+ data.link +'">View Details</a></p>';
156  if (data.vendor.toLowerCase() != "freegal") {
157    quickView += '<p class="QuickView-link"><a href="' + data.link + '">View Details</a></p>';
158  }
159  quickView += '</div>';
160  quickView += '</div>';
161  quickView += '<div class="quickview-mobile-only col-xs-12">';
162  quickView += '<p class="QuickView-summary">' + carouselSummaryStrip(data.summary) + ' </p>';
163  if (data.vendor.toLowerCase() != "freegal") {
164    quickView += '<p class="QuickView-link" onclick="openCarouselLink(\'' + data.link + '\')"><a>View Details</a></p>';
165  }
166  quickView += '</div>';
167  quickView += '<div class="kickPopUpLocation col-xs-12 col-sm-8 col-md-4 col-lg-4" style="text-align:center">';
168  quickView += '<div id="QuickView-request">';
169
170  //initially created logic for eContent vs regular content
171  /*
172  if(data.vendor.toLowerCase() != "freegal" && data.vendor.toLowerCase() != "overdrive" && 
173    data.vendor.toLowerCase() != "zinio" && data.vendor.toLowerCase() != "axis 360" && data.vendor.toLowerCase() != "indieflix" && data.vendor.toLowerCase() != "playaway"){
174    quickView += '<object id="widgetObj" data="/search/locations/widget?param1='+data.id+'&param2=1" width="400" height="300" style="overflow:hidden; width:400px; height: 300px">';
175    quickView += 'Error: Embedded data could not be displayed.</object>';
176  }else{
177    var learn_more_link = "/help/how-to-access-digital-media";
178    if(data.type.toLowerCase() == "ebook")
179      learn_more_link += "/ebooks";
180    else if(data.type.toLowerCase() == "eaudiobook")
181      learn_more_link += "/audiobooks";
182    else if(data.type.toLowerCase() == "emagazine")
183      learn_more_link += "/emagazines";
184    else if(data.type.toLowerCase() == "streaming video")
185      learn_more_link += "/video";
186    else if(data.type.toLowerCase() == "emusic")
187      learn_more_link += "/digital-music";
188
189    quickView += '<p class="ql-list-qv-emedia-title">ELECTRONIC MEDIA</p>';
190    quickView += '<a class="btn btn-primary" target="_blank" href="'+data.external_link+'">ACCESS NOW</a>';
191    quickView += '<p class="ql-list-qv-emedia-note">You may need a third-party application to access this item. Restrictions apply. <a href="'+learn_more_link+'">Learn more</a></p>';
192  }*/
193  if (data.external_link && data.vendor.toLowerCase() != "freegal") {
194
195    // Removed by Sarun 11/20/2019
196    // quickView += '<object id="widgetObj"  tabindex="0" data="/search/locations/widget?param1='+data.bib_id+'&param2=2&paramOthers='+ data.callNumber +'" style="overflow:hidden; width:400px; height: 350px">';
197    // quickView += 'Error: Embedded data could not be displayed.</object>';
198    quickView += '<script type="text/javascript" src="/modules/custom/qbpl_solr/js/searchGenWidget.js"></script>';
199    quickView += '<script>  ( new _GenerateWidget( \'QuickView-request\' , \'0\' , \'' + data.bib_id + '\' , \'2\' , \'1\' , \'' + data.callNumber + '\' ) )  </script>';
200
201  } else if (data.vendor.toLowerCase() != "freegal") {
202
203    // Removed by Sarun 11/20/2019
204    // quickView += '<object id="widgetObj" tabindex="0" data="/search/locations/widget?param1='+data.bib_id+'&param2=1&paramOthers='+ data.callNumber +'" style="overflow:hidden; width:400px; height: 350px">';
205    // quickView += 'Error: Embedded data could not be displayed.</object>';
206    quickView += '<script type="text/javascript" src="/modules/custom/qbpl_solr/js/searchGenWidget.js"></script>';
207    quickView += '<script>  ( new _GenerateWidget( \'QuickView-request\' , \'0\' , \'' + data.bib_id + '\' , \'1\' , \'1\' , \'' + data.callNumber + '\' ) )  </script>';
208
209  } else {
210    var learn_more_link = "/help/how-to-access-digital-media";
211    if (data.type.toLowerCase() == "ebook")
212      learn_more_link += "/ebooks";
213    else if (data.type.toLowerCase() == "eaudiobook")
214      learn_more_link += "/audiobooks";
215    else if (data.type.toLowerCase() == "emagazine")
216      learn_more_link += "/emagazines";
217    else if (data.type.toLowerCase() == "streaming video")
218      learn_more_link += "/video";
219    else if (data.type.toLowerCase() == "emusic")
220      learn_more_link += "/digital-music";
221
222    quickView += '<p class="ql-list-qv-emedia-title">ELECTRONIC MEDIA</p>';
223    quickView += '<a class="btn btn-primary" target="_blank" href="' + data.external_link + '">ACCESS NOW</a>';
224    quickView += '<p class="ql-list-qv-emedia-note">You may need a third-party application to access this item. Restrictions apply. <a href="' + learn_more_link + '">Learn more</a></p>';
225  }
226
227
228  quickView += '</div>';
229  /*
230  if(data.vendor.toLowerCase() != "freegal" && data.vendor.toLowerCase() != "overdrive" && 
231    data.vendor.toLowerCase() != "zinio" && data.vendor.toLowerCase() != "axis360" && data.vendor.toLowerCase() != "indieflix"){
232    quickView += '<div class="QuickView-callNumber callnumber"><b>Call</b> #:' + data.id + '</div>';
233  }else{
234    if(data.vendor.toLowerCase() != "freegal")
235      quickView += '<div class="ql-list-call-number"><b>Call</b> #:' + data.id + '</div>';
236  }*/
237  quickView += '</div>';
238  quickView += '</div>';
239  quickView += '</div><span id="' + data.id + '_' + blockID + '_QuickView_End" tabindex="0"></span>';
240
241  // Remove by Sarun 11/20/2019
242  // document.getElementById(blockID+"_QuickView").innerHTML = quickView;
243  $('#' + blockID + '_QuickView').html(quickView);
244
245  //only show ratings for books (if ratings == 0 handled in api)
246  if (data.ratings != 0)
247    getQVRating(currBlock + '_quickView_rate', data.ratings);
248
249  //For tooltip 
250  (function ($) {
251    $('.QuickViewWrapper').hide();
252    $('.QuickViewTooltipWrapper').hide();
253    $('.ql-list-default-slider-main-wrapper').css("padding-bottom", "0px");
254    $('.' + currBlock + '_quickview_tip').css("display", "block");
255    $("html, body").animate({ scrollTop: $("#" + currBlock + "_QuickView").offset().top + 300 }, 500);
256    //var offset= $("#"+currBlock+"_QuickView").offset().left + 75 - $('.ql-list-default-view-header').offset().left ;
257    //$('.ql-list-default-slider-quick-view-tip').css("left",offset + "px");
258  })(jQuery);
259  //End of ToolTip
260
261  document.getElementById(blockID + '_QuickView').style.display = "block"; //display the QuickView
262  $('#' + blockID + '_QuickView').focus();
263  $('#' + data.id + '_' + blockID + '_QuickView_End').focus(function () {
264    closeAndGoNext(data.id, blockID);
265  });
266}
267
268//to close the QuickView
269function quickViewClose() {
270  (function ($) {
271    $('.ql-list-default-slider-main-wrapper').css("padding-bottom", "50px");
272    $('.QuickViewWrapper').html('');
273    $('.QuickViewWrapper').hide();
274    $('.QuickViewTooltipWrapper').hide();
275  })(jQuery);
276}
277
278//open link of the carousel
279function openCarouselLink(link) {
280  if (link.includes("freegal"))
281    window.open(link, "_blank");
282  else
283    window.open(link, "_self");
284}
285
286/*
287function openBMMSearchWidgetOption(){
288  var links = ["/search/everything?searchField=*&category=book&searchFilter=%20sm_format:book",
289              "/search/everything?searchField=*&category=book&searchFilter=%20sm_format:movies",
290              "/search/everything?searchField=*&category=book&searchFilter=%20sm_format:sound_recording",
291              "/search/everything?searchField=*&category=book&searchFilter=%20sm_format:periodicals"];
292  var option = document.getElementById("widgetDropdownOptions");
293  var selected = option.options[option.selectedIndex].value;
294  console.log(selected);
295  console.log(links[selected-1]);
296  window.open(links[selected-1],"_self");
297}*/

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.