From 9bc577a83aa4ac1430d3bd4d7193b8ce40b23496 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 21 Feb 2017 17:20:27 +0200 Subject: [PATCH] feature(config) rm notification: do nothing --- HELP.md | 1 - client/config.js | 7 ------- client/dom.js | 1 - client/notify.js | 46 ---------------------------------------------- json/config.json | 1 - tmpl/config.hbs | 9 --------- 6 files changed, 65 deletions(-) delete mode 100644 client/notify.js diff --git a/HELP.md b/HELP.md index 41e5882b..627c9ce1 100644 --- a/HELP.md +++ b/HELP.md @@ -244,7 +244,6 @@ Here is description of options: "packer" : "tar", /* default, could be "tar" or "zip" */ "diff" : true, /* when save - send patch, not whole file */ "zip" : true, /* zip text before send / unzip before save */ - "notifications" : false, /* show notifications when tab is not active*/ "localStorage" : true, /* local storage */ "buffer" : true, /* buffer for copying files */ "dirStorage" : true, /* store directory listing to localStorage */ diff --git a/client/config.js b/client/config.js index 78db350e..610ae1e5 100644 --- a/client/config.js +++ b/client/config.js @@ -15,8 +15,6 @@ const {Dialog} = DOM; const TITLE = 'Config'; const alert = currify(Dialog.alert, TITLE); -const Notify = DOM.Notify; - const Config = module.exports; const showLoad = () => { @@ -203,11 +201,6 @@ function onChange(el) { else if (name === 'auth') onAuthChange(data); - if (name === 'notifications') { - if (data && !Notify.check()) - Notify.request(); - } - obj[name] = data; Config.save(obj); diff --git a/client/dom.js b/client/dom.js index e1c8a583..fd4569b7 100644 --- a/client/dom.js +++ b/client/dom.js @@ -28,7 +28,6 @@ DOM.Storage = require('./storage'); DOM.Files = require('./files'); DOM.RESTful = require('./rest'); DOM.load = require('./load'); -DOM.Notify = require('./notify'); function DOMTreeProto() { const DOM = this; diff --git a/client/notify.js b/client/notify.js deleted file mode 100644 index 6ce1209c..00000000 --- a/client/notify.js +++ /dev/null @@ -1,46 +0,0 @@ -/* global CloudCmd */ - -'use strict'; - -const Events = require('./events'); - -let Show; - -Events.add({ - 'blur': () => { - Show = true; - }, - 'focus': () => { - Show = false; - } -}); - -module.exports.send = (msg) => { - const notifications = CloudCmd.config('notifications'); - const focus = window.focus.bind(window); - const granted = check(); - - if (!notifications || !granted || !Show) - return; - - const notify = new Notification(msg, { - icon: '/img/favicon/favicon-notify.png' - }); - - Events.addClick(notify, focus); -}; - -module.exports.check = check; - -function check() { - const Not = Notification; - const perm = Not && Not.permission; - - return perm === 'granted'; -} - -module.exports.request = () => { - if (Notification) - Notification.requestPermission(); -}; - diff --git a/json/config.json b/json/config.json index e15321f0..f18437c7 100644 --- a/json/config.json +++ b/json/config.json @@ -7,7 +7,6 @@ "packer": "tar", "diff": true, "zip" : true, - "notifications": false, "localStorage": true, "buffer": true, "dirStorage": false, diff --git a/tmpl/config.hbs b/tmpl/config.hbs index 12d41066..05824506 100644 --- a/tmpl/config.hbs +++ b/tmpl/config.hbs @@ -48,15 +48,6 @@ -
  • - -