mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2025-04-13 15:27:16 +03:00
Add and implement a 'Switch to next channel' option
This commit is contained in:
parent
50a1e2e94e
commit
5ec0747fd1
@ -179,10 +179,12 @@ var GUI = (function(){
|
||||
"<label>After reaching the first message in channel...</label><br>",
|
||||
"<label><input id='dht-cfg-afm-nothing' name='dht-afm' type='radio'> Do Nothing</label><br>",
|
||||
"<label><input id='dht-cfg-afm-pause' name='dht-afm' type='radio'> Pause Tracking</label><br>",
|
||||
"<label><input id='dht-cfg-afm-switch' name='dht-afm' type='radio'> Switch to Next Channel</label><br>",
|
||||
"<br>",
|
||||
"<label>After reaching a previously saved message...</label><br>",
|
||||
"<label><input id='dht-cfg-asm-nothing' name='dht-asm' type='radio'> Do Nothing</label><br>",
|
||||
"<label><input id='dht-cfg-asm-pause' name='dht-asm' type='radio'> Pause Tracking</label><br>",
|
||||
"<label><input id='dht-cfg-asm-switch' name='dht-asm' type='radio'> Switch to Next Channel</label><br>"
|
||||
].join("");
|
||||
|
||||
// elements
|
||||
@ -195,9 +197,11 @@ var GUI = (function(){
|
||||
|
||||
settings.ui.optsAfterFirstMsg[CONSTANTS.AUTOSCROLL_ACTION_NOTHING] = DOM.id("dht-cfg-afm-nothing");
|
||||
settings.ui.optsAfterFirstMsg[CONSTANTS.AUTOSCROLL_ACTION_PAUSE] = DOM.id("dht-cfg-afm-pause");
|
||||
settings.ui.optsAfterFirstMsg[CONSTANTS.AUTOSCROLL_ACTION_SWITCH] = DOM.id("dht-cfg-afm-switch");
|
||||
|
||||
settings.ui.optsAfterSavedMsg[CONSTANTS.AUTOSCROLL_ACTION_NOTHING] = DOM.id("dht-cfg-asm-nothing");
|
||||
settings.ui.optsAfterSavedMsg[CONSTANTS.AUTOSCROLL_ACTION_PAUSE] = DOM.id("dht-cfg-asm-pause");
|
||||
settings.ui.optsAfterSavedMsg[CONSTANTS.AUTOSCROLL_ACTION_SWITCH] = DOM.id("dht-cfg-asm-switch");
|
||||
|
||||
// events
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
var CONSTANTS = {
|
||||
AUTOSCROLL_ACTION_NOTHING: "optNothing",
|
||||
AUTOSCROLL_ACTION_PAUSE: "optPause",
|
||||
AUTOSCROLL_ACTION_SWITCH: "optSwitch"
|
||||
};
|
||||
|
||||
var STATE = (function(){
|
||||
|
@ -17,7 +17,7 @@ DISCORD.setupMessageRequestHook((channel, messages) => {
|
||||
action = STATE.settings.afterFirstMsg;
|
||||
}
|
||||
|
||||
if (action === CONSTANTS.AUTOSCROLL_ACTION_PAUSE){
|
||||
if ((action === CONSTANTS.AUTOSCROLL_ACTION_SWITCH && !DISCORD.selectNextTextChannel()) || action === CONSTANTS.AUTOSCROLL_ACTION_PAUSE){
|
||||
STATE.toggleTracking();
|
||||
}
|
||||
else{
|
||||
@ -34,8 +34,12 @@ STATE.onStateChanged((type, detail) => {
|
||||
if (DISCORD.hasMoreMessages()){
|
||||
DISCORD.loadOlderMessages();
|
||||
}
|
||||
else if (STATE.settings.afterFirstMsg === CONSTANTS.AUTOSCROLL_ACTION_PAUSE){
|
||||
DOM.setTimer(() => STATE.toggleTracking(), 200); // give the user visual feedback after clicking the button before switching off
|
||||
else{
|
||||
var action = STATE.settings.afterFirstMsg;
|
||||
|
||||
if ((action === CONSTANTS.AUTOSCROLL_ACTION_SWITCH && !DISCORD.selectNextTextChannel()) || action === CONSTANTS.AUTOSCROLL_ACTION_PAUSE){
|
||||
DOM.setTimer(() => STATE.toggleTracking(), 200); // give the user visual feedback after clicking the button before switching off
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user