Bubble.am color

Script that allow you to change your cells color that you want

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Bubble.am color
// @version      1.1
// @description Script that allow you to change your cells color that you want
// @author       DD7
// @match        http://bubble.am/*
// @run-at       document-start
// @grant        none
// @namespace https://greasyfork.org/users/693712
// ==/UserScript==

var MacroInterval,MacroDebounce=!1;let splitInterval=null,splitSwitch=!1,pressedKeys={};const modName="color";function modifyCore(e){return(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    ")}function setCookie(e,n,t){var o="";if(t){var i=new Date;i.setTime(i.getTime()+24*t*60*60*1e3),o="; expires="+i.toUTCString()}document.cookie=e+"="+(n||"")+o+"; path=/"}function getCookie(e){var n=e+"=",t=document.cookie.split(";");for(let e=0;e<t.length;e++){let o=t[e];for(;" "==o.charAt(0);)o=o.substring(1,o.length);if(0==o.indexOf(n))return o.substring(n.length,o.length)}return null}("bubble.am"===location.host&&"/"===location.pathname||location.pathname.length>10)&&(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 n=document.createElement("script");n.type="text/javascript",n.src="https://cdn.jsdelivr.net/npm/@simonwep/pickr/dist/pickr.es5.min.js",$("head").append(n)}function initColorPicker(){$(".settings_checkboxes").after('<div id="colorPanel"><p style="float: left; line-height: 2.6rem; margin-right: 0.8rem;">Wybierz swój kolor: </p> <div id="colorMod"></div></div>'),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,n)=>{cellsColor=e.toRGBA().toString(3),setCookie("cellsColor",cellsColor,30)}).on("change",(e,n)=>{cellsColor=e.toRGBA().toString(1)})}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"q":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 n=pressedKeys;switch(!0){case n.a&&n.q:x=window.innerWidth/-0,y=window.innerHeight/-0,$("canvas").trigger($.Event("mousemove",{clientX:x,clientY:y}));break;case n.a&&n.s:x=window.innerWidth/-0,y=window.innerHeight/0,$("canvas").trigger($.Event("mousemove",{clientX:x,clientY:y}));break;case n.q&&n.d:x=window.innerWidth/0,y=window.innerHeight/-0,$("canvas").trigger($.Event("mousemove",{clientX:x,clientY:y}));break;case n.s&&n.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 n=modifyCore(this.responseText);document.open(),document.write(n),document.close(),window.onload=function(){initLibrary(),initMacro(),setTimeout(function(){initColorPicker()},500)}},request.onerror=function(e){console.log("Error")};