Skip to content

Commit

Permalink
Merge pull request #91 from toobeeh/develop
Browse files Browse the repository at this point in the history
Last compatibility fixes and new imageepost
  • Loading branch information
toobeeh authored Oct 10, 2024
2 parents 64e96e9 + a646b4d commit f844dde
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 19 deletions.
5 changes: 4 additions & 1 deletion content.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ chrome.runtime.onMessage.addListener(message => {

// initialize modules
captureCanvas.initListeners(); // init capturing draw ommands and drawings
imageAgent.initImageAgent(); // init image agent from agent.js
imageOptions.initAll(); // init image options from imageOptions.js
imageTools.initAll(); // init image tools from imageTools.js
gamemodes.setup();
Expand All @@ -82,6 +81,10 @@ search.setup();
setTimeout(async () => await emojis.init(), 0); // init emojis
// sprites, visuals and drops are initialized in patcher.js as soon as DOM and palantir loaded

document.addEventListener("skribblInitialized", () => {
imageAgent.initImageAgent(); // init image agent from agent.js
});

// thats a rickroll! :)))
//QS("a[href='https://twitter.com/ticedev']").href = "https://www.youtube.com/watch?v=dQw4w9WgXcQ";

13 changes: 10 additions & 3 deletions features/imageOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ let imageOptions = {
initContainer: () => {
// new imageoptions container on the right side
let imgtools = elemFromString(`<div id="imageOptions"></div>`);
QS("#game-chat").appendChild(imgtools);
QS("#game-wrapper").appendChild(imgtools);
imageOptions.optionsContainer = imgtools;
},
downloadDataURL: async (url, name = "skribbl-unknown", scale = 1) => {
Expand Down Expand Up @@ -218,7 +218,7 @@ let imageOptions = {
let loginName = socket.clientData.playerName ? socket.clientData.playerName : QS(".input-name").value;

// send to socket
await socket.emitEvent("post image", {
/*await socket.emitEvent("post image", {
accessToken: localStorage.accessToken,
serverID: w.ServerID,
imageURI: imageShareString,
Expand All @@ -229,7 +229,14 @@ let imageOptions = {
posterName: loginName,
title: title
}
});
});*/
await typoApiFetch(`/guilds/${w.Token}/imagepost/${w.Name}`, "POST", undefined, {
title: title,
author: imageShareStringDrawer,
posterName: loginName,
onlyImage: QS("#sendImageOnly").checked,
imageBase64: imageShareString.split(",")[1].replace("==", "")
}, localStorage.accessToken);

new Toast("Posted image on Discord.", 2000);
});
Expand Down
4 changes: 2 additions & 2 deletions features/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,11 @@ label input[type="checkbox"].flatUI:checked:after {
}

#imageOptions {
position: absolute;
position:relative;
grid-area: 4 / 3 / 4 / 3;
height: 48px;
background-color: var(--COLOR_CHAT_BG_BASE);
width: 100%;
bottom: -54px;
border-radius: 3px;
display: flex;
padding: .4em 0px;
Expand Down
4 changes: 2 additions & 2 deletions features/uiTweaks.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ const uiTweaks = {
initLobbyDescriptionForm: () => {
// add Description form
let customwords = QS(".group-customwords, .game-room-group.customwords");
const input = elemFromString(`<div class="group-customwords game-room-group" style="height:10%">
const input = elemFromString(`<div class="group-customwords game-room-group" style="min-height:3rem">
<div class="game-room-name">Palantir Description</div>
<textarea style="" id="lobbyDesc" maxlength="200" spellcheck="false" placeholder="Add a description that will show up in the Palantir bot"></textarea>
<textarea id="lobbyDesc" maxlength="200" spellcheck="false" placeholder="Add a description that will show up in the Palantir bot"></textarea>
</div>`);
customwords.insertAdjacentElement("beforebegin", input);
},
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "Skribbl Typo",
"description": "The most complete toolbox for skribbl.io with namefinder & Discord integration",
"version": "26.3.7",
"version": "26.3.8",
"author": "tobeh",
"icons": {
"256": "res/icon/256MaxFit.png",
Expand Down
30 changes: 20 additions & 10 deletions skribbltypo.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// @author tobeh#7437
// @description Userscript version of skribbltypo - the most advanced toolbox for skribbl.io
// @icon64 https://rawcdn.githack.com/toobeeh/skribbltypo/master/res/icon/128MaxFit.png
// @version 26.3.7.172815219
// @version 26.3.8.172858992
// @updateURL https://raw.githubusercontent.com/toobeeh/skribbltypo/master/skribbltypo.user.js
// @grant none
// @match https://skribbl.io/*
Expand All @@ -24,7 +24,7 @@ const chrome = {
return "https://rawcdn.githack.com/toobeeh/skribbltypo/master/" + url;
},
getManifest: () => {
return {version: "26.3.7 usrsc"};
return {version: "26.3.8 usrsc"};
},
onMessage: {
addListener: (callback) => {
Expand Down Expand Up @@ -3358,7 +3358,7 @@ let imageOptions = {
initContainer: () => {
// new imageoptions container on the right side
let imgtools = elemFromString(`<div id="imageOptions"></div>`);
QS("#game-chat").appendChild(imgtools);
QS("#game-wrapper").appendChild(imgtools);
imageOptions.optionsContainer = imgtools;
},
downloadDataURL: async (url, name = "skribbl-unknown", scale = 1) => {
Expand Down Expand Up @@ -3514,7 +3514,7 @@ let imageOptions = {
let loginName = socket.clientData.playerName ? socket.clientData.playerName : QS(".input-name").value;

// send to socket
await socket.emitEvent("post image", {
/*await socket.emitEvent("post image", {
accessToken: localStorage.accessToken,
serverID: w.ServerID,
imageURI: imageShareString,
Expand All @@ -3525,7 +3525,14 @@ let imageOptions = {
posterName: loginName,
title: title
}
});
});*/
await typoApiFetch(`/guilds/${w.Token}/imagepost/${w.Name}`, "POST", undefined, {
title: title,
author: imageShareStringDrawer,
posterName: loginName,
onlyImage: QS("#sendImageOnly").checked,
imageBase64: imageShareString.split(",")[1].replace("==", "")
}, localStorage.accessToken);

new Toast("Posted image on Discord.", 2000);
});
Expand Down Expand Up @@ -4338,11 +4345,11 @@ label input[type="checkbox"].flatUI:checked:after {
}

#imageOptions {
position: absolute;
position:relative;
grid-area: 4 / 3 / 4 / 3;
height: 48px;
background-color: var(--COLOR_CHAT_BG_BASE);
width: 100%;
bottom: -54px;
border-radius: 3px;
display: flex;
padding: .4em 0px;
Expand Down Expand Up @@ -6641,9 +6648,9 @@ const uiTweaks = {
initLobbyDescriptionForm: () => {
// add Description form
let customwords = QS(".group-customwords, .game-room-group.customwords");
const input = elemFromString(`<div class="group-customwords game-room-group" style="height:10%">
const input = elemFromString(`<div class="group-customwords game-room-group" style="min-height:3rem">
<div class="game-room-name">Palantir Description</div>
<textarea style="" id="lobbyDesc" maxlength="200" spellcheck="false" placeholder="Add a description that will show up in the Palantir bot"></textarea>
<textarea id="lobbyDesc" maxlength="200" spellcheck="false" placeholder="Add a description that will show up in the Palantir bot"></textarea>
</div>`);
customwords.insertAdjacentElement("beforebegin", input);
},
Expand Down Expand Up @@ -9336,7 +9343,6 @@ chrome.runtime.onMessage.addListener(message => {

// initialize modules
captureCanvas.initListeners(); // init capturing draw ommands and drawings
imageAgent.initImageAgent(); // init image agent from agent.js
imageOptions.initAll(); // init image options from imageOptions.js
imageTools.initAll(); // init image tools from imageTools.js
gamemodes.setup();
Expand All @@ -9349,6 +9355,10 @@ search.setup();
setTimeout(async () => await emojis.init(), 0); // init emojis
// sprites, visuals and drops are initialized in patcher.js as soon as DOM and palantir loaded

document.addEventListener("skribblInitialized", () => {
imageAgent.initImageAgent(); // init image agent from agent.js
});

// thats a rickroll! :)))
//QS("a[href='https://twitter.com/ticedev']").href = "https://www.youtube.com/watch?v=dQw4w9WgXcQ";

Expand Down

0 comments on commit f844dde

Please sign in to comment.