MediaWiki talk:Edittools

From Wikipedia, the free encyclopedia
Jump to: navigation, search


Protected edit request on 4 March 2014[edit]

Could someone make this update to MediaWiki:Gadget-charinsert.js to remove a hack from 2010? Helder.wiki 13:24, 4 March 2014 (UTC)

Or even better, since the script uses textSelection, just add the module "jquery.textSelection" to the list of dependencies of the gadget on its definition:
* charinsert[ResourceLoader|default|dependencies=jquery.textSelection]|charinsert.js|charinsert.css
and then we can remove a few more bytes of code with thisthis. Helder.wiki 14:39, 4 March 2014 (UTC)
One definitive solution at a time please. Edokter (talk) — 14:56, 4 March 2014 (UTC)
Consider only the second request then. Helder.wiki 18:34, 4 March 2014 (UTC)
Something not right here... return; is always called. Please check your code again. Edokter (talk) — 11:11, 5 March 2014 (UTC)
Right! I forgot to remove that "return". Here is the fixed version, Edokter. Helder.wiki 13:34, 5 March 2014 (UTC)
Yes check.svg Done. Edokter (talk) — 13:43, 5 March 2014 (UTC)
Helder.wiki Something broke; everything is inserted twice. Edokter (talk) — 17:11, 5 March 2014 (UTC)
Pinging TheDJ, Krinkle and Technical 13 as well. Edokter (talk) — 17:24, 5 March 2014 (UTC)
It seems the first one is inserted by
            $( txtarea ).textSelection(
                'encapsulateSelection',
                { 'pre': tagOpen, 'peri': sampleText, 'post': tagClose }
            );
and the other one by
                txtarea.value = txtarea.value.substring( 0, startPos ) + tagOpen + selText
                    + tagClose + txtarea.value.substring( endPos );
So, I believe it is because we removed the "return" which existed before. For now, you can revert this change. Helder.wiki 17:42, 5 March 2014 (UTC)
Edokter, the splitted gadget is working fine on test wiki after reverting just this ^. Helder.wiki 17:45, 5 March 2014 (UTC)
Reverted (partial). Works in debug mode, cache needs to catch up. Edokter (talk) — 17:52, 5 March 2014 (UTC)
OK, I'm never doing this again until I see fully working code on test.wiki. Please don't place edit requests until your code is tested. Edokter (talk) — 17:59, 5 March 2014 (UTC)

Edokter, TheDJ, Technical 13, Ori.livneh and others watching this page, could you test the current of the gadget which is configured on test.wikipedia.org? I removed the custom functions which are duplicating functionality already provided by MediaWiki (-5,401 bytes!), added a missing dependency (mediawiki.action.edit), and worked fine in my first tests. Indeed, it even works in a case where enwiki's code fails: try it in a custom field created with <inputbox> on English Wikipedia and then on testwiki. Helder.wiki 22:18, 5 March 2014 (UTC)

Seems to work. Why does it depend on mediawiki.action.edit? Also, There is really no need for type checking here. Edokter (talk) — 22:40, 5 March 2014 (UTC)
Edokter, mw.toolbar.insertTags and the old window.insertTags are defined in that module. About the type, I was just trying to reduce the number of warnings on jsHint (maybe there is a config to ignore this). Helder.wiki 23:17, 5 March 2014 (UTC)
I've updated the code. Edokter (talk) — 22:10, 7 March 2014 (UTC)

Recent CharInsert changes breaks certain customizations[edit]

Edokter Hi there - long time fan but mostly try to keep Wikisource up to date with your latest WP changes/advances...

Long story short - with the changes to CharInsert over the past 2 or 3 days, certain custom templates added via my common.js that also happen to be set to "hidden" using the Entries prefixed with ␥ (U+2425 SYMBOL FOR DELETE FORM TWO) will not appear in the article namespace (namespace 0) "trick" no longer insert properly nor are reflected correctly in the toolbar. They still "hide" from display in the mainspace as always. Any idea how to restore the previous behavior? -- George Orwell III (talk) 01:09, 8 March 2014 (UTC)

George Orwell III, I don't understand what is the problem. Could you provide a small example of what happens now and what was happening before? Helder.wiki 14:33, 8 March 2014 (UTC)
well a custom set of ...
{\{hws|+|}}  ␥{\{hwe|+|}}  ␥<section.begin="+"_/>  ␥<section.end="+"_/>
... when applied, produces...
 {{hws|+}}  {{hwe|+}}  <section.begin="+ />  <section.end="+ />
