Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Uniwiki.js: Difference between revisions

MediaWiki interface page
Rayanth (talk | contribs)
No edit summary
Rayanth (talk | contribs)
No edit summary
Line 38: Line 38:
     result = '';
     result = '';
     for (var i = 0; i < tokens.length; i++) {
     for (var i = 0; i < tokens.length; i++) {
        orig_token = tokens[i];
         if (tokens[i].trim() === '') {
         if (tokens[i].trim() === '') {
            result += orig_token;
             continue;
             continue;
         }
         }
         const shouldAddStyle = ratio > Math.random();
         const shouldAddStyle = ratio > Math.random();
         if (shouldAddStyle) {
         if (shouldAddStyle) {
             tokens[i] = `<span class="${className}" data-timestamp="${Date.now()}">${tokens[i]}</span>`        
             addStyle = '<span class="' + className + '" data-timestamp=' + Date.now() + '>' + tokens[i] + '</span>';
            tokens[i] = addStyle;
            //tokens[i] = `<span class="${className}" data-timestamp="${Date.now()}">${tokens[i]}</span>`    
         }
         }
         result += `${tokens[i]} `;
         //result += tokens[i];
     }
     }
    result = tokens.join(' ');
     return result;
     return result;
}
}