🏠 Home 

TOP BLACK Theme

Tetris Online Poland BLACK theme for Jstris


Installer dette script?
  1. // ==UserScript==
  2. // @name TOP BLACK Theme
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.12
  5. // @description Tetris Online Poland BLACK theme for Jstris
  6. // @author Eddie
  7. // @match https://*.jstris.jezevec10.com/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11. (function() {
  12. 'use strict';
  13. window.addEventListener('load', function(){
  14. //Jstris Block Skin Change
  15. loadSkin("https://i.imgur.com/MWjZKtK.png",30);
  16. //Jstris SFX
  17. CustomSFXset.prototype = new BaseSFXset;
  18. loadSFX(new CustomSFXset);
  19. });
  20. })();
  21. function CustomSFXset(){
  22. this.volume=1;
  23. this.lock={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_lock.wav",abs:1};
  24. this.ready={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_ready.wav",abs:1,set:1};
  25. this.go={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_go.wav",abs:1,set:0};
  26. this.died={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_died.wav",abs:1,set:1};
  27. this.hold={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_hold.wav",abs:1,set:0};
  28. this.move={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_move.wav",abs:1,set:0};
  29. this.linefall={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_linefall.wav",abs:1,set:0};
  30. this.comboTones={url:"https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_combo.mp3",abs:1,set:2,duration:1000,spacing:500,cnt:20};
  31. this.linefall={url:"blank.wav",abs:1,set:0};
  32. };
  33. /************************************
  34. TOP Grid Script
  35. ************************************/
  36. (function() {
  37. window.addEventListener('load', function(){
  38. customFieldBorder = true //change to false to disable
  39. if(customFieldBorder){
  40. if(typeof Game != "undefined"){
  41. if(typeof trim != "function"){var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}}
  42. if(typeof getParams != "function"){var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}}
  43. function atGameStart() {
  44. bgLayer.width = 550
  45. bgLayer.height = 700
  46. bgLayer.style.left = "-"+((880-248)/2)/2+"px"
  47. bgLayer.style.top = "-"+((1080-480)/2)/2+"px"
  48. this.drawBgGrid(1);
  49. var bgctx = bgLayer.getContext("2d");
  50. var img = new Image;
  51. img.onload = function(){
  52. bgctx.clearRect(0, 0, 880, 1080);
  53. bgctx.drawImage(img,38,108,494,577); // Or at whatever offset you like
  54. };
  55. img.src = "https://i.imgur.com/09GL3i3.png";
  56. sprintInfo.style.zIndex = "100000";
  57. }
  58. var initRandom = GameCore['prototype']['initRandomizer'].toString()
  59. var initRandomParams = getParams(initRandom)
  60. initRandom = trim(atGameStart.toString()) + trim(initRandom)
  61. GameCore['prototype']['initRandomizer'] = new Function(...initRandomParams, initRandom);
  62. var queueC = queueCanvas.getBoundingClientRect();
  63. for (var i = 0; i < 5; i++) {
  64. var qCC = document.createElement("canvas");
  65. qCC.id = "queueCopy" + i
  66. qCC.className = "queueCopy"
  67. qCC.style.position = "absolute";
  68. qCC.style.left = queueC.left+"px";
  69. qCC.style.top = queueC.top+(72*i)+"px";
  70. qCC.height=72
  71. i&&(qCC.style.transform = "translatey("+(72*i)+") ")
  72. qCC.width=queueCanvas.width
  73. document.body.appendChild(qCC)
  74. }
  75. var customStyleQueue=document.createElement("style");
  76. customStyleQueue.innerHTML='#queueCanvas {visibility:hidden;} .queueCopy {z-index:1} #holdCanvas {z-index:2}';
  77. document.body.appendChild(customStyleQueue);
  78. var updateQueueBoxFunc = Game['prototype']['updateQueueBox'].toString()
  79. var inject = `;for (var i = 0; i < 5; i++) {
  80. var destCanvas = document.getElementById("queueCopy"+i)
  81. var destCtx = destCanvas.getContext('2d');
  82. destCtx.clearRect(0, 0, destCanvas.width, destCanvas.height);
  83. destCtx.drawImage(queueCanvas, 0, -i*72);}`
  84. updateQueueBoxFunc = trim(updateQueueBoxFunc) + inject
  85. Game['prototype']["updateQueueBox"] = new Function(updateQueueBoxFunc);
  86. queueCopies = [queueCopy0,queueCopy1,queueCopy2,queueCopy3,queueCopy4]
  87. //i=0
  88. //queueCopies.map(x=>{
  89. // x.style.transform = "scale(0.6,0.6) translate(13px,"+ (100+(-i*20)) +"px)"
  90. // i++
  91. //})
  92. queueCopy0.style.transform = "scale(0.75,0.75) translate(15px, 55px)"
  93. queueCopy1.style.transform = "scale(0.7,0.7) translate(18px, 90px)"
  94. queueCopy2.style.transform = "scale(0.6,0.6) translate(18px, 100px)"
  95. queueCopy3.style.transform = "scale(0.6,0.6) translate(18px, 90px)"
  96. queueCopy4.style.transform = "scale(0.6,0.6) translate(18px, 80px)"
  97. holdCanvas.style.float = "none"
  98. holdCanvas.style.position = "absolute"
  99. holdCanvas.style.transform = "scale(0.7,0.7)"
  100. holdCanvas.style.top = "40px"
  101. holdCanvas.style.left = "16px"
  102. rInfoBox.style.position = "absolute"
  103. rInfoBox.style.zIndex = 100
  104. rInfoBox.style.marginLeft = "132px"
  105. rInfoBox.style.marginTop = "40px"
  106. rInfoBox.style.transform = "scale(0.8,0.8)"
  107. bgLayer.style.zIndex = -1
  108. stage.style.left = "112px"}
  109. }
  110. });
  111. })();
  112. /**************************
  113. Special Events Script
  114. **************************/
  115. (function() {
  116. window.addEventListener('load', function(){
  117. Game['eventSounds'] = [
  118. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_tspinsingle.mp3",
  119. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_tspinminisingle.mp3",
  120. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_clear1.wav",
  121. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_tspindouble.mp3",
  122. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_clear2.mp3",
  123. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_clear3.mp3",
  124. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_tspintriple.mp3",
  125. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_clear4.mp3",
  126. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_clear5.mp3",
  127. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_perfectclear.mp3",
  128. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_b2btspin.wav",
  129. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_b2btetris.mp3"
  130. ];
  131. Game['eventVolumes'] = [1,1,1,1,1,1,1,1,1,1,1,1]
  132. window.events = ["TSPIN_SINGLE","TSPIN_MINI_SINGLE","CLEAR1","TSPIN_DOUBLE","CLEAR2","TSPIN_TRIPLE","CLEAR3","CLEAR4","CLEAR5","PERFECT_CLEAR"]
  133. window.enableB2B = true;
  134. Game["latestEv"]="";Game["sArray"]=[];localStorage.evVol=localStorage.evVol||"100";window.b2bBefore=false;
  135. Game["eventSounds"].map((x,i)=>{if(Game['eventSounds'][i]){Game["sArray"].push(document.createElement("audio"));Game["sArray"][i].src=x}else{Game["sArray"].push(null)}})
  136. var evVol = document.createElement("tr");
  137. evVol.innerHTML = `Special Events vol:&nbsp;<input id="volControl3" oninput="localStorage.evVol=volControl3.value;volSetting3.innerHTML=volControl3.value+'%'" type="range" min="0" max="100" value="`+localStorage.evVol+`" step="1" style="width:150px;display:inline-block;padding-top:9px">&nbsp;&nbsp;<span id="volSetting3">`+localStorage.evVol+`%</span>`
  138. tab_sound.appendChild(evVol);
  139. if(typeof playSound != 'function') {
  140. window.playSound = function(S){s=Game.sArray[S];console.log(s);!s.paused&&0<s.currentTime?s.currentTime=0:(s.volume=Game['eventVolumes'][S]*localStorage.evVol/100,s.play())}
  141. }
  142. window.events = ["TSPIN_SINGLE","TSPIN_MINI_SINGLE","CLEAR1","TSPIN_DOUBLE","CLEAR2","TSPIN_TRIPLE","CLEAR3","CLEAR4","CLEAR5","PERFECT_CLEAR"]
  143. if(typeof trim != "function"){var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}}
  144. if(typeof getParams != "function"){var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}}
  145. var clcFunc = Game['prototype']['checkLineClears'].toString()
  146. var clcParams = getParams(clcFunc)
  147. searchFor = "[_" + clcFunc.split("switch")[1].split("]][_")[2]
  148. events.map((x,i)=>{
  149. replacement = searchFor.replace("[","[Game['btb']=this['isBack2Back'],console.log('"+x+"'),Game['latestEv']='"+x+"',")
  150. clcFunc=clcFunc.replace(searchFor,replacement)
  151. })
  152. Game['prototype']["checkLineClears"] = new Function(...clcParams, trim(clcFunc));
  153. var psFunc = Game['prototype']['playSound'].toString()
  154. var psParams = getParams(psFunc);
  155. psFunc = `
  156. if(Game["latestEv"]){
  157. sIndex=events.indexOf(Game["latestEv"]);
  158. console.log(sIndex)
  159. sound=sIndex;enableB2B&&Game.btb&&~[0,1,3,5,7,8].indexOf(sIndex)&&(sound=10+ +(7==sIndex));
  160. console.log(sound);
  161. Game.sArray[sound]&&playSound(sound);
  162. Game["latestEv"]="";
  163. }` + trim(psFunc)
  164. Game['prototype']['playSound'] = new Function(...psParams, psFunc);
  165. localStorage.mainVol = localStorage.mainVol || "100"
  166. document.getElementById("settingsSave").addEventListener("click", function(){
  167. localStorage.mainVol=document.getElementById('vol-control').value
  168. }, false);
  169. Settings['prototype']['volumeChange'](+localStorage.mainVol)
  170. /**************************
  171. Rotation Sounds Script
  172. **************************/
  173. Game['rotationSounds'] = [
  174. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_rotate.wav", //rotate left
  175. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_rotate.wav", //rotate right
  176. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOP_rotate.wav" //rotate 180°
  177. ];
  178. Game['rotationVolumes'] = [1,1,1]
  179. localStorage.evVol=localStorage.evVol||"100"
  180. Game["rArray"]=[];
  181. Game["rotationSounds"].map((x,i)=>{if(Game['rotationSounds'][i]){Game["rArray"].push(document.createElement("audio"));Game["rArray"][i].src=x}else{Game["rArray"].push(null)}})
  182. window.playRotSound = function(S){s=Game.rArray[S];!s.paused&&0<s.currentTime?s.currentTime=0:(s.volume=Game['rotationVolumes'][S]*localStorage.evVol/100,s.play())}
  183. var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}
  184. var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}
  185. var rotFunc = Game['prototype']['rotateCurrentBlock'].toString()
  186. var rotParams = getParams(rotFunc)
  187. var rotInsert = 'var rotPos=[0,0,1,2]['+rotParams[0]+'+1];console.log(rotPos);Game.rArray[rotPos]&&playRotSound(rotPos);'
  188. rotFunc = rotInsert + trim(rotFunc)
  189. Game['prototype']['rotateCurrentBlock'] = new Function(...rotParams, rotFunc);
  190. /**************************
  191. Songs Script
  192. **************************/
  193. if(typeof trim != "function"){var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}}
  194. if(typeof getParams != "function"){var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}}
  195. localStorage.musicVol = localStorage.musicVol || "100";
  196. localStorage.SPvol = localStorage.SPvol || "100";
  197. var musicVol = document.createElement("tr");
  198. musicVol.innerHTML = 'Music vol (MP):&nbsp;<input id="volControl" oninput="Game.setVol(volControl.value,1)" type="range" min="0" max="100" value="'+localStorage.musicVol+'" step="1" style="width:150px;display:inline-block;padding-top:9px">&nbsp;&nbsp;<span id="volSetting">'+localStorage.musicVol+'%</span>'
  199. tab_sound.appendChild(musicVol);
  200. var spVol = document.createElement("tr");
  201. spVol.innerHTML = 'Music vol (SP):&nbsp;<input id="volControl2" oninput="Game.setVol(volControl2.value,0)" type="range" min="0" max="100" value="'+localStorage.SPvol+'" step="1" style="width:150px;display:inline-block;padding-top:9px">&nbsp;&nbsp;<span id="volSetting2">'+localStorage.SPvol+'%</span>'
  202. tab_sound.appendChild(spVol);
  203. Game["setVol"] = function(vol,mode) {
  204. if(mode){
  205. localStorage.musicVol = vol
  206. volSetting.innerHTML=vol+'%';
  207. var musicVol=document.getElementById("volControl")
  208. Game["songs"].map(x=>{
  209. x.volume = (musicVol.value/100);
  210. })
  211. } else {
  212. localStorage.SPvol = vol
  213. volSetting2.innerHTML=vol+'%';
  214. var spVol=document.getElementById("volControl2")
  215. Game["song"].volume = spVol.value/100
  216. }
  217. }
  218. if(typeof Game != "undefined"){
  219. var songsMP = [
  220. "https://ecdldaiiere.github.io/Eddiez-Soundz/TOPsong1.mp3",
  221. ]
  222. var songSP = "https://ecdldaiiere.github.io/Eddiez-Soundz/TOPsong1.mp3"
  223. var songThresholds = [1]
  224. Game['onlySprint'] = false;
  225. window.playSong = function(s) {
  226. Game["songs"].map(x=>{
  227. x.pause();
  228. x.currentTime = 0;
  229. })
  230. Game["song"].pause();
  231. Game["song"].currentTime = 0;
  232. if(s != undefined){
  233. !s.paused&&0<s.currentTime?s.currentTime=0:s.play()
  234. }
  235. }
  236. Game["songs"] = [];
  237. Game["maxPlayers"] = 0
  238. Game["songIndex"] = -1
  239. Game["song"] = document.createElement("audio");
  240. Game["song"].src = songSP;
  241. Game["song"].loop = true;
  242. Game["song"].volume = 1;
  243. songsMP.map((x,i)=>{
  244. Game["songs"].push(document.createElement("audio"));
  245. Game["songs"][i].src = x;
  246. Game["songs"][i].loop = true;
  247. Game["songs"][i].volume = 1;
  248. })
  249. Game["setVol"](localStorage.musicVol,1)
  250. Game["setVol"](localStorage.SPvol,0)
  251. Game["updateSong"] = function(i) {
  252. if(i<0){
  253. Game["maxPlayers"] = 0
  254. playSong()
  255. Game["songIndex"] = -1
  256. }
  257. if(i==0){
  258. Game["maxPlayers"]= -1
  259. playSong(Game["songs"][0])
  260. Game["songIndex"] = 0
  261. }
  262. if(typeof i == "string"){
  263. if(Game["maxPlayers"]<0){
  264. Game["maxPlayers"]=parseInt(i)
  265. }
  266. var alivePercent = (parseInt(i)-1)/Game["maxPlayers"]
  267. if(alivePercent <= songThresholds[Game["songIndex"]+1]){
  268. console.log(Game["songIndex"])
  269. Game["songIndex"]++
  270. playSong(Game["songs"][Game["songIndex"]])
  271. }
  272. }
  273. }
  274. var gameOver99 = Game['prototype']['GameOver'].toString();
  275. gameOver99 = "Game['updateSong'](-1);Game['song'].pause();Game['song'].currentTime=0;" + trim(gameOver99)
  276. Game['prototype']['GameOver'] = new Function(gameOver99)
  277. var printSlot99 = SlotView['prototype']['printSlotPlace'].toString()
  278. var printSlotParams = getParams(printSlot99);
  279. printSlot99 = `Game["updateSong"](this['slot']['gs']['p']['getPlaceColor'](${printSlotParams[0]})['str']);` + trim(printSlot99)
  280. SlotView['prototype']['printSlotPlace'] = new Function(...printSlotParams, printSlot99);
  281. var readyGo99 = Game['prototype']['restart'].toString()
  282. readyGo99 = "if(this['pmode']+this['isPmode'](true)+this['isPmode'](false)==0){Game['updateSong'](0)}else{Game['updateSong'](-1);if(!Game['onlySprint']){playSong(Game['song'])}else{if(this['pmode']==1){playSong(Game['song'])}}};" + trim(readyGo99)
  283. Game['prototype']['restart'] = new Function(readyGo99);
  284. var specMode99 = Live['prototype']['spectatorMode'].toString()
  285. var specParams = getParams(specMode99);
  286. specMode99 = `Game['updateSong'](-1);` + trim(specMode99)
  287. Live['prototype']['spectatorMode'] = new Function(...specParams, specMode99);
  288. var paint99 = Game['prototype']['paintMatrixWithColor'].toString()
  289. var paintParams = getParams(paint99);
  290. paint99 = `Game['updateSong'](-1);` + trim(paint99)
  291. Game['prototype']['paintMatrixWithColor'] = new Function(...paintParams, paint99);
  292. localStorage.mainVol = localStorage.mainVol || "100"
  293. document.getElementById("settingsSave").addEventListener("click", function(){localStorage.mainVol=document.getElementById('vol-control').value}, false);
  294. Settings['prototype']['volumeChange'](+localStorage.mainVol)
  295. //remove these 3 lines if you dont want the music to stop for the countdown
  296. var readyGo992 = Game['prototype']['readyGo'].toString()
  297. readyGo992 = "Game['updateSong'](-1);" + trim(readyGo992)
  298. Game['prototype']['readyGo'] = new Function(readyGo992);
  299. }
  300. });
  301. })();