사용자:Bd3076/common.js: 두 판 사이의 차이
백괴게임>Bd3076 (플러그인 UncyBeat설치) |
백괴게임>Bd3076 (플러그인 UncyBeat설치) |
||
2,696번째 줄: | 2,696번째 줄: | ||
$( plugin_Minseo0388_plugin ); | $( plugin_Minseo0388_plugin ); | ||
/* Minseo0388_plugin 끝 */ | /* Minseo0388_plugin 끝 */ | ||
2,723번째 줄: | 2,726번째 줄: | ||
/** 플러그인 UncyBeat*************************** | /** 플러그인 UncyBeat*************************** | ||
* | * 버그 수정 | ||
* 버전 => 1. | * 버전 => 1.02 | ||
* 작성자 : [[사용자:Bd3076|Bd3076]] | * 작성자 : [[사용자:Bd3076|Bd3076]] | ||
* JSON => UncyBeat = {"name":"UncyBeat","descript":" | * JSON => UncyBeat = {"name":"UncyBeat","descript":"버그 수정","version":"1.02","local":true,"creat":"Bd3076","state":"UncyBeat/plugin","executable":true}; | ||
*/ | */ | ||
function plugin_UncyBeat(){ | function plugin_UncyBeat(){ | ||
2,862번째 줄: | 2,865번째 줄: | ||
clearInterval(showCursor); | clearInterval(showCursor); | ||
clearInterval(displayNotes); | clearInterval(displayNotes); | ||
console.log(score); | |||
var nowScore = getParameters('progress'+level); | var nowScore = getParameters('progress'+level); | ||
location.href = updateURLParameter(location.href, 'progress'+level, | location.href = updateURLParameter(location.href, 'progress'+level, score>nowScore?totalNotes:score); | ||
} | } | ||
2018년 7월 27일 (금) 09:26 판
/** 플러그인 autosave***************************
* 자동저장 시스템을 위한 플러그인
* 버전 => 2.0.2
* 작성자 : [[사용자:Manymaster|Manymaster]]
* JSON => autosave = {"name":"autosave","descript":"자동저장 시스템을 위한 플러그인","version":"2.0.2","local":false,"creat":"Manymaster","state":"틀:자동저장/플러그인","executable":true};
*/
function plugin_autosave(){
/* 작동 가능한 네임스페이스 */
var safeNameSpace = [""];
/* autosave 편집모드가 아닐 경우 플러그인 종료 */
var searchParams = geturlSearch(location);
var isEditMode = searchParams.action === "edit";
var isAutosaveMode = searchParams.autosave === "1";
if (!(isEditMode && isAutosaveMode)) return "";
/* 자동 저장하기에 안전한 네임스페이스가 아닌 경우 플러그인 종료 */
var thisNamespaceNumber = mw.config.get("wgNamespaceNumber");
var nameSpaceIds = mw.config.get("wgNamespaceIds");
var isSafeNameSpace = safeNameSpace
.map(function (namespace) { return nameSpaceIds[namespace]; })
.some(function (nsNumber) { return nsNumber == thisNamespaceNumber; });
if (!(isSafeNameSpace)) return "";
/* 자동 인증된 사용자가 아닌 경우 플러그인 종료 */
var userGroups = mw.config.get('wgUserGroups');
var autocheck = 0;
if (userGroups) {
for (var i = 0; i < userGroups.length; i++) {
if (userGroups[i] === 'autoconfirmed') {
autocheck++;
}
}
}
if (autocheck != 1) return "";
/* 지정된 단락에서 불러오기 */
var savetempDom = $(".game-autosave");
if ($(".game-autosave").length === 0)
throw new Error("autosave => game-autosave를 클래스명으로 가진 돔을 찾을 수 없습니다.");
var savetemp = $(".game-autosave").html();
/* 문제가 되는 문자열 치환 */
savetemp = savetemp.replace(/(<([^>]+)>)/ig, "");
savetemp = savetemp.replace(/\n+/gi, "\n");
savetemp = savetemp.replace("\n", "");
savetemp = savetemp.replace(/</gi, "<");
savetemp = savetemp.replace(/>/gi, ">");
/* 기록, 저장하고 빠져나오기 */
$("#wpTextbox1").val(savetemp);
$("#wpSave").click();
return;
/** 이 플러그인 제작을 도와주신 분들
* Ver 2 제작자: [[사용자:BANIP|BANIP]]
* 원 코드 작성자: [[사용자:*devunt]]
*/
}
$( plugin_autosave );
/* autosave 끝 */
/** 플러그인 uncyrhythm***************************
* 플러그인 전체적 테스트. 리듬게임
* 버전 => 1.7.3.4
* 작성자 : [[사용자:BANIP|BANIP]]
* JSON => uncyrhythm = {"name":"uncyrhythm","descript":"플러그인 전체적 테스트. 리듬게임","version":"1.7.3.4","local":true,"creat":"BANIP","state":"백괴리겜/플레이/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 rankingSystem = plugin_RankingSystem()("백괴리겜/랭킹", function(prev, next) {
return Number(next.score) - Number(prev.score)
});
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);
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);
}
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"),
}
rankingSystem.update(
thisScore,
function(rankingScore, thisScore) {
return rankingScore.score < thisScore.score
}, {
score: "점수",
combo: "콤보",
great: "따봉!",
good: "굿잡!",
miss: "이런.."
});
})
});
}
}
$( plugin_uncyrhythm );
/* uncyrhythm 끝 */
/** 플러그인 RankingSystem***************************
* 랭킹시스템 라이브러리
* 버전 => 1.0.7
* 작성자 : [[사용자:BANIP|BANIP]]
* JSON => RankingSystem = {"name":"RankingSystem","descript":"랭킹시스템 라이브러리","version":"1.0.7","local":true,"creat":"BANIP","state":"사용자:BANIP/플러그인/랭킹시스템","executable":false};
*/
function plugin_RankingSystem(){
if($("[data-name='RankingSystem']").length >= 1){
// 이부부분에 코드 입력 //
/**
* @param
{string} documentTitle 랭킹정보가 있는 문서의 제목.
{function} sortCallback 랭킹을 정렬할때 기준으로 사용하는 함수
{any} prev 랭킹 정렬 기준으로 사용할 왼쪽의 값
{any} next 랭킹 정렬 기준으로 사용할 오른쪽의 값
{object} api MediaWikiapi의 인스턴스, 없어도 됨.
@return {Object}
{function} get 랭킹정보를 object형태로 획득
{function} update 랭킹정보 업데이트
{object} updateInfo 업데이트할 사용자 정보
{function} updateCriteria 사용자정보의 업데이트 기준
@param {any} rankingScore 랭킹에서 사용중인 스코어
{any} thisScore 사용자 스코어
@return{bool} true가 반환되면 업데이트
{object} alternateKeys 랭킹에서 보여지는 대체 키
*/
return function(documentTitle, sortCallback, api) {
function forEach(object, callback) {
for (var key in object) {
var variable = object[key];
callback(variable, key);
}
}
function getRankingJSON(rankingDoc) {
console.log(rankingDoc)
if (!rankingDoc) return {};
var regexp = /\<includeonly\>(.*)\<\/includeonly\>/;
var stringRanking = regexp.exec(rankingDoc)[1];
return JSON.parse(stringRanking);
}
function updateDoc(rankingJSON, api, alternateKeys) {
//alternateKeys가 반영된 개개인의 랭킹정보 획득
function getOutputJSON(json) {
var result = {};
forEach(json, function(value, key) {
key = alternateKeys[key] || key;
result[key] = value;
})
return result;
}
//보여지는 형태의 랭킹정보 획득
function getOutputString(json) {
var name = json.name;
var result = "* '''" + name + "''' : ";
forEach(json, function(value, key) {
if (key === "name") return;
key = alternateKeys[key] || key;
result += key + ": " + value + ", ";
})
result += "\n"
return result
}
var stringRanking = JSON.stringify(rankingJSON);
var result = "<includ" + "eonly>" + stringRanking + "</inclu" + "deonly>\n";
result += "<onlyin" + "clude>\n";
var rankingList = Object.entries(rankingJSON).sort(function(prev,next){
return sortCallback(prev[1],next[1])
}).map(function(value){
return value[0]
});
rankingList.forEach(function(key) {
var json = rankingJSON[key];
var outputJSON = getOutputJSON(json);
result += getOutputString(outputJSON)
});
result += "</only" + "include>";
var reply = documentTitle.replace(new RegExp("\/.*"),"") + " 점수 갱신";
api.changeDocument(documentTitle, reply, result, true);
return result;
}
function updateUserScore(rankingJSON, thisScore, updateCriteria) {
updateCriteria = updateCriteria || function(rankingScore, thisScore) {
return rankingScore.score < thisScore.score;
}
var userName = thisScore.name;
var rankingScore = rankingJSON[userName];
if (!rankingScore || updateCriteria(rankingScore, thisScore)) {
rankingJSON[userName] = thisScore;
}
}
api = api || MediaWikiAPI();
var userName = mw.config.get("wgUserName");
var rankingDoc = api.getDocument(documentTitle);
var rankingJSON = getRankingJSON(rankingDoc);
var actions = {
get: function() {
return rankingJSON;
},
update: function(updateInfo, updateCriteria, alternateKeys) {
rankingJSON = actions.get();
updateUserScore(rankingJSON, updateInfo, updateCriteria);
updateDoc(rankingJSON, api, alternateKeys);
}
}
return actions;
}
}
}
/* RankingSystem 끝 */
/** 플러그인 autowriter***************************
* 문서 자동작성 스크립트 설치
* 버전 => 1.1.7
* 작성자 : [[사용자:BANIP|BANIP]]
* JSON => autowriter = {"name":"autowriter","descript":"문서 자동작성 스크립트 설치","version":"1.1.7","local":true,"creat":"BANIP","state":"사용자:BANIP/자동문서작성/플러그인","executable":true};
*/
function plugin_autowriter(){
if($("[data-name='autowriter']").length >= 1){
/**
* 시간에 따라 바뀌는 유동적인 값을 반환합니다. cos함수, 혹은 그의 절대값 형태를 띕니다.
* @param start 최소값
* @param height 진폭
* @param wavelength 파장
* @param isAbs 절대값인가 아닌가
*/
var getFluidValue = function (start, height, wavelength, isAbs) {
if (isAbs === void 0) { isAbs = true; }
var now = Date.now() / Math.PI / wavelength;
var amplitude = Math.cos(now) * height;
return start + (isAbs ? Math.abs(amplitude) : amplitude);
};
/**
* 뷰에 해당하는 클래스, 캔버스와 연동해 노드들의 관계를 보여줌
*/
var GUI = /** @class */ (function () {
/**
* 생성자, 컨텍스트를 가져오기 위한 용도인 getcdtx를 정의
* @param canvas 그림판으로 사용할 캔버스 객체
*/
function GUI(canvas) {
if (canvas === void 0) { canvas = document.querySelector("#nodemap"); }
var _this = this;
this.canvas = canvas;
this.nodeCache = [];
this.selectedNode = null;
this.isUnlinkNode = false;
this.dragInfo = null;
/**
* 캔버스에서 사용할 각종 수치
*/
this.elemUnit = {
wrap: {
marginX: 50,
marginY: 20
},
node: {
intervalY: 20,
width: 100,
height: 50,
getctx: null,
selectNodeColor: "yellow"
},
branch: {
width: 100,
weight: 3,
getctx: null
}
};
this.elemUnit.node.getctx = function () {
var ctx = _this.canvas.getContext("2d");
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.font = "30px sans-serif";
ctx.lineWidth = 5;
ctx.setLineDash([]);
ctx.strokeStyle = "black";
return ctx;
};
this.elemUnit.branch.getctx = function () {
var ctx = _this.canvas.getContext("2d");
ctx.strokeStyle = "black";
ctx.setLineDash([]);
return ctx;
};
}
/**
* 특정 노드의 위치 획득
* @param nodeList 위치를 획득할 노드가 속하는 집단
* @param node 위치를 획득할 노드
*/
GUI.prototype.getPosition = function (nodeList, node) {
var thisPosition;
nodeList.every(function (currentNode, i) {
thisPosition = i;
if (currentNode === node)
return false;
return true;
});
return thisPosition;
};
/**
* 수정 대상이 될 노드 지정
* @param node 수정 대상이 될 노드
*/
GUI.prototype.nodeSelect = function (node, isUnlinkNode) {
this.isUnlinkNode = isUnlinkNode;
this.selectedNode = node;
};
GUI.prototype.getNodeByAxis = function (axis) {
var _a = this.elemUnit, wrap = _a.wrap, node = _a.node, branch = _a.branch;
var nodeContainerSize = node.intervalY + node.height;
var isSafeX = axis.x >= branch.width + wrap.marginX && axis.x <= branch.width + wrap.marginX + node.width;
if (!isSafeX)
return null;
var p = parseInt((axis.y - wrap.marginY) / nodeContainerSize + "");
if (p === -1)
return null;
return this.nodeCache[p];
};
GUI.prototype.setNodeList = function (nodeList) {
this.nodeCache = nodeList;
};
GUI.prototype.setDragInfo = function (axis) {
this.dragInfo = axis;
};
/**
* 캔버스에 출력
*/
GUI.prototype.draw = function () {
var _this = this;
var nodeList = this.nodeCache;
this.initCanvasSize(nodeList.length);
nodeList.forEach(function (node, i) {
_this.drawNode(node, i);
node.getLinked().forEach(function (linkednode) {
var j = _this.getPosition(nodeList, linkednode);
_this.drawbranch(i, j);
});
});
this.drawbranch(this.selectedNode, this.dragInfo, function () {
var ctx = _this.elemUnit.branch.getctx();
ctx.setLineDash([7, 3]);
ctx.lineDashOffset = Date.now() / 100 % 100;
ctx.strokeStyle = _this.isUnlinkNode ? "red" : "blue";
return ctx;
});
};
GUI.prototype.initCanvasSize = function (nodeCount) {
var _a = this.elemUnit, wrap = _a.wrap, node = _a.node, branch = _a.branch;
var width = wrap.marginX * 2 + node.width + branch.width * 2;
var height = wrap.marginY * 2
+ (node.height * nodeCount)
+ node.intervalY * (nodeCount - 1);
this.canvas.width = width;
this.canvas.height = height;
};
GUI.prototype.getNodePosition = function (position, hori, vert) {
if (hori === void 0) { hori = "left"; }
if (vert === void 0) { vert = "top"; }
var _a = this.elemUnit, wrap = _a.wrap, node = _a.node, branch = _a.branch;
var getBonusWidth = function (hori) {
if (hori == "left")
return 0;
if (hori == "center")
return node.width / 2;
if (hori == "right")
return node.width;
};
var getBonusHeight = function (vert) {
if (vert === "top")
return 0;
if (vert === "middle")
return node.height / 2;
if (vert === "bottom")
return node.height;
};
return [
wrap.marginX + branch.width + getBonusWidth(hori),
wrap.marginY
+ (node.intervalY + node.height) * position
+ getBonusHeight(vert)
];
};
GUI.prototype.drawNode = function (node, position) {
var nodeSize = this.elemUnit.node;
var ctx = nodeSize.getctx();
var axis = this.getNodePosition(position);
if (node === this.selectedNode) {
ctx.fillStyle = nodeSize.selectNodeColor;
ctx.fillRect.apply(ctx, this.getNodePosition(position).concat([nodeSize.width, nodeSize.height]));
ctx.fillStyle = "black";
}
ctx.strokeRect.apply(ctx, this.getNodePosition(position).concat([nodeSize.width, nodeSize.height]));
ctx.fillText.apply(ctx, [node.getName()].concat(this.getNodePosition(position, "center", "middle")));
};
GUI.prototype.getBranchAxis = function (startPosition, endPosition) {
var _this = this;
var getAxisY = function (axis) {
if (axis instanceof DocNode)
axis = _this.getPosition(_this.nodeCache, axis);
if (typeof axis == "number")
return _this.getNodePosition(axis, "center", "middle")[1];
return axis.y;
};
var _a = [getAxisY(startPosition), getAxisY(endPosition)], startAxisY = _a[0], endAxisY = _a[1];
var direction = startAxisY > endAxisY ? "left" : "right";
var isDirectionLeft = direction === "left";
var axisX = this.getNodePosition(0, direction, "middle")[0];
var start = [axisX, startAxisY];
var end = [axisX, endAxisY];
return [start, end];
};
GUI.prototype.drawbranch = function (startPosition, endPosition, getctx) {
if (getctx === void 0) { getctx = this.elemUnit.branch.getctx; }
if (startPosition === null || endPosition === null)
return;
var _a = this.getBranchAxis(startPosition, endPosition), start = _a[0], end = _a[1];
var max = start[1] > end[1] ? end : start;
var isDirectionLeft = max === end;
var radius = Math.abs((end[1] - start[1]) / 2);
var arrowSize = (isDirectionLeft ? -1 : 1) * 15;
var ctx = getctx();
ctx.beginPath();
ctx.arc(max[0], max[1] + radius, radius, isDirectionLeft ? Math.PI * 1 / 2 : Math.PI * 3 / 2, isDirectionLeft ? Math.PI * 3 / 2 : Math.PI * 1 / 2);
ctx.moveTo.apply(ctx, end);
ctx.lineTo(end[0] + arrowSize, end[1] + arrowSize);
ctx.moveTo.apply(ctx, end);
ctx.lineTo(end[0] + arrowSize, end[1] - arrowSize);
ctx.stroke();
};
return GUI;
}());
var NodeInput = /** @class */ (function () {
function NodeInput(gui, nodeList) {
if (gui === void 0) { gui = new GUI(); }
this.gui = gui;
this.nodeList = nodeList;
this.selectedNode = null;
this.$$ = document.querySelector.bind(document);
this.initEventListener();
this.initCanvasEventListener();
}
NodeInput.prototype.initEventListener = function () {
var _this = this;
var $$ = this.$$;
// addNode
var addNodeListener = function (e) {
var nodenameNode = $$(".inp_addnodename");
var nodeName = nodenameNode.value;
_this.nodeList.addNode(nodeName);
};
$$(".btn_addnode").addEventListener("click", addNodeListener);
$$(".inp_addnodename").addEventListener("keydown", function (e) {
if (e.key === "Enter")
addNodeListener(e);
});
$$(".btn_removenode").addEventListener("click", function (e) {
if (_this.selectedNode === null)
throw Error("삭제할 노드를 선택 해 주세요.");
_this.gui.nodeSelect(null, false);
_this.nodeList.removeNode(_this.selectedNode.getName());
_this.selectedNode = null;
});
var createDocListener = function (e) {
var sendMessage = function (message) { return $$(".btn_create_message").innerHTML = message; };
$$(".btn_create_create").removeEventListener("click", createDocListener);
sendMessage("문서 생성 요청을 보냈습니다. 준비할때까지 좀만 기다려주세요");
var prefix = $$(".inp_create_target").value;
var template = $$(".inp_create_form").value;
if (prefix.slice(-1) !== "/")
prefix += "/";
DocFactory.create(_this.nodeList, template, prefix, sendMessage);
};
$$(".btn_create_create").addEventListener("click", createDocListener);
};
NodeInput.prototype.initCanvasEventListener = function () {
var _this = this;
var $$ = this.$$;
var getAxis = function (e) { return ({ x: e.offsetX, y: e.offsetY }); };
var setSelectedNode = function (node, isUnlinkMode) {
_this.selectedNode = node;
_this.setSelectedNode(node);
_this.gui.nodeSelect(_this.selectedNode, isUnlinkMode);
};
var isMouseDown = false;
// selectNode
$$("#nodemap").addEventListener("mousedown", function (e) {
var axis = getAxis(e);
isMouseDown = true;
setSelectedNode(_this.gui.getNodeByAxis(axis), e.button == 2);
});
// searchTarget
$$("#nodemap").addEventListener("mousemove", function (e) {
if (isMouseDown === false)
return _this.gui.setDragInfo(null);
;
var axis = getAxis(e);
_this.gui.getNodeByAxis(axis);
_this.gui.setDragInfo(axis);
});
// setTarget
$$("#nodemap").addEventListener("mouseup", function (e) {
var selectedNode = _this.selectedNode;
isMouseDown = false;
var axis = getAxis(e);
var throwNode = _this.gui.getNodeByAxis(axis);
if (selectedNode === null || throwNode === null)
return;
if (e.button == 0) {
_this.nodeList.linkNode(throwNode.getName(), selectedNode.getName());
}
else if (e.button == 2) {
_this.nodeList.unLinkNode(throwNode.getName(), selectedNode.getName());
}
});
// removePreventEvent
$$("#nodemap").addEventListener("contextmenu", function (e) {
e.preventDefault();
});
};
NodeInput.prototype.setSelectedNode = function (node) {
var $$ = this.$$;
this.selectedNode = node;
$$(".spn_nodename").innerHTML = node.getName();
};
return NodeInput;
}());
var DocFactory = /** @class */ (function () {
function DocFactory() {
}
DocFactory.setTemplateVariable = function (template, templateVariable) {
var _a = templateVariable.shift(), searchValue = _a[0], replaceValue = _a[1];
template = template.replace("{[" + searchValue + "]}", replaceValue);
if (templateVariable.length != 0)
return DocFactory.setTemplateVariable(template, templateVariable);
return template;
};
DocFactory.setLinkNoding = function (node, template, prefix) {
var nodeName = node.getName();
return template.replace(/\{\[링크\|([^]+)\]\}/g, function (matchedStr) {
matchedStr = matchedStr.replace(/\{\[링크\|\s*([^]+)\s*\]\}/g, "$1");
return node.getLinked().map(function (linkedNode) {
var templateVariable = [
["링크노드네임", linkedNode.getName()],
["링크페이지네임", prefix + linkedNode.getName()]
];
return DocFactory.setTemplateVariable(matchedStr, templateVariable.slice());
}).join("\n");
});
};
DocFactory.setOtherVariable = function (node, template, prefix) {
var nodeName = node.getName();
var templateVariable = [
["노드네임", nodeName],
["페이지네임", prefix + nodeName]
];
return DocFactory.setTemplateVariable(template, templateVariable);
};
DocFactory.create = function (docNodeList, template, prefix, messageCallback) {
var nodeList = docNodeList.getNodeList();
var docQueue = nodeList.map(function (node) {
var docString = template;
var nodeName = node.getName();
docString = DocFactory.setLinkNoding(node, docString, prefix);
docString = DocFactory.setOtherVariable(node, docString, prefix);
return { title: prefix + nodeName, content: docString };
});
DocFactory.makeDoc(messageCallback, docQueue);
};
DocFactory.makeDoc = function (messageCallback, docQueue) {
var api = MediaWikiAPI();
var makeDocIntervar = setInterval(function () {
if (docQueue.length === 0) {
messageCallback("\uBAA8\uB4E0 \uBB38\uC11C\uB97C \uC791\uC131\uD588\uC2B5\uB2C8\uB2E4. \uCD5C\uADFC \uBC14\uB01C\uC744 \uD655\uC778 \uD574 \uC8FC\uC2ED\uC1FC");
clearInterval(makeDocIntervar);
}
var nextDoc = docQueue.pop();
api.changeDocument(nextDoc.title, "템플릿 문서작성 스크립트 실행중", nextDoc.content, true);
messageCallback("\uBB38\uC11C\uB97C \uBAA8\uB450 \uC791\uC131\uD558\uAE30\uAE4C\uC9C0 \uC55E\uC73C\uB85C " + docQueue.length + "\uAC1C \uB0A8\uC558\uC2B5\uB2C8\uB2E4.");
}, 3000);
};
return DocFactory;
}());
var DocNodeList = /** @class */ (function () {
function DocNodeList(gui) {
if (gui === void 0) { gui = new GUI(); }
this.gui = gui;
this.nodeList = {};
}
DocNodeList.prototype.sendDraw = function () {
this.gui.setNodeList(Object.values(this.nodeList));
};
DocNodeList.prototype.hasNotNode = function (node) {
return typeof node === "undefined";
};
DocNodeList.prototype.linkNode = function (forNodename, toNodename) {
var _a = this, hasNotNode = _a.hasNotNode, nodeList = _a.nodeList;
var forNode = nodeList[forNodename];
var toNode = nodeList[toNodename];
if (hasNotNode(forNode) || hasNotNode(toNode))
throw Error("존재하지 않는 노드입니다.");
toNode.link(forNode);
this.sendDraw();
};
DocNodeList.prototype.unLinkNode = function (forNodename, toNodename) {
if (toNodename === void 0) { toNodename = null; }
var _a = this, hasNotNode = _a.hasNotNode, nodeList = _a.nodeList;
var forNode = nodeList[forNodename];
var toNode = nodeList[toNodename];
if (hasNotNode(forNode))
throw Error("존재하지 않는 노드입니다.");
if (hasNotNode(toNodename)) {
this.getNodeList().forEach(function (currentNode) {
currentNode.unLink(forNode);
forNode.unLink(currentNode);
});
}
else {
toNode.unLink(forNode);
}
this.sendDraw();
};
DocNodeList.prototype.addNode = function (nodename) {
var nodeList = this.nodeList;
if (nodeList[nodename] instanceof Node)
throw Error("이미 존재하는 노드입니다");
else {
nodeList[nodename] = new DocNode(nodename);
this.sendDraw();
}
};
DocNodeList.prototype.removeNode = function (nodename) {
var nodeList = this.nodeList;
var targetNode = nodeList[nodename];
if (this.hasNotNode(targetNode))
throw Error("존재하지 않는 노드입니다.");
delete nodeList[nodename];
this.getNodeList().forEach(function (node) { return node.unLink(targetNode); });
this.sendDraw();
};
DocNodeList.prototype.getNodeList = function () { return Object.values(this.nodeList); };
return DocNodeList;
}());
var DocNode = /** @class */ (function () {
function DocNode(name) {
this.name = name;
this.linkedNode = [];
}
DocNode.prototype.link = function (node) {
if (node === this)
return; //throw Error("연결하려는 노드가 자신입니다.");
if (this.linkedNode.some(function (currentNode) { return currentNode === node; }))
throw Error("이미 연결된 노드입니다.");
this.linkedNode.push(node);
};
DocNode.prototype.unLink = function (node) {
var _this = this;
this.linkedNode.forEach(function (currentNode, i) {
if (currentNode === node)
_this.linkedNode.splice(i, 1);
});
};
DocNode.prototype.getLinked = function () {
return this.linkedNode;
};
DocNode.prototype.getName = function () { return this.name; };
DocNode.prototype.setName = function (name) { return this.name = name; };
return DocNode;
}());
var initHTML = function () {
document.querySelector("#content").innerHTML += "<div class=\"wrap\"><section class=\"section_node\">\n <canvas id=\"nodemap\"></canvas>\n</section>\n<section class=\"section_node\">\n <h2>\uB178\uB4DC \uC2A4\uCF00\uCE58 \uC870\uC791\uBC95</h2>\n <ul>\n <li>\uB178\uB4DC \uC120\uD0DD: \uC120\uD0DD\uD558\uACE0 \uC2F6\uC740 \uB178\uB4DC \uD074\uB9AD</li>\n <li>\uB178\uB4DC \uB9C1\uD0B9: \uB9C1\uD06C\uD558\uACE0 \uC2F6\uC740 \uB178\uB4DC \uD074\uB9AD \uD6C4 \uB9C1\uD06C \uB300\uC0C1\uC774 \uB418\uB294 \uB178\uB4DC\uC5D0 \uAC16\uB2E4 \uB04C\uAE30</li>\n <li>\uB178\uB4DC \uB9C1\uD0B9 \uD574\uC81C: \uD574\uC81C\uD558\uACE0 \uC2F6\uC740 \uB178\uB4DC \uD074\uB9AD \uD6C4 \uB9C1\uD06C \uB300\uC0C1\uC774 \uB418\uB294 \uB178\uB4DC\uC5D0 \uAC16\uB2E4 \uB04C\uAE30</li>\n </ul>\n <h2>\uC0C8\uB85C\uC6B4 \uB178\uB4DC \uCD94\uAC00</h2>\n \uB178\uB4DC \uC774\uB984 <input class=\"inp_addnodename\"/> <button class=\"btn_addnode\" placeholder=\"\uB178\uB4DC\uC758 \uC81C\uBAA9\uC744 \uC785\uB825\uD574\uC8FC\uC138\uC694...\" > \uCD94\uAC00 </button>\n <h2>\uAE30\uC874 \uB178\uB4DC \uC218\uC815</h2>\n \uD604\uC7AC \uC120\uD0DD\uB41C \uB178\uB4DC: <span class=\"spn_nodename\"> \uC120\uD0DD\uB418\uC9C0 \uC54A\uC74C </span>\n <button class=\"btn_removenode\"> \uB178\uB4DC \uC0AD\uC81C </button> \n\n <h2>\uB178\uB4DC \uC791\uC131 \uC644\uB8CC \uBC0F \uBB38\uC11C \uC0DD\uC131</h2>\n <pre>\n \uC544\uB798 \uD14D\uC2A4\uD2B8 \uC5D0\uB9AC\uC5B4\uC5D0 \uAC01 \uBB38\uC11C\uC5D0 \uC0DD\uC131\uB420 \uD15C\uD50C\uB9BF\uC744 \uC785\uB825 \uD574 \uC8FC\uC138\uC694. \uD15C\uD50C\uB9BF\uC5D0\uC11C \uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uD2B9\uC218 \uBB38\uBC95\uC740 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4.\n {[\uB178\uB4DC\uB124\uC784]} : \uB178\uB4DC \uC774\uB984\uC744 \uCD9C\uB825\uD569\uB2C8\uB2E4.\n {[\uD398\uC774\uC9C0\uB124\uC784]} : \uD398\uC774\uC9C0 \uC774\uB984\uC744 \uCD9C\uB825\uD569\uB2C8\uB2E4.\n {[\uB9C1\uD06C| .... ]} : \uB2E4\uB978 \uB178\uB4DC\uC640 \uB9C1\uD06C\uB41C \uAC2F\uC218\uB9CC\uD07C \uD30C\uB77C\uBBF8\uD130 \uC548\uC758 \uB0B4\uC6A9\uC744 \uBC18\uBCF5\uD569\uB2C8\uB2E4.\n {[\uB9C1\uD06C\uB178\uB4DC\uB124\uC784]} : \uB9C1\uD06C\uD568\uC218 \uB0B4\uBD80\uC5D0 \uC4F0\uC774\uB294 \uBCC0\uC218\uC785\uB2C8\uB2E4. \uB9C1\uD06C\uB41C \uB178\uB4DC\uC758 \uC774\uB984\uC744 \uCD9C\uB825\uD569\uB2C8\uB2E4.\n {[\uB9C1\uD06C\uD398\uC774\uC9C0\uB124\uC784]} : \uB9C1\uD06C\uD568\uC218 \uB0B4\uBD80\uC5D0 \uC4F0\uC774\uB294 \uBCC0\uC218\uC785\uB2C8\uB2E4. \uB9C1\uD06C\uB41C \uD398\uC774\uC9C0\uC758 \uC774\uB984\uC744 \uCD9C\uB825\uD569\uB2C8\uB2E4.\n </pre>\n \uCD5C\uC0C1\uC704 \uBB38\uC11C \uC81C\uBAA9<input class=\"inp_create_target\" value=\"{{FULLPAGENAME}}/\uD14C\uC2A4\uD2B8\" size=\"40\" />\n\n <textarea class=\"inp_create_form\"> \n\uD604\uC7AC\uC5ED\uC740 {[\uB178\uB4DC\uB124\uC784]}\uC785\uB2C8\uB2E4.\n== \uC120\uD0DD\uC9C0 ==\n{[\uB9C1\uD06C|\n* [[{[\uB9C1\uD06C\uD398\uC774\uC9C0\uB124\uC784]}|{[\uB9C1\uD06C\uB178\uB4DC\uB124\uC784]}\uC5ED\uC73C\uB85C]]\n]}\n </textarea>\n <button class=\"btn_create_create\"> \uC0DD\uC131 </button>\n <div class=\"btn_create_message\"> \uBB38\uC11C\uB97C \uC0DD\uC131\uD560 \uC900\uBE44\uAC00 \uB2E4 \uB418\uC5C8\uC73C\uBA74 \uC704 \uBC84\uD2BC \uB20C\uB7EC\uC8FC\uC138\uC694 </div>\n</section></div>";
};
var test = (function () {
initHTML();
var gui = new GUI();
var nodeList = new DocNodeList(gui);
var nodeInput = new NodeInput(gui, nodeList);
nodeList.addNode("서울");
nodeList.addNode("부산");
nodeList.addNode("인천");
nodeList.addNode("대구");
nodeList.linkNode("서울", "부산");
nodeList.linkNode("서울", "인천");
nodeList.linkNode("서울", "대구");
nodeList.linkNode("대구", "부산");
setInterval(function () { return gui.draw(); }, 50);
//nodeList.removeNode("미남")
})();
}
}
$( plugin_autowriter );
/* autowriter 끝 */
/** 플러그인 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 끝 */
/** 플러그인 HistoryGo***************************
* 앞으로, 뒤로, 새로고침을 구현합니다.
* 버전 => 1.0
* 작성자 : [[사용자:Gustmd7410|Gustmd7410]]
* JSON => HistoryGo = {"name":"HistoryGo","descript":"앞으로, 뒤로, 새로고침을 구현합니다.","version":"1.0","local":false,"creat":"Gustmd7410","state":"틀:새로고침/historygo","executable":true};
*/
function plugin_HistoryGo(){
// 이부분에 코드 입력 //
$('.historygo').click(function() {
history.go($(this).data('page'));
});
// 여기까지 코드 입력 //
}
$( plugin_HistoryGo );
/* HistoryGo 끝 */
/** 플러그인 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 끝 */
/** 플러그인 p21***************************
* 블랙잭
* 버전 => 0.833
* 작성자 : [[사용자:Riemann|Riemann]]
* JSON => p21 = {"name":"p21","descript":"블랙잭","version":"0.833","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);
// Taken from w3schools
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
if (getCookie("p21_coins") == "") {
var coins = 100;
$("#console").text("소지금: " + coins + " 코인");
$("#console").append("<br/>블랙잭에 오신 것을 환영합니다.");
} else {
var coins = parseInt(getCookie("p21_coins"));
$("#console").text("소지금: " + coins + " 코인");
$("#console").append("<br/>다시 오셨군요.");
}
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").append("<br/>새 판을 엽니다.");
$("#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("<br/>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("<br/>딜러가 카드를 뽑았습니다.")
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("<br/>딜러의 버스트.")
win()
} else {
$("#console").append("<br/>딜러의 스탠드.")
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("<br/>축하합니다! 이겼습니다.")
$("#console").append("<br/>" + mult + " 코인을 얻었습니다.")
coins += mult;
setCookie("p21_coins", coins, 30);
$("#deal").css("display", "inline-flex");
return 0;
}
function lose() {
$("#console").append("<br/>졌습니다...")
$("#console").append("<br/>" + mult + " 코인을 잃었습니다.")
coins -= mult;
setCookie("p21_coins", coins, 30);
$("#deal").css("display", "inline-flex");
publicAd();
return 0;
}
function push() {
$("#console").append("<br/>비겼습니다.")
setCookie("p21_coins", coins, 30);
$("#deal").css("display", "inline-flex");
return 0;
}
function surrender() {
$("#hit").css("display", "none");
$("#stand").css("display", "none");
$("#surrender").css("display", "none");
$("#console").append("<br/>이번 판을 포기하셨습니다.")
$("#console").append("<br/>" + (0.5 * mult) + " 코인을 잃었습니다.")
coins -= 0.5 * mult;
setCookie("p21_coins", coins, 30);
$("#deal").css("display", "inline-flex");
publicAd();
return 0;
}
function bust() {
$("#console").append("<br/>버스트! 유감입니다. 졌습니다...")
$("#console").append("<br/>" + mult + " 코인을 잃었습니다.")
coins -= mult;
setCookie("p21_coins", coins, 30);
$("#hit").css("display", "none");
$("#stand").css("display", "none");
$("#deal").css("display", "inline-flex");
publicAd();
return 0;
}
function jack() {
$("#console").append("<br/>블랙잭 달성! 축하합니다. 이겼습니다!")
$("#console").append("<br/>" + (1.5 * mult) + " 코인을 획득했습니다.")
coins += 1.5 * mult;
setCookie("p21_coins", coins, 30);
$("#deal").css("display", "inline-flex");
return 0;
}
function publicAd() {
if (coins < -100) {
$("#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 끝 */
/** 플러그인 msgame***************************
* 스톱워치 게임
* 버전 => 0.942
* 작성자 : [[사용자:Riemann|Riemann]]
* JSON => msgame = {"name":"msgame","descript":"스톱워치 게임","version":"0.942","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).keydown(function() {
if (bl == false) {
bl = true
startF();
} else {
bl = false
stopF();
}
});
$("#msgame-start").click(function() {
bl = true
startF();
});
$("#msgame-stop").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 끝 */
/** 플러그인 exportBitcoin***************************
* 비트코인 실시간 거래내역 수집, 플러그인 예시
* 버전 => 0.0.6
* 작성자 : [[사용자:BANIP|BANIP]]
* JSON => exportBitcoin = {"name":"exportBitcoin","descript":"비트코인 실시간 거래내역 수집, 플러그인 예시","version":"0.0.6","local":true,"creat":"BANIP","state":"백괴게임:플러그인/예시","executable":true};
*/
function plugin_exportBitcoin(){
if($("[data-name='exportBitcoin']").length >= 1){
// 이부부분에 코드 입력 //
if($(".bitcoin").length === 0) return;
setInterval(function(){
fetch("https://api.bithumb.com/public/orderbook")
.then(function(data){ return data.json() })
.then(function(json){
const price = json.data.asks[0].price
$(".bitcoin").html(price);
})
},1500)
// 여기까지 코드 입력 //
}
}
$( plugin_exportBitcoin );
/* exportBitcoin 끝 */
/** 플러그인 uncyslide***************************
* 백괴슬라이드 실행
* 버전 => 1.1.0
* 작성자 : [[사용자:BANIP|BANIP]]
* JSON => uncyslide = {"name":"uncyslide","descript":"백괴슬라이드 실행","version":"1.1.0","local":true,"creat":"BANIP","state":"백괴슬라이드/플러그인","executable":true};
*/
function plugin_uncyslide(){
if($("[data-name='uncyslide']").length >= 1){
// 이부부분에 코드 입력 //
var slideable = plugin_Slideable();
var create = slideable.create;
var execute = slideable.execute;
var dispose = slideable.dispose;
var rankingSystem = plugin_RankingSystem()("백괴슬라이드/랭킹", function(prev,next){ return Number(prev.time) - Number(next.time)});
var outputKeys = {time:"소요시간"};
var startMap = localStorage.getItem("uncySlide/startmap") || 0;
var game = {
0: {
center: "아래로 밀어주세요.",
bottom: 1
},
1: {
center: "오른쪽으로 밀어보세요.",
right: 2
},
2: {
center: "어디로 밀어보실래요?",
top: 3,
bottom: 3,
},
3: {
center: "반갑습니다. <br>백괴슬라이드입니다.",
bottom: 4,
},
4: {
center: "어디로 당기고 미느냐에 따라, 게임의 결과가 달라집니다.",
bottom: 5,
},
5: {
center: "는 개뿔 이겜 시스템만든다고 그런 장황한거 만들 정신머리는 없었습니다",
bottom: 5.1,
},
5.1: {
center: "진심 힘들었습니다.",
bottom: 5.2,
},
5.2: {
center: "잘했죠?",
bottom: 5.3,
},
5.3: {
center: "위로 밀어서 칭찬하거나 아래로 밀어서 욕해주세요.",
top: 5.4,
bottom: 5.5,
},
5.4: {
center: "감사합니다. 헤헤",
bottom: 6,
},
5.5: {
center: "흑흑.. 힘들었는데..",
bottom: 6,
},
6: {
center: "그래도 미디어위키의 틀에서 벗어난 겜인만큼 최대한 나은 경험을 선사하고자 노력했습니다. 잘부탁드립니다.",
bottom: function(){
localStorage.setItem("uncySlide/startmap","main");
execute("main");
},
},
main: {
center: "<ul><li>아래: 게임시작</li><li>토론: 위</li><li>설명: 오른쪽</li></ul>",
bottom: function(){ execute("start",{count:100,time:Date.now()}) },
top: "debate",
right: "i0",
},
i0: {
center:"가장자리에 화살표 보이죠?",
bottom:"i1"
},
i1: {
center:"화면을 넘겨서 드래그해서 진행하는 게임이에요.",
bottom:"i2"
},
i2: {
center:"원래라면 좀 큰 스케일의 게임으로 만들고 싶었는데..",
bottom:"i3"
},
i3: {
center:"제 역량이 겜 크기에서 다 드러나네요...",
bottom:"i4"
},
i4: {
center:"아무쪼록 힘들게 만들었으니 재밌게 즐겨주세요.",
right:"main"
},
debate: function(){
location.href = "https://game.uncyclopedia.kr/wiki/%ED%86%A0%EB%A1%A0:%EB%B0%B1%EA%B4%B4%EC%8A%AC%EB%9D%BC%EC%9D%B4%EB%93%9C";
},
start: function(arg){
function getRandomDirection(){
switch( Math.ceil(Math.random() * 4) ){
case 1: return "top"; break;
case 2: return "bottom"; break;
case 3: return "left"; break;
case 4: return "right"; break;
}
}
function getColorCode(count,maxcount){
var code = "hsl(" + count / maxcount * 360 +",100%,70%)";
console.log(code);
return code
}
var count = arg.count;
var maxcount = arg.maxcount || count;
var time = arg.time;
var $this = $(this);
var timerInterval;
var slideableItem = {
center: function(){
var $this = $(this);
$this.css({
"background": getColorCode(count,maxcount)
});
timerInterval = setInterval(function(){
var overtime = (Date.now() - time) * 0.001;
var printableTime = overtime.toFixed(2);
$this.find(".counter").html(printableTime + "초");
},5)
return "<div class='counter' style='font-size:5vw;'></div><div style='font-size:20vw;'>" + count + "</div>";
}
};
slideableItem[getRandomDirection()] = function(){
clearInterval(timerInterval);
if(count === 1) return execute("result",{count:count - 1,time:time,maxcount:maxcount});
execute("start",{count:count - 1,time:time,maxcount:maxcount})
};
create(slideableItem);
},
result: function(arg){
var maxcount = arg.maxcount || count;
var time = ( (Date.now() - arg.time) / 1000 ).toFixed(2);
var updateParam = {
time: time,
name: mw.config.get("wgUserName")
};
rankingSystem.update(updateParam,function(rankingScore,thisScore){ return rankingScore.time > thisScore.time},outputKeys);
create({
center: "갯수: " + maxcount + " <br/>시간: " + time + "<ul><li>왼쪽: 메인으로</li><li>오른쪽: 토론으로</li></ul>",
left:"main",
right:"debate",
});
}
}
dispose(game, startMap, {});
}
}
$( plugin_uncyslide );
/* uncyslide 끝 */
/** 플러그인 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 끝 */
/** 플러그인 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 끝 */
/** 플러그인 haircut***************************
* 게임 진행에 필요합니다.
* 버전 => 1.0
* 작성자 : [[사용자:Lemminkäinen|Lemminkäinen]]
* JSON => haircut = {"name":"haircut","descript":"게임 진행에 필요합니다.","version":"1.0","local":true,"creat":"Lemminkäinen","state":"머리 자르기/js","executable":true};
*/
function plugin_haircut(){
if($("[data-name='haircut']").length >= 1){
// 이부분에 코드 입력 //
/* 사문 하위의 머리자르기 JS */
var cut_now=$('#cuthair').text();
var cut_line=$('#cutline').text();
var cut_initial=cut_now-cut_line;
var cut_speed=cut_now/$('#cut_diff').text();
var cut_result1=0; var cut_result2=0;
$('#cut_res_container').hide();
$('#cut_container').height(cut_now);
$("#cut_line").height(cut_line);
function cut_again(){
$('#scissors').animate({ top:"100%" },cut_speed,'linear',function(){ $('#scissors').animate({ top:0 },cut_speed,'linear',function(){ cut_again() }); });
}
cut_again();
function cut_calc(pos){
if(pos<cut_line){
cut_rescalc(pos);
return;
}
cut_now=pos;
cut_speed=cut_now/$('#cut_diff').text();
$("#cut_container").height(cut_now);
$("#cuthair").text(cut_now);
}
function cut_rescalc(pos){
$('#cuthair_info').hide();
$('#cut_container').hide();
$('#cut').hide();
$('#cut_res_container').show();
cut_result1=(100*(1-(cut_now-cut_line)/cut_initial));
cut_result2=(100*(pos/cut_line));
$('#cut_result1').text(cut_result1);
$('#cut_result2').text(cut_result2);
if(cut_result1===0){ $('#cut_story0').show(); $('#cuts_story').hide(); }
else if(cut_result1<90){ $('#cut_story1').show(); }
else if(cut_result1<95){ $('#cut_story2').show(); }
else if(cut_result1<98){ $('#cut_story3').show(); }
else if(cut_result1<=100){ $('#cut_story4').show(); }
/* story2 (cut_result2, cuts) */
if(cut_result2<90){ $('#cuts_story1').show(); }
else if(cut_result2<95){ $('#cuts_story2').show(); }
else if(cut_result2<98){ $('#cuts_story3').show(); }
else if(cut_result2<=100){ $('#cuts_story4').show(); }
}
$('#cut').click(function(){ cut_calc($('#scissors').position().top ); });
// 여기까지 코드 입력 //
}
}
$( plugin_haircut );
/* haircut 끝 */
/** 플러그인 inputform***************************
* 완전한 입력기를 구현합니다.
* 버전 => 1.3
* 작성자 : [[사용자:Gustmd7410|Gustmd7410]]
* JSON => inputform = {"name":"inputform","descript":"완전한 입력기를 구현합니다.","version":"1.3","local":false,"creat":"Gustmd7410","state":"틀:입력 상자/플러그인","executable":true};
*/
function plugin_inputform(){
// 이부분에 코드 입력 //
function parseQuery(param) {
return JSON.parse('{' + decodeURI(param.replace('?', '').replace(/([-~!*.:/'()%+\w]+)=([-~!*.:/'()%+\w]*)/g, '"$1": "$2"').replace(/&/g, ', ')) + '}');
}
mw.loader.using('oojs-ui-core').done(function() {
function toBool(value) {
switch(value) {
case undefined: return false;
case '': return true;
}
}
function toArray(value) {
if(value) return value.split(' ');
else return undefined;
}
$('.input-form').each(function() {
var container = this;
$(this).html(new $('<form />', {
class: $(container).data('class'),
id: $(container).data('id'),
style: $(container).data('style'),
'accept-charset': 'UTF-8',
action: '/w/index.php',
method: 'GET',
autocomplete: toBool($(container).data('autocomplete')),
novalidate: toBool($(container).data('novalidate')),
html: $(container).html()
})[0].outerHTML);
var before = (toBool($(this).data('pass'))) ? parseQuery(location.search) : undefined;
var urlget = ($(this).data('get')) ? parseQuery($(this).data('get')) : undefined;
var page = new URL('?title=' + $(this).data('title'), $(this).find('form')[0].action);
var title = (parseQuery(page.search).title) ? parseQuery(page.search) : undefined;
var qdata = $.extend({}, before, urlget, title);
if(page.hash) $(this).find('form')[0].action += page.hash.replace(/%/g, '.');
for(var key in qdata) {
$(container).find('form').prepend($('<input />', {
type: 'hidden',
name: key,
value: qdata[key]
})[0].outerHTML);
}
});
$('.input-field').each(function() {
var container = this;
function validate() {
if($(container).data('validatetype') == 'RegExp') {
var value = $(container).data('validate').substr(1).split('/');
return RegExp(value[0], value[1]);
} else return $(container).data('validate');
}
$(this).html(new OO.ui.TextInputWidget({
accessKey: $(container).data('accessKey'),
autocomplete: toBool($(container).data('autocomplete')),
autofocus: toBool($(container).data('autofocus')),
classes: toArray($(container).data('classes')),
disabled: toBool($(container).data('disabled')),
flags: toArray($(container).data('flags')),
icon: $(container).data('icon'),
iconTitle: $(container).data('iconTitle'),
id: $(container).data('id'),
indicator: $(container).data('indicator'),
indicatorTitle: $(container).data('indicatorTitle'),
inputId: $(container).data('inputId'),
maxLength: Number($(container).data('maxLength')),
name: $(container).data('name'),
placeholder: $(container).data('placeholder'),
readOnly: toBool($(container).data('readOnly')),
required: toBool($(container).data('required')),
spellcheck: toBool($(container).data('spellcheck')),
tabIndex: Number($(container).data('tabIndex')),
text: $(container).data('text'),
title: $(container).data('title'),
type: $(container).data('type'),
validate: validate(),
value: $(container).data('value')
}).$element);
$(this).find('*').css({
display: 'inline',
width: 'auto'
});
});
$('.input-button').each(function() {
var container = this;
$(container).html(new OO.ui.ButtonInputWidget({
accessKey: $(container).data('accessKey'),
classes: toArray($(container).data('classes')),
disabled: toBool($(container).data('disabled')),
flags: toArray($(container).data('flags')),
framed: toBool($(container).data('framed')),
icon: $(container).data('icon'),
iconTitle: $(container).data('iconTitle'),
id: $(container).data('id'),
indicator: $(container).data('indicator'),
indicatorTitle: $(container).data('indicatorTitle'),
inputId: $(container).data('inputId'),
label: $(container).data('label'),
name: $(container).data('name'),
tabIndex: Number($(container).data('tabIndex')),
text: $(container).data('text'),
title: $(container).data('title'),
type: $(container).data('type'),
value: $(container).data('value')
}).$element);
$(this).find('*').css({
display: 'inline'
});
});
noPlugin('input');
});
// 여기까지 코드 입력 //
}
$( plugin_inputform );
/* inputform 끝 */
/** 플러그인 Minseo0388_plugin***************************
* 사문용
* 버전 => 1.1
* 작성자 : [[사용자:Minseo0388|Minseo0388]]
* JSON => Minseo0388_plugin = {"name":"Minseo0388_plugin","descript":"사문용","version":"1.1","local":true,"creat":"Minseo0388","state":"사용자:Minseo0388/플러그인","executable":true};
*/
function plugin_Minseo0388_plugin(){
if($("[data-name='Minseo0388_plugin']").length >= 1){
// 이부분에 코드 입력 //
alert("환영합니다!\n여기는 Minseo0388의 백괴게임 사용자 문서입니다!\n궁금하신 점이 있으시다면 minseo0388@daum.net으로 이메일을 보내주십시오.");
// 여기까지 코드 입력 //
}
}
$( plugin_Minseo0388_plugin );
/* Minseo0388_plugin 끝 */
/** 플러그인 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);
location.href = updateURLParameter(location.href, 'progress'+level, score>nowScore?totalNotes:score);
}
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 끝 */