사용자:Riemann/common.js

리버티게임, 모두가 만들어가는 자유로운 게임
< 사용자:Riemann
Riemann (토론 | 기여)님의 2023년 9월 3일 (일) 18:19 판 (플러그인 p21설치)

참고: 설정을 저장한 후에 바뀐 점을 확인하기 위해서는 브라우저의 캐시를 새로 고쳐야 합니다.

  • 파이어폭스 / 사파리: Shift 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5 또는 Ctrl-R을 입력 (Mac에서는 ⌘-R)
  • 구글 크롬: Ctrl-Shift-R키를 입력 (Mac에서는 ⌘-Shift-R)
  • 인터넷 익스플로러 / 엣지: Ctrl 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5를 입력.
  • 오페라: Ctrl-F5를 입력.
	/** 플러그인 Slideable***************************
* 슬라이드 플러그인 라이브러리
* 버전 => 1.0.0
* 작성자 : [[사용자:BANIP|BANIP]] 
* JSON => Slideable = {"name":"Slideable","descript":"슬라이드 플러그인 라이브러리","version":"1.0.0","local":true,"creat":"BANIP","state":"사용자:BANIP/플러그인/슬라이드","executable":false}; 
*/ 
function plugin_Slideable(){
  if($("[data-name='Slideable']").length >= 1){
		 // 이부부분에 코드 입력 //
    //모든 키 순회
    function forEach(object, callback) {
        for (var key in object) {
            var variable = object[key];
            callback(variable, key);
        }
    }

function create(directionData) {
    function initClassName($target, data) {
        forEach(data, function(value, direction) {
            $target.find("." + direction).addClass("on");
        })
    }

    function initDOM($target, data) {
        $target[0].data = data;
        $target.find(".center").html(data.center);
        $target.find(".top.on").css("background","url('https://upload.wikimedia.org/wikipedia/commons/8/85/Arrow_top_svg.svg') no-repeat center");
        $target.find(".bottom.on").css("background","url('https://upload.wikimedia.org/wikipedia/commons/f/f2/Arrow_bottom_svg.svg') no-repeat center");
        $target.find(".left.on").css("background","url('https://upload.wikimedia.org/wikipedia/commons/4/40/Arrowleft_svg.svg') no-repeat center");
        $target.find(".right.on").css("background","url('https://upload.wikimedia.org/wikipedia/commons/9/96/Arrow2right_svg.svg') no-repeat center");
    }

    var slideUtil = {
        moveObject: function($this, axis) {
            var x = axis[0], y = axis[1];

            var data = $this[0].data;
            if (!data.right && x > 0) x = 0;
            if (!data.left && x < 0) x = 0;
            if (!data.top && y < 0) y = 0;
            if (!data.bottom && y > 0) y = 0;
            $this.css("transform", "translate(" + x + "px," + y + "px)");
        },
        isHideable: function($this, axis, limit) {
            var x = axis[0], y = axis[1];
            var data = $this[0].data;
            if (data.right && x > limit) return "right";
            if (data.left && x < limit * -1) return "left";
            if (data.bottom && y > limit) return "bottom";
            if (data.top && y < limit * -1) return "top";
        },
        hide: function(direction, $this) {
            function getCss(direction) {
                var css = {
                    opacity: 0.01
                };
                var interval = 50;
                switch (direction) {
                    case "left":
                        css.left = -1 * interval + "vw";
                        break;
                    case "right":
                        css.left = interval + "vw";
                        break;
                    case "bottom":
                        css.top = interval + "vh";
                        break;
                    case "top":
                        css.top = -1 * interval + "vh";
                        break;
                }

                return css;
            }

            var self = $this[0];
            var data = self.data;
            if (self.isHide === true) {
                return;
            }
            self.isHide = true;
            $this.animate(getCss(direction), {
                duration: 300,
                easing: "swing",
                start: data[direction],
                complete: function() {
                    $this.remove();
                }
            });
        }
    }

    function setEvent($target, data) {
        var util = slideUtil;
        var moveLimit = 50;

        $(".slideable").mousedown(function(e) {
            this.isMouseDown = true;
            this.startAxis = [e.clientX, e.clientY];
        })

        $(".slideable").mousemove(function(e) {
            if (this.isMouseDown) {
                event.preventDefault()
                var axis = [e.clientX, e.clientY];
                var startAxis = this.startAxis;
                var moveInterval = [axis[0] - startAxis[0], axis[1] - startAxis[1]]
                util.moveObject($(this), moveInterval);
                var hideDirection = util.isHideable($(this), moveInterval, moveLimit);
                console.log(hideDirection)
                if (hideDirection) util.hide(hideDirection, $(this));
            }
        })

        $(".slideable").mouseup(function(e) {
            this.isMouseDown = false;
        })

        function getTouchEvent(e) {
            return e.originalEvent.touches[0]
        }

        $(".slideable").on("touchstart", function(e) {
            var touch = getTouchEvent(e);

            this.isMouseDown = true;
            this.startAxis = [touch.clientX, touch.clientY];
        })

        $(".slideable").on("touchmove", function(e) {
            event.preventDefault()
            if (this.isMouseDown) {
                event.preventDefault()
                var touch = getTouchEvent(e);
                var axis = [touch.clientX, touch.clientY];
                var startAxis = this.startAxis;
                var moveInterval = [axis[0] - startAxis[0], axis[1] - startAxis[1]]
                util.moveObject($(this), moveInterval);
                var hideDirection = util.isHideable($(this), moveInterval, moveLimit);
                console.log(hideDirection)
                if (hideDirection) util.hide(hideDirection, $(this));
            }
        })

        $(".slideable").on("touchend", function(e) {
            this.isMouseDown = false;
        })

    }

    //슬라이드아이템의 방향키로 숫자 혹은 문자로 지정된 경우
    //함수로 변환
    function setExecutable(target, item){
        forEach(item,function(value,direction){
            new Promise(function(resolve, reject){
                 if(direction === "center"){
                    switch( typeof value ){
                    case "function":
                        resolve( value.bind(target)() );
                    break;
                  }
              } else {
                switch( typeof value ){
                    case "string": case "number":
                        resolve(function(){ execute(value); }.bind(target));
                    break;
                }
              }
            }).then(function(result){
                 item[direction] = result;
            })

        })
    }
    
    var $target = $(".slideable.cloneable").clone().removeClass("cloneable");
    $("body").prepend($target);
    setExecutable($target[0], directionData);
    initClassName($target, directionData);
    initDOM($target, directionData);
    setEvent($target, directionData);
}

// create는 다른 함수들에 의존하지 않음 //
var game;

function execute(number, argument) {
    dispose(game, number, argument);
}

function dispose(slideableArray, start, argument) {
    game = slideableArray;
    
    var slideableItem = slideableArray[start];
    console.log(slideableItem);
    switch (typeof slideableItem) {
        case "function":
            slideableItem(argument);
            break;
        case "object":
            create(slideableItem);
            break;
    }
}

//모바일 전체화면으로 수정
var setFullScreen = (function(){
    //window.scrollTo(0,1);
})();

return {
    create: create,
    execute: execute,
    dispose: dispose
}
		
  }

}
/* Slideable 끝 */






