Ubiquity Command - Current Song
Subscribe
Labels: firefox, programming, ubiquity-commands
Labels: firefox, programming, ubiquity-commands
CmdUtils.CreateCommand({
name: "quote-to-quick-reply",
homepage: "http://deevus.digitalchild.org",
author: {name: "Simon Hartcher", email: "deevus@gmail.com"},
license: "GPL",
description: "Quotes the selected text to the Quick Reply box. Only works for phpbb forums with Quick Reply enabled.",
execute : function() {
//get selected text
var selection = CmdUtils.getSelection();
//get the node of the selection text
var parent = CmdUtils.getWindow().getSelection().anchorNode;
{
//traverse the nodes until the parent table is found
while (parent != null && parent.className != "tablebg") {
parent = parent.parentNode;
}
}
//find the name of the post author from within the table node
var author = jQuery(".postauthor", parent.innerHTML).html();
//construct the quote text
var quotetext = "[quote=\""+ author + "\"]"+ selection +"[/quote]";
//place it quote text into quick reply box
var doc = CmdUtils.getDocument();
var quickReply = jQuery("#message", doc);
quickReply.val(quickReply.val() + quotetext);
}
});
Labels: firefox, programming, ubiquity-commands