// ==UserScript== // @name Bubble.am colors // @version 1.1 // @description Script that allow you to change your cells color that you want // @author DD7 // @match *://bubble.am/* // @run-at document-start // @grant none // ==/UserScript== let splitInterval=null,splitSwitch=!1,pressedKeys={};const modName="color";function modifyCore(e){return(e=(e=e.replace("m = H[p], m.J(), m.o = m.x, m.p = m.y, m.n = m.size, m.color = I, m.gdid = gdID;","\n m = H[p];\n m.J();\n m.o = m.x;\n m.p = m.y;\n m.n = m.size;\n m.color = I;\n m.gdid = gdID;\n\n if(h.length > 0 && m.name === h[0].name && cellsColor !== undefined && cellsColor !== null && !m.f) m.color = window.cellsColor;\n ")).replace("\n for (var a = l / g, b = q / g, c = (-t + a / 2) % 50; c < a; c += 50) f.beginPath(), f.moveTo(c * g - .5, 0), f.lineTo(c * g - .5, b * g), f.stroke();\n for (c = (-u + b / 2) % 50; c < b; c += 50) f.beginPath(), f.moveTo(0, c * g - .5), f.lineTo(a *\n g, c * g - .5), f.stroke();\n ","\n ")).replace(/(bb\s\?)(.*)/,'\n if(bb) {\n a.fillStyle = "#FFFFFF";\n a.strokeStyle = "#AAAAAA";\n if(this.f) a.globalAlpha = 0.2;\n\n } else {\n a.fillStyle = this.color;\n a.strokeStyle = this.color;\n if(this.f) a.globalAlpha = 0.2;\n }\n ')}function setCookie(e,o,t){var n="";if(t){var r=new Date;r.setTime(r.getTime()+24*t*60*60*1e3),n="; expires="+r.toUTCString()}document.cookie=e+"="+(o||"")+n+"; path=/"}function getCookie(e){var o=e+"=",t=document.cookie.split(";");for(let e=0;e10)&&(window.stop(),location.href=`http://bubble.am/color${location.hash}`),document.documentElement.innerHTML="Loading...";const getColorValue=getCookie("cellsColor");function initLibrary(){const e=document.createElement("link");e.rel="stylesheet",e.href="https://cdn.jsdelivr.net/npm/@simonwep/pickr/dist/themes/nano.min.css",$("head").append(e);const o=document.createElement("script");o.type="text/javascript",o.src="https://cdn.jsdelivr.net/npm/@simonwep/pickr/dist/pickr.es5.min.js",$("head").append(o)}function initColorPicker(){$(".settings_checkboxes").after('

Wybierz swój kolor:

