Open mclabs15 opened 6 years ago
I am trying to close this issue and it seems like Reddit keeps on doing the weirdest of things. For one, it seems like Reddit is making the text boxes load after the page loads (this was added yesterday from the looks of it), as well as the new modals (a la the tweet previews on Twitter Web) making everything difficult (not that I even gotten to that stage) and the fact that the comment boxes is <div />
and not consistent (not a <textarea />
or <input />
.
Oh yeah, Reddit also seemed to have also stopped rendering emotes, as the bpm-emote bpmote-EMOTENAME
tags are not being added anymore.
Well, regarding the text box appearing after the page loads, you may do something like what discord does:
function waitByQuerySelector(selector, callback) {
var element = document.querySelector(selector);
if(!element) {
window.setTimeout(function() { waitByQuerySelector(selector, callback); }, 100);
} else {
callback(element);
}
}
This, of course, becomes more difficult if they're constantly changing class names, but it's all I've got for you. Obv. something like a MutationObserver required for child comment boxes. Or something. I'm spitballing on the bus at 8:30 here.
This, of course, becomes more difficult if they're constantly changing class names
At least for the submit button and its location, you can use more intermediate query selectors to try to work around the changing classes. Something like document.querySelector("button[type=\"submit\"]")
does the trick if I am not mistaken.
Yeah. Wildcards are valid as well, if that's any help.
On Sat, Apr 7, 2018, 12:35 HeyItsShuga notifications@github.com wrote:
This, of course, becomes more difficult if they're constantly changing class names
At least for the submit button and its location, you can use more intermediate query selectors to try to work around the changing classes. Something like document.querySelector("button[type=\"submit\"]") does the trick if I am not mistaken.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Rothera/bpm/issues/61#issuecomment-379493818, or mute the thread https://github.com/notifications/unsubscribe-auth/AEwr6S1EjYYTRKZRw3GjHQl-i-3msrTlks5tmRUQgaJpZM4SHt-P .
The beta version of reddit's new interface has no emotes button under the comment box. I've included some example HTML of the comments page here.