Browse Source

Commit initial

master
Benoît FORQUIN 6 years ago
commit
6eb5360387
  1. 2
      README.md
  2. BIN
      data/chocolat_jojo16.png
  3. BIN
      data/chocolat_jojo32.png
  4. BIN
      data/chocolat_jojo64.png
  5. 12
      data/content-script.js
  6. 80
      index.js
  7. 28
      locale/fr-FR.properties
  8. 17
      package.json
  9. 19
      test/test-index.js

2
README.md

@ -0,0 +1,2 @@
#chocoDF
Insère les blocs de bbcode pour obtenir des points-chocolat Debian-Facile

BIN
data/chocolat_jojo16.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 797 B

BIN
data/chocolat_jojo32.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
data/chocolat_jojo64.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

12
data/content-script.js

@ -0,0 +1,12 @@
self.on("context", function (node) {
return !!document.querySelector("textarea");
});
self.on("click", function (node,data) {
var text = node.name;
var textArea = document.getElementsByName("req_message")[0];
textArea.value = textArea.value + data;
});

80
index.js

@ -0,0 +1,80 @@
/*Firefox addon for win chocolateDF points
Copyright (C) <year> <name of author>
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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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");
contextMenu.Menu({
label: "chocoDF",
contentScriptFile : "./content-script.js",
context: contextMenu.URLContext(/https:\/\/.*debian-facile\.org\/.*/),
image: self.data.url("chocolat_jojo16.png"),
items: [
contextMenu.Item({ label: _("couleur_label"), data: _("couleur_message") }),
contextMenu.Item({ label: _("resolu_label"), data: _("resolu_message") }),
contextMenu.Item({ label: _("infodistri_label"), data: _("infodistri_message") }),
contextMenu.Item({ label: _("lapin_label"), data: _("lapin_message") }),
contextMenu.Item({ label: _("bernacle_label"), data: _("bernacle_message") }),
contextMenu.Item({ label: _("marche_label"), data: _("marche_message") })
],
});
//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
function dummy(text, callback) {
callback(text);
}
exports.dummy = dummy;

28
locale/fr-FR.properties

@ -0,0 +1,28 @@
#Infodistri
infodistri_label = Trop cool de reseigner sont infodistri
infodistri_message = [i][url=http://debian-facile.org/:atelier:indications-forum]Voir le tuto : Trop cool d'indiquer son installation dans son profil ![/url][/i]
#Bernacle-->
bernacle_label = On ne bernacle pas !
bernacle_message = [i][url=http://debian-facile.org/atelier:bernacle]Voir le tuto : On ne bernacle pas le post d'autrui. Plop ![/url][/i]
#bernacle.accesskey = b
#Coloration syntaxique-->
couleur_label = Le code, ça pique moins en couleurs !
couleur_message = [i][url=http://debian-facile.org/atelier:coloration-syntaxique]Voir le tuto : Le code, ça pique moins les yeux en couleur[/url][/i]
#couleur.accesskey = c
#Résolu-->
resolu_label = C'est résolu, Bravo !
resolu_message = [i][url=http://debian-facile.org/atelier:resolu]Voir le tuto : C'est résolu ! Bravo mais il faut l'indiquer dans l'titre.[/url][/i]
#resolu.accesskey = r
#Lapin compris votre formulation-->
lapin_label = Lapin compris !
lapin_message = [i][url=http://debian-facile.org/atelier:huile-de-meninges]Voir le tuto : Lapin compris votre formulation ?[/url][/i]
#lapin.accesskey = l
#Ça marche pas !-->
marche_label = Ça marche pas !
marche_message = [i][url=http://debian-facile.org/atelier:ca-marche-pas]Voir le tuto : Manuel du chocolat DF : « Ça marche pas ! »[/url][/i]
#marche.accesskey = m

17
package.json

@ -0,0 +1,17 @@
{
"title": "chocoDF",
"name": "chocodf",
"version": "0.2.2",
"id": "chocoDF@pansebete.net",
"description": "Insère les blocs de bbcode pour obtenir des points-chocolat Debian-Facile",
"main": "index.js",
"author": "bendia",
"engines": {
"firefox": ">=38.0a1",
"fennec": ">=38.0a1"
},
"license": "GPLV3",
"keywords": [
"jetpack"
]
}

19
test/test-index.js

@ -0,0 +1,19 @@
var main = require("../");
exports["test main"] = function(assert) {
assert.pass("Unit test running!");
};
exports["test main async"] = function(assert, done) {
assert.pass("async Unit test running!");
done();
};
exports["test dummy"] = function(assert, done) {
main.dummy("foo", function(text) {
assert.ok((text === "foo"), "Is the text actually 'foo'");
done();
});
};
require("sdk/test").run(exports);
Loading…
Cancel
Save