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 37: Line 37:
     tokens = text.split(' ');
     tokens = text.split(' ');
     result = '';
     result = '';
     for (var token of tokens) {
     for (var i = 0; i < tokens.length; i++) {
    if (token.trim() === '') {
        if (tokens[i].trim() === '') {
        continue;
            continue;
    }
        }
    const shouldAddStyle = ratio > Math.random();
        const shouldAddStyle = ratio > Math.random();
    if (shouldAddStyle) {
        if (shouldAddStyle) {
        token = `<span class="${className}" data-timestamp="${Date.now()}">${token}</span>`           
            tokens[i] = `<span class="${className}" data-timestamp="${Date.now()}">${tokens[i]}</span>`           
    }
        }
    result += `${token} `;
        result += `${tokens[i]} `;
     }
     }
     return result;
     return result;