/** 플러그인 uncyrhythm***************************
* 플러그인 전체적 테스트. 리듬게임
* 버전 => 1.7.3.1
* 작성자 : [[사용자:BANIP|BANIP]] 
* JSON => uncyrhythm = {"name":"uncyrhythm","descript":"플러그인 전체적 테스트. 리듬게임","version":"1.7.3.1","local":true,"creat":"BANIP","state":"사용자:BANIP/낙서장/라스트디버깅/uncyrhythm","executable":true}; 
*/ 
function plugin_uncyrhythm(){
  if($("[data-name='uncyrhythm']").length >= 1){
		 $("#mw-content-text").prepend("<audio controls class='gameaudio hide'><source src='https://s0.vocaroo.com/media/download_temp/Vocaroo_s0OAXRN8eUas.mp3'></audio>");
	$("#mw-content-text").prepend("<svg class='note cloneable' width='50px' height='50px'><circle cx=25 cy=25 r=25 /></svg>");

	 var noteInfo = [[2088,0],[2156,2],[2223,1],[2291,2],[2358,3],[2426,2],[2493,1],[2561,0],[2628,1],[2696,2],[2763,1],[2831,2],[2898,3],[2966,2],[3033,1],[3101,0],[3168,1],[3236,2],[3303,1],[3371,2],[3438,3],[3506,2],[3573,1],[3641,0],[3708,1],[3776,2],[3843,1],[3911,2],[3978,3],[4046,2],[4113,1],[4181,0],[4248,1],[4248,3],[4316,2],[4383,1],[4451,2],[4518,3],[4586,2],[4653,1],[4721,0],[4788,1],[4856,2],[4923,1],[4991,2],[5059,3],[5126,2],[5195,1],[5261,0],[5329,1],[5396,2],[5464,1],[5531,2],[5599,3],[5666,2],[5734,1],[5801,0],[5869,1],[5936,2],[6004,3],[6071,1],[6139,2],[6206,3],[6274,1],[6341,2],[6409,1],[6409,0],[6476,2],[6544,1],[6611,2],[6679,3],[6746,2],[6814,1],[6881,0],[6949,1],[7016,2],[7084,1],[7151,2],[7219,3],[7286,2],[7354,1],[7421,0],[7489,1],[7556,2],[7624,1],[7691,2],[7759,3],[7826,2],[7894,1],[7961,0],[8029,1],[8096,2],[8164,1],[8231,2],[8299,3],[8366,2],[8434,1],[8501,0],[8569,1],[8569,3],[8636,2],[8704,1],[8771,2],[8839,3],[8906,2],[8974,1],[9041,0],[9109,1],[9109,3],[9176,2],[9244,1],[9311,2],[9379,3],[9446,2],[9514,1],[9581,0],[9649,1],[9649,3],[9716,2],[9784,1],[9851,2],[9919,3],[9919,0],[9986,2],[10054,1],[10121,2],[10189,0],[10256,3],[10324,0],[10391,3],[10459,1],[10526,2],[10594,1],[10661,2],[10729,1],[10729,0],[10796,2],[10864,1],[10931,3],[10999,1],[10999,0],[11066,2],[11134,1],[11201,3],[11269,0],[11336,2],[11404,1],[11471,3],[11539,1],[11539,0],[11606,3],[11674,1],[11741,2],[11809,0],[11876,2],[11944,1],[12011,3],[12079,0],[12079,1],[12146,2],[12214,1],[12281,3],[12349,0],[12416,3],[12484,1],[12551,2],[12619,0],[12619,1],[12686,2],[12754,1],[12821,3],[12889,1],[12889,0],[12956,3],[13024,2],[13091,0],[13159,1],[13226,3],[13294,2],[13361,0],[13429,1],[13496,2],[13564,1],[13631,3],[13699,1],[13699,0],[13766,2],[13834,1],[13901,3],[13969,0],[14036,2],[14104,1],[14171,3],[14239,1],[14239,0],[14306,2],[14374,1],[14441,3],[14509,1],[14509,0],[14576,3],[14644,1],[14711,0],[14711,2],[14779,1],[14846,3],[14914,1],[14914,0],[14981,2],[15049,1],[15049,0],[15116,3],[15184,1],[15251,2],[15319,0],[15319,1],[15386,2],[15454,1],[15521,3],[15589,0],[15656,2],[15724,1],[15791,3],[15859,0],[15859,1],[15926,2],[15994,1],[15994,0],[16061,3],[16129,0],[16196,2],[16264,1],[16264,0],[16331,3],[16399,1],[16399,0],[16466,3],[16534,1],[16601,2],[16669,1],[16669,0],[16736,3],[16804,2],[16804,1],[16871,0],[16939,2],[16939,3],[17006,1],[17074,3],[17141,2],[17209,0],[17209,1],[17276,3],[17344,1],[17411,2],[17479,0],[17546,2],[17614,1],[17681,3],[17749,0],[17749,1],[17816,3],[17884,1],[17951,2],[18019,0],[18086,2],[18154,1],[18221,3],[18289,1],[18289,0],[18356,2],[18424,3],[18491,2],[18559,1],[18559,0],[18626,3],[18694,2],[18761,1],[18829,2],[18829,3],[18896,1],[18964,0],[19031,1],[19099,2],[19166,1],[19234,0],[19301,1],[19369,2],[19369,3],[19436,0],[19504,3],[19571,1],[19639,2],[19639,3],[19706,1],[19774,2],[19841,0],[19909,2],[19976,1],[20044,3],[20111,0],[20179,2],[20179,3],[20246,0],[20314,2],[20381,1],[20449,3],[20516,0],[20584,2],[20651,0],[20719,2],[20719,3],[20786,0],[20854,3],[20921,1],[20989,3],[21056,0],[21124,2],[21191,1],[21259,2],[21259,3],[21326,0],[21394,2],[21461,1],[21529,3],[21529,0],[21596,1],[21664,2],[21731,1],[21799,2],[21799,3],[21866,1],[21934,2],[22001,0],[22069,2],[22136,1],[22204,3],[22271,0],[22339,3],[22339,2],[22406,0],[22474,2],[22541,1],[22609,3],[22676,1],[22744,2],[22811,0],[22879,2],[22879,3],[22946,0],[23014,2],[23081,1],[23149,2],[23149,3],[23216,0],[23284,1],[23351,2],[23351,3],[23419,1],[23486,0],[23554,2],[23554,3],[23621,1],[23689,2],[23689,3],[23756,0],[23824,3],[23891,1],[23959,2],[23959,3],[24026,1],[24094,2],[24161,0],[24229,3],[24296,1],[24364,2],[24431,0],[24499,2],[24499,3],[24566,1],[24634,2],[24634,3],[24701,0],[24769,3],[24836,1],[24904,2],[24904,3],[24971,0],[25039,2],[25039,3],[25106,1],[25174,2],[25241,0],[25309,2],[25309,3],[25376,0],[25444,1],[25444,2],[25511,3],[25579,1],[25579,0],[25646,2],[25714,3],[25781,2],[25849,0],[25916,1],[25984,2],[26051,3],[26119,0],[26186,1],[26254,2],[26321,3],[26389,0],[26456,1],[26524,2],[26591,3],[26659,0],[26726,1],[26794,2],[26861,3],[26929,0],[26996,3],[27064,1],[27131,2],[27199,0],[27266,3],[27334,1],[27401,2],[27469,0],[27536,3],[27604,1],[27671,2],[27739,0],[27806,3],[27874,1],[27941,2],[28009,1],[28009,0],[28549,2],[29089,1],[29629,0],[30169,3],[30709,2],[31249,0],[31519,0],[31789,1],[31924,2],[32059,2],[32194,3],[32329,3],[32869,1],[33139,2],[33409,3],[33679,2],[33949,1],[34219,0],[34489,3],[34759,2],[35029,1],[35299,2],[35569,1],[36109,0],[36649,0],[36649,2],[36649,3],[36919,1],[37189,2],[37459,3],[37729,2],[37819,3],[37909,2],[37999,1],[38269,2],[38539,1],[38809,3],[38809,2],[38809,0],[39079,1],[39349,2],[39619,0],[39889,3],[40159,2],[40429,1],[40699,2],[40969,3],[40969,1],[40969,0],[41509,1],[41711,1],[41914,2],[42049,0],[42049,1],[42049,3],[42319,2],[42589,3],[42589,2],[42589,0],[42791,1],[42926,2],[43129,0],[43129,3],[43129,2],[43669,0],[43669,1],[43804,3],[43939,1],[43939,0],[44074,2],[44209,1],[44209,2],[44209,3],[44209,0],[44479,1],[44479,0],[44479,2],[44479,3],[44749,1],[44749,0],[44749,3],[44749,2],[45019,1],[45019,2],[45019,3],[45019,0],[45289,0],[45356,1],[45424,2],[45491,3],[45559,0],[45626,1],[45694,2],[45761,3],[45829,0],[45896,1],[45964,2],[46031,3],[46099,0],[46166,1],[46234,2],[46301,3],[46369,0],[46436,3],[46504,1],[46571,2],[46639,0],[46706,3],[46774,1],[46841,2],[46909,0],[46976,3],[47044,1],[47111,2],[47179,0],[47246,3],[47314,1],[47381,2],[47449,1],[47449,0],[47516,2],[47584,1],[47651,0],[47719,2],[47719,3],[47786,1],[47854,2],[47921,0],[47989,2],[47989,3],[48058,1],[48125,3],[48193,0],[48260,3],[48260,2],[48328,0],[48395,2],[48463,1],[48530,2],[48530,3],[48598,1],[48665,3],[48733,0],[48800,2],[48800,3],[48868,1],[48935,2],[49003,1],[49070,0],[49070,3],[49138,1],[49205,2],[49273,1],[49340,2],[49340,3],[49408,0],[49475,1],[49543,0],[49610,2],[49610,3],[49678,1],[49745,2],[49813,0],[49880,1],[49880,2],[49948,0],[50015,3],[50083,0],[50150,2],[50150,3],[50218,0],[50285,2],[50353,1],[50420,2],[50420,3],[50488,0],[50555,3],[50623,1],[50690,3],[50690,2],[50758,1],[50825,2],[50893,0],[50960,1],[50960,3],[51028,0],[51095,2],[51163,0],[51230,1],[51230,2],[51298,0],[51365,3],[51433,0],[51500,3],[51500,2],[51568,0],[51635,2],[51703,1],[51770,2],[51770,3],[51838,1],[51905,2],[51973,0],[52040,1],[52108,0],[52175,3],[52243,1],[52310,2],[52310,3],[52378,0],[52445,3],[52513,1],[52580,2],[52580,3],[52648,0],[52715,1],[52783,0],[52850,2],[52850,3],[52918,0],[52985,2],[53053,1],[53120,2],[53120,3],[53188,0],[53255,1],[53323,2],[53390,3],[53390,1],[53458,0],[53525,2],[53593,0],[53660,2],[53660,3],[53728,1],[53795,2],[53863,1],[53930,2],[53930,3],[53998,0],[54065,2],[54133,1],[54200,2],[54200,3],[54268,0],[54335,2],[54403,3],[54470,2],[54470,1],[54538,0],[54605,2],[54673,1],[54740,2],[54740,3],[54808,1],[54875,3],[54943,0],[55010,3],[55078,1],[55145,2],[55213,0],[55280,2],[55280,3],[55348,1],[55415,0],[55483,1],[55550,2],[55550,3],[55618,0],[55685,1],[55753,0],[55820,2],[55820,3],[55888,0],[55955,1],[56023,2],[56023,3],[56090,1],[56090,0],[56158,3],[56225,1],[56293,2],[56360,0],[56428,3],[56495,1],[56563,2],[56630,1],[56630,0],[56698,3],[56765,2],[56833,1],[56900,2],[56900,0],[56968,3],[57035,1],[57103,2],[57170,1],[57170,0],[57238,2],[57305,1],[57373,3],[57440,2],[57440,1],[57508,3],[57575,2],[57643,3],[57710,1],[57710,0],[57778,3],[57845,1],[57913,2],[57980,1],[57980,0],[58048,2],[58115,0],[58183,3],[58250,2],[58250,1],[58318,3],[58385,0],[58453,2],[58520,1],[58520,0],[58588,3],[58655,2],[58723,3],[58790,1],[58790,0],[58858,3],[58925,1],[58993,2],[59060,1],[59060,0],[59128,2],[59195,0],[59263,3],[59330,1],[59330,0],[59398,2],[59465,1],[59533,3],[59600,2],[59600,0],[59668,3],[59735,1],[59803,2],[59870,1],[59870,0],[59938,2],[60005,1],[60073,3],[60140,2],[60140,1],[60208,3],[60275,0],[60343,1],[60410,2],[60410,3],[60478,1],[60545,0],[60613,3],[60680,1],[60680,2],[60748,3],[60815,2],[60883,3],[60950,0],[60950,1],[61018,3],[61085,2],[61153,0],[61220,1],[61220,2],[61288,3],[61355,0],[61423,2],[61490,0],[61490,1],[61558,2],[61625,1],[61693,3],[61760,2],[61760,0],[61828,3],[61895,1],[61963,2],[62030,1],[62030,0],[62098,3],[62165,0],[62233,1],[62300,3],[62300,2],[62368,1],[62435,0],[62503,3],[62570,1],[62570,0],[62705,1],[62705,2],[62840,2],[62840,3],[62975,2],[62975,1],[63110,1],[63110,0],[63245,1],[63245,2],[63380,2],[63380,3],[63515,2],[63515,1],[63650,0],[63650,1],[63785,2],[63785,3],[63920,1],[63920,0],[64055,2],[64055,3],[64190,0],[64190,2],[64325,3],[64325,0],[64460,3],[64460,1],[64595,3],[64595,0],[64730,0],[64730,1],[64798,2],[64865,3],[64933,1],[64933,0],[65000,2],[65068,1],[65135,2],[65135,3],[65203,0],[65270,1],[65338,2],[65338,3],[65405,1],[65473,2],[65540,1],[65540,0],[65675,2],[65675,3],[65810,1],[65810,2],[65878,3],[65945,0],[66013,2],[66013,3],[66080,1],[66148,2],[66215,1],[66215,0],[66283,2],[66350,1],[66418,2],[66418,3],[66485,0],[66553,2],[66620,1],[66620,0],[66755,2],[66755,1],[66890,2],[66890,3],[66958,1],[67025,2],[67093,1],[67093,0],[67160,2],[67228,1],[67295,2],[67295,3],[67363,0],[67430,2],[67498,1],[67498,0],[67565,3],[67633,1],[67700,2],[67700,3],[67835,0],[67835,1],[67970,3],[67970,2],[68038,0],[68105,2],[68173,1],[68173,0],[68240,2],[68308,3],[68375,0],[68375,1],[68510,1],[68510,2],[68645,2],[68645,3],[68780,1],[68780,0],[68915,2],[68915,3],[69050,1],[69050,0],[69118,2],[69185,1],[69253,2],[69253,3],[69320,1],[69388,3],[69455,2],[69455,1],[69523,3],[69590,1],[69590,0],[69658,2],[69725,1],[69725,0],[69860,3],[69860,2],[69928,1],[69995,2],[69995,3],[70131,0],[70131,2],[70198,1],[70266,2],[70266,0],[70401,3],[70401,1],[70468,2],[70536,1],[70536,3],[70671,1],[70671,2],[70738,0],[70806,1],[70806,2],[70941,2],[70941,1],[71008,3],[71076,2],[71076,1],[71211,0],[71211,2],[71278,1],[71346,0],[71346,2],[71481,3],[71481,1],[71548,2],[71616,3],[71616,1],[71751,1],[71751,0],[71818,2],[71886,1],[71886,0],[72021,3],[72021,2],[72088,1],[72156,2],[72156,3],[72291,2],[72291,1],[72358,0],[72426,3],[72493,2],[72493,1],[72561,3],[72628,0],[72696,2],[72696,3],[72763,1],[72831,2],[72898,1],[72898,0],[72966,3],[73033,1],[73101,2],[73101,3],[73236,2],[73236,1],[73371,0],[73371,2],[73506,2],[73506,0],[73641,3],[73641,0],[73776,3],[73776,0],[73911,3],[73911,1],[74046,3],[74046,1],[74181,3],[74181,0],[74316,3],[74316,0],[74451,0],[74451,1],[74541,2],[74541,3],[74631,1],[74631,0],[74721,2],[74721,3],[74856,2],[74991,3],[75058,2],[75126,0],[75193,3],[75261,2],[75328,0],[75396,3],[75531,1],[75531,0],[75531,2],[75666,1],[75666,2],[75801,2],[75801,3],[75936,3],[75936,2],[76071,2],[76071,3],[76206,2],[76206,3],[76341,2],[76341,0],[76476,2],[76476,0],[76611,2],[76611,2],[76611,0],[76746,2],[76746,2],[76881,2],[76881,3],[76881,2],[77016,3],[77016,2],[77151,0],[77151,2],[77151,2],[77286,2],[77286,0],[77421,2],[77421,3],[77421,2],[77556,3],[77556,2],[77691,3],[77691,2],[77758,0],[77826,3],[77893,2],[77893,0],[77961,2],[78028,2],[78096,3],[78096,2],[78163,2],[78231,3],[78298,2],[78298,0],[78366,2],[78501,2],[78501,0],[78636,2],[78636,2],[78771,2],[78771,3],[78838,0],[78906,2],[78906,2],[78973,3],[79041,2],[79041,0],[79108,3],[79176,2],[79176,2],[79243,3],[79311,2],[79311,0],[79378,2],[79446,0],[79513,2],[79513,3],[79581,2],[79648,2],[79716,2],[79716,0],[79851,2],[79851,3],[79918,0],[79986,3],[80053,0],[80053,2],[80121,2],[80188,3],[80256,2],[80256,0],[80323,3],[80391,2],[80458,2],[80458,3],[80526,0],[80593,2],[80661,2],[80661,3],[80796,2],[80796,2],[80931,2],[80931,3],[80931,2],[81066,2],[81066,2],[81201,2],[81201,3],[81201,0],[81336,0],[81336,2],[81471,0],[81471,2],[81471,2],[81606,2],[81606,0],[81741,3],[81741,2],[81741,0],[81876,2],[81876,0],[81876,3],[82011,3],[82011,2],[82011,2],[82011,0],[82146,0],[82281,1],[82416,2],[82551,2],[82686,2],[82821,2],[82956,1],[83091,2],[83226,2],[83361,2],[83496,1],[83631,3],[83766,3],[83901,3],[84036,1],[84171,2],[84306,1],[84441,0],[84576,1],[84711,2],[84846,1],[84981,2],[85116,3],[85251,0],[85386,1],[85521,2],[85656,3],[85791,3],[85926,3],[86061,2],[86196,1],[86331,0],[86466,0],[86601,1],[86736,2],[86871,2],[87006,2],[87141,2],[87276,1],[87411,2],[87546,3],[87681,3],[87816,3],[87951,3],[88086,2],[88221,1],[88356,0],[88491,0],[88626,0],[88761,1],[88896,2],[89031,2],[89166,3],[89301,3],[89436,3],[89571,0],[89706,2],[89841,2],[89976,3],[90111,2],[90111,2],[90111,0],[90381,2],[90381,3],[90381,2],[90651,0],[90651,2],[90651,2],[90651,3],[90786,0],[90921,2],[91056,2],[91191,2],[91326,2],[91461,2],[91596,2],[91731,2],[91866,2],[92001,2],[92136,3],[92271,3],[92406,3],[92541,3],[92676,2],[92811,2],[92811,3],[92811,0],[92946,2],[93081,0],[93216,2],[93351,2],[93486,2],[93621,2],[93756,3],[93891,0],[94026,1],[94161,2],[94296,3],[94431,3],[94566,3],[94701,2],[94836,1],[94971,0],[94971,2],[94971,3],[95106,0],[95241,1],[95376,2],[95511,2],[95646,2],[95781,2],[95916,1],[96051,2],[96051,3],[96051,0],[96186,2],[96321,2],[96456,3],[96591,1],[96591,2],[96591,0],[96726,3],[96861,3],[96861,0],[96996,2],[97131,1],[97131,3],[97266,0],[97401,0],[97401,3],[97536,0],[97671,1],[97671,3],[97806,2],[97941,2],[97941,3],[98076,3],[98211,3],[98211,2],[98211,1],[98211,0],[98346,0],[98481,0],[98616,0],[98751,0],[98886,0],[99021,0],[99156,0],[99291,0],[99291,1],[99291,2],[99291,3],[99426,0],[99426,1],[99561,1],[99561,0],[99696,1],[99696,0],[99831,1],[99831,0],[99966,1],[99966,0],[100101,1],[100101,0],[100236,1],[100236,0],[100371,1],[100371,2],[100371,0],[100371,3],[100506,1],[100506,2],[100506,0],[100641,2],[100641,1],[100641,0],[100776,2],[100776,1],[100776,0],[100911,2],[100911,1],[100911,0],[101046,2],[101046,1],[101046,0],[101181,2],[101181,1],[101181,0],[101316,2],[101316,1],[101316,0],[101451,2],[101451,1],[101451,0],[101451,3],[101586,1],[101586,2],[101586,0],[101586,3],[101721,2],[101721,3],[101721,1],[101721,0],[101856,2],[101856,3],[101856,1],[101856,0],[101991,2],[101991,3],[101991,1],[101991,0],[102126,2],[102126,3],[102126,1],[102126,0],[102261,2],[102261,3],[102261,1],[102261,0],[102396,2],[102396,3],[102396,1],[102396,0],[102531,0],[102531,2],[102531,3],[102666,0],[102801,0],[102936,0],[103071,0],[103206,0],[103341,0],[103476,0],[103611,0],[103611,2],[103611,3],[103746,2],[103746,0],[103881,2],[103881,0],[104016,2],[104016,0],[104151,2],[104151,0],[104286,2],[104286,0],[104421,2],[104421,0],[104556,2],[104556,0],[104691,2],[104691,3],[104691,0],[104826,0],[104826,2],[104826,3],[104961,0],[104961,2],[104961,3],[105096,0],[105096,2],[105096,3],[105231,0],[105231,2],[105231,3],[105366,2],[105366,0],[105366,3],[105501,0],[105501,2],[105501,3],[105636,0],[105636,2],[105636,3],[105771,3],[105771,0],[105838,2],[105838,1],[105906,0],[105906,3],[105973,2],[105973,1],[106041,3],[106041,0],[106108,2],[106108,1],[106176,3],[106176,0],[106243,2],[106243,1],[106311,3],[106311,0],[106378,2],[106378,1],[106446,3],[106446,0],[106513,2],[106513,1],[106581,3],[106581,0],[106648,2],[106648,1],[106716,3],[106716,0],[106783,2],[106783,1],[106851,3],[106851,0],[106918,2],[106986,0],[107053,2],[107121,3],[107188,2],[107256,0],[107323,2],[107391,3],[107458,2],[107526,0],[107593,2],[107661,3],[107661,0],[107931,2],[107931,3],[107931,0],[107998,1],[108066,2],[108133,1],[108133,0],[108201,3],[108268,1],[108336,2],[108403,3],[108403,0],[108471,2],[108538,1],[108538,0],[108606,2],[108673,0],[108741,1],[108741,3],[108876,1],[108876,0],[109011,2],[109011,3],[109078,0],[109146,1],[109213,2],[109213,3],[109281,0],[109348,3],[109416,1],[109416,0],[109483,2],[109551,0],[109618,1],[109618,2],[109686,0],[109753,3],[109821,1],[109821,0],[109956,3],[109956,2],[110091,0],[110091,1],[110158,2],[110226,0],[110293,1],[110293,3],[110361,0],[110428,2],[110496,1],[110496,0],[110563,3],[110631,1],[110698,2],[110698,3],[110766,0],[110833,3],[110901,1],[110901,0],[111036,3],[111036,2],[111171,0],[111171,1],[111238,2],[111306,0],[111373,2],[111373,3],[111441,1],[111508,2],[111576,1],[111576,0],[111711,1],[111711,2],[111846,2],[111846,3],[111981,1],[111981,0],[112116,3],[112116,2],[112251,0],[112251,1],[112318,3],[112386,1],[112453,2],[112453,3],[112521,0],[112588,3],[112656,2],[112656,1],[112723,0],[112791,2],[112791,3],[112858,1],[112926,2],[112926,3],[113061,0],[113061,1],[113128,2],[113196,1],[113196,0],[113331,3],[113331,1],[113398,2],[113466,3],[113466,1],[113601,0],[113601,2],[113668,1],[113736,2],[113736,0],[113871,2],[113871,1],[113938,3],[114006,2],[114006,1],[114141,1],[114141,2],[114208,0],[114276,1],[114276,2],[114411,3],[114411,1],[114478,2],[114546,1],[114546,3],[114681,0],[114681,2],[114748,1],[114816,0],[114816,2],[114951,2],[114951,3],[115018,1],[115086,2],[115086,3],[115221,0],[115221,1],[115288,2],[115356,1],[115356,0],[115491,3],[115491,2],[115558,0],[115626,3],[115693,1],[115693,0],[115761,2],[115828,0],[115896,2],[115896,3],[115963,0],[116031,1],[116098,2],[116098,3],[116166,0],[116233,3],[116301,1],[116301,0],[116436,3],[116436,2],[116571,1],[116571,2],[116571,0],[116706,2],[116706,1],[116841,2],[116841,3],[116841,0],[116976,3],[116976,2],[117111,2],[117111,3],[117111,1],[117246,2],[117246,3],[117381,2],[117381,3],[117381,0],[117516,3],[117516,2],[117651,0],[117651,1],[117741,2],[117741,3],[117831,1],[117831,0],[117921,2],[117921,3],[118056,2],[118191,3],[118258,2],[118326,0],[118393,3],[118461,2],[118528,0],[118596,3],[118731,0],[118731,1],[118731,2],[118866,2],[118866,1],[119001,2],[119001,3],[119001,0],[119136,3],[119136,2],[119271,2],[119271,3],[119271,1],[119406,2],[119406,3],[119541,2],[119541,1],[119541,0],[119676,2],[119676,1],[119811,2],[119811,1],[119811,3],[119946,3],[119946,2],[120081,0],[120081,1],[120081,2],[120216,0],[120216,1],[120351,2],[120351,3],[120351,1],[120486,1],[120486,2],[120621,0],[120621,1],[120621,2],[120756,2],[120756,1],[120891,3],[121431,0],[121634,0],[121836,1],[121971,2],[122511,2],[122714,3],[123051,2],[123726,2],[123861,3],[123996,2],[124131,0],[124131,1],[124131,3],[124401,1],[124401,0],[124401,3],[124671,1],[124671,0],[124671,2],[124941,1],[124941,0],[124941,2],[125211,0],[125211,2],[125211,3],[125279,1],[125346,3],[125414,1],[125414,0],[125481,2],[125549,0],[125616,1],[125616,3],[125684,2],[125751,1],[125819,3],[125819,0],[125886,1],[125954,0],[126021,1],[126021,3],[126021,2],[126156,1],[126156,2],[126291,3],[126291,0],[126291,2],[126359,1],[126426,0],[126494,2],[126494,3],[126561,1],[126629,2],[126696,3],[126696,0],[126764,1],[126831,2],[126899,3],[126899,0],[126966,1],[126966,2],[127034,0],[127101,1],[127101,3],[127101,2],[127236,2],[127236,0],[127371,3],[127371,1],[127371,0],[127439,2],[127506,0],[127574,1],[127574,3],[127641,0],[127709,2],[127776,1],[127776,0],[127844,3],[127844,2],[127911,0],[127979,1],[127979,2],[128046,3],[128114,0],[128181,2],[128181,3],[128316,0],[128316,1],[128451,3],[128451,2],[128451,0],[128519,1],[128586,3],[128654,2],[128654,0],[128721,3],[128789,0],[128856,2],[128856,1],[128991,1],[128991,0],[128991,2],[129126,3],[129126,2],[129126,0],[129261,3],[129261,2],[129261,1],[129396,2],[129396,3],[129396,0],[129531,2],[129531,1],[129531,3],[129599,0],[129666,2],[129734,0],[129734,1],[129801,2],[129869,3],[129936,2],[129936,1],[130004,0],[130071,1],[130071,2],[130071,3],[130139,0],[130206,1],[130206,2],[130206,3],[130341,1],[130341,0],[130341,2],[130409,3],[130476,2],[130476,1],[130476,0],[130611,3],[130611,1],[130611,0],[130679,2],[130746,3],[130746,1],[130746,0],[130881,2],[130881,0],[130881,3],[130949,1],[131016,2],[131016,3],[131016,0],[131151,3],[131151,2],[131219,1],[131219,0],[131286,3],[131286,2],[131421,0],[131421,1],[131489,2],[131489,3],[131556,1],[131556,0],[131691,3],[131691,1],[131759,2],[131759,0],[131826,1],[131826,3],[131961,0],[131961,2],[132029,1],[132029,3],[132096,2],[132096,0],[132231,0],[132231,3],[132299,2],[132299,1],[132366,3],[132366,0],[132501,2],[132501,1],[132569,0],[132569,3],[132636,1],[132636,2],[132771,2],[132771,3],[132771,1],[132839,0],[132906,2],[132974,1],[132974,0],[133041,3],[133109,2],[133176,1],[133176,0],[133244,2],[133311,0],[133379,1],[133379,2],[133446,3],[133514,0],[133581,1],[133581,2],[133581,3],[133716,2],[133716,3],[133851,3],[133851,0],[133851,2],[133986,2],[133986,3],[134121,0],[134121,1],[134121,2],[134256,2],[134256,1],[134391,2],[134391,3],[134391,0],[134526,2],[134526,3],[134661,3],[134661,2],[134661,1],[134796,2],[134796,3],[134931,1],[134931,0],[135021,2],[135021,3],[135111,1],[135111,0],[135201,2],[135201,3],[135336,2],[135336,1],[135471,3],[135539,2],[135606,0],[135674,3],[135741,2],[135809,0],[135876,3],[136011,0],[136011,1],[136011,2],[136146,1],[136146,0],[136281,2],[136281,3],[136281,0],[136416,2],[136416,0],[136551,3],[136551,2],[136551,1],[136686,1],[136686,2],[136821,1],[136821,0],[136821,2],[136956,1],[136956,0],[137091,3],[137091,1],[137091,2],[137226,1],[137226,2],[137226,3],[137361,3],[137361,2],[137361,0],[137496,2],[137496,3],[137496,0],[137631,0],[137631,1],[137631,2],[137766,2],[137766,1],[137766,0],[137901,2],[137901,0],[137901,3],[138036,2],[138036,3],[138036,0],[138171,3],[138171,2],[138171,0],[138239,1],[138306,0],[138374,2],[138374,1],[138441,3],[138509,2],[138576,1],[138576,0],[138644,2],[138711,1],[138779,0],[138779,2],[138779,3],[138846,1],[138914,0],[138981,1],[138981,2],[139049,3],[139116,2],[139116,1],[139184,0],[139251,1],[139251,2],[139319,3],[139386,1],[139386,0],[139454,3],[139521,2],[139521,1],[139589,0],[139656,1],[139656,3],[139724,2],[139791,1],[139791,3],[139791,0],[139859,2],[139926,0],[139994,1],[139994,3],[140061,2],[140129,0],[140196,1],[140196,2],[140331,2],[140331,3],[140331,0],[140399,1],[140466,0],[140534,1],[140534,2],[140601,3],[140669,0],[140736,1],[140736,2],[140804,3],[140871,0],[140939,1],[140939,3],[141006,2],[141074,1],[141141,2],[141141,3],[141141,0],[141209,1],[141276,2],[141276,3],[141344,0],[141411,1],[141411,3],[141411,2],[141546,2],[141546,3],[141546,1],[141681,3],[141681,2],[141681,0],[141816,3],[141816,2],[141816,0],[141951,2],[141951,0],[141951,1],[142086,2],[142086,1],[142086,0],[142221,2],[142221,3],[142221,0],[142356,3],[142356,2],[142356,0],[142491,1],[142491,0],[142559,3],[142626,2],[142694,3],[142761,0],[142829,2],[142896,1],[142964,3],[143031,1],[143099,3],[143166,0],[143234,2],[143301,1],[143369,3],[143436,2],[143504,3],[143571,0],[143571,1],[143639,2],[143706,0],[143774,1],[143841,3],[143841,2],[143909,0],[143976,1],[144044,3],[144111,1],[144111,0],[144179,2],[144246,1],[144314,0],[144381,2],[144381,3],[144449,1],[144516,2],[144584,3],[144651,1],[144651,0],[144719,3],[144786,1],[144786,2],[144854,3],[144921,2],[144921,0],[144989,1],[145056,0],[145056,3],[145124,1],[145191,2],[145191,0],[145191,3],[145259,1],[145326,2],[145326,3],[145326,0],[145394,1],[145461,0],[145461,2],[145529,3],[145596,2],[145596,1],[145664,3],[145731,1],[145731,0],[145799,2],[145799,3],[145866,1],[145866,0],[145934,2],[145934,3],[146001,1],[146001,0],[146069,2],[146069,3],[146136,1],[146136,0],[146204,2],[146204,3],[146271,1],[146271,0],[146339,2],[146339,3],[146406,1],[146406,0],[146474,2],[146474,3],[146541,1],[146541,0],[146609,2],[146609,3],[146676,1],[146676,0],[146744,2],[146744,3],[146811,1],[146811,0]];
	 var nowTime = 0, interval = 1000, offset = 1350, perpectTop = 465, speed = 600;
	 var playInterval;

function showMessage(pclass,descript){
	 var mes = $(".cloneable.message").clone();
	 mes.text(descript);
	 mes[0].classList.remove("cloneable");
	 mes[0].classList.add(pclass);
	 mes.appendTo("#display");
	 mes.animate({"top":"350px","opacity":"0"},"slow","swing",function(){
	 	$(this).remove();
	 });
}
function pushnote(pclass){
	$(pclass+".key-intro")[0].classList.add("push");
	var note = $(pclass+".note:first")
	var timing = note.css("top").toString().replace("px","");
	/*
	$(pclass+".note").each(function(){
		var thisTimeing = $(this).css("top").toString().replace("px","");
		if(thisTimeing > timing && thisTimeing < perpectTop+100){
			note = $(this);
			timing = thisTimeing;
		}
	})
*/

	if(timing == undefined) return;
	pclass = pclass.substring(1);
	console.log(timing);
	if(perpectTop-30 < timing && perpectTop+30 > timing){
		$(".n-great").text(function(i,v){return parseInt(v) + 1});
		$(".n-score").text(function(i,v){return parseInt(v) + 2});
		addCombo(true);
		showMessage(pclass,"따봉!!");

		note[0].classList.add("pushed");
		note.remove();
	} else if(perpectTop-130 < timing && perpectTop+130 > timing){
		$(".n-good").text(function(i,v){return parseInt(v) + 1});
		$(".n-score").text(function(i,v){return parseInt(v) + 1});
		addCombo(true);
		showMessage(pclass,"굿잡!!");

		note[0].classList.add("pushed");
		note.remove();
	} else if(perpectTop-170 < timing && perpectTop+170 > timing){
		$(".n-miss").text(function(i,v){return parseInt(v) + 1});
		addCombo(false);
		showMessage(pclass,"이런..");

		note[0].classList.add("pushed");
		note.remove();
	}
}
function addCombo(status){
	if(status == true){
		$(".combo").text(function(i,v){return parseInt(v) + 1});
		var combo = parseInt($(".combo").text());
		$(".n-maxcombo").text(function(i,v){
			var maxcombo;
			if(parseInt(v) < combo){
				maxcombo = combo;
			} else {
				maxcombo = parseInt(v);
			}
			return maxcombo;
		});
	} else {
		$(".combo").text(0);
	}
}
$("bo" + "dy").on("keydown",function(e){
	switch(e.keyCode){
		case 90:
			pushnote(".position-0");
		break;
		case 88:
			pushnote(".position-1");
		break;
		case 190:
			pushnote(".position-2");
		break;
		case 191:
			pushnote(".position-3");
		break;
	}
});

$("bo" + "dy").on("keyup",function(e){
	switch(e.keyCode){
		case 90:
			$(".position-0.key-intro")[0].classList.remove("push");
		break;
		case 88:
			$(".position-1.key-intro")[0].classList.remove("push");
		break;
		case 190:
			$(".position-2.key-intro")[0].classList.remove("push");
		break;
		case 191:
			$(".position-3.key-intro")[0].classList.remove("push");
		break;
	}
});


$("audio").on("canplaythrough",function(){
	setTimeout(function(){
		$("audio")[0].play();
	},offset);
	playInterval = setInterval(function(){
	 var isNoteZero = noteInfo.length == 0;
	 if(isNoteZero == false){
	 	//겜중
		 while(noteInfo[0][0] < nowTime+interval){
		 	(function(){
		 	var notearr = noteInfo.shift();
		 	setTimeout(function(){
		 				var note = $(".note.cloneable").clone();
		 				var noteHorizon = "position-"+notearr[1];
		 				note[0].classList.remove("cloneable");
		 				note[0].classList.add(noteHorizon);
		 				note.appendTo("#display")
							.animate({top:"550px"},speed,"linear",function(){
								if(this.classList.contains("pushed") == false){
									showMessage(noteHorizon,"이런...")
									addCombo(false);
									$(".n-miss").text(function(i,v){return parseInt(v) + 1});
									$(this).remove();
								}
						});
		 	}, notearr[0] - nowTime);
		 	})()
		 }
	} else {
		// 겜끝
		var allScore = 2 * (parseInt($(".n-great").text()) + parseInt($(".n-good").text()) + parseInt($(".n-miss").text()) );
		var percent = parseInt($(".n-score").text()) * 100 / allScore;
		var rank = "";
		if(percent > 95){
			rank = "S";
		}else if(percent > 90){
			rank = "AAA";
		}else if(percent > 80){
			rank = "AA";
		}else if(percent > 70){
			rank = "A";
		}else if(percent > 60){
			rank = "B";
		}else if(percent > 50){
			rank = "C";
		}
                $(".result").removeClass("hide");
                $(".score").html(rank +"랭크 축하드려용!!");
		clearInterval(playInterval);
	}
		nowTime += interval;
	},interval);

      $(".moveDebate").click(function(){
          //플러그인의 모든 키 순회
          function forEach(object, callback){
              for(var key in object){
                  var variable = object[key];
                  callback(variable,key);
              }
          }
          
          function getValue(selector){
              return parseInt($(selector).text());
          }
          
          function getRankingJSON(rankingDoc){
              var regexp = /\<includeonly\>(.*)\<\/includeonly\>/;
              var stringRanking = regexp.exec(rankingDoc)[1];
              return JSON.parse(stringRanking);
          }
  
          function changeToDebate(){
              window.history.pushState(undefined,undefined, "/wiki/%ED%86%A0%EB%A1%A0:%EB%B0%B1%EA%B4%B4%EB%A6%AC%EA%B2%9C");
          }
  
          function updateDoc(rankingJSON,api){
              var stringRanking = JSON.stringify(rankingJSON);
              var result = "<includ" + "eonly>" + stringRanking + "</inclu" + "deonly>\n";
              result += "<onlyin" + "clude>\n";
              var rankingList = Object.values( rankingJSON )
              rankingList.sort(function(a,b){ return b.score - a.score});
              rankingList.forEach(function(json){
                    result += "* " + json.name + " : "
                    + "점수: " + json.score + ", "
                    + "따봉!: " + json.great + ", "
                    + "굿잡!: " + json.good + ", "
                    + "이런..: " + json.miss + ", "
                    + "콤보: " + json.combo + "\n";
              });

              result += "</only" + "include>";
              changeToDebate();
              api.changeDocument("백괴리겜/랭킹","백괴리겜 점수 갱신",result)
              return result;
          }

          function updateUserScore(rankingJSON,thisScore){
            var userName = thisScore.name;
            console.log(rankingJSON[userName].score, thisScore.score)
            if(rankingJSON[userName].score < thisScore.score){
                rankingJSON[userName] = thisScore;
            }
          }

          var userName = mw.config.get("wgUserName");
          var thisScore = {
              name: userName,
              great: getValue(".n-great"),
              good: getValue(".n-good"),
              miss: getValue(".n-miss"), 
              score: getValue(".n-score"),
              combo: getValue(".n-maxcombo"),
          }
          

          var api = MediaWikiAPI();
          var rankingDoc = api.getDocument("백괴리겜/랭킹");
          var rankingJSON = getRankingJSON(rankingDoc);
          updateUserScore(rankingJSON,thisScore);
          updateDoc(rankingJSON,api);
      })
});
		
  }

}
$( plugin_uncyrhythm );
/* uncyrhythm 끝 */

