浏览代码

Merge branch 'kkrisstoff-add/tip-randomiser'

j8
hristoterezov 8 年前
父节点
当前提交
66fbc28385
共有 3 个文件被更改,包括 54 次插入24 次删除
  1. 4
    12
      close.html
  2. 48
    0
      close.js
  3. 2
    12
      close2.html

+ 4
- 12
close.html 查看文件

@@ -3,20 +3,12 @@
3 3
     <link rel="stylesheet" href="css/all.css"/>
4 4
     <!--#include virtual="title.html" -->
5 5
     <script><!--#include virtual="/interface_config.js" --></script>
6
-    <script>function translateStr(id, msg) {
7
-        var div = document.getElementById(id);
8
-        div.innerHTML = msg;
9
-    }
10
-    function translate() {
11
-        translateStr('hintMessage',
12
-            'You can pin participants by clicking on their thumbnails');
13
-    }
14
-    </script>
6
+    <script src="close.js"></script>
15 7
 </head>
16
-<body onload="translate();">
8
+<body>
17 9
 <div class="redirectPageMessage">
18 10
     <div class="thanks-msg">
19
-        <p id="thanksMessage">Thank you for your feedback!</p>
11
+        <p>Thank you for your feedback!</p>
20 12
     </div>
21 13
     <div class="hint-msg">
22 14
         <p>
@@ -27,4 +19,4 @@
27 19
     </div>
28 20
 </div>
29 21
 </body>
30
-</html>
22
+</html>

+ 48
- 0
close.js 查看文件

@@ -0,0 +1,48 @@
1
+/* global interfaceConfig */
2
+//list of tips
3
+var hints = [
4
+    "You can pin participants by clicking on their thumbnails.",// jshint ignore:line
5
+    "You can tell others you have something to say by using the \"Raise Hand\" feature",// jshint ignore:line
6
+    "You can learn about key shortcuts by pressing Shift+?",// jshint ignore:line
7
+    "You can learn more about the state of everyone's connection by hovering on the bars in their thumbnail",// jshint ignore:line
8
+    "You can hide all thumbnails by using the button in the bottom right corner"// jshint ignore:line
9
+];
10
+
11
+/**
12
+ * Get a random hint meessage from hint array.
13
+ *
14
+ * @return {string} the hint message.
15
+ */
16
+function getHint(){
17
+    var l = hints.length - 1;
18
+    var n = Math.round(Math.random() * l);
19
+
20
+    return hints[n];
21
+}
22
+
23
+/**
24
+ * Inserts text message
25
+ * into DOM element
26
+ *
27
+ * @param id {string} element identificator
28
+ * @param msg {string} text message
29
+ */
30
+// eslint-disable-next-line no-unused-vars
31
+function insertTextMsg(id, msg){
32
+    var el = document.getElementById(id);
33
+
34
+    if (el)
35
+        el.innerText = msg;
36
+}
37
+
38
+/**
39
+ * Sets the hint and thanks messages. Will be executed on load event.
40
+ */
41
+function onLoad() {
42
+    //Works only for close2.html because close.html doesn't have this element.
43
+    insertTextMsg('thanksMessage',
44
+        'Thank you for using ' + interfaceConfig.APP_NAME);
45
+    insertTextMsg('hintMessage', getHint());
46
+}
47
+
48
+window.onload = onLoad;

+ 2
- 12
close2.html 查看文件

@@ -3,19 +3,9 @@
3 3
     <link rel="stylesheet" href="css/all.css"/>
4 4
     <!--#include virtual="title.html" -->
5 5
     <script><!--#include virtual="/interface_config.js" --></script>
6
-    <script>function translateStr(id, msg) {
7
-        var div = document.getElementById(id);
8
-        div.innerHTML = msg;
9
-    }
10
-    function translate() {
11
-        translateStr('thanksMessage',
12
-            'Thank you for using ' + interfaceConfig.APP_NAME);
13
-        translateStr('hintMessage',
14
-            'You can pin participants by clicking on their thumbnails');
15
-    }
16
-    </script>
6
+    <script src="close.js"></script>
17 7
 </head>
18
-<body onload="translate();">
8
+<body>
19 9
     <div class="redirectPageMessage">
20 10
         <div class="thanks-msg">
21 11
             <p id="thanksMessage"></p>

正在加载...
取消
保存