init repo
This commit is contained in:
13
meta.user.js
Normal file
13
meta.user.js
Normal file
@@ -0,0 +1,13 @@
|
||||
// ==UserScript==
|
||||
// @name Skribbl.io Auto-Downloader
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 1.1
|
||||
// @description type shit
|
||||
// @author ZStrike
|
||||
// @match *://skribbl.io/*
|
||||
// @license GPL
|
||||
// @grant none
|
||||
// @run-at document-start
|
||||
// @downloadURL https://update.greasyfork.org/scripts/596706/Skribblio%20Auto-Downloader.user.js
|
||||
// @updateURL https://update.greasyfork.org/scripts/596706/Skribblio%20Auto-Downloader.meta.js
|
||||
// ==/UserScript==
|
||||
14
min.user.js
Normal file
14
min.user.js
Normal file
@@ -0,0 +1,14 @@
|
||||
// ==UserScript==
|
||||
// @name Skribbl.io Auto-Downloader
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 1.1
|
||||
// @description type shit
|
||||
// @author ZStrike
|
||||
// @match *://skribbl.io/*
|
||||
// @license GPL
|
||||
// @grant none
|
||||
// @run-at document-start
|
||||
// @downloadURL https://update.greasyfork.org/scripts/596706/Skribblio%20Auto-Downloader.user.js
|
||||
// @updateURL https://update.greasyfork.org/scripts/596706/Skribblio%20Auto-Downloader.meta.js
|
||||
// ==/UserScript==
|
||||
!function(){"use strict";const e=window.WebSocket,t=new Map;let o=null;window.WebSocket=function(...a){const n=new e(...a);return n.addEventListener("message",function(e){if("string"==typeof e.data&&e.data.startsWith("42"))try{const a=JSON.parse(e.data.slice(2));if("data"===a[0]){const e=a[1];if(10===e.id){t.clear();const a=e.data.users;Array.isArray(a)&&a.forEach(e=>{t.set(e.id,e.name)});const n=e.data.state;n&&4===n.id&&(o=n.data.id)}if(1===e.id&&t.set(e.data.id,e.data.name),11===e.id){const a=e.data;if(a&&4===a.id&&(o=a.data.id),a&&5===a.id){const e=a.data,n=t.get(o)||"Unknown Player";console.log("[Hook] Turn ended!"),console.log(`Drawer: ${n} (ID: ${o})`),console.log("Word:",e.word),document.querySelector("canvas").toBlob(t=>{!function(e,t){var o=document.createElement("a");o.id="autodl-trigger",o.style.display="none";var a=URL.createObjectURL(e);o.href=a,o.download=t,document.body.appendChild(o),document.querySelector("#autodl-trigger").click(),document.querySelector("#autodl-trigger").remove()}(t,`${e.word} by ${n}`)})}}}}catch(e){console.error(e)}}),n}}();
|
||||
103
prod.user.js
Normal file
103
prod.user.js
Normal file
@@ -0,0 +1,103 @@
|
||||
// ==UserScript==
|
||||
// @name Skribbl.io Auto-Downloader
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 1.1
|
||||
// @description type shit
|
||||
// @author ZStrike
|
||||
// @match *://skribbl.io/*
|
||||
// @license GPL
|
||||
// @grant none
|
||||
// @run-at document-start
|
||||
// @downloadURL https://update.greasyfork.org/scripts/596706/Skribblio%20Auto-Downloader.user.js
|
||||
// @updateURL https://update.greasyfork.org/scripts/596706/Skribblio%20Auto-Downloader.meta.js
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
const OriginalWebSocket = window.WebSocket;
|
||||
|
||||
const players = new Map();
|
||||
let currentDrawerId = null;
|
||||
|
||||
function downloadImage(blob,name) {
|
||||
var b = document.createElement("a");
|
||||
b.id = "autodl-trigger";
|
||||
b.style.display = "none";
|
||||
var pebis = URL.createObjectURL(blob);
|
||||
b.href = pebis;
|
||||
b.download = name;
|
||||
document.body.appendChild(b);
|
||||
document.querySelector("#autodl-trigger").click();
|
||||
document.querySelector("#autodl-trigger").remove();
|
||||
|
||||
}
|
||||
window.WebSocket = function(...args) {
|
||||
const ws = new OriginalWebSocket(...args);
|
||||
|
||||
ws.addEventListener('message', function(event) {
|
||||
if (typeof event.data !== 'string') return;
|
||||
if (!event.data.startsWith('42')) return;
|
||||
|
||||
try {
|
||||
const payload = JSON.parse(event.data.slice(2));
|
||||
|
||||
if (payload[0] === 'data') {
|
||||
const packet = payload[1];
|
||||
|
||||
if (packet.id === 10) {
|
||||
players.clear();
|
||||
const users = packet.data.users;
|
||||
if (Array.isArray(users)) {
|
||||
users.forEach(user => {
|
||||
players.set(user.id, user.name);
|
||||
});
|
||||
}
|
||||
|
||||
// fix mid-game joining
|
||||
const currentState = packet.data.state;
|
||||
if (currentState && currentState.id === 4) {
|
||||
currentDrawerId = currentState.data.id;
|
||||
}
|
||||
}
|
||||
|
||||
if (packet.id === 1) {
|
||||
players.set(packet.data.id, packet.data.name);
|
||||
}
|
||||
|
||||
|
||||
if (packet.id === 11) { // game state updates
|
||||
const gameState = packet.data;
|
||||
|
||||
|
||||
if (gameState && gameState.id === 4) { // new turn
|
||||
currentDrawerId = gameState.data.id;
|
||||
}
|
||||
|
||||
|
||||
if (gameState && gameState.id === 5) { // end turn
|
||||
const turnData = gameState.data;
|
||||
|
||||
|
||||
const drawerName = players.get(currentDrawerId) || 'Unknown Player';
|
||||
|
||||
|
||||
console.log('[Hook] Turn ended!');
|
||||
console.log(`Drawer: ${drawerName} (ID: ${currentDrawerId})`);
|
||||
console.log('Word:', turnData.word);
|
||||
|
||||
|
||||
document.querySelector("canvas").toBlob((a) => {
|
||||
downloadImage(a,`${turnData.word} by ${drawerName}`)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
});
|
||||
|
||||
return ws;
|
||||
};
|
||||
})();
|
||||
Reference in New Issue
Block a user