Added GreasyFork version

This commit is contained in:
SwingTheVine 2026-02-14 02:04:03 -05:00
parent 08033ade52
commit 6218c3c95b
10 changed files with 1959 additions and 74 deletions

View file

@ -100,7 +100,11 @@ jobs:
- name: Update compression badge
run: |
dist_size=$(find dist -type f -exec cat {} + | wc -c)
dist_size=$(find dist -type f \
! -name "BlueMarble-Standalone.user.js" \
! -name "BlueMarble-For-GreasyFork.user.js" \
-exec cat {} + | wc -c)
src_size=$(find src dist/assets -type f -exec cat {} + | wc -c)
percentage=$(awk "BEGIN {printf \"%.2f\", 100 - ($dist_size * 100) / $src_size}")
echo "Compression: $percentage"

View file

@ -36,7 +36,7 @@ console.log(`${consoleStyle.BLUE}Starting build...${consoleStyle.RESET}`);
// }
// }
console.log(`${consoleStyle.BLUE}Building 1 of 2...${consoleStyle.RESET}`);
console.log(`${consoleStyle.BLUE}Building 1 of 3...${consoleStyle.RESET}`);
// Tries to bump the version
try {
@ -141,7 +141,10 @@ fs.writeFileSync(
'utf8'
);
console.log(`${consoleStyle.BLUE}Building 2 of 2...${consoleStyle.RESET}`);
console.log(`${consoleStyle.BLUE}Building 2 of 3...${consoleStyle.RESET}`);
const standaloneName = 'BlueMarble-Standalone.user.js'; // Standalone flavor name of flie
const standaloneBMUpdateURL = `https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/main/dist/${standaloneName}`;
// Fetches the completed, main Blue Marble userscript files
const mainBMjs = fs.readFileSync('dist/BlueMarble.user.js', 'utf8');
@ -151,10 +154,10 @@ let mainBMcss = fs.readFileSync('dist/BlueMarble.user.css', 'utf8');
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}\``);
let standaloneBMjs = 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, '');
standaloneBMjs = standaloneBMjs.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');
@ -162,18 +165,34 @@ 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);
standaloneBMjs = standaloneBMjs.replace(/robotoMonoInjectionPoint[^'"]*/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);
standaloneBMjs = standaloneBMjs.replace(/\/\/\s+\@icon\s+https.*\r?\n?/g, `// @icon64 ${faviconBase64DataURI}\n`);
standaloneBMjs = standaloneBMjs.replace(/https[^'"]+dist\/assets\/Favicon\.png[^'"]*/gi, faviconBase64DataURI);
// Updates the update/download URLs
standaloneBMjs = standaloneBMjs.replace(/\/\/\s+\@updateURL\s+https.*\r?\n?/g, `// @updateURL ${standaloneBMUpdateURL}\n`);
standaloneBMjs = standaloneBMjs.replace(/\/\/\s+\@downloadURL\s+https.*\r?\n?/g, `// @downloadURL ${standaloneBMUpdateURL}\n`);
// Generates the Blue Marble JS file that contains all external resources
fs.writeFileSync('dist/BlueMarbleStandalone.user.js', compactBMjs, 'utf-8');
fs.writeFileSync(`dist/${standaloneName}`, standaloneBMjs, 'utf-8');
console.log(`${consoleStyle.BLUE}Building 3 of 3...${consoleStyle.RESET}`);
const greasyForkName = 'BlueMarble-For-GreasyFork.user.js'; // GreasyFork flavor name of file
const greasyForkUpdateURL = `https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/main/dist/${greasyForkName}`;
let greasyForkBMjs = metaContent + resultEsbuildJS.text; // Gets the unobfuscated code and adds the metadata banner
// Updates the update/download URLs
greasyForkBMjs = greasyForkBMjs.replace(/\/\/\s+\@updateURL\s+https.*\r?\n?/g, `// @updateURL ${greasyForkUpdateURL}\n`);
greasyForkBMjs = greasyForkBMjs.replace(/\/\/\s+\@downloadURL\s+https.*\r?\n?/g, `// @downloadURL ${greasyForkUpdateURL}\n`);
fs.writeFileSync(`dist/${greasyForkName}`, greasyForkBMjs, 'utf-8');
console.log(`${consoleStyle.GREEN + consoleStyle.BOLD + consoleStyle.UNDERLINE}Building complete!${consoleStyle.RESET}`);

View file

@ -12,7 +12,7 @@ const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
const version = pkg.version;
let meta = fs.readFileSync('src/BlueMarble.meta.js', 'utf-8');
meta = meta.replace(/@version\s+[\d.]+/, `@version ${version}`);
meta = meta.replace(/@version\s+[\d.]+/, `@version ${version}`);
fs.writeFileSync('src/BlueMarble.meta.js', meta);
console.log(`${consoleStyle.GREEN}Updated${consoleStyle.RESET} userscript version to ${consoleStyle.MAGENTA}${version}${consoleStyle.RESET}`);

1853
dist/BlueMarble-For-GreasyFork.user.js vendored Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -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-569-black?style=flat"></a>
<a href="" target="_blank" rel="noopener noreferrer"><img alt="Total Patches" src="https://img.shields.io/badge/Total_Patches-575-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
View file

@ -1,12 +1,12 @@
{
"name": "wplace-bluemarble",
"version": "0.88.71",
"version": "0.88.77",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wplace-bluemarble",
"version": "0.88.71",
"version": "0.88.77",
"devDependencies": {
"esbuild": "^0.25.0",
"jsdoc": "^4.0.5",

View file

@ -1,6 +1,6 @@
{
"name": "wplace-bluemarble",
"version": "0.88.71",
"version": "0.88.77",
"type": "module",
"homepage": "https://bluemarble.lol/",
"repository": {

View file

@ -1,27 +1,30 @@
// ==UserScript==
// @name Blue Marble
// @namespace https://github.com/SwingTheVine/
// @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
// @supportURL https://discord.gg/tpeBPy46hf
// @homepageURL https://bluemarble.lol/
// @icon https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/0c760b903739e6214f7b8990ffc4089a93e73bd2/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
// @match https://wplace.live/*
// @grant GM_getResourceText
// @grant GM_addStyle
// @grant GM.setValue
// @grant GM_getValue
// @grant GM_xmlhttpRequest
// @connect telemetry.thebluecorner.net
// @resource CSS-BM-File https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/0c760b903739e6214f7b8990ffc4089a93e73bd2/dist/BlueMarble.user.css
// @name Blue Marble
// @name:en Blue Marble
// @namespace https://github.com/SwingTheVine/
// @version 0.88.77
// @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.
// @description:en 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
// @donate https://ko-fi.com/swingthevine
// @supportURL https://discord.gg/tpeBPy46hf
// @homepageURL https://bluemarble.lol/
// @icon https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/0c760b903739e6214f7b8990ffc4089a93e73bd2/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
// @match https://wplace.live/*
// @grant GM_getResourceText
// @grant GM_addStyle
// @grant GM.setValue
// @grant GM_getValue
// @grant GM_xmlhttpRequest
// @connect telemetry.thebluecorner.net
// @resource CSS-BM-File https://raw.githubusercontent.com/SwingTheVine/Wplace-BlueMarble/0c760b903739e6214f7b8990ffc4089a93e73bd2/dist/BlueMarble.user.css
// @antifeature tracking Anonymous opt-in telemetry data
// @noframes
// ==/UserScript==
// Wplace --> https://wplace.live
// License --> https://www.mozilla.org/en-US/MPL/2.0/
// Donate --> https://ko-fi.com/swingthevine