Contributing to the editor

The server was closed on April 2nd, 2023
https://pwmirage.com/forum/thread/342-we-are-closing/
  • A few people already offered their help on creating the editor, but it's very hard at the moment. Anyone interested in contributing, please read the below.


    Majority of the code is the frontend written in javascript. I'm not really a javascript developer and the code I wrote is a mix of various styles, coding principles, etc. TBH I'm still learning javascript as I write this editor and definitely the new code I add now is much better than the code from 3 months ago. Still, I can imagine it asks for improvement. We're close to the release right now and I'm focusing on finishing the quest editor so that we're not blocked, but after the release, a new priority will show up: refactoring and cleaning up the code.


    From what I read there's at least a few things that need to be implemented in order to keep the codebase clean as it grows:

    • ES6 modules -> we use global variables and global functions everywhere. The "public" function names are currently prefixed with filename and that's OK, but the private ones aren't prefixed and could conflict in multiple files
    • Scoped CSS -> All CSS is currently global and already conflicts in a few places. Adding more CSS is difficult, because you need to ensure it targets only the element you want to modify and nothing else.
    • Classes? -> We're currently using global functions + HTML element objects for metadata (usually prefixed with mgw (as in MiraGeWindow)). This is OK, but could be improved. Maybe custom classes extending HTMLElement instead?
    • getting rid of jQuery -> We use both jQuery and native JS interchangeably. Some APIs accept jquery objects as parameters, some other native JS objects. We could implement a few utility functions like creating HTML elements from string, then drop jQuery completely and make the API consistent
    • error handling -> this could be easily simplified by using exceptions. We're currently just checking all variables. e.g. functions return -1 if they fail


    I'll push all javascript to github after the release and will do my best to describe the overall structure/concept so that others can contribute as well.

    Thanks!