Skip to content

Commit 2721421

Browse files
feat: artwork extractor
1 parent 80eaa3f commit 2721421

11 files changed

Lines changed: 2597 additions & 362 deletions

File tree

Extension/Script-manager.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434
description: 'Automated repair and maintenance tasks',
3535
icon: '🔧',
3636
category: 'utility'
37+
},
38+
{
39+
name: 'Art-Extractor.js',
40+
displayName: '🎨 Art Extractor',
41+
description: 'Extract artwork areas to JSON for auto-repair',
42+
icon: '🎨',
43+
category: 'utility'
3744
}
3845
]; // Neon theme styling
3946
const NEON_STYLES = `

Extension/auto-image-styles.css

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,9 @@
9797

9898
/* Slider colors - defaults for classic compatibility */
9999
--wplace-slider-thumb-bg: white;
100-
--wplace-slider-track-bg: linear-gradient(
101-
to right,
102-
var(--wplace-icon-primary) 0%,
103-
var(--wplace-icon-secondary) 100%
104-
);
100+
--wplace-slider-track-bg: linear-gradient(to right,
101+
var(--wplace-icon-primary) 0%,
102+
var(--wplace-icon-secondary) 100%);
105103
}
106104

107105
/* Theme classes are now defined in separate files */
@@ -112,6 +110,7 @@
112110
/* Core animations (shared) */
113111
/* ========================= */
114112
@keyframes neon-glow {
113+
115114
0%,
116115
100% {
117116
text-shadow:
@@ -129,6 +128,7 @@
129128
}
130129

131130
@keyframes pixel-blink {
131+
132132
0%,
133133
50% {
134134
opacity: 1;
@@ -247,7 +247,7 @@
247247
position: fixed;
248248
top: 20px;
249249
left: 370px;
250-
width: 300px;
250+
width: 350px;
251251
max-height: calc(100vh - 40px);
252252
padding: 0;
253253
z-index: 9997;
@@ -1079,15 +1079,16 @@
10791079
/* ========================= */
10801080
/* Responsive tweaks */
10811081
/* ========================= */
1082-
@media (width <= 768px) {
1082+
@media (width <=768px) {
10831083
#wplace-image-bot-container {
10841084
left: 10px;
10851085
width: calc(100vw - 20px);
10861086
max-height: calc(100vh - 20px);
10871087
}
10881088

10891089
#wplace-stats-container {
1090-
display: none !important; /* hide secondary panel on small screens */
1090+
display: none !important;
1091+
/* hide secondary panel on small screens */
10911092
}
10921093

10931094
.wplace-alert-base {
@@ -1992,12 +1993,12 @@
19921993
transition: all 0.3s ease;
19931994
}
19941995

1995-
.wplace-toggle-switch input:checked + .wplace-toggle-slider {
1996+
.wplace-toggle-switch input:checked+.wplace-toggle-slider {
19961997
background: var(--wplace-success);
19971998
border-color: var(--wplace-success);
19981999
}
19992000

2000-
.wplace-toggle-switch input:checked + .wplace-toggle-slider:before {
2001+
.wplace-toggle-switch input:checked+.wplace-toggle-slider:before {
20012002
transform: translateX(20px);
20022003
background: white;
20032004
}
@@ -2022,7 +2023,7 @@
20222023
justify-content: space-between;
20232024
padding: 10px 12px;
20242025
border-bottom: 1px solid var(--wplace-border-color);
2025-
transition: all 0.2s ease;
2026+
transition: all 0.3s ease, box-shadow 0.5s ease;
20262027
}
20272028

20282029
.wplace-account-item:last-child {
@@ -2036,6 +2037,39 @@
20362037
.wplace-account-item.current {
20372038
background: var(--wplace-success)20;
20382039
border-left: 3px solid var(--wplace-success);
2040+
box-shadow: 0 0 15px rgba(46, 204, 113, 0.6),
2041+
0 0 25px rgba(46, 204, 113, 0.4),
2042+
0 0 35px rgba(46, 204, 113, 0.2);
2043+
animation: currentAccountGlow 2s ease-in-out infinite alternate;
2044+
}
2045+
2046+
@keyframes currentAccountGlow {
2047+
from {
2048+
box-shadow: 0 0 15px rgba(46, 204, 113, 0.6),
2049+
0 0 25px rgba(46, 204, 113, 0.4),
2050+
0 0 35px rgba(46, 204, 113, 0.2);
2051+
}
2052+
to {
2053+
box-shadow: 0 0 20px rgba(46, 204, 113, 0.8),
2054+
0 0 30px rgba(46, 204, 113, 0.6),
2055+
0 0 40px rgba(46, 204, 113, 0.4);
2056+
}
2057+
}
2058+
2059+
@keyframes currentAccountNumberPulse {
2060+
from {
2061+
box-shadow: 0 0 10px rgba(46, 204, 113, 0.8);
2062+
transform: scale(1);
2063+
}
2064+
to {
2065+
box-shadow: 0 0 15px rgba(46, 204, 113, 1.0);
2066+
transform: scale(1.05);
2067+
}
2068+
}
2069+
2070+
.wplace-account-item.next-in-sequence {
2071+
background: var(--wplace-warning)15;
2072+
border-left: 3px solid var(--wplace-warning);
20392073
}
20402074

20412075
.wplace-account-info-item {
@@ -2157,4 +2191,4 @@ input[type="number"] {
21572191
.wplace-notification-interval-input {
21582192
-moz-appearance: textfield;
21592193
appearance: textfield;
2160-
}
2194+
}

Extension/background.js

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ async function executeLocalScript(scriptName, tabId) {
4141
try {
4242
console.log(`Loading script: ${scriptName}`);
4343

44-
// Check if we need to inject dependencies first for Auto-Image.js
45-
if (scriptName === 'Auto-Image.js') {
46-
console.log('🔑 Auto-Image.js detected, ensuring dependencies are loaded first...');
44+
// Check if we need to inject dependencies first for Auto-Image.js or Art-Extractor.js
45+
if (scriptName === 'Auto-Image.js' || scriptName === 'Art-Extractor.js') {
46+
console.log(`🔑 ${scriptName} detected, ensuring dependencies are loaded first...`);
4747

4848
try {
4949
// First inject token-manager.js
@@ -777,34 +777,39 @@ async function setCookie(value) {
777777
const cleaned = value.trim();
778778
console.log("[bg] setCookie CALLED with:", cleaned);
779779

780-
chrome.cookies.set(
781-
{
782-
url: "https://backend.wplace.live/",
783-
name: "j",
784-
value: cleaned,
785-
domain: cookieDomain,
786-
path: "/",
787-
},
788-
(cookie) => {
789-
if (chrome.runtime.lastError) {
790-
console.error(
791-
"[bg] cookie set error:",
792-
chrome.runtime.lastError.message
793-
);
794-
} else {
795-
console.log("[bg] cookie set result:", cookie);
796-
797-
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
798-
if (tabs.length > 0) {
799-
chrome.tabs.sendMessage(tabs[0].id, {
800-
type: "cookieSet",
801-
value: cleaned,
802-
});
803-
}
804-
});
780+
return new Promise((resolve, reject) => {
781+
chrome.cookies.set(
782+
{
783+
url: "https://backend.wplace.live/",
784+
name: "j",
785+
value: cleaned,
786+
domain: cookieDomain,
787+
path: "/",
788+
},
789+
(cookie) => {
790+
if (chrome.runtime.lastError) {
791+
console.error(
792+
"[bg] cookie set error:",
793+
chrome.runtime.lastError.message
794+
);
795+
reject(new Error(chrome.runtime.lastError.message));
796+
} else {
797+
console.log("[bg] cookie set result:", cookie);
798+
799+
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
800+
if (tabs.length > 0) {
801+
chrome.tabs.sendMessage(tabs[0].id, {
802+
type: "cookieSet",
803+
value: cleaned,
804+
});
805+
}
806+
});
807+
808+
resolve(cookie);
809+
}
805810
}
806-
}
807-
);
811+
);
812+
});
808813
}
809814

810815
async function deleteAccountAtIndex(index) {

Extension/content-script.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,19 @@ if (window.location.hostname === 'wplace.live') {
279279
if (event.data.source !== "my-userscript") return;
280280
const message = event.data;
281281
if (message.type === "setCookie" && message.value) {
282+
console.log("🍪 Content script received setCookie message:", message);
282283
chrome.runtime.sendMessage(
283284
{ type: "setCookie", value: message.value },
284285
(response) => {
285-
if (response.status === "ok") {
286+
console.log("📥 Content script received response from background:", response);
287+
// Send response back to userscript
288+
window.postMessage({
289+
type: "setCookieResponse",
290+
status: response ? response.status || 'ok' : 'error',
291+
originalMessage: message
292+
}, "*");
293+
294+
if (response && response.status === "ok") {
286295
console.log("✅ Forwarded token to background.");
287296
}
288297
}

Extension/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "WPlace AutoBOT Script Launcher",
4-
"version": "2.0.0",
4+
"version": "2.0.2",
55
"description": "Launch and manage automation scripts for WPlace",
66
"icons": {
77
"16": "icons/icon16.png",

Extension/popup/popup.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ <h3>Startup Script</h3>
105105

106106
<footer>
107107
<div class="footer-info">
108-
<span>v2.0.1</span>
108+
<span>v2.0.2</span>
109109
<a href="#" id="settingsBtn">Settings</a>
110110
</div>
111111
</footer>
@@ -114,4 +114,3 @@ <h3>Startup Script</h3>
114114
<script src="popup.js"></script>
115115
</body>
116116
</html>
117-

Extension/popup/popup.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ const AVAILABLE_SCRIPTS = [
2626
displayName: '🔧 Auto Repair',
2727
description: 'Automated repair and maintenance tasks',
2828
filename: 'Auto-Repair.js'
29+
},
30+
{
31+
name: 'Art-Extractor.js',
32+
displayName: '🎨 Art Extractor',
33+
description: 'Extract artwork areas from canvas and save as JSON files',
34+
filename: 'Art-Extractor.js'
2935
}
3036
];
3137

0 commit comments

Comments
 (0)