1 | jQuery(document).ready(function (jQuery) { |
---|
2 | jQuery(window).on("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 |
---|
9 | && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { |
---|
10 | // IE 6+ in 'standards compliant mode' |
---|
11 | myWidth = document.documentElement.clientWidth; |
---|
12 | myHeight = document.documentElement.clientHeight; |
---|
13 | } else if (document.body |
---|
14 | && (document.body.clientWidth || document.body.clientHeight)) { |
---|
15 | // IE 4 compatible |
---|
16 | myWidth = document.body.clientWidth; |
---|
17 | myHeight = document.body.clientHeight; |
---|
18 | } |
---|
19 | |
---|
20 | windowWidth = jQuery(window).width(); |
---|
21 | windowHeight = jQuery(window).height(); |
---|
22 | if (windowWidth != myWidth) { |
---|
23 | windowWidth = parseInt(myWidth); |
---|
24 | windowHeight = parseInt(myHeight); |
---|
25 | } |
---|
26 | |
---|
27 | jQuery.cookie('windowHeight', myHeight | 800, { |
---|
28 | path: COOKIE_PATH |
---|
29 | }); |
---|
30 | jQuery.cookie('windowWidth', myWidth | 600, { |
---|
31 | path: COOKIE_PATH |
---|
32 | }); |
---|
33 | |
---|
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; |
---|
45 | |
---|
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 | }); |
---|