first commit
This commit is contained in:
BIN
iframe-resizer-master_old/spec/resources/djb.jpg
Executable file
BIN
iframe-resizer-master_old/spec/resources/djb.jpg
Executable file
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
259
iframe-resizer-master_old/spec/resources/frame.content.html
Executable file
259
iframe-resizer-master_old/spec/resources/frame.content.html
Executable file
@ -0,0 +1,259 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>iFrame message passing test</title>
|
||||
<meta name="description" content="iFrame message passing test">
|
||||
<style>
|
||||
a { float:right; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<b>iFrame</b>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p name="testAnchor">
|
||||
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?
|
||||
</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
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?
|
||||
</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
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?
|
||||
</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
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?
|
||||
</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var logging = true;
|
||||
|
||||
try {
|
||||
|
||||
function addEventListener(e, func) {
|
||||
if (window.addEventListener) {
|
||||
window.addEventListener(e, func, false);
|
||||
} else if (window.attachEvent) {
|
||||
window.attachEvent('on' + e, func);
|
||||
}
|
||||
}
|
||||
|
||||
function log(msg) {
|
||||
if (logging && window.console) {
|
||||
console.info('[Test] ' + msg);
|
||||
}
|
||||
}
|
||||
|
||||
function warn(msg) {
|
||||
if (window.console) {
|
||||
console.warn('[Test] ' + msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function init(test) {
|
||||
|
||||
function changeContent() {
|
||||
$('p').eq(0).remove();
|
||||
}
|
||||
|
||||
function callMethod(methodName, val1, val2) {
|
||||
if ('parentIFrame' in window)
|
||||
window.parentIFrame[methodName](val1, val2);
|
||||
else
|
||||
warn('window.parentIFrame methods not enabled.')
|
||||
}
|
||||
|
||||
|
||||
console.info(test);
|
||||
|
||||
switch (test) {
|
||||
case 'changeContent':
|
||||
setInterval(function () { changeContent(); }, 2);
|
||||
break;
|
||||
case 'close':
|
||||
callMethod('close');
|
||||
break;
|
||||
case 'pageChange':
|
||||
location.href = '/base/example/frame.hover.html';
|
||||
break;
|
||||
case 'nested':
|
||||
location.href = 'frame.nested.html';
|
||||
break;
|
||||
case 'size':
|
||||
changeContent();
|
||||
callMethod('size');
|
||||
break;
|
||||
case 'autoResize':
|
||||
callMethod('setAutoResize', true);
|
||||
setTimeout(function () {
|
||||
changeContent();
|
||||
}, 500);
|
||||
break;
|
||||
case 'size100':
|
||||
callMethod('size', 100);
|
||||
break;
|
||||
case 'size200300':
|
||||
callMethod('size', 200, 300);
|
||||
break;
|
||||
case 'jsTrigger':
|
||||
changeContent();
|
||||
callMethod('trigger');
|
||||
break;
|
||||
case 'chkHeight':
|
||||
callMethod('sendMessage', document.body.offsetHeight);
|
||||
break;
|
||||
case 'chkBackground':
|
||||
callMethod('sendMessage', document.body.style.backgroundColor);
|
||||
break;
|
||||
case 'chkSendMsg':
|
||||
callMethod('sendMessage', 'message: test string');
|
||||
break;
|
||||
case 'chkSendObj':
|
||||
callMethod('sendMessage', { message: 'test object' });
|
||||
break;
|
||||
case 'chkGetId':
|
||||
if ('parentIFrame' in window)
|
||||
callMethod('sendMessage', window.parentIFrame.getId());
|
||||
break;
|
||||
case 'setHeightCalculationMethod':
|
||||
if ('parentIFrame' in window) {
|
||||
parentIFrame.setHeightCalculationMethod('max');
|
||||
callMethod('size');
|
||||
}
|
||||
break;
|
||||
case 'width':
|
||||
$('p').width(3000);
|
||||
break;
|
||||
case 'image':
|
||||
$('p').html('<img src="djb.jpg">');
|
||||
break;
|
||||
case 'getPageInfo':
|
||||
callMethod('getPageInfo', function (pageInfo) {
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
window.iFrameResizer = {
|
||||
onMessage: init
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
warn(e);
|
||||
}
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="/base/js/iframeResizer.contentWindow.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
47
iframe-resizer-master_old/spec/resources/frame.lateload.html
Executable file
47
iframe-resizer-master_old/spec/resources/frame.lateload.html
Executable file
@ -0,0 +1,47 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>iFrame message passing test</title>
|
||||
<meta name="description" content="iFrame message passing test">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<style>
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
box-model: border-box;
|
||||
}
|
||||
|
||||
a {
|
||||
float: right;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-top: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>Late load JS test</h2>
|
||||
<p>Load JS with require after load event has fired.</p>
|
||||
<div style="margin:20px;">
|
||||
</div>
|
||||
|
||||
<script src="jquery.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
setTimeout(function () {
|
||||
console.log('Load Script');
|
||||
$.getScript('../../js/iframeResizer.contentWindow.min.js');
|
||||
}, 500);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
43
iframe-resizer-master_old/spec/resources/frame.nested.html
Executable file
43
iframe-resizer-master_old/spec/resources/frame.nested.html
Executable file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>iFrame message passing test</title>
|
||||
<meta name="description" content="iFrame message passing test">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<style>
|
||||
*, *:before, *:after {box-model: border-box;}
|
||||
a { float:right; margin-left:10px;}
|
||||
h2 {margin-top: 0;}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>Nested iFrame</h2>
|
||||
<p>Resize window or click one of the links in the nested iFrame to watch it resize.</p>
|
||||
<div style="margin:20px;">
|
||||
<iframe id="nestedIFrame" src="frame.content.html" width="100%" scrolling="no"></iframe>
|
||||
</div>
|
||||
<p id="callback">
|
||||
</p>
|
||||
|
||||
<script type="text/javascript" src="../../js/iframeResizer.contentWindow.min.js"></script>
|
||||
<script src="jquery.js"></script>
|
||||
<script type="text/javascript" src="../../js/iframeResizer.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/ie8.polyfils.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
iFrameResize({
|
||||
log: true, // Enable console logging
|
||||
onResized: function (messageData) { // Callback fn when message is received
|
||||
setTimeout(function () { parentIFrame.sendMessage('nested') }, 50);
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user