Skip to content

Instantly share code, notes, and snippets.

Created April 3, 2010 08:55
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 anonymous/354283 to your computer and use it in GitHub Desktop.
Save anonymous/354283 to your computer and use it in GitHub Desktop.
//selectedHistory
//author: jazztao
jetpack.future.import("slideBar");
var _doc;
//左邊的SlideBar
jetpack.slideBar.append(
{
icon: "https://jetpack.mozillalabs.com/images/jetpack.png",
html: "<html><body>Hello!底下是你選取過的字串</body></html>",
onReady: function(slider) { _doc = slider.contentDocument; }
});
var myStringArray = new Array();
//當選取的時候
jetpack.future.import("selection");
jetpack.selection.onSelection(function(){
var newSelection = jetpack.selection.text;
//顯示選取的字串
jetpack.notifications.show(newSelection);
//將字串生成物件,丟進array裡。
//jetpack.selection.html = "<b>" + jetpack.selection.html +"</b>";
//myStringArray[myStringArray.length] = "<ul><b>" + newSelection + "</b></ul>";
$("body", _doc).append( "<ul>" + newSelection + "</ul>");
jetpack.notifications.show(myStringArray.toString());
//jetpack.notifications.show("Success Add the world");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment