source: extensions/stripped_black_bloc/local_head.tpl @ 11699

Last change on this file since 11699 was 11699, checked in by flop25, 13 years ago

omg i did it ! dynamic generation of thumbnails.tpl
admin page for width and this dynamic generation

File size: 3.4 KB
Line 
1{if ($BODY_ID=='theCategoryPage')}
2{combine_script id='jquery.masonry' load='header' require='jquery' path='themes/stripped_black_bloc/js/masonry.js'}
3{html_head}{literal}
4<style>
5.bloc {
6        width: {/literal}{if $stripped_black_bloc.thumbnail_width}{$stripped_black_bloc.thumbnail_width}{/if}{literal}px;
7}
8.bloc a {
9        max-width:{/literal}{if $stripped_black_bloc.thumbnail_width}{$stripped_black_bloc.thumbnail_width}{/if}{literal}px;
10}
11</style>
12
13<script type="text/javascript">
14/**
15* jQuery Cookie plugin
16*
17* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
18* Dual licensed under the MIT and GPL licenses:
19* http://www.opensource.org/licenses/mit-license.php
20* http://www.gnu.org/licenses/gpl.html
21*
22*/
23jQuery.cookie = function (key, value, options) {
24
25    // key and at least value given, set cookie...
26    if (arguments.length > 1 && String(value) !== "[object Object]") {
27        options = jQuery.extend({}, options);
28
29        if (value === null || value === undefined) {
30            options.expires = -1;
31        }
32
33        if (typeof options.expires === 'number') {
34            var days = options.expires, t = options.expires = new Date();
35            t.setDate(t.getDate() + days);
36        }
37
38        value = String(value);
39
40        return (document.cookie = [
41            encodeURIComponent(key), '=',
42            options.raw ? value : encodeURIComponent(value),
43            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
44            options.path ? '; path=' + options.path : '',
45            options.domain ? '; domain=' + options.domain : '',
46            options.secure ? '; secure' : ''
47        ].join(''));
48    }
49
50    // key and possibly options given, get cookie...
51    options = value || {};
52    var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
53    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
54};
55
56    // MASONRY
57
58function tnb_resize() {
59        $('#subcontent').masonry({
60                columnWidth: {/literal} {if $stripped_black_bloc.column_width}{$stripped_black_bloc.column_width}{/if}{literal},
61                itemSelector: '.bloc, .content_block, .bloc_stuff',
62                isAnimated: true
63        });
64}
65
66
67jQuery(document).ready(function(jQuery){
68
69        // fade onmouseover
70        jQuery(".bloc a").hover(function() { jQuery(this).fadeTo(500, 1); }, function() { jQuery(this).fadeTo(500, 0.75);  });
71
72        // sidemenu managment
73        var sidemenu = jQuery.cookie('side-menu');
74        var isdisplayed;
75                // if cookie says the menu is hiding, keep it hidden!
76        {/literal} {if $stripped.hideMenu} {literal}
77        if (sidemenu == 'showing') {
78                jQuery("#subcontent").css({'margin-left' : '20em'});
79                isdisplayed=true;
80        }
81        else {
82                jQuery("#subcontent").css({'margin-left' : '0'});
83                isdisplayed=false;
84        }
85        {/literal} {else} {literal}
86        if (sidemenu == 'hiding') {
87                jQuery("#subcontent").css({'margin-left' : '0'});
88                isdisplayed=false;
89        }
90        else {
91                jQuery("#subcontent").css({'margin-left' : '20em'});
92                isdisplayed=true;
93        }
94        {/literal} {/if} {literal}
95        // creates a variable with the contents of the cookie side-menu
96        jQuery("#menuswitcher").click(function(){
97                if (jQuery("#menubar").is(":hidden") || isdisplayed==false ) {
98                        jQuery("#subcontent").css({'margin-left' : '20em'});
99                        isdisplayed=true;
100                } else {
101                        jQuery("#subcontent").css({'margin-left' : '0'});
102                        isdisplayed=false;
103                }
104        });
105        tnb_resize();
106
107});
108  </script>
109{/literal}
110{/html_head}
111{/if}
Note: See TracBrowser for help on using the repository browser.