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: "#000",
|
---|
49 | background: "#fff"
|
---|
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: "#000",
|
---|
185 | background: "#fff",
|
---|
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: "#fff"
|
---|
208 | })
|
---|
209 | },
|
---|
210 | mouseleave: function ()
|
---|
211 | {
|
---|
212 | g.find(".jquery-ui-switcher-list-hldr").is(":visible") || b(this).css(
|
---|
213 | {
|
---|
214 | background: "#fff"
|
---|
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 | }; |
---|