Scrambler

scrambles all the text on a page

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Scrambler
// @namespace    https://greasyfork.org/en/scripts/22121-scrambler
// @version      1.1
// @description  scrambles all the text on a page
// @author       abbott
// @match        *://*/*
// ==/UserScript==

window.onload = function() {
  var elements = document.body.getElementsByTagName('*');

  for (var i = 0; i < elements.length; i++) {
    var text = '';
    elements[i].innerHTML.split(/(<.+?>)/).forEach(function(s) {
      text += s.charAt(0) === '<' ? s : scramble(s);
    });

    elements[i].innerHTML = text;
  }
};

// scrambles middle letters 
function scramble(s) {
  if (s.includes('&nbsp;')) { // ignores nbsp messes up the scramble a bunch
    return s;
  }

  return s.split(' ').map(function(word) {
    if (word.length > 3) {
      var chars = word.split('');

      for (var i = 1; i < chars.length - 1; i++) {
        var j = Math.floor(Math.random() * (i - 1) + 1);
        var temp = chars[i];
        chars[i] = chars[j];
        chars[j] = temp;
      }

      return chars.join('');
    }

    return word;
  }).join(' ');
}