Guest User

Untitled

a guest
Oct 7th, 2026
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         zasrywacz 2.0
  3. // @match        https://karachan.org/*
  4. // @grant        GM_xmlhttpRequest
  5. // @connect      www.hovno.sk
  6. // @run-at       document-end
  7. // ==/UserScript==
  8.  
  9.  
  10. function getRandomPictureUrl() {
  11.     const page = Math.floor(Math.random() * 920) + 1;
  12.  
  13.     return new Promise(resolve => {
  14.         GM_xmlhttpRequest({
  15.             method: 'GET',
  16.             url: `https://www.hovno.sk/galeria?strana=${page}`,
  17.  
  18.             onload: function (response) {
  19.                 const doc = new DOMParser().parseFromString(
  20.                     response.responseText,
  21.                     'text/html'
  22.                 );
  23.  
  24.                 const images = doc.querySelectorAll('a.list-group-item.shit img');
  25.  
  26.                 const randomImage =
  27.                     images[Math.floor(Math.random() * images.length)];
  28.  
  29.                 const picture = randomImage.closest('a.list-group-item.shit');
  30.                 const title = picture.querySelector('span:not(.badge)').textContent.trim();
  31.                 console.log(title);
  32.  
  33.                 const fullUrl = randomImage.src.replace(
  34.                     '/img/thumb/',
  35.                     '/img/full/'
  36.                 );
  37.  
  38.                 resolve({
  39.                     url: fullUrl,
  40.                     title: title
  41.                 });
  42.             }
  43.         });
  44.     });
  45. }
  46.  
  47.  
  48. function downloadAndSetFile(url, title) {
  49.     GM_xmlhttpRequest({
  50.         method: 'GET',
  51.         url: url,
  52.         responseType: 'blob',
  53.  
  54.         onload: function (response) {
  55.             const file = new File(
  56.                 [response.response],
  57.                 title + '.jpg',
  58.                 { type: response.response.type }
  59.             );
  60.  
  61.             const input = document.querySelector(
  62.                 'input.upload[name="upfile"]'
  63.             );
  64.  
  65.             const dataTransfer = new DataTransfer();
  66.             dataTransfer.items.add(file);
  67.  
  68.             input.files = dataTransfer.files;
  69.  
  70.             input.dispatchEvent(
  71.                 new Event('change', { bubbles: true })
  72.             );
  73.         }
  74.     });
  75. }
  76.  
  77.  
  78.  
  79. function createButton() {
  80.     const replyCell = document.querySelector('td.ladda-td');
  81.  
  82.     if (!replyCell) return;
  83.  
  84.     const button = document.createElement('button');
  85.  
  86.  
  87.     button.textContent = 'zapostuj gówno';
  88.     button.type = 'button';
  89.     button.classList.add('ladda-button');
  90.     button.dataset.style = 'expand-right';
  91.     button.dataset.size = 'xs';
  92.     button.dataset.color = 'mint';
  93.     button.style.marginLeft = '6px';
  94.     button.style.verticalAlign = 'top';
  95.     button.addEventListener('click', async function () {
  96.         const picture = await getRandomPictureUrl();
  97.         downloadAndSetFile(picture.url, picture.title);
  98.         document.querySelector('input.board-input[name="email"]').value = 'sage';
  99.  
  100.         document.querySelector('button.ladda-button .ladda-label').closest('button').click();
  101.     });
  102.  
  103.     replyCell.appendChild(button);
  104. }
  105.  
  106. createButton();
Advertisement
Add Comment
Please, Sign In to add comment