/** 플러그인 numbase***************************
* 숫자야구 remake
* 버전 => 1.41
* 작성자 : [[사용자:Riemann|Riemann]] 
* JSON => numbase = {"name":"numbase","descript":"숫자야구 remake","version":"1.41","local":true,"creat":"Riemann","state":"사용자:Riemann/numbase","executable":true}; 
*/ 
function plugin_numbase(){
  if($("[data-name='numbase']").length >= 1){
		 
var title = mw.config.get('wgPageName');
if (title.slice( -1 ) == "4") {
    var no = 4
    }
else {
    var no = 3
}

var trial = 0;
var d = new Date();
$("#sBtn").click(function(){
    $("#description").css("display", "none");
    $("#sBtn").css("display", "none");
    $("#res").css("display", "table");
    cpuNum = initNumbase();
    document.getElementById('count').innerHTML = "시도 횟수: " + trial;
    var bDate = d.getTime();
    numGuess(bDate);
});

function initNumbase() {
var choice = "";
var initArray = [0,1,2,3,4,5,6,7,8,9];
var i, j;
for (i = 0; i < no; i++) {
    j = Math.floor(Math.random() * initArray.length);
    choice += initArray[j];
    initArray.splice(j,1);
}
return choice;
}

function numGuess(bDate) {
document.getElementById('disp').style.display = 'table';
document.getElementById('numList').style.display = 'block';
var numb = document.getElementById('numList');
var numBlocks = "";
var disp = "";
document.getElementById('disp').innerHTML = disp;
for (i = 0; i < 10; i++) {
    numBlocks += "<div id=\"numBlock" + i + "\" class=\"numBlock\">" + i + "</div>";
}
numBlocks += "<div id=\"numBlockC\" class=\"numBlockC\">C</div>";
numBlocks += "<div id=\"numBlockX\" class=\"numBlockC\">입력</div>";
numb.innerHTML = numBlocks;

function restrictLen(l,n) {
   if (l.length < no) {
        l += n;
   } else {
        alert(no + " 자리로 입력하세요.");
   }
   return l;
}

$("#numBlock0").click(function(){
    disp = restrictLen(disp,0);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock0").css("display", "none");
});
$("#numBlock1").click(function(){
    disp = restrictLen(disp,1);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock1").css("display", "none");
});
$("#numBlock2").click(function(){
    disp = restrictLen(disp,2);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock2").css("display", "none");
});
$("#numBlock3").click(function(){
    disp = restrictLen(disp,3);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock3").css("display", "none");
});
$("#numBlock4").click(function(){
    disp = restrictLen(disp,4);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock4").css("display", "none");
});
$("#numBlock5").click(function(){
    disp = restrictLen(disp,5);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock5").css("display", "none");
});
$("#numBlock6").click(function(){
    disp = restrictLen(disp,6);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock6").css("display", "none");
});
$("#numBlock7").click(function(){
    disp = restrictLen(disp,7);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock7").css("display", "none");
});
$("#numBlock8").click(function(){
    disp = restrictLen(disp,8);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock8").css("display", "none");
});
$("#numBlock9").click(function(){
    disp = restrictLen(disp,9);
    document.getElementById('disp').innerHTML = disp;
    $("#numBlock9").css("display", "none");
});
$("#numBlockC").click(function(){
    disp = "";
    document.getElementById('disp').innerHTML = disp;
    $(".numBlock").css("display", "inline-flex");
});
$("#numBlockX").click(function(){
    if (disp.length < no) {
        alert(no + " 자리로 입력하세요.")
    } else {
        trial += 1
        document.getElementById('count').innerHTML = "시도 횟수: " + trial;
        v = valid(disp,cpuNum);
        $("#res").append("<tr><td>" + trial + "</td><td>" + disp + "</td><td>" + v + "</td></tr>");
        disp = "";
        document.getElementById('disp').innerHTML = disp;
        $(".numBlock").css("display", "inline-flex");
        if ((v == "0B 3S" && no == 3) || (v == "0B 4S" && no == 4)) {
            var dd = new Date();
            var duration = Math.floor((dd.getTime() - bDate) / 1000);
            document.getElementById('end').innerHTML = "축하합니다. 정수를 맞히셨습니다. " + trial + "회, " + duration + "초가 소비되었습니다. 이용해주셔서 감사합니다.";
            $("#disp").css("display", "none");
            $("#numList").css("display", "none");
            $("#end").css("display", "inline");
            return 0;
        }
    }
});
}

function valid(u,c) {
    var b = 0;
    var s = 0;
    var bs;
    for (i = 0; i < no; i++) {
        for (j = 0; j < no; j++) {
            if (u[i] == c[j]) {
                if (i == j) {
                    s += 1;
                }
                else {
                    b += 1;
                }
            }
        }
    }
    bs = "" + b + "B " + s + "S"
    return bs;
}

		
  }

}
$( plugin_numbase );
/* numbase 끝 */


/** 플러그인 createBubble***************************
* 자바스크립트 외부 라이브러리 사용 가능 테스트, [[사용자:BANIP/거품]]을 보이게 해 줍니다
* 버전 => 1.0.9
* 작성자 : [[사용자:BANIP|BANIP]] 
* JSON => createBubble = {"name":"createBubble","descript":"자바스크립트 외부 라이브러리 사용 가능 테스트, [[사용자:BANIP/거품]]을 보이게 해 줍니다","version":"1.0.9","local":true,"creat":"BANIP","state":"사용자:BANIP/거품/createBubble","executable":true}; 
*/ 
function plugin_createBubble(){
  if($("[data-name='createBubble']").length >= 1){
		 
 // 이부부분에 코드 입력 //
fetch("https://rawgit.com/juliangarnier/anime/master/anime.min.js").then(function(data) {
    return data.text();
}).then(function(body) {
    return eval(body)
}).then(function() {
    $("body > *").not("script").hide();
    $("body").append('<div class="display"> <div class="count">0</div> <input class="set-count" value="45"/> </div> <div class="hidden"> <div class="circle" /> </div>');
    var outer = {
        init: function() {
            this.height = window.innerHeight;
            this.width = window.innerWidth;
            this.event();
        },
        event: function() {
            return $(window).resize(function() {
                return outer.init()
            });
        }

    }

    var create = (function() {
        var DOMControl = {
            addBubbleCount: function(count) {
                count = count || 1
                var prevCount = parseInt($(".display .count").text());
                $(".display .count").text(prevCount + count);

            }
        }
        return {
            bubble: function(duration) {
                duration = duration || 2000
                var $obj = $(".hidden .circle").clone();
                var property = {
                    startRadius: anime.random(outer.width / 15, outer.width / 5),
                    endRadius: anime.random(10, 50),
                    left: anime.random(0, 100) + "%",
                }
                $obj.css({
                    "left": property.left,
                    "width": property.startRadius,
                    "height": property.startRadius,
                });
                $(".display").append($obj);

                DOMControl.addBubbleCount(1);

                var animation = anime({
                    targets: $obj[0],
                    bottom: "100%",
                    width: property.endRadius,
                    height: property.endRadius,
                    duration: duration,
                    easing: "easeOutCubic",
                    update: function(status) {
                        return status.completed && $obj.remove()
                    },
                })
            }
        }

    })();

    var animation = {
        static: {},
        startBubble: function(interval, duration) {
            interval = interval || 12
            duration = duration || 800
            this.stopBubble();
            this.static.bubble = setInterval(function() {
                create.bubble(duration);
            }, interval)
            return this;
        },
        stopBubble: function() {
            this.static.bubble == undefined || clearInterval(this.static.bubble);
            return this;
        }
    };

    var system = (function() {
        var DOMControl = {
            getUserCount: function() {
                return $(".display .set-count").val()
            }
        }
        var eventListener = {
            bodyMouseDown: function(e) {
                //e.preventDefault();
                animation.startBubble(1000 / DOMControl.getUserCount());
                window.navigator.vibrate(20000);
            },
            bodyMouseUp: function() {
                animation.stopBubble();
                window.navigator.vibrate(0);
            },
            bodytouchMove: function(e) {
                e.preventDefault();
            }
        }

        return {
            init: function() {
                $(".display").on("touchMove", eventListener.bodytouchMove);
                $(".count").on("touchstart", eventListener.bodytouchMove)
                $(".display").on("mousedown touchstart", eventListener.bodyMouseDown);
                $(".display").on("mouseup touchend", eventListener.bodyMouseUp);

            }
        }
    })();
    system.init();
})
 // 여기까지 코드 입력 //

		
  }

}
$( plugin_createBubble );
/* createBubble 끝 */





/** 플러그인 uncytick***************************
* 게임 실행용 플러그인
* 버전 => 1.0.0
* 작성자 : [[사용자:BANIP|BANIP]] 
* JSON => uncytick = {"name":"uncytick","descript":"게임 실행용 플러그인","version":"1.0.0","local":true,"creat":"BANIP","state":"사용자:BANIP/틱택토 live/플러그인","executable":true}; 
*/ 
function plugin_uncytick(){
  if($("[data-name='uncytick']").length >= 1){
		  // 이부분에 코드 입력 //

jQuery.getScript("https://socket-io-chat.now.sh/socket.io/socket.io.js")
.done(function(){
var Socket = /** @class */ (function () {
    function Socket(url, username) {
        if (username === void 0) { username = Math.random().toString(); }
        this.username = username;
        this.socket = io(url);
        this.defineJoin();
        this.bindSocketListener();
    }
    Socket.prototype.defineJoin = function () {
        this.socket.emit("join", { username: this.username });
    };
    Socket.prototype.bindSocketListener = function () {
        var _this = this;
        var socket = this.socket;
        socket.on("newuser", function (_a) {
            var username = _a.username;
            Chat.server(username + "\uB2D8\uC774 \uB4E4\uC5B4\uC654\uC5B4\uC694.");
        });
        socket.on("passuser", function (_a) {
            var username = _a.username;
            Chat.server(username + "\uB2D8\uC774 \uB098\uAC14\uC5B4\uC694.");
        });
        socket.on("getuserlist", function (data) {
            var buttonClickListener = function ($li, username, id) {
                socket.emit("requestjoin", { targetId: id });
                $(".activePull").removeClass();
                $li.addClass("activePull");
                Chat.server(username + "에게 게임신청을 했어요.");
            };
            var $lis = data
                .map(function (userData) {
                if (userData == null)
                    return;
                var username = userData.username, id = userData.id;
                var $li = $("<li />")
                    .text(username)
                    .data("id", id);
                if (username != _this.username) {
                    var $button = $("<button>").text("게임 신청").addClass("btn-request");
                    $button.click(function () { return buttonClickListener($li, username, id); });
                    $li.append($button);
                }
                return $li;
            });
            $("#userlist").html($lis);
        });
        socket.on("servermessage", function (data) {
            Chat.server(data.message);
        });
        socket.on("receivemessage", function (data) {
            Chat.client(data.username, data.message);
        });
        socket.on("gamestart", function (_a) {
            var enemyUsername = _a.enemyUsername;
            var canStartGame = _this.game == undefined || _this.game.isGameEnd == true;
            if (canStartGame) {
                _this.game = new Game(socket, _this.username, enemyUsername);
            }
            else {
                Chat.server(_this.game.enemyUsername + "\uACFC\uC758 \uAC8C\uC784\uC774 \uC544\uC9C1 \uB05D\uB098\uC9C0 \uC54A\uC558\uC5B4\uC694.");
            }
        });
    };
    return Socket;
}());
var Chat = /** @class */ (function () {
    function Chat() {
    }
    Chat.server = function (message) {
        var $li = $("<li></li>").text(message);
        $("#messages").append($li);
        Chat.moveBottom();
    };
    Chat.client = function (username, message) {
        var $li = $("\n            <li>\n                <span class='username' /> : <span class='message'>\n            </li>");
        $li.find(".username").text(username);
        $li.find(".message").text(message);
        $("#messages").append($li);
        Chat.moveBottom();
    };
    Chat.moveBottom = function () {
        $("#messages").scrollTop($("#messages")[0].scrollHeight);
    };
    return Chat;
}());
var Game = /** @class */ (function () {
    function Game(socket, username, ememyusername) {
        this.socket = socket;
        this.isGameEnd = false;
        this.enemyUsername = ememyusername;
        Chat.server(ememyusername + "과의 게임이 시작되었어요!");
        $(".btn-request").fadeOut();
        var bindClick = function ($target, axis) {
            var x = axis[0], y = axis[1];
            $target.text("H").click(function () {
                console.log([x, y]);
                socket.emit("draw", {
                    axis: [x, y]
                });
            });
        };
        $("#gamepan").slideDown().find("> div")
            .each(function (x) {
            $(this).find("> a").each(function (y) { bindClick($(this), [x, y]); });
        });
        this.bindSocketListener();
    }
    Game.prototype.bindSocketListener = function () {
        var socket = this.socket;
        var self = this;
        socket.on("renewgamepan", function (_a) {
            var gamepan = _a.gamepan;
            gamepan.forEach(function (hori, x) {
                return hori.forEach(function (cell, y) {
                    var textType = {
                        "1": "O",
                        "0": "H",
                        "-1": "X",
                    };
                    var text = textType[cell];
                    $("#gamepan").find("div").eq(x).find("a").eq(y)
                        .data("x", x).data("y", y)
                        .text(text);
                    console.log(x, y);
                });
            });
        });
        socket.on("gameend", function (_a) {
            var state = _a.state;
            var hideGamePan = function () { return $("#gamepan").slideUp(); };
            var messageType = {
                "win": "게임 승리!! 축하드려요!",
                "lose": "윽... 져버렸네요...",
                "draw": "비겼어요!",
            };
            var endMessage = messageType[state];
            Chat.server(endMessage);
            $(".btn-request").fadeIn();
            setTimeout(hideGamePan, 3000);
            self.isGameEnd = true;
            self.removesocketListener();
        });
    };
    Game.prototype.removesocketListener = function () {
        $("#gamepan").find("a").off("click");
        this.socket.off("gameend").off("renewgamepan");
    };
    return Game;
}());
var gamehtml = '<div id="gamepan"><div><a></a><a></a><a></a></div><div><a></a><a></a><a></a></div><div><a></a><a></a><a></a></div></div><div class="wrap"><ul id="userlist" class="scrollbox"></ul><ul id="messages" class="scrollbox"></ul><input id="chat" placeholder="메세지를 입력하세요..."/></div>';
$("#gamewindow").html(gamehtml);
var thisSocket = new Socket("https://banip.tk" + "/uncytt",mw.config.values.wgUserName);

$("#chat").keypress(function (e) {
    if (e.key === "Enter" && $(this).val() != "") {
        thisSocket.socket.emit("sendmessage", { message: $(this).val() });
        $(this).val("");
    }
});

});
 // 여기까지 코드 입력 //

		
  }

}
$( plugin_uncytick );
/* uncytick 끝 */









































/** 플러그인 real369***************************
* real369 플레이
* 버전 => 1.1.7
* 작성자 : [[사용자:BANIP|BANIP]] 
* JSON => real369 = {"name":"real369","descript":"real369 플레이","version":"1.1.7","local":true,"creat":"BANIP","state":"Real 369/플러그인","executable":true}; 
*/ 
function plugin_real369(){
  if($("[data-name='real369']").length >= 1){
		 /**
 * 지금 박수를 쳐야되는지 숫자를 외쳐야 하는지 알아 냅니다
 * @param {number} number 지금 순서가 몇번째인지 넣는 칸.
 * @return {number|Array[number]} 박수를 쳐야되는 상황이면 배열 안에 숫자를 담아 반환하고 아니면 파라미터를 반환.
 */
function getAnswer(number) {
    var rawNumber = number + "";
    var targetNumber = rawNumber.replace(/3|6|9/g, "");
    var diff = rawNumber.length - targetNumber.length;
    if (diff === 0)
        return number + "";
    else
        return "짝!".repeat(diff);
}
function isMobile() {
    return !(navigator.userAgent.match(/Android|iPhone|iPad|iPod/i) === null);
}
var GUI = /** @class */ (function () {
    function GUI() {
        this.domList = {
            retry: document.querySelector("#gamewrap .gamelink .retry"),
            answer: document.querySelector("#gamewrap .answer"),
            dialog: document.querySelector("#gamewrap .dialog"),
            progress: document.querySelector("#gamewrap .progress"),
            gamelink: document.querySelector("#gamewrap .gamelink")
        };
        this.bindOtherEvent();
        //this.start();
    }
    GUI.prototype.start = function () {
        this.domList.answer.innerHTML = "시작!";
        this.domList.dialog.innerHTML = "";
        this.domList.gamelink.style.display = "none";
        createGame(gui);
        input.setGame(game);
    };
    GUI.prototype.bindOtherEvent = function () {
        var _this = this;
        this.domList.retry.addEventListener("click", function () {
            if (game !== null)
                game.gameOver();
            _this.start();
        });
    };
    GUI.prototype.message = function (message) {
        var dialogNode = this.domList.dialog;
        var messageNode = document.createElement("li");
        messageNode.innerHTML = message;
        dialogNode.appendChild(messageNode);
        dialogNode.scrollTop = dialogNode.scrollHeight;
    };
    GUI.prototype.initOrder = function (userCount, startUser) {
        var orderStringCount = 8;
        var orderString = new Array(orderStringCount).fill("1")
            .map(function (v, i) { return (startUser + i) % userCount === 0 ? username : "COM" + (startUser + i) % userCount; })
            .join(" => ");
        this.message("게임이 시작되었습니다!!!");
        this.message("게임순서 : " + orderString + "...");
    };
    GUI.prototype.getProgressColor = function (progress) {
        var interval = [30, 60, 100];
        var color = ["green", "yellow", "red"];
        var index = interval.indexOf(interval.filter(function (v) { return v > progress; })[0]);
        return color[index];
    };
    GUI.prototype.resetTime = function (duration) {
        var _this = this;
        clearInterval(this.timerInterval);
        var startTime = Date.now();
        this.timerInterval = setInterval(function () {
            var now = Date.now();
            var progress = (now - startTime) / duration * 100 - 1;
            var progressColor = _this.getProgressColor(progress);
            _this.domList.progress.style.background = "linear-gradient(to right," + progressColor + " " + (100 - progress) + "%,white " + (100 - progress + 0.1) + "%)";
        }, 10);
    };
    GUI.prototype.setEnemyTurn = function (order) {
        this.nextUser = "COM" + order;
    };
    GUI.prototype.setMyTurn = function () {
        this.nextUser = username;
    };
    GUI.prototype.gameOver = function (reason, lastCount) {
        this.domList.answer.innerHTML = reason;
        this.message("게임이 끝났습니다!!");
        this.message("최종 카운트: " + lastCount);
        input.setGame(null);
        this.domList.gamelink.style.display = "block";
        clearInterval(this.timerInterval);
    };
    GUI.prototype.setNumber = function (number) {
        this.domList.answer.innerHTML = number;
    };
    GUI.prototype.sayNumber = function (number, name) {
        if (name === void 0) { name = this.nextUser; }
        this.message(name + " : " + number);
    };
    GUI.prototype.setHandClab = function (clab) {
        this.domList.answer.innerHTML = clab;
    };
    return GUI;
}());
var Game = /** @class */ (function () {
    function Game(gui, playerCount, time) {
        if (playerCount === void 0) { playerCount = 3; }
        if (time === void 0) { time = 1000; }
        this.gui = gui;
        this.playerCount = playerCount;
        this.time = time;
        this.order = Math.floor(Math.random() * playerCount);
        this.number = 1;
        gui.initOrder(playerCount, this.order);
        this.turnStart();
    }
    Game.prototype.next = function () {
        var prevNumber = getAnswer(Number(this.number));
        this.gui.sayNumber(prevNumber);
        this.order = (this.order + 1) % this.playerCount;
        this.handClab = "";
        this.number++;
        this.turnStart();
    };
    Game.prototype.turnStart = function () {
        this.gui.resetTime(this.time);
        if (this.order === 0)
            this.myTurn();
        else
            this.enemyTurn();
    };
    Game.prototype.enemyTurn = function () {
        var _this = this;
        this.gui.setEnemyTurn(this.order);
        this.turnTimeout = setTimeout(function () {
            _this.shortenTime();
            _this.next();
        }, this.time * Math.random());
    };
    Game.prototype.myTurn = function () {
        var _this = this;
        this.gui.setMyTurn();
        this.turnTimeout = setTimeout(function () {
            if (getAnswer(_this.number) === _this.handClab)
                _this.next();
            else
                _this.gameOver("시간 초과!");
        }, this.time);
    };
    Game.prototype.sayNumber = function (answer) {
        clearTimeout(this.turnTimeout);
        var reasonGameOver = null;
        if (this.order > 0)
            reasonGameOver = "내 차례가 아닌데 말해버림!";
        else if (getAnswer(this.number) === answer)
            null;
        else
            reasonGameOver = "오답!";
        if (reasonGameOver === null)
            this.next();
        else {
            gui.sayNumber(answer, username);
            this.gameOver(reasonGameOver);
        }
    };
    Game.prototype.setHandClab = function (clab) {
        this.handClab = clab;
    };
    Game.prototype.gameOver = function (reason) {
        clearTimeout(this.turnTimeout);
        this.gui.gameOver(reason, this.number);
        game = null;
    };
    Game.prototype.shortenTime = function () {
        this.time *= 0.94;
    };
    return Game;
}());
var Input = /** @class */ (function () {
    function Input(game, gui) {
        this.game = game;
        this.gui = gui;
        this.clickEventType = isMobile() ? "touchstart" : "click";
        this.resetNumber();
        this.bindKeyBoardEvent();
        this.bindKeyPadEvent();
    }
    Input.prototype.setGame = function (game) {
        this.game = game;
    };
    Input.prototype.bindKeyBoardEvent = function () {
        var _this = this;
        document.addEventListener("keydown", function (e) {
            var key = e.key;
            if (["Enter", "Space"].some(function (v) { return v === key; }))
                return _this.pressEnter();
            else if (key === "BackSpace")
                _this.number = _this.number.slice(0, -1);
            else if (isNaN(parseInt(key)))
                return;
            else
                _this.number += key;
            _this.gui.setNumber(_this.number);
        });
    };
    Input.prototype.bindKeyPadEvent = function () {
        var _this = this;
        document.querySelectorAll(".keypad .key").forEach(function (node) {
            node.addEventListener(_this.clickEventType, function (e) {
                e.preventDefault();
                _this.number += e.target.dataset.num;
                _this.gui.setNumber(_this.number);
            });
        });
        document.querySelector(".keypad .enter").addEventListener(this.clickEventType, function (e) {
            e.preventDefault();
            _this.pressEnter();
        });
        document.querySelector(".keypad .reset").addEventListener(this.clickEventType, function (e) {
            e.preventDefault();
            _this.resetNumber();
            _this.gui.setNumber(_this.number);
        });
    };
    Input.prototype.pressEnter = function () {
        var _this = this;
        if (game == null || game == undefined)
            this.gui.message("아직 게임이 시작되지 않았어요.");
        clearTimeout(this.enterTimeout);
        if (this.number == "") {
            this.enterCount++;
            var answer_1 = "짝!".repeat(this.enterCount);
            this.gui.setHandClab(answer_1);
            this.game.setHandClab(answer_1);
            this.enterTimeout = setTimeout(function () {
                if (_this.game.order === 0) {
                    _this.game.sayNumber(answer_1);
                }
                _this.resetNumber();
            }, 800);
        }
        else {
            this.game.sayNumber(this.number);
            this.resetNumber();
        }
    };
    ;
    Input.prototype.resetNumber = function () {
        this.number = "";
        this.enterCount = 0;
        this.gui.setNumber(this.number);
    };
    return Input;
}());
var game = null;
var createGame = function (gui) { return game = new Game(gui, 4, 5000); };
var username = mw.config.values.wgUserName;
var gui = new GUI();
//createGame(gui);
var input = new Input(game, gui);

		
  }

}
$( plugin_real369 );
/* real369 끝 */























