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

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

[extensions] Autosize update to piwigo 2.5 (fix bugs)

File size: 2.0 KB
Line 
1function 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
8                        && (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
13                        && (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');
52
53        if (!retval2)
54          jQuery.cookie('picture_deriv','medium');
55        //
56        jQuery.cookie('autosize_reload', "ok", {path : COOKIE_PATH,expires:1});
57
58        if (reload == "true") {
59                document.location = document.location;
60
61                return;
62                // document.location.reload(false); // from cache
63                try {
64
65                        var retval = document.location.reload(true);
66                } catch (err) {
67                        var retval = window.location.reload();
68                }
69        }
70}
Note: See TracBrowser for help on using the repository browser.