aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Christopher Vogt <oss.nsp@cvogt.org>2017-05-01 14:02:09 -0400
committerGitHub <noreply@github.com>2017-05-01 14:02:09 -0400
commit6b26577a5e2bd16f7e4d943f160c6fac85210e46 (patch)
tree82c2a55aa43e4334e514d15b95b8136ce33928c7
parentfb0c68ffab35db304771e177ce93f80a680fabcc (diff)
parentae4b7b1ef5ec86f8ac5859d6e3593ba49885f036 (diff)
downloadcbt-6b26577a5e2bd16f7e4d943f160c6fac85210e46.tar.gz
cbt-6b26577a5e2bd16f7e4d943f160c6fac85210e46.tar.bz2
cbt-6b26577a5e2bd16f7e4d943f160c6fac85210e46.zip
Merge pull request #507 from tim-zh/issue/421
Fix #421 Html notifications
-rw-r--r--tools/gui/resources/web/definitions.js9
-rw-r--r--tools/gui/resources/web/index.html1
-rw-r--r--tools/gui/resources/web/main.js6
-rw-r--r--tools/gui/resources/web/styles.css13
4 files changed, 23 insertions, 6 deletions
diff --git a/tools/gui/resources/web/definitions.js b/tools/gui/resources/web/definitions.js
index 75ef509..846bbc9 100644
--- a/tools/gui/resources/web/definitions.js
+++ b/tools/gui/resources/web/definitions.js
@@ -53,12 +53,15 @@ let Popup = {
};
let Notifications = {
- init: function () {
- Notification.requestPermission();
+ init: function (container) {
+ this._container = container;
},
show: function (text, title) {
- new Notification(title || "", {body: text});
+ let now = new Date();
+ this._container.html(this._container.html() + now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds() +
+ " <b>" + (title || "") + "</b><br>" + text + "<br><br>");
+ this._container.animate({scrollTop: this._container[0].scrollHeight}, {duration: 500, queue: false});
},
showFail: function (e) {
diff --git a/tools/gui/resources/web/index.html b/tools/gui/resources/web/index.html
index 6b7a7a9..0b25c0e 100644
--- a/tools/gui/resources/web/index.html
+++ b/tools/gui/resources/web/index.html
@@ -10,6 +10,7 @@
<link rel="stylesheet" href="highlight/hljs-cbt-theme.css">
</head>
<body>
+<div id="notifications"></div>
<div id="popup">
<div class="stroke" onclick="Popup.hide()">×</div>
<table id="popup-table"></table>
diff --git a/tools/gui/resources/web/main.js b/tools/gui/resources/web/main.js
index 139795a..3a5e418 100644
--- a/tools/gui/resources/web/main.js
+++ b/tools/gui/resources/web/main.js
@@ -1,4 +1,4 @@
-Notifications.init();
+Notifications.init($("#notifications"));
Popup.init($("#popup"), $("#popup-table"));
@@ -35,7 +35,7 @@ function createProject() {
dependencies: Dependencies.serialize(),
flags: getFlags()
}, "post").done(() => {
- Notifications.show("Done.");
+ Notifications.show("Project created.");
}).always(() => {
button.innerHTML = buttonText;
button.disabled = false;
@@ -65,7 +65,7 @@ function copyProject() {
button.blur();
button.disabled = true;
ajax("/project/copy", {name: name}, "post").done(() => {
- Notifications.show("Done.");
+ Notifications.show("Project copied.");
}).always(() => {
button.innerHTML = buttonText;
button.disabled = false;
diff --git a/tools/gui/resources/web/styles.css b/tools/gui/resources/web/styles.css
index 124b63f..e9d6626 100644
--- a/tools/gui/resources/web/styles.css
+++ b/tools/gui/resources/web/styles.css
@@ -149,6 +149,19 @@ button, .entry {
cursor: pointer;
}
+#notifications {
+ position: absolute;
+ top: 1em;
+ left: 1em;
+ width: 20%;
+ max-height: 30%;
+ background: rgba(0, 0, 0, 0.1);
+ padding: 0 0.2em;
+ font-size: 0.5em;
+ overflow-y: auto;
+ word-wrap: break-word;
+}
+
#popup {
position: fixed;
left: 0;