mirror of
https://github.com/SwingTheVine/Wplace-BlueMarble.git
synced 2026-03-11 17:15:38 +00:00
Bumped version; Added some user info to the overlay
This commit is contained in:
parent
b2177012f8
commit
9adc28431f
3 changed files with 4 additions and 4 deletions
4
dist/BlueMarble.user.js
vendored
4
dist/BlueMarble.user.js
vendored
|
|
@ -1,7 +1,7 @@
|
|||
// ==UserScript==
|
||||
// @name Blue Marble
|
||||
// @namespace https://github.com/SwingTheVine/
|
||||
// @version 0.11.40
|
||||
// @version 0.12.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,4 +20,4 @@
|
|||
// Wplace --> https://wplace.live
|
||||
// License --> https://www.mozilla.org/en-US/MPL/2.0/
|
||||
|
||||
(()=>{var a=class{constructor(){}create(){let e=document.createElement("div");e.id="bm-overlay",e.style.top="10px",e.style.right="75px";let o=document.createElement("div"),t=document.createElement("div");t.id="bm-bar-drag",o.appendChild(t);let c=document.createElement("img");c.src="https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/main/src/assets/Favicon.png",c.alt="Blue Marble Icon",o.appendChild(c);let s=document.createElement("h1");s.textContent="Blue Marble",o.appendChild(s);let n=document.createElement("div"),l=document.createElement("p");l.id="bm-user-name",l.textContent="Username:",n.appendChild(l);let r=document.createElement("p");r.id="bm-user-droplets",r.textContent="Droplets:",n.appendChild(r),e.appendChild(o),e.appendChild(document.createElement("hr")),e.appendChild(n),document.body.appendChild(e),this.handleDrag(e,t)}handleDrag(e,o){let t=!1,c,s=0;o.addEventListener("mousedown",function(n){t=!0,c=n.clientX-e.getBoundingClientRect().left,s=n.clientY-e.getBoundingClientRect().top,document.body.style.userSelect="none",e.style.right="",o.classList.add("dragging")}),o.addEventListener("touchstart",function(n){t=!0;let l=n?.touches?.[0];l&&(c=l.clientX-e.getBoundingClientRect().left,s=l.clientY-e.getBoundingClientRect().top,document.body.style.userSelect="none",e.style.right="",o.classList.add("dragging"))},{passive:!1}),document.addEventListener("mousemove",function(n){t&&(e.style.left=n.clientX-c+"px",e.style.top=n.clientY-s+"px")}),document.addEventListener("touchmove",function(n){if(t){let l=n?.touches?.[0];if(!l)return;e.style.left=l.clientX-c+"px",e.style.top=l.clientY-s+"px",n.preventDefault()}},{passive:!1}),document.addEventListener("mouseup",function(){t=!1,document.body.style.userSelect="",o.classList.remove("dragging")}),document.addEventListener("touchend",function(){t=!1,document.body.style.userSelect="",o.classList.remove("dragging")}),document.addEventListener("touchcancel",function(){t=!1,document.body.style.userSelect="",o.classList.remove("dragging")})}};var i=class{constructor(){this.disableAll=!1}spontaneousResponseListener(e){window.addEventListener("message",o=>{let t=o.data;if(t&&t.source==="blue-marble")switch(t.endpoint){case"me":console.log(`${t.jsonData?.name} has ${t.jsonData?.droplets} droplets`);let c=document.getElementById("bm-user-name"),s=document.getElementById("bm-user-droplets");c&&(c.textContent=`Username: ${t.jsonData?.name}`),s&&(s.textContent=`Droplets: ${t.jsonData?.droplets}`);break;case"robots":this.disableAll=t.jsonData?.userscript?.toString().toLowerCase()=="false"}})}};function p(d){let e=document.createElement("script");e.textContent=`(${d})();`,document.documentElement.appendChild(e),e.remove()}p(()=>{let d=window.fetch;window.fetch=async function(...e){let o=await d.apply(this,e),t=o.clone();if((t.headers.get("content-type")||"").includes("application/json")){let s=(e[0]instanceof Request?e[0]?.url:e[0])||"ignore";s=s.split("/").filter(Boolean).pop()||"ignore",console.log(`Sending JSON message about endpoint "${s}"`),t.json().then(n=>{console.log(`JSON: ${n}`),window.postMessage({source:"blue-marble",endpoint:s,jsonData:n},"*")}).catch(n=>{console.error("BM - Failed to parse JSON:",n)})}return o}});var m=GM_getResourceText("CSS-Overlay");GM_addStyle(m);var u=new a;u.create();var g=new i;g.spontaneousResponseListener(u);console.log("Blue Marble userscript has loaded!");})();
|
||||
(()=>{var l=class{constructor(){}create(){let e=document.createElement("div");e.id="bm-overlay",e.style.top="10px",e.style.right="75px";let o=document.createElement("div"),t=document.createElement("div");t.id="bm-bar-drag",o.appendChild(t);let c=document.createElement("img");c.src="https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/main/src/assets/Favicon.png",c.alt="Blue Marble Icon",o.appendChild(c);let s=document.createElement("h1");s.textContent="Blue Marble",o.appendChild(s);let n=document.createElement("div"),d=document.createElement("p");d.id="bm-user-name",d.textContent="Username:",n.appendChild(d);let r=document.createElement("p");r.id="bm-user-droplets",r.textContent="Droplets:",n.appendChild(r),e.appendChild(o),e.appendChild(document.createElement("hr")),e.appendChild(n),document.body.appendChild(e),this.handleDrag(e,t)}handleDrag(e,o){let t=!1,c,s=0;o.addEventListener("mousedown",function(n){t=!0,c=n.clientX-e.getBoundingClientRect().left,s=n.clientY-e.getBoundingClientRect().top,document.body.style.userSelect="none",e.style.right="",o.classList.add("dragging")}),o.addEventListener("touchstart",function(n){t=!0;let d=n?.touches?.[0];d&&(c=d.clientX-e.getBoundingClientRect().left,s=d.clientY-e.getBoundingClientRect().top,document.body.style.userSelect="none",e.style.right="",o.classList.add("dragging"))},{passive:!1}),document.addEventListener("mousemove",function(n){t&&(e.style.left=n.clientX-c+"px",e.style.top=n.clientY-s+"px")}),document.addEventListener("touchmove",function(n){if(t){let d=n?.touches?.[0];if(!d)return;e.style.left=d.clientX-c+"px",e.style.top=d.clientY-s+"px",n.preventDefault()}},{passive:!1}),document.addEventListener("mouseup",function(){t=!1,document.body.style.userSelect="",o.classList.remove("dragging")}),document.addEventListener("touchend",function(){t=!1,document.body.style.userSelect="",o.classList.remove("dragging")}),document.addEventListener("touchcancel",function(){t=!1,document.body.style.userSelect="",o.classList.remove("dragging")})}};var a=class{constructor(){this.disableAll=!1}spontaneousResponseListener(e){window.addEventListener("message",o=>{let t=o.data;if(t&&t.source==="blue-marble")switch(t.endpoint){case"me":let c=document.getElementById("bm-user-name"),s=document.getElementById("bm-user-droplets");c&&(c.textContent=`Username: ${t.jsonData?.name}`),s&&(s.textContent=`Droplets: ${t.jsonData?.droplets}`);break;case"robots":this.disableAll=t.jsonData?.userscript?.toString().toLowerCase()=="false"}})}};function p(i){let e=document.createElement("script");e.textContent=`(${i})();`,document.documentElement.appendChild(e),e.remove()}p(()=>{let i=window.fetch;window.fetch=async function(...e){let o=await i.apply(this,e),t=o.clone();if((t.headers.get("content-type")||"").includes("application/json")){let s=(e[0]instanceof Request?e[0]?.url:e[0])||"ignore";s=s.split("/").filter(Boolean).pop()||"ignore",console.log(`Sending JSON message about endpoint "${s}"`),t.json().then(n=>{window.postMessage({source:"blue-marble",endpoint:s,jsonData:n},"*")}).catch(n=>{console.error("BM - Failed to parse JSON:",n)})}return o}});var m=GM_getResourceText("CSS-Overlay");GM_addStyle(m);var u=new l;u.create();var g=new a;g.spontaneousResponseListener(u);console.log("Blue Marble userscript has loaded!");})();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "wplace-bluemarble",
|
||||
"version": "0.11.40",
|
||||
"version": "0.12.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "node build/build.js",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// ==UserScript==
|
||||
// @name Blue Marble
|
||||
// @namespace https://github.com/SwingTheVine/
|
||||
// @version 0.11.40
|
||||
// @version 0.12.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
|
||||
|
|
|
|||
Loading…
Reference in a new issue