MediaWiki talk:SpecialChars.js

From Wikisource
Latest comment: 7 years ago by Seudo in topic Problem with apostroph and ellipsis
Jump to navigation Jump to search

New character shortcut[edit]

Could lowercase e-acute (é) be added? Samwilson (talk) 23:30, 11 December 2014 (UTC)Reply

added as 'e --> é — Phe 04:10, 12 December 2014 (UTC
Hi Samwilson and Phe. Good idea but very bad idea :( In french, it's not unusual to have ' before an e. Couldn't an other character be used ? maybe /e ? Cdlt, VIGNERON (talk) 13:57, 11 April 2015 (UTC)Reply

Diereses would be handy (:e-->ë etc.?) Cheers Zoë --Zoeannl (talk) 13:28, 1 June 2015 (UTC)Reply

Problem with apostroph and ellipsis[edit]

On my computer, replacement works for letter combinations (^ae => æ, etc.), but not for apostrophes (') and ellipsis (...). The problem is that single quotes (') and dots (.) do not match the following keycode test on my Windows computer (maybe they do match on other computers which use different key codes):

 var key = (window.event) ? event.keyCode : e.keyCode;
 (...)
 if( endPos==startPos && ( (key>=65 && key<=90) || key==222 || key==190) ) {

I believe the problem is that e.keyCode returns the key code, not the character code. For example, when I type a single quote, the value of e.keyCode is 52 because the single quote shares the same key as the 4 digit (which ASCII value is 52) on a French keyboard.

A solution might be to use e.char, which returns the character value (cf. [1]). But I cannot modify this page. Seudo (talk) 22:19, 5 September 2016 (UTC)Reply

After doing some tests in my common.js, the following should work (test character codes, not key codes):

      var key = (window.event) ? event.key : e.key;
      var charCode = key.charCodeAt(0);
      startPos = tb.selectionStart;
      endPos = tb.selectionEnd;
      if( endPos==startPos && ( (charCode>=65 && charCode<=90) || (charCode>=97 && charCode<=122) || charCode==39 || charCode==46) ) {
 (etc.)

Seudo (talk) 08:10, 6 September 2016 (UTC)Reply

could you please add m-tilde[edit]

that would be :

case "~m" : m = "m̃"; break;