Remove jq from tree.

This commit is contained in:
Lars Jung 2016-06-28 03:01:07 +02:00
parent 901d8c407d
commit 9c4f3111ba
7 changed files with 134 additions and 119 deletions

View file

@ -1,5 +1,4 @@
const {each} = require('../util');
const {jq} = require('../globals');
const {each, dom} = require('../util');
const server = require('../server');
const event = require('../core/event');
const location = require('../core/location');
@ -20,16 +19,16 @@ let selectedItems = [];
let $download;
function onSelection(items) {
const onSelection = items => {
selectedItems = items.slice(0);
if (selectedItems.length) {
$download.show();
} else if (!settings.alwaysVisible) {
$download.hide();
}
}
};
function onClick() {
const onClick = () => {
const type = settings.type;
let name = settings.packageName;
const extension = type === 'shell-zip' ? 'zip' : 'tar';
@ -54,16 +53,16 @@ function onClick() {
});
server.formRequest(query);
}
};
function init() {
const init = () => {
if (!settings.enabled) {
return;
}
$download = jq(template)
$download = dom(template)
.hide()
.appendTo('#toolbar')
.appTo('#toolbar')
.on('click', onClick);
if (settings.alwaysVisible) {
@ -71,7 +70,7 @@ function init() {
}
event.sub('selection', onSelection);
}
};
init();