Difference between revisions of "Template:Shanghaitech/js"

m (global match)
m (fix missing hashtag)
Line 1: Line 1:
 
<html><script>
 
<html><script>
 +
 
function createEmptySidenav() {
 
function createEmptySidenav() {
 
     $('<div id="mySidenav" class="sidenav shown"><a href="javascript:void(0)" id="hide-botton" onclick="closeNav()"><span id="hide-botton-icon">&gt;</span></a></div>').appendTo('#mw-content-text');
 
     $('<div id="mySidenav" class="sidenav shown"><a href="javascript:void(0)" id="hide-botton" onclick="closeNav()"><span id="hide-botton-icon">&gt;</span></a></div>').appendTo('#mw-content-text');
Line 15: Line 16:
 
function createSidenavElement(title) {
 
function createSidenavElement(title) {
 
     elementHTML = '<a href="#%id">%title</a>'.replace("%title", title.innerHTML).replace("%id", title.id);
 
     elementHTML = '<a href="#%id">%title</a>'.replace("%title", title.innerHTML).replace("%id", title.id);
     $(elementHTML).appendTo("mySidenav");
+
     $(elementHTML).appendTo("#mySidenav");
 
}
 
}
  
Line 22: Line 23:
 
     parseContentTitles();
 
     parseContentTitles();
 
}
 
}
 +
 +
$("#mySidenav").remove();
 +
createSidenav();
 +
 +
 
</script></html>
 
</script></html>

Revision as of 10:19, 29 October 2017