User:MusikAnimal/importWatchlist.js: Difference between revisions

Content deleted Content added
No edit summary
add rawcontinue URL parameter to fix upcoming API change
 
(4 intermediate revisions by one other user not shown)
Line 11:
There will be a new box at the top of your watchlist. Enter the username of the account whose watchlist you wish to import.
You will also need their watchlist token, which can be found in their Preferences under the Watchlist tab. [[Special:Preferences#mw-prefsection-watchlist]]
 
*/
 
Line 18 ⟶ 19:
"<legend>Import watchlist</legend>" +
"<div><label for='import_watchlist_username'>Source watchlist username:</label><input type='text' id='import_watchlist_username' /></div>" +
"<div><label for='import_watchlist_token'>Source watchlist token:</label><input type='text' id='import_watchlist_token' />&nbsp;(can be found at <a href='https://en.wikipedia.org/wiki/Special:Preferences#mw-prefsection-watchlist'>Special:Preferences#mw-prefsection-watchlist</a>)</div>" +
"<div id='import_watchlist_progress'></div>" +
"<button id='import_watchlist_submit'>Import</button>" +
Line 82 ⟶ 83:
"&wrtoken="+$('#import_watchlist_token').val() +
(wrcontinue ? "&wrcontinue="+wrcontinue : "") +
"&wrlimit=500&rawcontinue=&format=json", null, function(data) {
if(!data.watchlistraw) {
// error
$("#import_watchlist_progress").html("<div style='color:red'>Error fetching watchlist from user " + $("#import_watchlist_username").val() + ". Possible username/token mismatch.");
$("#import_watchlist_form").find("input,button").prop("disabled",false);
return false;
}
// first push to array
for(var i=0; i<data.watchlistraw.length; i++) {