Wikisource:Domande tecniche/Archivio/2015: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m →‎TemplateScript 2.0: link github repo
→‎TemplateScript 2.0: re: released!
Riga 2 457:
 
Since you're planning to use TemplateScript heavily on this wiki, here's your chance to provide feedback for the next version. Feel free to comment here or [https://github.com/Pathoschild/Wikimedia-contrib/milestones/TemplateScript%202.0 in the GitHub repository]. :) <small>—[[User:Pathoschild|Pathoschild]] ([[User talk:Pathoschild|disc.]]) 07:01, 23 ago 2015 (CEST)</small>
 
: TemplateScript 2.0 is released! This replaces the <code>context</code> argument for custom scripts with a more powerful <code>editor</code>. Some of the improvements:
:* You can use new helpers like <code>editor.get()</code> to get the text, <code>editor.set(text)</code> to change the text, <code>editor.prepend(text)</code> and <code>editor.append(text)</code> to insert text, and <code>editor.options({ minor: true, watch: true })</code> to set form options. These methods are all compatible with the normal wiki editor and the [[mw:Extension:CodeEditor|CodeEditor]].
:* You can now use helpers on custom textboxes. For example, when editing in the <tt>Page</tt> namespace this will add something to the header: <source lang="javascript">editor.for('#wpHeaderTextbox').prepend('{{RigaIntestazione|}}');</source>
:* You can now specify namespaces by name: <source lang="javascript">pathoschild.TemplateScript.add({ name: 'clean up OCR', script: ..., forNamespaces: 'discussioni utente' })</source>
:* You no longer need to specify <code>forActions: 'edit'</code>; that's the default value now.
:* You can [[m:TemplateScript#Translation|translate TemplateScript]]!
: See [[m:TemplateScript]] for the updated documentation. <small>—[[User:Pathoschild|Pathoschild]] ([[User talk:Pathoschild|disc.]]) 02:31, 30 ago 2015 (CEST)</small>