User:KYPark/common.js

// mw.loader.load( "//en.wikipedia.org/w/index.php?title=User:PleaseStand/userScriptSandbox.js&action=raw&ctype=text/javascript" ); // 유니코드 한글의 로마자화 자바스크립트 // 초성 var headPR="g-q-n-d-dj-r-m-b-bj-s-x--z-zj-c-k-t-p-h".split("-") ; var headRR="g-kk-n-d-tt-r-m-b-pp-s-ss--j-jj-ch-k-t-p-h".split("-") ; // 중성 var bodyPR="a-aj-ya-yaj-e-ej-ye-yej-o-wa-waj-oj-yo-u-we-wej-ui-yu-v-vi-i".split("-") ; var bodyRR="a-ae-ya-yae-eo-e-yeo-ye-o-wa-wae-oe-yo-u-wo-we-wi-yu-eu-ui-i".split("-") ; // 종성 var tailPR="-g-q-gs-n-nz-nh-d-l-lg-lm-lb-ls-lt-lp-lh-m-b-bs-s-x-ng-z-c-k-t-p-h".split("-") ; var tailRR="-g-kk-ks-n-nj-nh-d-l-lg-lm-lb-ls-lt-lp-lh-m-b-ps-s-ss-ng-j-ch-k-t-p-h".split("-") ; // var headOld=""; var bodyOld=""; var tailOld=""; var headNew=""; var bodyNew=""; var tailNew=""; // function doRR(x) { n = parseInt(escape(x).substring(2), 16) - 44032 ; h = parseInt(n/588) ; b = parseInt((n-588*h)/28) ; t = parseInt(n-588*h-28*b) ; headNew = headPR[h] ; bodyNew = bodyPR[b] ; // if (!headNew && tailOld) then capitalize bodyNew tailNew = tailPR[t] ; return headNew + bodyNew + tailNew ; } // // 참조: https://en.wiktionary.org/wiki/User_talk:AutoFormat/2007#Korean_characters_in_computing // alert(doRR("쌌")) ;