~hrvojem/percona-pam-for-mysql/theme-makefile

« back to all changes in this revision

Viewing changes to doc/source/percona-theme/static/percona.com.js

  • Committer: Hrvoje Matijakovic
  • Date: 2012-06-26 09:58:50 UTC
  • Revision ID: hrvoje.matijakovic@percona.com-20120626095850-0i6i0naq2zd53jwb
* removed theme tracking 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
window.jQuery(function($) {
2
 
 
3
 
 
4
 
 
5
 
function setCookie(c_name, value, expiredays)
6
 
{
7
 
        var exdate = new Date();
8
 
        exdate.setDate(exdate.getDate() + expiredays);
9
 
        document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";path=/;expires=" + exdate.toUTCString());
10
 
}
11
 
 
12
 
function getCookie(c_name)
13
 
{
14
 
        if (document.cookie.length > 0)
15
 
        {
16
 
                c_start = document.cookie.indexOf(c_name + "=");
17
 
                if (c_start != -1)
18
 
                {
19
 
                        c_start = c_start + c_name.length+1;
20
 
                        c_end = document.cookie.indexOf(";",c_start);
21
 
                        if (c_end == -1)
22
 
                        {
23
 
                                c_end = document.cookie.length;
24
 
                        }
25
 
                        return unescape(document.cookie.substring(c_start, c_end));
26
 
                }
27
 
        }
28
 
        return "";
29
 
}
30
 
 
31
 
 
32
 
NAVI = new Object();
33
 
 
34
 
NAVI.CloseTimer = null;
35
 
 
36
 
NAVI.Open = function ( menu_tag, dir )
37
 
{
38
 
  NAVI_CancelTimer();
39
 
  NAVI_Close();
40
 
  SEARCH_CancelTimer();
41
 
  SEARCH_Close();
42
 
  if ('h' == dir)
43
 
  {
44
 
    return;
45
 
  }
46
 
  var pos = $("#navilink-span-"+menu_tag).offset();
47
 
  if (dir=='r')
48
 
  {
49
 
    $("#navi-dropdown-"+menu_tag).css( { "position": "absolute", "left": (pos.left + ($("#navilink-span-"+menu_tag).width()) + 2 - ($("#navi-dropdown-"+menu_tag).width())) + "px", "top": (pos.top + 32) + "px" } );
50
 
  }
51
 
  else
52
 
  {
53
 
    $("#navi-dropdown-"+menu_tag).css( { "position": "absolute", "left": (pos.left) + "px", "top": (pos.top + 32) + "px" } );
54
 
  }
55
 
  $("#navi-dropdown-"+menu_tag).show();
56
 
  $("#navilink-span-"+menu_tag).bind('mouseover',NAVI_CancelTimer);
57
 
  $("#navilink-span-"+menu_tag).bind('mouseout',NAVI_Timer);
58
 
  $("#navi-dropdown-"+menu_tag).bind('mouseover',NAVI_CancelTimer);
59
 
  $("#navi-dropdown-"+menu_tag).bind('mouseout',NAVI_Timer);
60
 
};
61
 
 
62
 
function NAVI_Close()
63
 
{
64
 
  $(".navi-dropdown").hide();
65
 
  $("#menu div").unbind('mouseover');
66
 
  $(".dropdown").unbind('mouseover');
67
 
  $(".dropdown").unbind('mouseout');
68
 
 
69
 
  $("#search-dropdown").hide();
70
 
  $("#searchlink-anchor").unbind('mouseover');
71
 
  $("#searchlink-anchor").unbind('mouseout');
72
 
  $("#search-dropdown").unbind('mouseover');
73
 
  $("#search-dropdown").unbind('mouseout');
74
 
}
75
 
 
76
 
function NAVI_CancelTimer()
77
 
{
78
 
  if (NAVI.CloseTimer!=null)
79
 
  {
80
 
    window.clearTimeout(NAVI.CloseTimer);
81
 
    NAVI.CloseTimer = null;
82
 
  }
83
 
}
84
 
 
85
 
function NAVI_Timer()
86
 
{
87
 
  if (NAVI.CloseTimer==null)
88
 
  {
89
 
    NAVI.CloseTimer = window.setTimeout(NAVI_Close, 300);
90
 
  }
91
 
}
92
 
 
93
 
 
94
 
SUBNAVI = new Object();
95
 
 
96
 
SUBNAVI.Open = function ( menu_tag )
97
 
{
98
 
  if ($("#sidesubnavi-" + menu_tag + ':hidden').length)
99
 
  {
100
 
    $(".sidesubnavi").hide();
101
 
    $("#sidesubnavi-"+menu_tag).show();
102
 
    return false;
103
 
  } else {
104
 
    return true;
105
 
  }
106
 
};
107
 
 
108
 
 
109
 
SEARCH = new Object();
110
 
 
111
 
SEARCH.CloseTimer = null;
112
 
 
113
 
SEARCH.Open = function()
114
 
{
115
 
  NAVI_CancelTimer();
116
 
  NAVI_Close();
117
 
  SEARCH_CancelTimer();
118
 
  SEARCH_Close();
119
 
  var pos = $("#searchlink-anchor").offset();
120
 
  $("#search-dropdown").css( { "position": "absolute", "left": (pos.left - ($("#search-dropdown").width()) + 40) + "px", "top": (pos.top + 36) + "px" } );
121
 
  $("#search-dropdown").show();
122
 
  $("#searchlink-anchor").bind('mouseover',NAVI_CancelTimer);
123
 
  $("#searchlink-anchor").bind('mouseout',NAVI_Timer);
124
 
  $("#search-dropdown").bind('mouseover',NAVI_CancelTimer);
125
 
  $("#search-dropdown").bind('mouseout',NAVI_Timer);
126
 
  $("#search-input")[0].focus();
127
 
};
128
 
 
129
 
function SEARCH_Close()
130
 
{
131
 
  $(".navi-dropdown").hide();
132
 
  $("#menu div").unbind('mouseover');
133
 
  $(".dropdown").unbind('mouseover');
134
 
  $(".dropdown").unbind('mouseout');
135
 
 
136
 
  $("#search-dropdown").hide();
137
 
  $("#searchlink-anchor").unbind('mouseover');
138
 
  $("#searchlink-anchor").unbind('mouseout');
139
 
  $("#search-dropdown").unbind('mouseover');
140
 
  $("#search-dropdown").unbind('mouseout');
141
 
}
142
 
 
143
 
 
144
 
function SEARCH_CancelTimer()
145
 
{
146
 
  if (SEARCH.CloseTimer!=null)
147
 
  {
148
 
    window.clearTimeout(SEARCH.CloseTimer);
149
 
    SEARCH.CloseTimer = null;
150
 
  }
151
 
}
152
 
 
153
 
function SEARCH_Timer()
154
 
{
155
 
  if (SEARCH.CloseTimer==null)
156
 
  {
157
 
    SEARCH.CloseTimer = window.setTimeout(SEARCH_Close, 300);
158
 
  }
159
 
}
160
 
 
161
 
menuImg1 = new Image(); menuImg1.src = 'http://s1.percona.com/ui-dropdown-header-l.png';
162
 
menuImg2 = new Image(); menuImg2.src = 'http://s2.percona.com/ui-dropdown-header-r.png';
163
 
menuImg3 = new Image(); menuImg3.src = 'http://s3.percona.com/ui-dropdown-header-search.png';
164
 
menuImg4 = new Image(); menuImg4.src = 'http://s0.percona.com/ui-dropdown-bg.png';
165
 
menuImg5 = new Image(); menuImg5.src = 'http://s1.percona.com/ui-dropdown-footer.png';
166
 
 
167
 
 
168
 
});
169
 
 
170
 
 
171
 
