Board Thread:Lua Help/@comment-166269-20150217184425/@comment-11733175-20150224094008

Also, instead of looking for specific elements on the page, you can simple check wgAction is view or edit (and probably submit): // Documentation for wiki modules $(function {    if (wgCanonicalNamespace === 'Module') {        if (wgTitle.indexOf('/doc') === -1 && wgAction === 'view') {            mw.loader.using('mediawiki.api', function  { (new mw.Api) .get({                       action: 'parse',                        page: wgPageName + '/doc'                    }).done(function (data) {                        if (data.error) {                            return;                        }                        $('#mw-content-text').prepend(data.parse.text["*"]);                    }); });       } else if (wgTitle.indexOf('/doc') > -1 && ['edit', 'submit'].indexOf(wgAction) > -1) {            $('.wikia-scribunto-console').hide;            $('.scribunto_ignore_errors')                .hide                .children                    .prop('checked', true);        }    } }); Another advantage of this is that we can have subpages of /doc with things like changelogs to make it easier for users to see what changed in case a module receives a breaking change. We could also keep a testcases page there as well.