Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name ПУК-СРЕНЬК
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author Anonymous
- // @match https://2ch.hk/*/res/*.html
- // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
- // @grant none
- // ==/UserScript==
- const decode = (str) => {
- return new TextDecoder().decode(
- new Uint8Array(
- str
- .replace(/(\d+[ПУК|СРЕНЬК]{3,6})/g, (m) => {
- const count = parseInt(m.replace(/[ПУК|СРЕНЬК]/g, ""), 10);
- return m.replace(count, "").repeat(count);
- })
- .replace(/ПУК/g, "0")
- .replace(/СРЕНЬК/g, "1")
- .replace(/-/g, "")
- .match(/.{1,8}/g)
- .map((c) => parseInt(c, 2))
- )
- );
- };
- (function() {
- const posts = document.querySelectorAll('.post__message');
- posts.forEach((post) => {
- const words = post.textContent.replace(/\t+/g,"").split(/[\n, ]+/);
- words.forEach((word) => {
- post.innerHTML = post.innerHTML.replace(/(\d+)?(СРЕНЬК|ПУК).+/, (m) => {
- return `<div style="color:green">${decode(m)}</div>`;
- });
- });
- });
- })();
Add Comment
Please, Sign In to add comment