var Percona = {
172
 
    ssl: false,
173
 
    host: 'www.percona.com'
174
 
};
175
 
/**
176
 
 * @param string selector jQuery selector string
177
 
 */
178
 
Percona.getRecentServerVersion = function(selector)
179
 
{
180
 
    if ('string' != typeof(selector))
181
 
    {
182
 
        alert('Percona.getRecentServerVersion: missed or wrong selector!');
183
 
    }
184
 
    /* Localize jQuery variable */
185
 
    var jQuery;
186
 
    /******** Load jQuery if not present *********/
187
 
    if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2')
188
 
    {
189
 
        var script_tag = document.createElement('script');
190
 
        script_tag.setAttribute("type","text/javascript");
191
 
        script_tag.setAttribute('src', 'http' + (Percona.ssl ? 's' : '') + ':/' + '/ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
192
 
        script_tag.onload = scriptLoadHandler;
193
 
        script_tag.onreadystatechange = function () /* Same thing but for IE */
194
 
        {
195
 
            if (this.readyState == 'complete' || this.readyState == 'loaded')
196
 
            {
197
 
                scriptLoadHandler();
198
 
            }
199
 
        };
200
 
        /* Try to find the head, otherwise default to the documentElement */
201
 
        (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
202
 
    } else {
203
 
        /* The jQuery version on the window is the one we want to use */
204
 
        jQuery = window.jQuery;
205
 
        main();
206
 
    }
207
 
    var scriptLoadHandler_counter = 0;
208
 
    /******** Called once jQuery has loaded ******/
209
 
    function scriptLoadHandler()
210
 
    {
211
 
        if (++scriptLoadHandler_counter > 1)
212
 
        {
213
 
            return;
214
 
        }
215
 
        /* Restore $ and window.jQuery to their previous values and store the
216
 
           new jQuery in our local jQuery variable */
217
 
        jQuery = window.jQuery.noConflict(true);
218
 
        /* Call our main function */
219
 
        main(jQuery);
220
 
    }
221
 
    /******** Our main function ********/
222
 
    function main($)
223
 
    {
224
 
        var fillRecentServerVersion = function($)
225
 
        {
226
 
            if ($(selector).get(0))
227
 
            {
228
 
                $.get('http' + (Percona.ssl ? 's' : '') + ':/' + '/' + Percona.host + '/ajax/server-version/?callback=?', {}, function(json)
229
 
                {
230
 
                    if ('object' == typeof(json) && 'string' == typeof(json.recentServerVersion))
231
 
                    {
232
 
                        $(selector).text(' ' + json.recentServerVersion);
233
 
                    }
234
 
                }, 'jsonp');
235
 
            }
236
 
        };
237
 
        $(document).ready(function()
238
 
        {
239
 
            fillRecentServerVersion(jQuery);
240
 
        });
241
 
    }
242
 
};
243
 
 
244
 
$(document).ready(function(){
245
 
        $(window).bind("resize", resizeWindow);
246
 
        resizeWindow();
247
 
        function resizeWindow() {
248
 
                var win_w = $(window).width();
249
 
                var ribon = $("#support-ribbon");
250
 
                if(win_w < 1265){
251
 
                        if(/mobile/i.test(navigator.userAgent)){
252
 
                                ribon.hide();
253
 
                        }else{
254
 
                                if(ribon.hasClass("vertical")){
255
 
                                        ribon.removeClass("vertical");
256
 
                                        ribon.addClass("horizontal");
257
 
                                }
258
 
                                ribon.css({"left":'50%', "margin-left": '-'+(ribon.width() / 2)+'px'});
259
 
                        }
260
 
                }else{
261
 
                        if(ribon.hasClass("horizontal")){
262
 
                                ribon.addClass("vertical");
263
 
                                ribon.removeClass("horizontal");
264
 
                                ribon.removeAttr("style");
265
 
                        }
266
 
 
267
 
                }
268
 
        }
269
 
});
 
 
b'\\ No newline at end of file'