Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Комфортный срун
- // @author 1chanpatriot
- // @description Позволяет комфортно срать на колчке
- // @namespace 1chan
- // @include https://1chan.ca/weedcaptcha/index.php
- // @include https://1chan.ca/news/res/*
- // @version 0.1
- // @grant none
- // ==/UserScript==
- var captchas = {
- "бульбулятор": 11038,
- "heart": 1519,
- "musical note": 1413,
- "Шинку": 17966,
- "Собак": 1462,
- "Майли Сайрус": 22302,
- "Арбуз": 10601,
- "Розетка": 9766,
- "bug": 2397,
- "шизик": 4033,
- "Паук": 11333,
- "жопа слона": 5712,
- "Король Ночи": 11534,
- "house": 2010,
- "Хуйло": 14489,
- "Синий кит": 10068,
- "Попка": 6376,
- "Лимон": 9898,
- "Мизулина": 13174,
- "стульчак": 21956,
- "Александр Шульгин": 11236,
- "light bulb": 1937,
- "flag": 2398,
- "clock": 2880,
- "яжка": 22933,
- "Пацифик": 12576,
- "pen": 1793,
- "Спиннер": 11447,
- "Стивен Хокинг": 10927,
- "спайсы": 20792,
- "Украина": 20385,
- "Альберт Хоффман": 14433,
- "Суисейсеки": 12382,
- "шприц": 18682,
- "Всевидящее око": 14144,
- "КЛЛ": 13587,
- "Соусейсеки": 19633,
- "трава": 918,
- "анонимус": 3268,
- "world": 3040
- };
- function getImageSize(url, callback) {
- var xhr = new XMLHttpRequest();
- xhr.onload = function() {
- callback(xhr.response.size);
- };
- xhr.open('GET', url);
- xhr.responseType = 'blob';
- xhr.send();
- }
- function solveCaptcha(){
- var captchaText = document.getElementsByClassName('captchaText')[0].innerText;
- [].forEach.call(document.getElementsByClassName('captchaImage'), function(v,i,a) {
- getImageSize(v.src, function(size) {
- if (size == captchas[captchaText]){
- v.click();
- window.parent.postMessage("addComment","*");
- }
- });
- });
- }
- function addComment(){
- var xhr = new XMLHttpRequest();
- var body = 'post_id=' + encodeURIComponent(document.getElementsByName('post_id')[0].value) +
- '&text=' + encodeURIComponent(document.getElementsByName('text')[0].value) +
- '&homeboard=' + encodeURIComponent(document.getElementsByName('homeboard')[0].value);
- var commentForm = document.getElementById('comment_form');
- xhr.open("POST", commentForm.action, true);
- xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
- xhr.setRequestHeader('Accept', 'application/json');
- xhr.onreadystatechange = function(){
- if (xhr.readyState == 4) {
- var result = JSON.parse(xhr.responseText);
- if (result.isValid === true){
- document.getElementById('comment_form_text').value = '';
- var iframe = document.getElementsByTagName("IFRAME")[0];
- iframe.src = iframe.src;
- }
- }
- };
- xhr.send(body);
- }
- $(document).ready(function() {
- if (window.top === window.self) {
- var iframe = document.getElementsByTagName("IFRAME")[0];
- document.getElementById('comment_form_text').addEventListener("keydown", function(e) {
- if (e.ctrlKey && e.keyCode === 13) {
- iframe.contentWindow.postMessage('solveCaptcha', '*');
- }
- });
- var commentForm = document.getElementById('comment_form');
- var submitButton = commentForm.getElementsByTagName('input')[5];
- submitButton.addEventListener("click", function(e) {
- iframe.contentWindow.postMessage('solveCaptcha', '*');
- });
- window.onmessage = function(e){
- if (e.data == 'addComment') {
- addComment();
- }
- };
- }
- else {
- window.onmessage = function(e){
- if (e.data == 'solveCaptcha') {
- solveCaptcha();
- }
- };
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement