소스 검색

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
     <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>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
     </script>
18
     </script>
15
 </head>
19
 </head>
16
 <body onload="translate();">
20
 <body onload="translate();">

+ 14
- 10
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>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
     </script>
20
     </script>
17
 </head>
21
 </head>
18
 <body onload="translate();">
22
 <body onload="translate();">

+ 35
- 0
static/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 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…
취소
저장