mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2024-11-25 14:42:44 +01:00
Compare commits
3 Commits
a20ce8ee71
...
ce87901088
Author | SHA1 | Date | |
---|---|---|---|
ce87901088 | |||
ea03f285a6 | |||
4d914f2ae7 |
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Discord History Tracker
|
// @name Discord History Tracker
|
||||||
// @version v.31e
|
// @version v.31f
|
||||||
// @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-'] *, [class*='channel-'][class*='selected-'] [class^='name-'] *")) {
|
for (const ele of dms.querySelectorAll("[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 div[class*="app-"] { margin-bottom: 48px !important; }
|
#app-mount { height: calc(100% - 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.31e, released 10 October 2022</sub>
|
<sub>v.31f, released 20 November 2023</sub>
|
||||||
</p>`);
|
</p>`);
|
||||||
|
|
||||||
// elements
|
// elements
|
||||||
|
File diff suppressed because one or more lines are too long
4
build.py
4
build.py
@ -8,8 +8,8 @@ import os
|
|||||||
import re
|
import re
|
||||||
import distutils.dir_util
|
import distutils.dir_util
|
||||||
|
|
||||||
VERSION_SHORT = "v.31e"
|
VERSION_SHORT = "v.31f"
|
||||||
VERSION_FULL = VERSION_SHORT + ", released 10 October 2022"
|
VERSION_FULL = VERSION_SHORT + ", released 20 November 2023"
|
||||||
|
|
||||||
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}\""
|
||||||
|
@ -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-'] *, [class*='channel-'][class*='selected-'] [class^='name-'] *")) {
|
for (const ele of dms.querySelectorAll("[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;
|
||||||
}
|
}
|
||||||
|
@ -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.
|
||||||
|
@ -83,7 +83,7 @@ var GUI = (function(){
|
|||||||
// styles
|
// styles
|
||||||
|
|
||||||
controller.styles = DOM.createStyle(`
|
controller.styles = DOM.createStyle(`
|
||||||
#app-mount div[class*="app-"] { margin-bottom: 48px !important; }
|
#app-mount { height: calc(100% - 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; }
|
||||||
|
Loading…
Reference in New Issue
Block a user