Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2024
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.64 KB | Cybersecurity | 0 0
  1. // ==UserScript==
  2. // @name         Генератор хуйни
  3. // @namespace    Генератор_хуйни
  4. // @version      1.1
  5. // @description  Создай хуйню!
  6. // @author       Анонимус
  7. // @include      *://2ch.*
  8. // @icon         https://i.imgur.com/XK5x1Zr.png
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13.     'use strict';
  14.  
  15.     for (const area of document.querySelectorAll('.postarea')) {
  16.         const button = document.createElement('div');
  17.         button.innerHTML = `<a style='user-select: none;'><strong>Насрать хуйни</strong></a>`;
  18.         area.parentNode.insertBefore(button, area.nextSibling.nextSibling.nextSibling);
  19.         button.onclick = () => {
  20.             for (const field of document.querySelectorAll('#shampoo')) field.value += paragraph();
  21.         };
  22.     }
  23. })();
  24.  
  25. const alphabet = `абвгдеёжзийклмнопстфцчшщыэюя`;
  26. const consonants = `бвгджзйклмнпстфцчшщ`;
  27. const vowels = `аеиоыэюя`;
  28.  
  29. function choice(array) { return array[Math.floor(Math.random() * array.length)] }
  30.  
  31. function word() {
  32.     let rand = Math.floor(Math.random() * 2);
  33.     let result = '';
  34.     let length = 5 + Math.round(Math.random() * 9);
  35.     for (let i = 0; i < length; i++) {
  36.         result += choice(i % 2 == rand ? vowels : consonants);
  37.     }
  38.     return result;
  39. }
  40. function sentence() { return Array.apply(null, Array(5 + Math.round(Math.random() * 7))).map(word).join(' ') }
  41. function paragraph() { return Array.apply(null, Array(5 + Math.round(Math.random() * 10))).map(sentence).map(s => s.charAt(0).toUpperCase() + s.slice(1)).join('. ') + '. ' }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement