source: main/trunk/greenstone3/web/interfaces/oran/js/jquery.themeswitcher.min.js@ 25105

Last change on this file since 25105 was 25017, checked in by sjm84, 12 years ago

Adding in the javascript for the theme switcher

  • Property svn:executable set to *
File size: 6.2 KB
Line 
1(function(b){b.fn.themeswitcher=function(c){function d(f){a.onselect!==null&&a.onselect();m.text(a.buttonpretext+" "+f.title);var e=b("<link/>").attr("type","text/css").attr("rel","stylesheet");f.url?e.attr("href",f.url):e.attr("href","http://ajax.googleapis.com/ajax/libs/jqueryui/"+a.jqueryuiversion+"/themes/"+f.name+"/jquery-ui.css");e.appendTo("head");b.cookie(a.cookiename,f.name);g.find(".jquery-ui-switcher-title").text(a.buttonpretext+" "+f.title);a.closeonselect&&h()}function j(f){var e=null;
2b.each(l,function(n,i){if(i.name.toLowerCase()===f.toLowerCase()||i.title.toLowerCase()===f.toLowerCase()){e=i;return false}});if(!e)return l[0];return e}function h(){a.onclose!==null&&a.onclose();g.find(".jquery-ui-switcher-list-hldr").slideUp("fast",function(){g.find(".jquery-ui-switcher-link").css({color:"#666",background:"#eee url("+a.imgpath+"buttonbg.png) repeat-x 50% 50%"})})}var g=this,o={},a={loadtheme:"",height:200,width:175,rounded:true,imgpath:"",jqueryuiversion:"1.8.10",initialtext:"Switch Theme",
3buttonpretext:"Theme:",closeonselect:true,buttonheight:14,cookiename:"jquery-ui-theme",themes:[],additionalthemes:[],onopen:null,onclose:null,onselect:null};if(c){b.each(c,function(f,e){o[f.toLowerCase()]=e});b.extend(a,o)}var l=a.themes.length?a.themes:[{title:"Black Tie",name:"black-tie",icon:"theme_90_black_tie.png"},{title:"Blitzer",name:"blitzer",icon:"theme_90_blitzer.png"},{title:"Cupertino",name:"cupertino",icon:"theme_90_cupertino.png"},{title:"Dark Hive",name:"dark-hive",icon:"theme_90_dark_hive.png"},
4{title:"Dot Luv",name:"dot-luv",icon:"theme_90_dot_luv.png"},{title:"Eggplant",name:"eggplant",icon:"theme_90_eggplant.png"},{title:"Excite Bike",name:"excite-bike",icon:"theme_90_excite_bike.png"},{title:"Flick",name:"flick",icon:"theme_90_flick.png"},{title:"Hot Sneaks",name:"hot-sneaks",icon:"theme_90_hot_sneaks.png"},{title:"Humanity",name:"humanity",icon:"theme_90_humanity.png"},{title:"Le Frog",name:"le-frog",icon:"theme_90_le_frog.png"},{title:"Mint Choc",name:"mint-choc",icon:"theme_90_mint_choco.png"},
5{title:"Overcast",name:"overcast",icon:"theme_90_overcast.png"},{title:"Pepper Grinder",name:"pepper-grinder",icon:"theme_90_pepper_grinder.png"},{title:"Redmond",name:"redmond",icon:"theme_90_windoze.png"},{title:"Smoothness",name:"smoothness",icon:"theme_90_smoothness.png"},{title:"South Street",name:"south-street",icon:"theme_90_south_street.png"},{title:"Start",name:"start",icon:"theme_90_start_menu.png"},{title:"Sunny",name:"sunny",icon:"theme_90_sunny.png"},{title:"Swanky Purse",name:"swanky-purse",
6icon:"theme_90_swanky_purse.png"},{title:"Trontastic",name:"trontastic",icon:"theme_90_trontastic.png"},{title:"UI Darkness",name:"ui-darkness",icon:"theme_90_ui_dark.png"},{title:"UI Lightness",name:"ui-lightness",icon:"theme_90_ui_light.png"},{title:"Vader",name:"vader",icon:"theme_90_black_matte.png"}];a.additionalthemes.length&&b.extend(l,a.additionalthemes);c={cursor:"pointer","font-family":"'Trebuchet MS', Verdana, sans-serif","font-size":"11px",color:"#666",background:"#eee url("+a.imgpath+
7"buttonbg.png) repeat-x 50% 50%",border:"1px solid #CCC","text-decoration":"none",padding:"3px 3px 3px 8px",width:a.width+"px",display:"block",height:a.buttonheight+"px",outline:"0px","line-height":a.buttonheight+"px"};if(a.rounded){c["border-radius"]="6px";c["-moz-border-radius"]="6px";c["-webkit-border-radius"]="6px"}c=b("<a/>").addClass("jquery-ui-switcher-link").css(c).bind({mouseenter:function(){b(this).css({background:"#eee"})},mouseleave:function(){g.find(".jquery-ui-switcher-list-hldr").is(":visible")||
8b(this).css({background:"#eee url("+a.imgpath+"buttonbg.png) repeat-x 50% 50%"})},click:function(){if(g.find(".jquery-ui-switcher-list-hldr").is(":visible"))h();else{a.onopen!==null&&a.onopen();g.find(".jquery-ui-switcher-link").css({color:"#AAA",background:"#000"});g.find(".jquery-ui-switcher-list-hldr").slideDown("fast")}}});var m=b("<span/>").addClass("jquery-ui-switcher-title").appendTo(c);b("<span/>").addClass("jquery-ui-switcher-arrow").css({"float":"right",width:"16px",height:"16px",background:"url("+
9a.imgpath+"icon_color_arrow.gif) no-repeat 50% 50%"}).appendTo(c);if(b.cookie(a.cookiename))d(j(b.cookie(a.cookiename)));else a.loadtheme.length?d(j(a.loadtheme)):m.text(a.initialtext);var k=b("<div/>").addClass("jquery-ui-switcher-list-hldr").css({width:eval(a.width+8)+"px",background:"#000",color:"#FFF","font-family":"'Trebuchet MS', Verdana, sans-serif","font-size":"12px",border:"1px solid #CCC","border-top":"none","z-index":"999999",position:"absolute",top:eval(a.buttonheight+3)+"px",left:"0px",
10padding:"3px 3px 3px 0",display:"none"}).bind({mouseleave:function(){h()}});if(a.rounded){k.css("border-radius","0 0 6px 6px");k.css("-moz-border-radius","0 0 6px 6px");k.css("-webkit-border-radius","0 0 6px 6px")}var p=b("<ul/>").css({"list-style":"none",margin:"0",padding:"0","overflow-y":"auto","overflow-x":"hidden",height:a.height+"px"}).appendTo(k);b.each(l,function(f,e){var n=b("<li>").css("height","90px").appendTo(p),i=b("<a>").css({display:"block",padding:"5px 3px 5px 5px","text-decoration":"none",
11"float":"left",width:"100%",clear:"left"}).bind({mouseenter:function(){i.css("background","url("+a.imgpath+"menuhoverbg.png) repeat-x 50% 50%")},mouseleave:function(){i.css("background","none")},click:function(q){d(b(this).data());q.preventDefault()}}).attr("href","#").data(e).appendTo(n);b("<img>").attr("src",a.imgpath+e.icon).attr("title",e.title).css({"float":"left","margin-right":"5px",border:"1px solid #333"}).appendTo(i);b("<span>").css({"float":"left","padding-top":"5px",color:"#AAA"}).text(e.title).appendTo(i)});
12this.css("position","relative");this.append(c);this.append(k);return this}})(jQuery);
13jQuery.cookie=function(b,c,d){if(arguments.length>1&&String(c)!=="[object Object]"){d=jQuery.extend({},d);if(c===null||c===undefined)d.expires=-1;if(typeof d.expires==="number"){var j=d.expires,h=d.expires=new Date;h.setDate(h.getDate()+j)}c=String(c);return document.cookie=[encodeURIComponent(b),"=",d.raw?c:encodeURIComponent(c),d.expires?"; expires="+d.expires.toUTCString():"",d.path?"; path="+d.path:"",d.domain?"; domain="+d.domain:"",d.secure?"; secure":""].join("")}d=c||{};h=d.raw?function(g){return g}:
14decodeURIComponent;return(j=RegExp("(?:^|; )"+encodeURIComponent(b)+"=([^;]*)").exec(document.cookie))?h(j[1]):null};
Note: See TracBrowser for help on using the repository browser.