🏠 Home 

Tetris Ultimate Theme

do work ttc


Installer dette script?
  1. // ==UserScript==
  2. // @name Tetris Ultimate Theme
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.44
  5. // @description do work ttc
  6. // @author MrFaq
  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/PzVpYre.png",64);
  16. loadGhostSkin("https://i.imgur.com/1QYz0a2.png",64);
  17. //Jstris Custom Background Image
  18. document.head.getElementsByTagName("style")[0].innerHTML="";
  19. document.body.style.backgroundImage="url('https://i.imgur.com/9lhA4M6.png')";
  20. document.body.style.backgroundSize="100% 100%";
  21. document.getElementById("app").style.backgroundColor="rgba(0, 0, 0, 0)";
  22. document.getElementById("app").style.height="1000px";
  23. //Jstris SFX
  24. CustomSFXset.prototype = new BaseSFXset;
  25. loadSFX(new CustomSFXset);
  26. });
  27. })();
  28. function CustomSFXset(){
  29. this.volume=1;
  30. this.lock={url:"https://julf0.github.io/jstris-sfx/TU_harddrop.wav",abs:1};
  31. this.ready={url:"https://julf0.github.io/jstris-sfx/TU_ready.wav",abs:1,set:1};
  32. this.go={url:"https://julf0.github.io/jstris-sfx/TU_go.wav",abs:1,set:0};
  33. this.died={url:"https://julf0.github.io/jstris-sfx/TU_topout.wav",abs:1,set:1}; //TU actually doesn't have a topout sfx, this one was manually added from the gamefiles
  34. this.hold={url:"https://julf0.github.io/jstris-sfx/TU_hold.wav",abs:1,set:0};
  35. this.move={url:"blank.wav",abs:1,set:0}; //no sound exists for TU
  36. this.comboTones={url:"blank.wav",abs:1,set:2,duration:2500,spacing:500,cnt:8};
  37. this.linefall={url:"blank.wav",abs:1,set:0}; //no sound exists for TU
  38. };
  39. /**************************
  40. Special Events Script
  41. **************************/
  42. (function() {
  43. window.addEventListener('load', function(){
  44. Game['eventSounds'] = [
  45. "https://julf0.github.io/jstris-sfx/TU_tspin.wav",
  46. "https://julf0.github.io/jstris-sfx/TU_tspin.wav",
  47. "https://julf0.github.io/jstris-sfx/TU_single.wav",
  48. "https://julf0.github.io/jstris-sfx/TU_tspin.wav",
  49. "https://julf0.github.io/jstris-sfx/TU_double.wav",
  50. "https://julf0.github.io/jstris-sfx/TU_triple.wav",
  51. "https://julf0.github.io/jstris-sfx/TU_tspin.wav",
  52. "https://julf0.github.io/jstris-sfx/TU_tetris.wav",
  53. "blank.wav", //no sound exists for TU
  54. "https://julf0.github.io/jstris-sfx/TU_tspin.wav",
  55. "https://julf0.github.io/jstris-sfx/TU_tetris.wav",
  56. ];
  57. Game['eventVolumes'] = [1,1,1,1,1,1,1,1,1,1,1]
  58. window.events = ["TSPIN_SINGLE","TSPIN_MINI_SINGLE","CLEAR1","TSPIN_DOUBLE","CLEAR2","TSPIN_TRIPLE","CLEAR3","CLEAR4","PERFECT_CLEAR"]
  59. window.enableB2B = true;
  60. Game["latestEv"]="";Game["sArray"]=[];localStorage.evVol=localStorage.evVol||"100";window.b2bBefore=false;
  61. 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)}})
  62. var evVol = document.createElement("tr");
  63. 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>`
  64. tab_sound.appendChild(evVol);
  65. if(typeof playSound != 'function') {
  66. 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())}
  67. }
  68. window.events = ["TSPIN_SINGLE","TSPIN_MINI_SINGLE","CLEAR1","TSPIN_DOUBLE","CLEAR2","TSPIN_TRIPLE","CLEAR3","CLEAR4","PERFECT_CLEAR"]
  69. if(typeof trim != "function"){var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}}
  70. if(typeof getParams != "function"){var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}}
  71. var clcFunc = Game['prototype']['checkLineClears'].toString()
  72. var clcParams = getParams(clcFunc)
  73. searchFor = "[_" + clcFunc.split("switch")[1].split("]][_")[2]
  74. events.map((x,i)=>{
  75. replacement = searchFor.replace("[","[Game['btb']=this['isBack2Back'],Game['latestEv']='"+x+"',")
  76. clcFunc=clcFunc.replace(searchFor,replacement)
  77. })
  78. Game['prototype']["checkLineClears"] = new Function(...clcParams, trim(clcFunc));
  79. var psFunc = Game['prototype']['playSound'].toString()
  80. var psParams = getParams(psFunc);
  81. psFunc = 'if(Game["latestEv"]){sIndex=events.indexOf(Game["latestEv"]);sound=sIndex;enableB2B&&Game.btb&&~[0,1,3,5,7].indexOf(sIndex)&&(sound=9+ +(7==sIndex));console.log(sound);Game.sArray[sound]&&playSound(sound);Game["latestEv"]="";}' + trim(psFunc)
  82. Game['prototype']['playSound'] = new Function(...psParams, psFunc);
  83. localStorage.mainVol = localStorage.mainVol || "100"
  84. document.getElementById("settingsSave").addEventListener("click", function(){
  85. localStorage.mainVol=document.getElementById('vol-control').value
  86. }, false);
  87. Settings['prototype']['volumeChange'](+localStorage.mainVol)
  88. /**************************
  89. Rotation Sounds Script
  90. **************************/
  91. Game['rotationSounds'] = [
  92. "https://julf0.github.io/jstris-sfx/TU_rotate.wav", //rotate left
  93. "https://julf0.github.io/jstris-sfx/TU_rotate.wav", //rotate right
  94. "https://julf0.github.io/jstris-sfx/TU_rotate.wav", //rotate 180°
  95. ];
  96. Game['rotationVolumes'] = [1,1,1]
  97. localStorage.evVol=localStorage.evVol||"100"
  98. Game["rArray"]=[];
  99. 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)}})
  100. 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())}
  101. var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}
  102. var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}
  103. var rotFunc = Game['prototype']['rotateCurrentBlock'].toString()
  104. var rotParams = getParams(rotFunc)
  105. var rotInsert = 'var rotPos=[0,0,1,2]['+rotParams[0]+'+1];console.log(rotPos);Game.rArray[rotPos]&&playRotSound(rotPos);'
  106. rotFunc = rotInsert + trim(rotFunc)
  107. Game['prototype']['rotateCurrentBlock'] = new Function(...rotParams, rotFunc);
  108. /**************************
  109. Songs Script
  110. **************************/
  111. if(typeof trim != "function"){var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}}
  112. if(typeof getParams != "function"){var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}}
  113. localStorage.musicVol = localStorage.musicVol || "100";
  114. localStorage.SPvol = localStorage.SPvol || "100";
  115. var musicVol = document.createElement("tr");
  116. 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>'
  117. tab_sound.appendChild(musicVol);
  118. var spVol = document.createElement("tr");
  119. 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>'
  120. tab_sound.appendChild(spVol);
  121. Game["setVol"] = function(vol,mode) {
  122. if(mode){
  123. localStorage.musicVol = vol
  124. volSetting.innerHTML=vol+'%';
  125. var musicVol=document.getElementById("volControl")
  126. Game["songs"].map(x=>{
  127. x.volume = (musicVol.value/100);
  128. })
  129. } else {
  130. localStorage.SPvol = vol
  131. volSetting2.innerHTML=vol+'%';
  132. var spVol=document.getElementById("volControl2")
  133. Game["song"].volume = spVol.value/100
  134. }
  135. }
  136. if(typeof Game != "undefined"){
  137. var songsMP = [
  138. "https://julf0.github.io/jstris-sfx/TU_bgm_extended.mp3",
  139. ]
  140. var songSP = "https://julf0.github.io/jstris-sfx/TU_bgm_extended.mp3"
  141. var songThresholds = [1]
  142. Game['onlySprint'] = false;
  143. window.playSong = function(s) {
  144. Game["songs"].map(x=>{
  145. x.pause();
  146. x.currentTime = 0;
  147. })
  148. Game["song"].pause();
  149. Game["song"].currentTime = 0;
  150. if(s != undefined){
  151. !s.paused&&0<s.currentTime?s.currentTime=0:s.play()
  152. }
  153. }
  154. Game["songs"] = [];
  155. Game["maxPlayers"] = 0
  156. Game["songIndex"] = -1
  157. Game["song"] = document.createElement("audio");
  158. Game["song"].src = songSP;
  159. Game["song"].loop = true;
  160. Game["song"].volume = 1;
  161. songsMP.map((x,i)=>{
  162. Game["songs"].push(document.createElement("audio"));
  163. Game["songs"][i].src = x;
  164. Game["songs"][i].loop = true;
  165. Game["songs"][i].volume = 1;
  166. })
  167. Game["setVol"](localStorage.musicVol,1)
  168. Game["setVol"](localStorage.SPvol,0)
  169. Game["updateSong"] = function(i) {
  170. if(i<0){
  171. Game["maxPlayers"] = 0
  172. playSong()
  173. Game["songIndex"] = -1
  174. }
  175. if(i==0){
  176. Game["maxPlayers"]= -1
  177. playSong(Game["songs"][0])
  178. Game["songIndex"] = 0
  179. }
  180. if(typeof i == "string"){
  181. if(Game["maxPlayers"]<0){
  182. Game["maxPlayers"]=parseInt(i)
  183. }
  184. var alivePercent = (parseInt(i)-1)/Game["maxPlayers"]
  185. if(alivePercent <= songThresholds[Game["songIndex"]+1]){
  186. console.log(Game["songIndex"])
  187. Game["songIndex"]++
  188. playSong(Game["songs"][Game["songIndex"]])
  189. }
  190. }
  191. }
  192. var gameOver99 = Game['prototype']['GameOver'].toString();
  193. gameOver99 = "Game['updateSong'](-1);Game['song'].pause();Game['song'].currentTime=0;" + trim(gameOver99)
  194. Game['prototype']['GameOver'] = new Function(gameOver99)
  195. var printSlot99 = SlotView['prototype']['printSlotPlace'].toString()
  196. var printSlotParams = getParams(printSlot99);
  197. printSlot99 = `Game["updateSong"](this['slot']['gs']['p']['getPlaceColor'](${printSlotParams[0]})['str']);` + trim(printSlot99)
  198. SlotView['prototype']['printSlotPlace'] = new Function(...printSlotParams, printSlot99);
  199. var readyGo99 = Game['prototype']['restart'].toString()
  200. 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)
  201. Game['prototype']['restart'] = new Function(readyGo99);
  202. var specMode99 = Live['prototype']['spectatorMode'].toString()
  203. var specParams = getParams(specMode99);
  204. specMode99 = `Game['updateSong'](-1);` + trim(specMode99)
  205. Live['prototype']['spectatorMode'] = new Function(...specParams, specMode99);
  206. var paint99 = Game['prototype']['paintMatrixWithColor'].toString()
  207. var paintParams = getParams(paint99);
  208. paint99 = `Game['updateSong'](-1);` + trim(paint99)
  209. Game['prototype']['paintMatrixWithColor'] = new Function(...paintParams, paint99);
  210. localStorage.mainVol = localStorage.mainVol || "100"
  211. document.getElementById("settingsSave").addEventListener("click", function(){localStorage.mainVol=document.getElementById('vol-control').value}, false);
  212. Settings['prototype']['volumeChange'](+localStorage.mainVol)
  213. //remove these 3 lines if you dont want the music to stop for the countdown
  214. var readyGo992 = Game['prototype']['readyGo'].toString()
  215. readyGo992 = "Game['updateSong'](-1);" + trim(readyGo992)
  216. Game['prototype']['readyGo'] = new Function(readyGo992);
  217. }
  218. });
  219. })();