PageSourceSearch

https://www.saskatoon.ca/modules/saskatoon_ca/saskatoon_google_search/js/saskatoon-gcs.js?v=1.x

js saskatoon.ca collected 2026-10-01 11:28:50 UTC 2,658 bytes, 80 lines download raw bytes

1// We will have to replace this script when we set up the proper search engine
2// using the city account
3(function (window, document, $) {
4
5  var myCallback = function () {
6    var $stylesheet = $('link[href$="default+en.css"]');
7    $stylesheet.remove();
8
9    //update placeholder text
10    $('input.gsc-input').attr('placeholder', 'Search saskatoon.ca');
11
12    // add input classes
13    var $input = $('td.gsc-input');
14    $input.addClass('form-group');
15    $input.find('input').addClass('form-control');
16
17    // add button classes
18    $('input.gsc-search-button').addClass('btn btn-primary');
19
20    // add sortby
21    var $menuItems = $('.gsc-option-menu-item');
22    var $select = $('<select id="sort-by" class="form-control"></select>');
23    $('.gsc-option-menu-item').each(function () {
24      var text = $(this).text();
25      $select.append('<option>' + text + '</option>');
26    });
27
28    var $sortBy = $('<div id="gsc-sortby" class="form-group"></div>');
29    $sortBy.append('<label for="sort-by" class="control-label">Sort by:</label>');
30    $sortBy.append($select);
31
32    $('.gsc-results-wrapper-nooverlay').prepend($sortBy);
33    //
34    $select.change(function () {
35      var index = this.selectedIndex;
36      $menuItems.find('.gsc-option').eq(index).trigger('click');
37    });
38    //
39    // add categories
40    var $selectCategories = $('<select id="type" class="form-control"></select>');
41    $selectCategories.append('<option>All</option>');
42    $selectCategories.append('<option>Web</option>');
43    $selectCategories.append('<option>Docs</option>');
44    $selectCategories.append('<option>Videos</option>');
45
46    var $categories = $('<div id="gsc-categories" class="form-group"></div>');
47    $categories.append('<label for="type" class="control-label">Type:</label>');
48    $categories.append($selectCategories);
49
50    $('.gsc-results-wrapper-nooverlay').prepend($categories);
51
52    $selectCategories.change(function () {
53      var index = this.selectedIndex;
54      $('.gsc-refinementHeader').eq(index).trigger('click');
55    });
56  };
57
58  window.__gcse = {
59    plainStyle: true,
60    callback: myCallback
61  };
62
63
64  // $(document).ready(function(){
65  //   $('html, body').animate({
66  //     scrollTop: $("#search-results").offset().top+ 100
67  //   }, 100);
68  // })
69
70  var cx = '013718983848700429207:7jny2c8dphg';
71  var gcse = document.createElement('script');
72  gcse.type = 'text/javascript';
73  gcse.async = true;
74  gcse.src = (document.location.protocol === 'https:' ? 'https:' : 'http:') +
75    '//cse.google.com/cse.js?cx=' + cx;
76  var s = document.getElementsByTagName('script')[0];
77  s.parentNode.insertBefore(gcse, s);
78
79
80}(this, this.document, this.jQuery));

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.