Last active
June 13, 2016 13:24
-
-
Save theawesomecoder61/6abbb4fe27fb18ba6a7d0850a1e14586 to your computer and use it in GitHub Desktop.
From some Chrome extension I found
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var renderMode = 2, | |
version = '6.3', | |
normalRender = false, | |
gameFPS = null, | |
positionHUD = null, | |
bestscoreHUD = null, | |
ipHUD = null, | |
fpsHUD = null, | |
styleHUD = "color: #FFF; font-family: Consolas, Verdana; font-size: 13px; position: fixed; opacity: 0.35; z-index: 7;", | |
inpNick = null, | |
currentIP = null, | |
retry = 0, | |
bgImage = null; | |
var f = false; | |
var colorfood = 1; | |
var sizee = 1; | |
var crazie = false; | |
var teamUp = false; | |
var loopInterval = 500; | |
var skinLoop = null; | |
var foodLoop = null; | |
var nextSkin = 0; | |
var highScore = 0; | |
var inpIP = null; | |
function zoom(e) { | |
if (!window.gsc) { | |
return; | |
} | |
e.preventDefault(); | |
window.lvz *= Math.pow(0.93, e.wheelDelta / -120 || e.detail / 2 || 0); | |
window.lvz > 2 ? window.lvz = 2 : window.lvz < 0.1 ? window.lvz = 0.1 : null; | |
window.gsc = window.lvz; | |
} | |
function zoomByKey(key) { | |
var fzoom = key ? -2 : 2; | |
window.lvz *= Math.pow(0.9, fzoom); | |
window.lvz > 2 ? window.lvz = 2 : window.lvz < 0.1 ? window.lvz = 0.1 : null; | |
} | |
window.aef = window.oef; | |
window.oef = function() { | |
window.aef(); | |
if (snake) { | |
window.gsc = window.lvz; | |
} else { | |
window.lvz = window.sgsc; | |
} | |
}; | |
function init() { | |
appendDiv("position-hud", "nsi", styleHUD + "right: 30; bottom: 120px;"); | |
appendDiv("ip-hud", "nsi", styleHUD + "right: 30; bottom: 140px;"); | |
appendDiv("score-hud", "nsi", styleHUD + "right: 30; bottom: 180px;"); | |
appendDiv("fps-hud", "nsi", styleHUD + "right: 30; bottom: 160px;"); | |
positionHUD = document.getElementById("position-hud"); | |
ipHUD = document.getElementById("ip-hud"); | |
fpsHUD = document.getElementById("fps-hud"); | |
bestscoreHUD = document.getElementById("score-hud"); | |
if (/firefox/i.test(navigator.userAgent)) { | |
document.addEventListener("DOMMouseScroll", zoom, false); | |
} else { | |
document.body.onmousewheel = zoom; | |
} | |
window.lvz = window.sgsc; | |
window.onkeydown = function(e) { | |
if(window.playing){ | |
switch (e.keyCode) { | |
case 9: | |
e.preventDefault(); | |
positionHUD.style.display = positionHUD.style.display == "none" ? positionHUD.style.display = null : positionHUD.style.display = "none"; | |
ipHUD.style.display = ipHUD.style.display == "none" ? ipHUD.style.display = null : ipHUD.style.display = "none"; | |
fpsHUD.style.display = fpsHUD.style.display == "none" ? fpsHUD.style.display = null : fpsHUD.style.display = "none"; | |
bestscoreHUD.style.display = bestscoreHUD.style.display == "none" ? bestscoreHUD.style.display = null : bestscoreHUD.style.display = "none"; | |
break; | |
case 27: | |
forceConnect(); | |
break; | |
case 81: | |
gameOver(); | |
break; | |
case 90: | |
gsc = 0.9; | |
window.lvz = 0.9; | |
break; | |
case 69: //r | |
changeSkinback(); | |
break; | |
case 82: //e | |
changeSkin(); | |
break; | |
case 70: | |
if (f === true) { | |
f = false; | |
} else { | |
f = true; | |
} | |
foodInterval(); | |
break; | |
case 71: | |
if (colorfood >= 7) { | |
colorfood = 0; | |
} | |
colorfood = colorfood + 1; | |
break; | |
case 72: | |
if (sizee >= 20) { | |
sizee = 0; | |
} | |
sizee = sizee + 2; | |
break; | |
case 74: | |
if (crazie === true) { | |
crazie = false; | |
} else { | |
crazie = true; | |
} | |
break; | |
case 16: | |
setAcceleration(true); | |
break; | |
case 77://M | |
zoomByKey(false); | |
zoom(e); | |
break; | |
case 78://N | |
zoomByKey(true); | |
zoom(e); | |
break; | |
case 49: | |
insertFitout('oneeye'); //1 | |
break; | |
case 50: | |
insertFitout('argo'); //2 | |
break; | |
case 51: | |
insertFitout('magnet'); //3 | |
break; | |
case 52: | |
insertFitout('kiwi'); //4 | |
break; | |
case 53: | |
insertFitout('punch'); //5 | |
break; | |
case 54: | |
insertFitout('smile'); //6 | |
break; | |
case 55: | |
insertFitout('snail'); //7 | |
break; | |
case 56: | |
insertFitout('store'); //8 | |
break; | |
case 57: | |
insertFitout('reddit'); //8 | |
break; | |
case 85: | |
showHelp(true); | |
break; | |
} | |
} | |
} | |
window.onkeyup = function(e) { | |
switch (e.keyCode) { | |
case 16: | |
setAcceleration(false); | |
break; | |
case 85: | |
showHelp(false); | |
break; | |
} | |
} | |
setLogoMenu(); | |
loadBoard(); | |
setGPU(); | |
updateLoop(); | |
loadFPS(); | |
localStorage.edttsg = "1"; | |
} | |
function appendDiv(id, className, style) { | |
var div = document.createElement("div"); | |
if (id) { | |
div.id = id; | |
} | |
if (className) { | |
div.className = className; | |
} | |
if (style) { | |
div.style = style; | |
} | |
document.body.appendChild(div); | |
} | |
function changeSkin() { | |
if (window.playing && window.snake != null) { | |
var skin = window.snake.rcv; | |
skin++; | |
if (skin > window.max_skin_cv) { | |
skin = 0; | |
} | |
window.setSkin(window.snake, skin); | |
resetTogg(); | |
} | |
} | |
function changeSkinback() { | |
var skin = window.snake.rcv; | |
if (window.playing && window.snake != null) { | |
skin--; | |
if (skin < 1) { | |
skin = window.max_skin_cv; | |
} | |
window.setSkin(window.snake, skin); | |
resetTogg(); | |
} | |
} | |
function setLogoMenu() { | |
var login = document.getElementById("login"); | |
if (login) { | |
loadOptions(); | |
document.getElementById("nick").value = "Slithere.com"; | |
document.getElementById("nick_holder").style.marginTop = "10px"; | |
document.getElementById("playh").firstChild.style.marginBottom = "10px"; | |
document.getElementById("login").style.marginTop = "30px"; | |
document.getElementById("logo").style.marginTop = "0px"; | |
document.getElementById("lastscore").style.marginTop = "20px"; | |
jQuery('#login').append(''); | |
jQuery('#login').append('<div style="box-shadow: #000 0px 6px 50px;width: 700px;color: rgb(165, 165, 165);border-radius: 40px;font-family: Arial;font-size: 13px;text-align: center;margin: 10px auto 10px;line-height: 16px;text-shadow: #000000 0px 1px 1px;background: none;padding:25px;">We share best Slither.io Mods, Extensions Visit Us: <a style="color:#e2cd09;"target="_blank"href="http://www.slithere.com">SLITHERE.COM</a><br><span style="color:#ff5656;">Plaese Disable other Slither.io extension for use that one with full features!</span><div class="row" style="margin-top:15px;"><div class="col-xs-6 col-md-4"style="text-align:left;font-weight: bold;padding-right:0;"><div style="border-radius: 4px;padding:5px 0px;"><center><a href="http://www.slithere.com"target="_blank"style="color:#00b9d6;opacity:2;text-decoration:none;">VISIT SLITHERE.COM</a><br/><a href="http://www.diepioplay.com"target="_blank"style="color:#00b9d6;opacity:2;text-decoration:none;">VISIT DIEPIOPLAY.COM</a><br/><a href="http://www.agarw.com"target="_blank"style="color:#00b9d6;opacity:2;text-decoration:none;">VISIT AGARW.COM</a></center></br><select id="select-srv"class="form-control"style="color:#047a18;"><option value="">Select Server</option></select></div><div style="border-radius: 4px;padding:5px 0px;"><select id="select-graph"class="form-control"style="color: #c90808;"><option value="3">Graphic: Normal</option><option value="2">Graphic: Optimized</option><option value="1">Graphic: Low</option></select></div><div style="border-radius: 4px;padding:5px 0px;"><select id="bg-value"class="form-control"style="color: #0838d6;"><option value="1">Background:Default</option><option value="2">Background:Custom(URL)</option><option value="3">Background:White grid</option><option value="4">Background:Black grid</option><option value="5">Background:None(Black)</option><option value="6">Background:Cats</option><option value="7">Background:Dirt</option><option value="8">Background:Grass</option><option value="9">Background:Grid</option><option value="10">Background:Magma</option><option value="11">Background:Stonewall</option><option value="12">Background:Wood</option></select></div><div style="line-height: 20px;text-align: center;"></br>Mod Version: '+version+'</br><a style="color:#00ff00;opacity:2;text-decoration:none;"href="https://chrome.google.com/webstore/detail/slitherio-mods-hacks-skin/gkfpaolkkchfafkhdleklbddpcolkdea/reviews"target="_blank">Rate for Slither.io Mods [CLICK]</a></div></div><div class="col-xs-12 col-md-8"><div class="form-inline"style="padding: 5px;color: rgb(128, 88, 208); border-radius: 4px; margin: 5px auto; background-color: rgb(255, 255, 255);"><input id="ip-server"type="text"placeholder="Enter Server IP Here"class="form-control"style="color:#2196F3;text-align:center;"> <input id="connect-btn"type="button"value="Play With IP"class="btn btn-primary"style="padding:6px 10px;"></div><div style="border-radius: 4px; margin: 5px auto; padding: 5px 2px; background-color: rgb(255, 255, 255);"><input type="file"accept="image/*"id="fileinput"style="display: inline-block;"><input id="setbg-btn"type="button"value="Set BG"onclick="localImage();"class="btn btn-info"style="padding: 4px 10px;"></div><span style="color:#999">Upload your image with (559x519),then press (Set BG)</span></br></br><div style="color: rgb(133, 249, 174); font-family: Arial; font-size: 13px; text-align: left; opacity: 2; margin: 0px auto; padding: 5px 0px; line-height: 22px; text-shadow: rgb(0, 0, 0) 0px 1px 1px;"><b style="color:#8058d0">MAIN | </b><b style="color:#FF9800">ESC</b> - Respawn | <b style="color:#FF9800">Q</b> - Die | <b style="color:#FF9800">Z</b> - Reset Zoom | <b style="color:#FF9800">SHIFT</b> - Boost </br><b style="color:#FF9800">TAB</b> - Toggle HUD | <b style="color:#FF9800">N/M</b> - Zoom In/Out | <b style="color:#FF9800">U</b> - Hold For Help</br><b style="color:#8058d0">SKINS | </b><b style="color:#FF9800">W</b> - Toggle Skin Rotator | <b style="color:#FF9800">E</b> - Skin Backward | <b style="color:#FF9800">R</b> - Skin Forward</br><b style="color:#8058d0">FOODS | </b><b style="color:#FF9800">F</b> - Toggle Food | <b style="color:#FF9800">G</b> - Food Color | <b style="color:#FF9800">H</b> - Food Size | <b style="color:#FF9800">J</b> - Crazy</br><b style="color:#8058d0">ADDS | </b><b style="color:#FF9800">1</b> - Green Eye | <b style="color:#FF9800">2</b> - Point | <b style="color:#FF9800">3</b> - Magnet | <b style="color:#FF9800">4</b> - Kiwi | <b style="color:#FF9800">5</b> - Punch</br><b style="color:#FF9800">6</b> - Smile | <b style="color:#FF9800">7</b> - Snail | <b style="color:#FF9800">8</b> - Google | <b style="color:#FF9800">9</b> - Reddit</div></div></div></div></div>'); | |
inpIP = document.getElementById("ip-server"); | |
var nick = document.getElementById("nick"); | |
nick.addEventListener("input", setNickname, false); | |
var connectBtn = document.getElementById("connect-btn"); | |
connectBtn.onclick = forceConnect; | |
listServer(); | |
var selectGraph = document.getElementById("select-graph"); | |
if (renderMode == 1) { | |
selectGraph.selectedIndex = 2; | |
} else if (renderMode == 2) { | |
selectGraph.selectedIndex = 1; | |
} else { | |
selectGraph.selectedIndex = 0; | |
normalRender = true; | |
} | |
selectGraph.onchange = function() { | |
var mode = selectGraph.value; | |
if (mode) { | |
renderMode = mode; | |
localStorage.setItem("rendermode", renderMode); | |
} | |
}; | |
var bgGraph = document.getElementById("bg-value"); | |
bgGraph.onchange = function() { | |
var bg = parseInt(bgGraph.value); | |
switch (bg) { | |
case 1: | |
ii.src = "http://slither.io/s/bg45.jpg"; | |
break; | |
case 2: | |
ii.src = prompt("Enter url image (559x519px)") | |
break; | |
case 3: | |
ii.src = "http://www.slithere.com/chrome2/whitegrid.png"; | |
break; | |
case 4: | |
ii.src = "http://www.slithere.com/chrome2/blackgrid.png"; | |
break; | |
case 5: | |
ii.src = "http://www.slithere.com/chrome2/black.png"; | |
break; | |
case 6: | |
ii.src = "http://www.slithere.com/chrome2/carts.jpg"; | |
break; | |
case 7: | |
ii.src = "http://www.slithere.com/chrome2/dirt.jpg"; | |
break; | |
case 8: | |
ii.src = "http://www.slithere.com/chrome2/grass.jpg"; | |
break; | |
case 9: | |
ii.src = "http://www.slithere.com/chrome2/grid.jpg"; | |
break; | |
case 10: | |
ii.src = "http://www.slithere.com/chrome2/magma.jpg"; | |
break; | |
case 11: | |
ii.src = "http://www.slithere.com/chrome2/stonewall.jpg"; | |
break; | |
case 12: | |
ii.src = "http://www.slithere.com/chrome2/wood.jpg"; | |
break; | |
} | |
}; | |
resizeScreen(); | |
yardimet(); | |
$('#playh').insertAfter('#nick_holder'); | |
$('#playh').css({ | |
'display': 'inline-flex', | |
'margin-left': '5px' | |
}); | |
jQuery('#tips').remove(); | |
jQuery('#lastscore').css('margin-top','0px'); | |
cskh.style.bottom = "35px"; | |
cskh.style.display = "inline"; | |
cstx.style.display = "none"; | |
clq.style.width = "320px"; | |
clq.style.bottom = "35px"; | |
clq.innerHTML = "</br></br><a class='lq2' href='http://slithere.com/privacy-policy' target='_blank'>Privacy Policy</a> - <a class='lq2' href='http://facebook.com/slitherecom' target='_blank'>Contact</a>"; | |
} else { | |
setTimeout(setLogoMenu, 100); | |
} | |
} | |
function loadOptions() { | |
if (window.localStorage.getItem("nick") != null) { | |
var nick = window.localStorage.getItem("nick"); | |
document.getElementById("nick").value = nick; | |
} | |
if (window.localStorage.getItem("rendermode") != null) { | |
var mode = parseInt(window.localStorage.getItem("rendermode")); | |
if (mode >= 1 && mode <= 3) { | |
renderMode = mode; | |
} | |
} | |
if (window.localStorage.getItem("highscore") != null) { | |
var score = parseInt(window.localStorage.getItem("highscore")); | |
if (score > 0) { | |
highScore = score; | |
} | |
} | |
if (window.resetGame) { | |
window.resetOld = window.resetGame; | |
window.resetGame = function() { | |
if (snake != null) { | |
var score = Math.floor(150 * (fpsls[snake.sct] + snake.fam / fmlts[snake.sct] - 1) - 50) / 10; | |
if (score > highScore) { | |
highScore = score; | |
window.localStorage.setItem("highscore", highScore); | |
} | |
} | |
window.resetOld(); | |
}; | |
} | |
} | |
function setNickname() { | |
var nick = document.getElementById("nick").value; | |
window.localStorage.setItem("nick", nick); | |
} | |
function showHelp(show) { | |
if (show) { | |
jQuery('div#menu-help').fadeIn(100); | |
} else { | |
jQuery('div#menu-help').fadeOut(100); | |
} | |
} | |
function yardimet() { | |
var div = document.createElement('div'); | |
div.id = 'menu-help'; | |
div.style.width = "700px"; | |
div.style.color = "#85f9ae"; | |
div.style.fontFamily = "'Arial'"; | |
div.style.fontSize = "13px"; | |
div.style.textAlign = "center"; | |
div.style.opacity = "1"; | |
div.style.zIndex = "1000"; | |
div.style.display = "none"; | |
div.style.margin = "0 auto"; | |
div.style.padding = "5px 0"; | |
div.style.position = "fixed"; | |
div.style.top = "150px"; | |
div.style.left = "calc(50% - 350px)"; | |
div.style.lineHeight = "22px"; | |
div.style.textShadow = "0px 1px 1px #000"; | |
div.innerHTML = "<b style='color:#FF9800'>ESC</b> - Respawn | <b style='color:#FF9800'>Q</b> - Die | <b style='color:#FF9800'>Z</b> - Reset Zoom | <b style='color:#FF9800'>SHIFT</b> - Boost | <b style='color:#FF9800'>TAB</b> - Toggle HUD | <b style='color:#FF9800'>W</b> - Toggle Skin Rotator<br/><b style='color:#FF9800'>N/M</b> - Zoom In/Out | <b style='color:#FF9800'>E/R</b> - Change Skin | <b style='color:#FF9800'>F</b> - Toggle Food | <b style='color:#FF9800'>G</b> - Food Color | <b style='color:#FF9800'>H</b> - Food Size | <b style='color:#FF9800'>J</b> - Food Crazy</br><b style='color:#FF9800'>1</b> - Green Eye | <b style='color:#FF9800'>2</b> - Point | <b style='color:#FF9800'>3</b> - Magnet | <b style='color:#FF9800'>4</b> - Kiwi | <b style='color:#FF9800'>5</b> - Punch | <b style='color:#FF9800'>6</b> - Smile | <b style='color:#FF9800'>7</b> - Snail | <b style='color:#FF9800'>8</b> - Google | <b style='color:#FF9800'>9</b> - Reddit"; | |
jQuery('body').append(div); | |
} | |
function connectionStatus() { | |
if (!window.connecting || retry == 10) { | |
window.forcing = false; | |
retry = 0; | |
return; | |
} | |
retry++; | |
setTimeout(connectionStatus, 1000); | |
} | |
function forceConnect() { | |
if (inpIP.value.length == 0 || !window.connect) { | |
return; | |
} | |
window.forcing = true; | |
if (!window.bso) { | |
window.bso = {}; | |
} | |
if (jQuery('canvas').eq(1).css('display') != 'none') { | |
jQuery('canvas').eq(1).css('display', 'none'); | |
} | |
var srv = inpIP.value.trim().split(":"); | |
window.bso.ip = srv[0]; | |
window.bso.po = srv[1]; | |
window.connect(); | |
setTimeout(connectionStatus, 1000); | |
} | |
function loadBestscore() { | |
if (!window.snake || !window.fpsls || !window.fmlts) { | |
return; | |
} | |
if (bestscoreHUD && highScore > 0) { | |
bestscoreHUD.textContent = "Best Score: " + highScore; | |
} | |
} | |
function listServer() { | |
if (window.sos && window.sos.length > 0) { | |
var selectSrv = document.getElementById("select-srv"); | |
for (var i = 0; i < sos.length; i++) { | |
var srv = sos[i]; | |
var option = document.createElement("option"); | |
option.value = srv.ip + ":" + srv.po; | |
option.text = (i + 1) + ". " + option.value; | |
selectSrv.appendChild(option); | |
} | |
selectSrv.onchange = function() { | |
var srv = selectSrv.value; | |
inpIP.value = srv; | |
}; | |
} else { | |
setTimeout(listServer, 100); | |
} | |
} | |
function resizeScreen() { | |
if (window.resize) { | |
window.lww = 0; | |
window.wsu = 0; | |
window.resize(); | |
var wh = Math.ceil(window.innerHeight); | |
if (wh < 800) { | |
var login = document.getElementById("login"); | |
window.lgbsc = wh / 800; | |
login.style.top = -50 + "px"; | |
if (window.trf) { | |
window.trf(login, "scale(" + window.lgbsc + "," + window.lgbsc + ")"); | |
} | |
} | |
} else { | |
setTimeout(resizeScreen, 100); | |
} | |
} | |
function loadBoard() { | |
if (window.lbh) { | |
window.lbh.textContent = "Slithere.com Top 10"; | |
window.lbh.style.fontSize = "20px"; | |
} else { | |
setTimeout(loadBoard, 100); | |
} | |
} | |
function setNormalMode() { | |
normalRender = true; | |
window.ggbg = true; | |
if (!window.bgp2 && bgImage) { | |
window.bgp2 = bgImage; | |
} | |
window.render_mode = 2; | |
} | |
function setGPU() { | |
if (renderMode == 3) { | |
if (!normalRender) { | |
setNormalMode(); | |
} | |
return; | |
} | |
if (normalRender) { | |
normalRender = false; | |
} | |
if (window.want_quality && window.want_quality != 0) { | |
window.want_quality = 0; | |
window.localStorage.setItem("qual", "0"); | |
window.grqi.src = "/s/lowquality.png"; | |
} | |
if (window.ggbg && window.gbgmc) { | |
window.ggbg = false; | |
} | |
if (window.high_quality) { | |
window.high_quality = false; | |
} | |
if (window.gla && window.gla != 0) { | |
window.gla = 0; | |
} | |
if (window.render_mode && window.render_mode != renderMode) { | |
window.render_mode = renderMode; | |
} | |
} | |
function loadFPS() { | |
if (window.playing && fpsHUD && window.fps && window.lrd_mtm) { | |
if (Date.now() - window.lrd_mtm > 970) { | |
fpsHUD.textContent = "FPS: " + window.fps; | |
} | |
} | |
setTimeout(loadFPS, 50); | |
} | |
function updateLoop() { | |
setGPU(); | |
loadBestscore(); | |
if (window.playing) { | |
if (positionHUD) { | |
positionHUD.textContent = "X: " + (~~window.view_xx || 0) + " Y: " + (~~window.view_yy || 0); | |
} | |
if (inpIP && window.bso) { | |
currentIP = window.bso.ip + ":" + window.bso.po; | |
inpIP.value = currentIP; | |
if (ipHUD) { | |
ipHUD.textContent = "IP: " + currentIP; | |
} | |
} | |
} | |
setTimeout(updateLoop, 1000); | |
} | |
function ShowFullscreen() { | |
var elem = document.getElementsByTagName('html')[0]; | |
if (elem.requestFullscreen) { | |
elem.requestFullscreen(); | |
} else if (elem.mozRequestFullScreen) { | |
elem.mozRequestFullScreen(); | |
} else if (elem.webkitRequestFullscreen) { | |
elem.webkitRequestFullscreen(); | |
} | |
} | |
function gameOver() { | |
if (window.playing) { | |
window.want_close_socket = -1; | |
window.dead_mtm = Date.now() - 5E3; | |
window.ws.close(); | |
window.ws = null; | |
window.playing = !1; | |
window.connected = !1; | |
window.resetGame(); | |
window.play_btn.setEnabled(!0); | |
} | |
} | |
function foodInterval() { | |
skinLoop = setInterval(function() { | |
if (f === true && colorfood != 7 && crazie !== true) { | |
newFood(3, snake.xx, snake.yy, sizee, 5, colorfood); | |
} else if (f === true && colorfood == 7 && crazie !== true) { | |
newFood(3, snake.xx, snake.yy, sizee, 5, Math.floor(Math.random() * 7) + 1); | |
} else if (f === true && crazie === true) { | |
newFood(3, snake.xx, snake.yy, Math.floor(Math.random() * 20) + 1, 5, Math.floor(Math.random() * 7) + 1); | |
} | |
}, 100); | |
} | |
init(); | |
var toggEye = false; | |
var toggArgo = false; | |
var toggMag = false; | |
var toggKiw = false; | |
var toggPunch = false; | |
var toggSmile = false; | |
var toggSnail = false; | |
var toggStore = false; | |
var toggRed = false; | |
function resetTogg(){ | |
toggEye = false; | |
toggArgo = false; | |
toggMag = false; | |
toggKiw = false; | |
toggPunch = false; | |
toggSmile = false; | |
toggSnail = false; | |
toggStore = false; | |
toggRed = false; | |
} | |
function resetCustom(){ | |
snake.ec = "#fff"; | |
snake.ppc = "#000"; | |
snake.ppa = 1; | |
toggRed = false; | |
} | |
function flagTogg(result){ | |
toggArgo = result; | |
toggMag = result; | |
toggKiw = result; | |
toggPunch = result; | |
toggStore = result; | |
toggRed = result; | |
} | |
function eyeTogg(result){ | |
snake.ed = 6; | |
snake.esp = 6; | |
snake.eca = 0.75; | |
snake.eo = 0; | |
snake.er = 6; | |
snake.easp = .1; | |
snake.pr = 3.5; | |
snake.pma = 2.3; | |
snake.slg = 0; | |
snake.eac = 0; | |
snake.jyt = 0; | |
toggSnail = result; | |
toggEye = result; | |
toggSmile = result; | |
} | |
function insertFitout(fitout){ | |
resetCustom(); | |
if(fitout == 'oneeye'){ | |
if(!toggEye){ | |
eyeTogg(false); | |
snake.one_eye = !0; | |
snake.ebi = jsebi; | |
snake.ebiw = 64; | |
snake.ebih = 64; | |
snake.ebisz = 29; | |
snake.epi = jsepi; | |
snake.epiw = 48; | |
snake.epih = 48; | |
snake.episz = 14; | |
snake.pma = 4; | |
snake.swell = .06; | |
toggEye = true; | |
toggSmile = false; | |
toggSnail = false; | |
} | |
else{ | |
snake.one_eye = 0; | |
snake.swell = 0; | |
toggEye = false; | |
} | |
} | |
if(fitout == 'reddit'){//Flag | |
if(!toggRed){ | |
flagTogg(false); | |
eyeTogg(false); | |
window.setSkin(window.snake, 19); | |
var redbulb = document.createElement("canvas"); | |
redbulb.width = redbulb.height = 34; | |
ctx = redbulb.getContext("2d"); | |
g = ctx.createRadialGradient(17, 17, 1, 17, 17, 16); | |
g.addColorStop(0, "rgba(255, 255, 255, 1)"); | |
g.addColorStop(.83, "rgba(150,150,150, 1)"); | |
g.addColorStop(.84, "rgba(80,80,80, 1)"); | |
g.addColorStop(.99, "rgba(80,80,80, 1)"); | |
g.addColorStop(1, "rgba(80,80,80, 0)"); | |
ctx.fillStyle = g; | |
ctx.fillRect(0, 0, 34, 34); | |
snake.ec = "#ee5500"; | |
snake.atc1 = "#000"; | |
snake.atc2 = "#fff"; | |
snake.er = 4.5; | |
snake.ppa = 0; | |
snake.antenna = !0; | |
var b = 8; | |
snake.atx = new Float32Array(b); | |
snake.aty = new Float32Array(b); | |
snake.atvx = new Float32Array(b); | |
snake.atvy = new Float32Array(b); | |
snake.atax = new Float32Array(b); | |
snake.atay = new Float32Array(b); | |
for (--b; 0 <= b; b--) snake.atx[b] = snake.xx, snake.aty[b] = snake.yy; | |
snake.bulb = redbulb; | |
snake.blbx = -10; | |
snake.blby = -10; | |
snake.blbw = 20; | |
snake.blbh = 20; | |
snake.bsc = 1; | |
snake.blba = .9; | |
toggRed = true; | |
}else{ | |
snake.antenna = 0; | |
toggRed = false; | |
} | |
} | |
if(fitout == 'argo'){//Flag | |
if(!toggArgo){ | |
flagTogg(false); | |
snake.antenna = !0; | |
snake.atba = 0; | |
snake.atc1 = "#00688c"; | |
snake.atc2 = "#64c8e7"; | |
snake.atwg = !0; | |
snake.atia = .35; | |
snake.abrot = !1; | |
var b = 18; | |
snake.atx = new Float32Array(b); | |
snake.aty = new Float32Array(b); | |
snake.atvx = new Float32Array(b); | |
snake.atvy = new Float32Array(b); | |
snake.atax = new Float32Array(b); | |
snake.atay = new Float32Array(b); | |
for (--b; 0 <= b; b--) snake.atx[b] = snake.xx, snake.aty[b] = snake.yy; | |
snake.bulb = acbulb; | |
snake.blbx = -10; | |
snake.blby = -10; | |
snake.blbw = 20; | |
snake.blbh = 20; | |
snake.bsc = 1; | |
snake.blba = .9; | |
toggArgo = true; | |
}else{ | |
snake.antenna = 0; | |
toggArgo = false; | |
} | |
} | |
if(fitout == 'magnet'){//Flag | |
if(!toggMag){ | |
flagTogg(false); | |
snake.ec = "#ff5609"; | |
snake.eca = 1; | |
snake.antenna = !0; | |
snake.atba = 0; | |
snake.atc1 = "#000000"; | |
snake.atc2 = "#5630d7"; | |
snake.atia = 1; | |
snake.abrot = !0; | |
b = 18; | |
snake.atx = new Float32Array(b); | |
snake.aty = new Float32Array(b); | |
snake.atvx = new Float32Array(b); | |
snake.atvy = new Float32Array(b); | |
snake.atax = new Float32Array(b); | |
snake.atay = new Float32Array(b); | |
for (--b; 0 <= b; b--) snake.atx[b] = snake.xx, snake.aty[b] = snake.yy; | |
snake.bulb = cdbulb; | |
snake.blbx = -5; | |
snake.blby = -10; | |
snake.blbw = 20; | |
snake.blbh = 20; | |
snake.bsc = 1.6; | |
snake.blba = 1; | |
toggMag = true; | |
}else{ | |
snake.ec = "#fff"; | |
snake.antenna = 0; | |
toggMag = false; | |
} | |
} | |
if(fitout == 'kiwi'){//Flag | |
if(!toggKiw){ | |
flagTogg(false); | |
snake.eca = 1; | |
snake.antenna = !0; | |
snake.atba = 0; | |
snake.atc1 = "#301400"; | |
snake.atc2 = "#ff6813"; | |
snake.atwg = !0; | |
snake.atia = .5; | |
snake.abrot = !0; | |
c = 9; | |
snake.atx = new Float32Array(c); | |
snake.aty = new Float32Array(c); | |
snake.atvx = new Float32Array(c); | |
snake.atvy = new Float32Array(c); | |
snake.atax = new Float32Array(c); | |
snake.atay = new Float32Array(c); | |
for (--c; 0 <= c; c--) snake.atx[c] = snake.xx, snake.aty[c] = snake.yy; | |
snake.bulb = kwkbulb; | |
snake.blbx = -39; | |
snake.blby = -63; | |
snake.blbw = 172; | |
snake.blbh = 113; | |
snake.bsc = .42; | |
snake.blba = 1; | |
toggKiw = true; | |
}else{ | |
snake.antenna = 0; | |
toggKiw = false; | |
} | |
} | |
if(fitout == 'punch'){//Flag | |
if(!toggPunch){ | |
flagTogg(false); | |
snake.eca = 1; | |
snake.antenna = !0; | |
snake.atba = 0; | |
snake.atc1 = "#1d3245"; | |
snake.atc2 = "#44d4ff"; | |
snake.atwg = !0; | |
snake.atia = .43; | |
snake.abrot = !0; | |
c = 12; | |
snake.atx = new Float32Array(c); | |
snake.aty = new Float32Array(c); | |
snake.atvx = new Float32Array(c); | |
snake.atvy = new Float32Array(c); | |
snake.atax = new Float32Array(c); | |
snake.atay = new Float32Array(c); | |
for (--c; 0 <= c; c--) snake.atx[c] = snake.xx, snake.aty[c] = snake.yy; | |
snake.bulb = pwdbulb; | |
snake.blbx = -36; | |
snake.blby = -100; | |
snake.blbw = 190; | |
snake.blbh = 188; | |
snake.bsc = .25; | |
snake.blba = 1; | |
toggPunch = true; | |
}else{ | |
snake.antenna = 0; | |
toggPunch = false; | |
} | |
} | |
if(fitout == 'smile'){ | |
if(!toggSmile){ | |
eyeTogg(false); | |
snake.eac = !0; | |
snake.jyt = !0; | |
snake.one_eye = 0; | |
snake.swell = 0; | |
toggSmile = true; | |
toggSnail = false; | |
toggEye = false; | |
}else{ | |
snake.eac = 0; | |
snake.jyt = 0; | |
toggSmile = false; | |
} | |
} | |
if(fitout == 'snail'){ | |
if(!toggSnail){ | |
snake.one_eye = 0; | |
snake.swell = 0; | |
snake.ed = 34; | |
snake.esp = 14; | |
snake.eca = 1; | |
snake.eo = 3; | |
snake.er = 8; | |
snake.easp = .038; | |
snake.pr = 4.5; | |
snake.pma = 3; | |
snake.slg = !0; | |
toggSnail = true; | |
toggSmile = false; | |
toggEye = false; | |
}else{ | |
snake.ed = 6; | |
snake.esp = 6; | |
snake.eca = 0.75; | |
snake.eo = 0; | |
snake.er = 6; | |
snake.easp = .1; | |
snake.pr = 3.5; | |
snake.pma = 2.3; | |
snake.slg = 0; | |
toggSnail = false; | |
} | |
} | |
if(fitout == 'store'){//Flag | |
if(!toggStore){ | |
flagTogg(false); | |
snake.eca = 1; | |
snake.antenna = !0; | |
snake.atba = 0; | |
snake.atc1 = "#002828"; | |
snake.atc2 = "#80d0d0"; | |
snake.atwg = !0; | |
snake.atia = .5; | |
snake.abrot = !0; | |
c = 9; | |
snake.atx = new Float32Array(c); | |
snake.aty = new Float32Array(c); | |
snake.atvx = new Float32Array(c); | |
snake.atvy = new Float32Array(c); | |
snake.atax = new Float32Array(c); | |
snake.atay = new Float32Array(c); | |
for (--c; 0 <= c; c--) snake.atx[c] = snake.xx, snake.aty[c] = snake.yy; | |
snake.bulb = playbulb; | |
snake.blbx = -29; | |
snake.blby = -74; | |
snake.blbw = 142; | |
snake.blbh = 149; | |
snake.bsc = .36; | |
snake.blba = 1; | |
toggStore = true; | |
}else{ | |
snake.antenna = 0; | |
toggStore = false; | |
} | |
} | |
} | |
function localImage() { | |
var file = document.querySelector('input[type=file]').files[0]; | |
var reader = new FileReader(); | |
reader.onloadend = function() { | |
theImage = reader.result; | |
localStorage.setItem("savei", theImage); | |
ii.src = localStorage.getItem("savei"); | |
}; | |
if (file) { | |
reader.readAsDataURL(file); | |
} else { | |
preview.src = ""; | |
} | |
} | |
var setSkin = (function() { | |
var | |
omaxSkin = max_skin_cv, | |
osetSkin = setSkin, | |
newskin = [ | |
[11, 7, 7, 11, 11, 11, 9, 9], | |
[4, 3, 3, 4, 4, 4], | |
[5, 5, 7, 5, 22, 22, 4, 4, 22, 22, 5, 5, 9, 9], | |
[16, 16, 16, 16, 7, 7, 7, 9, 9, 10, 10, 10, 9, 9, 7, 7, 7], | |
[12, 7, 7, 7, 7, 9, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7], | |
[11, 9, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11], | |
[16, 16, 7, 7, 7, 7, 9, 11, 7, 7, 7, 7, 16], | |
[3, 3, 3, 9, 11, 9], | |
[11, 9, 11, 7, 7, 7], // Mexican Kingsnake | |
[11, 9, 11, 4, 4, 4], // Mexican Kingsnake | |
[11, 9, 11, 5, 5, 5], // Mexican Kingsnake | |
[11, 9, 11, 23, 23, 23], // Mexican Kingsnake | |
[12, 13, 14, 15, 16, 17, 18, 21, 22, 23], //Test 2 | |
[12, 11, 22, 22, 23, 23, 12], // Nice colors | |
[11], | |
[25],// fullcolor green | |
[21] //full color blue | |
]; | |
max_skin_cv = max_skin_cv + newskin.length; | |
return function(snake, skinId) { | |
osetSkin(snake, skinId); | |
if (skinId > omaxSkin) { | |
var sID, checkSkinId = skinId - omaxSkin - 1; | |
if (newskin[checkSkinId] !== undefined) { | |
sID = newskin[checkSkinId]; | |
} else { | |
skinId %= 9; | |
} | |
sID && (skinId = sID[0]); | |
snake.rbcs = sID; | |
snake.cv = skinId; | |
} | |
if(snake.rcv == 59){ | |
snake.one_eye = !0; | |
snake.ebi = jsebi; | |
snake.ebiw = 64; | |
snake.ebih = 64; | |
snake.ebisz = 29; | |
snake.epi = jsepi; | |
snake.epiw = 48; | |
snake.epih = 48; | |
snake.episz = 14; | |
snake.pma = 4; | |
snake.swell = .06; | |
toggEye = true; | |
} | |
if(snake.rcv == 60){ | |
snake.eca = 1; | |
snake.antenna = !0; | |
snake.atba = 0; | |
snake.atc1 = "#301400"; | |
snake.atc2 = "#ff6813"; | |
snake.atwg = !0; | |
snake.atia = .5; | |
snake.abrot = !0; | |
c = 9; | |
snake.atx = new Float32Array(c); | |
snake.aty = new Float32Array(c); | |
snake.atvx = new Float32Array(c); | |
snake.atvy = new Float32Array(c); | |
snake.atax = new Float32Array(c); | |
snake.atay = new Float32Array(c); | |
for (--c; 0 <= c; c--) snake.atx[c] = snake.xx, snake.aty[c] = snake.yy; | |
snake.bulb = kwkbulb; | |
snake.blbx = -39; | |
snake.blby = -63; | |
snake.blbw = 172; | |
snake.blbh = 113; | |
snake.bsc = .42; | |
snake.blba = 1; | |
toggkivi = true; | |
} | |
}; | |
})(); | |
function resizeScreen() { | |
if (window.resize) { | |
window.lww = 0; | |
window.wsu = 0; | |
window.resize(); | |
var wh = Math.ceil(window.innerHeight); | |
if (wh < 800) { | |
var login = document.getElementById("login"); | |
window.lgbsc = wh / 800; | |
login.style.top = -20 + "px"; | |
if (window.trf) { | |
window.trf(login, "scale(" + window.lgbsc + "," + window.lgbsc + ")"); | |
} | |
} | |
} else { | |
setTimeout(resizeScreen, 100); | |
} | |
} | |
window.addEventListener('resize', function(){resizeScreen()}, false); | |
window.social.src = "http://www.slithere.com/chrome/socialama.html"; | |
window.social.height = "160px"; | |
document.getElementById('twt').href = "http://twitter.com/intent/tweet?status=Come%20and%20play%20http%3A%2F%2Fslithereio.com%20%23slitherio"; | |
document.getElementById('fb').href = "https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fslithereio.com"; | |
document.getElementById("csk").childNodes[1].src = "http://www.slithere.com/chrome2/changeskin4.png"; | |
//Default newest skin | |
if(localStorage.snakercv == undefined){ | |
localStorage.snakercv = max_skin_cv; | |
} | |
window.addEventListener('click', function(){$(window).focus()}); | |
(function(){ | |
if (!+localStorage.getItem('edttsg')) { | |
localStorage.setItem('edttsg', 1); | |
cskh.style.display = "inline"; | |
cstx.style.display = "none"; | |
} | |
var body = document.body, switches = {}; | |
function createWindow() { | |
var blackout = document.createElement('div'); | |
blackout.className = 'yeniskinslithere-blackout'; | |
body.appendChild(blackout); | |
var wind = document.createElement('div'); | |
wind.className = 'yeniskinslithere-window'; | |
wind.onmousedown = function(e) { | |
e.stopPropagation(); | |
}; | |
blackout.appendChild(wind); | |
return blackout; | |
} | |
function createSwitch(parent, opt, text, func, initial = false) { | |
var id = 'yeniskinslithere-'+opt; | |
if (!localStorage.getItem(id)) localStorage.setItem(id, initial); | |
switches[opt] = localStorage.getItem(id) == 'true'; | |
var div = document.createElement('div'); | |
div.className = 'yeniskinslithere-checkbox-div'; | |
parent.appendChild(div); | |
var checkbox = document.createElement('div'); | |
checkbox.className = 'yeniskinslithere-checkbox'; | |
div.appendChild(checkbox); | |
var input = document.createElement('input'), o = {div:div,input:input}; | |
input.type = 'checkbox'; | |
input.id = id; | |
if (switches[opt]) input.checked = true, func && func(o); | |
input.onchange = function() { | |
switches[opt] = this.checked; | |
localStorage.setItem(id, switches[opt]); | |
func && func(o); | |
}; | |
checkbox.appendChild(input); | |
var label = document.createElement('label'); | |
label.htmlFor = id; | |
checkbox.appendChild(label); | |
var textLabel = document.createElement('label'); | |
textLabel.htmlFor = id; | |
textLabel.textContent = text; | |
div.appendChild(textLabel); | |
return input; | |
} | |
// <Styles> | |
var styles = { | |
'.yeniskinslithere-checkbox': { | |
display: 'inline-block', | |
width: '22px', | |
height: '22px', | |
position: 'relative', | |
'margin-right': '8px', | |
'background-color': '#fcfff4', | |
background: 'linear-gradient(to bottom, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%)', | |
'border-radius': '50px', | |
'box-shadow': 'inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5)' | |
}, | |
'.yeniskinslithere-checkbox>input': { | |
visibility: 'hidden' | |
}, | |
'.yeniskinslithere-checkbox>label': { | |
width: '14px', | |
height: '14px', | |
position: 'absolute', | |
top: '4px', | |
left: '4px', | |
cursor: 'pointer', | |
background: 'linear-gradient(to bottom, #222222 0%, #45484d 100%)', | |
'border-radius': '50px', | |
'box-shadow': 'inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white' | |
}, | |
'.yeniskinslithere-checkbox>label::after': { | |
content: '""', | |
width: '8px', | |
height: '5px', | |
position: 'absolute', | |
top: '2px', | |
left: '2px', | |
border: '2px solid #fcfff4', | |
'border-top': 'none', | |
'border-right': 'none', | |
background: 'transparent', | |
opacity: 0, | |
'-webkit-transform': 'rotate(-45deg)', | |
transform: 'rotate(-45deg)' | |
}, | |
'.yeniskinslithere-checkbox-div:hover>.yeniskinslithere-checkbox>label::after': { | |
opacity: 0.3 | |
}, | |
'.yeniskinslithere-checkbox>input:checked + label::after': { | |
opacity: '1 !important' | |
}, | |
'#yeniskinslithere-skins': { | |
transition: '1s' | |
}, | |
'#yeniskinslithere-skins>div': { | |
display: 'inline-block', | |
margin: '0 15px' | |
}, | |
'.yeniskinslithere-link': { | |
color: 'white', | |
cursor: 'pointer' | |
}, | |
'.yeniskinslithere-link:hover': { | |
'text-shadow': '1px 1px 4px rgba(0,0,0,1)' | |
}, | |
'.yeniskinslithere-blue': { | |
color: '#3366FF', | |
'text-decoration': 'none', | |
cursor: 'pointer' | |
}, | |
'.yeniskinslithere-blackout': { | |
display: 'flex', | |
'justify-content': 'center', | |
'align-items': 'center', | |
visibility: 'hidden', | |
position: 'fixed', | |
top: 0, right: 0, bottom: 0, left: 0, | |
background: 'rgba(0,0,0,.5)', | |
opacity: 0, | |
'z-index': 100000002, | |
transition: 'opacity 0.5s' | |
}, | |
'.yeniskinslithere-window': { | |
'box-sizing': 'border-box', | |
padding: '12px', | |
'min-width': '300px', | |
'max-height': hh - 50 + 'px', | |
background: 'white', | |
'border-radius': '10px', | |
'box-shadow': '0 0 20px 7px rgba(0,0,0,.5)', | |
'font-family': 'Calibri, Tahoma, Arial, sans-serif', | |
overflow: 'auto' | |
}, | |
'.yeniskinslithere-window>h2': { | |
margin: 0, | |
'text-align': 'center' | |
} | |
}; | |
var style = document.createElement('style'); | |
document.head.appendChild(style); | |
stylesheet = style.sheet; | |
for (var selector in styles) | |
for (var property in styles[selector]) | |
stylesheet.insertRule(selector + '{' + property + ':' + styles[selector][property] + ';' + '}', stylesheet.cssRules.length); | |
// </Styles> | |
var div = document.createElement('div'); | |
div.id = 'yeniskinslithere-skins'; | |
div.className = 'nsi'; | |
div.style.display = 'none'; | |
div.style.opacity = 0; | |
div.style.position = 'fixed'; | |
div.style.bottom = '35px'; | |
div.style.left = '20%'; | |
div.style.right = '20%'; | |
div.style.color = 'white'; | |
div.style.fontFamily = 'Arial, sans-serif'; | |
div.style.textAlign = 'center'; | |
div.style.zIndex = 100000000; | |
body.appendChild(div); | |
// <Change SKins> | |
if (!localStorage.getItem('yeniskinslithere-cstime')) localStorage.setItem('yeniskinslithere-cstime', 1000); | |
var nextSkin = +localStorage.getItem('snakercv'), cstime = +localStorage.getItem('yeniskinslithere-cstime'); | |
function changeSkins() { | |
if (switches.changeskins && snake && !sc) { | |
nextSkin++; | |
var Skins = skins, maxSkin = max_skin_cv; | |
if (switches.csd) Skins = []; | |
if (nextSkin > maxSkin + Skins.length) nextSkin = 0; | |
if (switches.csc && Skins.length && nextSkin <= maxSkin) nextSkin = maxSkin + 1; | |
setSkin(snake, nextSkin); | |
localStorage.setItem('snakercv', nextSkin); | |
} | |
if (switches.changeskins) setTimeout(changeSkins, cstime); | |
} | |
var csinput = createSwitch(div, 'changeskins', 'Change Skins (W key)', function(){if (switches.changeskins) setTimeout(changeSkins, cstime)}); | |
// </Change SKins> | |
var ayircmi = document.createTextNode('-'); | |
div.appendChild(ayircmi); | |
// <Settings> | |
var setlink = document.createElement('div'); | |
setlink.innerHTML = '<span class="yeniskinslithere-link">Skin Rotator</span>'; | |
setlink.style.marginTop = '5px'; | |
setlink.style.fontSize = '16px'; | |
setlink.firstChild.onclick = function() { | |
setblackout.style.visibility = 'visible'; | |
setblackout.style.opacity = 1; | |
}; | |
div.appendChild(setlink); | |
var setblackout = createWindow(); | |
//setblackout.style.visibility = 'visible'; | |
//setblackout.style.opacity = 1; | |
var setdiv = setblackout.firstChild; | |
var setcs1 = document.createElement('div'), setcs2 = document.createElement('div');; | |
setcs1.style.display = setcs2.style.display = 'inline-block'; | |
setcs1.style.width = setcs2.style.width = '50%'; | |
setdiv.appendChild(setcs1); | |
setdiv.appendChild(setcs2); | |
var setcs = document.createElement('h3'); | |
setcs.textContent = 'Skin Rotator'; | |
setcs.style.margin = '3px'; | |
setcs1.appendChild(setcs); | |
var setcs4 = document.createElement('h4'); | |
setcs4.textContent = 'Dont forget to tick Change Skins'; | |
setcs4.style.margin = '3px'; | |
setcs1.appendChild(setcs4); | |
var setcstime = document.createElement('label'); | |
setcstime.innerHTML = '<span title="' + "Excellent for Slither.io YouTubers.\nIncrease the value so that skins don't change too fast in your video.\nThe unit is milliseconds." + '" style="cursor:help;">Interval:</span> <input type="number" value="' + cstime + '" style="width:60px;">'; | |
setcstime.lastChild.onchange = function() { | |
cstime = +this.value; | |
localStorage.setItem('yeniskinslithere-cstime', cstime); | |
}; | |
setcs1.appendChild(setcstime); | |
function csonly(o) { | |
if (o.input.checked) { | |
var sib = o.div.previousSibling || o.div.nextSibling; | |
if (sib) { | |
var input = sib.firstChild.firstChild; | |
if (input && input.checked) input.checked = false, input.onchange(); | |
} | |
} | |
} | |
var setok = makeTextBtn('OK', 36, 16, 18, 1).elem; | |
setok.style.position = 'relative'; | |
setok.style.margin = '10px auto 0px auto'; | |
setok.style.removeProperty('box-shadow'); | |
setok.onclick = function() { | |
setblackout.style.opacity = 0; | |
setTimeout(function() { | |
setblackout.style.visibility = 'hidden'; | |
}, 500); | |
}; | |
setdiv.appendChild(setok); | |
// </Settings> | |
var ayircmi = document.createTextNode('-'); | |
div.appendChild(ayircmi); | |
// <Custom Colors> | |
function applyColor(i) { | |
o = { | |
imgs: [], | |
fws: [], | |
fhs: [], | |
fw2s: [], | |
fh2s: [], | |
gimgs: [], | |
gfws: [], | |
gfhs: [], | |
gfw2s: [], | |
gfh2s: [], | |
oimgs: [], | |
ofws: [], | |
ofhs: [], | |
ofw2s: [], | |
ofh2s: [] | |
}; | |
var rs = "00" + rrs[i].toString(16), | |
gs = "00" + ggs[i].toString(16), | |
bs = "00" + bbs[i].toString(16), | |
rs = rs.substr(rs.length - 2), | |
gs = gs.substr(gs.length - 2), | |
bs = bs.substr(bs.length - 2); | |
o.cs = "#" + rs + gs + bs; | |
var sz = 62, | |
kfmc = document.createElement("canvas"); | |
kfmc.width = kfmc.height = sz; | |
ctx = kfmc.getContext("2d"); | |
map = ctx.getImageData(0, 0, sz, sz); | |
imgd = map.data; | |
l = imgd.length; | |
for (p = | |
yy = xx = 0; p < l; p += 4) v = Math.abs(Math.sqrt(Math.pow(sz / 2 - xx, 2) + Math.pow(sz / 2 - yy, 2)) - 16), v = 15 >= v ? 1 - v / 15 : 0, imgd[p] = rrs[i], imgd[p + 1] = ggs[i], imgd[p + 2] = bbs[i], imgd[p + 3] = Math.floor(255 * v), xx++, xx >= sz && (xx = 0, yy++); | |
ctx.putImageData(map, 0, 0); | |
o.kfmc = kfmc; | |
var ksz = 48, | |
ksz2 = ksz / 2, | |
kmc = document.createElement("canvas"); | |
kmc.width = kmc.height = ksz; | |
ctx = kmc.getContext("2d"); | |
ctx.fillStyle = "#FFFFFF"; | |
ctx.arc(ksz2, ksz2, ksz2, 0, pi2); | |
ctx.fill(); | |
map = ctx.getImageData(0, 0, ksz, ksz); | |
imgd = map.data; | |
l = imgd.length; | |
yy = xx = 0; | |
var kmcs = []; | |
for (j = | |
0; 7 > j; j++) { | |
for (p = xx = yy = 0; p < l; p += 4) { | |
var v = Math.pow(Math.max(0, Math.min(1, 1 - Math.abs(yy - ksz2) / ksz2)), .35), | |
v2 = Math.max(0, Math.min(1, 1 - Math.sqrt(Math.pow(xx - ksz2, 2) + Math.pow(yy - ksz2, 2)) / 34)), | |
v = v + .375 * (v2 - v), | |
v = v * (1.22 - .44 * j / 6); | |
rr = rrs[i]; | |
gg = ggs[i]; | |
bb = bbs[i]; | |
imgd[p] = Math.max(0, Math.min(255, Math.floor(rr * v))); | |
imgd[p + 1] = Math.max(0, Math.min(255, Math.floor(gg * v))); | |
imgd[p + 2] = Math.max(0, Math.min(255, Math.floor(bb * v))); | |
xx++; | |
xx >= ksz && (xx = 0, yy++) | |
} | |
ctx.putImageData(map, 0, 0); | |
var kmc2 = document.createElement("canvas"); | |
kmc2.width = kmc2.height = ksz; | |
var ctx2 = kmc2.getContext("2d"); | |
ctx2.drawImage(kmc, 0, 0); | |
/*if (10 == i) | |
for (k = -1; 1 >= k; k++) { | |
var tx = ksz2 + ksz2 / 16 * Math.cos(2 * Math.PI * k / 8) * 13, | |
ty = ksz2 + ksz2 / 16 * Math.sin(2 * Math.PI * k / 8) * 13; | |
ctx2.fillStyle = "#FFFFFF"; | |
ctx2.beginPath(); | |
for (m = 0; 5 >= m; m++) xx = tx + ksz / 32 * Math.cos(2 * Math.PI * m / 5) * .05 * 24, yy = ty + ksz / 32 * Math.sin(2 * Math.PI * m / 5) * .05 * 24, 0 == m ? ctx2.moveTo(xx, yy) : ctx2.lineTo(xx, yy), xx = tx + ksz / 32 * Math.cos(2 * Math.PI * (m + .5) / 5) * 3.1, yy = ty + ksz / 32 * Math.sin(2 * Math.PI * (m + .5) / 5) * 3.1, ctx2.lineTo(xx, yy); | |
ctx2.fill() | |
} else if (19 == i) | |
for (k = -2; 2 >= k; k++) { | |
tx = ksz2 + ksz2 / 16 * Math.cos(2 * Math.PI * k / 15) * 13; | |
ty = ksz2 + ksz2 / 16 * Math.sin(2 * Math.PI * k / 15) * 13; | |
ctx2.save(); | |
ctx2.globalAlpha = .7; | |
ctx2.fillStyle = "#FFFFFF"; | |
ctx2.beginPath(); | |
for (m = 0; 5 >= m; m++) xx = tx + ksz / 32 * Math.cos(2 * Math.PI * m / 5) * .05 * 12, yy = ty + ksz / 32 * Math.sin(2 * Math.PI * m / 5) * .05 * 12, 0 == m ? ctx2.moveTo(xx, yy) : ctx2.lineTo(xx, yy), xx = tx + ksz / 32 * Math.cos(2 * Math.PI * (m + .5) / 5) * 1.55, yy = ty + ksz / 32 * Math.sin(2 * Math.PI * (m + .5) / 5) * 1.55, ctx2.lineTo(xx, yy); | |
ctx2.fill(); | |
ctx2.restore() | |
} else if (20 == i) | |
for (k = -1.5; 1.5 >= k; k++) { | |
tx = ksz2 + ksz2 / 16 * Math.cos(2 * Math.PI * k / 15) * 13; | |
ty = ksz2 + ksz2 / 16 * Math.sin(2 * Math.PI * k / 15) * 13; | |
ctx2.save(); | |
ctx2.globalAlpha = .7; | |
ctx2.fillStyle = "#FFFFFF"; | |
ctx2.beginPath(); | |
for (m = 0; 5 >= m; m++) xx = tx + ksz2 / 16 * Math.cos(2 * Math.PI * m / 5) * .05 * 14, yy = ty + ksz2 / 16 * Math.sin(2 * Math.PI * m / 5) * .05 * 14, 0 == m ? ctx2.moveTo(xx, yy) : ctx2.lineTo(xx, yy), xx = tx + ksz2 / 16 * Math.cos(2 * Math.PI * (m + .5) / 5) * 1.8, yy = ty + ksz2 / 16 * Math.sin(2 * Math.PI * (m + .5) / 5) * 1.8, ctx2.lineTo(xx, yy); | |
ctx2.fill(); | |
ctx2.restore() | |
}*/ | |
kmcs.push(kmc2) | |
} | |
o.kmcs = kmcs; | |
per_color_imgs.push(o); | |
for (j = 2.8; 18.8 >= j; j += 1) { | |
var cc = document.createElement("canvas"), | |
sz = Math.ceil(2.5 * j + 28); | |
cc.width = cc.height = sz; | |
ctx = cc.getContext("2d"); | |
ctx.fillStyle = o.cs; | |
ctx.arc(sz / 2, sz / 2, .65 * j, 0, pi2); | |
ctx.shadowBlur = 12; | |
ctx.shadowOffsetY = 0; | |
ctx.shadowColor = "#" + rs + gs + bs; | |
ctx.globalAlpha = .8; | |
ctx.fill(); | |
ctx.globalAlpha = 1; | |
ctx.fill(); | |
o.imgs.push(cc); | |
o.fws.push(sz); | |
o.fhs.push(sz); | |
o.fw2s.push(sz / 2); | |
o.fh2s.push(sz / 2); | |
sz = Math.ceil(8 * j + 6); | |
cc = document.createElement("canvas"); | |
cc.width = cc.height = sz; | |
ctx = cc.getContext("2d"); | |
g = ctx.createRadialGradient(sz / 2, sz / 2, 1, sz / 2, sz / 2, 4 * j); | |
g.addColorStop(0, "rgba(" + rrs[i] + ", " + ggs[i] + ", " + bbs[i] + ", 1)"); | |
g.addColorStop(1, "rgba(" + rrs[i] + ", " + ggs[i] + ", " + bbs[i] + ", 0)"); | |
ctx.fillStyle = g; | |
ctx.fillRect(0, 0, sz, sz); | |
o.gimgs.push(cc); | |
o.gfws.push(sz); | |
o.gfhs.push(sz); | |
o.gfw2s.push(sz / 2); | |
o.gfh2s.push(sz / 2); | |
cc = document.createElement("canvas"); | |
sz = Math.ceil(1.3 * j + 6); | |
cc.width = cc.height = sz; | |
ctx = cc.getContext("2d"); | |
var eam = .2, | |
g = ctx.createRadialGradient(sz / 2, sz / 2, 0, sz / 2, sz / 2, j / 2); | |
g.addColorStop(0, "rgba(" + | |
rrs[i] + ", " + ggs[i] + ", " + bbs[i] + ", 1)"); | |
g.addColorStop(.99, "rgba(" + Math.floor(rrs[i] * eam) + ", " + Math.floor(ggs[i] * eam) + ", " + Math.floor(bbs[i] * eam) + ", 1)"); | |
g.addColorStop(1, "rgba(" + Math.floor(rrs[i] * eam) + ", " + Math.floor(ggs[i] * eam) + ", " + Math.floor(bbs[i] * eam) + ", 0)"); | |
ctx.fillStyle = g; | |
ctx.fillRect(0, 0, sz, sz); | |
ctx.strokeStyle = "#000000"; | |
ctx.lineWidth = 2; | |
ctx.arc(sz / 2, sz / 2, .65 * j, 0, pi2); | |
ctx.globalAlpha = 1; | |
ctx.stroke(); | |
o.oimgs.push(cc); | |
o.ofws.push(sz); | |
o.ofhs.push(sz); | |
o.ofw2s.push(sz / 2); | |
o.ofh2s.push(sz / 2) | |
} | |
o.ic = | |
o.imgs.length; | |
o.pr_imgs = []; | |
o.pr_fws = []; | |
o.pr_fhs = []; | |
o.pr_fw2s = []; | |
o.pr_fh2s = []; | |
for (j = 3; 24 >= j; j += 1) cc = document.createElement("canvas"), sz = Math.ceil(2 * j + 38), cc.width = cc.height = sz, ctx = cc.getContext("2d"), ctx.fillStyle = o.cs, ctx.arc(sz / 2, sz / 2, j / 2, 0, pi2), ctx.shadowBlur = 22, ctx.shadowOffsetY = 0, ctx.shadowColor = "#" + rs + gs + bs, ctx.fill(), ctx.fill(), o.pr_imgs.push(cc), o.pr_fws.push(sz), o.pr_fhs.push(sz), o.pr_fw2s.push(sz / 2), o.pr_fh2s.push(sz / 2) | |
}; | |
function applyColors(update = true) { | |
per_color_imgs.splice(ncolors, ccolors.length); | |
ccolors = []; | |
if (update) { | |
for (var i = cccs.childNodes.length - 1; i >= 0; i--) { | |
if (cccs.childNodes[i].childNodes.length == 5) { | |
rrs.splice(ncolors+i,1); | |
ggs.splice(ncolors+i,1); | |
bbs.splice(ncolors+i,1); | |
cccs.removeChild(cccs.childNodes[i]); | |
for (var j = i+1; j < cccs.childNodes.length; j++) | |
cccs.childNodes[j].dataset.n = cccs.childNodes[j].dataset.n - 1; | |
for (var j = 0; j < skins.length; j++) | |
for (var k = 0; k < skins[j].length; k++) | |
if (skins[j][k] >= ncolors + i) skins[j][k]--; | |
} | |
} | |
localStorage.setItem('yeniskinslithere-skins', JSON.stringify(skins)); | |
colorMenu(); | |
workspace(); | |
} | |
for (var i = ncolors; i < rrs.length; i++) { | |
ccolors.push([rrs[i], ggs[i], bbs[i]]); | |
applyColor(i); | |
} | |
localStorage.setItem('yeniskinslithere-colors', JSON.stringify(ccolors)); | |
} | |
var currentColor = null, | |
ccrestore = document.createElement('div'); | |
ccrestore.innerHTML = 'You just deleted this color. <span class="yeniskinslithere-blue">Restore</span>'; | |
ccrestore.style.position = 'absolute'; | |
ccrestore.style.top = ccrestore.style.left = 0; | |
ccrestore.style.width = '100%'; | |
ccrestore.style.height = '46px'; | |
ccrestore.style.background = 'rgba(255,255,255,0.95)'; | |
ccrestore.style.lineHeight = '46px'; | |
ccrestore.style.textAlign = 'center'; | |
function newColor(rgb) { | |
var ccc = document.createElement('div'); | |
ccc.dataset.n = rrs.length; | |
ccc.style.position = 'relative'; | |
ccc.style.margin = '8px'; | |
cccs.appendChild(ccc); | |
var ccself = document.createElement('div'); | |
ccself.style.display = 'inline-block'; | |
ccself.style.boxSizing = 'content-box'; | |
ccself.style.width = '40px'; | |
ccself.style.height = '40px'; | |
ccself.style.border = '3px solid rgba(0,0,0,0.5)'; | |
ccc.appendChild(ccself); | |
var ccnames = document.createElement('div'), | |
ccr = document.createElement('div'), | |
ccg = document.createElement('div'), | |
ccb = document.createElement('div'); | |
ccnames.style.display = 'inline-block'; | |
ccnames.style.boxSizing = 'content-box'; | |
ccnames.style.margin = '0 8px'; | |
ccnames.style.width = '45px'; | |
ccr.textContent = 'Red: '; | |
ccg.textContent = 'Green: '; | |
ccb.textContent = 'Blue: '; | |
ccr.style.lineHeight = ccg.style.lineHeight = ccb.style.lineHeight = '10px'; | |
ccg.style.margin = '8px 0'; | |
ccc.appendChild(ccnames); | |
ccnames.appendChild(ccr); | |
ccnames.appendChild(ccg); | |
ccnames.appendChild(ccb); | |
var ccgrads = document.createElement('div'); | |
ccgrads.style.display = 'inline-block'; | |
ccgrads.style.width = '256px'; | |
ccc.appendChild(ccgrads); | |
var ccred = document.createElement('canvas'); | |
var ccgreen = document.createElement('canvas'); | |
var ccblue = document.createElement('canvas'); | |
ccred.style.cursor = ccgreen.style.cursor = ccblue.style.cursor = 'pointer'; | |
ccgreen.style.margin = '8px 0'; | |
var ccrgb = [ccred, ccgreen, ccblue]; | |
ccred.onmousedown = ccgreen.onmousedown = ccblue.onmousedown = function(e) { | |
currentColor = this; | |
body.onmousemove(e); | |
}; | |
ccred.width = ccgreen.width = ccblue.width = 256; | |
ccred.height = ccgreen.height = ccblue.height = 10; | |
ccgrads.appendChild(ccred); | |
ccgrads.appendChild(ccgreen); | |
ccgrads.appendChild(ccblue); | |
var ccdelete = document.createElement('div'); | |
ccdelete.innerHTML = '<span class="yeniskinslithere-blue">Delete</span>'; | |
ccdelete.style.display = 'inline-block'; | |
ccdelete.style.boxSizing = 'content-box'; | |
ccdelete.style.marginLeft = '8px'; | |
ccdelete.style.width = '50px'; | |
ccdelete.style.height = '46px'; | |
ccdelete.style.lineHeight = '46px'; | |
ccdelete.style.verticalAlign = 'top'; | |
ccdelete.firstChild.onclick = function() { | |
var ccback = ccrestore.cloneNode(true); | |
ccback.onclick = function() { | |
this.parentNode.removeChild(this); | |
}; | |
this.parentNode.parentNode.appendChild(ccback); | |
}; | |
ccc.appendChild(ccdelete); | |
setColor(rgb, ccc); | |
} | |
function parseColor(input) { | |
var m = input.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i); | |
if( m) { | |
return [+m[1],+m[2],+m[3]]; | |
} | |
} | |
function setColor(rgb, el) { | |
var n = el.dataset.n; | |
rrs[n] = rgb[0]; | |
ggs[n] = rgb[1]; | |
bbs[n] = rgb[2]; | |
for (var i = 0; i < 3; i++) { | |
el.firstChild.style.backgroundColor = 'rgb('+rgb[0]+','+rgb[1]+','+rgb[2]+')'; | |
var rgb0 = rgb.slice(), rgb1 = rgb.slice(); | |
rgb0[i] = 0, rgb1[i] = 255; | |
var ctx = el.childNodes[2].children[i].getContext('2d'); | |
var grad = ctx.createLinearGradient(0,0,256,0); | |
grad.addColorStop(0, 'rgb('+rgb0[0]+','+rgb0[1]+','+rgb0[2]+')'); | |
grad.addColorStop(1, 'rgb('+rgb1[0]+','+rgb1[1]+','+rgb1[2]+')'); | |
ctx.fillStyle = grad; | |
ctx.fillRect(0,0,256,10); | |
ctx.beginPath(); | |
ctx.arc(rgb[i],5,3,0,2*Math.PI); | |
ctx.strokeStyle = (rgb[0] + rgb[1] + rgb[2] < 350) ? '#fff' : '#000'; | |
ctx.lineWidth = 2; | |
ctx.stroke(); | |
} | |
} | |
function setColors() { | |
for (var i = 0; i < ccolors.length; i++) | |
newColor([ccolors[i][0], ccolors[i][1], ccolors[i][2]]); | |
applyColors(false); | |
} | |
var ccolors = JSON.parse(localStorage.getItem('yeniskinslithere-colors')) || [], | |
ncolors = rrs.length, | |
ccblackout = createWindow(), | |
ccdiv = ccblackout.firstChild; | |
var ccheader = document.createElement('h2'); | |
ccheader.textContent = 'Custom colors'; | |
ccdiv.appendChild(ccheader); | |
var cccs = document.createElement('div'); | |
ccdiv.appendChild(cccs); | |
var ccnew = document.createElement('div'); | |
ccnew.innerHTML = '<span class="yeniskinslithere-blue">New color</span>'; | |
ccnew.style.textAlign = 'center'; | |
ccnew.style.fontSize = '20px'; | |
ccnew.firstChild.onclick = function() { | |
newColor([255,255,255]); | |
}; | |
ccdiv.appendChild(ccnew); | |
var ccbtns = document.createElement('div'); | |
ccbtns.style.margin = '10px 0 6px 0'; | |
ccbtns.style.textAlign = 'center'; | |
ccdiv.appendChild(ccbtns); | |
var ccsave = makeTextBtn('Save', 36, 16, 18, 1).elem; | |
ccsave.style.position = 'relative'; | |
ccsave.style.display = 'inline-block'; | |
ccsave.style.removeProperty('box-shadow'); | |
ccsave.onclick = function() { | |
ccblackout.style.opacity = 0; | |
setTimeout(function() { | |
ccblackout.style.visibility = 'hidden'; | |
}, 500); | |
applyColors(); | |
}; | |
ccbtns.appendChild(ccsave); | |
var cccancel = makeTextBtn('Cancel', 36, 16, 18, 2).elem; | |
cccancel.style.position = 'relative'; | |
cccancel.style.display = 'inline-block'; | |
cccancel.style.marginLeft = '6px'; | |
cccancel.style.removeProperty('box-shadow'); | |
cccancel.onclick = function() { | |
ccblackout.style.opacity = 0; | |
setTimeout(function() { | |
ccblackout.style.visibility = 'hidden'; | |
}, 500); | |
rrs.splice(ncolors, rrs.length - ncolors); | |
ggs.splice(ncolors, ggs.length - ncolors); | |
bbs.splice(ncolors, bbs.length - ncolors); | |
while (cccs.firstChild) | |
cccs.removeChild(cccs.firstChild); | |
setColors(); | |
}; | |
ccbtns.appendChild(cccancel); | |
// </Custom Colors> | |
// <Skin Constructor> | |
var ss = setSkin; | |
setSkin = function(b, h) { | |
if (!snake) h = localStorage.getItem('snakercv'); | |
ss(b, h); | |
if (h > max_skin_cv) { | |
setTimeout(function() {b.rbcs = skins[h - max_skin_cv - 1];}, 0); | |
} | |
if (sc) setTimeout(workspace, 0); | |
}; | |
function newSkin() { | |
skins.push([9]); | |
localStorage.setItem('yeniskinslithere-skins', JSON.stringify(skins)); | |
setSkin(snake, max_skin_cv + skins.length); | |
} | |
function updateSkin() { | |
var toSave = JSON.parse(localStorage.getItem('yeniskinslithere-skins')); | |
skins[snake.rcv - max_skin_cv - 1] = snake.rbcs; | |
toSave[snake.rcv - max_skin_cv - 1] = JSON.parse(JSON.stringify(snake.rbcs)); | |
for (var i = 0; i < snake.rbcs.length; i++) | |
if (snake.rbcs[i] >= ncolors) toSave[snake.rcv - max_skin_cv - 1][i] = ~snake.rbcs[i] + ncolors; | |
localStorage.setItem('yeniskinslithere-skins', JSON.stringify(toSave)); | |
} | |
var sc = false; | |
function sfc(el, bottom = false) { | |
var prop = bottom ? 'bottom' : 'top'; | |
el.style.transition = '0.5s'; | |
el.style[prop] = parseInt(el.style[prop]) + (sc != bottom ? 250 : -250) + 'px'; | |
setTimeout(function() { | |
el.style.removeProperty('transition'); | |
}, 500); | |
} | |
function Constructor(onlyReset = false) { | |
if (!(onlyReset && !sc)) { | |
sfc(mc); | |
sfc(pskh); | |
sfc(nskh); | |
sfc(skodiv); | |
sfc(div, true); | |
sfc(scdiv, true); | |
sc ? scdiv.style.removeProperty('box-shadow') : scdiv.style.boxShadow = '0px -3px 2px rgba(0,0,0,0.5)'; | |
sc = !sc; | |
} | |
} | |
function workspace() { | |
while (sccss.firstChild) | |
sccss.removeChild(sccss.firstChild); | |
if (snake.rcv > max_skin_cv && snake.rcv <= max_skin_cv + skins.length) { | |
scdef.style.display = 'none'; | |
scadd.style.display = scskin.style.display = 'block'; | |
var colorStops = [0]; | |
for (var i = 1; i < snake.rbcs.length; i++) { | |
if (snake.rbcs[i-1] != snake.rbcs[i]) break; | |
if (i == snake.rbcs.length - 1) snake.rbcs = [snake.rbcs[0]]; | |
} | |
for (var i = 1; i < snake.rbcs.length; i++) | |
if (snake.rbcs[i] != snake.rbcs[i-1]) colorStops.push(i); | |
for (var i = 0; i < colorStops.length; i++) { | |
var sccs = document.createElement('div'); | |
sccs.dataset.position = colorStops[i]; | |
sccs.style.marginBottom = '1px'; | |
sccss.appendChild(sccs); | |
var sccolor = document.createElement('div'); | |
sccolor.textContent = 'Color:'; | |
sccolor.style.position = 'relative'; | |
sccolor.style.display = 'inline-block'; | |
sccolor.style.width = '125px'; | |
sccs.appendChild(sccolor); | |
var scc = colors[snake.rbcs[colorStops[i]]].cloneNode(); | |
scc.style.margin = '0 0 0 10px'; | |
scc.style.verticalAlign = 'middle'; | |
scc.onclick = function(e) { | |
e.stopPropagation(); | |
var sccolor = this.parentNode; | |
sccm.parentNode == sccolor ? sccolor.removeChild(sccm) : sccolor.appendChild(sccm); | |
}; | |
sccolor.appendChild(scc); | |
var sccells = document.createElement('div'); | |
sccells.textContent = 'Cells number:'; | |
sccells.style.display = 'inline-block'; | |
sccells.style.marginRight = '13px'; | |
sccs.appendChild(sccells); | |
var sccn = document.createElement('input'); | |
sccn.type = 'number'; | |
sccn.min = 1; | |
sccn.value = (colorStops.length - 1 == i ? snake.rbcs.length : colorStops[i+1]) - colorStops[i]; | |
if (colorStops.length == 1) sccn.disabled = true; | |
sccn.style.marginLeft = '10px'; | |
sccn.style.width = '50px'; | |
sccn.style.height = '20px'; | |
sccn.style.border = '1px solid #A9A9A9'; | |
sccn.style.fontSize = '12px'; | |
sccn.style.verticalAlign = 'middle'; | |
sccn.onchange = function() { | |
var sccs = this.parentNode.parentNode, | |
prevValue = (sccs.nextSibling ? +sccs.nextSibling.dataset.position : snake.rbcs.length) - +sccs.dataset.position; | |
if (isNaN(parseInt(this.value))) { | |
this.value = prevValue; return; | |
} | |
var args = [+sccs.dataset.position, 0]; | |
if (this.value > prevValue) | |
for (var i = 0; i < this.value - prevValue; i++) | |
args.push(snake.rbcs[args[0]]); | |
else args[1] = prevValue - this.value; | |
Array.prototype.splice.apply(snake.rbcs, args); | |
updateSkin(); | |
if (this.value == 0) workspace(); | |
else while (sccs = sccs.nextSibling) | |
sccs.dataset.position = +sccs.dataset.position + +this.value - prevValue; | |
}; | |
sccells.appendChild(sccn); | |
if (!sccn.disabled) { | |
var sccsd = document.createElement('div'); | |
sccsd.textContent = 'Delete'; | |
sccsd.className = 'yeniskinslithere-blue'; | |
sccsd.style.display = 'inline-block'; | |
sccsd.style.fontSize = '14px'; | |
sccsd.onclick = function() { | |
this.previousSibling.lastChild.value = 0; | |
this.previousSibling.lastChild.onchange(); | |
}; | |
sccs.appendChild(sccsd); | |
if (colorStops.length == 2) { | |
sccss.firstChild.appendChild(sccsd.cloneNode()); | |
} | |
} | |
} | |
} else { | |
scdef.style.display = 'block'; | |
scadd.style.display = scskin.style.display = 'none'; | |
} | |
}; | |
var sclink = document.createElement('div'); | |
sclink.className = 'yeniskinslithere-link'; | |
sclink.style.marginTop = '5px'; | |
sclink.style.fontSize = '16px'; | |
sclink.innerHTML = '<b>→ Create Your Skin ←</b>'; | |
sclink.onclick = function() { | |
Constructor(); | |
if (sc) snake.rcv <= max_skin_cv ? skins.length ? setSkin(snake, max_skin_cv + 1) : newSkin() : workspace(); | |
}; | |
div.appendChild(sclink); | |
var scdiv = document.createElement('div'); | |
scdiv.style.width = '100%'; | |
scdiv.style.height = '250px'; | |
scdiv.style.padding = '20px 7% 15px 7%'; | |
scdiv.style.boxSizing = 'border-box'; | |
scdiv.style.position = 'fixed'; | |
scdiv.style.bottom = '-250px'; | |
scdiv.style.left = 0; | |
scdiv.style.background = 'white'; | |
scdiv.style.fontFamily = 'Calibri, Tahoma, Arial, sans-serif'; | |
scdiv.style.overflow = 'auto'; | |
scdiv.style.zIndex = 100000000; | |
scdiv.style.transition = '0.5s'; | |
scdiv.onmousedown = function(e) { | |
e.stopPropagation(); | |
}; | |
body.appendChild(scdiv); | |
var schelp = document.createElement('div'); | |
schelp.style.display = 'inline-block'; | |
schelp.style.width = '40%'; | |
scdiv.appendChild(schelp); | |
var scheader = document.createElement('h2'); | |
scheader.innerHTML = '<span style="color:black"><a href="http://slithere.com" target="_blank">SLITHERE.COM [CLICK]</a></br><a href="http://diepioplay.com" target="_blank">DIEPIOPLAY.COM [CLICK]</a></br><a href="http://agarw.com" target="_blank">AGARW.COM [CLICK]</a></span>'; | |
scheader.style.margin = 0; | |
schelp.appendChild(scheader); | |
var scws = document.createElement('div'); | |
scws.style.display = 'inline-block'; | |
scws.style.width = '55%'; | |
scws.style.height = '100%'; | |
scws.style.float = 'right'; | |
scws.style.position = 'relative'; | |
scdiv.appendChild(scws); | |
var scdef = document.createElement('div'); | |
scdef.style.display = 'none'; | |
scdef.style.width = '100%'; | |
scdef.style.position = 'absolute'; | |
scdef.style.top = '50%'; | |
scdef.style.transform = 'translate(0, -50%)'; | |
scdef.style.textAlign = 'center'; | |
scdef.style.opacity = 0.75; | |
scws.appendChild(scdef); | |
var scsorry = document.createElement('div'); | |
scsorry.textContent = "Sorry, you can't change default skins."; | |
scdef.appendChild(scsorry); | |
var scnew = document.createElement('div'); | |
scnew.textContent = 'Create new'; | |
scnew.className = 'yeniskinslithere-blue'; | |
scnew.style.fontWeight = 'bold'; | |
scnew.onclick = newSkin; | |
scdef.appendChild(scnew); | |
var sccss = document.createElement('div'); | |
scws.appendChild(sccss); | |
var scadd = document.createElement('div'); | |
scadd.innerHTML = '<span class="yeniskinslithere-blue">Add color stop</span>'; | |
scadd.style.display = 'none'; | |
scadd.firstChild.onclick = function() { | |
var prevColor = +sccss.lastChild.firstChild.childNodes[1].dataset.color, push; | |
if (sccss.firstChild.childNodes[1].lastChild.disabled) { | |
snake.rbcs = []; | |
for (var i = 0; i < 7; i++) | |
snake.rbcs.push(prevColor); | |
} | |
do { | |
push = Math.floor(Math.random() * rrs.length); | |
} while (push == prevColor); | |
for (var i = 0; i < 7; i++) | |
snake.rbcs.push(push); | |
updateSkin(); | |
workspace(); | |
}; | |
scws.appendChild(scadd); | |
var scskin = document.createElement('div'); | |
scskin.style.display = 'none'; | |
scskin.style.marginTop = '7px'; | |
scws.appendChild(scskin); | |
var sccreate = document.createElement('span'); | |
sccreate.textContent = 'Create new skin'; | |
sccreate.className = 'yeniskinslithere-blue'; | |
sccreate.onclick = newSkin; | |
scskin.appendChild(sccreate); | |
ayircmi = ayircmi.cloneNode(); | |
scskin.appendChild(ayircmi); | |
var scdelete = document.createElement('span'); | |
scdelete.textContent = 'Delete this skin'; | |
scdelete.className = 'yeniskinslithere-blue'; | |
scdelete.onclick = function() { | |
skins.splice(snake.rcv - max_skin_cv - 1, 1); | |
localStorage.setItem('yeniskinslithere-skins', JSON.stringify(skins)); | |
setSkin(snake, snake.rcv - 1); | |
}; | |
scskin.appendChild(scdelete); | |
var sccm = document.createElement('div'), colors; | |
sccm.style.position = 'absolute'; | |
sccm.style.top = '0px'; | |
sccm.style.left = '-310px'; | |
sccm.style.padding = '3px 7px'; | |
sccm.style.width = '350px'; | |
sccm.style.border = '1px solid #A9A9A9'; | |
sccm.style.background = 'white'; | |
sccm.style.zIndex = 100000001; | |
sccm.onclick = function(e) { | |
e.stopPropagation(); | |
}; | |
var scdefc = document.createElement('div'); | |
scdefc.textContent = 'Default colors:'; | |
var sccc = document.createElement('div'); | |
sccc.textContent = 'Custom colors:'; | |
var sccset = document.createElement('div'); | |
sccset.innerHTML = '<span class="yeniskinslithere-blue">Color settings</span>'; | |
sccset.firstChild.className = 'yeniskinslithere-blue'; | |
sccset.firstChild.onclick = function() { | |
ccblackout.style.visibility = 'visible'; | |
ccblackout.style.opacity = 1; | |
sccm.parentNode.removeChild(sccm); | |
}; | |
function colorMenu() { | |
colors = [], sccm.innerHTML = ''; | |
sccm.appendChild(scdefc); | |
for (var i = 0; i < rrs.length; i++) { | |
if (i == ncolors) | |
sccm.appendChild(sccc); | |
var scc = document.createElement('div'); | |
scc.dataset.color = i; | |
scc.style.display = 'inline-block'; | |
scc.style.margin = '2px'; | |
scc.style.width = '18px'; | |
scc.style.height = '18px'; | |
scc.style.border = '1px solid rgba(0,0,0,0.75)'; | |
scc.style.backgroundColor = 'rgb('+rrs[i]+','+ggs[i]+','+bbs[i]+')'; | |
if (i == 10) scc.style.backgroundImage = ' url("http://agarw.com/chrome2kafa/miniadd1.png")'; | |
if (i == 19) scc.style.backgroundImage = ' url("http://agarw.com/chrome2kafa/miniadd2.png")'; | |
if (i == 20) scc.style.backgroundImage = ' url("http://agarw.com/chrome2kafa/miniadd3.png")'; | |
if (i == 24) scc.style.boxShadow = 'inset 0 0 8px #CCCC00'; | |
if (i == 26) scc.style.boxShadow = 'inset 0 0 8px #00FFCC'; | |
scc.style.cursor = 'pointer'; | |
scc.onclick = function() { | |
for (var j = 0; j < sccm.parentNode.nextSibling.lastChild.value; j++) | |
snake.rbcs[+sccm.parentNode.parentNode.dataset.position + j] = +this.dataset.color; | |
updateSkin(); | |
workspace(); | |
}; | |
sccm.appendChild(scc); | |
colors.push(scc); | |
} | |
sccm.appendChild(sccset); | |
} | |
// </Skin Constructor> | |
// <Special Skins> | |
var ssblackout = createWindow(), | |
ssdiv = ssblackout.firstChild; | |
var ssheader = document.createElement('h2'); | |
ssheader.textContent = 'Special skins'; | |
ssdiv.appendChild(ssheader); | |
var ssp = document.createElement('div'); | |
ssp.textContent = 'Check the skins you want to use:'; | |
ssp.style.textAlign = 'center'; | |
ssdiv.appendChild(ssp); | |
var ssskins = document.createElement('div'); | |
ssskins.style.marginTop = '5px'; | |
ssdiv.appendChild(ssskins); | |
var sskins = [ | |
{ | |
opt: 'usa', | |
text: 'usa', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/useheads1.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7,9,7,9,7,9,7,9,7,9,7,10,10,10,10,10,10,10,10,10] | |
} | |
}, { | |
opt: 'rus', | |
text: 'rus', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/rshead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [9,9,9,9,9,1,1,1,1,1,7,7,7,7,7] | |
} | |
}, { | |
opt: 'can', | |
text: 'can', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/canhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7,7,9,9,7,7,9,9,7,7,7,9,9,9] | |
} | |
}, { | |
opt: 'fr', | |
text: 'fr', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/frhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [14,14,14,14,14,9,9,9,9,9,7,7,7,7,7] | |
} | |
}, { | |
opt: 'ing', | |
text: 'ing', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/inghead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [9,9,9,9,9,21,21,21,21,21,7,7,7,7,7] | |
} | |
}, { | |
opt: 'tr', | |
text: 'tr', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/trhead1.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7,7,7,9,9,9] | |
} | |
}, { | |
opt: 'ger', | |
text: 'ger', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/grhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [11,11,11,11,11,7,7,7,7,7,12,12,12,12,12] | |
} | |
}, { | |
opt: 'neth', | |
text: 'neth', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/nethead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7,7,7,7,9,9,9,9,16,16,16,16] | |
} | |
}, { | |
opt: 'spa', | |
text: 'spa', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/spahead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7,7,7,7,7,7,7,7,18,18,18,18,18,18,18,18] | |
} | |
}, { | |
opt: 'por', | |
text: 'por', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/porthead.png', | |
skin: { | |
atc1: "#000000", | |
atc2: "#009933", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7,7,7,7,7,7,7,13,13,13,13] | |
} | |
}, { | |
opt: 'ita', | |
text: 'ita', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/itahead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7,7,7,7,7,9,9,9,9,9,13,13,13,13,13] | |
} | |
}, { | |
opt: 'cin', | |
text: 'cin', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/cinhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7, 18,7,7] | |
} | |
}, { | |
opt: 'ind', | |
text: 'ind', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/indhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [5,5,5,5,5,5,5,9,9,9,9,9,9,9,13,13,13,13,13,13,13] | |
} | |
}, { | |
opt: 'mex', | |
text: 'mex', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/mexhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [13,13,13,13,9,9,9,9,7,7,7,7] | |
} | |
}, { | |
opt: 'bra', | |
text: 'bra', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/brhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [3,3,3,3,3,3,3,18,18,18,18,18,18,20,19,20,19,20,19,20,18,18,18,18,18,18] | |
} | |
}, { | |
opt: 'arg', | |
text: 'arg', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/arghead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [ncolors+3,ncolors+3,ncolors+3,ncolors+3,ncolors+3,ncolors+3,ncolors+3,9,9,9,9,9,9,9] | |
} | |
}, { | |
opt: 'isr', | |
text: 'isr', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/isrhead.png', | |
skin: { | |
atc1: "#005cd7", | |
atc2: "#005cd7", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [9,9,9,9,9,16,16,16,16,16] | |
} | |
}, { | |
opt: 'den', | |
text: 'den', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/denhead.png', | |
skin: { | |
atc1: "#999999", | |
atc2: "#ff0000", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [9,9,9,9,9,9,9,7,7,7,7,9,7,7,7,7] | |
} | |
}, { | |
opt: 'aust', | |
text: 'aust', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/austhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [16,16,16,16,9,9,9,9,7,7,7,7] | |
} | |
}, { | |
opt: 'austrai', | |
text: 'austrai', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/austrhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7,7,7,7,11,11,11,11,9,9,9,9] | |
} | |
}, { | |
opt: 'jpn', | |
text: 'jpn', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/jpnhead.png', | |
skin: { | |
atc1: "#ff0000", | |
atc2: "#ff0000", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,7,7] | |
} | |
}, | |
{ | |
opt: 'skore', | |
text: 'skore', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/skore.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [16,16,16,16,7,7,7,7,9,9,9,9] | |
} | |
}, | |
{ | |
opt: 'nkore', | |
text: 'nkore', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/nkore.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7,7,7,7,16,16,16,16,16,9,9] | |
} | |
}, | |
{ | |
opt: 'nor', | |
text: 'nor', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/norhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7,7,7,7,7,7,7,9,16,16,16,16,16,16,16,9] | |
} | |
}, { | |
opt: 'swe', | |
text: 'swe', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/swehead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [15,15,15,15,15,15,15,4,4,4,4,4,4,4] | |
} | |
}, { | |
opt: 'ukr', | |
text: 'ukr', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/ukrhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [23,23,23,23,23,23,23,23,23,18,18,18,18,18,18,18,18,18] | |
} | |
}, { | |
opt: 'indo', | |
text: 'indo', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/indohead.png', | |
skin: { | |
atc1: "#999999", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7,7,7,7,7,9,9,9,9,9] | |
} | |
}, { | |
opt: 'phli', | |
text: 'phli', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/phlihead.png', | |
skin: { | |
atc1: "#999999", | |
atc2: "#ff0000", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [9,9,9,9,16,16,16,16,7,7,7,7] | |
} | |
}, { | |
opt: 'rom', | |
text: 'rom', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/romhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [16,16,16,16,16,16,16,18,18,18,18,18,18,18,7,7,7,7,7,7,7] | |
} | |
}, { | |
opt: 'gerg', | |
text: 'gerg', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/gerghead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7,7,7,7,7,7,7,7,9,9,9,9,9,9,9,9] | |
} | |
}, { | |
opt: 'serb', | |
text: 'serb', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/serbhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7,7,7,16,16,16,9,9,9] | |
} | |
}, { | |
opt: 'alg', | |
text: 'alg', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/alghead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#047a18", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [9,9,9,9,9,13,13,13,13,13,7,7,7,7,7] | |
} | |
}, { | |
opt: 'alb', | |
text: 'alb', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/albhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7,7,7,7,7,7,7,7,11,11,11,11,11,11,11,11] | |
} | |
}, { | |
opt: 'yun', | |
text: 'yun', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/yunhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [21,21,21,21,21,21,21,21,9,9,9,9,9,9,9,9] | |
} | |
}, { | |
opt: 'az', | |
text: 'az', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/azhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [ncolors+3,ncolors+3,ncolors+3,ncolors+3,ncolors+3,ncolors+2,ncolors+2,ncolors+2,ncolors+2,ncolors+2,ncolors+1,ncolors+1,ncolors+1,ncolors+1,ncolors+1] | |
} | |
}, { | |
opt: 'tha', | |
text: 'tha', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/thahead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [7,7,7,7,7,7,7,9,9,9,16,16,16,16,16,9,9,9] | |
} | |
}, { | |
opt: 'bosna', | |
text: 'bosna', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/boshead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [ncolors+3,ncolors+3,ncolors+3,18,18,18] | |
} | |
}, { | |
opt: 'vin', | |
text: 'vin', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/vinhead.png', | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [ncolors+2,ncolors+2,ncolors+2,18,18] | |
} | |
}, { | |
opt: 'pol', | |
text: 'pol', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/polhead2.png', | |
skin: { | |
atc1: "#ff0000", | |
atc2: "#ff0000", | |
blbx: -30, | |
blby: -120, | |
bsc: .15, | |
rbcs: [9,9,9,9,9,9,9,7,7,7,7,7,7,7] | |
} | |
}, { | |
opt: 'barca', | |
text: 'barca', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/barcahead.png', | |
skin: { | |
atc1: "#004d98", | |
atc2: "#a50044", | |
blbx: -35, | |
blby: -150, | |
blbh: 300, | |
bsc: .15, | |
rbcs: [21,21,21,21,7,7,7,7] | |
} | |
}, { | |
opt: 'rm', | |
text: 'rm', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/rmhead.png', | |
skin: { | |
atc1: "#033e86", | |
atc2: "#033e86", | |
blbx: -35, | |
blby: -131, | |
blbh: 285, | |
bsc: .16, | |
rbcs: [9] | |
} | |
}, { | |
opt: 'atm', | |
text: 'atm', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/atmhead.png', | |
skin: { | |
atc1: "#0004FF", | |
atc2: "#000000", | |
blbx: -15, | |
blby: -170, | |
bsc: .15, | |
rbcs: [7,7,7,9,9,9,21,21,21] | |
} | |
}, { | |
opt: 'chelsea', | |
text: 'chelsea', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/chead.png', | |
skin: { | |
atc1: "transparent", | |
atc2: "#fff", | |
blbx: -15, | |
blby: -155, | |
bsc: .16, | |
rbcs: [16,16,16,16,16,9] | |
} | |
}, { | |
opt: 'live', | |
text: 'live', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/livehead.png', | |
skin: { | |
atc1: "transparent", | |
atc2: "#fff", | |
blbx: -15, | |
blby: -155, | |
bsc: .16, | |
rbcs: [7,7,7,7,7,9] | |
} | |
}, { | |
opt: 'arse', | |
text: 'arse', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/arseheadz.png', | |
skin: { | |
atc1: "#0004FF", | |
atc2: "#fff", | |
blbx: -15, | |
blby: -170, | |
bsc: .15, | |
rbcs: [7,7,7,7,7,7,9,16,16,9] | |
} | |
}, { | |
opt: 'mcity', | |
text: 'mcity', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/mancity.png', | |
skin: { | |
atc1: "#97ffff", | |
atc2: "#fff", | |
blbx: -15, | |
blby: -170, | |
bsc: .15, | |
rbcs: [12,12,12,12,12,9,ncolors+3,ncolors+3,ncolors+3,ncolors+3,ncolors+3,9] | |
} | |
}, { | |
opt: 'manu', | |
text: 'manu', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/manuhead.png', | |
skin: { | |
atc1: "#ff0000", | |
atc2: "#fff", | |
blbx: -15, | |
blby: -170, | |
bsc: .15, | |
rbcs: [18,18,18,18,18,11,7,7,7,7,7,11] | |
} | |
}, { | |
opt: 'tote', | |
text: 'tote', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/totte.png', | |
skin: { | |
atc1: "transparent", | |
atc2: "#fff", | |
blbx: -15, | |
blby: -170, | |
bsc: .16, | |
rbcs: [16,16,16,16,16,9] | |
} | |
}, { | |
opt: 'lei', | |
text: 'lei', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/leiheadsz.png', | |
skin: { | |
atc1: "transparent", | |
atc2: "#0883e0", | |
blbx: -15, | |
blby: -170, | |
bsc: .15, | |
rbcs: [9,9,9,9,9,9,16,16,16,16,16,16] | |
} | |
}, { | |
opt: 'psg', | |
text: 'psg', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/psghead1.png', | |
skin: { | |
atc1: "#2a1269", | |
atc2: "#2a1269", | |
blbx: -35, | |
blby: -168, | |
blbh: 330, | |
bsc: .15, | |
rbcs: [21,21,21,9,7,9] | |
} | |
}, { | |
opt: 'bmnh', | |
text: 'bmnh', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/bmunihhead.png', | |
skin: { | |
atc1: "#000000", | |
atc2: "#0300e0", | |
blbx: -15, | |
bsc: .15, | |
rbcs: [7,7,7,7,7,7,7,7,21,21,21,21,21,21,21] | |
} | |
}, { | |
opt: 'drd', | |
text: 'drd', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/drdmundhead.png', | |
skin: { | |
atc1: "#111111", | |
atc2: "#222222", | |
blbx: -15, | |
bsc: .15, | |
rbcs: [18,18,18,18,11,11,11,11] | |
} | |
}, { | |
opt: 'juv', | |
text: 'juv', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/juvehead.png', | |
skin: { | |
atc1: "#000000", | |
atc2: "#ffffff", | |
blbx: -35, | |
blby: -175, | |
bsc: .15, | |
rbcs: [9,9,9,9,9,11,11,11,11,11] | |
} | |
}, { | |
opt: 'mil', | |
text: 'mil', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/milahead.png', | |
skin: { | |
atc1: "#000000", | |
atc2: "#ffffff", | |
blbx: -35, | |
blby: -194, | |
blbh: 360, | |
bsc: .16, | |
rbcs: [11,11,11,11,7,7,7,7] | |
} | |
}, { | |
opt: 'inter', | |
text: 'inter', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/inthead.png', | |
skin: { | |
atc1: "#0004FF", | |
atc2: "#000000", | |
blbx: -15, | |
bsc: .15, | |
rbcs: [11,11,11,11,1,1,1,1] | |
} | |
}, { | |
opt: 'Fenerbahce', | |
text: 'Fenerbahce', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/fenerbahcehead1.png', | |
skin: { | |
atc1: "#0004FF", | |
atc2: "#EEFF00", | |
blbx: -15, | |
bsc: .15, | |
rbcs: [18,18,18,18,16,16,16,16] | |
} | |
}, { | |
opt: 'gs', | |
text: 'gs', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/gshead1.png', | |
skin: { | |
atc1: "#FF0000", | |
atc2: "#EEFF00", | |
blbx: -40, | |
bsc: .15, | |
rbcs: [18,18,18,18,7,7,7,7] | |
} | |
}, { | |
opt: 'bjk', | |
text: 'bjk', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/bjkhead.png', | |
skin: { | |
atc1: "#000000", | |
atc2: "#ffffff", | |
blbx: -35, | |
blby: -168, | |
bsc: .15, | |
rbcs: [11,11,11,11,9,9,9,9] | |
} | |
}, { | |
opt: 'Donut', | |
text: 'Donut', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/headdonut.png', | |
skin: { | |
atc1: "#003300", | |
atc2: "#66cc00", | |
bsc: .15, | |
blbx: -16, | |
rbcs: [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,ncolors,ncolors,ncolors,ncolors,ncolors,ncolors,ncolors,ncolors,ncolors,ncolors,ncolors+1,ncolors+1,ncolors+1,ncolors+1,ncolors+1,ncolors+1,ncolors+1,ncolors+1,ncolors+1,ncolors+1] | |
} | |
}, { | |
opt: 'elmas', | |
text: 'elmas', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/elmashead.png', | |
skin: { | |
atc1: "#000000", | |
atc2: "#69D0F1", | |
blbx: -20, | |
blby: -125, | |
bsc: .18, | |
rbcs: [23] | |
} | |
}, { | |
opt: 'itf', | |
text: 'itf', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/tythead.png', | |
skin: { | |
atc1: "transparent", | |
atc2: "transparent", | |
blbx: -20, | |
blby: -101, | |
atba: true, | |
antenna: true, | |
abrot: true, | |
bsc: 0.25, | |
er: 2, | |
alpha: 1, | |
scale: 0.28, | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
ec: "#000000", | |
eca: 1, | |
ppc: 'transparent', | |
swell: 0.04, | |
rbcs: [9, 9, 9, 22, 22, 22] | |
} | |
}, { | |
opt: 'prt', | |
text: 'prt', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/prtyhead.png', | |
skin: { | |
atc1: "transparent", | |
atc2: "transparent", | |
blbx: -20, | |
blby: -101, | |
atba: true, | |
antenna: true, | |
abrot: true, | |
bsc: 0.21, | |
alpha: 1, | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
eca: 1, | |
rbcs: [3,4,5,6,7,8,2,10] | |
} | |
}, { | |
opt: 'kng', | |
text: 'kng', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/knghead.png', | |
skin: { | |
atc1: "transparent", | |
atc2: "transparent", | |
blbx: -20, | |
blby: -171, | |
atba: true, | |
antenna: true, | |
abrot: true, | |
blbh: 540, | |
blbw: 430, | |
alpha: 1, | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
eca: 1, | |
rbcs: [5,5,5,5,5,5,5,11] | |
} | |
}, { | |
opt: 'spr', | |
text: 'spr', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/pelerines.png', | |
skin: { | |
atc1: "transparent", | |
atc2: "transparent", | |
ppc: "#ff0000", | |
blbx: 0, | |
blby: -246, | |
atba: true, | |
antenna: true, | |
abrot: true, | |
blbh: 790, | |
blbw: 710, | |
alpha: 1, | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
eca: 1, | |
rbcs: [7,7,7,7,11] | |
} | |
}, { | |
opt: 'ninja', | |
text: 'ninja', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/ninjasowr.png', | |
skin: { | |
atc1: "transparent", | |
atc2: "#fff", | |
ec: "#222", | |
ppc: "#555", | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
blbx: -105, | |
bsc: .20, | |
rbcs: [11] | |
} | |
}, { | |
opt: 'tramp', | |
text: 'tramp', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/tramphead1.png', | |
skin: { | |
atc1: "transparent", | |
atc2: "transparent", | |
blbx: -210, | |
blby: -165, | |
atba: true, | |
antenna: true, | |
abrot: true, | |
bsc: 0.15, | |
alpha: 1, | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
eca: 0, | |
ppc: 'transparent', | |
rbcs: [5] | |
} | |
}, { | |
opt: 'mari', | |
text: 'mari', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/marihead.png', | |
skin: { | |
atc1: "transparent", | |
atc2: "transparent", | |
blbx: -230, | |
blby: -150, | |
atba: true, | |
antenna: true, | |
abrot: true, | |
bsc: 0.17, | |
alpha: 1, | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
eca: 0, | |
ppc: 'transparent', | |
rbcs: [7,7,7,7,7,7,7,7,16,16,16] | |
} | |
}, { | |
opt: 'angr', | |
text: 'angr', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/angrhead.png', | |
skin: { | |
atc1: "transparent", | |
atc2: "transparent", | |
blbx: -230, | |
blby: -150, | |
atba: true, | |
antenna: true, | |
abrot: true, | |
bsc: 0.16, | |
alpha: 1, | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
eca: 0, | |
ppc: 'transparent', | |
rbcs: [7] | |
} | |
}, { | |
opt: 'hulk', | |
text: 'hulk', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/hulkhead3.png', | |
skin: { | |
atc1: "transparent", | |
atc2: "transparent", | |
blbx: -246, | |
blby: -160, | |
atba: true, | |
antenna: true, | |
abrot: true, | |
bsc: 0.15, | |
alpha: 1, | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
eca: 0, | |
ppc: 'transparent', | |
rbcs: [ncolors-3] | |
} | |
}, { | |
opt: 'ame', | |
text: 'ame', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/amerishield.png', | |
skin: { | |
atc1: "transparent", | |
atc2: "transparent", | |
blbx: 0, | |
blby: -157, | |
bsc: 0.18, | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
eca: 1, | |
rbcs: [16, 16, 16, 16, 7, 7, 7, 9, 9, 10, 10, 10, 9, 9, 7, 7, 7] | |
} | |
}, { | |
opt: 'spilog', | |
text: 'spilog', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/spilog.png', | |
skin: { | |
ec: "transparent", | |
ppc: "transparent", | |
atc1: "transparent", | |
atc2: "transparent", | |
blbx: -250, | |
bsc: 0.15, | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
rbcs: [7,7,7,7,7,7,7,7,7,11,11,11,11] | |
} | |
}, { | |
opt: 'irolog', | |
text: 'irolog', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/irologs.png', | |
skin: { | |
ec: "transparent", | |
ppc: "transparent", | |
atc1: "transparent", | |
atc2: "transparent", | |
blbx: -250, | |
bsc: 0.15, | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
rbcs: [12, 7, 7, 7, 7, 9, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7] | |
} | |
}, { | |
opt: 'hulklog', | |
text: 'hulklog', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/hulklogsz.png', | |
skin: { | |
ec: "transparent", | |
ppc: "transparent", | |
atc1: "transparent", | |
atc2: "transparent", | |
blbx: -250, | |
bsc: 0.15, | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
rbcs: [13,ncolors-3,ncolors-3,ncolors-3,ncolors-3,ncolors-3,ncolors-3,ncolors-3] | |
} | |
}, { | |
opt: 'batmanlog', | |
text: 'batmanlog', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/batmanlogz.png', | |
skin: { | |
ec: "#333333", | |
ppc: "#ffffff", | |
atc1: "#000000", | |
atc2: "#000000", | |
blbx: -20, | |
bsc: 0.15, | |
atx: new Float32Array(10), | |
aty: new Float32Array(10), | |
atvx: new Float32Array(10), | |
atvy: new Float32Array(10), | |
atax: new Float32Array(10), | |
atay: new Float32Array(10), | |
rbcs: [11,11,11,11,18] | |
} | |
}, { | |
opt: 'superlog', | |
text: 'superlog', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/superlog.png', | |
skin: { | |
ec: "#ff0000", | |
ppc: "#000000", | |
atc1: "#000000", | |
atc2: "#000000", | |
blbx: 0, | |
bsc: 0.15, | |
smell: 0.01, | |
atx: new Float32Array(10), | |
aty: new Float32Array(10), | |
atvx: new Float32Array(10), | |
atvy: new Float32Array(10), | |
atax: new Float32Array(10), | |
atay: new Float32Array(10), | |
rbcs: [11,11,11,11,7] | |
} | |
}, { | |
opt: 'taco', | |
text: 'taco', | |
bulb: 'http://agarw.com/chrome2kafa/tacohead.png', | |
initial: true, | |
skin: { | |
atc1: "transparent", | |
atc2: "#ca7f4c", | |
blbh: 270, | |
blbw: 310, | |
bsc: 0.18, | |
blby: -135, | |
blbx: -30, | |
atx: new Float32Array(9), | |
aty: new Float32Array(9), | |
atvx: new Float32Array(9), | |
atvy: new Float32Array(9), | |
atax: new Float32Array(9), | |
atay: new Float32Array(9), | |
rbcs: [5] | |
} | |
}, { | |
opt: 'thug', | |
text: 'thug', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/thuglifes.png', | |
skin: { | |
ec: "transparent", | |
ppc: "transparent", | |
atc1: "transparent", | |
atc2: "transparent", | |
blbx: -260, | |
bsc: 0.15, | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
rbcs: [12,11,11,11,11,11,11,11,11,11] | |
} | |
}, { | |
opt: 'troll', | |
text: 'troll', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/trollhead.png', | |
skin: { | |
ec: "transparent", | |
ppc: "transparent", | |
atc1: "transparent", | |
atc2: "transparent", | |
blbx: -220, | |
bsc: 0.16, | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
rbcs: [9] | |
} | |
}, { | |
opt: 'cre', | |
text: 'cre', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/crehead.png', | |
skin: { | |
ec: "transparent", | |
ppc: "transparent", | |
atc1: "transparent", | |
atc2: "transparent", | |
blbx: -260, | |
bsc: 0.13, | |
atx: new Float32Array(2), | |
aty: new Float32Array(2), | |
atvx: new Float32Array(2), | |
atvy: new Float32Array(2), | |
atax: new Float32Array(2), | |
atay: new Float32Array(2), | |
rbcs: [3] | |
} | |
}, { | |
opt: 'balon', | |
text: 'balon', | |
bulb: 'http://agarw.com/chrome2kafa/balonhead.png', | |
initial: true, | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
blbh: 270, | |
blbw: 310, | |
blby: -135, | |
blbx: -30, | |
atx: new Float32Array(13), | |
aty: new Float32Array(13), | |
atvx: new Float32Array(13), | |
atvy: new Float32Array(13), | |
atax: new Float32Array(13), | |
atay: new Float32Array(13), | |
rbcs: [7] | |
} | |
}, { | |
opt: 'ant', | |
text: 'ant', | |
initial: true, | |
skin: { | |
atc1: "#ffffff", | |
atc2: "#ffffff", | |
atx: new Float32Array(30), | |
aty: new Float32Array(30), | |
atvx: new Float32Array(30), | |
atvy: new Float32Array(30), | |
atax: new Float32Array(30), | |
atay: new Float32Array(30), | |
rbcs: [11] | |
} | |
}, { | |
opt: 'RayDay', | |
text: 'RayDay', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/headcr.png', | |
skin: { | |
atc1: "#440000", | |
atc2: "#ff3300", | |
bsc: .15, | |
rbcs: [ncolors+2] | |
} | |
}, { | |
opt: 'Meganism', | |
text: 'Meganism', | |
initial: true, | |
bulb: 'http://agarw.com/chrome2kafa/headhand.png', | |
skin: { | |
atc1: "#1d3245", | |
atc2: "#44d4ff", | |
blbx: -35, | |
bsc: .25, | |
rbcs: [ncolors+3] | |
}, | |
deg: -90 | |
} | |
], scolors = [[179,74,0],[153,255,0],[255,25,0],[0,213,255],[0,213,255]]; | |
for (var i = 0; i < scolors.length; i++) { | |
rrs.push(scolors[i][0]); | |
ggs.push(scolors[i][1]); | |
bbs.push(scolors[i][2]); | |
applyColor(ncolors++); | |
} | |
for (var i = 0; i < sskins.length; i++) {(function(i){ | |
var s = sskins[i], skin = s.skin, | |
bulb = document.createElement("canvas"), img = document.createElement("img"); | |
bulb.width = 320; | |
bulb.height = 320; | |
img.onload = function() { | |
f = bulb.getContext('2d'); | |
f.drawImage(img, 0, 0); | |
}; | |
img.src = s.bulb; | |
var ss = setSkin; | |
s.n = max_skin_cv + 1; | |
setSkin = function(b, h) { | |
if (!snake) h = localStorage.getItem('snakercv'); | |
ss(b, h); | |
if (h == s.n && switches[s.opt]) { | |
b.eca = 1; | |
b.antenna = !0; | |
b.atba = 0; | |
b.atwg = !0; | |
b.atia = 1; | |
b.abrot = !0; | |
c = 9; | |
b.atx = new Float32Array(c); | |
b.aty = new Float32Array(c); | |
b.atvx = new Float32Array(c); | |
b.atvy = new Float32Array(c); | |
b.atax = new Float32Array(c); | |
b.atay = new Float32Array(c); | |
for (--c; 0 <= c; c--) b.atx[c] = b.xx, b.aty[c] = b.yy; | |
b.bulb = bulb; | |
b.blbx = 5; | |
b.blby = -160; | |
b.blbw = 320; | |
b.blbh = 320; | |
b.bsc = .15; | |
b.blba = 1; | |
for (var prop in skin) { | |
b[prop] = skin[prop]; | |
} | |
} | |
}; | |
var ssskin = document.createElement('div'); | |
ssskins.appendChild(ssskin); | |
function switchSkin() { | |
max_skin_cv += switches[s.opt] ? 1 : -1; | |
for (var j = i+1; j < sskins.length; j++) { | |
sskins[j].n += switches[s.opt] ? 1 : -1; | |
} | |
if (snake && snake.rcv >= s.n) setSkin(snake, snake.rcv + (switches[s.opt] ? 1 : -1)); | |
} | |
createSwitch(ssskin, s.opt, s.text, switchSkin, s.initial); | |
ssskin.lastChild.style.display = 'inline-block'; | |
var sslogo = img.cloneNode(); | |
sslogo.style.marginLeft = '7px'; | |
sslogo.style.width = sslogo.style.height = '26px'; | |
sslogo.style.verticalAlign = 'middle'; | |
sslogo.style.transform = 'rotate(' + (s.deg || 180) + 'deg)'; | |
ssskin.appendChild(sslogo); | |
var sswrap = document.createElement('div'); | |
sswrap.style.float = 'right'; | |
sswrap.style.display = 'none'; | |
ssskin.appendChild(sswrap); | |
var sssub = document.createElement('div'); | |
sssub.id = 'yeniskinslithere-' + s.opt + '-sub'; | |
sssub.dataset.channel = JSON.stringify(s.channel); | |
sswrap.appendChild(sssub); | |
})(i);} | |
var ssok = makeTextBtn('OK', 36, 16, 18, 1).elem; | |
ssok.style.position = 'relative'; | |
ssok.style.margin = '8px auto 5px auto'; | |
ssok.style.removeProperty('box-shadow'); | |
ssok.onclick = function() { | |
ssblackout.style.opacity = 0; | |
setTimeout(function() { | |
ssblackout.style.visibility = 'hidden'; | |
for (var i = 0; i < ssskins.childNodes.length; i++) { | |
ssskins.childNodes[i].lastChild.style.display = 'none'; | |
} | |
}, 500); | |
}; | |
ssdiv.appendChild(ssok); | |
// </Special Skins> | |
setColors(); | |
colorMenu(); | |
var skins = JSON.parse(localStorage.getItem('yeniskinslithere-skins')) || [], storageSkins = JSON.parse(JSON.stringify(skins)); | |
if (!(skins instanceof Array)) skins = []; | |
for (var i = 0; i < skins.length; i++) | |
for (var j = 0; j < skins[i].length; j++) { | |
if (-skins[i][j] > ccolors.length) storageSkins[i][j] = skins[i][j] = -ccolors.length, localStorage.setItem('yeniskinslithere-skins', JSON.stringify(storageSkins)); | |
if (skins[i][j] < 0) skins[i][j] = ~skins[i][j] + ncolors; | |
} | |
cskh.onclick = function() { | |
div.style.display = 'block'; | |
setTimeout(function() { | |
div.style.opacity = 1; | |
}, 0); | |
if (localStorage.getItem('snakercv') > max_skin_cv + skins.length) setSkin(snake, max_skin_cv + skins.length), localStorage.setItem('snakercv', max_skin_cv + skins.length); | |
}; | |
skodiv.lastChild.onclick = function() { | |
div.style.opacity = 0; | |
setTimeout(function() { | |
div.style.display = 'none'; | |
}, 1000); | |
Constructor(true); | |
}; | |
psk.onclick = function() { | |
if (playing && snake) { | |
var c = snake.rcv; | |
c--; | |
0 > c && (c = max_skin_cv + skins.length); | |
setSkin(snake, c); | |
} | |
return !1; | |
}; | |
nsk.onclick = function() { | |
if (playing && snake) { | |
var c = snake.rcv; | |
c++; | |
c > max_skin_cv + skins.length && (c = 0); | |
setSkin(snake, c); | |
} | |
return !1; | |
}; | |
var onkeyup = document.onkeyup; | |
document.onkeyup = function(e) { | |
onkeyup(); | |
switch (e.which) { | |
case 87: | |
Constructor(true); | |
csinput.checked = !csinput.checked; | |
csinput.onchange(); | |
break; | |
} | |
}; | |
body.onclick = function() { | |
if (sccm.parentNode) sccm.parentNode.removeChild(sccm); | |
}; | |
body.onmousemove = function(e) { | |
if (currentColor) { | |
e.preventDefault(); | |
var x = Math.min(255, e.pageX - currentColor.parentNode.parentNode.offsetLeft - currentColor.offsetLeft); | |
if (x < 0) x = 0; | |
var rgb = parseColor(currentColor.parentNode.parentNode.firstChild.style.backgroundColor); | |
for (var i = 0; i < currentColor.parentNode.childNodes.length; i++) | |
if (currentColor.parentNode.childNodes[i] === currentColor) rgb[i] = x; | |
setColor(rgb, currentColor.parentNode.parentNode); | |
} | |
}; | |
body.onmouseup = function() { | |
currentColor = null; | |
}; | |
var oldResize = resize; | |
resize = function() { | |
oldResize(); | |
skodiv.style.top = Math.round(hh / 2 + (sc ? -130 : 120)) + "px"; | |
pskh.style.top = Math.round(hh / 2 - (sc ? 294 : 44)) + "px"; | |
nskh.style.top = Math.round(hh / 2 - (sc ? 294 : 44)) + "px"; | |
mc.style.top = Math.floor(hh / 2 - mhh / 2) - (sc ? 250 : 0) + "px"; | |
stylesheet.insertRule('.yeniskinslithere-window{max-height:' + (hh-50) + 'px;' + '}', stylesheet.cssRules.length); | |
}; | |
var oldRedraw = redraw, crash = false; | |
redraw = function() { | |
if (!crash) | |
try { | |
oldRedraw(); | |
} catch(err) { | |
crash = true; | |
var crashblackout = createWindow(); | |
crashblackout.style.visibility = 'visible'; | |
crashblackout.style.opacity = 1; | |
body.appendChild(crashblackout); | |
var crashdiv = crashblackout.firstChild; | |
crashdiv.style.maxWidth = '400px'; | |
crashdiv.style.textAlign = 'center'; | |
var crashbtn = makeTextBtn('Reload page', 36, 16, 18, 2).elem; | |
crashbtn.style.position = 'relative'; | |
crashbtn.style.display = 'inline-block'; | |
crashbtn.style.marginTop = '7px'; | |
crashbtn.style.removeProperty('box-shadow'); | |
crashbtn.onclick = function() { | |
location.reload(); | |
}; | |
crashdiv.appendChild(crashbtn); | |
//localStorage.removeItem('yeniskinslithere-colors'); | |
//localStorage.removeItem('yeniskinslithere-skins'); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment