Diferencia entre revisiones de «MediaWiki:Gadget-Biblia.js»

De EIFA - Estudios Interdisciplinares de las Fuentes Avilistas
Etiqueta: Revertido
(Se ha deshecho la revisión 669 de Juancc (disc.))
Etiqueta: Deshacer
Línea 1: Línea 1:
var dato1 = 0;
var dato1 = 0;
console.log('1: '+dato1);


ve.ui.BibliaCommand = function VeUiBibliaCommand() {
ve.ui.BibliaCommand = function VeUiBibliaCommand() {
ve.ui.BibliaCommand.super.call( this, 'Biblia' );
ve.ui.BibliaCommand.super.call( this, 'Biblia' );
console.log('2: '+dato1);
};
};
console.log('3: '+dato1);
OO.inheritClass( ve.ui.BibliaCommand, ve.ui.Command );
OO.inheritClass( ve.ui.BibliaCommand, ve.ui.Command );
console.log('4: '+dato1);


ve.ui.BibliaCommand.prototype.execute = function ( surface ) {
ve.ui.BibliaCommand.prototype.execute = function ( surface ) {
console.log('5: '+dato1);
var model = surface.getModel(),
var model = surface.getModel(),
doc = model.getDocument(),
doc = model.getDocument(),
range = model.getSelection().getRange(),
range = model.getSelection().getRange(),
docRange = doc.shallowCloneFromRange( range );
docRange = doc.shallowCloneFromRange( range );
console.log('6: '+dato1);
 
alert (dato1);
dato1 = 112;
alert (dato1);


ve.init.target.getWikitextFragment( docRange, false ).done( function ( wikitext ) {
ve.init.target.getWikitextFragment( docRange, false ).done( function ( wikitext ) {
console.log('7: '+dato1);
htmlfrag = model.getFragment().insertHtml('<bible>'+wikitext+'</bible>');
htmlfrag = model.getFragment().insertHtml('<bible>'+wikitext+'</bible>');
dato1 = htmlfrag.selection.range.from;
dato1 = htmlfrag.selection.range.from;
console.log('8: '+dato1);
} );
} );
};
};
console.log('9: '+dato1);
 




ve.ui.commandRegistry.register( new ve.ui.BibliaCommand() );
ve.ui.commandRegistry.register( new ve.ui.BibliaCommand() );
console.log('10: '+dato1);


ve.ui.BibliaTool = function VeUiBibliaTool() {
ve.ui.BibliaTool = function VeUiBibliaTool() {
ve.ui.BibliaTool.super.apply( this, arguments );
ve.ui.BibliaTool.super.apply( this, arguments );
console.log('11: '+dato1);
};
};
OO.inheritClass( ve.ui.BibliaTool, ve.ui.Tool );
OO.inheritClass( ve.ui.BibliaTool, ve.ui.Tool );
Línea 42: Línea 36:
ve.ui.BibliaTool.static.commandName = 'Biblia';
ve.ui.BibliaTool.static.commandName = 'Biblia';
ve.ui.toolFactory.register( ve.ui.BibliaTool );
ve.ui.toolFactory.register( ve.ui.BibliaTool );
console.log('12: '+dato1);

Revisión del 21:01 3 ene 2023

var dato1 = 0;

ve.ui.BibliaCommand = function VeUiBibliaCommand() {
	ve.ui.BibliaCommand.super.call(	this, 'Biblia' );
};
OO.inheritClass( ve.ui.BibliaCommand, ve.ui.Command );

ve.ui.BibliaCommand.prototype.execute = function ( surface ) {
	var model = surface.getModel(),
		doc = model.getDocument(),
		range = model.getSelection().getRange(),
		docRange = doc.shallowCloneFromRange( range );

		alert (dato1);
		dato1 = 112;
		alert (dato1);

	ve.init.target.getWikitextFragment( docRange, false ).done( function ( wikitext ) {
		htmlfrag = model.getFragment().insertHtml('<bible>'+wikitext+'</bible>');
		dato1 = htmlfrag.selection.range.from;
	} );
};



ve.ui.commandRegistry.register( new ve.ui.BibliaCommand() );

ve.ui.BibliaTool = function VeUiBibliaTool() {
	ve.ui.BibliaTool.super.apply( this, arguments );
};
OO.inheritClass( ve.ui.BibliaTool, ve.ui.Tool );
ve.ui.BibliaTool.static.name = 'Biblia';
ve.ui.BibliaTool.static.group = 'cite';
ve.ui.BibliaTool.static.icon = 'book';
ve.ui.BibliaTool.static.title = 'Biblia';
ve.ui.BibliaTool.static.commandName = 'Biblia';
ve.ui.toolFactory.register( ve.ui.BibliaTool );