[refactor] improve background module

This commit is contained in:
Kuldeep M 2019-07-16 23:56:57 +01:00
parent f1f8939f27
commit eba414733d
3 changed files with 13 additions and 14 deletions

View File

@ -2,6 +2,16 @@ var background = (function() {
var mod = {}; var mod = {};
mod.import = function() {
// get files from input
var fileList = helper.e(".control-background-image-file").files;
// if file was added
if (fileList.length > 0) {
// validate the file
_validateImageFile(fileList);
};
};
mod.clear = { mod.clear = {
file: function() { file: function() {
helper.setObject({ helper.setObject({
@ -159,16 +169,6 @@ var background = (function() {
} }
}; };
var importData = function() {
// get files from input
var fileList = helper.e(".control-background-image-file").files;
// if file was added
if (fileList.length > 0) {
// validate the file
_validateImageFile(fileList);
};
};
var _validateImageFile = function(fileList) { var _validateImageFile = function(fileList) {
// make new file reader // make new file reader
var reader = new FileReader(); var reader = new FileReader();
@ -212,9 +212,8 @@ var background = (function() {
return { return {
init: init, init: init,
mod: mod, mod: mod,
bind: bind,
render: render, render: render,
importData: importData bind: bind
}; };
})(); })();

View File

@ -1,6 +1,6 @@
var version = (function() { var version = (function() {
var current = "3.45.0"; var current = "3.46.0";
var compare = function(a, b) { var compare = function(a, b) {
var pa = a.split("."); var pa = a.split(".");

View File

@ -2,7 +2,7 @@
"name": "nightTab", "name": "nightTab",
"short_name": "nightTab", "short_name": "nightTab",
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.", "description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
"version": "3.45.0", "version": "3.46.0",
"manifest_version": 2, "manifest_version": 2,
"chrome_url_overrides": { "chrome_url_overrides": {
"newtab": "index.html" "newtab": "index.html"