j1m_app 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.md +21 -0
  3. data/README.md +41 -0
  4. data/_data/modules/default/j1_app-0.0.1/j1_iframe_resizer.yml +270 -0
  5. data/_data/resources/default/j1_app-0.0.1/resource.yml +22 -0
  6. data/assets/themes/j1/iframe_resizer/.npmignore +9 -0
  7. data/assets/themes/j1/iframe_resizer/.travis.yml +6 -0
  8. data/assets/themes/j1/iframe_resizer/CONTRIBUTING.md +86 -0
  9. data/assets/themes/j1/iframe_resizer/Iframe-resizer by davidjbradshaw.url +2 -0
  10. data/assets/themes/j1/iframe_resizer/LICENSE +21 -0
  11. data/assets/themes/j1/iframe_resizer/README.md +608 -0
  12. data/assets/themes/j1/iframe_resizer/bower.json +45 -0
  13. data/assets/themes/j1/iframe_resizer/example/frame.absolute.html +88 -0
  14. data/assets/themes/j1/iframe_resizer/example/frame.content.html +58 -0
  15. data/assets/themes/j1/iframe_resizer/example/frame.hover.html +51 -0
  16. data/assets/themes/j1/iframe_resizer/example/frame.nested.html +72 -0
  17. data/assets/themes/j1/iframe_resizer/example/frame.textarea.html +46 -0
  18. data/assets/themes/j1/iframe_resizer/example/frame.tolerance.html +79 -0
  19. data/assets/themes/j1/iframe_resizer/example/index.html +70 -0
  20. data/assets/themes/j1/iframe_resizer/example/two.html +71 -0
  21. data/assets/themes/j1/iframe_resizer/gruntfile.js +215 -0
  22. data/assets/themes/j1/iframe_resizer/iframeResizer.jquery.json +41 -0
  23. data/assets/themes/j1/iframe_resizer/index.js +4 -0
  24. data/assets/themes/j1/iframe_resizer/js/_client.js +1131 -0
  25. data/assets/themes/j1/iframe_resizer/js/_server.js +1126 -0
  26. data/assets/themes/j1/iframe_resizer/js/ie8.polyfils.js +85 -0
  27. data/assets/themes/j1/iframe_resizer/js/ie8.polyfils.map +1 -0
  28. data/assets/themes/j1/iframe_resizer/js/ie8.polyfils.min.js +4 -0
  29. data/assets/themes/j1/iframe_resizer/js/iframeResizer.contentWindow.js +1104 -0
  30. data/assets/themes/j1/iframe_resizer/js/iframeResizer.contentWindow.map +1 -0
  31. data/assets/themes/j1/iframe_resizer/js/iframeResizer.contentWindow.min.js +10 -0
  32. data/assets/themes/j1/iframe_resizer/js/iframeResizer.js +1007 -0
  33. data/assets/themes/j1/iframe_resizer/js/iframeResizer.js.modified +1004 -0
  34. data/assets/themes/j1/iframe_resizer/js/iframeResizer.map +1 -0
  35. data/assets/themes/j1/iframe_resizer/js/iframeResizer.min.js +9 -0
  36. data/assets/themes/j1/iframe_resizer/js/index.js +2 -0
  37. data/assets/themes/j1/iframe_resizer/karma.conf.js +92 -0
  38. data/assets/themes/j1/iframe_resizer/package.json +111 -0
  39. data/assets/themes/j1/iframe_resizer/spec/_initSpec.js +63 -0
  40. data/assets/themes/j1/iframe_resizer/spec/anchorSpec.js +62 -0
  41. data/assets/themes/j1/iframe_resizer/spec/childSpec.js +403 -0
  42. data/assets/themes/j1/iframe_resizer/spec/closeSpecSpec.js +44 -0
  43. data/assets/themes/j1/iframe_resizer/spec/getPageInfoSpec.js +32 -0
  44. data/assets/themes/j1/iframe_resizer/spec/initCssSpec.js +28 -0
  45. data/assets/themes/j1/iframe_resizer/spec/initDomSpec.js +27 -0
  46. data/assets/themes/j1/iframe_resizer/spec/initDoubleCallSpec.js +33 -0
  47. data/assets/themes/j1/iframe_resizer/spec/initErrorSpec.js +57 -0
  48. data/assets/themes/j1/iframe_resizer/spec/initJQuerySpec.js +29 -0
  49. data/assets/themes/j1/iframe_resizer/spec/initUndefinedDomSpec.js +25 -0
  50. data/assets/themes/j1/iframe_resizer/spec/javascripts/fixtures/iframe.html +2 -0
  51. data/assets/themes/j1/iframe_resizer/spec/javascripts/fixtures/iframe600.html +4 -0
  52. data/assets/themes/j1/iframe_resizer/spec/javascripts/fixtures/iframe600WithId.html +4 -0
  53. data/assets/themes/j1/iframe_resizer/spec/lib/common.js +59 -0
  54. data/assets/themes/j1/iframe_resizer/spec/parentSpec.js +88 -0
  55. data/assets/themes/j1/iframe_resizer/spec/resources/djb.jpg +0 -0
  56. data/assets/themes/j1/iframe_resizer/spec/resources/frame.content.html +176 -0
  57. data/assets/themes/j1/iframe_resizer/spec/resources/frame.lateload.html +33 -0
  58. data/assets/themes/j1/iframe_resizer/spec/resources/frame.nested.html +40 -0
  59. data/assets/themes/j1/iframe_resizer/spec/scrollSpec.js +53 -0
  60. data/assets/themes/j1/iframe_resizer/spec/sendMessageSpec.js +58 -0
  61. data/assets/themes/j1/iframe_resizer/spec/support/jasmine.json +9 -0
  62. data/assets/themes/j1/iframe_resizer/src/ie8.polyfils.js +64 -0
  63. data/assets/themes/j1/iframe_resizer/src/iframeResizer.contentWindow.js +1123 -0
  64. data/assets/themes/j1/iframe_resizer/src/iframeResizer.js +1002 -0
  65. data/assets/themes/j1/iframe_resizer/test-main.js +33 -0
  66. data/assets/themes/j1/iframe_resizer/test/_init.html +44 -0
  67. data/assets/themes/j1/iframe_resizer/test/_init_once.html +45 -0
  68. data/assets/themes/j1/iframe_resizer/test/_init_once_async.html +72 -0
  69. data/assets/themes/j1/iframe_resizer/test/background.html +47 -0
  70. data/assets/themes/j1/iframe_resizer/test/changePage.html +50 -0
  71. data/assets/themes/j1/iframe_resizer/test/close.html +44 -0
  72. data/assets/themes/j1/iframe_resizer/test/getId.html +44 -0
  73. data/assets/themes/j1/iframe_resizer/test/interval.html +56 -0
  74. data/assets/themes/j1/iframe_resizer/test/jqueryNoConflict.html +47 -0
  75. data/assets/themes/j1/iframe_resizer/test/lateImageLoad.html +90 -0
  76. data/assets/themes/j1/iframe_resizer/test/margin.html +73 -0
  77. data/assets/themes/j1/iframe_resizer/test/mutationObserver.html +63 -0
  78. data/assets/themes/j1/iframe_resizer/test/nested.html +46 -0
  79. data/assets/themes/j1/iframe_resizer/test/resize.contentWidth.html +51 -0
  80. data/assets/themes/j1/iframe_resizer/test/resize.width.html +63 -0
  81. data/assets/themes/j1/iframe_resizer/test/resources/djb.jpg +0 -0
  82. data/assets/themes/j1/iframe_resizer/test/resources/frame.content.html +191 -0
  83. data/assets/themes/j1/iframe_resizer/test/resources/frame.lateload.html +33 -0
  84. data/assets/themes/j1/iframe_resizer/test/resources/frame.nested.html +40 -0
  85. data/assets/themes/j1/iframe_resizer/test/resources/jquery.js +6 -0
  86. data/assets/themes/j1/iframe_resizer/test/resources/qunit.css +244 -0
  87. data/assets/themes/j1/iframe_resizer/test/resources/qunit.js +2212 -0
  88. data/assets/themes/j1/iframe_resizer/test/resources/require.js +2103 -0
  89. data/assets/themes/j1/iframe_resizer/test/resources/testLib.js +9 -0
  90. data/assets/themes/j1/iframe_resizer/test/scrolling.html +65 -0
  91. data/assets/themes/j1/iframe_resizer/test/sendMessage.html +61 -0
  92. data/assets/themes/j1/iframe_resizer/test/setHeightCalculationMethod.html +51 -0
  93. data/assets/themes/j1/iframe_resizer/test/size.html +64 -0
  94. data/assets/themes/j1/iframe_resizer/test/v1.html +189 -0
  95. data/exe/console +14 -0
  96. data/exe/setup +8 -0
  97. data/lib/j1m_app.rb +5 -0
  98. data/lib/j1m_app/version.rb +3 -0
  99. metadata +187 -0