'),Pickr.create({el:"#colorMod",theme:"nano",container:"body",swatches:null,default:getColorValue,components:{preview:!0,opacity:!1,hue:!0,interaction:{hex:!0,rgba:!0,hsla:!1,hsva:!1,cmyk:!1,input:!0,clear:!1,save:!0}}}).on("save",(e,o)=>{cellsColor=e.toRGBA().toString(3),setCookie("cellsColor",cellsColor,30)}).on("change",(e,o)=>{cellsColor=e.toRGBA().toString(1)})}function darkTheme(){const e=".main-panel { background-color: #191919; color: #c2c2c2; } .form-control { background-color: #0000009c; color: #c2c2c2; border: 1px solid #565656; } #radio_mode .gm-s { background-color: #0000009c; color: #c2c2c2; } .bb-panel { background-color: #191919; } .progress { background-color: #0000009c; } .dropdown-menu { background-color: #000; color: #c2c2c2; } .dropdown-menu > li > a { color: #c2c2c2; } .dropdown-menu>li>a:hover, .dropdown-menu>li>a:focus { background-color: #0095ff9e; color: #c2c2c2; } .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control { background-color: #0000009c; color: #c2c2c2; } .table-striped>tbody>tr:nth-child(odd) { background-color: #151515; } .table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td { border-top: 1px solid #4e4e4e; } .table>thead>tr>th { border-bottom: 2px solid #636363; } .modal-content { background-color: #191919; color: #e6e6e6;} .panel {background-color: #191919; color: #c2c2c2; } .panel-default>.panel-heading { background-color: #0e0e0e; border-color: #4e4e4e; } input.chat { background-color: #0e0e0e; color: #e6e6e6;} #tournament-modal .panel-heading { color: #d6d6d6 !important;} .tright { color: #c2c2c2; } .modeinfo {color: #438eff; } option:disabled { color: #c2c2c2; } .table>thead>tr>td.warning, .table>tbody>tr>td.warning, .table>tfoot>tr>td.warning, .table>thead>tr>th.warning, .table>tbody>tr>th.warning, .table>tfoot>tr>th.warning, .table>thead>tr.warning>td, .table>tbody>tr.warning>td, .table>tfoot>tr.warning>td, .table>thead>tr.warning>th, .table>tbody>tr.warning>th, .table>tfoot>tr.warning>th { background-color: #ffde2b8c; } .user-notif div { border-bottom: 1px solid #828282; background: #0000004c !important; } .nav-tabs>li.active>a, .nav-tabs>li.active>a:hover, .nav-tabs>li.active>a:focus { color: #c2c2c2; background-color: #0009; } .nav>li>a:hover, .nav>li>a:focus { background-color: #0000; } nav-tabs>li>a:hover { border-color: #4a4a4a #4a4a4a #4a4a4a;} tr:hover { background: #000 !important; }",o=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");o.appendChild(t),t.type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function keydown(e){if(document.querySelector("#chat_textbox")===document.activeElement)return;switch(pressedKeys[e.key]=!0,e.key){case"Shift":if(splitSwitch)return;splitSwitch=!0,splitInterval=setInterval(()=>{$("body").trigger($.Event("keydown",{keyCode:32})),$("body").trigger($.Event("keyup",{keyCode:32}))},0);break;case"r":x=window.innerWidth/3,y=window.innerHeight/-0,$("canvas").trigger($.Event("mousemove",{clientX:x,clientY:y}));break;case"a":x=window.innerWidth/-0,y=window.innerHeight/8,$("canvas").trigger($.Event("mousemove",{clientX:x,clientY:y}));break;case"s":x=window.innerWidth/2,y=window.innerHeight/.6,$("canvas").trigger($.Event("mousemove",{clientX:x,clientY:y}));break;case"d":x=window.innerWidth/0,y=window.innerHeight/5,$("canvas").trigger($.Event("mousemove",{clientX:x,clientY:y}))}const o=pressedKeys;switch(!0){case o.a&&o.r:x=window.innerWidth/-0,y=window.innerHeight/-0,$("canvas").trigger($.Event("mousemove",{clientX:x,clientY:y}));break;case o.a&&o.s:x=window.innerWidth/-0,y=window.innerHeight/0,$("canvas").trigger($.Event("mousemove",{clientX:x,clientY:y}));break;case o.r&&o.d:x=window.innerWidth/0,y=window.innerHeight/-0,$("canvas").trigger($.Event("mousemove",{clientX:x,clientY:y}));break;case o.s&&o.d:x=window.innerWidth/0,y=window.innerHeight/0,$("canvas").trigger($.Event("mousemove",{clientX:x,clientY:y}))}}function keyup(e){if(document.querySelector("#chat_textbox")!==document.activeElement)switch(delete pressedKeys[e.key],e.key){case"Shift":return clearInterval(splitInterval),void(splitSwitch=!1)}}function initMacro(){document.addEventListener("keydown",keydown),document.addEventListener("keyup",keyup)}null===getColorValue&&setCookie("cellsColor","undefined",30),window.cellsColor=getColorValue;const request=new XMLHttpRequest,url="http://bubble.am";request.open("get",url,!0),request.send(),request.onload=function(e){const o=modifyCore(this.responseText);document.open(),document.write(o),document.close(),window.onload=function(){initLibrary(),initMacro(),darkTheme(),setTimeout(function(){initColorPicker()},500)}},request.onerror=function(e){console.log("Error")};