diff --git a/dist/BlueMarble.user.css b/dist/BlueMarble.user.css index 79282cf..ee9cff3 100644 --- a/dist/BlueMarble.user.css +++ b/dist/BlueMarble.user.css @@ -1 +1 @@ -#bm-overlay{position:fixed;background-color:#153063e6;color:#fff;padding:10px;border-radius:8px;z-index:9000}div#bm-overlay{font-family:Roboto Mono,Courier New,Monaco,DejaVu Sans Mono,monospace,Arial;letter-spacing:.05em}#bm-bar-drag{margin-bottom:.5em;background:url('data:image/svg+xml;utf8,') repeat;cursor:grab;width:100%;height:1em}#bm-bar-drag.dragging{cursor:grabbing}#bm-contain-header{margin-bottom:.5em}#bm-overlay img{display:inline-block;height:2.5em;margin-right:1ch;vertical-align:middle}#bm-overlay h1{display:inline-block;font-size:x-large;font-weight:700;vertical-align:middle}#bm-contain-automation input[type=checkbox]{vertical-align:middle;margin-right:.5ch}#bm-contain-automation label{margin-right:.5ch}.bm-help{border:white 1px solid;border-radius:1em;height:1.25em;width:1.25em;margin-top:2px;text-align:center;line-height:1.25em}#bm-button-coords{vertical-align:middle}#bm-button-coords svg{width:50%;margin:0 auto;fill:#111}#bm-contain-coords input[type=text]{width:7.5ch;margin-left:1ch;background-color:#0003;padding:0 .5ch;font-size:small}#bm-contain-buttons{display:flex;flex-direction:row;flex-wrap:wrap;align-content:center;justify-content:center;align-items:center;gap:1ch}#bm-contain-buttons button{border-radius:1em;padding:0 .75ch}#bm-output-status{font-size:small;background-color:#0003;padding:0 .5ch;height:3.75em;width:100%}#bm-contain-userinfo,#bm-contain-automation,#bm-contain-coords,#bm-contain-buttons,#bm-input-file,#bm-output-status{margin-top:.5em}#bm-overlay button{background-color:#144eb9}#bm-overlay button:hover,#bm-overlay button:focus{background-color:#1061e5}#bm-overlay button:active,#bm-overlay button:disabled{background-color:#2e97ff}#bm-overlay button:disabled{text-decoration:line-through} +#bm-overlay{position:fixed;background-color:#153063e6;color:#fff;padding:10px;border-radius:8px;z-index:9000}div#bm-overlay{font-family:Roboto Mono,Courier New,Monaco,DejaVu Sans Mono,monospace,Arial;letter-spacing:.05em}#bm-bar-drag{margin-bottom:.5em;background:url('data:image/svg+xml;utf8,') repeat;cursor:grab;width:100%;height:1em}#bm-bar-drag.dragging{cursor:grabbing}#bm-contain-header{margin-bottom:.5em}#bm-overlay img{display:inline-block;height:2.5em;margin-right:1ch;vertical-align:middle}#bm-overlay h1{display:inline-block;font-size:x-large;font-weight:700;vertical-align:middle}#bm-contain-automation input[type=checkbox]{vertical-align:middle;margin-right:.5ch}#bm-contain-automation label{margin-right:.5ch}.bm-help{border:white 1px solid;border-radius:1em;height:1.25em;width:1.25em;margin-top:2px;text-align:center;line-height:1.25em}#bm-button-coords{vertical-align:middle}#bm-button-coords svg{width:50%;margin:0 auto;fill:#111}#bm-contain-coords input[type=text]{width:7.5ch;margin-left:1ch;background-color:#0003;padding:0 .5ch;font-size:small}#bm-contain-buttons{display:flex;flex-direction:row;flex-wrap:wrap;align-content:center;justify-content:center;align-items:center;gap:1ch}div:has(>#bm-input-file)>button{width:100%;text-align:left}#bm-output-status{font-size:small;background-color:#0003;padding:0 .5ch;height:3.75em;width:100%}#bm-contain-userinfo,#bm-contain-automation,#bm-contain-coords,#bm-contain-buttons,div:has(>#bm-input-file),#bm-output-status{margin-top:.5em}#bm-overlay button{background-color:#144eb9;border-radius:1em;padding:0 .75ch}#bm-overlay button:hover,#bm-overlay button:focus{background-color:#1061e5}#bm-overlay button:active,#bm-overlay button:disabled{background-color:#2e97ff}#bm-overlay button:disabled{text-decoration:line-through} diff --git a/dist/BlueMarble.user.js b/dist/BlueMarble.user.js index 5cf6f25..f1acb8c 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.36.2 +// @version 0.37.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 @@ -20,5 +20,5 @@ // Wplace --> https://wplace.live // License --> https://www.mozilla.org/en-US/MPL/2.0/ -(()=>{var h=class{constructor(t,n){this.name=t,this.version=n}create(){let t="bm-output-status",n=document.createElement("div");n.id="bm-overlay",n.style.top="10px",n.style.right="75px";let o=document.createElement("div");o.id="bm-contain-header";let e=document.createElement("div");e.id="bm-bar-drag",o.appendChild(e);let s=document.createElement("img");s.src="https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/main/src/assets/Favicon.png",s.alt="Blue Marble Icon",o.appendChild(s);let i=document.createElement("h1");i.textContent=this.name,o.appendChild(i);let c=document.createElement("div");c.id="bm-contain-userinfo";let f=document.createElement("p");f.id="bm-user-name",f.textContent="Username:",c.appendChild(f);let C=document.createElement("p");C.id="bm-user-droplets",C.textContent="Droplets:",c.appendChild(C);let g=document.createElement("p");g.id="bm-user-nextlevel",g.textContent="Next level in...",c.appendChild(g);let a=document.createElement("div");a.id="bm-contain-automation",a.appendChild(this.createInputCheckbox("Stealth","bm-input-stealth",!0)),a.appendChild(this.createButtonQuestion("bm-help-stealth","Help: Waits for the website to make requests, instead of sending requests.",t)),a.appendChild(document.createElement("br")),a.appendChild(this.createInputCheckbox("Possessed","bm-input-possessed",!0)),a.appendChild(this.createButtonQuestion("bm-help-possessed","Help: Controls the website as if it were possessed.",t)),a.appendChild(document.createElement("br")),a.appendChild(this.createInputCheckbox("Panic","bm-input-panic")),a.appendChild(this.createButtonQuestion("bm-help-panic","Help: Stops placing for a while if it detects a user nearby.",t)),a.appendChild(document.createElement("br"));let l=document.createElement("div");l.id="bm-contain-coords";let d=document.createElement("button");d.id="bm-button-coords",d.className="bm-help",d.style="margin-top: 0",d.innerHTML='',d.onclick=()=>{},l.appendChild(d),l.appendChild(this.createInputText("bm-input-tx","Tile X","","4")),l.appendChild(this.createInputText("bm-input-ty","Tile Y","","4")),l.appendChild(this.createInputText("bm-input-px","Pixl X","","4")),l.appendChild(this.createInputText("bm-input-py","Pixl Y","","4")),a.appendChild(l),a.appendChild(this.createInputFile("bm-input-file",20));let p=document.createElement("div");p.id="bm-contain-buttons",p.appendChild(this.createButton("bm-button-start","Start")),p.appendChild(this.createButton("bm-button-pause","Pause",!1)),p.appendChild(this.createButton("bm-button-stop","Stop",!1)),a.appendChild(p);let m=document.createElement("textarea");m.id=t,m.readOnly=!0,m.placeholder=`Status: Sleeping... -Version: ${this.version}`,a.appendChild(m),n.appendChild(o),n.appendChild(document.createElement("hr")),n.appendChild(c),n.appendChild(document.createElement("hr")),n.appendChild(a),document.body.appendChild(n),this.handleDrag(n,e)}updateInnerHTML(t,n,o=!1){let e=document.getElementById(t);if(e){if(e instanceof HTMLInputElement){e.value=n;return}o?e.textContent=n:e.innerHTML=n}}createButtonQuestion(t,n,o){let e=this.createButton(t,"?");return e.className="bm-help",e.title=n,e.onclick=()=>{this.updateInnerHTML(o,n)},e}createButton(t,n,o=!0){let e=document.createElement("button");return e.id=t,e.textContent=n,e.disabled=!o,e}createInputText(t,n="",o="",e="",s=!1){let i=document.createElement("input");return i.id=t,i.type="text",i.placeholder=n,i.value=o,i.readOnly=s,i.maxLength=e,i}createInputCheckbox(t,n,o=!1){let e=document.createElement("label");e.textContent=t;let s=document.createElement("input");return s.type="checkbox",s.id=n,s.checked=o,e.prepend(s),e}createInputFile(t,n=0){let o=document.createElement("div"),e=document.createElement("input");e.id=t,e.type="file",e.style="display: none";let s=document.createElement("button");return s.textContent="Upload File",s.addEventListener("click",()=>{e.click()}),e.addEventListener("change",()=>{e.files.length>0?s.textContent=n?`${e.files[0].name.slice(0,n)}\u2026`:e.files[0].name:s.textContent="Upload File"}),o.appendChild(e),o.appendChild(s),o}handleDrag(t,n){let o=!1,e,s=0;n.addEventListener("mousedown",function(i){o=!0,e=i.clientX-t.getBoundingClientRect().left,s=i.clientY-t.getBoundingClientRect().top,document.body.style.userSelect="none",n.classList.add("dragging")}),n.addEventListener("touchstart",function(i){o=!0;let c=i?.touches?.[0];c&&(e=c.clientX-t.getBoundingClientRect().left,s=c.clientY-t.getBoundingClientRect().top,document.body.style.userSelect="none",n.classList.add("dragging"))},{passive:!1}),document.addEventListener("mousemove",function(i){o&&(t.style.left=i.clientX-e+"px",t.style.top=i.clientY-s+"px",t.style.right="")}),document.addEventListener("touchmove",function(i){if(o){let c=i?.touches?.[0];if(!c)return;t.style.left=c.clientX-e+"px",t.style.top=c.clientY-s+"px",i.preventDefault()}},{passive:!1}),document.addEventListener("mouseup",function(){o=!1,document.body.style.userSelect="",n.classList.remove("dragging")}),document.addEventListener("touchend",function(){o=!1,document.body.style.userSelect="",n.classList.remove("dragging")}),document.addEventListener("touchcancel",function(){o=!1,document.body.style.userSelect="",n.classList.remove("dragging")})}};var b=class{constructor(){this.disableAll=!1}spontaneousResponseListener(t){window.addEventListener("message",n=>{let o=n.data;if(o&&o.source==="blue-marble")switch(o.endpoint){case"me":let e=Math.ceil(Math.pow(Math.floor(o.jsonData?.level)*Math.pow(30,.65),1.5384615384615383)-o.jsonData?.pixelsPainted);t.updateInnerHTML("bm-user-name",`Username: ${o.jsonData?.name}`),t.updateInnerHTML("bm-user-droplets",`Droplets: ${new Intl.NumberFormat().format(o.jsonData?.droplets)}`),t.updateInnerHTML("bm-user-nextlevel",`Next level in ${new Intl.NumberFormat().format(e)} pixel${e==1?"":"s"}`);break;case"robots":this.disableAll=o.jsonData?.userscript?.toString().toLowerCase()=="false"}})}};var x=GM_info.script.name.toString(),E=GM_info.script.version.toString();function y(r){let t=document.createElement("script");t.textContent=`(${r})();`,document.documentElement.appendChild(t),t.remove()}y(()=>{let r=window.fetch;window.fetch=async function(...t){let n=await r.apply(this,t),o=n.clone();if((o.headers.get("content-type")||"").includes("application/json")){let s=(t[0]instanceof Request?t[0]?.url:t[0])||"ignore";s=s.split("/").filter(Boolean).pop()||"ignore",console.log(`Sending JSON message about endpoint "${s}"`),o.json().then(i=>{window.postMessage({source:"blue-marble",endpoint:s,jsonData:i},"*")}).catch(i=>{console.error("BM - Failed to parse JSON:",i)})}return n}});var w=GM_getResourceText("CSS-BM-File");GM_addStyle(w);var u=document.createElement("link");u.href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap";u.rel="preload";u.as="style";u.onload="this.onload=null;this.rel='stylesheet'";document.head.appendChild(u);var v=new h(x,E);v.create();var L=new b;L.spontaneousResponseListener(v);console.log(`${x} (${E}) userscript has loaded!`);})(); +(()=>{var h=class{constructor(n,t){this.name=n,this.version=t}create(){let n="bm-output-status",t=document.createElement("div");t.id="bm-overlay",t.style.top="10px",t.style.right="75px";let o=document.createElement("div");o.id="bm-contain-header";let e=document.createElement("div");e.id="bm-bar-drag",o.appendChild(e);let i=document.createElement("img");i.src="https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/main/src/assets/Favicon.png",i.alt="Blue Marble Icon",o.appendChild(i);let s=document.createElement("h1");s.textContent=this.name,o.appendChild(s);let c=document.createElement("div");c.id="bm-contain-userinfo";let f=document.createElement("p");f.id="bm-user-name",f.textContent="Username:",c.appendChild(f);let g=document.createElement("p");g.id="bm-user-droplets",g.textContent="Droplets:",c.appendChild(g);let C=document.createElement("p");C.id="bm-user-nextlevel",C.textContent="Next level in...",c.appendChild(C);let a=document.createElement("div");a.id="bm-contain-automation",a.appendChild(this.createInputCheckbox("Stealth","bm-input-stealth",!0)),a.appendChild(this.createButtonQuestion("bm-help-stealth","Help: Waits for the website to make requests, instead of sending requests.",n)),a.appendChild(document.createElement("br")),a.appendChild(this.createInputCheckbox("Possessed","bm-input-possessed",!0)),a.appendChild(this.createButtonQuestion("bm-help-possessed","Help: Controls the website as if it were possessed.",n)),a.appendChild(document.createElement("br")),a.appendChild(this.createInputCheckbox("Panic","bm-input-panic")),a.appendChild(this.createButtonQuestion("bm-help-panic","Help: Stops placing for a while if it detects a user nearby.",n)),a.appendChild(document.createElement("br"));let l=document.createElement("div");l.id="bm-contain-coords";let d=document.createElement("button");d.id="bm-button-coords",d.className="bm-help",d.style="margin-top: 0",d.innerHTML='',d.onclick=()=>{},l.appendChild(d),l.appendChild(this.createInputText("bm-input-tx","Tl X","","4")),l.appendChild(this.createInputText("bm-input-ty","Tl Y","","4")),l.appendChild(this.createInputText("bm-input-px","Px X","","4")),l.appendChild(this.createInputText("bm-input-py","Px Y","","4")),a.appendChild(l),a.appendChild(this.createInputFile("bm-input-file",20));let p=document.createElement("div");p.id="bm-contain-buttons",p.appendChild(this.createButton("bm-button-start","Start")),p.appendChild(this.createButton("bm-button-pause","Pause",!1)),p.appendChild(this.createButton("bm-button-stop","Stop",!1)),a.appendChild(p);let m=document.createElement("textarea");m.id=n,m.readOnly=!0,m.placeholder=`Status: Sleeping... +Version: ${this.version}`,a.appendChild(m),t.appendChild(o),t.appendChild(document.createElement("hr")),t.appendChild(c),t.appendChild(document.createElement("hr")),t.appendChild(a),document.body.appendChild(t),this.handleDrag(t,e)}updateInnerHTML(n,t,o=!1){let e=document.getElementById(n);if(e){if(e instanceof HTMLInputElement){e.value=t;return}o?e.textContent=t:e.innerHTML=t}}createButtonQuestion(n,t,o){let e=this.createButton(n,"?");return e.className="bm-help",e.title=t,e.onclick=()=>{this.updateInnerHTML(o,t)},e}createButton(n,t,o=!0){let e=document.createElement("button");return e.id=n,e.textContent=t,e.disabled=!o,e}createInputText(n,t="",o="",e="",i=!1){let s=document.createElement("input");return s.id=n,s.type="text",s.placeholder=t,s.value=o,s.readOnly=i,s.maxLength=e,s}createInputCheckbox(n,t,o=!1){let e=document.createElement("label");e.textContent=n;let i=document.createElement("input");return i.type="checkbox",i.id=t,i.checked=o,e.prepend(i),e}createInputFile(n,t=0){let o=document.createElement("div"),e=document.createElement("input");e.id=n,e.type="file",e.style="display: none";let i=document.createElement("button");return i.textContent="Upload File",i.addEventListener("click",()=>{e.click()}),e.addEventListener("change",()=>{if(e.files.length>0){let s=e.files[0].name;i.textContent=t?`${s.slice(0,t)}${s.length>t?"\u2026":""}`:e.files[0].name}else i.textContent="Upload File"}),o.appendChild(e),o.appendChild(i),o}handleDrag(n,t){let o=!1,e,i=0;t.addEventListener("mousedown",function(s){o=!0,e=s.clientX-n.getBoundingClientRect().left,i=s.clientY-n.getBoundingClientRect().top,document.body.style.userSelect="none",t.classList.add("dragging")}),t.addEventListener("touchstart",function(s){o=!0;let c=s?.touches?.[0];c&&(e=c.clientX-n.getBoundingClientRect().left,i=c.clientY-n.getBoundingClientRect().top,document.body.style.userSelect="none",t.classList.add("dragging"))},{passive:!1}),document.addEventListener("mousemove",function(s){o&&(n.style.left=s.clientX-e+"px",n.style.top=s.clientY-i+"px",n.style.right="")}),document.addEventListener("touchmove",function(s){if(o){let c=s?.touches?.[0];if(!c)return;n.style.left=c.clientX-e+"px",n.style.top=c.clientY-i+"px",s.preventDefault()}},{passive:!1}),document.addEventListener("mouseup",function(){o=!1,document.body.style.userSelect="",t.classList.remove("dragging")}),document.addEventListener("touchend",function(){o=!1,document.body.style.userSelect="",t.classList.remove("dragging")}),document.addEventListener("touchcancel",function(){o=!1,document.body.style.userSelect="",t.classList.remove("dragging")})}};var b=class{constructor(){this.disableAll=!1}spontaneousResponseListener(n){window.addEventListener("message",t=>{let o=t.data;if(o&&o.source==="blue-marble")switch(o.endpoint){case"me":let e=Math.ceil(Math.pow(Math.floor(o.jsonData?.level)*Math.pow(30,.65),1.5384615384615383)-o.jsonData?.pixelsPainted);n.updateInnerHTML("bm-user-name",`Username: ${o.jsonData?.name}`),n.updateInnerHTML("bm-user-droplets",`Droplets: ${new Intl.NumberFormat().format(o.jsonData?.droplets)}`),n.updateInnerHTML("bm-user-nextlevel",`Next level in ${new Intl.NumberFormat().format(e)} pixel${e==1?"":"s"}`);break;case"robots":this.disableAll=o.jsonData?.userscript?.toString().toLowerCase()=="false"}})}};var x=GM_info.script.name.toString(),E=GM_info.script.version.toString();function y(r){let n=document.createElement("script");n.textContent=`(${r})();`,document.documentElement.appendChild(n),n.remove()}y(()=>{let r=window.fetch;window.fetch=async function(...n){let t=await r.apply(this,n),o=t.clone();if((o.headers.get("content-type")||"").includes("application/json")){let i=(n[0]instanceof Request?n[0]?.url:n[0])||"ignore";i=i.split("/").filter(Boolean).pop()||"ignore",console.log(`Sending JSON message about endpoint "${i}"`),o.json().then(s=>{window.postMessage({source:"blue-marble",endpoint:i,jsonData:s},"*")}).catch(s=>{console.error("BM - Failed to parse JSON:",s)})}return t}});var w=GM_getResourceText("CSS-BM-File");GM_addStyle(w);var u=document.createElement("link");u.href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap";u.rel="preload";u.as="style";u.onload="this.onload=null;this.rel='stylesheet'";document.head.appendChild(u);var v=new h(x,E);v.create();var L=new b;L.spontaneousResponseListener(v);console.log(`${x} (${E}) userscript has loaded!`);})(); diff --git a/docs/README.md b/docs/README.md index 26a77d4..3ac3c62 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 diff --git a/package.json b/package.json index f251ba9..fb4af82 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wplace-bluemarble", - "version": "0.36.2", + "version": "0.37.0", "type": "module", "scripts": { "build": "node build/build.js", diff --git a/src/BlueMarble.meta.js b/src/BlueMarble.meta.js index 1f3d9c1..03db20e 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.36.2 +// @version 0.37.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