瀏覽代碼

refactor(close_pages): Refactor the close pages.

master
hristoterezov 8 年之前
父節點
當前提交
4bcd75f15c
共有 5 個檔案被更改,包括 54 行新增67 行删除
  1. 4
    11
      close.html
  2. 48
    0
      close.js
  3. 2
    11
      close2.html
  4. 0
    30
      randomizer.js
  5. 0
    15
      utils.js

+ 4
- 11
close.html 查看文件

3
     <link rel="stylesheet" href="css/all.css"/>
3
     <link rel="stylesheet" href="css/all.css"/>
4
     <!--#include virtual="title.html" -->
4
     <!--#include virtual="title.html" -->
5
     <script><!--#include virtual="/interface_config.js" --></script>
5
     <script><!--#include virtual="/interface_config.js" --></script>
6
-    <script src="randomizer.js"></script>
7
-    <script src="utils.js"></script>
8
-    <script>
9
-        function onDocumentReady() {
10
-            insertTextMsgIntoDocument('hintMessage',
11
-                randomizer.getItem());
12
-        }
13
-    </script>
6
+    <script src="close.js"></script>
14
 </head>
7
 </head>
15
-<body onload="onDocumentReady();">
8
+<body>
16
 <div class="redirectPageMessage">
9
 <div class="redirectPageMessage">
17
     <div class="thanks-msg">
10
     <div class="thanks-msg">
18
-        <p id="thanksMessage">Thank you for your feedback!</p>
11
+        <p>Thank you for your feedback!</p>
19
     </div>
12
     </div>
20
     <div class="hint-msg">
13
     <div class="hint-msg">
21
         <p>
14
         <p>
26
     </div>
19
     </div>
27
 </div>
20
 </div>
28
 </body>
21
 </body>
29
-</html>
22
+</html>

+ 48
- 0
close.js 查看文件

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
- 11
close2.html 查看文件

3
     <link rel="stylesheet" href="css/all.css"/>
3
     <link rel="stylesheet" href="css/all.css"/>
4
     <!--#include virtual="title.html" -->
4
     <!--#include virtual="title.html" -->
5
     <script><!--#include virtual="/interface_config.js" --></script>
5
     <script><!--#include virtual="/interface_config.js" --></script>
6
-    <script src="randomizer.js"></script>
7
-    <script src="utils.js"></script>
8
-    <script>
9
-        function onDocumentReady() {
10
-            insertTextMsgIntoDocument('thanksMessage',
11
-                'Thank you for using ' + interfaceConfig.APP_NAME);
12
-            insertTextMsgIntoDocument('hintMessage',
13
-                randomizer.getItem());
14
-        }
15
-    </script>
6
+    <script src="close.js"></script>
16
 </head>
7
 </head>
17
-<body onload="onDocumentReady();">
8
+<body>
18
     <div class="redirectPageMessage">
9
     <div class="redirectPageMessage">
19
         <div class="thanks-msg">
10
         <div class="thanks-msg">
20
             <p id="thanksMessage"></p>
11
             <p id="thanksMessage"></p>

+ 0
- 30
randomizer.js 查看文件

1
-
2
-(function (){
3
-    //list of tips
4
-    var items = [
5
-        "You can pin participants by clicking on their thumbnails.",// jshint ignore:line
6
-        "You can tell others you have something to say by using the \"Raise Hand\" feature",// jshint ignore:line
7
-        "You can learn about key shortcuts by pressing Shift+?",// jshint ignore:line
8
-        "You can learn more about the state of everyone's connection by hovering on the bars in their thumbnail",// jshint ignore:line
9
-        "You can hide all thumbnails by using the button in the bottom right corner"// jshint ignore:line
10
-    ];
11
-
12
-    /**
13
-     * Creates a randomiser.
14
-     * Put in in Global scope
15
-     */
16
-    window.randomizer = {
17
-        /**
18
-         * Get a random integer between 0 and items length.
19
-         *
20
-         * @return {string} a random integer
21
-         */
22
-        getItem: function (){
23
-            var l = items.length - 1;
24
-            var n = Math.round(Math.random() * l);
25
-
26
-            return items[n];
27
-        }
28
-    };
29
-})();
30
-

+ 0
- 15
utils.js 查看文件

66
     });
66
     });
67
     return result;
67
     return result;
68
 }
68
 }
69
-
70
-/**
71
- * Inserts text message
72
- * into DOM element
73
- *
74
- * @param id {string} element identificator
75
- * @param msg {string} text message
76
- */
77
-// eslint-disable-next-line no-unused-vars
78
-function insertTextMsgIntoDocument(id, msg){
79
-    var el = document.getElementById(id);
80
-
81
-    if (el)
82
-        el.innerText = msg;
83
-}

Loading…
取消
儲存