From 0f1489727c137a9409270430a5e52cf3840aa7ab Mon Sep 17 00:00:00 2001 From: jdescottes Date: Thu, 26 Feb 2015 22:07:36 +0100 Subject: [PATCH] Removed JQuery from ImportController --- .../controller/settings/ImportController.js | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/js/controller/settings/ImportController.js b/src/js/controller/settings/ImportController.js index 37fe0b1f..bb2a659e 100644 --- a/src/js/controller/settings/ImportController.js +++ b/src/js/controller/settings/ImportController.js @@ -3,42 +3,38 @@ ns.ImportController = function (piskelController) { this.piskelController = piskelController; - this.importedImage_ = null; }; pskl.utils.inherit(ns.ImportController, pskl.controller.settings.AbstractSettingController); ns.ImportController.prototype.init = function () { - this.hiddenFileInput = document.querySelector('[name=file-upload-input]'); + this.hiddenFileInput = document.querySelector('[name="file-upload-input"]'); this.addEventListener(this.hiddenFileInput, 'change', this.onFileUploadChange_); - this.hiddenOpenPiskelInput = document.querySelector('[name=open-piskel-input]'); + this.hiddenOpenPiskelInput = document.querySelector('[name="open-piskel-input"]'); this.addEventListener(this.hiddenOpenPiskelInput, 'change', this.onOpenPiskelChange_); this.addEventListener('.browse-local-button', 'click', this.onBrowseLocalClick_); this.addEventListener('.file-input-button', 'click', this.onFileInputClick_); this.addEventListener('.open-piskel-button', 'click', this.onOpenPiskelClick_); - - this.previousSessionTemplate_ = pskl.utils.Template.get("previous-session-info-template"); - this.fillRestoreSession_(); + this.initRestoreSession_(); }; ns.ImportController.prototype.initRestoreSession_ = function () { - var html = ''; + var previousSessionContainer = document.querySelector('.previous-session'); var previousInfo = pskl.app.backupService.getPreviousPiskelInfo(); if (previousInfo) { - var previousSessionTemplate_ = pskl.utils.Template.get("previous-session-info-template"); - var date = pskl.utils.DateUtils.format(previousInfo.date, "{{H}}:{{m}} - {{Y}}/{{M}}/{{D}}"); - html = pskl.utils.Template.replace(previousSessionTemplate_, { + var previousSessionTemplate_ = pskl.utils.Template.get('previous-session-info-template'); + var date = pskl.utils.DateUtils.format(previousInfo.date, '{{H}}:{{m}} - {{Y}}/{{M}}/{{D}}'); + previousSessionContainer.innerHTML = pskl.utils.Template.replace(previousSessionTemplate_, { name : previousInfo.name, date : date }); this.addEventListener('.restore-session-button', 'click', this.onRestorePreviousSessionClick_); } else { - html = "No piskel backup was found on this browser."; + previousSessionContainer.innerHTML = 'No piskel backup was found on this browser.'; } - document.querySelector('.previous-session').innerHTML = html; }; ns.ImportController.prototype.closeDrawer_ = function () {