瀏覽代碼

tip randomiser added

master
Konstantyn Pahsura 8 年之前
父節點
當前提交
1a91f4953b
共有 3 個檔案被更改,包括 61 行新增18 行删除
  1. 12
    8
      close.html
  2. 14
    10
      close2.html
  3. 35
    0
      static/randomizer.js

+ 12
- 8
close.html 查看文件

@@ -3,14 +3,18 @@
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
-    }
6
+    <script src="static/randomizer.js"></script>
7
+    <script>
8
+        var randomizer = new Randomizer();
9
+
10
+        function translateStr(id, msg) {
11
+            var div = document.getElementById(id);
12
+            div.innerHTML = msg;
13
+        }
14
+        function translate() {
15
+            translateStr('hintMessage',
16
+                randomizer.getItem());
17
+        }
14 18
     </script>
15 19
 </head>
16 20
 <body onload="translate();">

+ 14
- 10
close2.html 查看文件

@@ -3,16 +3,20 @@
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
-    }
6
+    <script src="static/randomizer.js"></script>
7
+    <script>
8
+        var randomizer = new Randomizer();
9
+
10
+        function translateStr(id, msg) {
11
+            var div = document.getElementById(id);
12
+            div.innerHTML = msg;
13
+        }
14
+        function translate() {
15
+            translateStr('thanksMessage',
16
+                'Thank you for using ' + interfaceConfig.APP_NAME);
17
+            translateStr('hintMessage',
18
+                randomizer.getItem());
19
+        }
16 20
     </script>
17 21
 </head>
18 22
 <body onload="translate();">

+ 35
- 0
static/randomizer.js 查看文件

@@ -0,0 +1,35 @@
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 new Randomiser.
14
+     *
15
+     * @class
16
+     */
17
+    function Randomizer(){
18
+        this.items = items;
19
+    }
20
+
21
+    /**
22
+     * Get a random integer between 0 and items length.
23
+     *
24
+     * @return {string} a random integer
25
+     */
26
+    Randomizer.prototype.getItem = function (){
27
+        var l = this.items.length - 1;
28
+        var n = Math.round(Math.random() * l);
29
+
30
+        return this.items[n];
31
+    };
32
+
33
+    window.Randomizer = Randomizer;
34
+})();
35
+

Loading…
取消
儲存