annotate iframe-resizer/test/resources/frame.content.html @ 2:3c160414da2e default tip

initial upload
author shiltemann
date Thu, 26 Feb 2015 14:05:23 +0100
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
3c160414da2e initial upload
shiltemann
parents:
diff changeset
1 <!DOCTYPE html>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
2 <html>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
3 <head>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
4 <meta charset="utf-8">
3c160414da2e initial upload
shiltemann
parents:
diff changeset
5 <title>iFrame message passing test</title>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
6 <meta name="description" content="iFrame message passing test">
3c160414da2e initial upload
shiltemann
parents:
diff changeset
7 <script src="jquery.js"></script>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
8 <style>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
9 a { float:right; }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
10 </style>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
11 </head>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
12 <body>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
13
3c160414da2e initial upload
shiltemann
parents:
diff changeset
14 <b>iFrame</b>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
15
3c160414da2e initial upload
shiltemann
parents:
diff changeset
16 <p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
17 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
3c160414da2e initial upload
shiltemann
parents:
diff changeset
18 </p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
19 <p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
20 But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?
3c160414da2e initial upload
shiltemann
parents:
diff changeset
21 </p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
22 <p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
23 On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.
3c160414da2e initial upload
shiltemann
parents:
diff changeset
24 </p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
25 <p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
26 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
3c160414da2e initial upload
shiltemann
parents:
diff changeset
27 </p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
28 <p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
29 But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?
3c160414da2e initial upload
shiltemann
parents:
diff changeset
30 </p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
31 <p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
32 On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.
3c160414da2e initial upload
shiltemann
parents:
diff changeset
33 </p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
34 <p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
35 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
3c160414da2e initial upload
shiltemann
parents:
diff changeset
36 </p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
37 <p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
38 But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?
3c160414da2e initial upload
shiltemann
parents:
diff changeset
39 </p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
40 <p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
41 On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.
3c160414da2e initial upload
shiltemann
parents:
diff changeset
42 </p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
43 <p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
44 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
3c160414da2e initial upload
shiltemann
parents:
diff changeset
45 </p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
46 <p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
47 But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?
3c160414da2e initial upload
shiltemann
parents:
diff changeset
48 </p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
49 <p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
50 On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.
3c160414da2e initial upload
shiltemann
parents:
diff changeset
51 </p>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
52
3c160414da2e initial upload
shiltemann
parents:
diff changeset
53
3c160414da2e initial upload
shiltemann
parents:
diff changeset
54 <script type="text/javascript" src="../../js/iframeResizer.contentWindow.min.js"></script>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
55 <script type="text/javascript">
3c160414da2e initial upload
shiltemann
parents:
diff changeset
56
3c160414da2e initial upload
shiltemann
parents:
diff changeset
57 (function() {
3c160414da2e initial upload
shiltemann
parents:
diff changeset
58
3c160414da2e initial upload
shiltemann
parents:
diff changeset
59 var
3c160414da2e initial upload
shiltemann
parents:
diff changeset
60 msgID = '[iFrameSizerTest]', //Must match host page msg ID
3c160414da2e initial upload
shiltemann
parents:
diff changeset
61 firstRun = true,
3c160414da2e initial upload
shiltemann
parents:
diff changeset
62 logging = true,
3c160414da2e initial upload
shiltemann
parents:
diff changeset
63 msgIdLen= msgID.length;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
64
3c160414da2e initial upload
shiltemann
parents:
diff changeset
65 try{
3c160414da2e initial upload
shiltemann
parents:
diff changeset
66
3c160414da2e initial upload
shiltemann
parents:
diff changeset
67 function addEventListener(e,func){
3c160414da2e initial upload
shiltemann
parents:
diff changeset
68 if (window.addEventListener){
3c160414da2e initial upload
shiltemann
parents:
diff changeset
69 window.addEventListener(e,func, false);
3c160414da2e initial upload
shiltemann
parents:
diff changeset
70 } else if (window.attachEvent){
3c160414da2e initial upload
shiltemann
parents:
diff changeset
71 window.attachEvent('on'+e,func);
3c160414da2e initial upload
shiltemann
parents:
diff changeset
72 }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
73 }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
74
3c160414da2e initial upload
shiltemann
parents:
diff changeset
75 function log(msg){
3c160414da2e initial upload
shiltemann
parents:
diff changeset
76 if (logging && window.console){
3c160414da2e initial upload
shiltemann
parents:
diff changeset
77 console.log(msg);
3c160414da2e initial upload
shiltemann
parents:
diff changeset
78 }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
79 }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
80
3c160414da2e initial upload
shiltemann
parents:
diff changeset
81 function warn(msg){
3c160414da2e initial upload
shiltemann
parents:
diff changeset
82 if (window.console){
3c160414da2e initial upload
shiltemann
parents:
diff changeset
83 console.warn(msg);
3c160414da2e initial upload
shiltemann
parents:
diff changeset
84 }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
85 }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
86
3c160414da2e initial upload
shiltemann
parents:
diff changeset
87 function receiver(event) {
3c160414da2e initial upload
shiltemann
parents:
diff changeset
88
3c160414da2e initial upload
shiltemann
parents:
diff changeset
89 function init(){
3c160414da2e initial upload
shiltemann
parents:
diff changeset
90
3c160414da2e initial upload
shiltemann
parents:
diff changeset
91 function changeContent(){
3c160414da2e initial upload
shiltemann
parents:
diff changeset
92 $('p').eq(0).remove();
3c160414da2e initial upload
shiltemann
parents:
diff changeset
93 }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
94
3c160414da2e initial upload
shiltemann
parents:
diff changeset
95 function callMethod(methodName,val1,val2){
3c160414da2e initial upload
shiltemann
parents:
diff changeset
96 if ('parentIFrame' in window)
3c160414da2e initial upload
shiltemann
parents:
diff changeset
97 window.parentIFrame[methodName](val1,val2);
3c160414da2e initial upload
shiltemann
parents:
diff changeset
98 else
3c160414da2e initial upload
shiltemann
parents:
diff changeset
99 warn('window.parentIFrame methods not enabled.')
3c160414da2e initial upload
shiltemann
parents:
diff changeset
100 }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
101
3c160414da2e initial upload
shiltemann
parents:
diff changeset
102 var
3c160414da2e initial upload
shiltemann
parents:
diff changeset
103 data = event.data.substr(msgIdLen).split(':'),
3c160414da2e initial upload
shiltemann
parents:
diff changeset
104 test = data[1];
3c160414da2e initial upload
shiltemann
parents:
diff changeset
105
3c160414da2e initial upload
shiltemann
parents:
diff changeset
106 console.info(test);
3c160414da2e initial upload
shiltemann
parents:
diff changeset
107
3c160414da2e initial upload
shiltemann
parents:
diff changeset
108 switch (test){
3c160414da2e initial upload
shiltemann
parents:
diff changeset
109 case 'changeContent':
3c160414da2e initial upload
shiltemann
parents:
diff changeset
110 setInterval(function(){changeContent();},2);
3c160414da2e initial upload
shiltemann
parents:
diff changeset
111 break;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
112 case 'close':
3c160414da2e initial upload
shiltemann
parents:
diff changeset
113 callMethod('close');
3c160414da2e initial upload
shiltemann
parents:
diff changeset
114 break;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
115 case 'pageChange':
3c160414da2e initial upload
shiltemann
parents:
diff changeset
116 location.href = '../../example/frame.hover.html';
3c160414da2e initial upload
shiltemann
parents:
diff changeset
117 break;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
118 case 'nested':
3c160414da2e initial upload
shiltemann
parents:
diff changeset
119 location.href = 'frame.nested.html';
3c160414da2e initial upload
shiltemann
parents:
diff changeset
120 break;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
121 case 'size':
3c160414da2e initial upload
shiltemann
parents:
diff changeset
122 changeContent();
3c160414da2e initial upload
shiltemann
parents:
diff changeset
123 callMethod('size');
3c160414da2e initial upload
shiltemann
parents:
diff changeset
124 break;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
125 case 'size100':
3c160414da2e initial upload
shiltemann
parents:
diff changeset
126 callMethod('size',100);
3c160414da2e initial upload
shiltemann
parents:
diff changeset
127 break;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
128 case 'size200300':
3c160414da2e initial upload
shiltemann
parents:
diff changeset
129 callMethod('size',200,300);
3c160414da2e initial upload
shiltemann
parents:
diff changeset
130 break;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
131 case 'jsTrigger':
3c160414da2e initial upload
shiltemann
parents:
diff changeset
132 changeContent();
3c160414da2e initial upload
shiltemann
parents:
diff changeset
133 callMethod('trigger');
3c160414da2e initial upload
shiltemann
parents:
diff changeset
134 break;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
135 case 'chkHeight':
3c160414da2e initial upload
shiltemann
parents:
diff changeset
136 callMethod('sendMessage',document.body.offsetHeight);
3c160414da2e initial upload
shiltemann
parents:
diff changeset
137 break;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
138 case 'chkBackground':
3c160414da2e initial upload
shiltemann
parents:
diff changeset
139 callMethod('sendMessage',document.body.style.background);
3c160414da2e initial upload
shiltemann
parents:
diff changeset
140 break;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
141 case 'chkSendMsg':
3c160414da2e initial upload
shiltemann
parents:
diff changeset
142 callMethod('sendMessage','message: test');
3c160414da2e initial upload
shiltemann
parents:
diff changeset
143 break;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
144 case 'chkGetId':
3c160414da2e initial upload
shiltemann
parents:
diff changeset
145 if ('parentIFrame' in window)
3c160414da2e initial upload
shiltemann
parents:
diff changeset
146 callMethod('sendMessage',window.parentIFrame.getId());
3c160414da2e initial upload
shiltemann
parents:
diff changeset
147 break;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
148 case 'setHeightCalculationMethod':
3c160414da2e initial upload
shiltemann
parents:
diff changeset
149 if ('parentIFrame' in window){
3c160414da2e initial upload
shiltemann
parents:
diff changeset
150 parentIFrame.setHeightCalculationMethod('max');
3c160414da2e initial upload
shiltemann
parents:
diff changeset
151 callMethod('size');
3c160414da2e initial upload
shiltemann
parents:
diff changeset
152 }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
153 break;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
154 case 'width':
3c160414da2e initial upload
shiltemann
parents:
diff changeset
155 $('p').width(3000);
3c160414da2e initial upload
shiltemann
parents:
diff changeset
156 break;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
157 case 'image':
3c160414da2e initial upload
shiltemann
parents:
diff changeset
158 $('p').html('<img src="djb.jpg">');
3c160414da2e initial upload
shiltemann
parents:
diff changeset
159 break;
3c160414da2e initial upload
shiltemann
parents:
diff changeset
160 }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
161
3c160414da2e initial upload
shiltemann
parents:
diff changeset
162 }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
163
3c160414da2e initial upload
shiltemann
parents:
diff changeset
164
3c160414da2e initial upload
shiltemann
parents:
diff changeset
165 if (msgID === event.data.substr(0,msgIdLen) ){ //Check msg ID
3c160414da2e initial upload
shiltemann
parents:
diff changeset
166 init();
3c160414da2e initial upload
shiltemann
parents:
diff changeset
167 }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
168 }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
169 addEventListener('message', receiver);
3c160414da2e initial upload
shiltemann
parents:
diff changeset
170 }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
171 catch(e){
3c160414da2e initial upload
shiltemann
parents:
diff changeset
172 warn(e);
3c160414da2e initial upload
shiltemann
parents:
diff changeset
173 }
3c160414da2e initial upload
shiltemann
parents:
diff changeset
174
3c160414da2e initial upload
shiltemann
parents:
diff changeset
175 })();
3c160414da2e initial upload
shiltemann
parents:
diff changeset
176 </script>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
177 </body>
3c160414da2e initial upload
shiltemann
parents:
diff changeset
178 </html>