PageSourceSearch

https://webapps.etsu.edu/Advisory/Scripts/script.js

js etsu.edu collected 2026-09-24 08:27:40 UTC 5,216 bytes, 188 lines download raw bytes

1jQuery(document).ready(function ($) {
2  /* toggle nav */
3  $("#menu-icon").on("click", function () {
4    $("#nav").slideToggle();
5  });
6
7  $("#nav").superfish();
8
9  var nav = $('#nav-wrap');
10  if (nav.length) {
11    var navHomeY = nav.offset().top;
12    var isFixed = false;
13    var $w = $(window);
14    $w.scroll(function () {
15      var scrollTop = $w.scrollTop();
16      var shouldBeFixed = scrollTop > navHomeY;
17      if (shouldBeFixed && !isFixed) {
18        nav.css({
19          position: 'fixed',
20          top: 0,
21          left: nav.offset().left,
22          width: $w.width()
23        });
24        isFixed = true;
25      }
26      else if (!shouldBeFixed && isFixed) {
27        nav.css({
28          position: 'static'
29        });
30        isFixed = false;
31      }
32    });
33  }
34
35  autosize($("textarea"));
36
37  $("body").on("focus", "input[type='text']", function () {
38    if (!$(this).hasClass("calendar")) {
39      $(this).select();
40    }
41  });
42
43  // collapsible panels
44  $("body").on("click", ".sectionContainer .titleBar", function () {
45    $(this).next().slideToggle("slow");
46    if ($(this).hasClass("collapsed"))
47      $(this).removeClass("collapsed");
48    else
49      $(this).addClass("collapsed");
50  });
51
52  $("body").on({
53    mouseenter: function () {
54      $(this).addClass("hover");
55    },
56    mouseleave: function () {
57      $(this).removeClass("hover");
58    }
59  }, ".highlighthover");
60
61  var customAlert = function (message) {
62
63    // Modal
64    BootstrapDialog.show({
65      title: "<h4>Information</h4>",
66      message: "<div class='confirm-modal'>" + message + "</div>",
67      onshown: function (dialog) {
68        dialog.getButton("OK").focus();
69      },
70      buttons: [{
71        id: "OK",
72        label: "OK",
73        action: function (dialog) {
74          dialog.close();
75        }
76      }]
77    });
78
79  }
80
81  //show alert
82  var message = document.getElementById('alert').value;
83  if (message != '') {
84    customAlert(message);
85  }
86
87  // Activate Datepicker on all .calendar objects
88
89  $(".no-touchevents").on('click', "input.calendar", function () {
90    $(this).datepicker({
91      constrainInput: false,
92      changeMonth: true,
93      changeYear: true,
94      yearRange: "c-20:c+20",
95      defaultDate: "-0y",
96      onChangeMonthYear: function (year, month, inst) {
97        var curDate = $(this).datepicker("getDate");
98        if (curDate == null)
99          return;
100        if (curDate.getYear() != year || curDate.getMonth() != month - 1) {
101          curDate.setYear(year);
102          curDate.setMonth(month - 1);
103          $(this).datepicker("setDate", curDate);
104        }
105      }
106    }).focus();
107  });
108
109
110  if (document.documentMode != undefined) {
111    $('html').addClass("msie" + document.documentMode);
112  }
113
114  // for <= iOS5, add safari5 class as they render the same
115  if (/(iPhone|iPod|iPad)/i.test(navigator.userAgent)) {
116    if (/OS [2-5]_\d(_\d)? like Mac OS X/i.test(navigator.userAgent)) {
117      $('html').addClass("safari5");
118    }
119  }
120
121  var currentController = $("input#controller").val() + "Controller";
122  $("ul#nav ." + currentController).addClass("current");
123
124  // initialize all typeaheads
125  $('[data-provide=typeahead]').each(function () {
126    var self = $(this);
127
128    var items = self.attr('data-items');
129    var minLength = self.attr('data-minlength');
130    var matcher = self.attr('data-matcher');
131    var sorter = self.attr('data-sorter');
132    var updater = self.attr('data-updater');
133    var highlighter = self.attr('data-highlighter');
134    var typeaheadOptions = {
135      source: function (term, process) {
136        var url = self.data('url');
137
138        return $.getJSON(url, { term: term }, function (data) {
139          return process(data);
140        });
141      },
142      minLength: minLength,
143      matcher: matcher,
144      sorter: sorter,
145      highlighter: highlighter,
146      items: items,
147      updater: updater
148    };
149
150    if (items) typeaheadOptions['items'] = items;
151    if (minLength) typeaheadOptions['minLength'] = minLength;
152    if (matcher) typeaheadOptions['matcher'] = function (item) { window[matcher](item); };
153    if (sorter) typeaheadOptions['sorter'] = function (items) { window[sorter](items); };
154    if (updater) typeaheadOptions['updater'] = function (item) { window[updater](item); };
155    if (highlighter) typeaheadOptions['highlighter'] = function (item) { window[highlighter](item); };
156
157    self.typeahead(typeaheadOptions);
158  });
159
160});
161
162function JQueryLightbox(elementSelector) {
163  $(elementSelector).dialog({
164    modal: true,
165    buttons: {
166      Ok: function () {
167        $(this).dialog("close");
168      }
169    }
170  });
171}
172
173function markInvalid(liItem) {
174  $(liItem).removeClass('valid').addClass('invalid');
175}
176function markValid(liItem) {
177  $(liItem).removeClass('invalid').addClass('valid');
178}
179
180var aAscF = [];
181function sortResults(nr) {
182  aAscF[nr] = aAscF[nr] == 'asc' ? 'desc' : 'asc';
183  $('#sortResultsTable>.sortBody>.rspnd').tsort('section:eq(' + nr + ')[$(this).html()]', { order: aAscF[nr] });
184}
185
186$("#resultsSort").change(function () {
187  sortFaculty($("#resultsSort").val());
188});

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.