mediawiki-extensions-Visual.../demos/playground/iframe.html
Christian Williams 82cbb4a8ba New playground test for inspectors in iframes
Change-Id: I5f0aeb01da789030117028ff4cb014f4c07fab8d
2012-05-14 17:43:34 -07:00

42 lines
1.6 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>iFrame Selection Demo</title>
<style>
.myframe {
background: #EEE;
border: 1px solid #AAA;
bottom: 5px;
display: none;
height: 50px;
position: absolute;
right: 5px;
width: 200px;
}
</style>
<script src="../../modules/rangy/rangy-core.js"></script>
<script src="../../modules/jquery/jquery.js"></script>
</head>
<body>
<div contenteditable="true">
<p>This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document.</p>
</div>
<iframe class="myframe" src="iframe2.html"></iframe>
<script>
$(function() {
$('body').on('mouseup', function() {
var sel = rangy.getSelection();
var range = sel.getRangeAt(0);
if (!range.collapsed) {
$('iframe').show();
} else {
$('iframe').hide();
}
});
});
</script>
</body>
</html>