source: extensions/automatic_size/picture_js.tpl @ 23148

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

add 2 configuration settings to let the webmaster decide of errors margins.

(margins can be negative)

bug fixed: do not hide the check sign in front of "Automatic" option in size
list when the user selects another size.

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