summaryrefslogtreecommitdiff
path: root/ishtar_common/static/ajax_select/js/bootstrap.js
blob: cb742eaa9f4a3cd14aa477930da713c4712606ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(function(w) {
  /**
   * load jquery and jquery-ui if needed
   */

  function not(thing) {
    return typeof thing === 'undefined';
  }

  function loadJS(src) {
    document.write('<script type="text/javascript"  src="' + src + '"><\/script>');
  }

  function loadCSS(href) {
    var script = document.createElement('link');
    script.href = href;
    script.type = 'text/css';
    script.rel = 'stylesheet';
    document.head.appendChild(script);
  }

  if (not(w.jQuery)) {
    loadJS('//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js');
  }

  if (not(w.jQuery) || not(w.jQuery.ui) || not(w.jQuery.ui.autocomplete)) {
    loadJS('//code.jquery.com/ui/1.10.3/jquery-ui.js');
    loadCSS('//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css');
  }
})(window);