... when it should have produced...
 {{hws||}}  {{hwe||}}  <section_begin="" />  <section_end="" />
Note in the 2nd example the plus symbol(s) should have been dropped all round and the lack of a 2nd piped parameter (first 2 templates) or closing quote (last 2 tags) when applied in the textarea field under edit mode (non ns-0).

To repoduce, just copy my common.js onto the test site and try inserting any of the 4 templates prefixed with ␥ (U+2425 SYMBOL FOR DELETE FORM TWO) in any namespace other than the main. -- George Orwell III (talk) 21:42, 8 March 2014 (UTC)

George Orwell III, I created two gadgets on testwiki:Special:Preferences#mw-prefsection-gadgets: <gadget-charinsert-old> with the old code and <gadget-charinsert> with the current code. Both have the same behavior in the test case you provided. Helder.wiki 17:41, 10 March 2014 (UTC)
Helder.wiki, Confirmed over on Wikisource - this past week's changes do not induce the behavior so it is quite possible I missed the "change" that caused this oddity altogether. Sorry for pointing fingers prematurely.

Nevertheless, I'm sure this was not always the case - it did "work" as desired at some point in time. I've removed the prefix-character from templates for now, though I'm not savy enough to troubleshoot the issue any further.

One other question (and forgive me if this is obvious to experts) but why does Gadget-charinsert-core.js need the additional dependency of mediawiki.action.edit under the revised gadget? Wasn't the whole point of creating the "loader" enough to insure that? (or shouldn't mediawiki.action.edit be a dependent when loading Gadget-charinsert.js rather than Gadget-charinsert-core.js if anything?)

p.s. - if you ever get bored, we sure could use your skills to review/improve en.wikisource's .js/.css/gadget "scheme". I have always admired Wikibooks approach to all that compared to what we got stuck with but my skill set is way below what is needed to make those kind of tweaks/improvements/overhauls and, thanks to that, voicing those long needed changes to the "community" largely falls on deaf ears.

Thanks for your time either way. Prost. -- George Orwell III (talk) 03:56, 12 March 2014 (UTC)

I can answer that. The -core gadget needs mediawiki.action.edit because it uses one or more funtions in that module. The loader is there for one thing only; to load the -core only when an edit page is loaded. This saves loading a lot of javascript when it is not needed. Edokter (talk) — 11:28, 12 March 2014 (UTC)

adjustment[edit]

Under Latin, could we have both Ə ə and Ǝ ǝ? (Make sure that the lower-case letters are matched correctly!) They're used in different alphabets.

Under Arabic, "transcription" should really be "transliteration".

kwami (talk) 20:12, 22 April 2014 (UTC)

Yes check.svg Done @Kwamikagami: Is this what you meant? let me know if they need to be in a different order or anything. — Mr. Stradivarius ♪ talk ♪ 10:17, 23 April 2014 (UTC)
Perfect. (Maybe the opposite order, so the caps go from more similar to less similar, but that's not important.) — kwami (talk) 17:32, 23 April 2014 (UTC)
I've switched the order around. — Mr. Stradivarius ♪ talk ♪ 12:59, 24 April 2014 (UTC)
Also, Arabic doesn't seem to be maintained here. Sorry, I'm not sure which message is the one that needs editing. — Mr. Stradivarius ♪ talk ♪ 10:19, 23 April 2014 (UTC)
Odd. It used to be. But the labels aren't important. — kwami (talk) 17:32, 23 April 2014 (UTC)
@Mr. Stradivarius: You edited MediaWiki:Edittools which is the old-style cut&paste, for browsers without javascript. The clickable insertions are handled in MediaWiki:Gadget-charinsert-core.js, which is pulled in by MediaWiki:Edittools.js as described in the box at the top of this page. --Redrose64 (talk) 12:54, 24 April 2014 (UTC)
Ah yes, found it - thanks for that. I've updated the JavaScript version as well. — Mr. Stradivarius ♪ talk ♪ 13:09, 24 April 2014 (UTC)

Individual customization?[edit]

Is it possible for an editor to customize this for individual use without replicating all the .js files? Alternatively, would it be possible to get a combined <code><nowiki></nowiki></code> option in the list of tools? I find I use this combination quite frequently; since the tool doesn't maintain focus on the selected text once it is wrapped, I have to re-select the desired text to apply the second wrap.

Also, just a quibble, but is there a way to wrap pairs in the tools so that they don't split across lines? Currently, in my browser, there is a line break between <s> and </s>. Thanks for any assistance you could provide!—D'Ranged 1 VTalk 01:47, 30 June 2014 (UTC)