xref: /dokuwiki/lib/scripts/script.js (revision 8707b67124d73a0df1b88c2f0da037aa0fa5ba16)
1// if jQuery was loaded, let's make it noConflict here.
2if ('function' === typeof jQuery && 'function' === typeof jQuery.noConflict) {
3    jQuery.noConflict();
4}
5
6/**
7 * Some browser detection
8 */
9var clientPC  = navigator.userAgent.toLowerCase(); // Get client info
10var is_macos  = navigator.appVersion.indexOf('Mac') != -1;
11var is_gecko  = ((clientPC.indexOf('gecko')!=-1) && (clientPC.indexOf('spoofer')==-1) &&
12                (clientPC.indexOf('khtml') == -1) && (clientPC.indexOf('netscape/7.0')==-1));
13var is_safari = ((clientPC.indexOf('applewebkit')!=-1) && (clientPC.indexOf('spoofer')==-1));
14var is_khtml  = (navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled ));
15if (clientPC.indexOf('opera')!=-1) {
16    var is_opera = true;
17    var is_opera_preseven = (window.opera && !document.childNodes);
18    var is_opera_seven = (window.opera && document.childNodes);
19}
20
21/**
22 * Prints a animated gif to show the search is performed
23 *
24 * Because we need to modify the DOM here before the document is loaded
25 * and parsed completely we have to rely on document.write()
26 *
27 * @author Andreas Gohr <andi@splitbrain.org>
28 */
29function showLoadBar(){
30
31  document.write('<img src="'+DOKU_BASE+'lib/images/loading.gif" '+
32                 'width="150" height="12" alt="..." />');
33
34  /* this does not work reliable in IE
35  obj = $(id);
36
37  if(obj){
38    obj.innerHTML = '<img src="'+DOKU_BASE+'lib/images/loading.gif" '+
39                    'width="150" height="12" alt="..." />';
40    obj.style.display="block";
41  }
42  */
43}
44
45/**
46 * Disables the animated gif to show the search is done
47 *
48 * @author Andreas Gohr <andi@splitbrain.org>
49 */
50function hideLoadBar(id){
51  jQuery('#' + id).hide();
52}
53
54/**
55 * Handler to close all open Popups
56 */
57function closePopups(){
58    jQuery('div.JSpopup').hide();
59}
60
61jQuery(function () {
62    jQuery(document).click(closePopups);
63});
64