Skip to content

Instantly share code, notes, and snippets.

@nuadaria
Created March 31, 2022 23:52
Show Gist options
  • Save nuadaria/942b1d46b78c5f7ccf663219a5445eb4 to your computer and use it in GitHub Desktop.
Save nuadaria/942b1d46b78c5f7ccf663219a5445eb4 to your computer and use it in GitHub Desktop.
Edit This Page Button
if(document.getElementsByClassName('wiki-edit').length < 1){
var siblingDiv = document.getElementsByClassName('wiki-page-container');
var div = document.createElement('div');
div.innerHTML = '<div class="wiki-edit"><a class="button" href="'+window.location.href+'/edit">Edit This Page</a></div>';
siblingDiv[0].parentNode.insertBefore(div, siblingDiv.nextSibling);
}
@nuadaria
Copy link
Author

Adds a button similar to the one on the Home Page for direct editing of the page. Selectors can be updated to allow for different application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment