source: extensions/Autosize/js/autosizeDetect.js @ 19910

Last change on this file since 19910 was 19910, checked in by cljosse, 11 years ago

[extensions] Autosize fix bug crop

File size: 2.4 KB
Line 
1
2function on_load() {
3  var myWidth = 0, myHeight = 0, myImgWidth =0,  myImgHeight = 0;
4  if (typeof (window.innerWidth) == 'number') {
5    //Non-IE
6    myWidth = window.innerWidth;
7    myHeight = window.innerHeight;
8  } else if (document.documentElement && (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 && (document.body.clientWidth || document.body.clientHeight)) {
13    //IE 4 compatible
14    myWidth = document.body.clientWidth;
15    myHeight = document.body.clientHeight;
16  }
17  windowWidth =parseInt( myWidth);
18  windowHeight = parseInt(myHeight);
19
20  theImageRight = 2;
21  theImageLeft=261;
22  theImageMargeWidth=0;
23
24  theImageTop =73;
25  theImageBottom = 0;
26  theImageMargeHeight=0;
27  jQuery.cookie('windowHeight', myHeight, { path: COOKIE_PATH  });
28  jQuery.cookie('windowWidth', myWidth, { path: COOKIE_PATH });
29
30  jQuery.cookie('theImageRight', theImageRight, { path: COOKIE_PATH  });
31  jQuery.cookie('theImageLeft',theImageLeft, { path: COOKIE_PATH  });
32  jQuery.cookie('theImageMargeWidth',theImageMargeWidth, { path: COOKIE_PATH  });
33
34  jQuery.cookie('theImageTop',theImageTop, { path: COOKIE_PATH  });
35  jQuery.cookie('theImageBottom',theImageBottom, { path: COOKIE_PATH  });
36  jQuery.cookie('theImageMargeHeight', theImageMargeHeight, { path: COOKIE_PATH });
37/*
38  theImageWidth = windowWidth - theImageRight - theImageLeft - theImageMargeWidth;
39  theImageHeight = windowHeight - theImageTop - theImageBottom - theImageMargeHeight;
40  jQuery.cookie('theImageHeight', theImageHeight, { path: COOKIE_PATH });
41  jQuery.cookie('theImageWidth', theImageWidth, { path: COOKIE_PATH });
42  jQuery.cookie('theMainImageHeight', theMainImageHeight, { path: COOKIE_PATH });
43  jQuery.cookie('theMainImage', theMainImageWidth, { path: COOKIE_PATH });
44*/
45  retval = jQuery.cookie('autosize_reload');
46 retval2=  jQuery.cookie('picture_deriv');
47  if (retval == "ok" && retval2) return;
48
49  jQuery.cookie('autosize_reload', "ok", { path: COOKIE_PATH });
50  if (reload=="true") {
51    //document.location.reload(false); // from cache
52    try {
53
54      var retval = document.location.reload(true);
55    }
56    catch (err) {
57      var retval = window.location.reload();
58    }
59  }
60}
Note: See TracBrowser for help on using the repository browser.