/** 플러그인 UncyBeat***************************
* 버그 수정
* 버전 => 1.02
* 작성자 : [[사용자:Bd3076|Bd3076]] 
* JSON => UncyBeat = {"name":"UncyBeat","descript":"버그 수정","version":"1.02","local":true,"creat":"Bd3076","state":"UncyBeat/plugin","executable":true}; 
*/ 
function plugin_UncyBeat(){
  if($("[data-name='UncyBeat']").length >= 1){
		  // 이부분에 코드 입력 //



var getParameters = function (paramName) {
    var returnValue;

    var url = location.href;
    
    console.log(url);
    
    if(url[8] == 'f'){
      return 0;
    }

    var parameters = (url.slice(url.indexOf('?') + 1, url.length)).split('&');

    for (var i = 0; i < parameters.length; i++) {
        var varName = parameters[i].split('=')[0];
        if (varName.toUpperCase() == paramName.toUpperCase()) {
            returnValue = parameters[i].split('=')[1];
            return decodeURIComponent(returnValue);
        }
    }
};

function updateURLParameter(url, param, paramVal){
    var newAdditionalURL = "";
    var tempArray = url.split("?");
    var baseURL = tempArray[0];
    var additionalURL = tempArray[1];
    var temp = "";
    if (additionalURL) {
        tempArray = additionalURL.split("&");
        for (var i=0; i<tempArray.length; i++){
            if(tempArray[i].split('=')[0] != param){
                newAdditionalURL += temp + tempArray[i];
                temp = "&";
            }
        }
    }

    var rows_txt = temp + "" + param + "=" + paramVal;
    return baseURL + "?" + newAdditionalURL + rows_txt;
}

function Queue(){
  this.arr = [];
  this.s = 0;
  this.e = 0;
  this.size = 0;
  this.front = function(){
    return arr[s];
  }
  this.pop = function(){
    s++;
    size--;
    return;
  }
  this.push = function(k){
    arr[e++] = k;
    size--;
    return;
  }
  this.empty = function(){
    return size==0;
  }
}

var timer = 0;
function calculateTimer(){
	timer += 1;
}

var cvs = document.getElementById('spanArea');
cvs.innerHTML = "<canvas width='720' height='720' id='spanCanvas'></canvas>"
var canvas = document.getElementById('spanCanvas');
var ctx = canvas.getContext('2d');

var level = getParameters('level');
const levelCount = 1;

const levelNames = [
  'Dreams'
];

const levelMusicLink = [
  'https://k003.kiwi6.com/hotlink/9f13ktbumx/bensound-dreams.mp3'
];

function clearCanvas(){
  ctx.clearRect(0, 0, 720, 720);
}

function makeGameArea(){
  clearCanvas();
  ctx.strokeStyle = "black";
  ctx.strokeRect(20, 20, 680, 680);
  
  for(var i=0; i<5; i++){
  	for(var j=0; j<5; j++){
    	ctx.strokeRect(40+i*132, 40+j*132, 112, 112);
    }
  }
}

function playGameMusic(){
  console.log(level);
  var audioElement = new Audio(levelMusicLink[level]);
  var audio = audioElement.play();
  audioElement.onended = function(){
  	setTimeout(levelEnd, 3000);
  };
  setInterval(calculateTimer, 50);
}

var x = 2;
var y = 2;
var color = 0;

var perfect = 0;
var good = 0;
var miss = 0;

var score = 0;

function levelEnd(){
	var totalNotes = perfect+good+miss;
	score = (perfect / totalNotes) * 1000000 + (good / totalNotes) * 500000;
  clearInterval(calculateTimer);
  clearInterval(showCursor);
  clearInterval(displayNotes);
  
  console.log(score);
  
  var nowScore = getParameters('progress'+level);
  var maxScore = nowScore < score ? score : nowScore;
  location.href = updateURLParameter(location.href, 'progress'+level, maxScore);
}

var noteTimer = new Array(5);
for(var i=0; i<5; i++){
  noteTimer[i] = new Array(5);
  for(var j=0; j<5; j++){
    noteTimer[i][j] = -400;
  }
}

var noteColor = new Array(5);
for(var i=0; i<5; i++){
  noteColor[i] = new Array(5);
}

function showCursor(){
	for(var i=0; i<5; i++){
  	for(var j=0; j<5; j++){
      ctx.fillStyle = color==0?"red":"blue";
      if(noteTimer[i][j] > 0){
        ctx.fillRect(40+i*132, 40+j*132, (400-noteTimer[i][j]) * 112 / 400, 112);
      }
      else{
        ctx.clearRect(40+i*132, 40+j*132, 112, 112);
      }
      if(i==x && j==y){
        ctx.strokeStyle = color==0?"red":"blue";
      }
      else{
        ctx.strokeStyle = "black";
      }
    	ctx.strokeRect(40+i*132, 40+j*132, 112, 112);
    }
  }
}

function perfect_(x, y){
  perfect++;
  noteTimer[x][y] = -400;
}

function good_(x, y){
  good++;
  noteTimer[x][y] = -400;
}

function miss_(x, y){
  miss++;
}

function onKeyDown(e){
  var ek = e.keyCode;
  console.log(ek);
  if(37 <= ek && ek <= 40){
  	if(ek == 37){
      if(x!=0) x--;
    }
    else if(ek==38){
      if(y!=0) y--;
    }
    else if(ek==39){
      if(x!=4) x++;
    }
    else if(ek==40){
      if(y!=4) y++;
    }
    console.log(x + "and" + y);
    var point = Math.abs(noteTimer[x][y]);
    if(point <= 20){
      perfect_(x, y);
    }
    else if(point <= 40 || noteTimer[x][y] > 20){
      good_(x, y);
    }
  }
  else if(ek==32){
  	color = !color;
  }
}

window.addEventListener("keydown", onKeyDown, false);

var levelData = [
  "0|2|1|0/21|2|2|0/52|2|3|0/72|2|2|0/101|1|2|0/121|2|2|0/153|3|2|0/172|2|2|0/203|2|1|0/223|2|0|0/256|2|1|0/274|2|2|0/305|2|3|0/323|2|4|0/355|2|3|0/375|2|2|0/406|2|1|0/419|3|1|0/431|3|2|0/443|2|2|0/456|1|2|0/469|1|3|0/481|2|3|0/493|2|2|0/506|2|1|0/519|1|1|0/528|1|2|0/544|2|2|0/558|3|2|0/571|3|3|0/583|2|3|0/595|2|2|0/608|2|1|0/621|1|1|0/633|1|2|0/646|2|2|0/659|3|2|0/672|3|1|0/683|2|1|0/697|2|2|0/709|2|3|0/723|3|3|0/735|3|2|0/749|2|2|0/760|1|2|0/772|1|3|0/784|2|3|0/798|2|2|0/811|2|1|0/823|2|0|0/836|2|1|0/850|2|2|0/862|3|2|0/874|4|2|0/888|3|2|0/900|2|2|0/912|1|2|0/924|0|2|0/936|1|2|0/950|2|2|0/964|2|3|0/976|2|4|0/988|2|3|0/1001|2|2|0/1015|2|1|0/1033|2|2|0/1063|2|3|0/1082|2|2|0/1113|1|2|0/1133|2|2|0/1166|3|2|0/1184|2|2|0/1216|2|1|0/1227|2|0|0/1239|1|0|0/1252|0|0|0/1265|0|1|0/1277|0|2|0/1290|1|2|0/1302|2|2|0/1315|3|2|0/1328|4|2|0/1341|4|3|0/1353|4|4|0/1366|3|4|0/1379|2|4|0/1392|2|3|0/1404|2|2|0/1417|3|2|0/1431|4|2|0/1442|3|2|0/1454|2|2|0/1468|1|2|0/1480|0|2|0/1494|1|2|0/1506|2|2|0/1519|3|2|0/1533|4|2|0/1544|4|1|0/1557|4|0|0/1568|3|0|0/1581|2|0|0/1594|2|1|0/1607|2|2|0/1620|2|3|0/1633|2|4|0/1645|2|3|0/1658|2|2|0/1670|2|1|0/1683|2|0|0/1695|2|1|0/1708|2|2|0/1721|2|3|0/1733|2|4|0/1746|1|4|0/1759|0|4|0/1771|0|3|0/1783|0|2|0/1796|1|2|0/1809|2|2|0/1822|2|1|0/1837|2|0|0/1847|2|1|0/1859|2|2|0/1871|1|2|0/1885|0|2|0/1898|1|2|0/1910|2|2|0/1922|2|3|0/1935|2|4|0/1948|2|3|0/1959|2|2|0/1972|3|2|0/1984|4|2|0/1998|3|2|0/2010|2|2|0/2024|2|1|0/2042|2|0|0/2073|1|0|0/2091|0|0|0/2121|0|1|0/2142|0|2|0/2173|1|2|0/2193|2|2|0/2225|3|2|0/2244|4|2|0/2277|4|3|0/2295|4|4|0/2326|3|4|0/2345|2|4|0/2380|2|3|0/2396|2|2|0/2427|1|2|0/2445|0|2|0/2477|1|2|0/2496|2|2|0/2528|3|2|0/2547|4|2|0/2578|3|2|0/2597|2|2|0/2629|2|3|0/2655|2|2|0/2680|2|1|0/2705|2|2|0/2730|1|2|0/2754|2|2|0/2781|3|2|0/2804|2|2|0/2832|2|3|0/2841|3|3|0/2850|3|2|0/2856|3|1|0/2863|2|1|0/2866|1|1|0/2880|1|2|0/2891|1|3|0/2900|2|3|0/2907|3|3|0/2912|4|3|0/2932|3|3|0/2941|2|3|0/2951|1|3|0/2957|1|2|0/2961|1|1|0/2963|1|0|0/2982|2|0|0/2991|2|1|0/3001|2|2|0/3034|1|2|0/3044|0|2|0/3052|1|2|0/3059|2|2|0/3063|3|2|0/3069|3|3|0/3084|2|3|0/3095|2|2|0/3104|2|1|0/3109|1|1|0/3112|0|1|0/3115|0|2|0/3118|0|3|0/3134|1|3|0/3144|2|3|0/3152|2|2|0/3155|2|1|0/3158|2|0|0/3160|3|0|0/3185|3|1|0/3195|3|2|0/3202|2|2|0/3205|1|2|0/3208|1|3|0/3211|2|3|0/3236|2|2|0/3254|2|1|0/3285|2|2|0/3304|2|3|0/3330|2|2|0/3336|1|2|0/3356|2|2|0/3387|2|1|0/3406|2|2|0/3436|3|2|0/3457|2|2|0/3487|1|2|0/3507|2|2|0/3538|2|1|0/3557|2|2|0/3589|2|3|0/3608|2|2|0/3639|1|2|0/3660|2|2|0/3691|3|2|0/3712|2|2|0/3741|2|1|0/3759|2|2|0/3791|2|3|0/3810|2|2|0/3842|1|2|0/3860|2|2|0/3892|3|2|0/3912|2|2|0/3943|2|1|0/3960|2|2|0/3991|2|3|0/4011|2|2|0/4045|1|2|0/4063|2|2|0/4093|3|2|0/4113|2|2|0/"
];

var startIndex = 0;
var endIndex = 0;
var data;
var dataLength;

function calculateNotes(t, x, y, c){
  noteTimer[x][y] = 400;
  noteColor[x][y] = c;
}

function displayNotes(){
	for(var i=0; i<5; i++){
    for(var j=0; j<5; j++){
      if(noteTimer[i][j] != -400) noteTimer[i][j] -= 20;
      if(noteTimer[i][j] < -40 && noteTimer[i][j] != -400){
        noteTimer[i][j] = -400;
        miss_(i, j);
      }
    }
  }
}

function setInit(){
  data = levelData[level];
  dataLength = String(data).length;
}

function playNotes(){
	setInterval(displayNotes, 20);
  
  console.log(dataLength + ', ' + data);
  
  for(; endIndex < dataLength;){
    var tt, tx, ty, tc;
    while(data[endIndex] != '|') endIndex++;
    tt = data.substring(startIndex, endIndex);
    startIndex = ++endIndex;
    while(data[endIndex] != '|') endIndex++;
    tx = data.substring(startIndex, endIndex);
    startIndex = ++endIndex;
    while(data[endIndex] != '|') endIndex++;
    ty = data.substring(startIndex, endIndex);
    startIndex = ++endIndex;
    while(data[endIndex] != '/') endIndex++;
    tc = data.substring(startIndex, endIndex);
    startIndex = ++endIndex;
    
    console.log(tt + ', ' + tx + ', ' + ty + ', ' + tc);
    
    setTimeout(calculateNotes, tt*50-400+3100, tt, tx, ty, tc);
  }
}

function playGame(){
  makeGameArea();
  setInterval(showCursor, 30);
  setTimeout(playGameMusic, 3000);
  setInit();
  playNotes();
}

playGame();



 // 여기까지 코드 입력 //

		
  }

}
$( plugin_UncyBeat );
/* UncyBeat 끝 */


/** 플러그인 riemann_testplugin***************************
* test
* 버전 => 0.6.13
* 작성자 : [[사용자:Riemann|Riemann]] 
* JSON => riemann_testplugin = {"name":"riemann_testplugin","descript":"test","version":"0.6.13","local":true,"creat":"Riemann","state":"사용자:Riemann/testplugin","executable":true}; 
*/ 
function plugin_riemann_testplugin(){
  if($("[data-name='riemann_testplugin']").length >= 1){
		 $("#wa").append('<canvas id="can" width="500" height="500">Alt text</canvas>');
var c = document.getElementById("can");
var ctx = c.getContext("2d");

var Earth = {};
Earth.x = 250;
Earth.y = 250;
Earth.draw = function() {
    ctx.beginPath();
    ctx.fillStyle = 'gray';
    ctx.arc(this.x, this.y, 50, 0, 2 * Math.PI);
    ctx.fill();
}

var You = {};
You.x = 250;
You.y = 250;
var mouseX;
var mouseY;

document.addEventListener("mousemove", mouseMoveHandler, false);
function mouseMoveHandler(e) {
    mouseX = e.clientX - $("#can").offset().left;
    mouseY = e.clientY - $("#can").offset().top;
}

You.draw = function() {
    ctx.beginPath();
    ctx.fillStyle = 'black';
    ctx.arc(this.x, this.y, 10, 0, 2 * Math.PI);
    ctx.fill();
}

You.update = function() {
    event = new MouseEvent("mouse");
    norm = Math.sqrt( Math.pow(mouseX - 250, 2) + Math.pow(mouseY - 250, 2));
    this.x = 250 + 50 * (mouseX - 250) / norm;
    this.y = 250 + 50 * (mouseY - 250) / norm;
}

function Asteroid(x, y, dx, dy) {
    this.x = x;
    this.y = y;
    this.dx = dx;
    this.dy = dy;
}

Asteroid.prototype.draw = function() {
    ctx.beginPath();
    ctx.fillStyle = 'gray';
    ctx.arc(this.x, this.y, 20, 0, 2 * Math.PI);
    ctx.fill();
}

Asteroid.prototype.update = function() {
    this.x += this.dx;
    this.y += this.dy;
}

var asterList = []

function loop() {
    ctx.fillStyle = 'rgb(240, 240, 240)';
    ctx.fillRect(0, 0, 500, 500);
    
    while (asterList.length < 5) {
        var aster = new Asteroid(Math.floor(460 * Math.random()) + 20, Math.floor(460 * Math.random()) + 20, Math.cos(2 * Math.PI * Math.random()), Math.sin(2 * Math.PI * Math.random()) );
        asterList.push(aster);
    }
    
    for (var i = 0; i < asterList.length; i++) {
        asterList[i].draw();
        asterList[i].update();
        if (asterList[i].x > 500 || asterList[i].x < 0 || asterList[i].y > 500 || asterList[i].y < 0) {
            asterList.splice(i, 1);
        }
    }
    
    Earth.draw();
    You.draw();
    You.update();
    
    window.requestAnimationFrame(loop);
}
loop();

		
  }

}
$( plugin_riemann_testplugin );
/* riemann_testplugin 끝 */


/** 플러그인 testOfSomething***************************
* 플러그인의 용도
* 버전 => 0.01
* 작성자 : [[사용자:bd3076|bd3076]] 
* JSON => testOfSomething = {"name":"testOfSomething","descript":"플러그인의 용도","version":"0.01","local":false,"creat":"bd3076","state":"사용자:Bd3076/그냥/plugin","executable":true}; 
*/ 
function plugin_testOfSomething(){
		  // 이부분에 코드 입력 //

var title = document.getElementById('firstHeading').innerHTML;
var thing = document.getElementById("mw-content-text");
if(title === "사용자:Bd3076/자스실험실"){
  thing.innerHTML = "당신은 미궁 앞에 서 있다.";
}
else if(title === "사용자토론:Bd3076"){
  thing.innerHTML = "옛다 관심";
}

 // 여기까지 코드 입력 //

		
}
$( plugin_testOfSomething );
/* testOfSomething 끝 */

