1
0
mirror of https://github.com/chylex/Discord-History-Tracker.git synced 2024-10-18 20:42:51 +02:00

Compare commits

..

No commits in common. "ce87901088d13741d8ec74f17d7f3789a751769a" and "a20ce8ee71ff4f20e7a469080c5e004f7d306c59" have entirely different histories.

7 changed files with 26 additions and 26 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name Discord History Tracker // @name Discord History Tracker
// @version v.31f // @version v.31e
// @license MIT // @license MIT
// @namespace https://chylex.com // @namespace https://chylex.com
// @homepageURL https://dht.chylex.com/ // @homepageURL https://dht.chylex.com/
@ -18,11 +18,11 @@ var DISCORD = (function(){
}; };
var getMessageScrollerElement = function(){ var getMessageScrollerElement = function(){
return getMessageOuterElement().querySelector("[class*='scroller_']"); return getMessageOuterElement().querySelector("[class*='scroller-']");
}; };
var getMessageElements = function() { var getMessageElements = function() {
return getMessageOuterElement().querySelectorAll("[class*='message_']"); return getMessageOuterElement().querySelectorAll("[class*='message-']");
}; };
var getReactProps = function(ele) { var getReactProps = function(ele) {
@ -197,7 +197,7 @@ var DISCORD = (function(){
if (dms){ if (dms){
let name; let name;
for (const ele of dms.querySelectorAll("[class*='channel_'] [class*='selected_'] [class^='name_'] *")) { for (const ele of dms.querySelectorAll("[class*='channel-'] [class*='selected-'] [class^='name-'] *, [class*='channel-'][class*='selected-'] [class^='name-'] *")) {
const node = Array.prototype.find.call(ele.childNodes, node => node.nodeType === Node.TEXT_NODE); const node = Array.prototype.find.call(ele.childNodes, node => node.nodeType === Node.TEXT_NODE);
if (node) { if (node) {
@ -230,7 +230,7 @@ var DISCORD = (function(){
else if (obj.guild_id) { else if (obj.guild_id) {
let guild; let guild;
for (const child of getReactProps(document.querySelector("nav header [class*='headerContent_']")).children) { for (const child of getReactProps(document.querySelector("nav header [class*='headerContent-']")).children) {
if (child && child.props && child.props.guild) { if (child && child.props && child.props.guild) {
guild = child.props.guild; guild = child.props.guild;
break; break;
@ -300,10 +300,10 @@ var DISCORD = (function(){
if (dms) { if (dms) {
const currentChannel = DOM.queryReactClass("selected", dms); const currentChannel = DOM.queryReactClass("selected", dms);
const currentChannelContainer = currentChannel && currentChannel.closest("[class*='channel_']"); const currentChannelContainer = currentChannel && currentChannel.closest("[class*='channel-']");
const nextChannel = currentChannelContainer && currentChannelContainer.nextElementSibling; const nextChannel = currentChannelContainer && currentChannelContainer.nextElementSibling;
if (!nextChannel || !nextChannel.getAttribute("class").includes("channel_")) { if (!nextChannel || !nextChannel.getAttribute("class").includes("channel-")) {
return false; return false;
} }
@ -330,7 +330,7 @@ var DISCORD = (function(){
let nextChannel = null; let nextChannel = null;
for (let index = 0; index < allTextChannels.length - 1; index++) { for (let index = 0; index < allTextChannels.length - 1; index++) {
if (allTextChannels[index].className.includes("selected_")) { if (allTextChannels[index].className.includes("selected-")) {
nextChannel = allTextChannels[index + 1]; nextChannel = allTextChannels[index + 1];
break; break;
} }
@ -371,7 +371,7 @@ var DOM = (function(){
/* /*
* Returns the first child element containing the specified obfuscated class. Parent defaults to the entire document. * Returns the first child element containing the specified obfuscated class. Parent defaults to the entire document.
*/ */
queryReactClass: (cls, parent) => (parent || document).querySelector(`[class*="${cls}_"]`), queryReactClass: (cls, parent) => (parent || document).querySelector(`[class*="${cls}-"]`),
/* /*
* Creates an element, adds it to the DOM, and returns it. * Creates an element, adds it to the DOM, and returns it.
@ -524,7 +524,7 @@ var GUI = (function(){
// styles // styles
controller.styles = DOM.createStyle(` controller.styles = DOM.createStyle(`
#app-mount { height: calc(100% - 48px) !important; } #app-mount div[class*="app-"] { margin-bottom: 48px !important; }
#dht-ctrl { position: absolute; bottom: 0; width: 100%; height: 48px; background-color: #FFF; z-index: 1000000; } #dht-ctrl { position: absolute; bottom: 0; width: 100%; height: 48px; background-color: #FFF; z-index: 1000000; }
#dht-ctrl button { height: 32px; margin: 8px 0 8px 8px; font-size: 16px; padding: 0 12px; background-color: #7289DA; color: #FFF; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.75); } #dht-ctrl button { height: 32px; margin: 8px 0 8px 8px; font-size: 16px; padding: 0 12px; background-color: #7289DA; color: #FFF; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.75); }
#dht-ctrl button:disabled { background-color: #7A7A7A; cursor: default; } #dht-ctrl button:disabled { background-color: #7A7A7A; cursor: default; }
@ -664,7 +664,7 @@ ${radio("asm", "pause", "Pause Tracking")}
${radio("asm", "switch", "Switch to Next Channel")} ${radio("asm", "switch", "Switch to Next Channel")}
<p id='dht-cfg-note'> <p id='dht-cfg-note'>
It is recommended to disable link and image previews to avoid putting unnecessary strain on your browser.<br><br> It is recommended to disable link and image previews to avoid putting unnecessary strain on your browser.<br><br>
<sub>v.31f, released 20 November 2023</sub> <sub>v.31e, released 10 October 2022</sub>
</p>`); </p>`);
// elements // elements

File diff suppressed because one or more lines are too long

View File

@ -8,8 +8,8 @@ import os
import re import re
import distutils.dir_util import distutils.dir_util
VERSION_SHORT = "v.31f" VERSION_SHORT = "v.31e"
VERSION_FULL = VERSION_SHORT + ", released 20 November 2023" VERSION_FULL = VERSION_SHORT + ", released 10 October 2022"
EXEC_UGLIFYJS_WIN = "{2}/lib/uglifyjs.cmd --parse bare_returns --compress --mangle toplevel --mangle-props keep_quoted,reserved=[{3}] --output \"{1}\" \"{0}\"" EXEC_UGLIFYJS_WIN = "{2}/lib/uglifyjs.cmd --parse bare_returns --compress --mangle toplevel --mangle-props keep_quoted,reserved=[{3}] --output \"{1}\" \"{0}\""
EXEC_UGLIFYJS_AUTO = "uglifyjs --parse bare_returns --compress --mangle toplevel --mangle-props keep_quoted,reserved=[{3}] --output \"{1}\" \"{0}\"" EXEC_UGLIFYJS_AUTO = "uglifyjs --parse bare_returns --compress --mangle toplevel --mangle-props keep_quoted,reserved=[{3}] --output \"{1}\" \"{0}\""

View File

@ -4,11 +4,11 @@ var DISCORD = (function(){
}; };
var getMessageScrollerElement = function(){ var getMessageScrollerElement = function(){
return getMessageOuterElement().querySelector("[class*='scroller_']"); return getMessageOuterElement().querySelector("[class*='scroller-']");
}; };
var getMessageElements = function() { var getMessageElements = function() {
return getMessageOuterElement().querySelectorAll("[class*='message_']"); return getMessageOuterElement().querySelectorAll("[class*='message-']");
}; };
var getReactProps = function(ele) { var getReactProps = function(ele) {
@ -183,7 +183,7 @@ var DISCORD = (function(){
if (dms){ if (dms){
let name; let name;
for (const ele of dms.querySelectorAll("[class*='channel_'] [class*='selected_'] [class^='name_'] *")) { for (const ele of dms.querySelectorAll("[class*='channel-'] [class*='selected-'] [class^='name-'] *, [class*='channel-'][class*='selected-'] [class^='name-'] *")) {
const node = Array.prototype.find.call(ele.childNodes, node => node.nodeType === Node.TEXT_NODE); const node = Array.prototype.find.call(ele.childNodes, node => node.nodeType === Node.TEXT_NODE);
if (node) { if (node) {
@ -216,7 +216,7 @@ var DISCORD = (function(){
else if (obj.guild_id) { else if (obj.guild_id) {
let guild; let guild;
for (const child of getReactProps(document.querySelector("nav header [class*='headerContent_']")).children) { for (const child of getReactProps(document.querySelector("nav header [class*='headerContent-']")).children) {
if (child && child.props && child.props.guild) { if (child && child.props && child.props.guild) {
guild = child.props.guild; guild = child.props.guild;
break; break;
@ -286,10 +286,10 @@ var DISCORD = (function(){
if (dms) { if (dms) {
const currentChannel = DOM.queryReactClass("selected", dms); const currentChannel = DOM.queryReactClass("selected", dms);
const currentChannelContainer = currentChannel && currentChannel.closest("[class*='channel_']"); const currentChannelContainer = currentChannel && currentChannel.closest("[class*='channel-']");
const nextChannel = currentChannelContainer && currentChannelContainer.nextElementSibling; const nextChannel = currentChannelContainer && currentChannelContainer.nextElementSibling;
if (!nextChannel || !nextChannel.getAttribute("class").includes("channel_")) { if (!nextChannel || !nextChannel.getAttribute("class").includes("channel-")) {
return false; return false;
} }
@ -316,7 +316,7 @@ var DISCORD = (function(){
let nextChannel = null; let nextChannel = null;
for (let index = 0; index < allTextChannels.length - 1; index++) { for (let index = 0; index < allTextChannels.length - 1; index++) {
if (allTextChannels[index].className.includes("selected_")) { if (allTextChannels[index].className.includes("selected-")) {
nextChannel = allTextChannels[index + 1]; nextChannel = allTextChannels[index + 1];
break; break;
} }

View File

@ -16,7 +16,7 @@ var DOM = (function(){
/* /*
* Returns the first child element containing the specified obfuscated class. Parent defaults to the entire document. * Returns the first child element containing the specified obfuscated class. Parent defaults to the entire document.
*/ */
queryReactClass: (cls, parent) => (parent || document).querySelector(`[class*="${cls}_"]`), queryReactClass: (cls, parent) => (parent || document).querySelector(`[class*="${cls}-"]`),
/* /*
* Creates an element, adds it to the DOM, and returns it. * Creates an element, adds it to the DOM, and returns it.

View File

@ -83,7 +83,7 @@ var GUI = (function(){
// styles // styles
controller.styles = DOM.createStyle(` controller.styles = DOM.createStyle(`
#app-mount { height: calc(100% - 48px) !important; } #app-mount div[class*="app-"] { margin-bottom: 48px !important; }
#dht-ctrl { position: absolute; bottom: 0; width: 100%; height: 48px; background-color: #FFF; z-index: 1000000; } #dht-ctrl { position: absolute; bottom: 0; width: 100%; height: 48px; background-color: #FFF; z-index: 1000000; }
#dht-ctrl button { height: 32px; margin: 8px 0 8px 8px; font-size: 16px; padding: 0 12px; background-color: #7289DA; color: #FFF; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.75); } #dht-ctrl button { height: 32px; margin: 8px 0 8px 8px; font-size: 16px; padding: 0 12px; background-color: #7289DA; color: #FFF; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.75); }
#dht-ctrl button:disabled { background-color: #7A7A7A; cursor: default; } #dht-ctrl button:disabled { background-color: #7A7A7A; cursor: default; }