Ignore:
Timestamp:
Apr 25, 2013, 2:56:51 PM (11 years ago)
Author:
cljosse
Message:

[extensions] Autosize update to piwigo 2.5 (fix bugs with pamooramics, charlies's )

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Autosize/js/autosizeDetect.js

    r22218 r22360  
    1 function on_load() {
    2         var myWidth = 0, myHeight = 0;
    3         if (typeof (window.innerWidth) == 'number') {
    4                 // Non-IE
    5                 myWidth = window.innerWidth;
    6                 myHeight = window.innerHeight;
    7         } else if (document.documentElement
     1jQuery(document).ready(function (jQuery) {
     2  jQuery(window).load(function (e) {
     3    var myWidth = 0, myHeight = 0;
     4    if (typeof (window.innerWidth) == 'number') {
     5      // Non-IE
     6      myWidth = window.innerWidth;
     7      myHeight = window.innerHeight;
     8    } else if (document.documentElement
    89                        && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
    9                 // IE 6+ in 'standards compliant mode'
    10                 myWidth = document.documentElement.clientWidth;
    11                 myHeight = document.documentElement.clientHeight;
    12         } else if (document.body
     10      // IE 6+ in 'standards compliant mode'
     11      myWidth = document.documentElement.clientWidth;
     12      myHeight = document.documentElement.clientHeight;
     13    } else if (document.body
    1314                        && (document.body.clientWidth || document.body.clientHeight)) {
    14                 // IE 4 compatible
    15                 myWidth = document.body.clientWidth;
    16                 myHeight = document.body.clientHeight;
    17         }
    18         windowWidth = parseInt(myWidth);
    19         windowHeight = parseInt(myHeight);
    20         theImageRight = 2;
    21         theImageLeft = 261;
    22         theImageMargeWidth = 0;
    23         theImageTop = 73;
    24         theImageBottom = 0;
    25         theImageMargeHeight = 0;
    26         jQuery.cookie('windowHeight', myHeight, {
    27                 path : COOKIE_PATH
    28         });
    29         jQuery.cookie('windowWidth', myWidth, {
    30                 path : COOKIE_PATH
    31         });
    32         jQuery.cookie('theImageRight', theImageRight, {
    33                 path : COOKIE_PATH
    34         });
    35         jQuery.cookie('theImageLeft', theImageLeft, {
    36                 path : COOKIE_PATH
    37         });
    38         jQuery.cookie('theImageMargeWidth', theImageMargeWidth, {
    39                 path : COOKIE_PATH
    40         });
    41         jQuery.cookie('theImageTop', theImageTop, {
    42                 path : COOKIE_PATH
    43         });
    44         jQuery.cookie('theImageBottom', theImageBottom, {
    45                 path : COOKIE_PATH
    46         });
    47         jQuery.cookie('theImageMargeHeight', theImageMargeHeight, {
    48                 path : COOKIE_PATH
    49         });
    50         retval = jQuery.cookie('autosize_reload');
    51         retval2 = jQuery.cookie('picture_deriv');
     15      // IE 4 compatible
     16      myWidth = document.body.clientWidth;
     17      myHeight = document.body.clientHeight;
     18    }
    5219
    53         if (!retval2)
    54           jQuery.cookie('picture_deriv','medium');
    55         //
    56         jQuery.cookie('autosize_reload', "ok", {path : COOKIE_PATH,expires:1});
     20    windowWidth = jQuery(window).width();
     21    windowHeight = jQuery(window).height();
     22    if (windowWidth != myWidth) {
     23      windowWidth = parseInt(myWidth);
     24      windowHeight = parseInt(myHeight);
     25    }
    5726
    58         if (reload == "true") {
    59                 document.location = document.location;
     27    jQuery.cookie('windowHeight', myHeight | 800, {
     28      path: COOKIE_PATH
     29    });
     30    jQuery.cookie('windowWidth', myWidth | 600, {
     31      path: COOKIE_PATH
     32    });
    6033
    61                 return;
    62                 // document.location.reload(false); // from cache
    63                 try {
     34    if (DEBUG_autosize.match(new RegExp("cookies", "gi"))) {
     35      cookies = jQuery.cookie('*');
     36      for (var i in cookies) {
     37        jQuery("div").append("<br>" + i + " = " + cookies[i]);
     38      };
     39    }
     40    jQuery.cookie('autosize_reload', "ok", { path: COOKIE_PATH, expires: 1 });
     41    if (reload == "true") {
     42      document.location = document.location;
     43    }
     44    return;
    6445
    65                         var retval = document.location.reload(true);
    66                 } catch (err) {
    67                         var retval = window.location.reload();
    68                 }
    69         }
    70 }
     46    jQuery.cookie('autosize_reload', "ok", { path: COOKIE_PATH, expires: 1 });
     47    if (reload == "true") {
     48      document.location = document.location;
     49
     50      return;
     51      // document.location.reload(false); // from cache
     52      try {
     53
     54        var retval = document.location.reload(true);
     55      } catch (err) {
     56        var retval = window.location.reload();
     57      }
     58    }
     59  }
     60
     61);
     62});
Note: See TracChangeset for help on using the changeset viewer.