From b8933327b925368d6c7263940ebbd378b1c7ea9d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 31 Jul 2025 08:53:07 +0000 Subject: [PATCH] Release version; Fixed commit description bug in build.yml ...I think? --- dist/BlueMarble.user.js | 8 ++++---- docs/README.md | 4 ++-- package.json | 2 +- src/BlueMarble.meta.js | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dist/BlueMarble.user.js b/dist/BlueMarble.user.js index 7e3687a..c326a3c 100644 --- a/dist/BlueMarble.user.js +++ b/dist/BlueMarble.user.js @@ -1,23 +1,23 @@ // ==UserScript== // @name Blue Marble // @namespace https://github.com/SwingTheVine/ -// @version 0.64.12 +// @version 0.65.0 // @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 // @supportURL https://discord.gg/tpeBPy46hf // @homepageURL https://github.com/SwingTheVine/Wplace-BlueMarble -// @icon https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/7f9d852d99646eb626aa8296757968289c1e8c8f/dist/assets/Favicon.png +// @icon https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/51b906a447aa39e6ea82ece26696d73fb6c9b693/dist/assets/Favicon.png // @updateURL https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/main/dist/BlueMarble.user.js // @downloadURL https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/main/dist/BlueMarble.user.js // @run-at document-start // @match *://*.wplace.live/* // @grant GM_getResourceText // @grant GM_addStyle -// @resource CSS-BM-File https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/7f9d852d99646eb626aa8296757968289c1e8c8f/dist/BlueMarble.user.css +// @resource CSS-BM-File https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/51b906a447aa39e6ea82ece26696d73fb6c9b693/dist/BlueMarble.user.css // ==/UserScript== // Wplace --> https://wplace.live // License --> https://www.mozilla.org/en-US/MPL/2.0/ -(()=>{var t,e,n=t=>{throw TypeError(t)},s=(t,e,s)=>(((t,e)=>{e.has(t)||n("Cannot access private method")})(t,e),s);t=new WeakSet,e=function(t,e={},n={}){const s=document.createElement(t);this.t?(this.i.appendChild(s),this.o.push(this.i),this.i=s):(this.t=s,this.i=s);for(const[t,n]of Object.entries(e))s[t]=n;for(const[t,e]of Object.entries(n))s[t]=e;return s};var i=GM_info.script.name.toString(),o=GM_info.script.version.toString();!function(t){const e=document.createElement("script");e.setAttribute("bm-s",i),e.setAttribute("bm-q","color: cornflowerblue;"),e.textContent=`(${t})();`,document.documentElement.appendChild(e),e.remove()}(()=>{const t=document.currentScript,e=t?.getAttribute("bm-s")||"Blue Marble",n=t?.getAttribute("bm-q")||"",s=new Map;window.addEventListener("message",t=>{const{source:i,endpoint:o,blobID:a,blobData:r,blink:c}=t.data,l=Date.now()-c;console.groupCollapsed(`%c${e}%c: ${s.size} Recieved IMAGE message about blob "${a}"`,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(s),console.groupEnd(),"blue-marble"==i&&a&&r&&!o&&s.get(a)(r)});const i=window.fetch;window.fetch=async function(...t){const o=await i.apply(this,t),a=o.clone(),r=(t[0]instanceof Request?t[0]?.url:t[0])||"ignore",c=a.headers.get("content-type")||"";if(c.includes("application/json"))console.log(`%c${e}%c: Sending JSON message about endpoint "${r}"`,n,""),a.json().then(t=>{window.postMessage({source:"blue-marble",endpoint:r,jsonData:t},"*")}).catch(t=>{console.error(`%c${e}%c: Failed to parse JSON: `,n,"",t)});else if(c.includes("image/")&&!r.includes("openfreemap")){const t=Date.now(),i=await a.blob();return console.log(`%c${e}%c: ${s.size} Sending IMAGE message about endpoint "${r}"`,n,""),new Promise(o=>{const c=crypto.randomUUID();s.set(c,t=>{o(new Response(t,{headers:a.headers,status:a.status,statusText:a.statusText})),s.delete(c),console.log(`%c${e}%c: ${s.size} Processed blob "${c}"`,n,"")}),window.postMessage({source:"blue-marble",endpoint:r,blobID:c,blobData:i,blink:t})}).catch(i=>{const o=Date.now();console.error(`%c${e}%c: Failed to Promise blob!`,n,""),console.groupCollapsed(`%c${e}%c: Details of failed blob Promise:`,n,""),console.log(`Endpoint: ${r}\nThere are ${s.size} blobs processing...\nBlink: ${t.toLocaleString()}\nTime Since Blink: ${String(Math.floor(o/6e4)).padStart(2,"0")}:${String(Math.floor(o/1e3)%60).padStart(2,"0")}.${String(o%1e3).padStart(3,"0")} MM:SS.mmm`),console.error("Exception stack:",i),console.groupEnd()})}return o}});var a=GM_getResourceText("CSS-BM-File");GM_addStyle(a);var r=document.createElement("link");r.href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap",r.rel="preload",r.as="style",r.onload=function(){this.onload=null,this.rel="stylesheet"},document.head.appendChild(r),new class{constructor(){this.l=null,this.h=null,this.m="#bm-9"}u(t){return this.h=t,this.l=new MutationObserver(t=>{for(const e of t)for(const t of e.addedNodes)t instanceof HTMLElement&&t.matches?.(this.m)}),this}p(){return this.l}observe(t,e=!1,n=!1){t.observe(this.h,{childList:e,subtree:n})}};var c=new class{constructor(e,s){var i,o;i=this,(o=t).has(i)?n("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(i):o.set(i,undefined),this.name=e,this.version=s,this.v=null,this.$="bm-e",this.t=null,this.i=null,this.o=[]}M(t){this.v=t}S(){return this.o.length>0&&(this.i=this.o.pop()),this}C(t){t.appendChild(this.t),this.t=null,this.i=null,this.o=[]}T(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"div",{},n)),this}k(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"p",{},n)),this}I(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"small",{},n)),this}D(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"img",{},n)),this}B(n,i={},o=()=>{}){return o(this,s(this,t,e).call(this,"h"+n,{},i)),this}N(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"hr",{},n)),this}P(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"br",{},n)),this}H(n={},i=()=>{}){const o=s(this,t,e).call(this,"label",{textContent:n.textContent??""});delete n.textContent;const a=s(this,t,e).call(this,"input",{type:"checkbox"},n);return o.insertBefore(a,o.firstChild),this.S(),i(this,o,a),this}L(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"button",{},n)),this}O(n={},i=()=>{}){const o=n.title??n.textContent??"Help: No info";delete n.textContent,n.title=`Help: ${o}`;const a={textContent:"?",className:"bm-t",onclick:()=>{this.R(this.$,o)}};return i(this,s(this,t,e).call(this,"button",a,n)),this}G(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"input",{},n)),this}j(n={},i=()=>{}){const o=n.textContent??"";delete n.textContent;const a=s(this,t,e).call(this,"div"),r=s(this,t,e).call(this,"input",{type:"file",style:"display: none;"},n);this.S();const c=s(this,t,e).call(this,"button",{textContent:o});return this.S(),this.S(),c.addEventListener("click",()=>{r.click()}),r.addEventListener("change",()=>{c.style.maxWidth=`${c.offsetWidth}px`,r.files.length>0?c.textContent=r.files[0].name:c.textContent=o}),i(this,a,r,c),this}F(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"textarea",{},n)),this}R(t,e,n=!1){const s=document.getElementById(t.replace(/^#/,""));s&&(s instanceof HTMLInputElement?s.value=e:n?s.textContent=e:s.innerHTML=e)}U(t,e){let n,s=!1,i=0;t=document.querySelector("#"==t?.[0]?t:"#"+t),e=document.querySelector("#"==e?.[0]?e:"#"+e),t&&e?(e.addEventListener("mousedown",function(o){s=!0,n=o.clientX-t.getBoundingClientRect().left,i=o.clientY-t.getBoundingClientRect().top,document.body.style.userSelect="none",e.classList.add("dragging")}),e.addEventListener("touchstart",function(o){s=!0;const a=o?.touches?.[0];a&&(n=a.clientX-t.getBoundingClientRect().left,i=a.clientY-t.getBoundingClientRect().top,document.body.style.userSelect="none",e.classList.add("dragging"))},{passive:!1}),document.addEventListener("mousemove",function(e){s&&(t.style.left=e.clientX-n+"px",t.style.top=e.clientY-i+"px",t.style.right="")}),document.addEventListener("touchmove",function(e){if(s){const s=e?.touches?.[0];if(!s)return;t.style.left=s.clientX-n+"px",t.style.top=s.clientY-i+"px",e.preventDefault()}},{passive:!1}),document.addEventListener("mouseup",function(){s=!1,document.body.style.userSelect="",e.classList.remove("dragging")}),document.addEventListener("touchend",function(){s=!1,document.body.style.userSelect="",e.classList.remove("dragging")}),document.addEventListener("touchcancel",function(){s=!1,document.body.style.userSelect="",e.classList.remove("dragging")})):this.W(`Can not drag! ${t?"":"moveMe"} ${t||e?"":"and "}${e?"":"iMoveThings "}was not found!`)}X(t){(0,console.info)(`${this.name}: ${t}`),this.R(this.$,"Status: "+t,!0)}W(t){(0,console.error)(`${this.name}: ${t}`),this.R(this.$,"Error: "+t,!0)}}(i,o),l=new class{constructor(){this.Y=null,this._=null,this.q="bm-r",this.A="div#map canvas.maplibregl-canvas",this.V=null,this.J=""}Z(){if(document.body.contains(this.Y))return this.Y;document.getElementById(this.q)?.remove();const t=document.querySelector(this.A),e=document.createElement("canvas");return e.id=this.q,e.className="maplibregl-canvas",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.height=t?.clientHeight*(window.devicePixelRatio||1)+"px",e.style.width=t?.clientWidth*(window.devicePixelRatio||1)+"px",e.height=t?.clientHeight*(window.devicePixelRatio||1),e.width=t?.clientWidth*(window.devicePixelRatio||1),e.style.zIndex="8999",e.style.pointerEvents="none",t?.parentElement?.appendChild(e),this.Y=e,window.addEventListener("move",this.K),window.addEventListener("zoom",this.tt),window.addEventListener("resize",this.et),this.Y}nt(t){this.V=t,this.J="file"}async st(t,e=[0,0,0,0]){if("file"!=this.J&&"template"!=this.J)return;const n=3e3;e=e?.length?e:[0,0,0,0],console.log(this.V);const s="template"==this.J?this.V:await createImageBitmap(await this.it(this.V)),i=await createImageBitmap(t),o=new OffscreenCanvas(n,n),a=o.getContext("2d");a.imageSmoothingEnabled=!1,a.beginPath(),a.rect(0,0,n,n),a.clip(),a.clearRect(0,0,n,n),a.drawImage(i,0,0,n,n),a.drawImage(s,3*e[2],3*e[3]);const r=await o.convertToBlob({type:"image/png"});return"template"!=this.J&&(this.V=s,this.J="template"),r}async it(t,e=3,n="image/png"){const s=await createImageBitmap(t);e|=1;const i=s.width*Math.round(e),o=s.height*Math.round(e),a=document.createElement("canvas");a.width=i,a.height=o;const r=a.getContext("2d");r.imageSmoothingEnabled=!1,r.drawImage(s,0,0,i,o);const c=r.getImageData(0,0,i,o);for(let t=0;t{a.toBlob(t,n)})}},h=new class{constructor(t){this.ot=t,this.rt=!1,this.ct=[],this.lt=[]}ht(t){window.addEventListener("message",async e=>{const n=e.data,s=n.jsonData;if(!n||"blue-marble"!==n.source)return;if(!n.endpoint)return;const i=n.endpoint?.split("?")[0].split("/").filter(t=>t&&isNaN(Number(t))).filter(t=>t&&!t.includes(".")).pop();switch(console.log(`%cBlue Marble%c: Recieved message about "${i}"`,"color: cornflowerblue;",""),i){case"me":if(s.status&&"2"!=s.status?.toString()[0])return void t.W("The game is down!\nCould not fetch userdata.");const e=Math.ceil(Math.pow(Math.floor(s.level)*Math.pow(30,.65),1/.65)-s.pixelsPainted);t.R("bm-j",`Username: ${function(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}(s.name)}`),t.R("bm-f",`Droplets: ${(new Intl.NumberFormat).format(s.droplets)}`),t.R("bm-a",`Next level in ${(new Intl.NumberFormat).format(e)} pixel${1==e?"":"s"}`);break;case"pixel":const i=n.endpoint.split("?")[0].split("/").filter(t=>t&&!isNaN(Number(t))),r=new URLSearchParams(n.endpoint.split("?")[1]),c=[r.get("x"),r.get("y")];if(this.ct.length&&(!i.length||!c.length))return void t.W("Coordinates are malformed!\nDid you try clicking the canvas first?");this.ct=[...i,...c];const l=(o=i,a=c,[parseInt(o[0])%4*1e3+parseInt(a[0]),parseInt(o[1])%4*1e3+parseInt(a[1])]),h=document.querySelectorAll("span");for(const t of h)if(t.textContent.trim().includes(`${l[0]}, ${l[1]}`)){let e=document.querySelector("#bm-9");const n=`(Tl X: ${i[0]}, Tl Y: ${i[1]}, Px X: ${c[0]}, Px Y: ${c[1]})`;e?e.textContent=n:(e=document.createElement("span"),e.id="bm-9",e.textContent=n,e.style="margin-left: calc(var(--spacing)*3); font-size: small;",t.parentNode.parentNode.parentNode.insertAdjacentElement("afterend",e))}break;case"tiles":let d=n.endpoint.split("/");d=[parseInt(d[d.length-2]),parseInt(d[d.length-1].replace(".png",""))];const m=n.blobID,u=n.blobData;let p=u;this.lt?.length>=4&&d[0]==this.lt[0]&&d[1]==this.lt[1]&&(console.log(`templateState: ${this.ot.J||null}`),p=this.ot.J?await this.ot.st(u,this.lt):u),window.postMessage({source:"blue-marble",blobID:m,blobData:p,blink:n.blink});break;case"robots":this.rt="false"==s.userscript?.toString().toLowerCase();break}var o,a})}}(l);c.M(h),c.T({id:"bm-p",style:"top: 10px; right: 75px;"}).T({id:"bm-b"}).T({id:"bm-k"}).S().D({alt:"Blue Marble Icon",src:"https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/main/dist/assets/Favicon.png"}).S().B(1,{textContent:i}).S().S().N().S().T({id:"bm-4"}).k({id:"bm-j",textContent:"Username:"}).S().k({id:"bm-f",textContent:"Droplets:"}).S().k({id:"bm-a",textContent:"Next level in..."}).S().S().N().S().T({id:"bm-3"}).H({id:"bm-g",textContent:"Stealth",checked:!0}).S().O({title:"Waits for the website to make requests, instead of sending requests."}).S().P().S().H({id:"bm-6",textContent:"Possessed",checked:!0}).S().O({title:"Controls the website as if it were possessed."}).S().P().S().T({id:"bm-c"}).L({id:"bm-h",className:"bm-t",style:"margin-top: 0;",innerHTML:''},(t,e)=>{e.onclick=()=>{const e=t.v?.ct;e?.[0]?(t.R("bm-l",e?.[0]||""),t.R("bm-m",e?.[1]||""),t.R("bm-n",e?.[2]||""),t.R("bm-o",e?.[3]||"")):t.W("Coordinates are malformed! Did you try clicking on the canvas first?")}}).S().G({type:"number",id:"bm-l",placeholder:"Tl X",min:0,max:2047,step:1}).S().G({type:"number",id:"bm-m",placeholder:"Tl Y",min:0,max:2047,step:1}).S().G({type:"number",id:"bm-n",placeholder:"Px X",min:0,max:2047,step:1}).S().G({type:"number",id:"bm-o",placeholder:"Px Y",min:0,max:2047,step:1}).S().S().j({id:"bm-2",textContent:"Upload Template",accept:"image/png, image/jpeg, image/webp, image/bmp, image/gif"}).S().T({id:"bm-0"}).L({id:"bm-i",textContent:"Enable"},(t,e)=>{e.onclick=()=>{const e=document.querySelector("#bm-2");e?.files[0]?(console.log(`TCoords: ${h.lt}\nCoords: ${h.ct}`),h.lt=h.ct,console.log(`TCoords: ${h.lt}\nCoords: ${h.ct}`),l.nt(e.files[0]),t.X("Drew to canvas!")):t.W("No file selected!")}}).S().L({id:"bm-d",textContent:"Disable"}).S().S().F({id:c.$,placeholder:`Status: Sleeping...\nVersion: ${o}`,readOnly:!0}).S().T({id:"bm-1"}).T().L({id:"bm-7",className:"bm-t",textContent:"✈"}).S().L({id:"bm-8",className:"bm-t",innerHTML:''}).S().L({id:"bm-5",className:"bm-t",innerHTML:"🖌"}).S().S().I({textContent:"Made by SwingTheVine",style:"margin-top: auto;"}).S().S().S().C(document.body),c.U("#bm-p","#bm-k"),h.ht(c),function(...t){(0,console.log)(...t)}(`%c${i}%c (${o}) userscript has loaded!`,"color: cornflowerblue;","")})(); \ No newline at end of file +(()=>{var t,e,n=t=>{throw TypeError(t)},s=(t,e,s)=>(((t,e)=>{e.has(t)||n("Cannot access private method")})(t,e),s);t=new WeakSet,e=function(t,e={},n={}){const s=document.createElement(t);this.t?(this.i.appendChild(s),this.o.push(this.i),this.i=s):(this.t=s,this.i=s);for(const[t,n]of Object.entries(e))s[t]=n;for(const[t,e]of Object.entries(n))s[t]=e;return s};var i=GM_info.script.name.toString(),o=GM_info.script.version.toString();!function(t){const e=document.createElement("script");e.setAttribute("bm-s",i),e.setAttribute("bm-q","color: cornflowerblue;"),e.textContent=`(${t})();`,document.documentElement.appendChild(e),e.remove()}(()=>{const t=document.currentScript,e=(t?.getAttribute("bm-s"),t?.getAttribute("bm-q"),new Map);window.addEventListener("message",t=>{const{source:n,endpoint:s,blobID:i,blobData:o,blink:a}=t.data;Date.now(),"blue-marble"==n&&i&&o&&!s&&e.get(i)(o)});const n=window.fetch;window.fetch=async function(...t){const s=await n.apply(this,t),i=s.clone(),o=(t[0]instanceof Request?t[0]?.url:t[0])||"ignore",a=i.headers.get("content-type")||"";if(a.includes("application/json"))i.json().then(t=>{window.postMessage({source:"blue-marble",endpoint:o,jsonData:t},"*")}).catch(t=>{});else if(a.includes("image/")&&!o.includes("openfreemap")){const t=Date.now(),n=await i.blob();return new Promise(s=>{const a=crypto.randomUUID();e.set(a,t=>{s(new Response(t,{headers:i.headers,status:i.status,statusText:i.statusText})),e.delete(a)}),window.postMessage({source:"blue-marble",endpoint:o,blobID:a,blobData:n,blink:t})}).catch(t=>{Date.now()})}return s}});var a=GM_getResourceText("CSS-BM-File");GM_addStyle(a);var r=document.createElement("link");r.href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap",r.rel="preload",r.as="style",r.onload=function(){this.onload=null,this.rel="stylesheet"},document.head.appendChild(r),new class{constructor(){this.l=null,this.h=null,this.u="#bm-9"}m(t){return this.h=t,this.l=new MutationObserver(t=>{for(const e of t)for(const t of e.addedNodes)t instanceof HTMLElement&&t.matches?.(this.u)}),this}p(){return this.l}observe(t,e=!1,n=!1){t.observe(this.h,{childList:e,subtree:n})}};var c=new class{constructor(e,s){var i,o;i=this,(o=t).has(i)?n("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(i):o.set(i,undefined),this.name=e,this.version=s,this.v=null,this.M="bm-e",this.t=null,this.i=null,this.o=[]}C(t){this.v=t}$(){return this.o.length>0&&(this.i=this.o.pop()),this}I(t){t.appendChild(this.t),this.t=null,this.i=null,this.o=[]}T(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"div",{},n)),this}D(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"p",{},n)),this}k(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"small",{},n)),this}S(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"img",{},n)),this}N(n,i={},o=()=>{}){return o(this,s(this,t,e).call(this,"h"+n,{},i)),this}B(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"hr",{},n)),this}H(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"br",{},n)),this}L(n={},i=()=>{}){const o=s(this,t,e).call(this,"label",{textContent:n.textContent??""});delete n.textContent;const a=s(this,t,e).call(this,"input",{type:"checkbox"},n);return o.insertBefore(a,o.firstChild),this.$(),i(this,o,a),this}P(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"button",{},n)),this}O(n={},i=()=>{}){const o=n.title??n.textContent??"Help: No info";delete n.textContent,n.title=`Help: ${o}`;const a={textContent:"?",className:"bm-t",onclick:()=>{this.R(this.M,o)}};return i(this,s(this,t,e).call(this,"button",a,n)),this}j(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"input",{},n)),this}G(n={},i=()=>{}){const o=n.textContent??"";delete n.textContent;const a=s(this,t,e).call(this,"div"),r=s(this,t,e).call(this,"input",{type:"file",style:"display: none;"},n);this.$();const c=s(this,t,e).call(this,"button",{textContent:o});return this.$(),this.$(),c.addEventListener("click",()=>{r.click()}),r.addEventListener("change",()=>{c.style.maxWidth=`${c.offsetWidth}px`,r.files.length>0?c.textContent=r.files[0].name:c.textContent=o}),i(this,a,r,c),this}U(n={},i=()=>{}){return i(this,s(this,t,e).call(this,"textarea",{},n)),this}R(t,e,n=!1){const s=document.getElementById(t.replace(/^#/,""));s&&(s instanceof HTMLInputElement?s.value=e:n?s.textContent=e:s.innerHTML=e)}W(t,e){let n,s=!1,i=0;t=document.querySelector("#"==t?.[0]?t:"#"+t),e=document.querySelector("#"==e?.[0]?e:"#"+e),t&&e?(e.addEventListener("mousedown",function(o){s=!0,n=o.clientX-t.getBoundingClientRect().left,i=o.clientY-t.getBoundingClientRect().top,document.body.style.userSelect="none",e.classList.add("dragging")}),e.addEventListener("touchstart",function(o){s=!0;const a=o?.touches?.[0];a&&(n=a.clientX-t.getBoundingClientRect().left,i=a.clientY-t.getBoundingClientRect().top,document.body.style.userSelect="none",e.classList.add("dragging"))},{passive:!1}),document.addEventListener("mousemove",function(e){s&&(t.style.left=e.clientX-n+"px",t.style.top=e.clientY-i+"px",t.style.right="")}),document.addEventListener("touchmove",function(e){if(s){const s=e?.touches?.[0];if(!s)return;t.style.left=s.clientX-n+"px",t.style.top=s.clientY-i+"px",e.preventDefault()}},{passive:!1}),document.addEventListener("mouseup",function(){s=!1,document.body.style.userSelect="",e.classList.remove("dragging")}),document.addEventListener("touchend",function(){s=!1,document.body.style.userSelect="",e.classList.remove("dragging")}),document.addEventListener("touchcancel",function(){s=!1,document.body.style.userSelect="",e.classList.remove("dragging")})):this.X(`Can not drag! ${t?"":"moveMe"} ${t||e?"":"and "}${e?"":"iMoveThings "}was not found!`)}Y(t){(0,console.info)(`${this.name}: ${t}`),this.R(this.M,"Status: "+t,!0)}X(t){(0,console.error)(`${this.name}: ${t}`),this.R(this.M,"Error: "+t,!0)}}(i,o),l=new class{constructor(){this._=null,this.q=null,this.F="bm-r",this.V="div#map canvas.maplibregl-canvas",this.A=null,this.Z=""}J(){if(document.body.contains(this._))return this._;document.getElementById(this.F)?.remove();const t=document.querySelector(this.V),e=document.createElement("canvas");return e.id=this.F,e.className="maplibregl-canvas",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.height=t?.clientHeight*(window.devicePixelRatio||1)+"px",e.style.width=t?.clientWidth*(window.devicePixelRatio||1)+"px",e.height=t?.clientHeight*(window.devicePixelRatio||1),e.width=t?.clientWidth*(window.devicePixelRatio||1),e.style.zIndex="8999",e.style.pointerEvents="none",t?.parentElement?.appendChild(e),this._=e,window.addEventListener("move",this.K),window.addEventListener("zoom",this.tt),window.addEventListener("resize",this.et),this._}nt(t){this.A=t,this.Z="file"}async st(t,e=[0,0,0,0]){if("file"!=this.Z&&"template"!=this.Z)return;const n=3e3;e=e?.length?e:[0,0,0,0];const s="template"==this.Z?this.A:await createImageBitmap(await this.it(this.A)),i=await createImageBitmap(t),o=new OffscreenCanvas(n,n),a=o.getContext("2d");a.imageSmoothingEnabled=!1,a.beginPath(),a.rect(0,0,n,n),a.clip(),a.clearRect(0,0,n,n),a.drawImage(i,0,0,n,n),a.drawImage(s,3*e[2],3*e[3]);const r=await o.convertToBlob({type:"image/png"});return"template"!=this.Z&&(this.A=s,this.Z="template"),r}async it(t,e=3,n="image/png"){const s=await createImageBitmap(t);e|=1;const i=s.width*Math.round(e),o=s.height*Math.round(e),a=document.createElement("canvas");a.width=i,a.height=o;const r=a.getContext("2d");r.imageSmoothingEnabled=!1,r.drawImage(s,0,0,i,o);const c=r.getImageData(0,0,i,o);for(let t=0;t{a.toBlob(t,n)})}},h=new class{constructor(t){this.ot=t,this.rt=!1,this.ct=[],this.lt=[]}ht(t){window.addEventListener("message",async e=>{const n=e.data,s=n.jsonData;if(!n||"blue-marble"!==n.source)return;if(!n.endpoint)return;const i=n.endpoint?.split("?")[0].split("/").filter(t=>t&&isNaN(Number(t))).filter(t=>t&&!t.includes(".")).pop();switch(i){case"me":if(s.status&&"2"!=s.status?.toString()[0])return void t.X("The game is down!\nCould not fetch userdata.");const e=Math.ceil(Math.pow(Math.floor(s.level)*Math.pow(30,.65),1/.65)-s.pixelsPainted);t.R("bm-j",`Username: ${function(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}(s.name)}`),t.R("bm-f",`Droplets: ${(new Intl.NumberFormat).format(s.droplets)}`),t.R("bm-a",`Next level in ${(new Intl.NumberFormat).format(e)} pixel${1==e?"":"s"}`);break;case"pixel":const i=n.endpoint.split("?")[0].split("/").filter(t=>t&&!isNaN(Number(t))),r=new URLSearchParams(n.endpoint.split("?")[1]),c=[r.get("x"),r.get("y")];if(this.ct.length&&(!i.length||!c.length))return void t.X("Coordinates are malformed!\nDid you try clicking the canvas first?");this.ct=[...i,...c];const l=(o=i,a=c,[parseInt(o[0])%4*1e3+parseInt(a[0]),parseInt(o[1])%4*1e3+parseInt(a[1])]),h=document.querySelectorAll("span");for(const t of h)if(t.textContent.trim().includes(`${l[0]}, ${l[1]}`)){let e=document.querySelector("#bm-9");const n=`(Tl X: ${i[0]}, Tl Y: ${i[1]}, Px X: ${c[0]}, Px Y: ${c[1]})`;e?e.textContent=n:(e=document.createElement("span"),e.id="bm-9",e.textContent=n,e.style="margin-left: calc(var(--spacing)*3); font-size: small;",t.parentNode.parentNode.parentNode.insertAdjacentElement("afterend",e))}break;case"tiles":let d=n.endpoint.split("/");d=[parseInt(d[d.length-2]),parseInt(d[d.length-1].replace(".png",""))];const u=n.blobID,m=n.blobData;let p=m;this.lt?.length>=4&&d[0]==this.lt[0]&&d[1]==this.lt[1]&&(p=this.ot.Z?await this.ot.st(m,this.lt):m),window.postMessage({source:"blue-marble",blobID:u,blobData:p,blink:n.blink});break;case"robots":this.rt="false"==s.userscript?.toString().toLowerCase()}var o,a})}}(l);c.C(h),c.T({id:"bm-p",style:"top: 10px; right: 75px;"}).T({id:"bm-b"}).T({id:"bm-k"}).$().S({alt:"Blue Marble Icon",src:"https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/main/dist/assets/Favicon.png"}).$().N(1,{textContent:i}).$().$().B().$().T({id:"bm-4"}).D({id:"bm-j",textContent:"Username:"}).$().D({id:"bm-f",textContent:"Droplets:"}).$().D({id:"bm-a",textContent:"Next level in..."}).$().$().B().$().T({id:"bm-3"}).L({id:"bm-g",textContent:"Stealth",checked:!0}).$().O({title:"Waits for the website to make requests, instead of sending requests."}).$().H().$().L({id:"bm-6",textContent:"Possessed",checked:!0}).$().O({title:"Controls the website as if it were possessed."}).$().H().$().T({id:"bm-c"}).P({id:"bm-h",className:"bm-t",style:"margin-top: 0;",innerHTML:''},(t,e)=>{e.onclick=()=>{const e=t.v?.ct;e?.[0]?(t.R("bm-l",e?.[0]||""),t.R("bm-m",e?.[1]||""),t.R("bm-n",e?.[2]||""),t.R("bm-o",e?.[3]||"")):t.X("Coordinates are malformed! Did you try clicking on the canvas first?")}}).$().j({type:"number",id:"bm-l",placeholder:"Tl X",min:0,max:2047,step:1}).$().j({type:"number",id:"bm-m",placeholder:"Tl Y",min:0,max:2047,step:1}).$().j({type:"number",id:"bm-n",placeholder:"Px X",min:0,max:2047,step:1}).$().j({type:"number",id:"bm-o",placeholder:"Px Y",min:0,max:2047,step:1}).$().$().G({id:"bm-2",textContent:"Upload Template",accept:"image/png, image/jpeg, image/webp, image/bmp, image/gif"}).$().T({id:"bm-0"}).P({id:"bm-i",textContent:"Enable"},(t,e)=>{e.onclick=()=>{const e=document.querySelector("#bm-2");e?.files[0]?(h.lt=h.ct,l.nt(e.files[0]),t.Y("Drew to canvas!")):t.X("No file selected!")}}).$().P({id:"bm-d",textContent:"Disable"}).$().$().U({id:c.M,placeholder:`Status: Sleeping...\nVersion: ${o}`,readOnly:!0}).$().T({id:"bm-1"}).T().P({id:"bm-7",className:"bm-t",textContent:"✈"}).$().P({id:"bm-8",className:"bm-t",innerHTML:''}).$().P({id:"bm-5",className:"bm-t",innerHTML:"🖌"}).$().$().k({textContent:"Made by SwingTheVine",style:"margin-top: auto;"}).$().$().$().I(document.body),c.W("#bm-p","#bm-k"),h.ht(c),function(...t){(0,console.log)(...t)}(`%c${i}%c (${o}) userscript has loaded!`,"color: cornflowerblue;","")})(); \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index cc32b79..87862a0 100644 --- a/docs/README.md +++ b/docs/README.md @@ -30,7 +30,7 @@

