From 8a5f45acbb127d635ea4d79b2680c921551bc7c4 Mon Sep 17 00:00:00 2001 From: rottencandy Date: Mon, 15 Jul 2019 21:49:28 +0530 Subject: [PATCH] Add CSS based modal message A modal(dialog popup message) can be made using rs.popupAlert(). --- webui-src/app/assets/index.html | 2 ++ webui-src/app/downloads.js | 2 +- webui-src/app/rswebui.js | 23 ++++++++++++++++++ webui-src/app/theme.css | 41 ++++++++++++++++++++++++++++++--- 4 files changed, 64 insertions(+), 4 deletions(-) diff --git a/webui-src/app/assets/index.html b/webui-src/app/assets/index.html index 2f2eeb2..07a4451 100644 --- a/webui-src/app/assets/index.html +++ b/webui-src/app/assets/index.html @@ -40,5 +40,7 @@ +
+ diff --git a/webui-src/app/downloads.js b/webui-src/app/downloads.js index 7cbce96..688ce31 100644 --- a/webui-src/app/downloads.js +++ b/webui-src/app/downloads.js @@ -134,7 +134,7 @@ function actionButton(file, action) { onclick: function() { fileAction(file.hash, 'cancel'); }, - }, m('i.fas.fa-times')); + }, 'Cancel'); } }; diff --git a/webui-src/app/rswebui.js b/webui-src/app/rswebui.js index 19330b7..04a0697 100644 --- a/webui-src/app/rswebui.js +++ b/webui-src/app/rswebui.js @@ -123,10 +123,33 @@ Tab.active = ''; Tab.componentList = {}; Tab.routeTable = {}; +function popupAlert(message) { + let container = document.getElementById('modal-container'); + let popup = document.createElement('div'); + popup.setAttribute('id', 'modal-content'); + popup.innerHTML = + ` + +

+

` + message + `

`; + container.appendChild(popup); + container.style.display = 'block'; + let removeMessage = function() { + popup.remove(); + container.style.display = 'none'; + } + container.onclick = removeMessage; + document.getElementById('modal-cancel-button') + .onckick = removeMessage; +} + module.exports = { rsJsonApiRequest, setKeys, setBackgroundTask, Tab, + popupAlert, }; diff --git a/webui-src/app/theme.css b/webui-src/app/theme.css index 95f2465..0136d96 100644 --- a/webui-src/app/theme.css +++ b/webui-src/app/theme.css @@ -47,8 +47,8 @@ button { box-shadow: inset 3px 3px 0 #0d69ac; } button.red { - background: #f00202; - box-shadow: inset -3px -3px 0 #bd0909; + background: #bd0909; + box-shadow: inset -3px -3px 0 #830000; } table { @@ -143,6 +143,41 @@ table { animation: fadein 0.5s; } +#modal-container { + display: none; + position: fixed; + z-index: 1; + height: 100%; +} +#modal-container { + top: 0; + left: 0; + width: 100%; + background-color: rgba(0, 0, 0, 0.2); +} +#modal-content { + position: absolute; + color: #555; + width: 40%; + height: 40%; + transform: translate(60%, 50%); + background-color: white; + padding: 1em; + border-radius: 20px; + animation: fadein 0.3s; +}#modal-content p { + font-size: 1.5em; +}#modal-content button { + float: right; +} + +#notification-container { + position: absolute; + bottom: 0; + right: 0; +}#notification-container .notification { +} + /****************************** Animations ******************************/ @@ -230,7 +265,7 @@ a.tab-menu-item { border: 1px solid #ccc; margin-top: 2em; padding: 1em; - animation: swipe-from-left 0.5s; + animation: fadein 0.5s; }.file-view > p { margin: 0.5em; font-size: 1.1em;