Wiktionary:Grease pit: difference between revisions

Jump to: navigation, search
m (MediaWiki:Edittools: Q)
(MediaWiki:Edittools)
Line 1,295: Line 1,295:
   
 
: In Mediawiki:Monobook.js, you'll find it sets a cookie ("edittoolscharsubset") when you choose one. (in "chooseCharSubset") So it persists. Should be easy to copy. [[User:Robert Ullmann|Robert Ullmann]] 05:11, 18 July 2009 (UTC)
 
: In Mediawiki:Monobook.js, you'll find it sets a cookie ("edittoolscharsubset") when you choose one. (in "chooseCharSubset") So it persists. Should be easy to copy. [[User:Robert Ullmann|Robert Ullmann]] 05:11, 18 July 2009 (UTC)
  +
 
::Is there something to add to my monobook.js (or elsewhere) to make it follow the user rather than the browser?<span style="text-decoration: none;"><span class="Unicode">&#x200b;—</span></span>[[User:Msh210|msh210]]<span style="text-decoration: none;"><span class="Unicode">℠</span></span> 21:00, 19 July 2009 (UTC)
 
::Is there something to add to my monobook.js (or elsewhere) to make it follow the user rather than the browser?<span style="text-decoration: none;"><span class="Unicode">&#x200b;—</span></span>[[User:Msh210|msh210]]<span style="text-decoration: none;"><span class="Unicode">℠</span></span> 21:00, 19 July 2009 (UTC)
  +
  +
::: Yes, but no very smooth way, since you probably wouldn't want to remove the ability to set it to something different on a given computer. (For example, if you switched it to "Arabic" to edit a certain page, you probably wouldn't want it to switch back the instant you hit the "Show preview" button.) The best/simplest approach I can think of is something like this: <pre>var edittoolscharsubset_value = parseInt(getCookie('edittoolscharsubset'));&#xA;if(edittoolscharsubset_value == 0 || isNan(edittoolscharsubset_value))&#xA; setCookie('edittoolscharsubset', '22');</pre> in the case of "Hebrew". (That checks if the <tt>edittoolscharsubset</tt> cookie exists and is nonzero — <tt>0</tt> being the index of "Templates", which is set by default — and if not, it sets it to <tt>22</tt>, which is the index of Hebrew.) The main problem is, every time the index of Hebrew changed, you'd have to edit [[Special:Mypage/monobook.js]] to match. And the "Templates" value would never stick. (Really, I think it's kind of a mistake that we set the cookie to <tt>0</tt> by default — we should leave it blank by default, and just treat blank the same as <tt>0</tt> — but I suppose it doesn't matter much for most purposes.)
  +
::: That said, I use a completely different approach, which you might want to try; [[User:Ruakh/monobook.js]] has a bit of code that basically copies the "Misc.", "Hebrew", "Latin/Roman", "IPA", and "enPR" sections up into non-collapsed &lt;p&gt;s. (The relevant code is the <tt>findEdittoolsSection</tt> function, and the <tt>addOnloadHook</tt> block underneath it. It should be obvious how to customize it for whichever sections you want to copy up.)
  +
::: —[[User: Ruakh |Ruakh]]<sub ><small ><i >[[User talk: Ruakh |TALK]]</i ></small ></sub > 03:48, 20 July 2009 (UTC)