Diferenças entre edições de "Utilizador:Bawolff/common.js"

Origem: Wikilivros, livros abertos por um mundo aberto.
Ir para: navegação, pesquisa
 
Linha 1: Linha 1:
 
if (!window.console) window.console = { log: jsMsg }
 
if (!window.console) window.console = { log: jsMsg }
   
function addButton() {
+
function addButton2() {
 
console.log('The code inside of addButton() was executed.');
 
console.log('The code inside of addButton() was executed.');
 
}
 
}
Linha 8: Linha 8:
 
mw.loader.using( 'ext.wikiEditor.toolbar', function () {
 
mw.loader.using( 'ext.wikiEditor.toolbar', function () {
 
console.log('"$( addButton )" was executed inside of mw.loader.using( \'ext.wikiEditor.toolbar\'...');
 
console.log('"$( addButton )" was executed inside of mw.loader.using( \'ext.wikiEditor.toolbar\'...');
console.log( "addButton: " + addButton.toString() );
+
$( addButton2 );
$( addButton );
 
 
} );
 
} );
 
}
 
}
   
 
if( mw.config.get( 'wgAction' ) === 'edit' ) {
 
if( mw.config.get( 'wgAction' ) === 'edit' ) {
console.log( "mw.util.wikiScript('api')=" + mw.util.wikiScript('api') );
 
 
$.getJSON(
 
$.getJSON(
 
mw.util.wikiScript('api'),
 
mw.util.wikiScript('api'),
 
'format=json&action=query&prop=revisions&rvprop=content&rvlimit=1&indexpageids=1&titles=Teste',
 
'format=json&action=query&prop=revisions&rvprop=content&rvlimit=1&indexpageids=1&titles=Teste',
 
function ( data ) {
 
function ( data ) {
console.log( 'Data to process: ' + data.query.pages[ data.query.pageids[0] ].revisions[0]['*'] );
 
 
processText( data.query.pages[ data.query.pageids[0] ].revisions[0]['*'] );
 
processText( data.query.pages[ data.query.pageids[0] ].revisions[0]['*'] );
 
}
 
}

Edição atual desde as 03h25min de 17 de março de 2012

if (!window.console) window.console = { log: jsMsg }
 
function addButton2() {
	console.log('The code inside of addButton() was executed.');
}
 
function processText( text ) {
	mw.loader.using( 'ext.wikiEditor.toolbar', function () {
		console.log('"$( addButton )" was executed inside of mw.loader.using( \'ext.wikiEditor.toolbar\'...');
		$( addButton2 );
	} );
}
 
if( mw.config.get( 'wgAction' ) === 'edit' ) {
	$.getJSON(
		mw.util.wikiScript('api'),
		'format=json&action=query&prop=revisions&rvprop=content&rvlimit=1&indexpageids=1&titles=Teste',
		function ( data ) {
			processText( data.query.pages[ data.query.pageids[0] ].revisions[0]['*'] );
		}
	);
}