hooking up a test frame to test sending different data to share page, simulate data sent by overlay. Restore the animation of the iframe shown in FF4beta.
This commit is contained in:
Родитель
aa5a69867d
Коммит
3735e6dfe1
|
@ -2,22 +2,11 @@
|
|||
<html>
|
||||
<head>
|
||||
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
|
||||
<script src="../../scripts/requireplugins-jquery-1.4.2.js" charset="utf-8"></script>
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
|
||||
<script>require(["index.js"]);</script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="share.css">
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#tabs").tabs({ fx: { opacity: 'toggle', duration: 200 } });
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.ui-tabs .ui-tabs-hide { display: none; }
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/* ***** 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):
|
||||
* */
|
||||
|
||||
/*jslint plusplus: false */
|
||||
/*global require: false, location: true, window: false, alert: false */
|
||||
"use strict";
|
||||
|
||||
require.def("send",
|
||||
["require", "jquery", "blade/fn", "rdapi", "blade/url"],
|
||||
function (require, $, fn, rdapi, url) {
|
||||
|
||||
var hash = location.href.split('#')[1],
|
||||
options = {
|
||||
services: {}
|
||||
};
|
||||
|
||||
if (hash) {
|
||||
options = url.queryToObject(hash);
|
||||
if (options.services) {
|
||||
options.services = JSON.parse(options.services);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(options);
|
||||
|
||||
//TODO: Call linkdrop account API first, to see if that works.
|
||||
|
||||
//Try twitter API if have a twitter name
|
||||
var twitter = options.services.Twitter;
|
||||
if (twitter && twitter.usernames) {
|
||||
var userName = twitter.usernames[0];
|
||||
$.getJSON('http://api.twitter.com/1/users/show.json?callback=?&screen_name=' +
|
||||
encodeURIComponent(userName), function (json) {
|
||||
$('#twitter')
|
||||
.find('img.avatar').attr('src', json.profile_image_url).end()
|
||||
.find('.username').html(json.name);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#tabs").tabs({ fx: { opacity: 'toggle', duration: 200 } });
|
||||
|
||||
$('.message').val(location.href);
|
||||
});
|
||||
});
|
|
@ -35,6 +35,10 @@ a {
|
|||
outline: none;
|
||||
}
|
||||
|
||||
.ui-tabs .ui-tabs-hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#tabs {
|
||||
height: 128px;
|
||||
overflow: hidden;
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
<!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 accountJson = JSON.parse(accountForm.find('textarea').val());
|
||||
iframeNode.src = shareUrl +
|
||||
'#services=' + encodeURIComponent(JSON.stringify(accountJson)) +
|
||||
'&url=' + $('shareUrl').val();
|
||||
iframeNode.contentWindow.location.reload(true);
|
||||
evt.preventDefault();
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe id="shareFrame" src="index.html"></iframe>
|
||||
|
||||
<hr>
|
||||
<form id="accountForm" action="#">
|
||||
Share URL: <input type="text" id="shareUrl" value="http://mozilla.com">
|
||||
<br>
|
||||
Send accounts:
|
||||
<textarea>
|
||||
{
|
||||
"Twitter": {
|
||||
"usernames": ["jeanreilly"]
|
||||
},
|
||||
"Facebook": {
|
||||
"usernames": ["jn.reilly@gmail.com"]
|
||||
}
|
||||
}
|
||||
</textarea>
|
||||
<button>Update</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче