|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/*Firefox addon for win chocolateDF points |
|
|
|
|
Copyright (C) <year> <name of author> |
|
|
|
|
Copyright (C) <2016> <Benoît FORQUIN> |
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify |
|
|
|
|
it under the terms of the GNU General Public License as published by |
|
|
|
@ -14,34 +14,23 @@
|
|
|
|
|
You should have received a copy of the GNU General Public License |
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.*/
|
|
|
|
|
|
|
|
|
|
/*Pour futur développement sur Firefox mobile alias Fennec |
|
|
|
|
// Obtain component object : Chrome Authority
|
|
|
|
|
// https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Chrome_Authority
|
|
|
|
|
var { Cu } = require("chrome"); |
|
|
|
|
|
|
|
|
|
// Obtain commonly used services : Services.jsm
|
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Services.jsm
|
|
|
|
|
Cu.import("resource://gre/modules/Services.jsm"); |
|
|
|
|
|
|
|
|
|
function getNativeWindow() { |
|
|
|
|
|
|
|
|
|
let window = Services.wm.getMostRecentWindow("navigator:browser"); |
|
|
|
|
return window.NativeWindow; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getBrowserApp() { |
|
|
|
|
|
|
|
|
|
let window = Services.wm.getMostRecentWindow("navigator:browser"); |
|
|
|
|
return window.BrowserApp; |
|
|
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
var self = require("sdk/self"); |
|
|
|
|
var _ = require("sdk/l10n").get; |
|
|
|
|
//Le menu n'apparaît que sur
|
|
|
|
|
|
|
|
|
|
var contextMenu = require("sdk/context-menu"); |
|
|
|
|
|
|
|
|
|
/*Création du menu contextuel. |
|
|
|
|
================================ |
|
|
|
|
|
|
|
|
|
Il ne s'affiche que pour le domaine debian-facile.org |
|
|
|
|
grâce à la REgex https://developer.mozilla.org/en-US/Add-ons/SDK/Low-Level_APIs/util_match-pattern
|
|
|
|
|
et uniquement dans les textarea grâce à la fonction on("context") du fichier ./data/content-script.js |
|
|
|
|
|
|
|
|
|
Au click, on appel toujours la même fonction en lui passant en paramètre le message localisé situé dans le |
|
|
|
|
le fichier ./locale/xx-XX.properties |
|
|
|
|
*/ |
|
|
|
|
contextMenu.Menu({ |
|
|
|
|
label: "chocoDF", |
|
|
|
|
contentScriptFile : "./content-script.js", |
|
|
|
@ -58,23 +47,12 @@ contextMenu.Menu({
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var menuItem = contextMenu.Item({
|
|
|
|
|
// label: _("infodistri_label"),
|
|
|
|
|
// context: contextMenu.URLContext(/https:\/\/.*debian-facile\.org\/(?:viewtopic|post|edit)\.php.*/),
|
|
|
|
|
// //
|
|
|
|
|
// contentScriptFile : "./content-script.js",
|
|
|
|
|
|
|
|
|
|
// data: _("infodistri_message")
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// a dummy function, to show how tests work.
|
|
|
|
|
// to see how to test this function, look at test/test-index.js
|
|
|
|
|
// see https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Unit_testing
|
|
|
|
|
function dummy(text, callback) { |
|
|
|
|
callback(text); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
exports.dummy = dummy; |
|
|
|
|
|
|
|
|
|