Skip to content

Commit

Permalink
Version 1.0.0 de l'extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Aldarone committed Jan 5, 2016
1 parent be5bc73 commit 66ab426
Show file tree
Hide file tree
Showing 9 changed files with 802 additions and 0 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#Wallabag-next
Post URL to Wallabag

Does the same as wallabag-extension from Wallabag but using the latest Firefox SDK instead of the old XUL.

Original Add-on : [Wallabag firefox-ext](https://addons.mozilla.org/fr/firefox/addon/wallabag/)
Original source code : [Wallabag firefox-ext source code](https://github.com/wallabag/firefox-ext)
Binary file added data/icon-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icon-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icon-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions data/js/wallabag-get-infos.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
self.port.on('ping', function wallabagPing(){
var url = document.URL;

var pageInfos = {
wallaUrl: url,
};

self.port.emit('pong', pageInfos);
});
63 changes: 63 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
var self = require('sdk/self');
var tabs = require('sdk/tabs');
var workers = require('sdk/content/worker');

var {ActionButton} = require('sdk/ui/button/action');
var {openDialog} = require('sdk/window/utils');

var base64 = require('sdk/base64');

var toolbarButton = ActionButton({
id: 'wallabag-toolbar-button',
label: 'Bag it !',
icon: {
'16': self.data.url('icon-16.png'),
'32': self.data.url('icon-32.png'),
'64': self.data.url('icon-64.png')
}
});

var wallabag = {
buttonClick: function wallabagButtonClick(state) {
var worker = tabs.activeTab.attach({
contentScriptFile: self.data.url('js/wallabag-get-infos.js')
});

worker.port.emit('ping');
worker.port.on('pong', wallabag.postLink);
},

postLink: function wallabagPostLink(linkInfo) {
var wallabagUrl = require('sdk/simple-prefs').prefs.wallabagUrl;
var height = require('sdk/simple-prefs').prefs.wallabagHeight;
var width = require('sdk/simple-prefs').prefs.wallabagWidth;

var url = linkInfo.wallaUrl;
var title = linkInfo.wallaTitle;
var description = linkInfo.wallaDescription;

var GET = [
'action=add',
'autoclose=true',
'url='+base64.encode(url),
];

var features = [
'height='+height,
'width='+width,
'centerscreen=yes',
'toolbar=no',
'menubar=no',
'scrollbars=no',
'status=no',
'dialog'
];

openDialog({
url: wallabagUrl+"?"+GET.join('&'),
features: features.join(',')
});
}
};

toolbarButton.on('click', wallabag.buttonClick);
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"title": "Wallabag-next",
"name": "wallabag-next",
"version": "1.0.0",
"description": "Post URL to Wallabag",
"main": "index.js",
"author": "Alda Marteau-Hardi",
"engines": {
"firefox": ">=38.0a1"
},
"license": "GPLv3",
"updateURL": "https://raw.githubusercontent.com/Aldarone/wallabag-extension-next/master/update.rdf",
"preferences": [
{
"name": "wallabagUrl",
"title": "Wallabag URL",
"type": "string",
"value": ""
},
{
"name": "wallabagWidth",
"title": "Window width",
"type": "integer",
"value": 600
},
{
"name": "wallabagHeight",
"title": "Window height",
"type": "integer",
"value": 530
}
]
}
16 changes: 16 additions & 0 deletions update.rdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>

<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">

<!-- This Description resource includes all the update and compatibility information for
a single add-on with the id foobar@developer.mozilla.org. You can list multiple
add-ons information in the same RDF file. -->
<RDF:Description about="urn:mozilla:extension:@wallabag-next">
<em:updates>
<RDF:Seq>

</RDF:Seq>
</em:updates>
</RDF:Description>
</RDF:RDF>

0 comments on commit 66ab426

Please sign in to comment.