EhxVisited

E-H Visited, combined with ExVisited, and then better.

< Commentaires sur EhxVisited

Question / commentaire

§
Posté le: 2019-12-13
Édité le: 2019-12-13

A few tips...

To make clean code learn from a JavaScript beautifier. My Favorite: https://beautifier.io/

Include more functions and objects. (This makes your code look more professional) Ex:

window.scriptStorage = {
    repeatedCodeInHere: function () {

    },
    someMoreVariablesSeperatedByCommasAndThisAlsoHelpsToPreventPatching: 10
}

Make code more undetectable. Ex:

(!function () {
    /*bulk of code here*/
})()

Use commentation to describe parts of your code so in 4 months from now you can understand your code. Ex:

//Single Line
/*
Multi-line
*/

Make code dedicated for easy customization. Ex:

//start of program or by it
var themeColors = {
    primary: "#000000",
    secondary: "#404040",
    tertiary "#606060"
};
/*
             ...
    100 lines later
*/
document.getElementsByTagName("head")[0] += `
    <style>
        .primary {
            background-color: ${themeColors.primary};
        }
        .secondary {
            background-color: ${themeColors.secondary};
        }
        .tertiary {
            background-color: ${themeColors.tertiary};
        }
    </style>
`;
HauffenAuteur
§
Posté le: 2019-12-13

I mean, I'll take what I can get, but most of the points raised here aren't that applicable. The majority of the repeated code is already in functions and the stuff that isn't is stuff I'm working on. Throwing an exclamation point in front of the main function simple and plainly breaks the code, which would probably be a good idea to find out why. I'm the only developer and I've put in enough comments for myself, and the majority of any of the customization is within either user created CSS stored in a very plainly labeled variable in browser storage, or in a giant block of CSS that definitely could be more readable.

I appreciate the tips for sure, but this is essentially basic best practices for any programming language. Perhaps it would be more elucidating to me if there were more concrete examples, rather than just samples. Do note that I am actively working on making this less of spaghetti code, it's just getting there slowly.

§
Posté le: 2019-12-13

I made this to potentially help your "spaghetti code" to get cleaner.

Poster une réponse

Connectez-vous pour poster une réponse.