- Timestamp:
- 2012-02-21T16:21:13+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/oran/js/jquery.themeswitcher.min.js
r25017 r25123 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; 2 b.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", 3 buttonpretext:"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", 6 icon:"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")|| 8 b(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("+ 9 a.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", 10 padding:"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)}); 12 this.css("position","relative");this.append(c);this.append(k);return this}})(jQuery); 13 jQuery.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}: 14 decodeURIComponent;return(j=RegExp("(?:^|; )"+encodeURIComponent(b)+"=([^;]*)").exec(document.cookie))?h(j[1]):null}; 1 (function (b) 2 { 3 b.fn.themeswitcher = function (c) 4 { 5 function d(f) 6 { 7 a.onselect !== null && a.onselect(); 8 m.text(a.buttonpretext + " " + f.title); 9 var e = b("<link/>").attr("type", "text/css").attr("rel", "stylesheet"); 10 if(f.url) 11 { 12 e.attr("href", f.url); 13 $.ajax({url:gs.xsltParams.library_name + "?a=g&rt=r&configChangeName=cssTheme&configChangeValue=" + f.url}); 14 } 15 else 16 { 17 e.attr("href", "http://ajax.googleapis.com/ajax/libs/jqueryui/" + a.jqueryuiversion + "/themes/" + f.name + "/jquery-ui.css"); 18 $.ajax({url:gs.xsltParams.library_name + "?a=g&rt=r&configChangeName=cssTheme&configChangeValue=" + "http://ajax.googleapis.com/ajax/libs/jqueryui/" + a.jqueryuiversion + "/themes/" + f.name + "/jquery-ui.css"}); 19 } 20 e.appendTo("head"); 21 b.cookie(a.cookiename, f.name); 22 g.find(".jquery-ui-switcher-title").text(a.buttonpretext + " " + f.title); 23 a.closeonselect && h() 24 } 25 26 function j(f) 27 { 28 var e = null; 29 b.each(l, function (n, i) 30 { 31 if (i.name.toLowerCase() === f.toLowerCase() || i.title.toLowerCase() === f.toLowerCase()) 32 { 33 e = i; 34 return false 35 } 36 }); 37 if (!e) return l[0]; 38 return e 39 } 40 41 function h() 42 { 43 a.onclose !== null && a.onclose(); 44 g.find(".jquery-ui-switcher-list-hldr").slideUp("fast", function () 45 { 46 g.find(".jquery-ui-switcher-link").css( 47 { 48 color: "#666", 49 background: "#eee url(" + a.imgpath + "buttonbg.png) repeat-x 50% 50%" 50 }) 51 }) 52 } 53 var g = this, 54 o = {}, 55 a = { 56 loadtheme: "", 57 height: 200, 58 width: 175, 59 rounded: true, 60 imgpath: "", 61 jqueryuiversion: "1.8.10", 62 initialtext: "Switch Theme", 63 buttonpretext: "Theme:", 64 closeonselect: true, 65 buttonheight: 14, 66 cookiename: "jquery-ui-theme", 67 themes: [], 68 additionalthemes: [], 69 onopen: null, 70 onclose: null, 71 onselect: null 72 }; 73 if (c) 74 { 75 b.each(c, function (f, e) 76 { 77 o[f.toLowerCase()] = e 78 }); 79 b.extend(a, o) 80 } 81 var l = a.themes.length ? a.themes : [ 82 { 83 title: "Black Tie", 84 name: "black-tie", 85 icon: "theme_90_black_tie.png" 86 }, { 87 title: "Blitzer", 88 name: "blitzer", 89 icon: "theme_90_blitzer.png" 90 }, { 91 title: "Cupertino", 92 name: "cupertino", 93 icon: "theme_90_cupertino.png" 94 }, { 95 title: "Dark Hive", 96 name: "dark-hive", 97 icon: "theme_90_dark_hive.png" 98 }, { 99 title: "Dot Luv", 100 name: "dot-luv", 101 icon: "theme_90_dot_luv.png" 102 }, { 103 title: "Eggplant", 104 name: "eggplant", 105 icon: "theme_90_eggplant.png" 106 }, { 107 title: "Excite Bike", 108 name: "excite-bike", 109 icon: "theme_90_excite_bike.png" 110 }, { 111 title: "Flick", 112 name: "flick", 113 icon: "theme_90_flick.png" 114 }, { 115 title: "Hot Sneaks", 116 name: "hot-sneaks", 117 icon: "theme_90_hot_sneaks.png" 118 }, { 119 title: "Humanity", 120 name: "humanity", 121 icon: "theme_90_humanity.png" 122 }, { 123 title: "Le Frog", 124 name: "le-frog", 125 icon: "theme_90_le_frog.png" 126 }, { 127 title: "Mint Choc", 128 name: "mint-choc", 129 icon: "theme_90_mint_choco.png" 130 }, { 131 title: "Overcast", 132 name: "overcast", 133 icon: "theme_90_overcast.png" 134 }, { 135 title: "Pepper Grinder", 136 name: "pepper-grinder", 137 icon: "theme_90_pepper_grinder.png" 138 }, { 139 title: "Redmond", 140 name: "redmond", 141 icon: "theme_90_windoze.png" 142 }, { 143 title: "Smoothness", 144 name: "smoothness", 145 icon: "theme_90_smoothness.png" 146 }, { 147 title: "South Street", 148 name: "south-street", 149 icon: "theme_90_south_street.png" 150 }, { 151 title: "Start", 152 name: "start", 153 icon: "theme_90_start_menu.png" 154 }, { 155 title: "Sunny", 156 name: "sunny", 157 icon: "theme_90_sunny.png" 158 }, { 159 title: "Swanky Purse", 160 name: "swanky-purse", 161 icon: "theme_90_swanky_purse.png" 162 }, { 163 title: "Trontastic", 164 name: "trontastic", 165 icon: "theme_90_trontastic.png" 166 }, { 167 title: "UI Darkness", 168 name: "ui-darkness", 169 icon: "theme_90_ui_dark.png" 170 }, { 171 title: "UI Lightness", 172 name: "ui-lightness", 173 icon: "theme_90_ui_light.png" 174 }, { 175 title: "Vader", 176 name: "vader", 177 icon: "theme_90_black_matte.png" 178 }]; 179 a.additionalthemes.length && b.extend(l, a.additionalthemes); 180 c = { 181 cursor: "pointer", 182 "font-family": "'Trebuchet MS', Verdana, sans-serif", 183 "font-size": "11px", 184 color: "#666", 185 background: "#eee url(" + a.imgpath + "buttonbg.png) repeat-x 50% 50%", 186 border: "1px solid #CCC", 187 "text-decoration": "none", 188 padding: "3px 3px 3px 8px", 189 width: a.width + "px", 190 display: "block", 191 height: a.buttonheight + "px", 192 outline: "0px", 193 "line-height": a.buttonheight + "px" 194 }; 195 if (a.rounded) 196 { 197 c["border-radius"] = "6px"; 198 c["-moz-border-radius"] = "6px"; 199 c["-webkit-border-radius"] = "6px" 200 } 201 c = b("<a/>").addClass("jquery-ui-switcher-link").css(c).bind( 202 { 203 mouseenter: function () 204 { 205 b(this).css( 206 { 207 background: "#eee" 208 }) 209 }, 210 mouseleave: function () 211 { 212 g.find(".jquery-ui-switcher-list-hldr").is(":visible") || b(this).css( 213 { 214 background: "#eee url(" + a.imgpath + "buttonbg.png) repeat-x 50% 50%" 215 }) 216 }, 217 click: function () 218 { 219 if (g.find(".jquery-ui-switcher-list-hldr").is(":visible")) h(); 220 else 221 { 222 a.onopen !== null && a.onopen(); 223 g.find(".jquery-ui-switcher-link").css( 224 { 225 color: "#AAA", 226 background: "#000" 227 }); 228 g.find(".jquery-ui-switcher-list-hldr").slideDown("fast") 229 } 230 } 231 }); 232 var m = b("<span/>").addClass("jquery-ui-switcher-title").appendTo(c); 233 b("<span/>").addClass("jquery-ui-switcher-arrow").css( 234 { 235 "float": "right", 236 width: "16px", 237 height: "16px", 238 background: "url(" + a.imgpath + "icon_color_arrow.gif) no-repeat 50% 50%" 239 }).appendTo(c); 240 if (b.cookie(a.cookiename)) d(j(b.cookie(a.cookiename))); 241 else a.loadtheme.length ? d(j(a.loadtheme)) : m.text(a.initialtext); 242 var k = b("<div/>").addClass("jquery-ui-switcher-list-hldr").css( 243 { 244 width: eval(a.width + 8) + "px", 245 background: "#000", 246 color: "#FFF", 247 "font-family": "'Trebuchet MS', Verdana, sans-serif", 248 "font-size": "12px", 249 border: "1px solid #CCC", 250 "border-top": "none", 251 "z-index": "999999", 252 position: "absolute", 253 top: eval(a.buttonheight + 3) + "px", 254 left: "0px", 255 padding: "3px 3px 3px 0", 256 display: "none" 257 }).bind( 258 { 259 mouseleave: function () 260 { 261 h() 262 } 263 }); 264 if (a.rounded) 265 { 266 k.css("border-radius", "0 0 6px 6px"); 267 k.css("-moz-border-radius", "0 0 6px 6px"); 268 k.css("-webkit-border-radius", "0 0 6px 6px") 269 } 270 var p = b("<ul/>").css( 271 { 272 "list-style": "none", 273 margin: "0", 274 padding: "0", 275 "overflow-y": "auto", 276 "overflow-x": "hidden", 277 height: a.height + "px" 278 }).appendTo(k); 279 b.each(l, function (f, e) 280 { 281 var n = b("<li>").css("height", "90px").appendTo(p), 282 i = b("<a>").css( 283 { 284 display: "block", 285 padding: "5px 3px 5px 5px", 286 "text-decoration": "none", 287 "float": "left", 288 width: "100%", 289 clear: "left" 290 }).bind( 291 { 292 mouseenter: function () 293 { 294 i.css("background", "url(" + a.imgpath + "menuhoverbg.png) repeat-x 50% 50%") 295 }, 296 mouseleave: function () 297 { 298 i.css("background", "none") 299 }, 300 click: function (q) 301 { 302 console.log(b(this).data()); 303 d(b(this).data()); 304 q.preventDefault() 305 } 306 }).attr("href", "#").data(e).appendTo(n); 307 b("<img>").attr("src", a.imgpath + e.icon).attr("title", e.title).css( 308 { 309 "float": "left", 310 "margin-right": "5px", 311 border: "1px solid #333" 312 }).appendTo(i); 313 b("<span>").css( 314 { 315 "float": "left", 316 "padding-top": "5px", 317 color: "#AAA" 318 }).text(e.title).appendTo(i) 319 }); 320 this.css("position", "relative"); 321 this.append(c); 322 this.append(k); 323 return this 324 } 325 })(jQuery); 326 jQuery.cookie = function (b, c, d) 327 { 328 if (arguments.length > 1 && String(c) !== "[object Object]") 329 { 330 d = jQuery.extend( 331 {}, d); 332 if (c === null || c === undefined) d.expires = -1; 333 if (typeof d.expires === "number") 334 { 335 var j = d.expires, 336 h = d.expires = new Date; 337 h.setDate(h.getDate() + j) 338 } 339 c = String(c); 340 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("") 341 } 342 d = c || {}; 343 h = d.raw ? 344 function (g) 345 { 346 return g 347 } : decodeURIComponent; 348 return (j = RegExp("(?:^|; )" + encodeURIComponent(b) + "=([^;]*)").exec(document.cookie)) ? h(j[1]) : null 349 };
Note:
See TracChangeset
for help on using the changeset viewer.