Page MenuHomePhabricator

[CharInsert] Use event binding from a module instead of inline javascript
Closed, ResolvedPublic

Description

Author: jisok2

Description:
Editing in non-javascript environment, I copy&paste characters in [[MediaWiki:Edittools]]. But because of the mouse links, it's somewhat tricky to drag the wanted character. I want the links activated only when javascript is enabled.


Version: unspecified
Severity: enhancement

Details

Reference
bz9424

Event Timeline

bzimport raised the priority of this task from to Low.
bzimport set Reference to bz9424.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Mar 27 2007, 1:13 PM

Any stuff requiring JavaScript should not be in Edittools. Only JS independent texts and placeholders which are to be filled/manipulated by scripts in Common.js or other linked js pages.

ayg wrote:

Yes, the Charinsert extension should just output a plain character wrapped in a span with class="mw-charinsert" that the JavaScript can add a link to if enabled.

Tgr added a comment.Feb 27 2009, 11:44 AM

The script should be able to differentiate between <charinsert>A+B</charinsert> (inserts "A" to the beginning and "B" to the end of the selection) and <charinsert>A<nowiki>+</nowiki>B</charinsert> (inserts "A+B").

Per comment #2, it seems adequated to tag this as "easy".

If any scripts or styles remain, port to ResourceLoader as well.

Actually the links by core EditTools do use JavaScript and it looks genuine too.

In the current state (SVN HEAD:112664) extensions/CharInsert/CharInsert.php outputs:
<a onclick="insertTags( .. );"> .. </a>

Which calls the core mw.toolbar.insertTags function. So it does work by default (insertion in toolbar). And that pretty much justifies the use of links, right ?

Granted it could be nicer and prettier but the assumption made here that it requires site-specific javascript code to work is not true. Marking WONTFIX as such.

Well, the deal was to remove onclick=... stuff in favour of jQuery general global handling.

Thus reopening.

OK, maybe that should be a separate request then. Re-summarizing for now (removing javascript on itself makes no sense as a goal unless it's redundant or broken).

He7d3r added a comment.Aug 6 2014, 4:37 PM

Change 152076 had a related patch set uploaded by Helder:
Use event binding from a module instead of inline javascript

https://gerrit.wikimedia.org/r/152076

Change 152076 had a related patch set uploaded by TheDJ:
Use event binding from a module instead of inline javascript

https://gerrit.wikimedia.org/r/152076

matmarex set Security to None.
matmarex removed a subscriber: wikibugs-l-list.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 27 2015, 9:47 PM

Change 288922 had a related patch set uploaded (by Brian Wolff):
[DO NOT MERGE] Remove inline event handler js from charinsert

https://gerrit.wikimedia.org/r/288922

Legoktm added a subscriber: Legoktm.

@Bawolff can you write something up for tech news and/or wikitech-ambassadors?

Change 288922 merged by jenkins-bot:
Remove inline event handler js from charinsert

https://gerrit.wikimedia.org/r/288922

matmarex closed this task as Resolved.May 27 2016, 12:08 PM
matmarex assigned this task to Bawolff.
Tacsipacsi updated the task description. (Show Details)May 30 2016, 4:52 PM