fixes and changes

pull/1142/head
Konstantyn Pahsura 8 years ago committed by hristoterezov
parent 1a91f4953b
commit da6af88910
  1. 15
      close.html
  2. 17
      close2.html
  3. 31
      randomizer.js
  4. 15
      utils.js

@ -3,21 +3,16 @@
<link rel="stylesheet" href="css/all.css"/>
<!--#include virtual="title.html" -->
<script><!--#include virtual="/interface_config.js" --></script>
<script src="static/randomizer.js"></script>
<script src="randomizer.js"></script>
<script src="utils.js"></script>
<script>
var randomizer = new Randomizer();
function translateStr(id, msg) {
var div = document.getElementById(id);
div.innerHTML = msg;
}
function translate() {
translateStr('hintMessage',
function onDocumentReady() {
insertTextMsgIntoDocument('hintMessage',
randomizer.getItem());
}
</script>
</head>
<body onload="translate();">
<body onload="onDocumentReady();">
<div class="redirectPageMessage">
<div class="thanks-msg">
<p id="thanksMessage">Thank you for your feedback!</p>

@ -3,23 +3,18 @@
<link rel="stylesheet" href="css/all.css"/>
<!--#include virtual="title.html" -->
<script><!--#include virtual="/interface_config.js" --></script>
<script src="static/randomizer.js"></script>
<script src="randomizer.js"></script>
<script src="utils.js"></script>
<script>
var randomizer = new Randomizer();
function translateStr(id, msg) {
var div = document.getElementById(id);
div.innerHTML = msg;
}
function translate() {
translateStr('thanksMessage',
function onDocumentReady() {
insertTextMsgIntoDocument('thanksMessage',
'Thank you for using ' + interfaceConfig.APP_NAME);
translateStr('hintMessage',
insertTextMsgIntoDocument('hintMessage',
randomizer.getItem());
}
</script>
</head>
<body onload="translate();">
<body onload="onDocumentReady();">
<div class="redirectPageMessage">
<div class="thanks-msg">
<p id="thanksMessage"></p>

@ -10,26 +10,21 @@
];
/**
* Creates a new Randomiser.
*
* @class
* Creates a randomiser.
* Put in in Global scope
*/
function Randomizer(){
this.items = items;
}
window.randomizer = {
/**
* Get a random integer between 0 and items length.
*
* @return {string} a random integer
*/
getItem: function (){
var l = items.length - 1;
var n = Math.round(Math.random() * l);
/**
* Get a random integer between 0 and items length.
*
* @return {string} a random integer
*/
Randomizer.prototype.getItem = function (){
var l = this.items.length - 1;
var n = Math.round(Math.random() * l);
return this.items[n];
return items[n];
}
};
window.Randomizer = Randomizer;
})();

@ -66,3 +66,18 @@ function getConfigParamsFromUrl(source, dontParse) {
});
return result;
}
/**
* Inserts text message
* into DOM element
*
* @param id {string} element identificator
* @param msg {string} text message
*/
// eslint-disable-next-line no-unused-vars
function insertTextMsgIntoDocument(id, msg){
var el = document.getElementById(id);
if (el)
el.innerText = msg;
}
Loading…
Cancel
Save