MediaWiki talk:Common.js/Archive 4: Difference between revisions

Content deleted Content added
Fluxbot (talk | contribs)
 
(3 intermediate revisions by 3 users not shown)
Line 23:
== escape() and replace() in importScript function ==
 
I read this [[MediaWiki_talk:Common.js/Archive_2#Import_Module|December discussion about import module]] but I still don't see why <ttcode>escape()</ttcode> is there in the first place. Can you please give me an example when it's really needed? As far as I can see, it doesn't work for 2-byte Unicode characters anyway, so in [[:ru:MediaWiki:Common.js]] we had to remove it so far.
Same question for <ttcode>replace()</ttcode>: everything seems to work fine without it, even with spaces in the script path.
— [[User:Alex Smotrov|Alex Smotrov]] 20:48, 3 March 2007 (UTC)
 
Line 112:
== Placing the cursor after the section name ==
 
A long time ago, [[User_talk:Quarl/Archive_2006-02#User:Quarl.2Fauto_summary.js|Quarl and I discussed]]{{Broken anchor|date=2024-04-21|bot=User:Cewbot/log/20201008/configuration|target_link=User_talk:Quarl/Archive_2006-02#User:Quarl.2Fauto summary.js|reason= }} some user scripts and made a little snippet of code that, when you press ''tab'' to go to the Summary field, puts your cursor after the section name, so you can just start typing. It's a tremendously helpful little tweak, and now that I've removed Quarl's code from my monobook.js, I miss it. :-) It would be a good thing to implement site-wide, though. This was my version, though I think he improved on it in his Power Tools scripts:
 
<pre>
Line 161:
 
== Proposal: Edittools with Javascript ==
Replace all those <code><a … onlcick=InsertTags </code> lines now generated from [[MediaWiki:Edittools]] with javascript code inside <ttcode>MediaWiki:Editpage.js</ttcode>. Sample version of this code: [[User:Alex Smotrov/createEditTools]], see discussion page for instructions on how to test it. Advantages:
* ease of removing (not just hiding) unnecessary characters and adding your own
* Js code is about 10 times smaller
Line 167:
— [[User:Alex Smotrov|Alex Smotrov]] 20:47, 8 March 2007 (UTC)
:Great idea! I like the js, but I have one idea. Once we're doing this, why don't we have a drop-down menu like at [[:commons:]]? —<span style="color: red;">[[User:Mets501|M<small>ETS</small>501]] ([[User talk:Mets501|talk]])</span> 21:03, 8 March 2007 (UTC)
::Question: What happens for users with javascript disabled? [[User:Prodego|<fontspan colorstyle="color:darkgreen;">''Prodego''</fontspan>]] <sup>[[User talk:Prodego|<fontsup colorstyle="color:darkgreen;">talk</fontsup>]]</sup> 19:23, 18 March 2007 (UTC)
:::The edit tools don't appear. Since clicking on them relies on JavaScript anyways, this is not a problem. It's actually better than the current situation since right now the tools show up if you don't have JS enabled, but they don't actually work. [[User talk:Mike Dillon|Mike Dillon]] 19:44, 18 March 2007 (UTC)
<span id="63298081396" ></span>
Line 194:
<span id="63298702036" ></span>
== Proposal: Editpage.js ==
Create another «common» javascript file <ttcode>MediaWiki:Editpage.js</ttcode> and «call» it from [[MediaWiki:Common.js]] (already implemented e.g. in [[:pl:MediaWiki:Monobook.js]] and [[:ru:MediaWiki:Common.js]]: search for "<ttcode>Onlyifediting.js</ttcode>")
if (document.___URL.indexOf('action=edit') > 0 || document.___URL.indexOf('action=submit') > 0)
importScript('MediaWiki:Editpage.js');
Then move from [[MediaWiki:Common.js]] → <ttcode>MediaWiki:Editpage.js</ttcode>
* code «Extra toolbar options» (mwCustomEditButtons)
* code «fix edit summary prompt for undo»