Blue Marble

-Latest Version +Latest Version Latest Release Software License: MPL-2.0 Contact Me @@ -38,7 +38,7 @@ Total Patches Total Lines of Code Total Comments -Compression +Compression Build CodeQL diff --git a/package.json b/package.json index 13bb86f..7640ba9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wplace-bluemarble", - "version": "0.64.12", + "version": "0.65.0", "type": "module", "scripts": { "build": "node build/build.js", diff --git a/src/BlueMarble.meta.js b/src/BlueMarble.meta.js index bccdbd2..2a7bc7d 100644 --- a/src/BlueMarble.meta.js +++ b/src/BlueMarble.meta.js @@ -1,20 +1,20 @@ // ==UserScript== // @name Blue Marble // @namespace https://github.com/SwingTheVine/ -// @version 0.64.12 +// @version 0.65.0 // @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 // @supportURL https://discord.gg/tpeBPy46hf // @homepageURL https://github.com/SwingTheVine/Wplace-BlueMarble -// @icon https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/7f9d852d99646eb626aa8296757968289c1e8c8f/dist/assets/Favicon.png +// @icon https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/51b906a447aa39e6ea82ece26696d73fb6c9b693/dist/assets/Favicon.png // @updateURL https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/main/dist/BlueMarble.user.js // @downloadURL https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/main/dist/BlueMarble.user.js // @run-at document-start // @match *://*.wplace.live/* // @grant GM_getResourceText // @grant GM_addStyle -// @resource CSS-BM-File https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/7f9d852d99646eb626aa8296757968289c1e8c8f/dist/BlueMarble.user.css +// @resource CSS-BM-File https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/51b906a447aa39e6ea82ece26696d73fb6c9b693/dist/BlueMarble.user.css // ==/UserScript== // Wplace --> https://wplace.live