NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name JVC Unicode // @author Benissou // @description Convertissez votre texte en unicode // @include http://www.jeuxvideo.com/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js // @version 0.9 // @icon http://image.noelshack.com/fichiers/2016/50/1481684643-benissou.gif // @copyright 2016+, Benissou // ==/UserScript== /*jshint multistr: true */ var alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0','1', '2', '3', '4', '5', '6', '7', '8', '9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']; var regional = ['๐ฆ','๐ง','๐จ','๐ฉ','๐ช','๐ซ','๐ฌ','๐ญ','๐ฎ','๐ฏ','๐ฐ','๐ฑ','๐ฒ','๐ณ','๐ด','๐ต','๐ถ','๐ท','๐ธ','๐น','๐บ','๐ป','๐ผ','๐ฝ','๐พ','๐ฟ','0','1', '2', '3', '4', '5', '6', '7', '8', '9','๐ฆ','๐ง','๐จ','๐ฉ','๐ช','๐ซ','๐ฌ','๐ญ','๐ฎ','๐ฏ','๐ฐ','๐ฑ','๐ฒ','๐ณ','๐ด','๐ต','๐ถ','๐ท','๐ธ','๐น','๐บ','๐ป','๐ผ','๐ฝ','๐พ','๐ฟ']; var Fullwidth = ['๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ฝ','๏ผ','๏ผ','๏ผ','๏ผ','๏ผ','๏ผ','๏ผ','๏ผ','๏ผ','๏ผ','๏ผก','๏ผข','๏ผฃ','๏ผค','๏ผฅ','๏ผฆ','๏ผง','๏ผจ','๏ผฉ','๏ผช','๏ผซ','๏ผฌ','๏ผญ','๏ผฎ','๏ผฏ','๏ผฐ','๏ผฑ','๏ผฒ','๏ผณ','๏ผด','๏ผต','๏ผถ','๏ผท','๏ผธ','๏ผน','๏ผบ']; var Mathdouble = ['๐','๐','๐','๐','๐','๐','๐','๐','๐','๐','๐','๐','๐','๐','๐ ','๐ก','๐ข','๐ฃ','๐ค','๐ฅ','๐ฆ','๐ง','๐จ','๐ฉ','๐ช','๐ซ','๐','๐','๐','๐','๐','๐','๐','๐','๐ ','๐ก','๐ธ','๐น','โ','๐ป','๐ผ','๐ฝ','๐พ','โ','๐','๐','๐','๐','๐','โ','๐','โ','โ','โ','๐','๐','๐','๐','๐','๐','๐','โค']; var Circled = ['๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ก','๐ ข','๐ ฃ','๐ ค','๐ ฅ','๐ ฆ','๐ ง','๐ จ','๐ ฉ','โฟ','0','1', '2', '3', '4', '5', '6', '7', '8', '9','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ','๐ ก','๐ ข','๐ ฃ','๐ ค','๐ ฅ','๐ ฆ','๐ ง','๐ จ','๐ ฉ','โฟ']; var Squared = ['๐ ฐ','๐ ฑ','๐ ฒ','๐ ณ','๐ ด','๐ ต','๐ ถ','๐ ท','๐ ธ','๐ น','๐ บ','๐ ป','๐ ผ','๐ ฝ','๐ พ','๐ ฟ','๐','๐','๐','๐','๐','๐ ','๐','๐','๐','๐','0','1', '2', '3', '4', '5', '6', '7', '8', '9','๐ ฐ','๐ ฑ','๐ ฒ','๐ ณ','๐ ด','๐ ต','๐ ถ','๐ ท','๐ ธ','๐ น','๐ บ','๐ ป','๐ ผ','๐ ฝ','๐ พ','๐ ฟ','๐','๐','๐','๐','๐','๐ ','๐','๐','๐','๐']; (function() { 'use strict'; $('.jv-editor-toolbar').append('<div id="unicode" ></div>'); $('#unicode').append('<div class="btn-group">\ <button class="btn btn-jv-editor-toolbar" id="char_regional" type="button" title=""><span>๐ฆ</span></button>\ <button class="btn btn-jv-editor-toolbar" id="char_Fullwidth" type="button" title=""><span>๏ฝ</span></button>\ <button class="btn btn-jv-editor-toolbar" id="char_Mathdouble" type="button" title=""><span>๐</span></button>\ <button class="btn btn-jv-editor-toolbar" id="char_Circled" type="button" title=""><span>๐ </span></button>\ <button class="btn btn-jv-editor-toolbar" id="char_Squared" type="button" title=""><span>๐ ฐ</span></button>\ </div>'); document.getElementById('char_regional').addEventListener('click', function() {char_unicode(regional);}); document.getElementById('char_Fullwidth').addEventListener('click', function() {char_unicode(Fullwidth);}); document.getElementById('char_Mathdouble').addEventListener('click', function() {char_unicode(Mathdouble);}); document.getElementById('char_Circled').addEventListener('click', function() {char_unicode(Circled);}); document.getElementById('char_Squared').addEventListener('click', function() {char_unicode(Squared);}); function char_unicode (table) { var elem = document.getElementById('message_topic'); var start = elem.selectionStart; var end = elem.selectionEnd; var len = elem.value.length; var sel_txt = elem.value.substring(start,end); elem.value = elem.value.substring(0,start) + encodeunicode(sel_txt, table)+ elem.value.substring(end,len); } function cleanUpSpecialChars(str) { str = str.replace(/[ร รกรขรฃรครฅ]/g,"a"); str = str.replace(/[รรรรรร ]/g,"A"); str = str.replace(/[รจรฉรชรซ]/g,"e"); str = str.replace(/[รรรร]/g,"E"); str = str.replace(/[รฏรฎ]/g,"i"); str = str.replace(/[รร]/g,"I"); str = str.replace(/[รง]/g,"c"); str = str.replace(/[ร]/g,"C"); return str; } function encodeunicode(seltxt, table) { var text = ""; //seltxt = seltxt.toLowerCase(); seltxt = cleanUpSpecialChars(seltxt); var ok = false; for (var i =0; i< seltxt.length ; i++) { ok = false; for (var m = 0; m < alphabet.length;m++) { if (alphabet[m] === seltxt[i]) { text+= table[m]; ok = true; } } if (!ok ) { text+=seltxt[i]; } } return text; } })();