@@ -0,0 +1,47 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>QUnit LoadHide</title>
6
+ <link rel="stylesheet" href="resources/qunit.css">
7
+ </head>
8
+ <body>
9
+ <div id="qunit"></div>
10
+ <div id="qunit-fixture">
11
+
12
+ <div style="width:600px;">
13
+ <iframe src="resources/frame.content.html" width="100%" scrolling="no"></iframe>
14
+ </div>
15
+
16
+ </div>
17
+ <script src="resources/qunit.js"></script>
18
+ <script src="resources/jquery.js"></script>
19
+ <script>
20
+ //var myOwnJquery = jQuery.noConflict(true);
21
+ </script>
22
+ <script src="../js/iframeResizer.min.js"></script>
23
+ <script>
24
+
25
+ 'use strict';
26
+ var msgId = '[iFrameSizerTest]:';
27
+
28
+ asyncTest("init with jQuery.noConflict", function() {
29
+ try {
30
+ $('iframe').iFrameResize({
31
+ //log:true,
32
+ bodyBackground:'wheat',
33
+ heightCalculationMethod:'max',
34
+ initCallback:function(iframe){
35
+ ok( true, 'Receive init message back from iFrame.' );
36
+ start();
37
+ }
38
+ });
39
+ } catch(e) {
40
+ console.log(e);
41
+ ok(false);
42
+ start();
43
+ }
44
+ });
45
+ </script>
46
+ </body>
47
+ </html>
@@ -0,0 +1,90 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>QUnit LoadHide</title>
6
+ <link rel="stylesheet" href="resources/qunit.css">
7
+ </head>
8
+ <body>
9
+ <div id="qunit"></div>
10
+ <div id="qunit-fixture">
11
+
12
+ <div style="width:600px;">
13
+ <iframe src="resources/frame.content.html" height="100%" scrolling="no"></iframe>
14
+ </div>
15
+
16
+ </div>
17
+ <script src="resources/qunit.js"></script>
18
+ <script src="resources/jquery.js"></script>
19
+ <script src="resources/testLib.js"></script>
20
+ <script src="../js/ie8.polyfils.min.js"></script>
21
+ <script src="../js/iframeResizer.min.js"></script>
22
+ <script>
23
+
24
+ 'use strict';
25
+ var msgId = '[iFrameSizerTest]:';
26
+
27
+ var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
28
+
29
+ function mutationObserverTest(){
30
+ asyncTest( "iFrame late image load", function() {
31
+
32
+ var callbackCounter = 0;
33
+
34
+ $('iframe').iFrameResize({
35
+ //log:true,
36
+ sizeHeight:false,
37
+ sizeWidth:true,
38
+ interval:1,
39
+ resizedCallback:function(messageData){
40
+ switch (''+(++callbackCounter)){
41
+ case '1':
42
+ sendMessage('image');
43
+ break;
44
+ case '2':
45
+ break;
46
+ case '3':
47
+ ok( 'imageLoad' === messageData.type, 'type = imageLoad');
48
+ start();
49
+ }
50
+ }
51
+ });
52
+ });
53
+
54
+ asyncTest( "iFrame late image load with other mutations", function() {
55
+
56
+ var callbackCounter = 0;
57
+
58
+ $('iframe').iFrameResize({
59
+ //log:true,
60
+ sizeHeight:false,
61
+ sizeWidth:true,
62
+ interval:1,
63
+ resizedCallback:function(messageData){
64
+ switch (''+(++callbackCounter)){
65
+ case '1':
66
+ sendMessage('imageAsSecondMutation');
67
+ break;
68
+ case '2':
69
+ break;
70
+ case '3':
71
+ ok( 'imageLoad' === messageData.type, 'type = imageLoad');
72
+ start();
73
+ }
74
+ }
75
+ });
76
+ });
77
+ }
78
+
79
+ if (MutationObserver)
80
+ mutationObserverTest()
81
+ else{
82
+ console.warn('(MutationObserver not supported in this browser! Unable to run test)');
83
+ test('iFrame MutationObserver',function(){
84
+ ok(true,'MutationObserver not supported in this browser! Unable to run test.');
85
+ });
86
+ }
87
+
88
+ </script>
89
+ </body>
90
+ </html>
@@ -0,0 +1,73 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>QUnit LoadHide</title>
6
+ <link rel="stylesheet" href="resources/qunit.css">
7
+ </head>
8
+ <body>
9
+ <div id="qunit"></div>
10
+ <div id="qunit-fixture">
11
+
12
+ <div style="width:1600px;">
13
+ <iframe src="resources/frame.content.html" width="100%" scrolling="no"></iframe>
14
+ </div>
15
+
16
+ </div>
17
+ <script src="resources/qunit.js"></script>
18
+ <script src="resources/jquery.js"></script>
19
+ <script src="resources/testLib.js"></script>
20
+ <script src="../js/ie8.polyfils.min.js"></script>
21
+ <script src="../js/iframeResizer.min.js"></script>
22
+ <script>
23
+
24
+ 'use strict';
25
+ var msgId = '[iFrameSizerTest]:';
26
+
27
+ var margins = [
28
+ '10px 5em',
29
+ '15px 5ex',
30
+ '20px',
31
+ '25px',
32
+ '75px'
33
+ ];
34
+
35
+ function Counter(){
36
+ var i=0;
37
+ return function(){return i++};
38
+ }
39
+
40
+ var counter = Counter();
41
+
42
+ for (var i=0; i !== margins.length; i++){
43
+ asyncTest( "Margin " + margins[i], function() {
44
+ var
45
+ height = 0,
46
+ i = counter(), //counteract async
47
+ margin = margins[i];
48
+
49
+ iFrameResize({
50
+ //log:true,
51
+ bodyMargin:margin,
52
+ resizedCallback:function(messageData){
53
+ ok( true, 'Receive message back from iFrame.' );
54
+ height=parseInt(messageData.height,10);
55
+ sendMessage('chkHeight');
56
+ },
57
+ messageCallback:function(messageData){
58
+ var
59
+ marginCheck = 2 *parseInt(margin,10),
60
+ bodyHeight = parseInt(messageData.message,10);
61
+
62
+ ok(height === (marginCheck + bodyHeight), 'Margin = ' + margin);
63
+ console.log('.');
64
+ start();
65
+ }
66
+ });
67
+ });
68
+
69
+ }
70
+
71
+ </script>
72
+ </body>
73
+ </html>
@@ -0,0 +1,63 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>QUnit LoadHide</title>
6
+ <link rel="stylesheet" href="resources/qunit.css">
7
+ </head>
8
+ <body>
9
+ <div id="qunit"></div>
10
+ <div id="qunit-fixture">
11
+
12
+ <div style="width:600px;">
13
+ <iframe src="resources/frame.content.html" width="100%" scrolling="no"></iframe>
14
+ </div>
15
+
16
+ </div>
17
+ <script src="resources/qunit.js"></script>
18
+ <script src="resources/jquery.js"></script>
19
+ <script src="resources/testLib.js"></script>
20
+ <script src="../js/iframeResizer.min.js"></script>
21
+ <script>
22
+
23
+ 'use strict';
24
+
25
+ function mutationObserverTest(){
26
+ asyncTest( "iFrame MutationObserver", function() {
27
+
28
+ var callbackCounter = 0;
29
+
30
+ $('iframe').iFrameResize({
31
+ //log:true,
32
+ resizedCallback:function(messageData){
33
+
34
+ switch (''+(++callbackCounter)){
35
+ case '1':
36
+ sendMessage('changeContent');
37
+ break;
38
+ case '2':
39
+ ok( true, 'iFrame detected content change');
40
+ ok( 'mutationObserver' === messageData.type, 'Received '+messageData.type+' message back from iFrame. Expected mutationObserver' );
41
+ start();
42
+ }
43
+ }
44
+ });
45
+ });
46
+ }
47
+
48
+ var msgId = '[iFrameSizerTest]:';
49
+
50
+ var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
51
+
52
+ if (MutationObserver)
53
+ mutationObserverTest()
54
+ else{
55
+ console.warn('(MutationObserver not supported in this browser! Unable to run test)');
56
+ test('iFrame MutationObserver',function(){
57
+ ok(true,'MutationObserver not supported in this browser! Unable to run test.');
58
+ });
59
+ }
60
+
61
+ </script>
62
+ </body>
63
+ </html>
@@ -0,0 +1,46 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>QUnit LoadHide</title>
6
+ <link rel="stylesheet" href="resources/qunit.css">
7
+ </head>
8
+ <body>
9
+ <div id="qunit"></div>
10
+ <div id="qunit-fixture">
11
+
12
+ <div style="width:600px;">
13
+ <iframe id="parentPage" src="resources/frame.content.html" width="100%" scrolling="no"></iframe>
14
+ </div>
15
+
16
+ </div>
17
+ <script src="resources/qunit.js"></script>
18
+ <script src="resources/jquery.js"></script>
19
+ <script src="resources/testLib.js"></script>
20
+ <script src="../js/ie8.polyfils.min.js"></script>
21
+ <script src="../src/iframeResizer.js"></script>
22
+ <script>
23
+
24
+ 'use strict';
25
+ var
26
+ count = 0,
27
+ msgId = '[iFrameSizerTest]:';
28
+
29
+ asyncTest( "Nested iFrame", function() {
30
+
31
+ $('iframe').iFrameResize({
32
+ //log:true,
33
+ resizedCallback:function(messageData){
34
+ ok( true, 'Receive init message back from iFrame.' );
35
+ sendMessage('nested');
36
+ },
37
+ messageCallback:function(messageData){
38
+ ok( 'nested' === messageData.message, 'Nested iFrame sized.' );
39
+ start();
40
+ }
41
+ });
42
+ });
43
+
44
+ </script>
45
+ </body>
46
+ </html>
@@ -0,0 +1,51 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>QUnit LoadHide</title>
6
+ <link rel="stylesheet" href="resources/qunit.css">
7
+ </head>
8
+ <body>
9
+ <div id="qunit"></div>
10
+ <div id="qunit-fixture">
11
+
12
+ <div style="width:600px;">
13
+ <iframe src="resources/frame.content.html" height="100%" scrolling="no"></iframe>
14
+ </div>
15
+
16
+ </div>
17
+ <script src="resources/qunit.js"></script>
18
+ <script src="resources/jquery.js"></script>
19
+ <script src="resources/testLib.js"></script>
20
+ <script src="../js/ie8.polyfils.min.js"></script>
21
+ <script src="../js/iframeResizer.min.js"></script>
22
+ <script>
23
+
24
+ 'use strict';
25
+ var msgId = '[iFrameSizerTest]:';
26
+
27
+ asyncTest( "iFrame Resize height", function() {
28
+
29
+ var callbackCounter = 0;
30
+
31
+ $('iframe').iFrameResize({
32
+ //log:true,
33
+ sizeHeight:false,
34
+ sizeWidth:true,
35
+ interval:1,
36
+ resizedCallback:function(messageData){
37
+ switch (''+(++callbackCounter)){
38
+ case '1':
39
+ sendMessage('width');
40
+ break;
41
+ case '2':
42
+ ok( 3000 < parseInt(messageData.width,10), 'iFrame width<3000');
43
+ start();
44
+ }
45
+ }
46
+ });
47
+ });
48
+
49
+ </script>
50
+ </body>
51
+ </html>
@@ -0,0 +1,63 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>QUnit LoadHide</title>
6
+ <link rel="stylesheet" href="resources/qunit.css">
7
+ </head>
8
+ <body>
9
+ <div id="qunit"></div>
10
+ <div id="qunit-fixture">
11
+
12
+ <div style="width:600px;">
13
+ <iframe src="resources/frame.content.html" width="100%" scrolling="no"></iframe>
14
+ </div>
15
+
16
+ </div>
17
+ <script src="resources/qunit.js"></script>
18
+ <script src="resources/jquery.js"></script>
19
+ <script src="../js/iframeResizer.min.js"></script>
20
+ <script>
21
+
22
+ 'use strict';
23
+ var msgId = '[iFrameSizerTest]:';
24
+
25
+ function resize(size){
26
+ console.info('Size width:'+size);
27
+ $('#qunit-fixture > div').width(size);
28
+ }
29
+
30
+ asyncTest( "iFrame Resize Event", function() {
31
+
32
+ var callbackCounter = 0;
33
+
34
+ $('iframe').iFrameResize({
35
+ //log:true,
36
+ interval:1000,
37
+ heightCalculationMethod:'max',
38
+ resizeFrom:'child',
39
+ resizedCallback:function(messageData){
40
+
41
+ switch (''+(++callbackCounter)){
42
+ case '1':
43
+ setTimeout(function(){resize(300);},150);
44
+ break;
45
+ case '2':
46
+ setTimeout(function(){resize(600)},150);
47
+ ok( 'resize' === messageData.type, '1 Received '+messageData.type+' message back from iFrame. Expected resize');
48
+ ok( '300' === messageData.width, '2 iFrame width = '+messageData.width+'. Expected 300.');
49
+ break;
50
+ default:
51
+ ok( 'resetPage' === messageData.type, '3 Received '+messageData.type+' message back from iFrame. Expected resetPage');
52
+ if ('600' === messageData.width){
53
+ ok( '600' === messageData.width, '4 iFrame width = '+messageData.width+'. Expected 600.');
54
+ start();
55
+ }
56
+ }
57
+ }
58
+ });
59
+ });
60
+
61
+ </script>
62
+ </body>
63
+ </html>
@@ -0,0 +1,191 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>iFrame message passing test</title>
6
+ <meta name="description" content="iFrame message passing test">
7
+ <script src="jquery.js"></script>
8
+ <style>
9
+ a { float:right; }
10
+ </style>
11
+ </head>
12
+ <body>
13
+
14
+ <b>iFrame</b>
15
+
16
+ <div>Some content to be replaced</div>
17
+
18
+ <p>
19
+ 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.
20
+ </p>
21
+ <p>
22
+ 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?
23
+ </p>
24
+ <p>
25
+ 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.
26
+ </p>
27
+ <p>
28
+ 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.
29
+ </p>
30
+ <p>
31
+ 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?
32
+ </p>
33
+ <p>
34
+ 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.
35
+ </p>
36
+ <p>
37
+ 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.
38
+ </p>
39
+ <p>
40
+ 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?
41
+ </p>
42
+ <p>
43
+ 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.
44
+ </p>
45
+ <p>
46
+ 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.
47
+ </p>
48
+ <p>
49
+ 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?
50
+ </p>
51
+ <p>
52
+ 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.
53
+ </p>
54
+
55
+
56
+ <script type="text/javascript">
57
+
58
+ (function() {
59
+
60
+ var logging = true;
61
+
62
+ try{
63
+
64
+ function addEventListener(e,func){
65
+ if (window.addEventListener){
66
+ window.addEventListener(e,func, false);
67
+ } else if (window.attachEvent){
68
+ window.attachEvent('on'+e,func);
69
+ }
70
+ }
71
+
72
+ function log(msg){
73
+ if (logging && window.console){
74
+ console.info('[Test] '+msg);
75
+ }
76
+ }
77
+
78
+ function warn(msg){
79
+ if (window.console){
80
+ console.warn('[Test] '+msg);
81
+ }
82
+ }
83
+
84
+
85
+ function init(test){
86
+
87
+ function changeContent(){
88
+ $('p').eq(0).remove();
89
+ }
90
+
91
+ function callMethod(methodName,val1,val2){
92
+ if ('parentIFrame' in window)
93
+ window.parentIFrame[methodName](val1,val2);
94
+ else
95
+ warn('window.parentIFrame methods not enabled.')
96
+ }
97
+
98
+
99
+ //console.info(test);
100
+
101
+ switch (test){
102
+ case 'changeContent':
103
+ setInterval(function(){changeContent();},2);
104
+ break;
105
+ case 'close':
106
+ init('imageAsSecondMutation');
107
+ setTimeout(function(){
108
+ callMethod('close');
109
+ },2000);
110
+ break;
111
+ case 'pageChange':
112
+ location.href = '../../example/frame.hover.html';
113
+ break;
114
+ case 'nested':
115
+ location.href = 'frame.nested.html';
116
+ break;
117
+ case 'size':
118
+ changeContent();
119
+ callMethod('size');
120
+ break;
121
+ case 'autoResize':
122
+ callMethod('setAutoResize',true);
123
+ setTimeout(function(){
124
+ changeContent();
125
+ },500);
126
+ break;
127
+ case 'size100':
128
+ callMethod('size',100);
129
+ break;
130
+ case 'size200300':
131
+ callMethod('size',200,300);
132
+ break;
133
+ case 'jsTrigger':
134
+ changeContent();
135
+ callMethod('trigger');
136
+ break;
137
+ case 'chkHeight':
138
+ callMethod('sendMessage',document.body.offsetHeight);
139
+ break;
140
+ case 'chkBackground':
141
+ callMethod('sendMessage',document.body.style.background);
142
+ break;
143
+ case 'chkSendMsg':
144
+ callMethod('sendMessage','message: test string');
145
+ break;
146
+ case 'chkSendObj':
147
+ callMethod('sendMessage',{message: 'test object'});
148
+ break;
149
+ case 'chkGetId':
150
+ if ('parentIFrame' in window)
151
+ callMethod('sendMessage',window.parentIFrame.getId());
152
+ break;
153
+ case 'setHeightCalculationMethod':
154
+ if ('parentIFrame' in window){
155
+ parentIFrame.setHeightCalculationMethod('max');
156
+ callMethod('size');
157
+ }
158
+ break;
159
+ case 'width':
160
+ $('p').width(3000);
161
+ break;
162
+ case 'image':
163
+ $('p').html('<img src="djb.jpg">');
164
+ break;
165
+ case 'imageAsSecondMutation':
166
+ $('div').html('How now brown cow');
167
+ $('p').html('<img src="djb.jpg">');
168
+ $('b').html('<img src="djb2.jpg">');
169
+ break;
170
+ }
171
+
172
+ }
173
+
174
+ window.iFrameResizer = {
175
+ messageCallback: init
176
+ }
177
+ }
178
+ catch(e){
179
+ warn(e);
180
+ }
181
+
182
+
183
+
184
+
185
+ })();
186
+ </script>
187
+
188
+
189
+ <script type="text/javascript" src="../../js/iframeResizer.contentWindow.min.js"></script>
190
+ </body>
191
+ </html>