Utente:Alex brollo/Caratteri unicode ricombinanti

Unicode: caratteri ricombinanti

modifica
  • regex per caratteri greci e spazi consecutivi : ([\u0370-\u3fff\u1f00-\u1fff ]{2,}) (sost. $1)
  • script da usare in console per visualizzare i codici unicode di una stringa:
function uniChar(s) {
    var t = "";
    var l = s.normalize("NFD").split('');
    var cp = "";
    for (i = 0; i < l.length; i += 1) {
        cp = l[i].codePointAt();
        t += "\\u" + ("0000" + cp.toString(16)).substr(-4);
    }
    return t;
}
Spirito,
ecc...
Accento \u Vocali Rho
Iota sottoscritto
α ε η ι ο υ ω ρ
Acuto ´ 0301 ά έ ή ί ό ύ ώ  
Grave ` 0300  
Circonflesso 0342      
Dolce ᾿ 0313
Acuto 0313 0301  
Grave 03b1 0301  
Circonflesso 0313 0342      
Aspro 0314
Acuto 0314 0301  
Grave 0314 0300  
Circonflesso 0314 0342      
Dieresi ¨ 0308 ϊ ϋ
Acuto ΅ 0308 0301 ΐ ΰ
Grave 0308 0300
Circonflesso 0308 0342
Macron ˉ 0304
Breve ˘ 0306
Iota ι 0345

Box vuoto

modifica
showDiacritici = function() {
		$('.diacritici-new-box').remove();
		$('#mw-content-text').prepend('<div class="box diacritici-new-box">' +
			'<div class="box-title">Diacritici ricombinanti</a>' +
			'<span class="icon-close"></span></div>' +
			'<div class="box-main diacritici-new-box-main"></div></div>');
		$('.diacritici-new-box-main').html("<p>Il C rosso cancella un diacritico nel carattere a sinistra del cursore. Gli altri aggiungono un diacritico al carattere a sinistra del cursore. </p>");
		$('.diacritici-new-box').draggable({
		    create: function( event, ui ) {
		        $(this).css({
		            right: "auto",
		            top: $(this).position().top,
		            left: $(this).position().left
		        });
		    }
		});
		$('.diacritici-new-box').draggable('option', 'cancel', '.diacritici-new-box-main');
		$('.diacritici-new-box .icon-close').click(function() {
			$('.diacritici-new-box').remove();
		});
	};

ë Ἀ ααα ᾶ ἆ ὶ̈ α α

canc ´ ` ¨ ˆ ¸ ¯ ˙ . ˘ ι

Funzioni

modifica
function addDia(x) {
  var t=sel();
  t[1][0]=t[1][0].normalize("NFD"); 
  t[1][0]=t[1][0]+=x; 
  t[1][0]=t[1][0].normalize("NFC"); 
  scriviSel(t[1]);
}
//rimozione di un diacritico a sinistra del cursore
function remDia() {
  var x="";
  var t=sel(); 
  t[1][0]=t[1][0].normalize("NFD").split(""); 
  x=t[1][0].pop(); 
  t[1][0]=t[1][0].join("").normalize("NFC");
  scriviSel(t[1]);
}

