Jump to content

Quicker page edits on mediawiki: Difference between revisions

From Squirrel's Lair
Ttenbergen (talk | contribs)
No edit summary
Ttenbergen (talk | contribs)
m Ttenbergen moved page Internal:Quicker page edits on mediawiki to Quicker page edits on mediawiki without leaving a redirect
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{TidBit
{{TidBit
|shortDescription=Quicker page edits on mediawiki
|shortDescription=Quicker page edits on mediawiki
|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, this can save time. This is especially relevant when editing many pages at a time, such as during a cleanup of [[Mediawiki Extension RottenLinks]].  
|skillSet=Mediawiki; Python
|featured=Yes
}}
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, this 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  <code>&action=formedit</code> for edits using [[Mediawiki Extension PageForms]].
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  <code>&action=formedit</code> for edits using [[Mediawiki Extension PageForms]].


Line 65: Line 68:
== Option 5 ==
== Option 5 ==
Use the [https://www.mediawiki.org/wiki/Manual:Pywikibot Pywikibot] Python library to interact with mediawiki programmatically.
Use the [https://www.mediawiki.org/wiki/Manual:Pywikibot Pywikibot] Python library to interact with mediawiki programmatically.
|skillSet=Mediawiki; Python
|featured=Yes
}}

Latest revision as of 16:22, 2022 January 12


  • Cargo:


  • Categories:
  • Default form


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, this 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.

Option 4 - AutoWikiBrowser

Use AutoWikiBrowser to get a set of pages to pre-load and do fully automated or facilitated edits on them.

Option 5

Use the Pywikibot Python library to interact with mediawiki programmatically.