From 238efd3b975b60b715e770e19eb422e0e9d358dd Mon Sep 17 00:00:00 2001 From: SwingTheVine Date: Sat, 16 Aug 2025 22:48:31 -0400 Subject: [PATCH] Debugging CSS --- dist/BlueMarble.user.js | 4 ++-- docs/README.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/BlueMarble.meta.js | 2 +- src/main.js | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/BlueMarble.user.js b/dist/BlueMarble.user.js index 6a8bbd2..4cf7c80 100644 --- a/dist/BlueMarble.user.js +++ b/dist/BlueMarble.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Blue Marble // @namespace https://github.com/SwingTheVine/ -// @version 0.81.37 +// @version 0.81.38 // @description A userscript to automate and/or enhance the user experience on Wplace.live. Make sure to comply with the site's Terms of Service, and rules! This script is not affiliated with Wplace.live in any way, use at your own risk. This script is not affiliated with TamperMonkey. The author of this userscript is not responsible for any damages, issues, loss of data, or punishment that may occur as a result of using this script. This script is provided "as is" under the MPL-2.0 license. The "Blue Marble" icon is licensed under CC0 1.0 Universal (CC0 1.0) Public Domain Dedication. The image is owned by NASA. // @author SwingTheVine // @license MPL-2.0 @@ -24,4 +24,4 @@ // Wplace --> https://wplace.live // License --> https://www.mozilla.org/en-US/MPL/2.0/ -(()=>{var e,t,n=e=>{throw TypeError(e)},i=(e,t,i)=>t.has(e)?n("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),o=(e,t,i)=>(((e,t)=>{t.has(e)||n("Cannot access private method")})(e,t),i),s=class{constructor(t,n){i(this,e),this.name=t,this.version=n,this.t=null,this.i="bm-g",this.o=null,this.l=null,this.m=[]}u(e){this.t=e}h(){return this.m.length>0&&(this.l=this.m.pop()),this}p(e){e?.appendChild(this.o),this.o=null,this.l=null,this.m=[]}$(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"div",{},n)),this}v(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"p",{},n)),this}S(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"small",{},n)),this}M(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"img",{},n)),this}O(n,i={},s=()=>{}){return s(this,o(this,e,t).call(this,"h"+n,{},i)),this}T(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"hr",{},n)),this}D(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"br",{},n)),this}C(n={},i=()=>{}){const s=o(this,e,t).call(this,"label",{textContent:n.textContent??""});delete n.textContent;const r=o(this,e,t).call(this,"input",{type:"checkbox"},n);return s.insertBefore(r,s.firstChild),this.h(),i(this,s,r),this}N(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"button",{},n)),this}k(n={},i=()=>{}){const s=n.title??n.textContent??"Help: No info";delete n.textContent,n.title=`Help: ${s}`;const r={textContent:"?",className:"bm-v",onclick:()=>{this.B(this.i,s)}};return i(this,o(this,e,t).call(this,"button",r,n)),this}I(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"input",{},n)),this}L(n={},i=()=>{}){const s=n.textContent??"";delete n.textContent;const r=o(this,e,t).call(this,"div"),a=o(this,e,t).call(this,"input",{type:"file",style:"display: none !important; visibility: hidden !important; position: absolute !important; left: -9999px !important; width: 0 !important; height: 0 !important; opacity: 0 !important;"},n);this.h();const c=o(this,e,t).call(this,"button",{textContent:s});return this.h(),this.h(),a.setAttribute("tabindex","-1"),a.setAttribute("aria-hidden","true"),c.addEventListener("click",()=>{a.click()}),a.addEventListener("change",()=>{c.style.maxWidth=`${c.offsetWidth}px`,a.files.length>0?c.textContent=a.files[0].name:c.textContent=s}),i(this,r,a,c),this}G(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"textarea",{},n)),this}B(e,t,n=!1){const i=document.getElementById(e.replace(/^#/,""));i&&(i instanceof HTMLInputElement?i.value=t:n?i.textContent=t:i.innerHTML=t)}P(e,t){let n,i=!1,o=0,s=null,r=0,a=0,c=0,l=0;if(e=document.querySelector("#"==e?.[0]?e:"#"+e),t=document.querySelector("#"==t?.[0]?t:"#"+t),!e||!t)return void this.F(`Can not drag! ${e?"":"moveMe"} ${e||t?"":"and "}${t?"":"iMoveThings "}was not found!`);const m=()=>{if(i){const t=Math.abs(r-c),n=Math.abs(a-l);(t>.5||n>.5)&&(r=c,a=l,e.style.transform=`translate(${r}px, ${a}px)`,e.style.left="0px",e.style.top="0px",e.style.right=""),s=requestAnimationFrame(m)}};let u=null;const d=(d,h)=>{i=!0,u=e.getBoundingClientRect(),n=d-u.left,o=h-u.top;const b=window.getComputedStyle(e).transform;if(b&&"none"!==b){const e=new DOMMatrix(b);r=e.m41,a=e.m42}else r=u.left,a=u.top;c=r,l=a,document.body.style.userSelect="none",t.classList.add("dragging"),s&&cancelAnimationFrame(s),m()},h=()=>{i=!1,s&&(cancelAnimationFrame(s),s=null),document.body.style.userSelect="",t.classList.remove("dragging")};t.addEventListener("mousedown",function(e){e.preventDefault(),d(e.clientX,e.clientY)}),t.addEventListener("touchstart",function(e){const t=e?.touches?.[0];t&&(d(t.clientX,t.clientY),e.preventDefault())},{passive:!1}),document.addEventListener("mousemove",function(e){i&&u&&(c=e.clientX-n,l=e.clientY-o)},{passive:!0}),document.addEventListener("touchmove",function(e){if(i&&u){const t=e?.touches?.[0];if(!t)return;c=t.clientX-n,l=t.clientY-o,e.preventDefault()}},{passive:!1}),document.addEventListener("mouseup",h),document.addEventListener("touchend",h),document.addEventListener("touchcancel",h)}W(e){(0,console.info)(`${this.name}: ${e}`),this.B(this.i,"Status: "+e,!0)}F(e){(0,console.error)(`${this.name}: ${e}`),this.B(this.i,"Error: "+e,!0)}};function r(...e){(0,console.error)(...e)}function a(e,t){if(0===e)return t[0];let n="";const i=t.length;for(;e>0;)n=t[e%i]+n,e=Math.floor(e/i);return n}function c(e){let t="";for(let n=0;n"transparent"!==(e?.name||"").toLowerCase()&&Array.isArray(e?.rgb)).map(e=>`${e.rgb[0]},${e.rgb[1]},${e.rgb[2]}`));const l="222,250,206";this.H.add(l),this.K=new Map(c.filter(e=>Array.isArray(e?.rgb)).map(e=>[`${e.rgb[0]},${e.rgb[1]},${e.rgb[2]}`,{id:e.id,premium:!!e.premium,name:e.name}]));try{const e=c.find(e=>"transparent"===(e?.name||"").toLowerCase());e&&Array.isArray(e.rgb)&&this.K.set(l,{id:e.id,premium:!!e.premium,name:e.name})}catch(e){}}async Z(){console.log("Template coordinates:",this.coords);const e=await createImageBitmap(this.file),t=e.width,n=e.height,i=t*n;console.log(`Template pixel analysis - Dimensions: ${t}×${n} = ${i.toLocaleString()} pixels`),this.X=i;try{const i=new OffscreenCanvas(t,n).getContext("2d",{ee:!0});i.imageSmoothingEnabled=!1,i.clearRect(0,0,t,n),i.drawImage(e,0,0);const o=i.getImageData(0,0,t,n).data;let s=0,r=0;const a=new Map;for(let e=0;e0){for(const e in t){const n=e,i=t[e];if(console.log(n),t.hasOwnProperty(e)){const e=n.split(" "),o=Number(e?.[0]),s=e?.[1]||"0",r=i.name||`Template ${o||""}`,a=i.tiles,c={};let m=0;const u=new Map;for(const e in a)if(console.log(e),a.hasOwnProperty(e)){const t=l(a[e]),n=new Blob([t],{type:"image/png"}),i=await createImageBitmap(n);c[e]=i;try{const e=i.width,t=i.height,n=new OffscreenCanvas(e,t).getContext("2d",{ee:!0});n.imageSmoothingEnabled=!1,n.clearRect(0,0,e,t),n.drawImage(i,0,0);const o=n.getImageData(0,0,e,t).data;for(let n=0;n{d.U?.add(e.split(",").slice(0,2).join(","))})}catch(e){}try{const e=t?.[n]?.palette;if(e)for(const[t,n]of Object.entries(e))d.Y[t]?d.Y[t].enabled=!!n?.enabled:d.Y[t]={count:n?.count||0,enabled:!!n?.enabled}}catch(e){}d.V=n,this.se.push(d),console.log(this.se),console.log("^^^ This ^^^")}}try{const e=document.querySelector("#bm-4");e&&(e.style.display=""),window.postMessage({source:"blue-marble",re:"bm-6"},"*")}catch(e){}}},h=new WeakSet,b=async function(e=navigator.userAgent){return(e=e||"").includes("OPR/")||e.includes("Opera")?"Opera":e.includes("Edg/")?"Edge":e.includes("Vivaldi")?"Vivaldi":e.includes("YaBrowser")?"Yandex":e.includes("Kiwi")?"Kiwi":e.includes("Brave")?"Brave":e.includes("Firefox/")?"Firefox":e.includes("Chrome/")?"Chrome":e.includes("Safari/")?"Safari":navigator.brave&&"function"==typeof navigator.brave.isBrave&&await navigator.brave.isBrave()?"Brave":"Unknown"},p=function(e=navigator.userAgent){return/Windows NT 11/i.test(e=e||"")?"Windows 11":/Windows NT 10/i.test(e)?"Windows 10":/Windows NT 6\.3/i.test(e)?"Windows 8.1":/Windows NT 6\.2/i.test(e)?"Windows 8":/Windows NT 6\.1/i.test(e)?"Windows 7":/Windows NT 6\.0/i.test(e)?"Windows Vista":/Windows NT 5\.1|Windows XP/i.test(e)?"Windows XP":/Mac OS X 10[_\.]15/i.test(e)?"macOS Catalina":/Mac OS X 10[_\.]14/i.test(e)?"macOS Mojave":/Mac OS X 10[_\.]13/i.test(e)?"macOS High Sierra":/Mac OS X 10[_\.]12/i.test(e)?"macOS Sierra":/Mac OS X 10[_\.]11/i.test(e)?"OS X El Capitan":/Mac OS X 10[_\.]10/i.test(e)?"OS X Yosemite":/Mac OS X 10[_\.]/i.test(e)?"macOS":/Android/i.test(e)?"Android":/iPhone|iPad|iPod/i.test(e)?"iOS":/Linux/i.test(e)?"Linux":"Unknown"};var y=GM_info.script.name.toString(),w=GM_info.script.version.toString();!function(e){const t=document.createElement("script");t.setAttribute("bm-w",y),t.setAttribute("bm-t","color: cornflowerblue;"),t.textContent=`(${e})();`,document.documentElement?.appendChild(t),t.remove()}(()=>{const e=document.currentScript,t=e?.getAttribute("bm-w")||"Blue Marble",n=e?.getAttribute("bm-t")||"",i=new Map;window.addEventListener("message",e=>{const{source:o,endpoint:s,blobID:r,blobData:a,blink:c}=e.data,l=Date.now()-c;if(console.groupCollapsed(`%c${t}%c: ${i.size} Recieved IMAGE message about blob "${r}"`,n,""),console.log(`Blob fetch took %c${String(Math.floor(l/6e4)).padStart(2,"0")}:${String(Math.floor(l/1e3)%60).padStart(2,"0")}.${String(l%1e3).padStart(3,"0")}%c MM:SS.mmm`,n,""),console.log(i),console.groupEnd(),"blue-marble"==o&&r&&a&&!s){const e=i.get(r);"function"==typeof e?e(a):function(...e){(0,console.warn)(...e)}(`%c${t}%c: Attempted to retrieve a blob (%s) from queue, but the blobID was not a function! Skipping...`,n,"",r),i.delete(r)}});const o=window.fetch;window.fetch=async function(...e){const s=await o.apply(this,e),r=s.clone(),a=(e[0]instanceof Request?e[0]?.url:e[0])||"ignore",c=r.headers.get("content-type")||"";if(c.includes("application/json"))console.log(`%c${t}%c: Sending JSON message about endpoint "${a}"`,n,""),r.json().then(e=>{window.postMessage({source:"blue-marble",endpoint:a,jsonData:e},"*")}).catch(e=>{console.error(`%c${t}%c: Failed to parse JSON: `,n,"",e)});else if(c.includes("image/")&&!a.includes("openfreemap")&&!a.includes("maps")){const e=Date.now(),o=await r.blob();return console.log(`%c${t}%c: ${i.size} Sending IMAGE message about endpoint "${a}"`,n,""),new Promise(s=>{const c=crypto.randomUUID();i.set(c,e=>{s(new Response(e,{headers:r.headers,status:r.status,statusText:r.statusText})),console.log(`%c${t}%c: ${i.size} Processed blob "${c}"`,n,"")}),window.postMessage({source:"blue-marble",endpoint:a,blobID:c,blobData:o,blink:e})}).catch(o=>{const s=Date.now();console.error(`%c${t}%c: Failed to Promise blob!`,n,""),console.groupCollapsed(`%c${t}%c: Details of failed blob Promise:`,n,""),console.log(`Endpoint: ${a}\nThere are ${i.size} blobs processing...\nBlink: ${e.toLocaleString()}\nTime Since Blink: ${String(Math.floor(s/6e4)).padStart(2,"0")}:${String(Math.floor(s/1e3)%60).padStart(2,"0")}.${String(s%1e3).padStart(3,"0")} MM:SS.mmm`),console.error("Exception stack:",o),console.groupEnd()})}return s}});var $=GM_getResourceText("CSS-BM-File");GM_addStyle($);var v=document.createElement("link");v.href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap",v.rel="preload",v.as="style",v.onload=function(){this.onload=null,this.rel="stylesheet"},document.head?.appendChild(v),new class{constructor(){this.ae=null,this.ce=null,this.le="#bm-a"}me(e){return this.ce=e,this.ae=new MutationObserver(e=>{for(const t of e)for(const e of t.addedNodes)e instanceof HTMLElement&&e.matches?.(this.le)}),this}ue(){return this.ae}observe(e,t=!1,n=!1){e.observe(this.ce,{childList:t,subtree:n})}};var x=new s(y,w),S=(new s(y,w),new class{constructor(e,t,n){i(this,m),this.name=e,this.version=t,this.o=n,this.de="1.0.0",this.he=null,this.be="!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~",this.R=1e3,this.oe=3,this.pe=null,this.ge=null,this.fe="bm-u",this.ye="div#map canvas.maplibregl-canvas",this.we=null,this.$e="",this.se=[],this.ie=null,this.ve=!0,this.xe=new Map}Se(){if(document.body.contains(this.pe))return this.pe;document.getElementById(this.fe)?.remove();const e=document.querySelector(this.ye),t=document.createElement("canvas");return t.id=this.fe,t.className="maplibregl-canvas",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.height=e?.clientHeight*(window.devicePixelRatio||1)+"px",t.style.width=e?.clientWidth*(window.devicePixelRatio||1)+"px",t.height=e?.clientHeight*(window.devicePixelRatio||1),t.width=e?.clientWidth*(window.devicePixelRatio||1),t.style.zIndex="8999",t.style.pointerEvents="none",e?.parentElement?.appendChild(t),this.pe=t,window.addEventListener("move",this.Me),window.addEventListener("zoom",this.Oe),window.addEventListener("resize",this.Te),this.pe}async De(){return{whoami:this.name.replace(" ",""),scriptVersion:this.version,schemaVersion:this.de,templates:{}}}async Ce(e,t,n){this.ie||(this.ie=await this.De(),console.log("Creating JSON...")),this.o.W(`Creating template at ${n.join(", ")}...`);const i=new f({displayName:t,J:0,_:a(this.he||0,this.be),file:e,coords:n}),{te:s,ne:r}=await i.Z(this.R);i.j=s;const c=`${i.J} ${i._}`;i.V=c,this.ie.templates[c]={name:i.displayName,coords:n.join(", "),enabled:!0,tiles:r,palette:i.Y},this.se=[],this.se.push(i);const l=(new Intl.NumberFormat).format(i.X);this.o.W(`Template created at ${n.join(", ")}! Total pixels: ${l}`);try{const e=document.querySelector("#bm-4");e&&(e.style.display=""),window.postMessage({source:"blue-marble",re:"bm-6"},"*")}catch(e){}console.log(Object.keys(this.ie.templates).length),console.log(this.ie),console.log(this.se),console.log(JSON.stringify(this.ie)),await o(this,m,u).call(this)}Ne(){}async ke(){this.ie||(this.ie=await this.De(),console.log("Creating JSON..."))}async Be(e,t){if(!this.ve)return e;const n=this.R*this.oe;t=t[0].toString().padStart(4,"0")+","+t[1].toString().padStart(4,"0"),console.log(`Searching for templates in tile: "${t}"`);const i=this.se;if(console.log(i),i.sort((e,t)=>e.J-t.J),console.log(i),!i.some(e=>!!e?.j&&(e.U&&e.U.size>0?e.U.has(t):Object.keys(e.j).some(e=>e.startsWith(t)))))return e;const o=i.map(e=>{const n=Object.keys(e.j).filter(e=>e.startsWith(t));if(0===n.length)return null;const i=n.map(t=>{const n=t.split(",");return{Ie:e.j[t],Le:[n[0],n[1]],Ge:[n[2],n[3]]}});return i?.[0]}).filter(Boolean);console.log(o);const s=o?.length||0;console.log(`templateCount = ${s}`);let r=0,a=0,c=0;const l=await createImageBitmap(e),m=new OffscreenCanvas(n,n),u=m.getContext("2d");u.imageSmoothingEnabled=!1,u.beginPath(),u.rect(0,0,n,n),u.clip(),u.clearRect(0,0,n,n),u.drawImage(l,0,0,n,n);let d=null;try{d=u.getImageData(0,0,n,n).data}catch(e){}for(const e of o){if(console.log("Template:"),console.log(e),d)try{const t=e.Ie.width,i=e.Ie.height,o=new OffscreenCanvas(t,i).getContext("2d",{ee:!0});o.imageSmoothingEnabled=!1,o.clearRect(0,0,t,i),o.drawImage(e.Ie,0,0);const s=o.getImageData(0,0,t,i).data,l=Number(e.Ge[0])*this.oe,m=Number(e.Ge[1])*this.oe;for(let e=0;e=n||u>=n)continue;const h=4*(e*t+i),b=s[h],p=s[h+1],g=s[h+2];if(s[h+3]<64){try{const e=this.se?.[0],t=4*(u*n+o),i=d[t],s=d[t+1],r=d[t+2],c=d[t+3],l=`${i},${s},${r}`,m=!!e?.H&&e.H.has(l);c>=64&&m&&a++}catch(e){}continue}try{const e=this.se?.[0];if(e?.H&&!e.H.has(`${b},${p},${g}`))continue}catch(e){}c++;const f=4*(u*n+o),y=d[f],w=d[f+1],$=d[f+2];d[f+3]<64||(y===b&&w===p&&$===g?r++:a++)}}catch(e){console.warn("Failed to compute per-tile painted/wrong stats:",e)}try{const t=this.se?.[0],n=t?.Y||{};if(Object.values(n).some(e=>!1===e?.enabled)){const i=e.Ie.width,o=e.Ie.height,s=new OffscreenCanvas(i,o),r=s.getContext("2d",{ee:!0});r.imageSmoothingEnabled=!1,r.clearRect(0,0,i,o),r.drawImage(e.Ie,0,0);const a=r.getImageData(0,0,i,o),c=a.data;for(let e=0;e0){const e=t;this.xe.set(e,{Pe:r,required:c,Fe:a});let n=0,i=0,o=0;for(const e of this.xe.values())n+=e.Pe||0,i+=e.required||0,o+=e.Fe||0;const l=this.se.reduce((e,t)=>e+(t.A||t.X||0),0),m=l>0?l:i,u=(new Intl.NumberFormat).format(n),d=(new Intl.NumberFormat).format(m),h=(new Intl.NumberFormat).format(m-n);this.o.W(`Displaying ${s} template${1==s?"":"s"}.\nPainted ${u} / ${d} • Wrong ${h}`)}else this.o.W(`Displaying ${s} templates.`);return await m.convertToBlob({type:"image/png"})}We(e){console.log("Importing JSON..."),console.log(e),"BlueMarble"==e?.whoami&&o(this,m,d).call(this,e)}Ee(e){this.ve=e}}(y,w,x)),M=new class{constructor(e){i(this,h),this.Je=e,this._e=!1,this.je=[],this.Re=[]}Xe(e){window.addEventListener("message",async t=>{const n=t.data,i=n.jsonData;if(!n||"blue-marble"!==n.source)return;if(!n.endpoint)return;const o=n.endpoint?.split("?")[0].split("/").filter(e=>e&&isNaN(Number(e))).filter(e=>e&&!e.includes(".")).pop();switch(console.log('%cBlue Marble%c: Recieved message about "%s"',"color: cornflowerblue;","",o),o){case"me":if(i.status&&"2"!=i.status?.toString()[0])return void e.F("You are not logged in!\nCould not fetch userdata.");const t=Math.ceil(Math.pow(Math.floor(i.level)*Math.pow(30,.65),1/.65)-i.pixelsPainted);console.log(i.id),(i.id||0===i.id)&&console.log(a(i.id,"!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~")),this.Je.he=i.id,e.B("bm-m",`Username: ${function(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}(i.name)}`),e.B("bm-h",`Droplets: ${(new Intl.NumberFormat).format(i.droplets)}`),e.B("bm-b",`Next level in ${(new Intl.NumberFormat).format(t)} pixel${1==t?"":"s"}`);break;case"pixel":const o=n.endpoint.split("?")[0].split("/").filter(e=>e&&!isNaN(Number(e))),c=new URLSearchParams(n.endpoint.split("?")[1]),l=[c.get("x"),c.get("y")];if(this.je.length&&(!o.length||!l.length))return void e.F("Coordinates are malformed!\nDid you try clicking the canvas first?");this.je=[...o,...l];const m=(s=o,r=l,[parseInt(s[0])%4*1e3+parseInt(r[0]),parseInt(s[1])%4*1e3+parseInt(r[1])]),u=document.querySelectorAll("span");for(const e of u)if(e.textContent.trim().includes(`${m[0]}, ${m[1]}`)){let t=document.querySelector("#bm-a");const n=`(Tl X: ${o[0]}, Tl Y: ${o[1]}, Px X: ${l[0]}, Px Y: ${l[1]})`;t?t.textContent=n:(t=document.createElement("span"),t.id="bm-a",t.textContent=n,t.style="margin-left: calc(var(--spacing)*3); font-size: small;",e.parentNode.parentNode.parentNode.insertAdjacentElement("afterend",t))}break;case"tiles":let d=n.endpoint.split("/");d=[parseInt(d[d.length-2]),parseInt(d[d.length-1].replace(".png",""))];const h=n.blobID,b=n.blobData,p=await this.Je.Be(b,d);window.postMessage({source:"blue-marble",blobID:h,blobData:p,blink:n.blink});break;case"robots":this._e="false"==i.userscript?.toString().toLowerCase();break}var s,r})}async Ae(e){console.log("Sending heartbeat to telemetry server...");let t=GM_getValue("bmUserSettings","{}");if(t=JSON.parse(t),!t||!t.telemetry||!t.uuid)return void console.log("Telemetry is disabled, not sending heartbeat.");const n=navigator.userAgent;let i=await o(this,h,b).call(this,n),s=o(this,h,p).call(this,n);GM_xmlhttpRequest({method:"POST",url:"https://telemetry.thebluecorner.net/heartbeat",headers:{"Content-Type":"application/json"},data:JSON.stringify({uuid:t.uuid,version:e,browser:i,os:s}),onload:e=>{200!==e.status&&r("Failed to send heartbeat:",e.statusText)},onerror:e=>{r("Error sending heartbeat:",e)}})}}(S);x.u(M);var O=JSON.parse(GM_getValue("bmTemplates","{}"));console.log(O),S.We(O);var T=JSON.parse(GM_getValue("bmUserSettings","{}"));if(console.log(T),console.log(Object.keys(T).length),0==Object.keys(T).length){const e=crypto.randomUUID();console.log(e),GM.setValue("bmUserSettings",JSON.stringify({uuid:e}))}if(setInterval(()=>M.Ae(w),18e5),console.log(`Telemetry is ${null==T?.telemetry}`),null==T?.telemetry||T?.telemetry>1){const e=new s(y,w);e.u(M),e.$({id:"bm-s-telemetry",style:"top: 20%"}).$({id:"bm-c-telemetry"}).$({id:"bm-r-telemetry"}).h().O(1,{textContent:`${y} Telemetry`}).h().h().T().h().$({id:"bm-M"}).v({textContent:"We collect anonymous telemetry data such as your browser, OS, and script version to make the experience better for everyone. The data is never shared personally. The data is never sold. You can turn this off anytime by pressing the 'Disable' button, but keeping it on helps us improve features and reliability faster. Thank you for supporting the Blue Marble!"}).h().v({textContent:'You can disable telemetry by pressing the "Disable" button below.'}).h().N({id:"bm-E",textContent:"Enable Telemetry"},(e,t)=>{t.onclick=()=>{const e=JSON.parse(GM_getValue("bmUserSettings","{}"));e.telemetry=1,GM.setValue("bmUserSettings",JSON.stringify(e));const t=document.getElementById("bm-s-telemetry");t&&(t.style.display="none")}}).h().N({id:"bm-B",textContent:"Disable Telemetry"},(e,t)=>{t.onclick=()=>{const e=JSON.parse(GM_getValue("bmUserSettings","{}"));e.telemetry=0,GM.setValue("bmUserSettings",JSON.stringify(e));const t=document.getElementById("bm-s-telemetry");t&&(t.style.display="none")}}).h().h().p(document.body),e.P("#bm-s-telemetry","#bm-r-telemetry")}!function(){let e=!1,t={};try{t=JSON.parse(GM_getValue("bmCoords","{}"))||{}}catch(e){t={}}const n=()=>{try{const e=Number(document.querySelector("#bm-n")?.value||""),t=Number(document.querySelector("#bm-o")?.value||""),n={qe:e,Ye:t,px:Number(document.querySelector("#bm-p")?.value||""),Ue:Number(document.querySelector("#bm-q")?.value||"")};GM.setValue("bmCoords",JSON.stringify(n))}catch(e){}};x.$({id:"bm-s",style:"top: 10px; right: 75px;"}).$({id:"bm-c"}).$({id:"bm-r"}).h().M({alt:"Blue Marble Icon - Click to minimize/maximize",src:"https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/main/dist/assets/Favicon.png",style:"cursor: pointer;"},(t,n)=>{n.addEventListener("click",()=>{e=!e;const i=document.querySelector("#bm-s"),o=document.querySelector("#bm-c"),s=document.querySelector("#bm-r"),r=document.querySelector("#bm-d"),a=document.querySelector("#bm-i"),c=document.querySelector("#bm-j"),l=document.querySelector("#bm-k"),m=document.querySelector("#bm-e"),u=document.querySelectorAll("#bm-d input");e||(i.style.width="auto",i.style.maxWidth="300px",i.style.minWidth="200px",i.style.padding="10px"),["#bm-s h1","#bm-8","#bm-s hr","#bm-7 > *:not(#bm-d)","#bm-5","#bm-3",`#${t.i}`,"#bm-4"].forEach(t=>{document.querySelectorAll(t).forEach(t=>{t.style.display=e?"none":""})}),e?(r&&(r.style.display="none"),a&&(a.style.display="none"),c&&(c.style.display="none"),l&&(l.style.display="none"),m&&(m.style.display="none"),u.forEach(e=>{e.style.display="none"}),i.style.width="60px",i.style.height="76px",i.style.maxWidth="60px",i.style.minWidth="60px",i.style.padding="8px",n.style.marginLeft="3px",o.style.textAlign="center",o.style.margin="0",o.style.marginBottom="0",s&&(s.style.display="",s.style.marginBottom="0.25em")):(r&&(r.style.display="",r.style.flexDirection="",r.style.justifyContent="",r.style.alignItems="",r.style.gap="",r.style.textAlign="",r.style.margin=""),a&&(a.style.display=""),c&&(c.style.display="",c.style.marginTop=""),l&&(l.style.display="",l.style.marginTop=""),m&&(m.style.display="",m.style.marginTop=""),u.forEach(e=>{e.style.display=""}),n.style.marginLeft="",i.style.padding="10px",o.style.textAlign="",o.style.margin="",o.style.marginBottom="",s&&(s.style.marginBottom="0.5em"),i.style.width="",i.style.height=""),n.alt=e?"Blue Marble Icon - Minimized (Click to maximize)":"Blue Marble Icon - Maximized (Click to minimize)"})}).h().O(1,{textContent:y}).h().h().T().h().$({id:"bm-8"}).v({id:"bm-m",textContent:"Username:"}).h().v({id:"bm-h",textContent:"Droplets:"}).h().v({id:"bm-b",textContent:"Next level in..."}).h().h().T().h().$({id:"bm-7"}).$({id:"bm-d"}).N({id:"bm-i",className:"bm-v",style:"margin-top: 0;",innerHTML:''},(e,t)=>{t.onclick=()=>{const t=e.t?.je;t?.[0]?(e.B("bm-n",t?.[0]||""),e.B("bm-o",t?.[1]||""),e.B("bm-p",t?.[2]||""),e.B("bm-q",t?.[3]||""),n()):e.F("Coordinates are malformed! Did you try clicking on the canvas first?")}}).h().I({type:"number",id:"bm-n",placeholder:"Tl X",min:0,max:2047,step:1,required:!0,value:t.qe??""},(e,t)=>{t.addEventListener("paste",e=>{let t=(e.clipboardData||window.clipboardData).getData("text").split(" ").filter(e=>e).map(Number).filter(e=>!isNaN(e));if(4!==t.length)return;let n=(i=document,coords=[],coords.push(i.querySelector("#bm-n")),coords.push(i.querySelector("#bm-o")),coords.push(i.querySelector("#bm-p")),coords.push(i.querySelector("#bm-q")),coords);var i;for(let e=0;en();t.addEventListener("input",i),t.addEventListener("change",i)}).h().I({type:"number",id:"bm-o",placeholder:"Tl Y",min:0,max:2047,step:1,required:!0,value:t.Ye??""},(e,t)=>{const i=()=>n();t.addEventListener("input",i),t.addEventListener("change",i)}).h().I({type:"number",id:"bm-p",placeholder:"Px X",min:0,max:2047,step:1,required:!0,value:t.px??""},(e,t)=>{const i=()=>n();t.addEventListener("input",i),t.addEventListener("change",i)}).h().I({type:"number",id:"bm-q",placeholder:"Px Y",min:0,max:2047,step:1,required:!0,value:t.Ue??""},(e,t)=>{const i=()=>n();t.addEventListener("input",i),t.addEventListener("change",i)}).h().h().$({id:"bm-4",style:"max-height: 140px; overflow: auto; border: 1px solid rgba(255,255,255,0.1); padding: 4px; border-radius: 4px; display: none;"}).$({style:"display: flex; gap: 6px; margin-bottom: 6px;"}).N({id:"bm-1",textContent:"Enable All"},(e,t)=>{t.onclick=()=>{const t=S.se[0];t?.Y&&(Object.values(t.Y).forEach(e=>e.enabled=!0),buildColorFilterList(),e.W("Enabled all colors"))}}).h().N({id:"bm-0",textContent:"Disable All"},(e,t)=>{t.onclick=()=>{const t=S.se[0];t?.Y&&(Object.values(t.Y).forEach(e=>e.enabled=!1),buildColorFilterList(),e.W("Disabled all colors"))}}).h().h().$({id:"bm-9"}).h().h().L({id:"bm-5",textContent:"Upload Template",accept:"image/png, image/jpeg, image/webp, image/bmp, image/gif"}).h().$({id:"bm-2"}).N({id:"bm-k",textContent:"Enable"},(e,t)=>{t.onclick=()=>{e.t?.Je?.Ee(!0),e.W("Enabled templates!")}}).h().N({id:"bm-j",textContent:"Create"},(e,t)=>{t.onclick=()=>{const t=document.querySelector("#bm-5"),n=document.querySelector("#bm-n");if(!n.checkValidity())return n.reportValidity(),void e.F("Coordinates are malformed! Did you try clicking on the canvas first?");const i=document.querySelector("#bm-o");if(!i.checkValidity())return i.reportValidity(),void e.F("Coordinates are malformed! Did you try clicking on the canvas first?");const o=document.querySelector("#bm-p");if(!o.checkValidity())return o.reportValidity(),void e.F("Coordinates are malformed! Did you try clicking on the canvas first?");const s=document.querySelector("#bm-q");if(!s.checkValidity())return s.reportValidity(),void e.F("Coordinates are malformed! Did you try clicking on the canvas first?");t?.files[0]?(S.Ce(t.files[0],t.files[0]?.name.replace(/\.[^/.]+$/,""),[Number(n.value),Number(i.value),Number(o.value),Number(s.value)]),e.W("Drew to canvas!")):e.F("No file selected!")}}).h().N({id:"bm-e",textContent:"Disable"},(e,t)=>{t.onclick=()=>{e.t?.Je?.Ee(!1),e.W("Disabled templates!")}}).h().h().G({id:x.i,placeholder:`Status: Sleeping...\nVersion: ${w}`,readOnly:!0}).h().$({id:"bm-3"}).$().N({id:"bm-f",className:"bm-v",innerHTML:"🎨",title:"Template Color Converter"},(e,t)=>{t.addEventListener("click",()=>{window.open("https://pepoafonso.github.io/color_converter_wplace/","_blank","noopener noreferrer")})}).h().h().S({textContent:"Made by SwingTheVine",style:"margin-top: auto;"}).h().h().h().p(document.body),window.buildColorFilterList=function(){const e=document.querySelector("#bm-9"),t=S.se?.[0];if(!e||!t?.Y)return void(e&&(e.innerHTML="No template colors to display."));e.innerHTML="";const n=Object.entries(t.Y).sort((e,t)=>t[1].count-e[1].count);for(const[t,i]of n){const[n,o,s]=t.split(",").map(Number),r=document.createElement("div");r.style.display="flex",r.style.alignItems="center",r.style.gap="8px",r.style.margin="4px 0";const a=document.createElement("div");a.style.width="14px",a.style.height="14px",a.style.border="1px solid rgba(255,255,255,0.5)",a.style.background=`rgb(${n},${o},${s})`;const c=document.createElement("span");c.style.fontSize="12px";let l=`${i.count.toLocaleString()}`;try{const e=S.se?.[0]?.K?.get(t);if(e&&"number"==typeof e.id){const t=e?.name||`rgb(${n},${o},${s})`,i=e.premium?"★ ":"";l=`#${e.id} ${i}${t} • ${l}`}}catch(e){}c.textContent=l;const m=document.createElement("input");m.type="checkbox",m.checked=!!i.enabled,m.addEventListener("change",()=>{i.enabled=m.checked,x.W(`${m.checked?"Enabled":"Disabled"} ${t}`);try{const e=S.se?.[0],t=e?.V;e&&t&&S.ie?.templates?.[t]&&(S.ie.templates[t].palette=e.Y,GM.setValue("bmTemplates",JSON.stringify(S.ie)))}catch(e){}}),r.appendChild(m),r.appendChild(a),r.appendChild(c),e.appendChild(r)}},window.addEventListener("message",e=>{if("bm-6"===e?.data?.re)try{buildColorFilterList()}catch(e){}}),setTimeout(()=>{try{if(S.se?.length>0){const e=document.querySelector("#bm-4");e&&(e.style.display=""),buildColorFilterList()}}catch(e){}},0)}(),x.P("#bm-s","#bm-r"),M.Xe(x),new MutationObserver((e,t)=>{const n=document.querySelector("#color-1");if(!n)return;let i=document.querySelector("#bm-l");if(!i){i=document.createElement("button"),i.id="bm-l",i.textContent="Move ↑",i.className="btn btn-soft",i.onclick=function(){const e=this.parentNode.parentNode.parentNode.parentNode,t="Move ↑"==this.textContent;e.parentNode.className=e.parentNode.className.replace(t?"bottom":"top",t?"top":"bottom"),e.style.borderTopLeftRadius=t?"0px":"var(--radius-box)",e.style.borderTopRightRadius=t?"0px":"var(--radius-box)",e.style.borderBottomLeftRadius=t?"var(--radius-box)":"0px",e.style.borderBottomRightRadius=t?"var(--radius-box)":"0px",this.textContent=t?"Move ↓":"Move ↑"};const e=n.parentNode.parentNode.parentNode.parentNode.querySelector("h2");e.parentNode?.appendChild(i)}}).observe(document.body,{childList:!0,subtree:!0}),function(...e){(0,console.log)(...e)}(`%c${y}%c (${w}) userscript has loaded!`,"color: cornflowerblue;","")})(); \ No newline at end of file +(()=>{var e,t,n=e=>{throw TypeError(e)},i=(e,t,i)=>t.has(e)?n("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),o=(e,t,i)=>(((e,t)=>{t.has(e)||n("Cannot access private method")})(e,t),i),s=class{constructor(t,n){i(this,e),this.name=t,this.version=n,this.t=null,this.i="bm-g",this.o=null,this.l=null,this.m=[]}u(e){this.t=e}h(){return this.m.length>0&&(this.l=this.m.pop()),this}p(e){e?.appendChild(this.o),this.o=null,this.l=null,this.m=[]}$(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"div",{},n)),this}v(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"p",{},n)),this}S(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"small",{},n)),this}M(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"img",{},n)),this}O(n,i={},s=()=>{}){return s(this,o(this,e,t).call(this,"h"+n,{},i)),this}T(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"hr",{},n)),this}D(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"br",{},n)),this}C(n={},i=()=>{}){const s=o(this,e,t).call(this,"label",{textContent:n.textContent??""});delete n.textContent;const r=o(this,e,t).call(this,"input",{type:"checkbox"},n);return s.insertBefore(r,s.firstChild),this.h(),i(this,s,r),this}N(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"button",{},n)),this}k(n={},i=()=>{}){const s=n.title??n.textContent??"Help: No info";delete n.textContent,n.title=`Help: ${s}`;const r={textContent:"?",className:"bm-v",onclick:()=>{this.B(this.i,s)}};return i(this,o(this,e,t).call(this,"button",r,n)),this}I(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"input",{},n)),this}L(n={},i=()=>{}){const s=n.textContent??"";delete n.textContent;const r=o(this,e,t).call(this,"div"),a=o(this,e,t).call(this,"input",{type:"file",style:"display: none !important; visibility: hidden !important; position: absolute !important; left: -9999px !important; width: 0 !important; height: 0 !important; opacity: 0 !important;"},n);this.h();const c=o(this,e,t).call(this,"button",{textContent:s});return this.h(),this.h(),a.setAttribute("tabindex","-1"),a.setAttribute("aria-hidden","true"),c.addEventListener("click",()=>{a.click()}),a.addEventListener("change",()=>{c.style.maxWidth=`${c.offsetWidth}px`,a.files.length>0?c.textContent=a.files[0].name:c.textContent=s}),i(this,r,a,c),this}G(n={},i=()=>{}){return i(this,o(this,e,t).call(this,"textarea",{},n)),this}B(e,t,n=!1){const i=document.getElementById(e.replace(/^#/,""));i&&(i instanceof HTMLInputElement?i.value=t:n?i.textContent=t:i.innerHTML=t)}P(e,t){let n,i=!1,o=0,s=null,r=0,a=0,c=0,l=0;if(e=document.querySelector("#"==e?.[0]?e:"#"+e),t=document.querySelector("#"==t?.[0]?t:"#"+t),!e||!t)return void this.F(`Can not drag! ${e?"":"moveMe"} ${e||t?"":"and "}${t?"":"iMoveThings "}was not found!`);const m=()=>{if(i){const t=Math.abs(r-c),n=Math.abs(a-l);(t>.5||n>.5)&&(r=c,a=l,e.style.transform=`translate(${r}px, ${a}px)`,e.style.left="0px",e.style.top="0px",e.style.right=""),s=requestAnimationFrame(m)}};let u=null;const d=(d,h)=>{i=!0,u=e.getBoundingClientRect(),n=d-u.left,o=h-u.top;const b=window.getComputedStyle(e).transform;if(b&&"none"!==b){const e=new DOMMatrix(b);r=e.m41,a=e.m42}else r=u.left,a=u.top;c=r,l=a,document.body.style.userSelect="none",t.classList.add("dragging"),s&&cancelAnimationFrame(s),m()},h=()=>{i=!1,s&&(cancelAnimationFrame(s),s=null),document.body.style.userSelect="",t.classList.remove("dragging")};t.addEventListener("mousedown",function(e){e.preventDefault(),d(e.clientX,e.clientY)}),t.addEventListener("touchstart",function(e){const t=e?.touches?.[0];t&&(d(t.clientX,t.clientY),e.preventDefault())},{passive:!1}),document.addEventListener("mousemove",function(e){i&&u&&(c=e.clientX-n,l=e.clientY-o)},{passive:!0}),document.addEventListener("touchmove",function(e){if(i&&u){const t=e?.touches?.[0];if(!t)return;c=t.clientX-n,l=t.clientY-o,e.preventDefault()}},{passive:!1}),document.addEventListener("mouseup",h),document.addEventListener("touchend",h),document.addEventListener("touchcancel",h)}W(e){(0,console.info)(`${this.name}: ${e}`),this.B(this.i,"Status: "+e,!0)}F(e){(0,console.error)(`${this.name}: ${e}`),this.B(this.i,"Error: "+e,!0)}};function r(...e){(0,console.error)(...e)}function a(e,t){if(0===e)return t[0];let n="";const i=t.length;for(;e>0;)n=t[e%i]+n,e=Math.floor(e/i);return n}function c(e){let t="";for(let n=0;n"transparent"!==(e?.name||"").toLowerCase()&&Array.isArray(e?.rgb)).map(e=>`${e.rgb[0]},${e.rgb[1]},${e.rgb[2]}`));const l="222,250,206";this.H.add(l),this.K=new Map(c.filter(e=>Array.isArray(e?.rgb)).map(e=>[`${e.rgb[0]},${e.rgb[1]},${e.rgb[2]}`,{id:e.id,premium:!!e.premium,name:e.name}]));try{const e=c.find(e=>"transparent"===(e?.name||"").toLowerCase());e&&Array.isArray(e.rgb)&&this.K.set(l,{id:e.id,premium:!!e.premium,name:e.name})}catch(e){}}async Z(){console.log("Template coordinates:",this.coords);const e=await createImageBitmap(this.file),t=e.width,n=e.height,i=t*n;console.log(`Template pixel analysis - Dimensions: ${t}×${n} = ${i.toLocaleString()} pixels`),this.X=i;try{const i=new OffscreenCanvas(t,n).getContext("2d",{ee:!0});i.imageSmoothingEnabled=!1,i.clearRect(0,0,t,n),i.drawImage(e,0,0);const o=i.getImageData(0,0,t,n).data;let s=0,r=0;const a=new Map;for(let e=0;e0){for(const e in t){const n=e,i=t[e];if(console.log(n),t.hasOwnProperty(e)){const e=n.split(" "),o=Number(e?.[0]),s=e?.[1]||"0",r=i.name||`Template ${o||""}`,a=i.tiles,c={};let m=0;const u=new Map;for(const e in a)if(console.log(e),a.hasOwnProperty(e)){const t=l(a[e]),n=new Blob([t],{type:"image/png"}),i=await createImageBitmap(n);c[e]=i;try{const e=i.width,t=i.height,n=new OffscreenCanvas(e,t).getContext("2d",{ee:!0});n.imageSmoothingEnabled=!1,n.clearRect(0,0,e,t),n.drawImage(i,0,0);const o=n.getImageData(0,0,e,t).data;for(let n=0;n{d.U?.add(e.split(",").slice(0,2).join(","))})}catch(e){}try{const e=t?.[n]?.palette;if(e)for(const[t,n]of Object.entries(e))d.Y[t]?d.Y[t].enabled=!!n?.enabled:d.Y[t]={count:n?.count||0,enabled:!!n?.enabled}}catch(e){}d.V=n,this.se.push(d),console.log(this.se),console.log("^^^ This ^^^")}}try{const e=document.querySelector("#bm-4");e&&(e.style.display=""),window.postMessage({source:"blue-marble",re:"bm-6"},"*")}catch(e){}}},h=new WeakSet,b=async function(e=navigator.userAgent){return(e=e||"").includes("OPR/")||e.includes("Opera")?"Opera":e.includes("Edg/")?"Edge":e.includes("Vivaldi")?"Vivaldi":e.includes("YaBrowser")?"Yandex":e.includes("Kiwi")?"Kiwi":e.includes("Brave")?"Brave":e.includes("Firefox/")?"Firefox":e.includes("Chrome/")?"Chrome":e.includes("Safari/")?"Safari":navigator.brave&&"function"==typeof navigator.brave.isBrave&&await navigator.brave.isBrave()?"Brave":"Unknown"},p=function(e=navigator.userAgent){return/Windows NT 11/i.test(e=e||"")?"Windows 11":/Windows NT 10/i.test(e)?"Windows 10":/Windows NT 6\.3/i.test(e)?"Windows 8.1":/Windows NT 6\.2/i.test(e)?"Windows 8":/Windows NT 6\.1/i.test(e)?"Windows 7":/Windows NT 6\.0/i.test(e)?"Windows Vista":/Windows NT 5\.1|Windows XP/i.test(e)?"Windows XP":/Mac OS X 10[_\.]15/i.test(e)?"macOS Catalina":/Mac OS X 10[_\.]14/i.test(e)?"macOS Mojave":/Mac OS X 10[_\.]13/i.test(e)?"macOS High Sierra":/Mac OS X 10[_\.]12/i.test(e)?"macOS Sierra":/Mac OS X 10[_\.]11/i.test(e)?"OS X El Capitan":/Mac OS X 10[_\.]10/i.test(e)?"OS X Yosemite":/Mac OS X 10[_\.]/i.test(e)?"macOS":/Android/i.test(e)?"Android":/iPhone|iPad|iPod/i.test(e)?"iOS":/Linux/i.test(e)?"Linux":"Unknown"};var y=GM_info.script.name.toString(),w=GM_info.script.version.toString();!function(e){const t=document.createElement("script");t.setAttribute("bm-w",y),t.setAttribute("bm-t","color: cornflowerblue;"),t.textContent=`(${e})();`,document.documentElement?.appendChild(t),t.remove()}(()=>{const e=document.currentScript,t=e?.getAttribute("bm-w")||"Blue Marble",n=e?.getAttribute("bm-t")||"",i=new Map;window.addEventListener("message",e=>{const{source:o,endpoint:s,blobID:r,blobData:a,blink:c}=e.data,l=Date.now()-c;if(console.groupCollapsed(`%c${t}%c: ${i.size} Recieved IMAGE message about blob "${r}"`,n,""),console.log(`Blob fetch took %c${String(Math.floor(l/6e4)).padStart(2,"0")}:${String(Math.floor(l/1e3)%60).padStart(2,"0")}.${String(l%1e3).padStart(3,"0")}%c MM:SS.mmm`,n,""),console.log(i),console.groupEnd(),"blue-marble"==o&&r&&a&&!s){const e=i.get(r);"function"==typeof e?e(a):function(...e){(0,console.warn)(...e)}(`%c${t}%c: Attempted to retrieve a blob (%s) from queue, but the blobID was not a function! Skipping...`,n,"",r),i.delete(r)}});const o=window.fetch;window.fetch=async function(...e){const s=await o.apply(this,e),r=s.clone(),a=(e[0]instanceof Request?e[0]?.url:e[0])||"ignore",c=r.headers.get("content-type")||"";if(c.includes("application/json"))console.log(`%c${t}%c: Sending JSON message about endpoint "${a}"`,n,""),r.json().then(e=>{window.postMessage({source:"blue-marble",endpoint:a,jsonData:e},"*")}).catch(e=>{console.error(`%c${t}%c: Failed to parse JSON: `,n,"",e)});else if(c.includes("image/")&&!a.includes("openfreemap")&&!a.includes("maps")){const e=Date.now(),o=await r.blob();return console.log(`%c${t}%c: ${i.size} Sending IMAGE message about endpoint "${a}"`,n,""),new Promise(s=>{const c=crypto.randomUUID();i.set(c,e=>{s(new Response(e,{headers:r.headers,status:r.status,statusText:r.statusText})),console.log(`%c${t}%c: ${i.size} Processed blob "${c}"`,n,"")}),window.postMessage({source:"blue-marble",endpoint:a,blobID:c,blobData:o,blink:e})}).catch(o=>{const s=Date.now();console.error(`%c${t}%c: Failed to Promise blob!`,n,""),console.groupCollapsed(`%c${t}%c: Details of failed blob Promise:`,n,""),console.log(`Endpoint: ${a}\nThere are ${i.size} blobs processing...\nBlink: ${e.toLocaleString()}\nTime Since Blink: ${String(Math.floor(s/6e4)).padStart(2,"0")}:${String(Math.floor(s/1e3)%60).padStart(2,"0")}.${String(s%1e3).padStart(3,"0")} MM:SS.mmm`),console.error("Exception stack:",o),console.groupEnd()})}return s}});var $=GM_getResourceText("CSS-BM-File");GM_addStyle($);var v=document.createElement("link");v.href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap",v.rel="preload",v.as="style",v.onload=function(){this.onload=null,this.rel="stylesheet"},document.head?.appendChild(v),new class{constructor(){this.ae=null,this.ce=null,this.le="#bm-a"}me(e){return this.ce=e,this.ae=new MutationObserver(e=>{for(const t of e)for(const e of t.addedNodes)e instanceof HTMLElement&&e.matches?.(this.le)}),this}ue(){return this.ae}observe(e,t=!1,n=!1){e.observe(this.ce,{childList:t,subtree:n})}};var x=new s(y,w),S=(new s(y,w),new class{constructor(e,t,n){i(this,m),this.name=e,this.version=t,this.o=n,this.de="1.0.0",this.he=null,this.be="!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~",this.R=1e3,this.oe=3,this.pe=null,this.ge=null,this.fe="bm-u",this.ye="div#map canvas.maplibregl-canvas",this.we=null,this.$e="",this.se=[],this.ie=null,this.ve=!0,this.xe=new Map}Se(){if(document.body.contains(this.pe))return this.pe;document.getElementById(this.fe)?.remove();const e=document.querySelector(this.ye),t=document.createElement("canvas");return t.id=this.fe,t.className="maplibregl-canvas",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.height=e?.clientHeight*(window.devicePixelRatio||1)+"px",t.style.width=e?.clientWidth*(window.devicePixelRatio||1)+"px",t.height=e?.clientHeight*(window.devicePixelRatio||1),t.width=e?.clientWidth*(window.devicePixelRatio||1),t.style.zIndex="8999",t.style.pointerEvents="none",e?.parentElement?.appendChild(t),this.pe=t,window.addEventListener("move",this.Me),window.addEventListener("zoom",this.Oe),window.addEventListener("resize",this.Te),this.pe}async De(){return{whoami:this.name.replace(" ",""),scriptVersion:this.version,schemaVersion:this.de,templates:{}}}async Ce(e,t,n){this.ie||(this.ie=await this.De(),console.log("Creating JSON...")),this.o.W(`Creating template at ${n.join(", ")}...`);const i=new f({displayName:t,J:0,_:a(this.he||0,this.be),file:e,coords:n}),{te:s,ne:r}=await i.Z(this.R);i.j=s;const c=`${i.J} ${i._}`;i.V=c,this.ie.templates[c]={name:i.displayName,coords:n.join(", "),enabled:!0,tiles:r,palette:i.Y},this.se=[],this.se.push(i);const l=(new Intl.NumberFormat).format(i.X);this.o.W(`Template created at ${n.join(", ")}! Total pixels: ${l}`);try{const e=document.querySelector("#bm-4");e&&(e.style.display=""),window.postMessage({source:"blue-marble",re:"bm-6"},"*")}catch(e){}console.log(Object.keys(this.ie.templates).length),console.log(this.ie),console.log(this.se),console.log(JSON.stringify(this.ie)),await o(this,m,u).call(this)}Ne(){}async ke(){this.ie||(this.ie=await this.De(),console.log("Creating JSON..."))}async Be(e,t){if(!this.ve)return e;const n=this.R*this.oe;t=t[0].toString().padStart(4,"0")+","+t[1].toString().padStart(4,"0"),console.log(`Searching for templates in tile: "${t}"`);const i=this.se;if(console.log(i),i.sort((e,t)=>e.J-t.J),console.log(i),!i.some(e=>!!e?.j&&(e.U&&e.U.size>0?e.U.has(t):Object.keys(e.j).some(e=>e.startsWith(t)))))return e;const o=i.map(e=>{const n=Object.keys(e.j).filter(e=>e.startsWith(t));if(0===n.length)return null;const i=n.map(t=>{const n=t.split(",");return{Ie:e.j[t],Le:[n[0],n[1]],Ge:[n[2],n[3]]}});return i?.[0]}).filter(Boolean);console.log(o);const s=o?.length||0;console.log(`templateCount = ${s}`);let r=0,a=0,c=0;const l=await createImageBitmap(e),m=new OffscreenCanvas(n,n),u=m.getContext("2d");u.imageSmoothingEnabled=!1,u.beginPath(),u.rect(0,0,n,n),u.clip(),u.clearRect(0,0,n,n),u.drawImage(l,0,0,n,n);let d=null;try{d=u.getImageData(0,0,n,n).data}catch(e){}for(const e of o){if(console.log("Template:"),console.log(e),d)try{const t=e.Ie.width,i=e.Ie.height,o=new OffscreenCanvas(t,i).getContext("2d",{ee:!0});o.imageSmoothingEnabled=!1,o.clearRect(0,0,t,i),o.drawImage(e.Ie,0,0);const s=o.getImageData(0,0,t,i).data,l=Number(e.Ge[0])*this.oe,m=Number(e.Ge[1])*this.oe;for(let e=0;e=n||u>=n)continue;const h=4*(e*t+i),b=s[h],p=s[h+1],g=s[h+2];if(s[h+3]<64){try{const e=this.se?.[0],t=4*(u*n+o),i=d[t],s=d[t+1],r=d[t+2],c=d[t+3],l=`${i},${s},${r}`,m=!!e?.H&&e.H.has(l);c>=64&&m&&a++}catch(e){}continue}try{const e=this.se?.[0];if(e?.H&&!e.H.has(`${b},${p},${g}`))continue}catch(e){}c++;const f=4*(u*n+o),y=d[f],w=d[f+1],$=d[f+2];d[f+3]<64||(y===b&&w===p&&$===g?r++:a++)}}catch(e){console.warn("Failed to compute per-tile painted/wrong stats:",e)}try{const t=this.se?.[0],n=t?.Y||{};if(Object.values(n).some(e=>!1===e?.enabled)){const i=e.Ie.width,o=e.Ie.height,s=new OffscreenCanvas(i,o),r=s.getContext("2d",{ee:!0});r.imageSmoothingEnabled=!1,r.clearRect(0,0,i,o),r.drawImage(e.Ie,0,0);const a=r.getImageData(0,0,i,o),c=a.data;for(let e=0;e0){const e=t;this.xe.set(e,{Pe:r,required:c,Fe:a});let n=0,i=0,o=0;for(const e of this.xe.values())n+=e.Pe||0,i+=e.required||0,o+=e.Fe||0;const l=this.se.reduce((e,t)=>e+(t.A||t.X||0),0),m=l>0?l:i,u=(new Intl.NumberFormat).format(n),d=(new Intl.NumberFormat).format(m),h=(new Intl.NumberFormat).format(m-n);this.o.W(`Displaying ${s} template${1==s?"":"s"}.\nPainted ${u} / ${d} • Wrong ${h}`)}else this.o.W(`Displaying ${s} templates.`);return await m.convertToBlob({type:"image/png"})}We(e){console.log("Importing JSON..."),console.log(e),"BlueMarble"==e?.whoami&&o(this,m,d).call(this,e)}Ee(e){this.ve=e}}(y,w,x)),M=new class{constructor(e){i(this,h),this.Je=e,this._e=!1,this.je=[],this.Re=[]}Xe(e){window.addEventListener("message",async t=>{const n=t.data,i=n.jsonData;if(!n||"blue-marble"!==n.source)return;if(!n.endpoint)return;const o=n.endpoint?.split("?")[0].split("/").filter(e=>e&&isNaN(Number(e))).filter(e=>e&&!e.includes(".")).pop();switch(console.log('%cBlue Marble%c: Recieved message about "%s"',"color: cornflowerblue;","",o),o){case"me":if(i.status&&"2"!=i.status?.toString()[0])return void e.F("You are not logged in!\nCould not fetch userdata.");const t=Math.ceil(Math.pow(Math.floor(i.level)*Math.pow(30,.65),1/.65)-i.pixelsPainted);console.log(i.id),(i.id||0===i.id)&&console.log(a(i.id,"!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~")),this.Je.he=i.id,e.B("bm-m",`Username: ${function(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}(i.name)}`),e.B("bm-h",`Droplets: ${(new Intl.NumberFormat).format(i.droplets)}`),e.B("bm-b",`Next level in ${(new Intl.NumberFormat).format(t)} pixel${1==t?"":"s"}`);break;case"pixel":const o=n.endpoint.split("?")[0].split("/").filter(e=>e&&!isNaN(Number(e))),c=new URLSearchParams(n.endpoint.split("?")[1]),l=[c.get("x"),c.get("y")];if(this.je.length&&(!o.length||!l.length))return void e.F("Coordinates are malformed!\nDid you try clicking the canvas first?");this.je=[...o,...l];const m=(s=o,r=l,[parseInt(s[0])%4*1e3+parseInt(r[0]),parseInt(s[1])%4*1e3+parseInt(r[1])]),u=document.querySelectorAll("span");for(const e of u)if(e.textContent.trim().includes(`${m[0]}, ${m[1]}`)){let t=document.querySelector("#bm-a");const n=`(Tl X: ${o[0]}, Tl Y: ${o[1]}, Px X: ${l[0]}, Px Y: ${l[1]})`;t?t.textContent=n:(t=document.createElement("span"),t.id="bm-a",t.textContent=n,t.style="margin-left: calc(var(--spacing)*3); font-size: small;",e.parentNode.parentNode.parentNode.insertAdjacentElement("afterend",t))}break;case"tiles":let d=n.endpoint.split("/");d=[parseInt(d[d.length-2]),parseInt(d[d.length-1].replace(".png",""))];const h=n.blobID,b=n.blobData,p=await this.Je.Be(b,d);window.postMessage({source:"blue-marble",blobID:h,blobData:p,blink:n.blink});break;case"robots":this._e="false"==i.userscript?.toString().toLowerCase();break}var s,r})}async Ae(e){console.log("Sending heartbeat to telemetry server...");let t=GM_getValue("bmUserSettings","{}");if(t=JSON.parse(t),!t||!t.telemetry||!t.uuid)return void console.log("Telemetry is disabled, not sending heartbeat.");const n=navigator.userAgent;let i=await o(this,h,b).call(this,n),s=o(this,h,p).call(this,n);GM_xmlhttpRequest({method:"POST",url:"https://telemetry.thebluecorner.net/heartbeat",headers:{"Content-Type":"application/json"},data:JSON.stringify({uuid:t.uuid,version:e,browser:i,os:s}),onload:e=>{200!==e.status&&r("Failed to send heartbeat:",e.statusText)},onerror:e=>{r("Error sending heartbeat:",e)}})}}(S);x.u(M);var O=JSON.parse(GM_getValue("bmTemplates","{}"));console.log(O),S.We(O);var T=JSON.parse(GM_getValue("bmUserSettings","{}"));if(console.log(T),console.log(Object.keys(T).length),0==Object.keys(T).length){const e=crypto.randomUUID();console.log(e),GM.setValue("bmUserSettings",JSON.stringify({uuid:e}))}if(setInterval(()=>M.Ae(w),18e5),console.log(`Telemetry is ${!(null==T?.telemetry)}`),null==T?.telemetry||T?.telemetry>1){const e=new s(y,w);e.u(M),e.$({id:"bm-s-telemetry",style:"top: 20%"}).$({id:"bm-c-telemetry"}).$({id:"bm-r-telemetry"}).h().O(1,{textContent:`${y} Telemetry`}).h().h().T().h().$({id:"bm-M"}).v({textContent:"We collect anonymous telemetry data such as your browser, OS, and script version to make the experience better for everyone. The data is never shared personally. The data is never sold. You can turn this off anytime by pressing the 'Disable' button, but keeping it on helps us improve features and reliability faster. Thank you for supporting the Blue Marble!"}).h().v({textContent:'You can disable telemetry by pressing the "Disable" button below.'}).h().N({id:"bm-E",textContent:"Enable Telemetry"},(e,t)=>{t.onclick=()=>{const e=JSON.parse(GM_getValue("bmUserSettings","{}"));e.telemetry=1,GM.setValue("bmUserSettings",JSON.stringify(e));const t=document.getElementById("bm-s-telemetry");t&&(t.style.display="none")}}).h().N({id:"bm-B",textContent:"Disable Telemetry"},(e,t)=>{t.onclick=()=>{const e=JSON.parse(GM_getValue("bmUserSettings","{}"));e.telemetry=0,GM.setValue("bmUserSettings",JSON.stringify(e));const t=document.getElementById("bm-s-telemetry");t&&(t.style.display="none")}}).h().h().p(document.body),e.P("#bm-s-telemetry","#bm-r-telemetry")}!function(){let e=!1,t={};try{t=JSON.parse(GM_getValue("bmCoords","{}"))||{}}catch(e){t={}}const n=()=>{try{const e=Number(document.querySelector("#bm-n")?.value||""),t=Number(document.querySelector("#bm-o")?.value||""),n={qe:e,Ye:t,px:Number(document.querySelector("#bm-p")?.value||""),Ue:Number(document.querySelector("#bm-q")?.value||"")};GM.setValue("bmCoords",JSON.stringify(n))}catch(e){}};x.$({id:"bm-s",style:"top: 10px; right: 75px;"}).$({id:"bm-c"}).$({id:"bm-r"}).h().M({alt:"Blue Marble Icon - Click to minimize/maximize",src:"https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/main/dist/assets/Favicon.png",style:"cursor: pointer;"},(t,n)=>{n.addEventListener("click",()=>{e=!e;const i=document.querySelector("#bm-s"),o=document.querySelector("#bm-c"),s=document.querySelector("#bm-r"),r=document.querySelector("#bm-d"),a=document.querySelector("#bm-i"),c=document.querySelector("#bm-j"),l=document.querySelector("#bm-k"),m=document.querySelector("#bm-e"),u=document.querySelectorAll("#bm-d input");e||(i.style.width="auto",i.style.maxWidth="300px",i.style.minWidth="200px",i.style.padding="10px"),["#bm-s h1","#bm-8","#bm-s hr","#bm-7 > *:not(#bm-d)","#bm-5","#bm-3",`#${t.i}`,"#bm-4"].forEach(t=>{document.querySelectorAll(t).forEach(t=>{t.style.display=e?"none":""})}),e?(r&&(r.style.display="none"),a&&(a.style.display="none"),c&&(c.style.display="none"),l&&(l.style.display="none"),m&&(m.style.display="none"),u.forEach(e=>{e.style.display="none"}),i.style.width="60px",i.style.height="76px",i.style.maxWidth="60px",i.style.minWidth="60px",i.style.padding="8px",n.style.marginLeft="3px",o.style.textAlign="center",o.style.margin="0",o.style.marginBottom="0",s&&(s.style.display="",s.style.marginBottom="0.25em")):(r&&(r.style.display="",r.style.flexDirection="",r.style.justifyContent="",r.style.alignItems="",r.style.gap="",r.style.textAlign="",r.style.margin=""),a&&(a.style.display=""),c&&(c.style.display="",c.style.marginTop=""),l&&(l.style.display="",l.style.marginTop=""),m&&(m.style.display="",m.style.marginTop=""),u.forEach(e=>{e.style.display=""}),n.style.marginLeft="",i.style.padding="10px",o.style.textAlign="",o.style.margin="",o.style.marginBottom="",s&&(s.style.marginBottom="0.5em"),i.style.width="",i.style.height=""),n.alt=e?"Blue Marble Icon - Minimized (Click to maximize)":"Blue Marble Icon - Maximized (Click to minimize)"})}).h().O(1,{textContent:y}).h().h().T().h().$({id:"bm-8"}).v({id:"bm-m",textContent:"Username:"}).h().v({id:"bm-h",textContent:"Droplets:"}).h().v({id:"bm-b",textContent:"Next level in..."}).h().h().T().h().$({id:"bm-7"}).$({id:"bm-d"}).N({id:"bm-i",className:"bm-v",style:"margin-top: 0;",innerHTML:''},(e,t)=>{t.onclick=()=>{const t=e.t?.je;t?.[0]?(e.B("bm-n",t?.[0]||""),e.B("bm-o",t?.[1]||""),e.B("bm-p",t?.[2]||""),e.B("bm-q",t?.[3]||""),n()):e.F("Coordinates are malformed! Did you try clicking on the canvas first?")}}).h().I({type:"number",id:"bm-n",placeholder:"Tl X",min:0,max:2047,step:1,required:!0,value:t.qe??""},(e,t)=>{t.addEventListener("paste",e=>{let t=(e.clipboardData||window.clipboardData).getData("text").split(" ").filter(e=>e).map(Number).filter(e=>!isNaN(e));if(4!==t.length)return;let n=(i=document,coords=[],coords.push(i.querySelector("#bm-n")),coords.push(i.querySelector("#bm-o")),coords.push(i.querySelector("#bm-p")),coords.push(i.querySelector("#bm-q")),coords);var i;for(let e=0;en();t.addEventListener("input",i),t.addEventListener("change",i)}).h().I({type:"number",id:"bm-o",placeholder:"Tl Y",min:0,max:2047,step:1,required:!0,value:t.Ye??""},(e,t)=>{const i=()=>n();t.addEventListener("input",i),t.addEventListener("change",i)}).h().I({type:"number",id:"bm-p",placeholder:"Px X",min:0,max:2047,step:1,required:!0,value:t.px??""},(e,t)=>{const i=()=>n();t.addEventListener("input",i),t.addEventListener("change",i)}).h().I({type:"number",id:"bm-q",placeholder:"Px Y",min:0,max:2047,step:1,required:!0,value:t.Ue??""},(e,t)=>{const i=()=>n();t.addEventListener("input",i),t.addEventListener("change",i)}).h().h().$({id:"bm-4",style:"max-height: 140px; overflow: auto; border: 1px solid rgba(255,255,255,0.1); padding: 4px; border-radius: 4px; display: none;"}).$({style:"display: flex; gap: 6px; margin-bottom: 6px;"}).N({id:"bm-1",textContent:"Enable All"},(e,t)=>{t.onclick=()=>{const t=S.se[0];t?.Y&&(Object.values(t.Y).forEach(e=>e.enabled=!0),buildColorFilterList(),e.W("Enabled all colors"))}}).h().N({id:"bm-0",textContent:"Disable All"},(e,t)=>{t.onclick=()=>{const t=S.se[0];t?.Y&&(Object.values(t.Y).forEach(e=>e.enabled=!1),buildColorFilterList(),e.W("Disabled all colors"))}}).h().h().$({id:"bm-9"}).h().h().L({id:"bm-5",textContent:"Upload Template",accept:"image/png, image/jpeg, image/webp, image/bmp, image/gif"}).h().$({id:"bm-2"}).N({id:"bm-k",textContent:"Enable"},(e,t)=>{t.onclick=()=>{e.t?.Je?.Ee(!0),e.W("Enabled templates!")}}).h().N({id:"bm-j",textContent:"Create"},(e,t)=>{t.onclick=()=>{const t=document.querySelector("#bm-5"),n=document.querySelector("#bm-n");if(!n.checkValidity())return n.reportValidity(),void e.F("Coordinates are malformed! Did you try clicking on the canvas first?");const i=document.querySelector("#bm-o");if(!i.checkValidity())return i.reportValidity(),void e.F("Coordinates are malformed! Did you try clicking on the canvas first?");const o=document.querySelector("#bm-p");if(!o.checkValidity())return o.reportValidity(),void e.F("Coordinates are malformed! Did you try clicking on the canvas first?");const s=document.querySelector("#bm-q");if(!s.checkValidity())return s.reportValidity(),void e.F("Coordinates are malformed! Did you try clicking on the canvas first?");t?.files[0]?(S.Ce(t.files[0],t.files[0]?.name.replace(/\.[^/.]+$/,""),[Number(n.value),Number(i.value),Number(o.value),Number(s.value)]),e.W("Drew to canvas!")):e.F("No file selected!")}}).h().N({id:"bm-e",textContent:"Disable"},(e,t)=>{t.onclick=()=>{e.t?.Je?.Ee(!1),e.W("Disabled templates!")}}).h().h().G({id:x.i,placeholder:`Status: Sleeping...\nVersion: ${w}`,readOnly:!0}).h().$({id:"bm-3"}).$().N({id:"bm-f",className:"bm-v",innerHTML:"🎨",title:"Template Color Converter"},(e,t)=>{t.addEventListener("click",()=>{window.open("https://pepoafonso.github.io/color_converter_wplace/","_blank","noopener noreferrer")})}).h().h().S({textContent:"Made by SwingTheVine",style:"margin-top: auto;"}).h().h().h().p(document.body),window.buildColorFilterList=function(){const e=document.querySelector("#bm-9"),t=S.se?.[0];if(!e||!t?.Y)return void(e&&(e.innerHTML="No template colors to display."));e.innerHTML="";const n=Object.entries(t.Y).sort((e,t)=>t[1].count-e[1].count);for(const[t,i]of n){const[n,o,s]=t.split(",").map(Number),r=document.createElement("div");r.style.display="flex",r.style.alignItems="center",r.style.gap="8px",r.style.margin="4px 0";const a=document.createElement("div");a.style.width="14px",a.style.height="14px",a.style.border="1px solid rgba(255,255,255,0.5)",a.style.background=`rgb(${n},${o},${s})`;const c=document.createElement("span");c.style.fontSize="12px";let l=`${i.count.toLocaleString()}`;try{const e=S.se?.[0]?.K?.get(t);if(e&&"number"==typeof e.id){const t=e?.name||`rgb(${n},${o},${s})`,i=e.premium?"★ ":"";l=`#${e.id} ${i}${t} • ${l}`}}catch(e){}c.textContent=l;const m=document.createElement("input");m.type="checkbox",m.checked=!!i.enabled,m.addEventListener("change",()=>{i.enabled=m.checked,x.W(`${m.checked?"Enabled":"Disabled"} ${t}`);try{const e=S.se?.[0],t=e?.V;e&&t&&S.ie?.templates?.[t]&&(S.ie.templates[t].palette=e.Y,GM.setValue("bmTemplates",JSON.stringify(S.ie)))}catch(e){}}),r.appendChild(m),r.appendChild(a),r.appendChild(c),e.appendChild(r)}},window.addEventListener("message",e=>{if("bm-6"===e?.data?.re)try{buildColorFilterList()}catch(e){}}),setTimeout(()=>{try{if(S.se?.length>0){const e=document.querySelector("#bm-4");e&&(e.style.display=""),buildColorFilterList()}}catch(e){}},0)}(),x.P("#bm-s","#bm-r"),M.Xe(x),new MutationObserver((e,t)=>{const n=document.querySelector("#color-1");if(!n)return;let i=document.querySelector("#bm-l");if(!i){i=document.createElement("button"),i.id="bm-l",i.textContent="Move ↑",i.className="btn btn-soft",i.onclick=function(){const e=this.parentNode.parentNode.parentNode.parentNode,t="Move ↑"==this.textContent;e.parentNode.className=e.parentNode.className.replace(t?"bottom":"top",t?"top":"bottom"),e.style.borderTopLeftRadius=t?"0px":"var(--radius-box)",e.style.borderTopRightRadius=t?"0px":"var(--radius-box)",e.style.borderBottomLeftRadius=t?"var(--radius-box)":"0px",e.style.borderBottomRightRadius=t?"var(--radius-box)":"0px",this.textContent=t?"Move ↓":"Move ↑"};const e=n.parentNode.parentNode.parentNode.parentNode.querySelector("h2");e.parentNode?.appendChild(i)}}).observe(document.body,{childList:!0,subtree:!0}),function(...e){(0,console.log)(...e)}(`%c${y}%c (${w}) userscript has loaded!`,"color: cornflowerblue;","")})(); \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 512e0ce..fec01c8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -48,7 +48,7 @@ Software License: MPL-2.0 Contact Me WakaTime -Total Patches +Total Patches Total Lines of Code Total Comments Compression diff --git a/package-lock.json b/package-lock.json index 42583ed..1aeca7c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wplace-bluemarble", - "version": "0.81.37", + "version": "0.81.38", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wplace-bluemarble", - "version": "0.81.37", + "version": "0.81.38", "devDependencies": { "esbuild": "^0.25.0", "jsdoc": "^4.0.4", diff --git a/package.json b/package.json index e8195b0..8bf93dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wplace-bluemarble", - "version": "0.81.37", + "version": "0.81.38", "type": "module", "scripts": { "build": "node build/build.js", diff --git a/src/BlueMarble.meta.js b/src/BlueMarble.meta.js index 27d1426..52b41e9 100644 --- a/src/BlueMarble.meta.js +++ b/src/BlueMarble.meta.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Blue Marble // @namespace https://github.com/SwingTheVine/ -// @version 0.81.37 +// @version 0.81.38 // @description A userscript to automate and/or enhance the user experience on Wplace.live. Make sure to comply with the site's Terms of Service, and rules! This script is not affiliated with Wplace.live in any way, use at your own risk. This script is not affiliated with TamperMonkey. The author of this userscript is not responsible for any damages, issues, loss of data, or punishment that may occur as a result of using this script. This script is provided "as is" under the MPL-2.0 license. The "Blue Marble" icon is licensed under CC0 1.0 Universal (CC0 1.0) Public Domain Dedication. The image is owned by NASA. // @author SwingTheVine // @license MPL-2.0 diff --git a/src/main.js b/src/main.js index b227814..ef2b301 100644 --- a/src/main.js +++ b/src/main.js @@ -197,7 +197,7 @@ if (Object.keys(userSettings).length == 0) { } setInterval(() => apiManager.sendHeartbeat(version), 1000 * 60 * 30); // Sends a heartbeat every 30 minutes -console.log(`Telemetry is ${userSettings?.telemetry == undefined}`); +console.log(`Telemetry is ${!(userSettings?.telemetry == undefined)}`); if ((userSettings?.telemetry == undefined) || (userSettings?.telemetry > 1)) { // Increment 1 to retrigger telemetry notice const telemetryOverlay = new Overlay(name, version); telemetryOverlay.setApiManager(apiManager); // Sets the API manager for the telemetry overlay