FANDOM


  • Hello,
    I have relatively recently rewritten ChatHacks and ChatOptions to make them translatable using I18n-js and generally make the code more readable and up to date with standards (more or less) used on FANDOM Developers Wiki. Their code can be found here and here, because they are very widely used and could not be released live without thorough testing.

    ChatOptions

    All changes to ChatOptions also include:

    • wikia.ui.factory modal instead of $.showCustomModal
    • Storing options in $.storage instead of cookies
    • Extracted CSS to a separate page
    • Not leaking functions into global scope
    • UI-js instead of concatenated HTML
    • Double-loading prevention
    • Chat-js options button instead of a custom one appended to the top of the Rail
    • Slightly changed window look (old vs new)
    • "Added functionality" options have been made customizable and therefore some modules were changed/added:
      • ChatHacks module is importing the beta version of ChatHacks, but that is probably not going to be in the live version
      • Multikick option is now only appearing for moderators
      • MultiPM module has been switched with ExtendedPrivateMessaging, as it is a way newer script with way more options
      • EmoticonsWindow, FasterBanModule and QuickModTools have been added as options
      • Side scroll prevention option has been removed as that is a default feature of chat since about a year ago
      • "Ignore URL in main chat" option has only ever been enabled on Call of Duty Wiki, which doesn't have chat anymore, so the option has been removed
    • All inline CSS related to "Color changes"/"Font" sections has been converted into <style> with mw.util.addCSS
    • Rubik font is an option now
    • Module scripts are being imported all at once with importArticles instead of one by one with importScriptPage
    • ChatOptions code subpages will import the rewrite once it goes live

    ChatHacks

    All changes to ChatHacks also include:

    • Exposing the ChatHacks object globally (now that it exists).
    • Empty pings should no longer ping for every message
    • Killing emoticons should finally work as intended (.children('.message img') was replaced with .find('.message img')
    • No more playing with mw.hooks, all dependencies are preloaded together
    • Overwritten sendMessage method respects message length limiting
    • window.commands object has been changed to use objects instead of functions in order to contain information other than just the command handler
    • Simplified the logic in /self command

    Notes

    • ChatOptions modules should not be scripts intended for sitewide use, such as ChatTags, ChatSyntaxHighlight, ChatStatus, IsTyping or ChatAnnouncements - it is misleading to users as they would think these apply to everyone when they really apply only to them
    • One of the ChatOptions authors, Callofduty4, has requested that ChatOptions current code remains on the /code.js page. As the long-term plan is to move all /code.js pages to .js anyways, I believe we could create a MediaWiki:ChatOptions.js page for the new code and add a notice into the old script that a new version exists, with instructions for migration.
    • As killing emoticons never seems to have worked in past, this functionality might be unexpected to previous users of ChatHacks. Should we just remove it instead of fixing it?

    Any other thoughts/opinions on the rewrite? After how long from the beginning of testing should these be released as stable?

      Loading editor
    • Thanks for modernizing the ChatOptions code and bringing it up to par feature-wise Kocka. I don't believe it has been touched before now since 2012, so it was in dire need of some updating. Big props to you!

        Loading editor
    • Looks good! Glad to see these scripts updated.

        Loading editor
    • Brilliant! These scripts have always been the main export of the site (along with DiscordIntegrator) and rewriting them is no mean feat. πŸ‘πŸ‘πŸ‘

      1. I personally feel there should be freedom to use the legacy version - we could let users dismiss the ChatHacks update with a global/localStorage setting.
      2. Adding emote killing but make it opt-in would be suitable.

      I can read the code tomorrow and expand on my thoughts, it's late atmΒ :)

        Loading editor
    • ChatHacks beta code has been merged into stable now. I'll look into implementing more features (addressing some feedback from testers) into ChatOptions before moving it to ChatOptions.js.

        Loading editor
    • Excellent.

        Loading editor
    • Since this update I've been unable to open Chat via the "Join the chat" button. Loading the script directly through the devtools gives an error of TypeError: this is undefined; can't access its "openChatWindow" property. Has anyone else experienced this error?
      Firefox v65 (nightly) if that's relevant.

        Loading editor
    • It was a bug, and it should be fixed, although I haven't tested the changes

        Loading editor
    • Loaded the updated version with devtools, and it appears to be working great on my end. Thank you!

        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message