mirror of
https://github.com/SwingTheVine/Wplace-BlueMarble.git
synced 2026-03-11 13:05:38 +00:00
Added Standalone version
This commit is contained in:
parent
97a0579cd9
commit
08033ade52
10 changed files with 97 additions and 18 deletions
BIN
build/assets/RobotoMonoLatin.woff2
Normal file
BIN
build/assets/RobotoMonoLatin.woff2
Normal file
Binary file not shown.
|
|
@ -36,6 +36,8 @@ console.log(`${consoleStyle.BLUE}Starting build...${consoleStyle.RESET}`);
|
|||
// }
|
||||
// }
|
||||
|
||||
console.log(`${consoleStyle.BLUE}Building 1 of 2...${consoleStyle.RESET}`);
|
||||
|
||||
// Tries to bump the version
|
||||
try {
|
||||
const update = execSync('node build/update-version.js', { stdio: 'inherit' });
|
||||
|
|
@ -139,4 +141,39 @@ fs.writeFileSync(
|
|||
'utf8'
|
||||
);
|
||||
|
||||
console.log(`${consoleStyle.BLUE}Building 2 of 2...${consoleStyle.RESET}`);
|
||||
|
||||
// Fetches the completed, main Blue Marble userscript files
|
||||
const mainBMjs = fs.readFileSync('dist/BlueMarble.user.js', 'utf8');
|
||||
let mainBMcss = fs.readFileSync('dist/BlueMarble.user.css', 'utf8');
|
||||
|
||||
// Removes new lines from the CSS file
|
||||
mainBMcss = mainBMcss.replace(/\r?\n/g, '').trim();
|
||||
|
||||
// Injects the CSS into the Blue Marble JavaScript
|
||||
let compactBMjs = mainBMjs.replace('GM_getResourceText("CSS-BM-File")', `\`${mainBMcss}\``);
|
||||
|
||||
// Removes the metadata in the header that points to the old CSS location
|
||||
compactBMjs = compactBMjs.replace(/\/\/\s+\@resource\s+CSS-BM-File.*\r?\n?/g, '');
|
||||
|
||||
// Obtains the Roboto Mono font to inject
|
||||
const robotoMonoLatin = fs.readFileSync('build/assets/RobotoMonoLatin.woff2');
|
||||
const robotoMonoLatinBase64 = robotoMonoLatin.toString('base64');
|
||||
const fontfaces = `@font-face{font-family:'Roboto Mono';font-style:normal;font-weight:400;src:url(data:font/woff2;base64,${robotoMonoLatinBase64})format('woff2');}`;
|
||||
|
||||
// Injects Roboto Mono into the JavaScript file
|
||||
compactBMjs = compactBMjs.replace(/robotoMonoInjectionPoint[^'"]*/g, fontfaces);
|
||||
// compactBMjs = compactBMjs.replace(/https:\/\/fonts.googleapis.com\/[^'"]*/g, fontfaces);
|
||||
|
||||
// Obtains the Favicon to inject
|
||||
const favicon = fs.readFileSync('dist/assets/Favicon.png');
|
||||
const faviconBase64DataURI = `data:image/png;base64,${favicon.toString('base64')}`;
|
||||
|
||||
// Replaces the 2 different types of icon requests with base64
|
||||
compactBMjs = compactBMjs.replace(/\/\/\s+\@icon\s+https.*\r?\n?/g, `// @icon64 ${faviconBase64DataURI}\n`);
|
||||
compactBMjs = compactBMjs.replace(/https[^'"]+dist\/assets\/Favicon\.png[^'"]*/gi, faviconBase64DataURI);
|
||||
|
||||
// Generates the Blue Marble JS file that contains all external resources
|
||||
fs.writeFileSync('dist/BlueMarbleStandalone.user.js', compactBMjs, 'utf-8');
|
||||
|
||||
console.log(`${consoleStyle.GREEN + consoleStyle.BOLD + consoleStyle.UNDERLINE}Building complete!${consoleStyle.RESET}`);
|
||||
|
|
|
|||
2
dist/BlueMarble.user.css
vendored
2
dist/BlueMarble.user.css
vendored
|
|
@ -1 +1 @@
|
|||
#bm-A,#bm-d{position:fixed;background-color:#153063e6;color:#fff;padding:10px;border-radius:8px;z-index:9000;transition:all .3s ease,transform 0s;max-width:300px;width:auto;will-change:transform;backface-visibility:hidden;-webkit-backface-visibility:hidden;transform-style:preserve-3d;-webkit-transform-style:preserve-3d}#bm-f,#bm-A hr,#bm-d hr,#bm-c,#bm-6{transition:opacity .2s ease,height .2s ease}div#bm-A,div#bm-d{font-family:Roboto Mono,Courier New,Monaco,DejaVu Sans Mono,monospace,Arial;letter-spacing:.05em}#bm-z,#bm-z-telemetry{margin-bottom:.5em;background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="5" height="5"><circle cx="3" cy="3" r="1.5" fill="CornflowerBlue" /></svg>') repeat;cursor:grab;width:100%;height:1em}#bm-z.dragging,#bm-z-telemetry.dragging{cursor:grabbing}#bm-A:has(#bm-z.dragging),#bm-d:has(#bm-z-telemetry.dragging){pointer-events:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}#bm-z.dragging,#bm-z-telemetry.dragging{pointer-events:auto}#bm-j,#bm-1{margin-bottom:.5em}#bm-j[style*="text-align: center"],#bm-1[style*="text-align: center"]{display:flex;flex-direction:column;align-items:center;justify-content:center}#bm-A[style*="padding: 5px"],#bm-d[style*="padding: 5px"]{width:auto!important;max-width:300px;min-width:200px}#bm-A img{display:inline-block;height:2.5em;margin-right:1ch;vertical-align:middle;transition:opacity .2s ease}#bm-j[style*="text-align: center"] img{display:block;margin:0 auto}#bm-z,#bm-z-telemetry{transition:margin-bottom .2s ease}#bm-A h1,#bm-d h1{display:inline-block;font-size:x-large;font-weight:700;vertical-align:middle}#bm-c input[type=checkbox]{vertical-align:middle;margin-right:.5ch}#bm-c label{margin-right:.5ch}.bm-D{border:white 1px solid;height:1.5em;width:1.5em;margin-top:2px;text-align:center;line-height:1em;padding:0!important}#bm-q{vertical-align:middle}#bm-q svg{width:50%;margin:0 auto;fill:#111}div:has(>#bm-button-teleport){display:flex;gap:.5ch}#bm-button-favorite svg,#bm-button-template svg{height:1em;margin:2px auto 0;text-align:center;line-height:1em;vertical-align:bottom}#bm-k input[type=number]{appearance:auto;-moz-appearance:textfield;width:5.5ch;margin-left:1ch;background-color:#0003;padding:0 .5ch;font-size:small}#bm-k input[type=number]::-webkit-outer-spin-button,#bm-k input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}#bm-4{display:flex;flex-direction:row;flex-wrap:wrap;align-content:center;justify-content:center;align-items:center;gap:1ch}div:has(>#bm-a)>button{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#bm-a,input[type=file][id*=template]{display:none!important;visibility:hidden!important;position:absolute!important;left:-9999px!important;top:-9999px!important;width:0!important;height:0!important;opacity:0!important;z-index:-9999!important;pointer-events:none!important}#bm-o{font-size:small;background-color:#0003;padding:0 .5ch;height:3.75em;width:100%}#bm-6{display:flex;justify-content:space-between}div#bm-6 button#bm-D{margin-right:2px}#bm-A small{font-size:x-small;color:#d3d3d3}#bm-f,#bm-c,#bm-k,#bm-4,div:has(>#bm-a),#bm-o{margin-top:.5em}#bm-A button,#bm-d button{background-color:#144eb9;border-radius:1em;padding:0 .75ch}#bm-A button:hover,#bm-A button:focus-visible,#bm-d button:hover,#bm-d button:focus-visible{background-color:#1061e5}#bm-A button:active,#bm-d button:active #bm-A button:disabled,#bm-d button:disabled{background-color:#2e97ff}#bm-A button:disabled,#bm-d button:disabled{text-decoration:line-through}
|
||||
#bm-A,#bm-d{position:fixed;background-color:#153063e6;color:#fff;padding:10px;border-radius:8px;z-index:9000;transition:all .3s ease,transform 0s;max-width:300px;width:auto;will-change:transform;backface-visibility:hidden;-webkit-backface-visibility:hidden;transform-style:preserve-3d;-webkit-transform-style:preserve-3d}#bm-f,#bm-A hr,#bm-d hr,#bm-c,#bm-6{transition:opacity .2s ease,height .2s ease}div#bm-A,div#bm-d{font-family:Roboto Mono,Courier New,Monaco,DejaVu Sans Mono,monospace,Arial;letter-spacing:.05em}#bm-z,#bm-z-telemetry{margin-bottom:.5em;background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="5" height="5"><circle cx="3" cy="3" r="1.5" fill="CornflowerBlue" /></svg>') repeat;cursor:grab;width:100%;height:1em}#bm-z.dragging,#bm-z-telemetry.dragging{cursor:grabbing}#bm-A:has(#bm-z.dragging),#bm-d:has(#bm-z-telemetry.dragging){pointer-events:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}#bm-z.dragging,#bm-z-telemetry.dragging{pointer-events:auto}#bm-j,#bm-1{margin-bottom:.5em}#bm-j[style*="text-align: center"],#bm-1[style*="text-align: center"]{display:flex;flex-direction:column;align-items:center;justify-content:center}#bm-A[style*="padding: 5px"],#bm-d[style*="padding: 5px"]{width:auto!important;max-width:300px;min-width:200px}#bm-A img{display:inline-block;height:2.5em;margin-right:1ch;vertical-align:middle;transition:opacity .2s ease}#bm-j[style*="text-align: center"] img{display:block;margin:0 auto}#bm-z,#bm-z-telemetry{transition:margin-bottom .2s ease}#bm-A h1,#bm-d h1{display:inline-block;font-size:x-large;font-weight:700;vertical-align:middle}#bm-c input[type=checkbox]{vertical-align:middle;margin-right:.5ch}#bm-c label{margin-right:.5ch}.bm-D{border:white 1px solid;height:1.5em;width:1.5em;margin-top:2px;text-align:center;line-height:1em;padding:0!important}#bm-q{vertical-align:middle}#bm-q svg{width:50%;margin:0 auto;fill:#111}#bm-f{margin-bottom:.5em}div:has(>#bm-button-teleport){display:flex;gap:.5ch}#bm-button-favorite svg,#bm-button-template svg{height:1em;margin:2px auto 0;text-align:center;line-height:1em;vertical-align:bottom}#bm-k input[type=number]{appearance:auto;-moz-appearance:textfield;width:5.5ch;margin-left:1ch;background-color:#0003;padding:0 .5ch;font-size:small}#bm-k input[type=number]::-webkit-outer-spin-button,#bm-k input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}#bm-4{display:flex;flex-direction:row;flex-wrap:wrap;align-content:center;justify-content:center;align-items:center;gap:1ch}div:has(>#bm-a)>button{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#bm-a,input[type=file][id*=template]{display:none!important;visibility:hidden!important;position:absolute!important;left:-9999px!important;top:-9999px!important;width:0!important;height:0!important;opacity:0!important;z-index:-9999!important;pointer-events:none!important}#bm-o{font-size:small;background-color:#0003;padding:0 .5ch;height:3.75em;width:100%}#bm-6{display:flex;justify-content:space-between}div#bm-6 button#bm-D{margin-right:2px}#bm-A small{font-size:x-small;color:#d3d3d3}#bm-f,#bm-c,#bm-k,#bm-4,div:has(>#bm-a),#bm-o{margin-top:.5em}#bm-A button,#bm-d button{background-color:#144eb9;border-radius:1em;padding:0 .75ch}#bm-A button:hover,#bm-A button:focus-visible,#bm-d button:hover,#bm-d button:focus-visible{background-color:#1061e5}#bm-A button:active,#bm-d button:active #bm-A button:disabled,#bm-d button:disabled{background-color:#2e97ff}#bm-A button:disabled,#bm-d button:disabled{text-decoration:line-through}
|
||||
|
|
|
|||
5
dist/BlueMarble.user.js
vendored
5
dist/BlueMarble.user.js
vendored
File diff suppressed because one or more lines are too long
27
dist/BlueMarbleStandalone.user.js
vendored
Normal file
27
dist/BlueMarbleStandalone.user.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -51,7 +51,7 @@
|
|||
<a href="https://discord.gg/tpeBPy46hf" target="_blank" rel="noopener noreferrer"><img alt="Contact Me" src="https://img.shields.io/badge/Contact_Me-gray?style=flat&logo=Discord&logoColor=white&logoSize=auto&labelColor=cornflowerblue"></a>
|
||||
<a href="https://bluemarble.lol/" target="_blank" rel="noopener noreferrer"><img alt="Blue Marble Website" src="https://img.shields.io/badge/Blue_Marble_Website-crqch-blue?style=flat&logo=globe&logoColor=white"></a>
|
||||
<a href="" target="_blank" rel="noopener noreferrer"><img alt="WakaTime" src="https://img.shields.io/badge/Coding_Time-111hrs_12mins-blue?style=flat&logo=wakatime&logoColor=black&logoSize=auto&labelColor=white"></a>
|
||||
<a href="" target="_blank" rel="noopener noreferrer"><img alt="Total Patches" src="https://img.shields.io/badge/Total_Patches-541-black?style=flat"></a>
|
||||
<a href="" target="_blank" rel="noopener noreferrer"><img alt="Total Patches" src="https://img.shields.io/badge/Total_Patches-569-black?style=flat"></a>
|
||||
<a href="" target="_blank" rel="noopener noreferrer"><img alt="Total Lines of Code" src="https://img.shields.io/badge/Lines_Of_Code-498-blue?style=flat"></a>
|
||||
<a href="" target="_blank" rel="noopener noreferrer"><img alt="Total Comments" src="https://img.shields.io/badge/Lines_Of_Comments-498-blue?style=flat"></a>
|
||||
<a href="" target="_blank" rel="noopener noreferrer"><img alt="Compression" src="https://img.shields.io/badge/Compression-70.19%25-blue"></a>
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "wplace-bluemarble",
|
||||
"version": "0.88.43",
|
||||
"version": "0.88.71",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "wplace-bluemarble",
|
||||
"version": "0.88.43",
|
||||
"version": "0.88.71",
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.25.0",
|
||||
"jsdoc": "^4.0.5",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "wplace-bluemarble",
|
||||
"version": "0.88.43",
|
||||
"version": "0.88.71",
|
||||
"type": "module",
|
||||
"homepage": "https://bluemarble.lol/",
|
||||
"repository": {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// ==UserScript==
|
||||
// @name Blue Marble
|
||||
// @namespace https://github.com/SwingTheVine/
|
||||
// @version 0.88.43
|
||||
// @version 0.88.71
|
||||
// @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
|
||||
|
|
@ -23,4 +23,5 @@
|
|||
|
||||
// Wplace --> https://wplace.live
|
||||
// License --> https://www.mozilla.org/en-US/MPL/2.0/
|
||||
// Donate --> https://ko-fi.com/swingthevine
|
||||
|
||||
|
|
|
|||
33
src/main.js
33
src/main.js
|
|
@ -161,16 +161,29 @@ inject(() => {
|
|||
const cssOverlay = GM_getResourceText("CSS-BM-File");
|
||||
GM_addStyle(cssOverlay);
|
||||
|
||||
// Imports the Roboto Mono font family
|
||||
var stylesheetLink = document.createElement('link');
|
||||
stylesheetLink.href = 'https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap';
|
||||
stylesheetLink.rel = 'preload';
|
||||
stylesheetLink.as = 'style';
|
||||
stylesheetLink.onload = function () {
|
||||
this.onload = null;
|
||||
this.rel = 'stylesheet';
|
||||
};
|
||||
document.head?.appendChild(stylesheetLink);
|
||||
// Injection point for the Roboto Mono font file (only if this is the Standalone version)
|
||||
const robotoMonoInjectionPoint = 'robotoMonoInjectionPoint';
|
||||
|
||||
// If the Roboto Mono injection point contains '@font-face'...
|
||||
if (!!(robotoMonoInjectionPoint.indexOf('@font-face') + 1)) {
|
||||
// A very hacky way of doing truthy/falsy logic
|
||||
|
||||
console.log(`Loading Roboto Mono as a file...`);
|
||||
GM_addStyle(robotoMonoInjectionPoint); // Add the Roboto Mono font-faces that were injected.
|
||||
} else {
|
||||
// Else, no Roboto Mono was found. We need to use a stylesheet.
|
||||
|
||||
// Imports the Roboto Mono font family as a stylesheet
|
||||
var stylesheetLink = document.createElement('link');
|
||||
stylesheetLink.href = 'https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap';
|
||||
stylesheetLink.rel = 'preload';
|
||||
stylesheetLink.as = 'style';
|
||||
stylesheetLink.onload = function () {
|
||||
this.onload = null;
|
||||
this.rel = 'stylesheet';
|
||||
};
|
||||
document.head?.appendChild(stylesheetLink);
|
||||
}
|
||||
|
||||
// CONSTRUCTORS
|
||||
const observers = new Observers(); // Constructs a new Observers object
|
||||
|
|
|
|||
Loading…
Reference in a new issue