(bug 19496) New pages don't have yellow background. Moving rules for .not-patrolled...
[lhc/web/wiklou.git] / skins / common / wikibits.js
index 30686fb..b81196f 100644 (file)
@@ -49,8 +49,9 @@ function hookEvent(hookName, hookFunct) {
 }
 
 function importScript(page) {
+       // TODO: might want to introduce a utility function to match wfUrlencode() in PHP
        var uri = wgScript + '?title=' +
-               encodeURIComponent(page.replace(/ /g,'_')).replace('%2F','/').replace('%3A',':') +
+               encodeURIComponent(page.replace(/ /g,'_')).replace(/%2F/ig,'/').replace(/%3A/ig,':') +
                '&action=raw&ctype=text/javascript';
        return importScriptURI(uri);
 }
@@ -113,7 +114,9 @@ function showTocToggle() {
                // Uses DOM calls to avoid document.write + XHTML issues
 
                var linkHolder = document.getElementById('toctitle');
-               if (!linkHolder) {
+               var existingLink = document.getElementById('togglelink');
+               if (!linkHolder || existingLink) {
+                       // Don't add the toggle link twice
                        return;
                }