1 | var showtabs; |
---|
2 | var selectedTab; |
---|
3 | var interfaceTimerDelay; |
---|
4 | var isScrollable; |
---|
5 | var zoomMode; |
---|
6 | |
---|
7 | jQuery("document").ready(function(jQuery) { |
---|
8 | |
---|
9 | zoomMode=options.defaultZoomSize; |
---|
10 | |
---|
11 | // display alt from PWG stuffs actions |
---|
12 | |
---|
13 | var stuffs_actions=jQuery(".categoryActions",".stuffs_block .stuffs"); |
---|
14 | |
---|
15 | if (stuffs_actions.length != 0) { |
---|
16 | stuffs_actions.each(function(index) { |
---|
17 | var images=jQuery(this).find("img"); |
---|
18 | if (images.length !=0) { |
---|
19 | images.each(function(index) { |
---|
20 | var alt_text = (jQuery(this).attr("alt")); |
---|
21 | jQuery(this).before(alt_text); |
---|
22 | jQuery(this).parents("li").css("width","auto"); |
---|
23 | jQuery(this).remove(); |
---|
24 | }); |
---|
25 | } |
---|
26 | }); |
---|
27 | } |
---|
28 | |
---|
29 | // gmaps icon |
---|
30 | |
---|
31 | var icon_gmaps=jQuery("#icon_gmaps"); |
---|
32 | var text_gmaps=jQuery("#text_gmaps"); |
---|
33 | if ((icon_gmaps.length == 1) && (text_gmaps.length ==1)) { |
---|
34 | icon_gmaps.text(text_gmaps.text()); |
---|
35 | icon_gmaps.css("text-align","right"); |
---|
36 | icon_gmaps.wrapAll('<li>'); |
---|
37 | } |
---|
38 | |
---|
39 | // Tabs |
---|
40 | |
---|
41 | var tab_loaded=0; |
---|
42 | var delay=400; |
---|
43 | var hfirst; |
---|
44 | if (jQuery.browser.msie) {hfirst=false;} else {hfirst=true;} |
---|
45 | |
---|
46 | var tab_titles=jQuery(".tabTitle"); |
---|
47 | var tab_blocks=jQuery(".tabBlock"); |
---|
48 | var tab_name; |
---|
49 | var tab_start = null; |
---|
50 | |
---|
51 | if (options.defaultTab) { |
---|
52 | if (options.defaultTab != "none") tab_start = options.defaultTab; |
---|
53 | if (options.defaultTab == "last") tab_start = jQuery.cookie("tabactive"); |
---|
54 | } |
---|
55 | |
---|
56 | if ((tab_titles.length != 0) && (tab_titles.length == tab_blocks.length)) { |
---|
57 | |
---|
58 | if (tab_start != null) { |
---|
59 | tab_blocks.each(function(index) { |
---|
60 | jQuery(this).css("display","none"); |
---|
61 | }); |
---|
62 | tab_loaded=1; |
---|
63 | jQuery("#tabs").css("height","auto"); |
---|
64 | |
---|
65 | tab_titles.each(function(index1) { |
---|
66 | tab_name = jQuery(this).attr("name"); |
---|
67 | if (tab_name == tab_start) { |
---|
68 | jQuery(this).addClass("tabSelected"); |
---|
69 | jQuery.cookie("tabactive",jQuery(this).attr("name")); |
---|
70 | var old_selected_tab =-1; |
---|
71 | tab_blocks.each(function(index2) { |
---|
72 | if (index1 == index2) { |
---|
73 | jQuery(this).show(); |
---|
74 | } |
---|
75 | }); |
---|
76 | } |
---|
77 | }); |
---|
78 | |
---|
79 | } |
---|
80 | |
---|
81 | tab_titles.each(function(index1) { |
---|
82 | var tab_title = jQuery(this); |
---|
83 | tab_title.click(function () { |
---|
84 | if (tab_loaded==0) { |
---|
85 | tab_blocks.each(function(index) { |
---|
86 | jQuery(this).css("display","none"); |
---|
87 | }); |
---|
88 | tab_loaded=1; |
---|
89 | jQuery("#tabs").css("height","auto"); |
---|
90 | } |
---|
91 | if (jQuery(this).hasClass("tabSelected")) { |
---|
92 | var tab_title = jQuery(this); |
---|
93 | tab_blocks.each(function(index2) { |
---|
94 | if ((index1 == index2) && (options.animatedTabs)) { |
---|
95 | jQuery(this).slideUp(delay, function() {tab_title.removeClass("tabSelected");}); |
---|
96 | } else { |
---|
97 | jQuery(this).hide(); |
---|
98 | } |
---|
99 | }); |
---|
100 | jQuery.cookie("tabactive",null); |
---|
101 | } else { |
---|
102 | jQuery(this).addClass("tabSelected"); |
---|
103 | jQuery.cookie("tabactive",jQuery(this).attr("name")); |
---|
104 | var old_selected_tab =-1; |
---|
105 | tab_titles.each(function(index2) { |
---|
106 | if ((index1 != index2) && (jQuery(this).hasClass("tabSelected"))) { |
---|
107 | old_selected_tab=index2; |
---|
108 | jQuery(this).removeClass("tabSelected"); |
---|
109 | } |
---|
110 | }); |
---|
111 | tab_blocks.each(function(index2) { |
---|
112 | if (index1 == index2) { |
---|
113 | if ((old_selected_tab == -1) && (options.animatedTabs)) { |
---|
114 | jQuery(this).slideDown(delay); |
---|
115 | } else { |
---|
116 | jQuery(this).show(); |
---|
117 | } |
---|
118 | } |
---|
119 | }); |
---|
120 | tab_blocks.each(function(index2) { |
---|
121 | if (index2 != index1) { |
---|
122 | jQuery(this).hide(); |
---|
123 | } |
---|
124 | }); |
---|
125 | } |
---|
126 | }); |
---|
127 | }); |
---|
128 | } |
---|
129 | |
---|
130 | Init_nav_thumbs(); |
---|
131 | |
---|
132 | |
---|
133 | // Image autosize function inspired from Autosize Plugin (from cljosse) |
---|
134 | var img_W0=0; |
---|
135 | var img_H0=0; |
---|
136 | var img_ratio=0; |
---|
137 | |
---|
138 | if (options.imageAutosize) { |
---|
139 | // Autosize image |
---|
140 | jQuery(window).resize(function () { |
---|
141 | |
---|
142 | var marge_inf_sup = options.imageAutosizeMargin; |
---|
143 | var Hmin = options.imageAutosizeMinHeight; |
---|
144 | |
---|
145 | var ImageContainer; |
---|
146 | |
---|
147 | if (options.imageAutosizeTitle) { |
---|
148 | ImageContainer = jQuery("#theImageAndTitle"); |
---|
149 | } else { |
---|
150 | ImageContainer = jQuery("#theImage"); |
---|
151 | } |
---|
152 | var Image = jQuery("img","#theImg"); |
---|
153 | var TitleBox=jQuery("#imageTitleContainer"); |
---|
154 | |
---|
155 | if (Image.length != 1) { |
---|
156 | if (TitleBox.length !=0) TitleBox.css("width","97%"); |
---|
157 | return; |
---|
158 | } |
---|
159 | |
---|
160 | var marge_inf = ImageContainer.height()-Image.height()+marge_inf_sup; |
---|
161 | var pos0 = jQuery(Image).offset(); |
---|
162 | if (!pos0) return; |
---|
163 | var img_top = Math.round(parseFloat(pos0.top)); |
---|
164 | var win_height = jQuery(window).height(); |
---|
165 | var img_H = win_height - img_top - marge_inf; |
---|
166 | var max_H = img_H; |
---|
167 | |
---|
168 | if (img_W0==0){ |
---|
169 | img_W0=Image.width(); |
---|
170 | img_H0=Image.height(); |
---|
171 | img_ratio=img_W0/img_H0; |
---|
172 | } |
---|
173 | |
---|
174 | if (img_W0 == 0) return; |
---|
175 | |
---|
176 | if (img_H >= img_H0) img_H=img_H0; |
---|
177 | if (img_H <= Hmin) img_H=Hmin; |
---|
178 | |
---|
179 | var img_W = Math.round(parseFloat(img_H * img_ratio)); |
---|
180 | |
---|
181 | var max_W = jQuery("#content").width() - Image.outerWidth() + Image.width(); |
---|
182 | if (img_W > max_W) { |
---|
183 | var img_H = Math.round(parseFloat(max_W / img_ratio)); |
---|
184 | if (img_H <= Hmin) { |
---|
185 | img_H = Hmin; |
---|
186 | img_W = Math.round(parseFloat(img_H * img_ratio)); |
---|
187 | } else { |
---|
188 | img_W = max_W; |
---|
189 | } |
---|
190 | } |
---|
191 | |
---|
192 | Image.css("width", img_W + "px"); |
---|
193 | Image.css("height", img_H+ "px"); |
---|
194 | |
---|
195 | jQuery.cookie("stripped_max_width",max_W); |
---|
196 | jQuery.cookie("stripped_max_height",max_H); |
---|
197 | |
---|
198 | // limit img title Container width |
---|
199 | |
---|
200 | if (TitleBox.length != 0) { |
---|
201 | TitleBox.css("min-width",jQuery("#theImg").outerWidth()+"px"); |
---|
202 | } |
---|
203 | |
---|
204 | Calc_nav_thumbs_pos(); |
---|
205 | |
---|
206 | return; |
---|
207 | |
---|
208 | }); |
---|
209 | |
---|
210 | jQuery(window).resize(); |
---|
211 | |
---|
212 | } else { |
---|
213 | |
---|
214 | var TitleBox=jQuery("#imageTitleContainer"); |
---|
215 | if (TitleBox.length !=0) TitleBox.css("width","97%"); |
---|
216 | |
---|
217 | jQuery(window).resize(function () { |
---|
218 | Calc_nav_thumbs_pos(); |
---|
219 | return; |
---|
220 | }); |
---|
221 | |
---|
222 | } |
---|
223 | |
---|
224 | Calc_nav_thumbs_pos() |
---|
225 | |
---|
226 | }); |
---|
227 | |
---|
228 | function Init_nav_thumbs() { |
---|
229 | var tfade=options.navThumbsFade; |
---|
230 | |
---|
231 | var PrevBoxOut = jQuery("#linkPrevOut"); |
---|
232 | if (PrevBoxOut.length !=0) |
---|
233 | { |
---|
234 | var PrevBoxIn=jQuery("#linkPrevIn"); |
---|
235 | var PrevImgBox=jQuery("#linkPrevIn > .navThumb"); |
---|
236 | var PrevImg=jQuery("#linkPrevIn > .navThumb > img"); |
---|
237 | |
---|
238 | if ((jQuery("#mapPicture").length==0) && (jQuery("#Panorama").length==0) && (jQuery("#pamoorama").length==0)){ |
---|
239 | PrevBoxIn.mouseenter(function(){PrevImg.stop(true, false).animate({opacity:1},tfade);}); |
---|
240 | PrevBoxOut.mouseleave(function(){PrevImg.stop(true, false).animate({opacity:0},tfade);}); |
---|
241 | } else { |
---|
242 | PrevBoxOut.css("display","none"); |
---|
243 | } |
---|
244 | } |
---|
245 | |
---|
246 | var NextBoxOut = jQuery("#linkNextOut"); |
---|
247 | if (NextBoxOut.length !=0) |
---|
248 | { |
---|
249 | var NextBoxIn=jQuery("#linkNextIn"); |
---|
250 | var NextImgBox=jQuery("#linkNextIn > .navThumb"); |
---|
251 | var NextImg=jQuery("#linkNextIn > .navThumb > img"); |
---|
252 | |
---|
253 | if ((jQuery("#mapPicture").length==0) && (jQuery("#Panorama").length==0) && (jQuery("#pamoorama").length==0)){ |
---|
254 | NextBoxIn.mouseenter(function(){NextImg.stop(true, false).animate({opacity:1},tfade);}); |
---|
255 | NextBoxOut.mouseleave(function(){NextImg.stop(true, false).animate({opacity:0},tfade);}); |
---|
256 | } else { |
---|
257 | NextBoxOut.css("display","none"); |
---|
258 | } |
---|
259 | } |
---|
260 | } |
---|
261 | |
---|
262 | function Calc_nav_thumbs_pos() { |
---|
263 | |
---|
264 | var Window = jQuery(window); |
---|
265 | var Content = jQuery("#content"); |
---|
266 | var ImageBox = jQuery("#theImg"); |
---|
267 | var PrevImg=jQuery("#linkPrevIn > .navThumb > img"); |
---|
268 | |
---|
269 | var window_width = Window.width(); |
---|
270 | var content_width = Content.width(); |
---|
271 | var image_width = ImageBox.width(); |
---|
272 | |
---|
273 | var PrevBoxOut = jQuery("#linkPrevOut"); |
---|
274 | if (PrevBoxOut.length !=0) |
---|
275 | { |
---|
276 | if (PrevBoxOut.css("display") != "none") { |
---|
277 | var PrevBoxIn=jQuery("#linkPrevIn"); |
---|
278 | var PrevImgBox=jQuery("#linkPrevIn > .navThumb"); |
---|
279 | var PrevImg=jQuery("#linkPrevIn > .navThumb > img"); |
---|
280 | |
---|
281 | // height |
---|
282 | |
---|
283 | var imgHeight = ImageBox.height()||0; |
---|
284 | PrevBoxOut.css("height",imgHeight+"px"); |
---|
285 | |
---|
286 | var prevImgTopMargin = parseInt( (imgHeight - PrevImgBox.outerHeight()) / 2 ); |
---|
287 | PrevImgBox.css("margin-top",prevImgTopMargin+"px"); |
---|
288 | |
---|
289 | // position |
---|
290 | |
---|
291 | var prevbox_pos1= parseInt( ( content_width - image_width + PrevImg.outerWidth()) / 2 ) + 120; |
---|
292 | var prevbox_pos0= prevbox_pos1 - PrevBoxOut.width(); |
---|
293 | var left_margin = parseInt( ( window_width - content_width ) / 2 ); |
---|
294 | |
---|
295 | if (prevbox_pos0 + left_margin < 0 ) { |
---|
296 | prevbox_pos0 = - left_margin |
---|
297 | prevbox_pos1 = prevbox_pos0 + PrevBoxOut.width(); |
---|
298 | } |
---|
299 | var prevbox_width = prevbox_pos1 - prevbox_pos0; |
---|
300 | |
---|
301 | PrevBoxOut.css("left",prevbox_pos0+"px"); |
---|
302 | PrevBoxOut.css("width",prevbox_width+"px"); |
---|
303 | } |
---|
304 | } |
---|
305 | |
---|
306 | var NextBoxOut = jQuery("#linkNextOut"); |
---|
307 | if (NextBoxOut.length !=0) |
---|
308 | { |
---|
309 | if (NextBoxOut.css("display") != "none") { |
---|
310 | var NextBoxIn=jQuery("#linkNextIn"); |
---|
311 | var NextImgBox=jQuery("#linkNextIn > .navThumb"); |
---|
312 | var NextImg=jQuery("#linkNextIn > .navThumb > img"); |
---|
313 | |
---|
314 | // height |
---|
315 | |
---|
316 | var imgHeight = ImageBox.height()||0; |
---|
317 | NextBoxOut.css("height",imgHeight+"px"); |
---|
318 | |
---|
319 | var nextImgTopMargin = parseInt( (imgHeight - NextImg.outerHeight()) / 2 ); |
---|
320 | NextImgBox.css("margin-top",nextImgTopMargin+"px"); |
---|
321 | |
---|
322 | // position |
---|
323 | |
---|
324 | var nextbox_pos1= parseInt( ( content_width - image_width + NextImg.outerWidth()) / 2 ) + 120; |
---|
325 | var nextbox_pos0= nextbox_pos1 - NextBoxOut.width(); |
---|
326 | var right_margin = parseInt( ( window_width - content_width ) / 2 ); |
---|
327 | |
---|
328 | if (nextbox_pos0 + right_margin < 0 ) { |
---|
329 | nextbox_pos0 = - right_margin |
---|
330 | nextbox_pos1 = nextbox_pos0 + NextBoxOut.width(); |
---|
331 | } |
---|
332 | |
---|
333 | var nextbox_width = nextbox_pos1 - nextbox_pos0; |
---|
334 | |
---|
335 | NextBoxOut.css("right",nextbox_pos0+"px"); |
---|
336 | NextBoxOut.css("width",nextbox_width+"px"); |
---|
337 | } |
---|
338 | } |
---|
339 | } |
---|
340 | |
---|
341 | |
---|
342 | // Scripts taken from Gally Theme |
---|
343 | |
---|
344 | function openDisplayHigh(url) |
---|
345 | { |
---|
346 | jQuery('#theImageHigh').css( |
---|
347 | { |
---|
348 | width:jQuery("html").get(0).scrollWidth+"px", |
---|
349 | height:jQuery("html").get(0).scrollHeight+"px", |
---|
350 | display:"block" |
---|
351 | } |
---|
352 | ); |
---|
353 | |
---|
354 | if(jQuery("#theImgHigh").attr('src')=="") |
---|
355 | { |
---|
356 | p = new Object(); |
---|
357 | p.left = ((jQuery(window).width()-jQuery("#theImgHighContainer").attr("clientWidth")-options.paddingContainer*2)/2)+"px"; |
---|
358 | p.top = ((jQuery(window).height()-jQuery("#theImgHighContainer").attr("clientHeight")-options.paddingContainer*2)/2)+"px"; |
---|
359 | |
---|
360 | |
---|
361 | jQuery('#theImgHighContainer') |
---|
362 | .css( |
---|
363 | { |
---|
364 | left:p.left, |
---|
365 | top:p.top, |
---|
366 | padding:options.paddingContainer+"px" |
---|
367 | } |
---|
368 | ); |
---|
369 | |
---|
370 | |
---|
371 | jQuery("#theImgHigh") |
---|
372 | .load( |
---|
373 | function () |
---|
374 | { |
---|
375 | jQuery(document).data("highWidth", jQuery("#theImgHigh").width()); |
---|
376 | jQuery(document).data("highHeight", jQuery("#theImgHigh").height()); |
---|
377 | |
---|
378 | p=calcImgHighPositionAndSize(zoomMode); |
---|
379 | |
---|
380 | jQuery('#theImgHighContainer').css("background-image", "none") |
---|
381 | displayZoomHigh(); |
---|
382 | jQuery("#theImgHigh").css( {display:"block"} ); |
---|
383 | } |
---|
384 | ) |
---|
385 | .attr('src', url); |
---|
386 | |
---|
387 | if(options.highResClickMode=='close') |
---|
388 | { |
---|
389 | jQuery("#theImgHigh").bind('click', closeDisplayHigh); |
---|
390 | } |
---|
391 | else |
---|
392 | { |
---|
393 | // switch zoom |
---|
394 | jQuery("#theImgHigh").bind('click', switchZoomHigh); |
---|
395 | } |
---|
396 | } |
---|
397 | else |
---|
398 | { |
---|
399 | p=calcImgHighPositionAndSize(zoomMode); |
---|
400 | |
---|
401 | jQuery('#theImgHighContainer') |
---|
402 | .css( |
---|
403 | { |
---|
404 | left:p.left+"px", |
---|
405 | top:p.top+"px", |
---|
406 | width:p.width+"px", |
---|
407 | height:p.height+"px" |
---|
408 | } |
---|
409 | ); |
---|
410 | } |
---|
411 | } |
---|
412 | |
---|
413 | function calcImgHighPositionAndSize(zoom) |
---|
414 | { |
---|
415 | p = new Object(); |
---|
416 | |
---|
417 | if(zoom=='full') |
---|
418 | { |
---|
419 | p.width = (jQuery("html").get(0).clientWidth-(options.marginContainer+options.paddingContainer)*2); |
---|
420 | p.height = (jQuery("html").get(0).clientHeight-(options.marginContainer+options.paddingContainer)*2); |
---|
421 | p.left=options.marginContainer; |
---|
422 | p.top=options.marginContainer; |
---|
423 | |
---|
424 | if(p.width>jQuery(document).data("highWidth")) |
---|
425 | { |
---|
426 | p.width = jQuery(document).data("highWidth")-options.paddingContainer*2; |
---|
427 | p.left = (jQuery("html").get(0).clientWidth-p.width)/2; |
---|
428 | } |
---|
429 | |
---|
430 | if(p.height>jQuery(document).data("highHeight")) |
---|
431 | { |
---|
432 | p.height = jQuery(document).data("highHeight")-options.paddingContainer*2; |
---|
433 | p.top = (jQuery("html").get(0).clientHeight-p.height)/2; |
---|
434 | } |
---|
435 | } |
---|
436 | else |
---|
437 | { |
---|
438 | //zoom = 'fit' |
---|
439 | ratioImg = jQuery(document).data("highWidth") / jQuery(document).data("highHeight"); |
---|
440 | ratioPage = jQuery("html").get(0).clientWidth / jQuery("html").get(0).clientHeight; |
---|
441 | |
---|
442 | if((ratioPage > 1 && (ratioPage > ratioImg)) || |
---|
443 | (ratioPage < 1 && (ratioPage < ratioImg))) |
---|
444 | { |
---|
445 | p.height = (jQuery("html").get(0).clientHeight-(options.marginContainer+options.paddingContainer)*2); |
---|
446 | p.width = p.height*ratioImg; |
---|
447 | } |
---|
448 | else |
---|
449 | { |
---|
450 | p.width = (jQuery("html").get(0).clientWidth-(options.marginContainer+options.paddingContainer)*2); |
---|
451 | p.height = p.width/ratioImg; |
---|
452 | } |
---|
453 | p.left = (jQuery("html").get(0).clientWidth-p.width)/2; |
---|
454 | p.top = (jQuery("html").get(0).clientHeight-p.height)/2; |
---|
455 | } |
---|
456 | |
---|
457 | return(p); |
---|
458 | } |
---|
459 | |
---|
460 | function closeDisplayHigh() |
---|
461 | { |
---|
462 | jQuery('#theImageHigh').css('display', 'none'); |
---|
463 | } |
---|
464 | |
---|
465 | function switchZoomHigh() |
---|
466 | { |
---|
467 | if(zoomMode=='full') |
---|
468 | { |
---|
469 | zoomMode="fit"; |
---|
470 | } |
---|
471 | else |
---|
472 | { |
---|
473 | zoomMode="full"; |
---|
474 | } |
---|
475 | |
---|
476 | jQuery("#theImgHighZoomButton").toggleClass('full').toggleClass('fit'); |
---|
477 | |
---|
478 | displayZoomHigh(); |
---|
479 | } |
---|
480 | |
---|
481 | function displayZoomHigh() |
---|
482 | { |
---|
483 | p=calcImgHighPositionAndSize(zoomMode); |
---|
484 | |
---|
485 | jQuery('#theImgHighContainer').css( |
---|
486 | { |
---|
487 | left:p.left+"px", |
---|
488 | top:p.top+"px", |
---|
489 | width:p.width+"px", |
---|
490 | height:p.height+"px" |
---|
491 | } |
---|
492 | ); |
---|
493 | |
---|
494 | if(zoomMode=="full") |
---|
495 | { |
---|
496 | jQuery("#theImgHigh") |
---|
497 | .css( |
---|
498 | { |
---|
499 | width:jQuery(document).data("highWidth")+"px", |
---|
500 | height:jQuery(document).data("highHeight")+"px" |
---|
501 | } |
---|
502 | ); |
---|
503 | jQuery('#theImgHighContainer').bind("mousemove", |
---|
504 | function(event) |
---|
505 | { |
---|
506 | deadArea = options.marginContainer*2; |
---|
507 | mouseX=Math.max(Math.min(event.clientX-this.offsetLeft, this.clientWidth - deadArea), deadArea); |
---|
508 | mouseY=Math.max(Math.min(event.clientY-this.offsetTop, this.clientHeight - deadArea), deadArea); |
---|
509 | jQuery("#theImgHigh") |
---|
510 | .css("left",Math.round((jQuery("#theImgHigh").attr("scrollWidth")-this.clientWidth) * -(mouseX-deadArea)/(this.clientWidth-2*deadArea))+"px") |
---|
511 | .css("top",Math.round((jQuery("#theImgHigh").attr("scrollHeight")-this.clientHeight) * -(mouseY-deadArea)/(this.clientHeight-2*deadArea))+"px"); |
---|
512 | } |
---|
513 | ); |
---|
514 | } |
---|
515 | else |
---|
516 | { |
---|
517 | jQuery("#theImgHigh") |
---|
518 | .css( |
---|
519 | { |
---|
520 | width:p.width+"px", |
---|
521 | height:p.height+"px", |
---|
522 | left:"0px", |
---|
523 | top:"0px" |
---|
524 | } |
---|
525 | ); |
---|
526 | jQuery('#theImgHighContainer').unbind("mousemove"); |
---|
527 | } |
---|
528 | } |
---|
529 | /** |
---|
530 | * Cookie plugin |
---|
531 | * Copyright (c) 2006 Klaus Hartl (stilbuero.de) |
---|
532 | * Dual licensed under the MIT and GPL licenses: |
---|
533 | */ |
---|
534 | jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options=jQuery.extend({},options);options.expires=-1;} |
---|
535 | 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;} |
---|
536 | expires='; expires='+date.toUTCString();} |
---|
537 | 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{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]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}} |
---|
538 | return cookieValue;}}; |
---|
539 | |
---|
540 | |
---|
541 | |
---|
542 | |
---|