User:Atundo/prova.js

mw.hook( 've.activationComplete' ).add( function {	console.warn("Funziona");	//var domText = ve.ce.DocumentNode.getElementDocument;	var service_url = 'https://babelfy.io/v1/disambiguate';	var text = "boh";   console.warn(ve.init.target.getSurface.getModel.documentModel.documentNode.doc.htmlDocument.body);    var lang = 'EN'    var key = 'f36e3d72-f770-4398-b861-bd5ea7ca7d53'

var params = { 'text'  : text, 'lang' : lang, 'key' : key };

$.getJSON(service_url + "?", params, function(response) {

$.each(response, function(key, val) {

// retrieving token fragment var tokenFragment = val['tokenFragment']; var tfStart = tokenFragment['start']; var tfEnd = tokenFragment['end'];

var tfragment = "Start token fragment: " + tfStart + " " + "End token fragment: " + tfEnd; console.warn(tfragment); //$(' ', {html:tfragment}).appendTo(document.body);

// retrieving char fragment var charFragment = val['charFragment']; var cfStart = charFragment['start']; var cfEnd = charFragment['end'];

var cfragment = "Start char fragment: " + cfStart + " " + "End char fragment: " + cfEnd; console.warn(cfragment); //$(' ', {html:cfragment}).appendTo(document.body);

// retrieving BabelSynset ID           var synsetId = val['babelSynsetID']; var id = "BabelNet Synset id: " + synsetId; console.warn(id); //$(' ', {html:id}).appendTo(document.body);

});

}); } );