Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name avecrypto
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author anonymousse
- // @match https://avenoel.org/*
- // @exclude https://avenoel.org/chat*
- // @exclude https://avenoel.org/admin*
- // @grant none
- // ==/UserScript==
- const CRYPTO_KEY = 'AVEPREMIUMCTROCOOLISSOUFLE';
- const START_DELIMITER = '#secret#start#';
- const END_DELIMITER = '#secret#end#';
- const EQUAL_SUBSTITUTOR = '#equal#';
- const CRYPTO_REGEXP = new RegExp(`${START_DELIMITER}([a-zA-Z0-9#]+)${END_DELIMITER}`);
- function getSelection (field) {
- return field.value.substring(field.selectionStart, field.selectionEnd);
- }
- function replaceSelection (field, new_value) {
- field.value = [field.value.slice(0, field.selectionStart), new_value, field.value.slice(field.selectionEnd)].join('');
- }
- (function() {
- 'use strict';
- let bbcodes = $('.bbcodes');
- let button = $('<button type="button" class="btn" tabindex="-1" href="#">');
- let img = $('<img src="https://avenoel.org/images/smilies/724771109.gif">');
- img.appendTo(button);
- button.click(function () {
- let field = $(this).closest('form').find('textarea')[0];
- console.log(field);
- if (field.selectionStart === field.selectionEnd) {
- return ;
- }
- let msg = getSelection(field);
- let encoded = btoa(msg).replace(/=/g, EQUAL_SUBSTITUTOR);
- replaceSelection(field, `<color=${START_DELIMITER}${encoded}${END_DELIMITER}> </color>`);
- });
- button.appendTo(bbcodes);
- if (document.location.pathname.split('/')[1] === 'topic') {
- $('.text-color').filter(function () {
- return CRYPTO_REGEXP.test($(this).attr('style'));
- }).each(function () {
- let encoded = $(this).attr('style').match(CRYPTO_REGEXP)[1].replace(new RegExp(EQUAL_SUBSTITUTOR, 'g'), '=');
- console.log(encoded);
- let msg = atob(encoded);
- $.post('https://avenoel.org/previsualisation', {content: `Message Avepremium: <spoiler>${msg}</spoiler>`}).done(res => {
- $(this).html(res.content);
- });
- });
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement