Op 12/01/2009 16:35, Christian Sonne schreef:
> Great idea, however, we need to make sure this works even if people
> have "new pages should be opened in" == "a new window"
> Currently, it will throw an error (I'm not quite sure why though), but
> even without that, the copy tab would open in a new window and not a
> tab, because Utils.openUrlInBrowser respects that setting
>
> -- cers / Christian Sonne
>
If the error is solved you will like this command too
// more flexible copy tab command
CmdUtils.CreateCommand({
name: "copy-searched-tab",
takes: {"tab name": noun_type_tab},
description: "Copies the searched tab",
execute: function( tab ) {
var tabName = tab.text;
if(tabName != "")
{
var tab = Utils.tabs.get(tabName);
Utils.openUrlInBrowser( tab.document.location.href );
}
else
{
var win = CmdUtils.getWindowInsecure();
Utils.openUrlInBrowser( win.location.href );
}
},
preview: function( pblock, tab ) {
var tabName = tab.text;
if (tabName == this._cacheKey) {
pblock.innerHTML = this._cacheValue;
}
else if( tabName.length > 1 ){
var tab = Utils.tabs.get(tabName);
if (tab) {
var imgData = CmdUtils.getTabSnapshot( tab, {width:500} );
pblock.innerHTML = "Copies the <b style=\"color:yellow\">%s</b>
tab.".replace(/%s/, tabName);
pblock.innerHTML += "<br/><img src='%s'>".replace(/%s/, imgData );
}
else
pblock.innerHTML = "Copies the current tab.";
}
else
pblock.innerHTML = "Copies the current tab.";
this._cacheKey = tabName;
this._cacheValue = pblock.innerHTML;
}
});
David
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ubiquity-firefox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---