Skip to content

Instantly share code, notes, and snippets.

/selectedHistory.js

Created Apr 3, 2010
Embed
What would you like to do?
//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