LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   LQ Suggestions & Feedback (https://www.linuxquestions.org/questions/lq-suggestions-and-feedback-7/)
-   -   [Bug] Forum erases basic javascript global objects (https://www.linuxquestions.org/questions/lq-suggestions-and-feedback-7/%5Bbug%5D-forum-erases-basic-javascript-global-objects-4175725072/)

martixy 05-14-2023 06:46 PM

[Bug] Forum erases basic javascript global objects
 
Like the console.

You just don't mess with the window like that. It's rude.

vbulletin_global.js?v=3810b1
Code:

if (!window.console || !console.firebug) {
    window.console = {};
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
    for (var i = 0; i < names.length; ++i) {
        window.console[names[i]] = function() {}
    }
}

Somebody needs to fix that condition.

dugan 05-19-2023 11:45 AM

As this doesn’t hinder any legitimate use of the forum, I’d close this as “not a bug”.

boughtonp 05-20-2023 09:17 AM

Quote:

Originally Posted by dugan (Post 6431791)
As this doesn’t hinder any legitimate use of the forum

It hinders quickly testing JavaScript code, which is not illegitimate, and there is zero benefit to LQ in breaking the functionality.

One example of where it is useful is verifying code when responding to JS questions in the programming forum.

There's a couple of workarounds - easiest is to disable JS for linuxquestions.org (using uBlock Origin) so the vbulletin_global.js script doesn't run, but another is to restore it with:
Code:

function restoreConsole()
{
  var i = document.createElement('iframe');
  i.style.display = 'none';
  document.body.appendChild(i);
  window.console = i.contentWindow.console;
}


martixy 05-27-2023 10:25 AM

Quote:

Originally Posted by dugan (Post 6431791)
As this doesn’t hinder any legitimate use of the forum, I’d close this as “not a bug”.

I have a medical condition and I use userscripts and extensions to increase the accessibility of various sites and make them easier to navigate. These sometimes need to be adapted or configured.
Lack of the console makes this particularly hard.

Perhaps you'd like to reconsider.


All times are GMT -5. The time now is 09:03 AM.