source: extensions/automatic_size/picture_js.tpl @ 23022

Last change on this file since 23022 was 23022, checked in by plg, 11 years ago

initial import

File size: 1.2 KB
Line 
1{footer_script require='jquery'}{literal}
2jQuery().ready(function() {
3  if (jQuery("#theImage").size() > 0) {
4    function save_available_size() {
5      var width = jQuery("#theImage").width();
6
7      var docHeight = "innerHeight" in window ? window.innerHeight : document.documentElement.offsetHeight;
8      var offset = jQuery("#theImage").offset();
9      var bottomMargin = 40;
10      var height = docHeight - Math.ceil(offset.top) - bottomMargin;
11
12      document.cookie= 'available_size='+width+'x'+height+';path={/literal}{$COOKIE_PATH}{literal}';
13    }
14
15    save_available_size();
16    jQuery(window).resize(function() {
17      save_available_size();
18    });
19
20    jQuery("#aSize").click(function() {
21      var is_automatic_size;
22
23      if (jQuery(this).data("checked") == "yes") {
24        is_automatic_size = "no";
25        jQuery("#aSizeChecked").css("visibility", "hidden");
26      }
27      else {
28        is_automatic_size = "yes";
29        jQuery("#aSizeChecked").css("visibility", "visible");
30      }
31
32      jQuery(this).data("checked", is_automatic_size);
33      document.cookie= 'is_automatic_size='+is_automatic_size+';path={/literal}{$COOKIE_PATH}{literal}';
34    });
35  }
36});
37{/literal}{/footer_script}
Note: See TracBrowser for help on using the repository browser.