From 070a0d4110d0e600da8c1ab41a9c0c57f4159ba3 Mon Sep 17 00:00:00 2001 From: Rob Stupay Date: Tue, 25 Jul 2017 17:53:25 +0200 Subject: [PATCH] update for errors --- src/app/file-explorer.js | 2 +- src/app/modal-dialog-alert.js | 135 --------------------------------- src/app/modal-dialog-custom.js | 2 +- src/app/modaldialog.js | 1 - 4 files changed, 2 insertions(+), 138 deletions(-) delete mode 100644 src/app/modal-dialog-alert.js diff --git a/src/app/file-explorer.js b/src/app/file-explorer.js index c59e903fbb3..d660fb5bc44 100755 --- a/src/app/file-explorer.js +++ b/src/app/file-explorer.js @@ -1,4 +1,4 @@ -/* global FileReader, confirm, alert */ +/* global FileReader, confirm */ var yo = require('yo-yo') var csjs = require('csjs-inject') var Treeview = require('ethereum-remix').ui.TreeView diff --git a/src/app/modal-dialog-alert.js b/src/app/modal-dialog-alert.js deleted file mode 100644 index dd38caeac4c..00000000000 --- a/src/app/modal-dialog-alert.js +++ /dev/null @@ -1,135 +0,0 @@ -var yo = require('yo-yo') -var csjs = require('csjs-inject') - -var css = csjs` - .modal { - display: none; /* Hidden by default */ - position: fixed; /* Stay in place */ - z-index: 1000; /* Sit on top of everything including the dragbar */ - left: 0; - top: 0; - width: 100%; /* Full width */ - height: 100%; /* Full height */ - overflow: auto; /* Enable scroll if needed */ - background-color: rgb(0,0,0); /* Fallback color */ - background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ - } - .modalHeader { - padding: 2px 16px; - background-color: orange; - color: white; - } - .modalBody { - padding: 1.5em; - line-height: 1.5em; - } - .modalFooter { - padding: 10px 30px; - background-color: orange; - color: white; - text-align: right; - font-weight: 700; - cursor: pointer; - } - .modalContent { - position: relative; - background-color: #fefefe; - margin: auto; - padding: 0; - line-height: 18px; - font-size: 13px; - border: 1px solid #888; - width: 50%; - box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19); - -webkit-animation-name: animatetop; - -webkit-animation-duration: 0.4s; - animation-name: animatetop; - animation-duration: 0.4s - } - .modalFooterOk { - cursor: pointer; - } - @-webkit-keyframes animatetop { - from {top: -300px; opacity: 0} - to {top: 0; opacity: 1} - } - @keyframes animatetop { - from {top: -300px; opacity: 0} - to {top: 0; opacity: 1} - } -` - -module.exports = (content, title, ok, cancel) => { - var containerOrig = document.querySelector('.modal') - var container - if (!containerOrig) { - container = document.querySelector(`.${css.modal}`) - if (!container) { - document.querySelector('body').appendChild(html()) - container = document.querySelector(`.${css.modal}`) - } - } else { - var parent = document.querySelector('body') - var child = document.getElementById('modaldialog') - parent.removeChild(child) - document.querySelector('body').appendChild(html()) - container = document.querySelector(`.${css.modal}`) - } - - var okDiv = document.getElementById('modal-footer-ok') - okDiv.innerHTML = (ok && ok.label !== undefined) ? ok.label : 'OK' - - var modal = document.querySelector(`.${css.modalBody}`) - var modalTitle = document.querySelector(`.${css.modalHeader} h2`) - var modalFooter = document.querySelector(`.${css.modalFooter}`) - - modalTitle.innerHTML = '' - if (title) modalTitle.innerHTML = title - - modal.innerHTML = '' - if (content) modal.innerHTML = content - - container.style.display = container.style.display === 'block' ? hide() : show() - - function clickModalFooterListener (event) { - hide() - removeEventListener() - } - - function okListener () { - hide() - // if (ok && ok.fn) ok.fn() - what is ok.fn doing? - removeEventListener() - } - - function hide () { - container.style.display = 'none' - } - - function show () { - container.style.display = 'block' - } - - function removeEventListener () { - okDiv.removeEventListener('click', okListener) - modal.removeEventListener('click', clickModalFooterListener) - } - - okDiv.addEventListener('click', okListener) - modalFooter.addEventListener('click', clickModalFooterListener) -} - -function html () { - return yo`` -} diff --git a/src/app/modal-dialog-custom.js b/src/app/modal-dialog-custom.js index 4e2587b67fc..aad4586a857 100644 --- a/src/app/modal-dialog-custom.js +++ b/src/app/modal-dialog-custom.js @@ -2,6 +2,6 @@ var modal = require('./modaldialog.js') var yo = require('yo-yo') module.exports = { alert: function (text) { - modal('', yo`
${text}
`, null, {label:null}) + modal('', yo`
${text}
`, null, { label: null }) } } diff --git a/src/app/modaldialog.js b/src/app/modaldialog.js index 0bb20429159..2adcec66f9e 100644 --- a/src/app/modaldialog.js +++ b/src/app/modaldialog.js @@ -87,7 +87,6 @@ module.exports = (title, content, ok, cancel) => { var modal = document.querySelector(`.${css.modalBody}`) var modalTitle = document.querySelector(`.${css.modalHeader} h2`) - var modalFooter = document.querySelector(`.${css.modalFooter}`) modalTitle.innerHTML = '' if (title) modalTitle.innerHTML = title