Quicker page edits on mediawiki: Difference between revisions

From Squirrel's Lair
(Created page with "{{TidBit| TidBit= I have some slower wikis on shared hosting where a page load can take >5s. If I can go straight to the edit mode of a page without first loading it in page view mode, I can save time. This is especially relevant when editing many pages at a time, such as during a cleanup of Mediawiki Extension RottenLinks. However it is done, the trick is to do the initial page load with a postfix to the URL of <code>&action=edit</code> (for regular edits) or <cod...")
 
mNo edit summary
Line 18: Line 18:
  // ==UserScript==
  // ==UserScript==
  // @name    wikimedia allEdit
  // @name    wikimedia allEdit
  // @include  https://wiki.umintmed.ca/*
  // @include  <URL of your wiki here>/*
// @include  https://ccmdb.kuality.ca/*
// @include  https://srg.kuality.ca/*
  // ==/UserScript==
  // ==/UserScript==
 
//https://ccmdb.kuality.ca/index.php?title=Team_Meeting_November_29,_2018&action=edit
//when I see <a href="/index.php?title=*"
//change it to <a href="/index.php?title=*&action=edit" title="edit *">[e]</a><a href /index.php?title=*"
  var links = document.getElementsByTagName('a');
  var links = document.getElementsByTagName('a');
  for(var i = 0; i < links.length; i=i+2) { // for each link  
  for(var i = 0; i < links.length; i=i+2) { // for each link  

Revision as of 23:18, 2021 December 11

I have some slower wikis on shared hosting where a page load can take >5s. If I can go straight to the edit mode of a page without first loading it in page view mode, I can save time. This is especially relevant when editing many pages at a time, such as during a cleanup of Mediawiki Extension RottenLinks. However it is done, the trick is to do the initial page load with a postfix to the URL of &action=edit (for regular edits) or &action=formedit for edits using Mediawiki Extension PageForms.

Option 1 - Add a Gesturefy Gesture open the page with the edit link

One way to do this would be to use browser extensions like Gesturefy to apply a postfix &action=edit to the URL.

Option 2 - Use a Greasemonkey script to add edit links

Another option is to use the following script in browser extension Greasemonkey to actually provide [e] edit links and [fe] form edit links (for Mediawiki Extension PageForms.

There is a bug in this script in that it only adds the links to ~ every second internal link of the wiki. I have not been able to figure out how to make it add it to every link. If you know the trick, please Contact us.

click expand to see full code   

// ==UserScript==

// @name     wikimedia allEdit
// @include  <URL of your wiki here>/*
// ==/UserScript==
 
var links = document.getElementsByTagName('a');
for(var i = 0; i < links.length; i=i+2) {											// for each link 
  var a = links[i];																						// put that link into a.
 																														// filter links for those where edit makes sense
 if((a.href.indexOf("/index.php?title=") > -1) 
    && (a.href.indexOf(encodeURIComponent("section")) == -1) 
    && (a.href.indexOf(encodeURIComponent("Main")) == -1) 
    && (a.href.indexOf(encodeURIComponent("Special")) == -1) 
    && (a.href.indexOf(encodeURIComponent("edit")) == -1) 
    && (a.href.indexOf(encodeURIComponent("info")) == -1) 
    && (a.href.indexOf(encodeURIComponent("history")) == -1) 
    && (a.href.indexOf(encodeURIComponent("delete")) == -1) 
    && (a.href.indexOf(encodeURIComponent("watch")) == -1) 
    && (a.href.indexOf(encodeURIComponent("unwatch")) == -1) 
    && (a.href.indexOf(encodeURIComponent("action=delete")) == -1) 
    && (a.href.indexOf(encodeURIComponent("images")) == -1) 
    && (a.href.indexOf(encodeURIComponent("oldid")) == -1) 
    && (a.href.indexOf(encodeURIComponent("printable")) == -1)) 
    {							// if it is a link inside this wiki
		
//    alert("href: " + a.href + " -- position of section: "); // + ();
//    var test = a.href.indexOf(encodeURIComponent("section"));
//    alert(a.href.indexOf(encodeURIComponent("section")) == -1);
   
   var editLink = document.createElement('a');							    // make a new element
    editLink.setAttribute("href", a.href + "&action=edit");	  // set it to href of element we are looking at
    editLink.appendChild(document.createTextNode(" [e]"));	// set the visible text to "edit
    a.appendChild(editLink); 																  // append the edit <a> element
   var editLink = document.createElement('a');							    // make a new element
    editLink.setAttribute("href", a.href + "&action=formedit");	  // set it to href of element we are looking at
    editLink.appendChild(document.createTextNode(" [fe]"));	// set the visible text to "edit
    a.appendChild(editLink); 																  // append the edit <a> element
 }
}

Option 3 - ContextSearch

See here for how to use ContextSearch to open a mediawiki page in edit mode.


  • Cargo:


  • Categories:
  • Default form