1
window.jQuery(function($) {
5
function setCookie(c_name, value, expiredays)
7
var exdate = new Date();
8
exdate.setDate(exdate.getDate() + expiredays);
9
document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";path=/;expires=" + exdate.toUTCString());
12
function getCookie(c_name)
14
if (document.cookie.length > 0)
16
c_start = document.cookie.indexOf(c_name + "=");
19
c_start = c_start + c_name.length+1;
20
c_end = document.cookie.indexOf(";",c_start);
23
c_end = document.cookie.length;
25
return unescape(document.cookie.substring(c_start, c_end));
34
NAVI.CloseTimer = null;
36
NAVI.Open = function ( menu_tag, dir )
46
var pos = $("#navilink-span-"+menu_tag).offset();
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" } );
53
$("#navi-dropdown-"+menu_tag).css( { "position": "absolute", "left": (pos.left) + "px", "top": (pos.top + 32) + "px" } );
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);
64
$(".navi-dropdown").hide();
65
$("#menu div").unbind('mouseover');
66
$(".dropdown").unbind('mouseover');
67
$(".dropdown").unbind('mouseout');
69
$("#search-dropdown").hide();
70
$("#searchlink-anchor").unbind('mouseover');
71
$("#searchlink-anchor").unbind('mouseout');
72
$("#search-dropdown").unbind('mouseover');
73
$("#search-dropdown").unbind('mouseout');
76
function NAVI_CancelTimer()
78
if (NAVI.CloseTimer!=null)
80
window.clearTimeout(NAVI.CloseTimer);
81
NAVI.CloseTimer = null;
87
if (NAVI.CloseTimer==null)
89
NAVI.CloseTimer = window.setTimeout(NAVI_Close, 300);
94
SUBNAVI = new Object();
96
SUBNAVI.Open = function ( menu_tag )
98
if ($("#sidesubnavi-" + menu_tag + ':hidden').length)
100
$(".sidesubnavi").hide();
101
$("#sidesubnavi-"+menu_tag).show();
109
SEARCH = new Object();
111
SEARCH.CloseTimer = null;
113
SEARCH.Open = function()
117
SEARCH_CancelTimer();
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();
129
function SEARCH_Close()
131
$(".navi-dropdown").hide();
132
$("#menu div").unbind('mouseover');
133
$(".dropdown").unbind('mouseover');
134
$(".dropdown").unbind('mouseout');
136
$("#search-dropdown").hide();
137
$("#searchlink-anchor").unbind('mouseover');
138
$("#searchlink-anchor").unbind('mouseout');
139
$("#search-dropdown").unbind('mouseover');
140
$("#search-dropdown").unbind('mouseout');
144
function SEARCH_CancelTimer()
146
if (SEARCH.CloseTimer!=null)
148
window.clearTimeout(SEARCH.CloseTimer);
149
SEARCH.CloseTimer = null;
153
function SEARCH_Timer()
155
if (SEARCH.CloseTimer==null)
157
SEARCH.CloseTimer = window.setTimeout(SEARCH_Close, 300);
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';
173
host: 'www.percona.com'
176
* @param string selector jQuery selector string
178
Percona.getRecentServerVersion = function(selector)
180
if ('string' != typeof(selector))
182
alert('Percona.getRecentServerVersion: missed or wrong selector!');
184
/* Localize jQuery variable */
186
/******** Load jQuery if not present *********/
187
if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2')
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 */
195
if (this.readyState == 'complete' || this.readyState == 'loaded')
200
/* Try to find the head, otherwise default to the documentElement */
201
(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
203
/* The jQuery version on the window is the one we want to use */
204
jQuery = window.jQuery;
207
var scriptLoadHandler_counter = 0;
208
/******** Called once jQuery has loaded ******/
209
function scriptLoadHandler()
211
if (++scriptLoadHandler_counter > 1)
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 */
221
/******** Our main function ********/
224
var fillRecentServerVersion = function($)
226
if ($(selector).get(0))
228
$.get('http' + (Percona.ssl ? 's' : '') + ':/' + '/' + Percona.host + '/ajax/server-version/?callback=?', {}, function(json)
230
if ('object' == typeof(json) && 'string' == typeof(json.recentServerVersion))
232
$(selector).text(' ' + json.recentServerVersion);
237
$(document).ready(function()
239
fillRecentServerVersion(jQuery);