MediaWiki:Gadget-wikibugs.js/Core.js e Ajuda:Página de testes/1: diferenças entre as páginas
(Diferenças entre páginas)
Conteúdo apagado Conteúdo adicionado
m Correção do MediaWiki:Wikibugs.js: a função .error() do objeto jqXHR não existe na versão 1.4.2 do jQuery. |
|||
Linha 26: | Linha 26: | ||
'wikibugs-signature-label': 'Assinatura:', |
'wikibugs-signature-label': 'Assinatura:', |
||
'wikibugs-edit-error': 'Ocorreu um erro ao enviar a notificação. Por favor, tente novamente.', |
'wikibugs-edit-error': 'Ocorreu um erro ao enviar a notificação. Por favor, tente novamente.', |
||
'wikibugs-token-error': 'Ocorreu um erro ao solicitar um token por meio da API do MediaWiki: $1. $2.', |
|||
'wikibugs-unknown-token-error': 'Ocorreu um erro desconhecido ao solicitar um token por meio da API do MediaWiki.', |
|||
'wikibugs-ajax-error': 'Houve um erro ao usar AJAX.', |
|||
'wikibugs-incomplete-information': 'Descreva detalhadamente qual é o erro. Não coloque informações incompletas.', |
'wikibugs-incomplete-information': 'Descreva detalhadamente qual é o erro. Não coloque informações incompletas.', |
||
'wikibugs-invalid-page': 'Informe um nome válido para a página.', |
'wikibugs-invalid-page': 'Informe um nome válido para a página.', |
||
Linha 62: | Linha 65: | ||
'Condições_de_Uso" target="_blank">termos de uso</a> e a <a href="' + |
'Condições_de_Uso" target="_blank">termos de uso</a> e a <a href="' + |
||
'http://wikimediafoundation.org/wiki/Política_de_privacidade"' + |
'http://wikimediafoundation.org/wiki/Política_de_privacidade"' + |
||
' target="_blank">política de privacidade</a> da Wikipédia.</p>' |
' target="_blank">política de privacidade</a> da Wikipédia.</p>', |
||
'wikibugs-new-report': 'Nova notificação: $1' |
|||
}); |
}); |
||
var wikiBugsGadget = { |
var wikiBugsGadget = { |
||
Linha 402: | Linha 406: | ||
} |
} |
||
} |
} |
||
function |
function doEditPage( token /*, starttimestamp*/ ) { |
||
$.ajax({ |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
data: { |
|||
format: 'json', |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
action: 'edit', |
action: 'edit', |
||
title: that.reportPage, |
title: that.reportPage, |
||
text: newText, |
text: newText, |
||
minor: false, |
minor: false, |
||
summary: |
summary: mw.msg( 'wikibugs-new-report', page ), |
||
//starttimestamp: |
//starttimestamp: starttimestamp, |
||
token: |
token: token |
||
}, |
}, |
||
success: afterEdit, |
|||
⚫ | |||
error: function() { |
|||
//handle the error |
|||
alert( mw.msg( 'wikibugs-ajax-error' ) ); |
|||
form.submit.disabled = ''; |
|||
form.submit.disabled = ''; |
|||
loadingIcon.style.display = 'none'; |
|||
} |
|||
}); |
}); |
||
} |
} |
||
⚫ | |||
⚫ | |||
var pageInfo; |
|||
$.getJSON( |
|||
if ( 'error' in data ) { |
|||
alert( mw.msg( 'wikibugs-token-error', data.error.code, data.error.info ) ); |
|||
⚫ | |||
return false; |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
) { |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
doEditPage( pageInfo.edittoken /*, pageInfo.starttimestamp*/ ); |
|||
⚫ | |||
alert( mw.msg( 'wikibugs- |
} else { |
||
alert( mw.msg( 'wikibugs-unknown-token-error' ) ); |
|||
return false; |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
url: mw.util.wikiScript( 'api' ), |
|||
dataType: 'json', |
|||
data: { |
|||
format: 'json', |
|||
action: 'query', |
|||
prop: 'info', |
|||
⚫ | |||
intoken: 'edit', |
|||
⚫ | |||
}, |
|||
success: getToken, |
|||
⚫ | |||
alert( mw.msg( 'wikibugs-ajax-error' ) ); |
|||
} |
|||
}); |
}); |
||
} |
} |
||
$.ajax({ |
|||
url: mw.util.wikiScript( 'api' ), |
|||
$.getJSON( |
|||
dataType: 'json', |
|||
data: { |
|||
'format': 'json', |
'format': 'json', |
||
'action': 'query', |
'action': 'query', |
||
Linha 450: | Linha 473: | ||
'prop': 'revisions', |
'prop': 'revisions', |
||
'rvprop': 'content', |
'rvprop': 'content', |
||
'indexpageids': |
'indexpageids': true |
||
}, processContentOfPage |
}, |
||
success: processContentOfPage, |
|||
⚫ | |||
⚫ | |||
⚫ | |||
} |
|||
}); |
|||
} |
} |
||
}; |
}; |