showDiacritici = function() {
		$('.diacritici-new-box').remove();
		$('#mw-content-text').prepend('<div class="box diacritici-new-box">' +
			'<div class="box-title">Diacritici ricombinanti</a>' +
			'<span class="icon-close"></span></div>' +
			'<div class="box-main diacritici-new-box-main">'+
			'</div></div>');
		$('.diacritici-new-box-main').html('<p>Il C rosso cancella un diacritico nel carattere a sinistra del cursore. Gli altri aggiungono un diacritico al carattere a sinistra del cursore. </p>');
		
		$(".diacritici-new-box-main").append('<img alt="spirito_dolce" id="spirito_dolce" src="//upload.wikimedia.org/wikipedia/commons/thumb/3/35/Greek_Psili_%28%CF%88%CE%B9%CE%BB%CE%AE%29.svg/20px-Greek_Psili_%28%CF%88%CE%B9%CE%BB%CE%AE%29.svg.png" width="20" height="24">')
$("#spirito_dolce").on("click", function() {addDia("\u0313");});

$(".diacritici-new-box-main").append('<img alt="spirito_aspro" id="spirito_aspro" src="//upload.wikimedia.org/wikipedia/commons/thumb/1/1b/Greek_Dasia_%28%CE%B4%CE%B1%CF%83%CE%B5%E1%BF%96%CE%B1%29.svg/20px-Greek_Dasia_%28%CE%B4%CE%B1%CF%83%CE%B5%E1%BF%96%CE%B1%29.svg.png" width="20" height="26">')
$("#spirito_aspro").on("click", function() {addDia("\u0314");});

$(".diacritici-new-box-main").append('<img alt="accento grave" id="accento_grave" src="//upload.wikimedia.org/wikipedia/commons/thumb/6/6b/Greek_Varia_%28%CE%B2%CE%B1%CF%81%CE%B5%E1%BF%96%CE%B1%29.svg/20px-Greek_Varia_%28%CE%B2%CE%B1%CF%81%CE%B5%E1%BF%96%CE%B1%29.svg.png" width="20" height="26">')
$("#accento_grave").on("click", function() {addDia("\u0300");});

$(".diacritici-new-box-main").append('<img alt="accento acuto" id="accento_acuto" src="//upload.wikimedia.org/wikipedia/commons/thumb/6/6a/Greek_Oxia_%28%E1%BD%80%CE%BE%CE%B5%E1%BF%96%CE%B1%29.svg/20px-Greek_Oxia_%28%E1%BD%80%CE%BE%CE%B5%E1%BF%96%CE%B1%29.svg.png" width="20" height="26">')
$("#accento_acuto").on("click", function() {addDia("\u0301");});

$(".diacritici-new-box-main").append('<img alt="iota sottoscritto" id="iota" src="//upload.wikimedia.org/wikipedia/commons/thumb/1/13/Greek_Ypogegrammeni_%28%E1%BD%91%CF%80%CE%BF%CE%B3%CE%B5%CE%B3%CF%81%CE%B1%CE%BC%CE%BC%CE%AD%CE%BD%CE%B7%29.svg/20px-Greek_Ypogegrammeni_%28%E1%BD%91%CF%80%CE%BF%CE%B3%CE%B5%CE%B3%CF%81%CE%B1%CE%BC%CE%BC%CE%AD%CE%BD%CE%B7%29.svg.png" width="20" height="26">')
$("#iota").on("click", function() {addDia("\u0345");});

$(".diacritici-new-box-main").append('<img alt="circonflesso" id="circonflesso" src="//upload.wikimedia.org/wikipedia/commons/thumb/2/25/Greek_Perispomeni_%28%CF%80%CE%B5%CF%81%CE%B9%CF%83%CF%80%CF%89%CE%BC%CE%AD%CE%BD%CE%B7%29.svg/20px-Greek_Perispomeni_%28%CF%80%CE%B5%CF%81%CE%B9%CF%83%CF%80%CF%89%CE%BC%CE%AD%CE%BD%CE%B7%29.svg.png" width="20" height="24">')
$("#circonflesso").on("click", function() {addDia("\u0342");});

$(".diacritici-new-box-main").append('<img alt="dieresi" id="dieresi" src="//upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Diaeresis_%28%CE%B4%CE%B9%CE%B1%CE%AF%CF%81%CE%B5%CF%83%CE%B9%CF%82%29.svg/20px-Diaeresis_%28%CE%B4%CE%B9%CE%B1%CE%AF%CF%81%CE%B5%CF%83%CE%B9%CF%82%29.svg.png" width="20" height="24">')
$("#dieresi").on("click", function() {addDia("\u0308");});

$(".diacritici-new-box-main").append('<img alt="breve" id="breve" src="//upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Greek_Vrachy_%28%CE%B2%CF%81%CE%B1%CF%87%CF%8D%29.svg/20px-Greek_Vrachy_%28%CE%B2%CF%81%CE%B1%CF%87%CF%8D%29.svg.png" width="20" height="26">')
$("#breve").on("click", function() {addDia("\u0306");});

$(".diacritici-new-box-main").append('<img alt="macron" id="macron" src="//upload.wikimedia.org/wikipedia/commons/thumb/1/18/%CE%9C%CE%B1%CE%BA%CF%81%CE%AC.svg/20px-%CE%9C%CE%B1%CE%BA%CF%81%CE%AC.svg.png" width="20" height="24">')
$("#macron").on("click", function() {addDia("\u0304");});

$(".diacritici-new-box-main").append('<span id="remDia" style="color:red;"> Canc</span>')
$("#remDia").on("click", function() {remDia();});

		
		$('.diacritici-new-box').draggable({
		    create: function( event, ui ) {
		        $(this).css({
		            right: "auto",
		            top: $(this).position().top,
		            left: $(this).position().left
		        });
		    }
		});
		$('.diacritici-new-box').draggable('option', 'cancel', '.diacritici-new-box-main');
		$('.diacritici-new-box .icon-close').click(function() {
			$('.diacritici-new-box').remove();
		});
	};

Immagini

modifica

Immagini elementari

modifica