[WikiEN-l] Preformatted blank articles? (was Experiment on new pages and GFDL)

grm_wnr grmwnr at gmail.com
Mon Dec 12 01:58:53 UTC 2005


grm_wnr wrote:

> David Gerard wrote:
>
>> Anthony DiPierro wrote:
>>
>>  
>>
>>> I found out what preload is.  See
>>> http://en.wikipedia.org/w/index.php?title=Noarticlehere&action=edit&preload=User:Anthony_DiPierro/preload 
>>>
>>> So, in pseudocode (I don't know mediawiki), all that'd need to be done
>>> is change:
>>> return $text;
>>> to:
>>> if ($text!='') {
>>>  return $text;
>>> } else if (namespace is article namespace) {
>>>  return $newarticleboilerplate;
>>> } else {
>>>  return '';
>>> }
>>>   
>>
>>
>>
>> Fabulous! Preloading a blank article form should be not terribly
>> traumatic ... How hard would it be to make the preload an option that a
>> regular editor can switch off when it gets annoying? (Though I for one
>> would probably keep mine on.)
>>
>>
>> [cc to wikitech-l]
>>
>> - d.
>>  
>>
>
> If the developers need time for this, we could hack up a 
> [[MediaWiki:monobook.js]] patch in the meantime that checks if  a 
> <div> with the id "newarticletext" is present, and enters the article 
> template into the editbox if so. Of course, that would only work for 
> user with JavaScript-enabled browsers, but I guess the majority of 
> regular internet users use one (Yes, I'm going to get a lot of "Hey, 
> I'm using Lynx you insensitive clod!" replies to this). It would only 
> be a stopgap solution until a server-sided patch is ready anyway. I'm 
> going to give this a try in my user js now, just for kicks.
>
> grm_wnr 


function ArticleSkeletonPreload() {
  if (document.getElementById("wpTextbox1") && 
document.getElementById("newarticletext") && 
document.getElementById("ca-nstab-main") && !noarticleskeleton) {
    document.getElementById("wpTextbox1").value="A '''pagetitle''' is 
... (say what the article is about, with a bit of introductory 
detail)\n\n==More detail==\n\n(If there's more to say about it, put in 
sections with == == on the name of each section)\n\n==See 
also==\n\n==References==\n*List the sources you used in writing this 
article)\n*\n*\n\n==External links==\n* (List the few most relevant 
external web pages on the subject (home pages, etc) that you know 
of)\n\n[[Category:Newly created pages]]";
  }
}
noarticleskeleton = false;
addLoadEvent(ArticleSkeletonPreload);

That was simpler than I thought - the above works for me on Firefox, 
Opera and IE6. It only acts in the article namespace. Users can add 
"noarticleskeleton=true;" in their monobook.js to turn it off (that last 
part is not fully tested, since I'd have to put the script live on 
MediaWiki:monobook.js for that - I'm not bold enough to do this, but 
feel free to use it/abuse it/edit it mercilessly)

grm_wnr



More information about the WikiEN-l mailing list