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

Last change on this file since 7989 was 7989, checked in by Zaphod, 13 years ago

[extension] stripped - first release

File size: 4.3 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_fold = false;
9        if (options.animatedMenu) {
10                if (jQuery.browser.webkit) {
11                        // classic animation do not work with webkit browsers
12                        animation_fold = true;
13                        delay = 900;
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_fold) {
28                                        jQuery("#menubar").show("fold",{horizFirst:true,mode:"show",size:'200'},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_fold) {
38                                        jQuery("#menubar").hide("fold",{horizFirst:true,mode:"hide",size:'10'},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});
107
108
109
110// Thumbnails Block Resize function
111
112function tnb_resize() {
113        if (jQuery("#thumbnails_block2").length != 0) {
114                var tnb_width = 40+180*parseInt((jQuery("#thumbnails_block1").width()-40)/180);
115                jQuery("#thumbnails_block2").css("max-width",tnb_width+"px");
116        };
117}
118
119/**
120 * Cookie plugin
121 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
122 * Dual licensed under the MIT and GPL licenses:
123 */
124jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options=jQuery.extend({},options);options.expires=-1;}
125var 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;}
126expires='; expires='+date.toUTCString();}
127var 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;}}}
128return cookieValue;}};
Note: See TracBrowser for help on using the repository browser.