Skip to content

Instantly share code, notes, and snippets.

@Hri7566
Created July 26, 2022 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hri7566/ffdcb0070b561acf2e254e10423307e9 to your computer and use it in GitHub Desktop.
Save Hri7566/ffdcb0070b561acf2e254e10423307e9 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Download Chat
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Chat download button for mppclone
// @author Hri7566
// @match https://mppclone.com/*
// @match https://multiplayerpiano.com/*
// @match https://www.multiplayerpiano.org/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=mppclone.com
// @grant none
// ==/UserScript==
let btn = `<div id="chat-download-btn" class="ugly-button">Download Chat</div>`
$("#bottom .relative").append(btn);
$("#chat-download-btn").css({
position: "absolute",
left: "1020px",
top: "32px"
});
$("#chat-download-btn").on("click", () => {
let list = [];
$("#chat ul li").each((i, ele) => {
let str = "";
let ts = $(ele).find(".timestamp");
str += $(ts).text() + " ";
let shortID = $(ele).find(".id");
str += $(shortID).text() + " ";
let name = $(ele).find(".name");
str += $(name).text() + " ";
let mes = $(ele).find(".message");
str += $(mes).text() + "\n";
list.push(str);
});
let uri = URL.createObjectURL(new Blob(list, {type: "text/plain"}));
new MPP.Notification({
id: "chat-download",
class: "classic",
title: "Chat Download",
html: `<a href="${uri}" download>Here</a> is your download.`,
duration: 7000,
target: "#piano"
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment