Revision: 9643 http://languagetool.svn.sourceforge.net/languagetool/?rev=9643&view=rev Author: gulp21-1 Date: 2013-03-09 17:32:34 +0000 (Sat, 09 Mar 2013) Log Message: ----------- [extension] added context menuitem (not yet working as expected)
Modified Paths: -------------- trunk/extension/firefox/lib/main.js trunk/extension/firefox/locale/en-US.properties Modified: trunk/extension/firefox/lib/main.js =================================================================== --- trunk/extension/firefox/lib/main.js 2013-03-09 17:30:42 UTC (rev 9642) +++ trunk/extension/firefox/lib/main.js 2013-03-09 17:32:34 UTC (rev 9643) @@ -1,3 +1,5 @@ +var cm = require("sdk/context-menu"); +var panels=require("panel"); var preferencesservice=require("preferences-service"); var Request=require("request").Request; var selection=require("selection"); @@ -138,7 +140,7 @@ return returnLanguage+returnTextGrammar+returnTextSpelling; } -var panel=require("panel").Panel({ +var panel=panels.Panel({ contentURL: self.data.url("panel.html"), contentScriptFile: self.data.url("panel.js"), onHide: function () { @@ -256,18 +258,27 @@ } } +function widgetOnClick() { + tabs.activeTab.attach({ + contentScriptFile: self.data.url("content.js"), + onMessage: function (message) { + if(message!="-NULL-") selectedText=message; + widgetClicked(); + } + }); +} + var widget=widgets.Widget({ id: "lt-check", label: _("checkSelectionWithLT"), contentURL: self.data.url("iconSmall.ico"), panel: panel, - onClick: function() { - tabs.activeTab.attach({ - contentScriptFile: self.data.url("content.js"), - onMessage: function (message) { - if(message!="-NULL-") selectedText=message; - widgetClicked(); - } - }); - } + onClick: widgetOnClick }); + +cm.Item({ + label: _("checkSelectionWithLTShort"), + context: cm.SelectionContext(), // TODO or in TEXTAREA (CSS selector) + contentScript: 'self.on("click", self.postMessage);', + onMessage: widgetOnClick +}); Modified: trunk/extension/firefox/locale/en-US.properties =================================================================== --- trunk/extension/firefox/locale/en-US.properties 2013-03-09 17:30:42 UTC (rev 9642) +++ trunk/extension/firefox/locale/en-US.properties 2013-03-09 17:32:34 UTC (rev 9643) @@ -2,6 +2,7 @@ pleaseWaitWhileChecking=Please wait while the text is being checked … noProblemsFound=No problems have been found. checkSelectionWithLT=Check selected text or text in text field with LanguageTool +checkSelectionWithLTShort=Check with LanguageTool moreInformation=more information checkLtRunning=Please make sure that a LanguageTool Server is running on %s, or <a href="javascript:enableWebService();">enable the web service</a>. (When enabling the web service, the text is sent over the internet; please read the <a href="https://addons.mozilla.org/firefox/addon/languagetoolfx/privacy/">privacy policy</a> for details. The web service can be disabled in the settings of the add-on at any time.) usingWebService=Using local server failed, connecting with web service … This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev _______________________________________________ Languagetool-commits mailing list Languagetool-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/languagetool-commits