/** 플러그인 msgame***************************
* 스톱워치 게임
* 버전 => 0.950
* 작성자 : [[사용자:Riemann|Riemann]] 
* JSON => msgame = {"name":"msgame","descript":"스톱워치 게임","version":"0.950","local":true,"creat":"Riemann","state":"사용자:Riemann/msgame","executable":true}; 
*/ 
function plugin_msgame(){
  if($("[data-name='msgame']").length >= 1){
		  // 이부분에 코드 입력 //
sc = 0
cb = 0

bl = false;
$(document.body).on("keydown", function(ev) {
  if(ev.which == 13) {
    if (bl == false) {
  	  bl = true
      startF();
    } else {
      bl = false
      stopF();
    }
  }
});

$("#msgame-start").on("click", function() {
  bl = true
	startF();
});

$("#msgame-stop").on("click", function() {
  bl = false
	stopF();
});

function startF() {
  obj = Math.floor(Math.random() * 10) + 5;
  $("#msgame-start").css("display", "none");
  $("#msgame-stop").css("display", "block");
  it = new Date();
  si = setInterval(clockUpdate, 20)
  $("#msgame-console").text(obj + " 초를 세세요.");
}

function stopF() {
  $("#msgame-clockText").css("display", "inline");
  $("#msgame-stop").css("display", "none");
  $("#msgame-start").css("display", "block");
  clearInterval(si);
  ie = new Date();
  ifin = ie - it;
  $("#msgame-clockText").text(toMilliSec(ifin));
  finished(obj, ifin);
}

function clockUpdate() {
  ic = new Date();
  id = ic - it;
  ii = toMilliSec(id);
  $("#msgame-clockText").text(ii);
  if (obj * 1000 - id < 500 * cb && cb > 4 ) {
    $("#msgame-clockText").fadeOut();
  }
}

function toMilliSec(d) {
  return (Math.floor(d / 1000) + "\"" + ("" + d % 1000).padStart(3, "0")).padStart(6, "0");
}

function finished(a, b) {
  ath = a * 1000
  if (ath == b) {
    cbm = Math.floor(Math.pow(800, (1 + cb / 10)))
    $("#msgame-console").text("정확하시군요. " + cbm + " 점 드리겠습니다.");
    sc += cbm
    cb += 1
  } else if (Math.abs(ath - b) < 100) {
    cbm = Math.floor(Math.pow((500 / Math.abs(ath - b)), (1 + cb / 10)))
    $("#msgame-console").text("정확하시군요. " + cbm + " 점 드리겠습니다.");
    sc += cbm
    cb += 1
  } else {
    $("#msgame-console").text("안타깝습니다. 조금 더 노력해 보세요!");
    cb = 0
  }
  $("#msgame-score").text(sc);
  $("#msgame-combo").text(cb);
}
 // 여기까지 코드 입력 //

		
  }

}
$( plugin_msgame );
/* msgame 끝 */



/** 플러그인 p21***************************
* 블랙잭
* 버전 => 0.840a2
* 작성자 : [[사용자:Riemann|Riemann]] 
* JSON => p21 = {"name":"p21","descript":"블랙잭","version":"0.840a2","local":true,"creat":"Riemann","state":"사용자:Riemann/p21","executable":true}; 
*/ 
function plugin_p21(){
  if($("[data-name='p21']").length >= 1){
		 var title = mw.config.get('wgPageName');
if (title.slice( 1, 2 ) == "라") {
    var blind = true;
    var defa = 20;
} else {
    var blind = false;
    var defa = 10;
}
var mult = defa;
$("#multiplier").text(mult);

var coins = 100;
var wincount = 0;
var losecount = 0;
//$("#console").text("스코어: " + coins + "점");
$("#console").text("스코어: " + wincount + "승 " + losecount + "패");
$("#console").append("블랙잭에 오신 것을 환영합니다.");

const pcLst = [
0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAD,0xAE,
0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBD,0xBE,
0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCD,0xCE,
0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDD,0xDE];
const pointData = {a1:1,a2:2,a3:3,a4:4,a5:5,a6:6,a7:7,a8:8,a9:9,aa:10,ab:10,ad:10,ae:10,b1:1,b2:2,b3:3,b4:4,b5:5,b6:6,b7:7,b8:8,b9:9,ba:10,bb:10,bd:10,be:10,c1:1,c2:2,c3:3,c4:4,c5:5,c6:6,c7:7,c8:8,c9:9,ca:10,cb:10,cd:10,ce:10,d1:1,d2:2,d3:3,d4:4,d5:5,d6:6,d7:7,d8:8,d9:9,da:10,db:10,dd:10,de:10};
var pcSet = [];
function hexToChar(x) {
    return String.fromCharCode(0xD83C) +String.fromCharCode(x + 0xDC00);
}
function hexToStr(x) {
    return x.toString(16);
}
var dealerD, guestD;
$("#deal").click(function(){
    //$("#console").text("스코어: " + coins + "점");
    $("#console").text("스코어: " + wincount + "승 " + losecount + "패");
    $("#console").append("새 판을 엽니다.");
    $("#deal").css("display", "none");
    $("#dealerDeck").text("");
    $("#guestDeck").text("");
    pcSet = Object.create(pcLst);
    deal();
    return 0;
});
$("#hit").click(function(){
    hit();
    return 0;
});
$("#stand").click(function(){
    stand();
    return 0;
});
$("#surrender").click(function(){
    surrender();
    return 0;
});
$("#plus").click(function(){
    inc();
    return 0;
});
$("#minus").click(function(){
    dec();
    return 0;
});
$("#reset").click(function(){
    reset();
    return 0;
});
function reset() {
    mult = defa;
    $("#multiplier").text(mult);
}

/*
function inc() {
    if (mult < 100) {
        mult += 2;
    } else {
        alert("최대 100 코인까지만 걸 수 있습니다.");
    }
    $("#multiplier").text(mult);
}

function dec() {
    if (mult > 2) {
        mult -= 2;
    } else {
        alert("설마 빚을 판돈으로 거시려고요?");
    }
    $("#multiplier").text(mult);
}
*/

function deal() {
    dealerD = [];
    guestD = [];
    dealerD.push(cardPop());
    guestD.push(cardPop());
    dealerD.push(cardPop());
    guestD.push(cardPop());
    if (blind == true) {
        $("#dealerDeck").text("\u{1F0A0}\u{1F0A0}");
    } else {
        $("#dealerDeck").text(hexToChar(dealerD[0]) + "\u{1F0A0}");
    }
    $("#dealerS").text("?");
    if (blind == true) {
        $("#guestDeck").text("\u{1F0A0}\u{1F0A0}");
    } else {
        $("#guestDeck").text(hexToChar(guestD[0]) + hexToChar(guestD[1]));
    }
    var guestScore = [];
    var score = pointData[hexToStr(guestD[0])] + pointData[hexToStr(guestD[1])];
    $("#guestS").text(score);
    if ((pointData[hexToStr(guestD[0])] == 1 && pointData[hexToStr(guestD[1])] == 10) || (pointData[hexToStr(guestD[0])] == 10 && pointData[hexToStr(guestD[1])] == 1)) {
        $("#guestS").text(21);
        jack();
    } else {
        $("#hit").css("display", "inline-flex");
        $("#stand").css("display", "inline-flex");
        $("#surrender").css("display", "inline-flex");
    }
};
function hit() {
    $("#hit").css("display", "none");
    $("#stand").css("display", "none");
    $("#surrender").css("display", "none");
    guestD.push(cardPop());
    var guestDeq = "";
    for (i = 0; i < guestD.length; i++) {
        guestDeq += hexToChar(guestD[i]);
    }
    if (blind == true) {
        $("#guestDeck").text("\u{1F0A0}".repeat(guestDeq.length / 2));
    } else {
        $("#guestDeck").text(guestDeq);
    }
    var guestScore = [];
    var score = 0;
    for (i = 0; i < guestD.length; i++) {
        guestScore.push(pointData[hexToStr(guestD[i])]);
        score += guestScore[i];
    }
    $("#guestS").text(score);
    if (score == 21 || (score == 11 && guestScore.includes(1))) {
        $("#console").append("21점이므로 자동으로 스탠드를 외쳤습니다.")
        stand(dealerD,guestD);
    } else if (score > 21) {
        bust();
    } else  {
        $("#hit").css("display", "inline-flex");
        $("#stand").css("display", "inline-flex");
    }
    return 0;
}
function stand() {
    $("#hit").css("display", "none");
    $("#stand").css("display", "none");
    $("#surrender").css("display", "none");
    var dScore = 0;
    var dealerScore = []
    for (i = 0; i < dealerD.length; i++) {
        dealerScore.push(pointData[hexToStr(dealerD[i])]);
        dScore += dealerScore[i];
    }
    while (dScore < 17) {
        dealerD.push(cardPop());
        $("#console").append("딜러가 카드를 뽑았습니다.")
        dealerScore = [];
        dScore = 0;
        for (i = 0; i < dealerD.length; i++) {
            dealerScore.push(pointData[hexToStr(dealerD[i])]);
            dScore += dealerScore[i];
            dealerDeq += hexToChar(dealerD[i]);
        }
    }
    var dealerDeq = "";
    for (i = 0; i < dealerD.length; i++) {
            dealerDeq += hexToChar(dealerD[i]);
        }
    $("#dealerS").text(dScore);
    $("#dealerDeck").text(dealerDeq);
    guestScore = [];
    score = 0;
    for (i = 0; i < guestD.length; i++) {
        guestScore.push(pointData[hexToStr(guestD[i])]);
        score += guestScore[i];
    }
    $("#guestS").text(score);
    if (score > 21) {
        bust()
    } else if (dScore > 21) {
        $("#console").append("딜러의 버스트.")
        win()
    } else {
        $("#console").append("딜러의 스탠드.")
        compare(dealerD,guestD);
    }
    return 0;
}
function compare() {
    var dealerScore = [];
    var dScore = 0;
    for (i = 0; i < dealerD.length; i++) {
        dealerScore.push(pointData[hexToStr(dealerD[i])]);
        dScore += dealerScore[i];
    }
    var guestScore = [];
    var score = 0;
    for (i = 0; i < guestD.length; i++) {
        guestScore.push(pointData[hexToStr(guestD[i])]);
        score += guestScore[i];
    }
    if (dScore < 12 && dealerScore.includes(1)) {
        dScore += 10
    }
    if (score < 12 && guestScore.includes(1)) {
        score += 10
    }
    $("#dealerS").text(dScore);
    $("#guestS").text(score);
    if (dScore > score) {
        lose()
    } else if (dScore == score) {
        push()
    } else {
        win()
    }
    return 0;
}
function win() {
    $("#console").append("축하합니다! 이겼습니다.")
    //$("#console").append("" + mult + "점을 얻었습니다.")
    //coins += mult;
    wincount += 1;
    $("#deal").css("display", "inline-flex");
    return 0;
}
function lose() {
    $("#console").append("졌습니다...")
    //$("#console").append("" + mult + "점을 잃었습니다.")
    //coins -= mult;
    losecount += 1;
    $("#deal").css("display", "inline-flex");
    publicAd();
    return 0;
}
function push() {
    $("#console").append("비겼습니다.")
    $("#deal").css("display", "inline-flex");
    return 0;
}
function surrender() {
    $("#hit").css("display", "none");
    $("#stand").css("display", "none");
    $("#surrender").css("display", "none");
    $("#console").append("이번 판을 포기하셨습니다 (패배로 처리됩니다).")
    //$("#console").append("" + (0.5 * mult) + "점을 잃었습니다.")
    //coins -= 0.5 * mult;
    losecount += 1;
    $("#deal").css("display", "inline-flex");
    publicAd();
    return 0;
}
function bust() {
    $("#console").append("버스트! 유감입니다. 졌습니다...")
    //$("#console").append("" + mult + "점을 잃었습니다.")
    //coins -= mult;
    losecount += 1;
    $("#hit").css("display", "none");
    $("#stand").css("display", "none");
    $("#deal").css("display", "inline-flex");
    publicAd();
    return 0;
}
function jack() {
    $("#console").append("블랙잭 달성! 축하합니다. 이겼습니다!")
    //$("#console").append("" + (1.5 * mult) + "점을 획득했습니다.")
    //coins += 1.5 * mult;
    wincount += 1;
    $("#deal").css("display", "inline-flex");
    return 0;
}
function publicAd() {
    if (coins < 0) {
        $("#notice").text("땀 흘려 번 돈이 아름답습니다.");
    }
    return 0;
}
function cardPop() {
    var j, ret;
    j = Math.floor(Math.random() * pcSet.length);
    ret = pcSet[j];
    pcSet.splice(j,1);
    return ret;
}

		
  }

}
$( plugin_p21 );
/* p21 끝 */