사용자:Cheongseong9473/common.js
참고: 설정을 저장한 후에 바뀐 점을 확인하기 위해서는 브라우저의 캐시를 새로 고쳐야 합니다.
- 파이어폭스 / 사파리: Shift 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5 또는 Ctrl-R을 입력 (Mac에서는 ⌘-R)
- 구글 크롬: Ctrl-Shift-R키를 입력 (Mac에서는 ⌘-Shift-R)
- 인터넷 익스플로러 / 엣지: Ctrl 키를 누르면서 새로 고침을 클릭하거나, Ctrl-F5를 입력.
- 오페라: Ctrl-F5를 입력.
/** 플러그인 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 끝 */
/** 플러그인 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 끝 */
/** 플러그인 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 끝 */
/** 플러그인 UncyBeat***************************
* 버그 수정
* 버전 => 1.03
* 작성자 : [[사용자:Bd3076|Bd3076]]
* JSON => UncyBeat = {"name":"UncyBeat","descript":"버그 수정","version":"1.03","local":true,"creat":"Bd3076","state":"UncyBeat/plugin","executable":true};
*/
function plugin_UncyBeat(){
if($("[data-name='UncyBeat']").length >= 1){
// 이부분에 코드 입력 //
var getParameters = function (paramName) {
var returnValue;
var url = location.href;
console.log(url);
if(url[8] == 'f'){
return 0;
}
var parameters = (url.slice(url.indexOf('?') + 1, url.length)).split('&');
for (var i = 0; i < parameters.length; i++) {
var varName = parameters[i].split('=')[0];
if (varName.toUpperCase() == paramName.toUpperCase()) {
returnValue = parameters[i].split('=')[1];
return decodeURIComponent(returnValue);
}
}
};
function updateURLParameter(url, param, paramVal){
var newAdditionalURL = "";
var tempArray = url.split("?");
var baseURL = tempArray[0];
var additionalURL = tempArray[1];
var temp = "";
if (additionalURL) {
tempArray = additionalURL.split("&");
for (var i=0; i<tempArray.length; i++){
if(tempArray[i].split('=')[0] != param){
newAdditionalURL += temp + tempArray[i];
temp = "&";
}
}
}
var rows_txt = temp + "" + param + "=" + paramVal;
return baseURL + "?" + newAdditionalURL + rows_txt;
}
function Queue(){
this.arr = [];
this.s = 0;
this.e = 0;
this.size = 0;
this.front = function(){
return arr[s];
}
this.pop = function(){
s++;
size--;
return;
}
this.push = function(k){
arr[e++] = k;
size--;
return;
}
this.empty = function(){
return size==0;
}
}
var timer = 0;
function calculateTimer(){
timer += 1;
}
var cvs = document.getElementById('spanArea');
cvs.innerHTML = "<canvas width='720' height='720' id='spanCanvas'></canvas>"
var canvas = document.getElementById('spanCanvas');
var ctx = canvas.getContext('2d');
var level = getParameters('level');
const levelCount = 1;
const levelNames = [
'Dreams'
];
const levelMusicLink = [
'https://k003.kiwi6.com/hotlink/9f13ktbumx/bensound-dreams.mp3'
];
function clearCanvas(){
ctx.clearRect(0, 0, 720, 720);
}
function makeGameArea(){
clearCanvas();
ctx.strokeStyle = "black";
ctx.strokeRect(20, 20, 680, 680);
for(var i=0; i<5; i++){
for(var j=0; j<5; j++){
ctx.strokeRect(40+i*132, 40+j*132, 112, 112);
}
}
}
function playGameMusic(){
console.log(level);
var audioElement = new Audio(levelMusicLink[level]);
var audio = audioElement.play();
audioElement.onended = function(){
setTimeout(levelEnd, 3000);
};
setInterval(calculateTimer, 50);
}
var x = 2;
var y = 2;
var color = 0;
var perfect = 0;
var good = 0;
var miss = 0;
var score = 0;
function levelEnd(){
var totalNotes = perfect+good+miss;
score = (perfect / totalNotes) * 1000000 + (good / totalNotes) * 500000;
clearInterval(calculateTimer);
clearInterval(showCursor);
clearInterval(displayNotes);
console.log(score);
var nowScore = getParameters('progress'+level);
var maxScore = nowScore < score ? score : nowScore;
location.href = updateURLParameter(location.href, 'progress'+level, maxScore);
}
var noteTimer = new Array(5);
for(var i=0; i<5; i++){
noteTimer[i] = new Array(5);
for(var j=0; j<5; j++){
noteTimer[i][j] = -400;
}
}
var noteColor = new Array(5);
for(var i=0; i<5; i++){
noteColor[i] = new Array(5);
}
function showCursor(){
for(var i=0; i<5; i++){
for(var j=0; j<5; j++){
ctx.fillStyle = noteColor[i][j]==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 && color == noteColor[x][y]){
perfect_(x, y);
}
else if((point <= 40 || noteTimer[x][y] > 20) && color == noteColor[x][y]){
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 끝 */
/** 플러그인 inputform***************************
* 완전한 입력기를 구현합니다. (베타)
* 버전 => 1.6
* 작성자 : [[사용자:Gustmd7410|Gustmd7410]]
* JSON => inputform = {"name":"inputform","descript":"완전한 입력기를 구현합니다. (베타)","version":"1.6","local":false,"creat":"Gustmd7410","state":"틀:입력 상자/플러그인","executable":true};
*/
function plugin_inputform(){
// 이부분에 코드 입력 //
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;
}
function InpTable(table) {
this["case"] = {};
this["default"] = Object.assign({
prefix: '',
value: undefined,
suffix: '',
replace: [],
sub: [0]
}, table["default"]);
if (table["case"]) {
for (var value in table["case"]) {
this["case"][value] = Object.assign({}, this["default"], { value: this["default"].value || value }, table["case"][value]);
}
}
}
$('.input-form').each(function () {
var container = this;
$(this).html(new $('<form />', {
"class": $(this).data('class'),
id: $(this).data('id'),
style: $(this).data('style'),
'accept-charset': 'UTF-8',
autocomplete: toBool($(this).data('autocomplete')),
novalidate: toBool($(this).data('novalidate')),
html: $(this).html()
}));
$(this).children('form').submit(function (event) {
event.preventDefault();
var action = new URL('/w/index.php', location);
if (toBool($(container).data('pass')))
action.search = location.search;
if ($(container).data('get'))
new URLSearchParams($(container).data('get')).forEach(function (value, key) {
action.searchParams.set(key, value);
});
action.searchParams.set('title', $(container).data('title'));
$(this).children('.input-field').each(function () {
if (typeof ($(this).data('table')) == 'object') {
var name = $(this).data('name');
var rawval = $(this).find('input').val();
var table = new InpTable($(this).data('table'));
var cvttbl = table["case"][rawval] || table["default"];
var cvtval = (cvttbl.value || rawval).slice(cvttbl.sub[0], cvttbl.sub[1]);
cvttbl.replace.forEach(function (reparr) {
var regex = reparr[0].substr(1).split('/');
regex.pop();
regex = regex.join('/');
var flag = reparr[0].substr(1).split('/').reverse()[0];
cvtval = cvtval.replace(new RegExp(regex, flag), reparr[1]);
});
action.searchParams.set(name, cvttbl.prefix + cvtval + cvttbl.suffix);
}
else
action.searchParams.set($(this).data('name'), $(this).find('input').val());
});
location.href = action.href;
});
});
$('.input-field').each(function () {
$(this).html(new OO.ui.TextInputWidget({
accessKey: $(this).data('accessKey'),
autocomplete: toBool($(this).data('autocomplete')),
autofocus: toBool($(this).data('autofocus')),
classes: toArray($(this).data('classes')),
disabled: toBool($(this).data('disabled')),
flags: toArray($(this).data('flags')),
icon: $(this).data('icon'),
iconTitle: $(this).data('iconTitle'),
id: $(this).data('id'),
indicator: $(this).data('indicator'),
indicatorTitle: $(this).data('indicatorTitle'),
inputId: $(this).data('inputId'),
maxLength: Number($(this).data('maxLength')),
name: $(this).data('name'),
placeholder: $(this).data('placeholder'),
readOnly: toBool($(this).data('readOnly')),
required: toBool($(this).data('required')),
spellcheck: toBool($(this).data('spellcheck')),
tabIndex: Number($(this).data('tabIndex')),
text: $(this).data('text'),
title: $(this).data('title'),
type: $(this).data('type'),
validate: (function(container) {
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),
value: $(this).data('value')
}).$element);
if(toBool($(this).data('inline'))) $(this).find('*').css({
display: 'inline',
width: 'auto'
});
});
$('.input-button').each(function () {
$(this).html(new OO.ui.ButtonInputWidget({
accessKey: $(this).data('accessKey'),
classes: toArray($(this).data('classes')),
disabled: toBool($(this).data('disabled')),
flags: toArray($(this).data('flags')),
framed: toBool($(this).data('framed')),
icon: $(this).data('icon'),
iconTitle: $(this).data('iconTitle'),
id: $(this).data('id'),
indicator: $(this).data('indicator'),
indicatorTitle: $(this).data('indicatorTitle'),
inputId: $(this).data('inputId'),
label: $(this).data('label'),
name: $(this).data('name'),
tabIndex: Number($(this).data('tabIndex')),
text: $(this).data('text'),
title: $(this).data('title'),
type: $(this).data('type'),
value: $(this).data('value')
}).$element);
});
noPlugin('input');
});
// 여기까지 코드 입력 //
}
$( plugin_inputform );
/* inputform 끝 */
/** 플러그인 jsRULLET***************************
* 랜덤 룰렛을 위한 플러그인
* 버전 => 1.0.4
* 작성자 : [[사용자:Cheongseong9473|Cheongseong9473]]
* JSON => jsRULLET = {"name":"jsRULLET","descript":"랜덤 룰렛을 위한 플러그인","version":"1.0.4","local":true,"creat":"Cheongseong9473","state":"자바월드/랜덤룰렛/플러그인","executable":true};
*/
function plugin_jsRULLET(){
if($("[data-name='jsRULLET']").length >= 1){
for (var i=0;i<6;i++)
{
alert(randomRange(1,60));
}
function randomRange(n1, n2) {
return Math.floor( (Math.random() * (n2 - n1 + 1)) + n1 );
}
}
}
$( plugin_jsRULLET );
/* jsRULLET 끝 */
/** 플러그인 jsINPUT***************************
* 입력기
* 버전 => 1.0.0
* 작성자 : [[사용자:Cheongseong9473|Cheongseong9473]]
* JSON => jsINPUT = {"name":"jsINPUT","descript":"입력기","version":"1.0.0","local":true,"creat":"Cheongseong9473","state":"자바월드/틀안쓰는입력기/플러그인","executable":true};
*/
function plugin_jsINPUT(){
if($("[data-name='jsINPUT']").length >= 1){
var inptnm;
inptnm = prompt("입력기","입력 해 보세요!");
alert("당신이 입력 한 문자열은 "+inputnm);
// 여기까지 코드 입력 //
}
}
$( plugin_jsINPUT );
/* jsINPUT 끝 */
/** 플러그인 UncyBeat_levelmaker***************************
* levelMaker
* 버전 => 1.0
* 작성자 : [[사용자:Bd3076|Bd3076]]
* JSON => UncyBeat_levelmaker = {"name":"UncyBeat_levelmaker","descript":"levelMaker","version":"1.0","local":true,"creat":"Bd3076","state":"UncyBeat/LevelMaker/plugin","executable":true};
*/
function plugin_UncyBeat_levelmaker(){
if($("[data-name='UncyBeat_levelmaker']").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;
var lvData;
function levelEnd(){
location.href = updateURLParameter(location.href, levelData, lvData);
}
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 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);
lvData = lvData + timer + '|' + x + '|' + y + '|' + color + '/';
}
else if(ek==32){
color = !color;
}
}
window.addEventListener("keydown", onKeyDown, false);
var startIndex = 0;
var endIndex = 0;
var data;
var dataLength;
function playGame(){
makeGameArea();
setInterval(showCursor, 30);
setTimeout(playGameMusic, 3000);
}
playGame();
// 여기까지 코드 입력 //
}
}
$( plugin_UncyBeat_levelmaker );
/* UncyBeat_levelmaker 끝 */