1 | jQuery("document").ready(function(jQuery){ |
---|
2 | |
---|
3 | // scripts Category Page ------------------------------------------------------------------------------------------------------------ |
---|
4 | |
---|
5 | // menu switcher script from Simple Theme |
---|
6 | |
---|
7 | var delay; |
---|
8 | var animation_webkit = false; |
---|
9 | if (options.animatedMenu) { |
---|
10 | if (jQuery.browser.webkit) { |
---|
11 | // classic animation do not work with webkit browsers |
---|
12 | animation_webkit = true; |
---|
13 | delay = "slow"; |
---|
14 | } else { |
---|
15 | delay = "slow"; |
---|
16 | } |
---|
17 | } else { |
---|
18 | delay = 0; |
---|
19 | } |
---|
20 | |
---|
21 | jQuery("#menuswitcher").click(function(){ |
---|
22 | if (jQuery("#menubar").is(":hidden")) { |
---|
23 | if (delay == 0) { |
---|
24 | jQuery("#menubar").show(); |
---|
25 | tnb_resize(); |
---|
26 | } else { |
---|
27 | if (animation_webkit) { |
---|
28 | jQuery("#menubar").show("blind",{},delay, function (){tnb_resize();}); |
---|
29 | } else { |
---|
30 | jQuery("#menubar").show(delay, function (){tnb_resize();}); |
---|
31 | } |
---|
32 | } |
---|
33 | jQuery.cookie('side-menu', 'showing', {path: "/"}); |
---|
34 | if (jQuery("#thumbnails_block2").length != 0) tnb_resize(); |
---|
35 | return false; |
---|
36 | } else { |
---|
37 | if (animation_webkit) { |
---|
38 | jQuery("#menubar").hide("blind",{},delay, function (){tnb_resize();}); |
---|
39 | } else { |
---|
40 | jQuery("#menubar").hide(delay, function (){tnb_resize();}); |
---|
41 | } |
---|
42 | jQuery.cookie('side-menu', 'hiding', {path: "/"}); |
---|
43 | return false; |
---|
44 | } |
---|
45 | }); |
---|
46 | |
---|
47 | // creates a variable with the contents of the cookie side-menu |
---|
48 | var sidemenu = jQuery.cookie('side-menu'); |
---|
49 | |
---|
50 | // if cookie says the menu is hiding, keep it hidden! |
---|
51 | if (sidemenu == 'hiding') { |
---|
52 | jQuery("#menubar").hide(); |
---|
53 | } |
---|
54 | if (sidemenu == 'showing') { |
---|
55 | jQuery("#menubar").show(); |
---|
56 | } |
---|
57 | |
---|
58 | // resize thumbnail block |
---|
59 | jQuery(window).resize(function() { tnb_resize(); }); |
---|
60 | tnb_resize(); |
---|
61 | |
---|
62 | // display alt from PWG stuffs actions. |
---|
63 | |
---|
64 | var stuffs_actions=jQuery(".categoryActions",".stuffs_block .stuffs"); |
---|
65 | |
---|
66 | if (stuffs_actions.length != 0) { |
---|
67 | stuffs_actions.each(function(index) { |
---|
68 | var images=jQuery(this).find("img"); |
---|
69 | if (images.length !=0) { |
---|
70 | images.each(function(index) { |
---|
71 | var alt_text = (jQuery(this).attr("alt")); |
---|
72 | jQuery(this).before(alt_text); |
---|
73 | jQuery(this).parents("li").css("width","auto"); |
---|
74 | jQuery(this).remove(); |
---|
75 | }); |
---|
76 | } |
---|
77 | }); |
---|
78 | } |
---|
79 | |
---|
80 | // display alt from ALL actions. |
---|
81 | if (options.replaceActionIcons) { |
---|
82 | var actionBlock=jQuery(".categoryActions"); |
---|
83 | |
---|
84 | if (actionBlock.length != 0) { |
---|
85 | var actionIcons=actionBlock.find("img.button"); |
---|
86 | if (actionIcons.length !=0) { |
---|
87 | actionIcons.each(function(index) { |
---|
88 | var alt_text = (jQuery(this).attr("alt")); |
---|
89 | jQuery(this).before(alt_text); |
---|
90 | jQuery(this).parents("li").css("width","auto"); |
---|
91 | jQuery(this).remove(); |
---|
92 | }); |
---|
93 | } |
---|
94 | } |
---|
95 | } |
---|
96 | |
---|
97 | // gmaps icon |
---|
98 | |
---|
99 | var icon_gmaps=jQuery("#icon_gmaps"); |
---|
100 | var text_gmaps=jQuery("#text_gmaps"); |
---|
101 | if ((icon_gmaps.length == 1) && (text_gmaps.length ==1)) { |
---|
102 | icon_gmaps.text(text_gmaps.text()); |
---|
103 | icon_gmaps.css("text-align","right"); |
---|
104 | } |
---|
105 | |
---|
106 | // bug with MSIE6 & language switch |
---|
107 | |
---|
108 | if ((jQuery.browser.msie) && (jQuery.browser.version.substr(0,1) == "6")) { |
---|
109 | var lswitch = jQuery(".menuf > div > ul"); |
---|
110 | if (lswitch.length==1) { |
---|
111 | var flags = lswitch.children("li").children("a"); |
---|
112 | if (flags.length==2) { |
---|
113 | flags.first().remove(); |
---|
114 | } |
---|
115 | } |
---|
116 | } |
---|
117 | |
---|
118 | }); |
---|
119 | |
---|
120 | |
---|
121 | |
---|
122 | // Thumbnails Block Resize function |
---|
123 | |
---|
124 | function tnb_resize() { |
---|
125 | if (jQuery("#thumbnails_block2").length != 0) { |
---|
126 | var tnb_width = 40+180*parseInt((jQuery("#thumbnails_block1").width()-40)/180); |
---|
127 | jQuery("#thumbnails_block2").css("max-width",tnb_width+"px"); |
---|
128 | }; |
---|
129 | } |
---|
130 | |
---|
131 | /** |
---|
132 | * Cookie plugin |
---|
133 | * Copyright (c) 2006 Klaus Hartl (stilbuero.de) |
---|
134 | * Dual licensed under the MIT and GPL licenses: |
---|
135 | */ |
---|
136 | jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options=jQuery.extend({},options);options.expires=-1;} |
---|
137 | 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;} |
---|
138 | expires='; expires='+date.toUTCString();} |
---|
139 | 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;}}} |
---|
140 | return cookieValue;}}; |
---|