mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2025-06-06 10:23:11 +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>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-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-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>",
|
"<br>",
|
||||||
"<label>After reaching a previously saved message...</label><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-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-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("");
|
].join("");
|
||||||
|
|
||||||
// elements
|
// 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_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_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_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_PAUSE] = DOM.id("dht-cfg-asm-pause");
|
||||||
|
settings.ui.optsAfterSavedMsg[CONSTANTS.AUTOSCROLL_ACTION_SWITCH] = DOM.id("dht-cfg-asm-switch");
|
||||||
|
|
||||||
// events
|
// events
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
var CONSTANTS = {
|
var CONSTANTS = {
|
||||||
AUTOSCROLL_ACTION_NOTHING: "optNothing",
|
AUTOSCROLL_ACTION_NOTHING: "optNothing",
|
||||||
AUTOSCROLL_ACTION_PAUSE: "optPause",
|
AUTOSCROLL_ACTION_PAUSE: "optPause",
|
||||||
|
AUTOSCROLL_ACTION_SWITCH: "optSwitch"
|
||||||
};
|
};
|
||||||
|
|
||||||
var STATE = (function(){
|
var STATE = (function(){
|
||||||
|
@ -17,7 +17,7 @@ DISCORD.setupMessageRequestHook((channel, messages) => {
|
|||||||
action = STATE.settings.afterFirstMsg;
|
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();
|
STATE.toggleTracking();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -34,8 +34,12 @@ STATE.onStateChanged((type, detail) => {
|
|||||||
if (DISCORD.hasMoreMessages()){
|
if (DISCORD.hasMoreMessages()){
|
||||||
DISCORD.loadOlderMessages();
|
DISCORD.loadOlderMessages();
|
||||||
}
|
}
|
||||||
else if (STATE.settings.afterFirstMsg === CONSTANTS.AUTOSCROLL_ACTION_PAUSE){
|
else{
|
||||||
DOM.setTimer(() => STATE.toggleTracking(), 200); // give the user visual feedback after clicking the button before switching off
|
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