Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name bbcode_hg
- // @namespace -
- // @version 0.1
- // @description Highlight para as mensagens do chat do jogo
- // @author Eshkation
- // @match *atelier801.com/*
- // ==/UserScript==
- $(document).ready(function(){
- $('#outils_message_reponse > .groupe-boutons-barre-outils:last-child').prepend(`
- <button type="button" class="btn btn-reduit btn-success" id="highlight-text">
- Highlight
- </button>
- `);
- $(document).on('click', '#highlight-text', function(){
- var text_final = '[font=Verdana][size=11][color=#92AFCF]';
- var text_lines = window.getSelection().toString();
- text_lines = text_lines.split('\n');
- for (i = 0; i < text_lines.length; i++) {
- var line = text_lines[i];
- line = line.replace(/\[([A-Za-z0-9\_\+]{3,20})\]/, '[[color=#317FBA]$1[/color]]');
- text_final += line+'\n';
- }
- text_final += '[/color][/size][/font]';
- var textarea = $(window.getSelection().anchorNode.parentNode).find('textarea');
- $(textarea).val(text_final);
- console.log(text_final);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement