Closed IzzySoft closed 3 years ago
In which question did you encounter this error? Or do you encounter this error in every question?
Every question I tried on SoftwareRecs.SE and Android.SE.
apologies for the other two "pings": those reports belonged to another project I reported a problem simultaneously to…
I can't reproduce this on those sites either, please could you check if you get this bug if you temporarily disable the other timer script you have installed?
I did that already before reporting (disabled all other SE scripts), the error remains in the console. Just checked again now, still there.
Just reported this as I found it in the console (and the message asked to report). Nothing seems broken so far, so priority is rather low for me. Could it be some browser compatibility thing? I'm using Waterfox Classic here, as stated above – and the "classic" Greasemonkey.
I would suggest using Tampermonkey or Violentmonkey. I recommend against using Greasemonkey. Greasemonkey 3 was great. I highly preferred it. Unfortunately, with Greasemonkey 4 (GM4), a complete rewrite required by Firefox changing to WebExtensions only, there were decisions made that make GM4 incompatible with a large number of userscripts. Of the userscripts I use for Stack Overflow, 30 of them are incompatible with GM4.
Thanks for the pointer, @double-beep – and let me point out again that I'm still using the non-WE Greasemonkey here (Waterfox Classic still supports XUL), so
Greasemonkey 3 was great. I highly preferred it.
Full ack. And I still do run Greasemonkey 3.17 :wink:
That said: I just upgraded to the latest SOX version (I just returned from vacation, hence my delayed answer). The error is still shown in console. Again, low prio for me – I just reported this as the log message asked me to.
@IzzySoft This should be fixed in dev 2.6.18 now! :)
Sorry to disappoint you, but I still get it with 2.6.21 here. Both, Appearance-markEmployees
and Editing-inlineEditorEverywhere
.
Hmmm this is really quite weird because it's only happening for these features! I just installed Waterfox, but can't seem to find a place to get Greasemonkey 3.17 to test this on, do you know where I can install it from?
Also, please could you paste the entire console output after disabling other extensions? I just want to see if there's anything that might hint at what's going on here!
Sorry for not updating; I still see the issue, but found no time to do the "big dig". Especially as disabling extensions means multiple browser restarts (yes, legacy addons), and I always have multiple tabs with open work :cry: As long as it's only something showing up in the console, it doesn't hurt me – and I miss no functionality (I'd only like to know what's always deleting my localStorage, rendering some scripts like timer useless and forcing me to copy-paste my canned comments 5 times a week – but I don't assume SOX behind that, though it seems to only affect SO sites; I don't want to disable SOX for a week to find out either :wink:)
Can you do the following?
Update to SOX latest DEV version
Change line 48 with:
return ![...el.children].filter(el => el.classList.indexOf('sox-markEmployees') > -1).length && el.href && el.href.match(/\/users\/\d+/);
And line 73 with:
anchors.filter(el => el.href.indexOf(/users/${userId}/
) > -1).forEach(el => el.appendChild(logoSpan.cloneNode(true)));
Does it work now?
Thanks @double-beep! Took me a little to find a file where your line numbers fitted something that looked right :laughing: sox.features.js
seems to fit your line numbers (that doesn't open via GM menues).
Unfortunately, changing those lines doesn't get rid of the errors in console.
SOX: There was an error loading the feature "Appearance-markEmployees". Please raise an issue on GitHub, and copy the following error log: TypeError: el.classList.indexOf is not a function sox.common.js:38:7 sox.error Stack_Overflow_Extras_(SOX)/sox.common.js:38:7 init Stack_Overflow_Extras_(SOX)/sox.user.js:172:13 sox.ready/< sox.common.js:79:11 l jquery-3.3.1.min.js:2:29373 a/</c< jquery-3.3.1.min.js:2:29677 SOX: There was an error loading the feature "Editing-inlineEditorEverywhere". Please raise an issue on GitHub, and copy the following error log: TypeError: sox.Stack.using is not a function sox.common.js:38:7 sox.error sox.common.js:38:7 init sox.user.js:172:13 sox.ready/< sox.common.js:79:11 l jquery-3.3.1.min.js:2:29373 a/</c< jquery-3.3.1.min.js:2:29677
Funny thing is both stack traces seem to be identical to the letter. So to me it's not clear where they originate. Your first one indeed was one of the two – when replacing that with null
, the error is gone (but of course without enabling the feature).
Uh, ️🤦♂️. Replace classList
with className
in L48. Apparently, classList
returns a DOMTokenList
, but indexOf
needs a string (or an array) to work.
Yes, that does the trick! One down (sox-markEmployees), one to go (Editing-inlineEditorEverywhere).
@shu8 can we replace .contains()
with .indexOf()
to make markEmployees
compatible with Waterfox?
@IzzySoft that's an interesting error. What's the output of !!StackExchange.using
in console (should be true
)? What do you get when you add sox.warn("StackExchange.using exists: " + !!sox.Stack.using + "; object: " + sox.Stack.using);
after line 2240? Also, do you get any inlineEditorEverywhere error: sox.Stack.using not found
warnings in console?
What's the output of
!!StackExchange.using
in console (should betrue
)?
It is true
.
What do you get when you add
That would be right before sox.Stack.using('inlineEditing', () => {
, correct?
SOX: StackExchange.using exists: false; object: undefined
Funny thing is: I've added console.log(sox.stack);
right after if (sox.Stack) {
and investigated the object returned. According to console, it has a using: y()
. Though I cannot tell when console does evaluate that (probably when I click for the details, which is a lot later). If I replace that with console.log(sox.stack.using);
I get the expected undefined
. Maybe the conditional if (sox.stack)
should be replaced by if (sox.stack.using)
? That (obviously) removes the error – but of course the functionality is not implemented then.
For some context: I'm a mod, so I guess my reputation is high enough to already have the inline editor. Let me check a few other sites (rep in parenthesis):
Appearance-colorAnswerer
Appearance-colorAnswerer
)Appearance-markEmployees
error is back here as well?So it has nothing to do with my rep or being mod.
do you get any
inlineEditorEverywhere error: sox.Stack.using not found
warnings in console?
No. But with my suggested change above (replacing the conditional) I do, obviously.
Do note that JavaScript is case-sensitive - sox.stack
is not the same as sox.Stack
! Also, do you get the same contains is not a function
error wrt. the markEmployees
feature? What's the colorAnswerer
error you get?
Apparently, Waterfox is quite slow to create (or update?) the using
property of the StackExchange
. I suggest that you use this answer to fix this problem. More specifically:
inlineEditorEverywhere: async function() {
// Description: Enabled inline editor on all sites
// Written by @nicael: http://stackapps.com/questions/6216/inline-editor-regardless-of-reputation, and copied with nicael's permission
while (!sox.Stack.using) {
await new Promise(resolve => setTimeout(resolve, 100));
sox.warn("Not defined");
}
sox.warn("Finally defined");
if (sox.Stack) {
$('.suggest-edit-post').removeClass('suggest-edit-post').addClass('edit-post');
sox.Stack.using('inlineEditing', () => {
sox.Stack.inlineEditing.init();
});
} else {
sox.warn('inlineEditorEverywhere error: sox.Stack.using not found');
sox.debug('inlineEditorEverywhere: Stack object:', sox.Stack);
}
},
That should probably fix the problem. However, keep in mind that it's ugly, temporary and possibly not efficient.
No errors anymore then, right – but for a different reason: SOX won't load anymore at all then. Looks like it gets stuck in that while
loop then.
Nevermind, I can live with the current situation. I just reported the issue as SOX's debug output asked me to :wink:
Thanks for the debugging for the first issue @double-beep and @IzzySoft!
@shu8 can we replace .contains() with .indexOf() to make markEmployees compatible with Waterfox? Yes! Thanks for finding this out :) I can make that change soon or would be happy to review a PR for it too
For the sox.Stack
issue, for some reason I remember this as a Firefox issue and the whole reason why we started to use sox.Stack
and not StackExchange
, see https://github.com/soscripted/sox/blob/dev/sox.common.js#L52 for the 'hacky' assignment of Stack
.
I can't remember what exactly was the problem with FF though, so it might be worth trying to just use StackExchange
or window.StackExchange
again.
Reopening though because this seems to definitely be a bug! Thanks again for the debugging :)
Feel free to let me know if I should test something then!
Describe the bug Not sure what is affected, but while looking for the reason parts of the timer script don't work I found the following in the browser console:
SOX errors logged in console
Probably related, preceding the error:
Environment SOX version: 2.6.14 DEV Platform: Linux Mint 18.3, Waterfox 52.2.14, Greasemonkey (last pre-WE version)
Features Enabled