client-share-web/share/testframe.html

83 строки
2.5 KiB
HTML

<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Raindrop.
-
- The Initial Developer of the Original Code is
- Mozilla Messaging, Inc..
- Portions created by the Initial Developer are Copyright (C) 2009
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- -->
<!DOCTYPE html>
<html>
<head>
<title>Test IFrame</title>
<style type="text/css">
html, body {
background-color: gray;
margin: 0;
padding: 0;
}
iframe {
height: 128px;
width: 100%;
border: 0;
}
#accountForm textarea {
width: 50%;
height: 150px;
}
</style>
<script src="../../scripts/requireplugins-jquery-1.4.2.js" charset="utf-8"></script>
<script>
require(["require", "jquery", "blade/fn", "rdapi", "blade/url"],
function (require, $, fn, rdapi, url) {
$(function () {
var accountForm = $('#accountForm'),
iframeNode = $('#shareFrame')[0],
shareUrl = 'index.html';
accountForm.bind('submit', function (evt) {
var options = JSON.parse(accountForm.find('textarea').val());
iframeNode.src = shareUrl +
'#options=' + encodeURIComponent(JSON.stringify(options));
iframeNode.contentWindow.location.reload(true);
evt.preventDefault();
});
});
});
</script>
</head>
<body>
<iframe id="shareFrame" src="index.html"></iframe>
<hr>
<form id="accountForm" action="#">
<br>
Options:
<textarea>
{
"title":"Mozilla Community Store: SFX Group Image | Flickr - Photo Sharing!",
"url":"http://www.flickr.com/photos/29142435@N08/3060086137/",
"canonicalUrl":"http://flic.kr/p/5EpJZP",
"previews":["http://farm4.static.flickr.com/3047/3060086137_72d717e75c_m.jpg"]
}
</textarea>
<button>Update</button>
</form>
</body>
</html>