User:MusikAnimal/customWatchlists.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 23:
"<span class='mw-changeslist-separator'>. .</span>&nbsp;" +
"<span class='mw-changeslist-date'>"+formatDate(editDate)+"</span>&nbsp;" +
"<span class='mw-title'><a href='/wiki/"+data.title+"' class='mw-changeslist-title nonimage'>"+data.title+"</a></span>&nbsp;" +
"<span class='mw-changeslist-separator'>. .</span>&nbsp;" +
"<span dir='ltr' class='"+diffClass+"'>("+(lengthDiff > 0 ? "+" : "")+lengthDiff+")</span> " +
Line 185:
 
var api = new mw.Api();
// api.watch(wgPageName).done(function(watchResult) {
debugger;
api.postWithToken( "edit", {
// );
api.postWithToken( action: "edit", {
action title: "editUser:"+wgUserName+"/watchlists",
title summary: "User:"+wgUserName+"/updating custom watchlists",
text: JSON.stringify(cw)
summary: "updating custom watchlists",
}).done(function(result, jqXHR) {
text: JSON.stringify(cw)
$("#cw-overlay-body").html("Success!");
}).done(function(result, jqXHR) {
setTimeout(function() {
$("#cw-overlay-body").html("Success!");
setTimeout $(function"#cw-overlay").remove() {;
$("#cw-overlay").remove(},5000);
}).fail(function(code,5000 result); {
if ( code === "http" ) {
mw.log( "HTTP error: " + result.textStatus ); // result.xhr contains the jqXHR object
} else if ( code === "ok-but-empty" ) {
mw.log( "Got an empty response from the server" );
} else {
mw.log( "API error: " + code );
}
// });
}).fail(function(code, result) {
if ( code === "http" ) {