Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.142.251.204
/* jQuery plugin themeswitcher
---------------------------------------------------------------------*/
//getting Application path
var css_path = "http://"+window.location.host+"/"+window.location.pathname.split('/')[1]+"/JQGrid3.5/ThemeRoller";
var icon_path = "http://"+window.location.host+"/"+window.location.pathname.split('/')[1]+"/JQGrid3.5/ThemeRoller/Icon";
$.fn.themeswitcher = function(settings){
var options = jQuery.extend({
loadTheme: null,
initialText: 'Switch Theme',
width: 150,
height: 200,
buttonPreText: 'Theme: ',
closeOnSelect: true,
buttonHeight: 14,
cookieName: 'jquery-ui-theme',
onOpen: function(){},
onClose: function(){},
onSelect: function(){}
}, settings);
//markup
var button = $('<a href="#" class="jquery-ui-themeswitcher-trigger"><span class="jquery-ui-themeswitcher-icon"></span><span class="jquery-ui-themeswitcher-title">'+ options.initialText +'</span></a>');
var switcherpane = $('<div class="jquery-ui-themeswitcher"><div id="themeGallery"> <ul> <li><a href="'+css_path+'/Tarka/jquery-ui.css"><img src="'+icon_path+'/redmond.jpg" alt="Tarka" title="Tarka" /><span class="themeName">Tarka</span></a></li><li><a href="'+css_path+'/Lightness/jquery-ui.css"><img src="'+icon_path+'/ui_light.jpg" alt="UI Lightness" title="UI Lightness" /><span class="themeName">Lightness</span></a></li><li><a href="'+css_path+'/Darkness/jquery-ui.css"><img src="'+icon_path+'/ui_dark.jpg" alt="UI Darkness" title="UI Darkness" /><span class="themeName">Darkness</span></a></li><li><a href="'+css_path+'/Smoothness/jquery-ui.css"><img src="'+icon_path+'/smoothness.jpg" alt="Smoothness" title="Smoothness" /><span class="themeName">Smoothness</span></a></li><li><a href="'+css_path+'/Start/jquery-ui.css"><img src="'+icon_path+'/start.jpg" alt="Start" title="Start" /><span class="themeName">Start</span></a></li><li><a href="'+css_path+'/Sunny/jquery-ui.css"><img src="'+icon_path+'/sunny.jpg" alt="Sunny" title="Sunny" /><span class="themeName">Sunny</span></a></li><li><a href="'+css_path+'/Overcast/jquery-ui.css"><img src="'+icon_path+'/overcast.jpg" alt="Overcast" title="Overcast" /><span class="themeName">Overcast</span></a></li><li><a href="'+css_path+'/LeFrog/jquery-ui.css"><img src="'+icon_path+'/frog.jpg" alt="LeFrog" title="Le Frog" /><span class="themeName">LeFrog</span></a></li><li><a href="'+css_path+'/Flick/jquery-ui.css"><img src="'+icon_path+'/flick.jpg" alt="Flick" title="Flick" /><span class="themeName">Flick</span></a></li><li><a href="'+css_path+'/Pepper/jquery-ui.css"><img src="'+icon_path+'/pepper_grinder.jpg" alt="Pepper" title="Pepper Grinder" /><span class="themeName">Pepper</span></a></li><li><a href="'+css_path+'/Eggplant/jquery-ui.css"><img src="'+icon_path+'/eggplant.jpg" alt="Eggplant" title="Eggplant" /><span class="themeName">Eggplant</span></a></li><li><a href="'+css_path+'/DarkHive/jquery-ui.css"><img src="'+icon_path+'/dark_hive.jpg" alt="DarkHive" title="Dark Hive" /><span class="themeName">DarkHive</span></a></li><li><a href="'+css_path+'/Cupertino/jquery-ui.css"><img src="'+icon_path+'/cupertino.jpg" alt="Cupertino" title="Cupertino" /><span class="themeName">Cupertino</span></a></li><li><a href="'+css_path+'/South/jquery-ui.css"><img src="'+icon_path+'/south_street.jpg" alt="South" title="South St" /><span class="themeName">South</span></a></li><li><a href="'+css_path+'/Blitzer/jquery-ui.css"><img src="'+icon_path+'/blitzer.jpg" alt="Blitzer" title="Blitzer" /><span class="themeName">Blitzer</span></a></li><li><a href="'+css_path+'/Humanity/jquery-ui.css"><img src="'+icon_path+'/humanity.jpg" alt="Humanity" title="Humanity" /><span class="themeName">Humanity</span></a></li><li><a href="'+css_path+'/Sneaks/jquery-ui.css"><img src="'+icon_path+'/hot_sneaks.jpg" alt="Sneaks" title="Sneaks" /><span class="themeName">Sneaks</span></a></li><li><a href="'+css_path+'/Excite/jquery-ui.css"><img src="'+icon_path+'/excite_bike.jpg" alt="Excite" title="Excite" /><span class="themeName">Excite</span></a></li><li><a href="'+css_path+'/Vader/jquery-ui.css"><img src="'+icon_path+'/vader.jpg" alt="Vader" title="Vader" /><span class="themeName">Vader</span></a></li><li><a href="'+css_path+'/Dot/jquery-ui.css"><img src="'+icon_path+'/dot_luv.jpg" alt="Dot" title="Dot" /><span class="themeName">Dot</span></a></li><li><a href="'+css_path+'/MintChoc/jquery-ui.css"><img src="'+icon_path+'/mint_choco.jpg" alt="MintChoc" title="Mint Choc" /><span class="themeName">MintChoc</span></a></li><li><a href="'+css_path+'/BlackTie/jquery-ui.css"><img src="'+icon_path+'/black_tie.jpg" alt="BlackTie" title="BlackTie" /><span class="themeName">BlackTie</span></a></li><li><a href="'+css_path+'/Trontastic/jquery-ui.css"><img src="'+icon_path+'/trontastic.jpg" alt="Trontastic" title="Trontastic" /><span class="themeName">Trontastic</span></a></li><li><a href="'+css_path+'/Swanky/jquery-ui.css"><img src="'+icon_path+'/swanky_purse.jpg" alt="Swanky Purse" title="Swanky Purse" /><span class="themeName">Swanky</span></a></li></ul></div></div>').find('div').removeAttr('id');
//button events
button.click(
function(){
if(switcherpane.is(':visible')){ switcherpane.spHide(); }
else{ switcherpane.spShow(); }
return false;
}
);
//menu events (mouseout didn't work...)
switcherpane.hover(
function(){},
function(){if(switcherpane.is(':visible')){$(this).spHide();}}
);
//show/hide panel functions
$.fn.spShow = function(){ $(this).css({top: button.offset().top + options.buttonHeight + 6, left: button.offset().left}).slideDown(50); button.css(button_active); options.onOpen(); }
$.fn.spHide = function(){ $(this).slideUp(50, function(){options.onClose();}); button.css(button_default); }
/* Theme Loading
---------------------------------------------------------------------*/
switcherpane.find('a').click(function(){
updateCSS( $(this).attr('href') );
var themeName = $(this).find('span').text();
button.find('.jquery-ui-themeswitcher-title').text( options.buttonPreText + themeName );
setCookie("jquery-ui-theme_name",themeName,1);
$.cookie(options.cookieName, themeName);
options.onSelect();
if(options.closeOnSelect && switcherpane.is(':visible')){ switcherpane.spHide(); }
return false;
});
//function to append a new theme stylesheet with the new style changes
function updateCSS(locStr){
// console.log(locStr);
var cssLink = $('<link href="'+locStr+'" type="text/css" rel="Stylesheet" class="ui-theme" />');
$("head").append(cssLink);
if( $("link.ui-theme").size() > 3){
$("link.ui-theme:first").remove();
}
}
/* Inline CSS
---------------------------------------------------------------------*/
var button_default = {
fontFamily: 'Trebuchet MS, Verdana, sans-serif',
fontSize: '11px',
color: '#666',
background: '#eee url('+icon_path+'/buttonbg.jpg) 50% 50% repeat-x',
border: '1px solid #ccc',
'-moz-border-radius': '6px',
'-webkit-border-radius': '6px',
textDecoration: 'none',
padding: '3px 3px 3px 8px',
width: options.width - 11,//minus must match left and right padding
display: 'block',
height: options.buttonHeight,
outline: '0'
};
var button_hover = {
'borderColor':'#bbb',
'background': '#f0f0f0',
cursor: 'pointer',
color: '#444'
};
var button_active = {
color: '#aaa',
background: '#000',
border: '1px solid #ccc',
borderBottom: 0,
'-moz-border-radius-bottomleft': 0,
'-webkit-border-bottom-left-radius': 0,
'-moz-border-radius-bottomright': 0,
'-webkit-border-bottom-right-radius': 0,
outline: '0'
};
//button css
button.css(button_default)
.hover(
function(){
$(this).css(button_hover);
},
function(){
if( !switcherpane.is(':animated') && switcherpane.is(':hidden') ){ $(this).css(button_default); }
}
)
.find('.jquery-ui-themeswitcher-icon').css({
float: 'right',
width: '16px',
height: '16px',
background: 'url('+icon_path+'/icon_color_arrow.gif) 50% 50% no-repeat'
});
//pane css
switcherpane.css({
position: 'absolute',
float: 'left',
fontFamily: 'Trebuchet MS, Verdana, sans-serif',
fontSize: '12px',
background: '#000',
color: '#fff',
padding: '8px 3px 3px',
border: '1px solid #ccc',
'-moz-border-radius-bottomleft': '6px',
'-webkit-border-bottom-left-radius': '6px',
'-moz-border-radius-bottomright': '6px',
'-webkit-border-bottom-right-radius': '6px',
borderTop: 0,
zIndex: 999999,
width: options.width-6//minus must match left and right padding
})
.find('ul').css({
listStyle: 'none',
margin: '0',
padding: '0',
overflow: 'auto',
height: options.height
}).end()
.find('li').hover(
function(){
$(this).css({
'borderColor':'#555',
'background': 'url('+icon_path+'/menuhoverbg.jpg) 50% 50% repeat-x',
cursor: 'pointer'
});
},
function(){
$(this).css({
'borderColor':'#111',
'background': '#000',
cursor: 'auto'
});
}
).css({
width: options.width-30,
height: '',
padding: '2px',
margin: '1px',
border: '1px solid #111',
'-moz-border-radius': '4px',
clear: 'left',
float: 'left'
}).end()
.find('a').css({
color: '#aaa',
textDecoration: 'none',
float: 'left',
width: '100%',
outline: '0'
}).end()
.find('img').css({
float: 'left',
border: '1px solid #333',
margin: '0 2px'
}).end()
.find('.themeName').css({
float: 'left',
margin: '3px 0'
}).end();
$(this).append(button);
$('body').append(switcherpane);
switcherpane.hide();
if( $.cookie(options.cookieName) || options.loadTheme ){
var themeName = $.cookie(options.cookieName) || options.loadTheme;
switcherpane.find('a:contains('+ themeName +')').trigger('click');
}
return this;
};
/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
// CAUTION: Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined
// in the packed version for some reason...
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};
|