source: extensions/stripped/js/scripts-tcp.js @ 12659

Last change on this file since 12659 was 12659, checked in by Zaphod, 12 years ago

version 2.0.3

File size: 4.1 KB
Line 
1jQuery("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        // gmaps icon
81       
82        var icon_gmaps=jQuery("#icon_gmaps");
83        var text_gmaps=jQuery("#text_gmaps");
84        if ((icon_gmaps.length == 1) && (text_gmaps.length ==1)) {
85                icon_gmaps.text(text_gmaps.text());
86                icon_gmaps.css("text-align","right");
87        }       
88       
89        // bug with MSIE6 & language switch
90       
91        if ((jQuery.browser.msie) && (jQuery.browser.version.substr(0,1) == "6")) {
92                var lswitch = jQuery(".menuf > div > ul");
93                if (lswitch.length==1) {
94                        var flags = lswitch.children("li").children("a");
95                        if (flags.length==2) {
96                                flags.first().remove();
97                        }
98                }
99        }
100       
101});
102
103
104
105// Thumbnails Block Resize function
106
107function tnb_resize() {
108        if (jQuery("#thumbnails_block2").length != 0) {
109                var tnb_width = 40+180*parseInt((jQuery("#thumbnails_block1").width()-40)/180);
110                jQuery("#thumbnails_block2").css("max-width",tnb_width+"px");
111        };
112}
113
114/**
115 * Cookie plugin
116 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
117 * Dual licensed under the MIT and GPL licenses:
118 */
119jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options=jQuery.extend({},options);options.expires=-1;}
120var 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;}
121expires='; expires='+date.toUTCString();}
122var 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;}}}
123return cookieValue;}};
Note: See TracBrowser for help on using the repository browser.