Skip to content

Instantly share code, notes, and snippets.

@konk303
Created May 22, 2009 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save konk303/116147 to your computer and use it in GitHub Desktop.
Save konk303/116147 to your computer and use it in GitHub Desktop.
testing jetpack feature
<!DOCTYPE html>
<html>
<head>
<link rel="jetpack" href="jetpackTesting.js" />
<title>testing Jetpack</title>
</head>
<body>
<h1>testing Jetpack</h1>
</body>
</html>
jetpack.statusBar.append({
html: '<span id="changeAccount">account:</span><span id="status">testing</span>',
width: 200,
onReady: function(doc) {
// データの永続化は Jetpack.sessionStorage で
// ...どうせsession単位の記憶なら、closureでいいんじゃ
if (!jetpack.sessionStorage.twName) {
jetpack.sessionStorage.tw ={};
jetpack.sessionStorage.tw.name =
jetpack.tabs.focused.contentWindow.prompt('twitter id?');
jetpack.sessionStorage.tw.pass =
jetpack.tabs.focused.contentWindow.prompt('twitter pass?');
jetpack.sessionStorage.tw.counter = 1;
}
$("#changeAccount", doc).css({background:"green"});
$("#status", doc).css({background:"gold"});
var twitter = new jetpack.lib.twitter.Twit(
jetpack.sessionStorage.tw.name,
jetpack.sessionStorage.tw.pass
);
$(doc).click(function() {
var self = this;
//twitter.tweet("counter from jetpack, count:" + Jetpack.sessionStorage.counter);
jetpack.notifications.show(jetpack.sessionStorage.tw.toSource());
twitter.getLatestStatus(function(res){$(self).contents().find("p").html(res.text)});
jetpack.sessionStorage.tw.counter ++;
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment