P
P
Peter2012-12-19 07:21:03
JavaScript
Peter, 2012-12-19 07:21:03

How to create a new popup window in FireFox Extensions?

How to create a new popo FireFox Extensions window via ContextMenu, with Url like google.ru ?
In chrome, this is done in one or two

var clickHandler = function(info, tab) {
  chrome.windows.create({
          "url" :"http://google.ru",
          "width" : 600,
          "height" : 540,
          "type": "popup"
        });
}

chrome.contextMenus.create({
    "title": "Отправить на стенку",
    "contexts": ["page", "selection", "image", "link"],
    "onclick" : clickHandler
  });


And how to do it in FF, I can’t figure it out.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Peter, 2012-12-19
@SeNaP

overlay chrome://browser/content/browser.xul chrome://vkwall/content/browser.xul
browser.xul

<?xml version="1.0"?>
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">  
    <script type="application/x-javascript" src="main.js" />
    <menupopup id="contentAreaContextMenu" oncontextmenu="">
        <menuitem id="saveToFile" label="Отправить на стенку" oncommand="newTabb();"/>
    </menupopup>
</overlay>

main.js
function newTabb(){
    var params = "menubar=no,location=no,resizable=no,scrollbars=no,status=no,width=600,height=540";
    var img = (content.getSelection().focusNode.firstElementChild.src != undefined) ? content.getSelection().focusNode.firstElementChild.src : "" ;
    content.window.open("http://vk.com/share.php?image="+img+"&title="+content.document.title+"&url="+content.location.href+"&description="+content.getSelection().toString(), "Отпраить на стенку", params);	
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question