brendanheywood / moodle-local_cleanurls

Lets drag Moodle's url structure into this century...
36 stars 24 forks source link

Remove hard coded location in hash click handler #114

Closed brendanheywood closed 6 years ago

brendanheywood commented 6 years ago

Thinking this:

    if (element.getAttribute('href').charAt(0) == '#') {
        element.href = 'https://preprod-cqu-mba.catalyst-au.net/admin/search.php' + element.getAttribute('href');
    }

should be

        element.href = location.href + element.getAttribute('href');

Thinking about the edge case where the replace state hasn't worked in a browser that doesn't support it, and also it's simpler / easier / more robust code.