MediaWiki:Gadget-ExpandedWatchlist.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
/**
 * See the instructions at https://commons.wikimedia.org/w/index.php?title=User:Magog_the_Ogre/ExpandedWatchlist.js
 */

/* jshint ignore:start */
(function() {
   //code from Closure compiler starts here
var d={scope:{},executeAsyncGenerator:function(a){function c(c){return a.next(c)}function g(c){return a["throw"](c)}return new Promise(function(h,e){function l(f){f.done?h(f.value):Promise.resolve(f.value).then(c,g).then(l,e)}l(a.next())})}};d.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,c,g){if(g.get||g.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[c]=g.value)};
d.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};d.global=d.getGlobal(this);d.SYMBOL_PREFIX="jscomp_symbol_";d.initSymbol=function(){d.initSymbol=function(){};d.global.Symbol||(d.global.Symbol=d.Symbol)};d.symbolCounter_=0;d.Symbol=function(a){return d.SYMBOL_PREFIX+(a||"")+d.symbolCounter_++};
d.initSymbolIterator=function(){d.initSymbol();var a=d.global.Symbol.iterator;a||(a=d.global.Symbol.iterator=d.global.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&d.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return d.arrayIterator(this)}});d.initSymbolIterator=function(){}};d.arrayIterator=function(a){var c=0;return d.iteratorPrototype(function(){return c<a.length?{done:!1,value:a[c++]}:{done:!0}})};
d.iteratorPrototype=function(a){d.initSymbolIterator();a={next:a};a[d.global.Symbol.iterator]=function(){return this};return a};d.makeIterator=function(a){d.initSymbolIterator();d.initSymbol();d.initSymbolIterator();var c=a[Symbol.iterator];return c?c.call(a):d.arrayIterator(a)};d.arrayFromIterator=function(a){for(var c,g=[];!(c=a.next()).done;)g.push(c.value);return g};d.arrayFromIterable=function(a){return a instanceof Array?a:d.arrayFromIterator(d.makeIterator(a))};
d.inherits=function(a,c){function g(){}g.prototype=c.prototype;a.prototype=new g;a.prototype.constructor=a;for(var h in c)if(Object.defineProperties){var e=Object.getOwnPropertyDescriptor(c,h);e&&Object.defineProperty(a,h,e)}else a[h]=c[h]};d.polyfill=function(a,c){if(c){for(var g=d.global,h=a.split("."),e=0;e<h.length-1;e++){var l=h[e];l in g||(g[l]={});g=g[l]}h=h[h.length-1];e=g[h];l=c(e);l!=e&&null!=l&&d.defineProperty(g,h,{configurable:!0,writable:!0,value:l})}};d.EXPOSE_ASYNC_EXECUTOR=!0;
d.FORCE_POLYFILL_PROMISE=!1;
d.polyfill("Promise",function(a){function c(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var f=this.createResolveAndReject_();try{a(f.resolve,f.reject)}catch(b){f.reject(b)}}function g(){this.batch_=null}if(a&&!d.FORCE_POLYFILL_PROMISE)return a;g.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};g.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};var h=
d.global.setTimeout;g.prototype.asyncExecuteFunction=function(a){h(a,0)};g.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=this.batch_;this.batch_=[];for(var f=0;f<a.length;++f){var b=a[f];delete a[f];try{b()}catch(m){this.asyncThrow_(m)}}}this.batch_=null};g.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};c.prototype.createResolveAndReject_=function(){function a(a){return function(c){b||(b=!0,a.call(f,c))}}var f=this,b=!1;return{resolve:a(this.resolveTo_),
reject:a(this.reject_)}};c.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof c)this.settleSameAsPromise_(a);else{var f;a:switch(typeof a){case "object":f=null!=a;break a;case "function":f=!0;break a;default:f=!1}f?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};c.prototype.resolveToNonPromiseObj_=function(a){var f=void 0;try{f=a.then}catch(b){this.reject_(b);return}"function"==typeof f?this.settleSameAsThenable_(f,
a):this.fulfill_(a)};c.prototype.reject_=function(a){this.settle_(2,a)};c.prototype.fulfill_=function(a){this.settle_(1,a)};c.prototype.settle_=function(a,f){if(0!=this.state_)throw Error("Cannot settle("+a+", "+f|"): Promise already settled in state"+this.state_);this.state_=a;this.result_=f;this.executeOnSettledCallbacks_()};c.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=this.onSettledCallbacks_,f=0;f<a.length;++f)a[f].call(),a[f]=null;this.onSettledCallbacks_=
null}};var e=new g;c.prototype.settleSameAsPromise_=function(a){var f=this.createResolveAndReject_();a.callWhenSettled_(f.resolve,f.reject)};c.prototype.settleSameAsThenable_=function(a,f){var b=this.createResolveAndReject_();try{a.call(f,b.resolve,b.reject)}catch(m){b.reject(m)}};c.prototype.then=function(a,f){function b(a,b){return"function"==typeof a?function(b){try{m(a(b))}catch(w){n(w)}}:b}var m,n,e=new c(function(a,b){m=a;n=b});this.callWhenSettled_(b(a,m),b(f,n));return e};c.prototype["catch"]=
function(a){return this.then(void 0,a)};c.prototype.callWhenSettled_=function(a,f){function b(){switch(c.state_){case 1:a(c.result_);break;case 2:f(c.result_);break;default:throw Error("Unexpected state: "+c.state_);}}var c=this;null==this.onSettledCallbacks_?e.asyncExecute(b):this.onSettledCallbacks_.push(function(){e.asyncExecute(b)})};c.resolve=function(a){return a instanceof c?a:new c(function(f){f(a)})};c.reject=function(a){return new c(function(f,b){b(a)})};c.race=function(a){return new c(function(f,
b){for(var e=d.makeIterator(a),n=e.next();!n.done;n=e.next())c.resolve(n.value).callWhenSettled_(f,b)})};c.all=function(a){var f=d.makeIterator(a),b=f.next();return b.done?c.resolve([]):new c(function(a,e){function n(b){return function(f){m[b]=f;g--;0==g&&a(m)}}var m=[],g=0;do m.push(void 0),g++,c.resolve(b.value).callWhenSettled_(n(m.length-1),e),b=f.next();while(!b.done)})};d.EXPOSE_ASYNC_EXECUTOR&&(c.$jscomp$new$AsyncExecutor=function(){return new g});return c},"es6-impl","es3");
d.owns=function(a,c){return Object.prototype.hasOwnProperty.call(a,c)};d.polyfill("Object.assign",function(a){return a?a:function(a,g){for(var c=1;c<arguments.length;c++){var e=arguments[c];if(e)for(var l in e)d.owns(e,l)&&(a[l]=e[l])}return a}},"es6-impl","es3");
d.polyfill("WeakMap",function(a){function c(a){this.id_=(l+=Math.random()+1).toString();if(a){d.initSymbol();d.initSymbolIterator();a=d.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}}function g(a){d.owns(a,e)||d.defineProperty(a,e,{value:{}})}function h(a){var b=Object[a];b&&(Object[a]=function(a){g(a);return b(a)})}if(function(){if(!a||!Object.seal)return!1;try{var f=Object.seal({}),b=Object.seal({}),c=new a([[f,2],[b,3]]);if(2!=c.get(f)||3!=c.get(b))return!1;c["delete"](f);
c.set(b,4);return!c.has(f)&&4==c.get(b)}catch(n){return!1}}())return a;var e="$jscomp_hidden_"+Math.random().toString().substring(2);h("freeze");h("preventExtensions");h("seal");var l=0;c.prototype.set=function(a,b){g(a);if(!d.owns(a,e))throw Error("WeakMap key fail: "+a);a[e][this.id_]=b;return this};c.prototype.get=function(a){return d.owns(a,e)?a[e][this.id_]:void 0};c.prototype.has=function(a){return d.owns(a,e)&&d.owns(a[e],this.id_)};c.prototype["delete"]=function(a){return d.owns(a,e)&&d.owns(a[e],
this.id_)?delete a[e][this.id_]:!1};return c},"es6-impl","es3");d.ASSUME_NO_NATIVE_MAP=!1;
d.polyfill("Map",function(a){function c(){var a={};return a.previous=a.next=a.head=a}function g(a,c){var b=a.head_;return d.iteratorPrototype(function(){if(b){for(;b.head!=a.head_;)b=b.previous;for(;b.next!=b.head;)return b=b.next,{done:!1,value:c(b)};b=null}return{done:!0,value:void 0}})}function h(a,c){var b;b=c&&typeof c;"object"==b||"function"==b?l.has(c)?b=l.get(c):(b=""+ ++f,l.set(c,b)):b="p_"+c;var e=a.data_[b];if(e&&d.owns(a.data_,b))for(var g=0;g<e.length;g++){var m=e[g];if(c!==c&&m.key!==
m.key||c===m.key)return{id:b,list:e,index:g,entry:m}}return{id:b,list:e,index:-1,entry:void 0}}function e(a){this.data_={};this.head_=c();this.size=0;if(a){a=d.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}}if(!d.ASSUME_NO_NATIVE_MAP&&function(){if(!a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var b=Object.seal({x:4}),c=new a(d.makeIterator([[b,"s"]]));if("s"!=c.get(b)||1!=c.size||c.get({x:4})||c.set({x:4},"t")!=c||2!=c.size)return!1;var f=c.entries(),
e=f.next();if(e.done||e.value[0]!=b||"s"!=e.value[1])return!1;e=f.next();return e.done||4!=e.value[0].x||"t"!=e.value[1]||!f.next().done?!1:!0}catch(q){return!1}}())return a;d.initSymbol();d.initSymbolIterator();var l=new WeakMap;e.prototype.set=function(a,c){var b=h(this,a);b.list||(b.list=this.data_[b.id]=[]);b.entry?b.entry.value=c:(b.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:a,value:c},b.list.push(b.entry),this.head_.previous.next=b.entry,this.head_.previous=b.entry,
this.size++);return this};e.prototype["delete"]=function(a){a=h(this,a);return a.entry&&a.list?(a.list.splice(a.index,1),a.list.length||delete this.data_[a.id],a.entry.previous.next=a.entry.next,a.entry.next.previous=a.entry.previous,a.entry.head=null,this.size--,!0):!1};e.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=c();this.size=0};e.prototype.has=function(a){return!!h(this,a).entry};e.prototype.get=function(a){return(a=h(this,a).entry)&&a.value};e.prototype.entries=function(){return g(this,
function(a){return[a.key,a.value]})};e.prototype.keys=function(){return g(this,function(a){return a.key})};e.prototype.values=function(){return g(this,function(a){return a.value})};e.prototype.forEach=function(a,c){for(var b=this.entries(),f;!(f=b.next()).done;)f=f.value,a.call(c,f[1],f[0],this)};e.prototype[Symbol.iterator]=e.prototype.entries;var f=0;return e},"es6-impl","es3");
d.findInternal=function(a,c,g){a instanceof String&&(a=String(a));for(var h=a.length,e=0;e<h;e++){var l=a[e];if(c.call(g,l,e,a))return{i:e,v:l}}return{i:-1,v:void 0}};d.polyfill("Array.prototype.find",function(a){return a?a:function(a,g){return d.findInternal(this,a,g).v}},"es6-impl","es3");d.array=d.array||{};
d.iteratorFromArray=function(a,c){d.initSymbolIterator();a instanceof String&&(a+="");var g=0,h={next:function(){if(g<a.length){var e=g++;return{value:c(e,a[e]),done:!1}}h.next=function(){return{done:!0,value:void 0}};return h.next()}};h[Symbol.iterator]=function(){return h};return h};d.polyfill("Array.prototype.keys",function(a){return a?a:function(){return d.iteratorFromArray(this,function(a){return a})}},"es6-impl","es3");
(function(a){return d.executeAsyncGenerator(function(){function c(){return d.executeAsyncGenerator(function(){function b(){for(;;)switch(c){case 0:return c=-1,{value:new Promise(function(b){k(function(){b()});var c=a.setInterval(function(){k("#footer")[0]&&k("#mw-navigation")[0]&&(b(),a.clearInterval(c))},100)}),done:!0};default:return{value:void 0,done:!0}}}var c=0,D={next:function(a){return b(a,void 0)},"throw":function(a){return b(void 0,a)},"return":function(){throw Error("Not yet implemented");
}};d.initSymbolIterator();D[Symbol.iterator]=function(){return this};return D}())}function g(a){return Object.assign.apply(Object,[].concat([{}],d.arrayFromIterable(k.map(a,function(a){var b=d.makeIterator(a);a=b.next().value;var b=b.next().value,c={};return c[a]=b,c}))))}function h(h,v){for(;;)switch(e){case 0:k=a.$;r=a.mw;x=function(){this._registry=new Map;this._factories=[]};x.prototype.get=function(a){var b=this._registry.get(a);b||(this._factories.some(function(c){return b=c.get(a)}),this._registry.set(a,
b));return b};x.prototype.register=function(a){this._factories.unshift(a)};B=function(){};B.prototype.get=function(a){return new a};w=function(){};w.prototype.get=function(b){if(b===a.Storage)return[a.localStorage,a.sessionStorage].find(function(a){try{return a.setItem("gadget-ew-check",0),a.removeItem("gadget-ew-check"),!0}catch(E){}})};u=function(){var b=f.get(a.Storage),c=Object.assign({},JSON.parse(b.getItem("gadget-ew"))||{});this.get=function(a){return c[a]};this.set=function(a,f){c[a]=f;b.setItem("gadget-ew",
JSON.stringify(c))}};t=function(){this._preferences=f.get(u);this._message=f.get(q).getGlobal("disableOptions")};t.prototype.notify=function(a){a[0]&&!this.getNotified()&&this.doNotify(a)};t.prototype.doNotify=function(a){var b=this,c={};k("<div></div>").html(this.getMessage(a)).dialog({appendTo:"body",modal:!0,buttons:(c[f.get(q).getGlobal("gotIt")]=function(){k(this).dialog("close")},c),close:function(){b.setNotified()}})};t.prototype.getMessage=function(a){a=a.map(function(a,b){return k.trim(k("label[for="+
k(b).attr("id")+"]").text())}).get().join(", ");return this._message.replace(/\$1\b/,a)};t.prototype.getNotified=function(){return this._preferences.get("notified")};t.prototype.setNotified=function(){this._preferences.set("notified",!0)};q=function(){this._mylang=r.config.get("wgUserLanguage");this._defaultLang="en";this.global={show:{en:"Show"},only:{en:"Show only"},hide:{en:"Hide"},disabled:{en:"disabled"},disableOptions:{en:"Expanded watchlist will only filter entries returned in your standard watchlist. In order to make the most out of expanded watchlist, you may wish to <strong>edit your preferences</strong> to only hide options you never want to see. <br/><br/>The following options are currently disabled: $1."},
gotIt:{en:"Got it"},expandWatchlist:{en:"Expanded watchlist"},standardWatchlist:{en:"Standard watchlist"},rememberSettings:{en:"Remember settings"},reset:{en:"Clear state"},resetSettings:{en:"Reset settings"},save:{en:"Save state"},"preferences-saved":{en:"Preferences saved"},"preferences-cleared":{en:"Preferences cleared"}};this.tools={"ew-bot":{shortDesc:{en:"Bots"},longDesc:{en:"Bot edits"}},"ew-log":{shortDesc:{en:"Logs"},longDesc:{en:"All log entries"}},"ew-uploads":{shortDesc:{en:"Upload log"},
longDesc:{en:"Upload log"}},"ew-deletion":{shortDesc:{en:"Deletion log"},longDesc:{en:"Deletion log"}},"ew-new":{shortDesc:{en:"New pages"},longDesc:{en:"New pages"}},"ew-patrolled":{shortDesc:{en:"Patrolled pages"},longDesc:{en:"Patrolled pages"}},"ew-data":{shortDesc:{en:"Wikidata"},longDesc:{en:"Wikidata"}},"ew-minor":{shortDesc:{en:"Minor edits"},longDesc:{en:"Minor edits"}},"ew-anon":{shortDesc:{en:"Anonymous users"},longDesc:{en:"Anonymous users"}},"ew-cat":{shortDesc:{en:"Page categorization"},
longDesc:{en:"Page categorization"}},"ew-mine":{shortDesc:{en:"My edits"},longDesc:{en:"My edits"}},"ew-experienced":{shortDesc:{en:"Experienced users"},longDesc:{en:"Experienced accounts"}},"ew-learner":{shortDesc:{en:"Learners"},longDesc:{en:"Learner accounts"}},"ew-newcomer":{shortDesc:{en:"Newcomers"},longDesc:{en:"Newcomer accounts"}},"ew-deleted":{shortDesc:{en:"Deleted pages"},longDesc:{en:"Target pages is deleted."}}}};q.prototype._getMessage=function(a){return a[this._myLang]||a[this._defaultLang]};
q.prototype.getGlobal=function(a){try{return this._getMessage(this.global[a])}catch(F){return r.log.error("Global message not found: "+a),""}};q.prototype.getTool=function(a,b){try{return this._getMessage(this.tools[a][b])}catch(E){return r.log.error("Message not found: "+a+"."+b),""}};q.prototype.addToolMessages=function(a){k.extend(!0,this.tools,a)};q.prototype.setMylang=function(a){this._mylang=a};p=function(){function a(a){return m.apply(this,arguments)||this}function c(a){return b.apply(this,
arguments)||this}function e(a){return b.apply(this,arguments)||this}function g(a){return b.apply(this,arguments)||this}function h(a){return b.apply(this,arguments)||this}function l(a){return b.apply(this,arguments)||this}function p(a){return b.apply(this,arguments)||this}function y(a){return b.apply(this,arguments)||this}function r(a){return b.apply(this,arguments)||this}function t(a){return b.apply(this,arguments)||this}function u(a){return b.apply(this,arguments)||this}function w(a){return b.apply(this,
arguments)||this}function v(a){return b.apply(this,arguments)||this}function x(a){return b.apply(this,arguments)||this}function z(a){return b.apply(this,arguments)||this}function A(a){return b.apply(this,arguments)||this}var C=this;this.AbstractExpandedWatchlistFilter=n;this.ExistingFilter=m;this.ShowHideFilter=b;this._messages=f.get(q);d.inherits(A,b);A.prototype.getName=function(){return"ew-log"};A.prototype.getToolFilter=function(){return".mw-changeslist-src-mw-log"};d.inherits(z,b);z.prototype.getName=
function(){return"ew-uploads"};z.prototype.getToolFilter=function(){return".mw-changeslist-log-upload"};d.inherits(x,b);x.prototype.getName=function(){return"ew-deletion"};x.prototype.getToolFilter=function(){return".mw-changeslist-log-delete"};d.inherits(v,b);v.prototype.getName=function(){return"ew-minor"};v.prototype.getToolFilter=function(){return".mw-changeslist-minor"};v.prototype.getOriginalElementIds=function(){return["hideminor"]};d.inherits(w,b);w.prototype.getName=function(){return"ew-new"};
w.prototype.getToolFilter=function(){return".mw-changeslist-src-mw-new"};d.inherits(u,b);u.prototype.getName=function(){return"ew-patrolled"};u.prototype.getToolFilter=function(){return".mw-changeslist-patrolled"};u.prototype.getOriginalElementIds=function(){return["hidepatrolled"]};d.inherits(t,b);t.prototype.getName=function(){return"ew-data"};t.prototype.getToolFilter=function(){return".mw-changeslist-src-wb"};t.prototype.getOriginalElementIds=function(){return["hideWikibase"]};d.inherits(r,b);
r.prototype.getName=function(){return"ew-cat"};r.prototype.getToolFilter=function(){return".mw-changeslist-src-mw-categorize"};r.prototype.getOriginalElementIds=function(){return["hidecategorization"]};d.inherits(y,b);y.prototype.getName=function(){return"ew-deleted"};y.prototype.doFilter=function(a){return a.children(".new:not(.mw-userlink)").closest(a)};d.inherits(p,b);p.prototype.getName=function(){return"ew-mine"};p.prototype.getToolFilter=function(){return".mw-changeslist-self"};p.prototype.getOriginalElementIds=
function(){return["hidemyself"]};d.inherits(l,b);l.prototype.getName=function(){return"ew-experienced"};l.prototype.getToolFilter=function(){return".mw-changeslist-user-experienced"};l.prototype.getOriginalElementIds=function(){return["hideliu"]};d.inherits(h,b);h.prototype.getName=function(){return"ew-learner"};h.prototype.getToolFilter=function(){return".mw-changeslist-user-learner"};h.prototype.getOriginalElementIds=function(){return["hideliu"]};d.inherits(g,b);g.prototype.getName=function(){return"ew-newcomer"};
g.prototype.getToolFilter=function(){return".mw-changeslist-user-newcomer"};g.prototype.getOriginalElementIds=function(){return["hideliu"]};d.inherits(e,b);e.prototype.getName=function(){return"ew-anon"};e.prototype.getToolFilter=function(){return".mw-changeslist-anon"};e.prototype.getOriginalElementIds=function(){return["hideanons","hideliu"]};e.prototype.getDisabledState=function(){if(k("#hideanons:checked")[0])return"hide";if(k("#hideliu:checked")[0])return"only"};d.inherits(c,b);c.prototype.getName=
function(){return"ew-bot"};c.prototype.getToolFilter=function(){return".mw-changeslist-bot"};c.prototype.getOriginalElementIds=function(){return["hidebots"]};d.inherits(a,m);a.prototype.getName=function(){return"ew-namespace"};a.prototype.getChangeElements=function(){return k("#namespace,#nsinvert,#nsassociated")};a.prototype.filter=function(a){var b=k("#namespace").val();if(!b)return a;var c=k("#nsinvert").is(":checked"),f=[new RegExp("(^|\\s)(mw\\-changeslist\\-ns|watchlist\\-)"+b+"\\-")];k("#nsassociated").is(":checked")&&
f.push(new RegExp("(^|\\s)(mw\\-changeslist\\-ns|watchlist\\-)"+((b%2?-1:1)+ +b)+"\\-"));b=a.filter(function(a,b){return f.some(function(a){return a.test(k(b).attr("class"))})});c&&(b=a.not(b));return b};this._filters=[A,z,x,v,w,u,t,r,y,p,l,h,g,e,c,a].map(function(a){a=new a;a.setNotify(C.filterAll.bind(C));return a})};p.prototype.notifyIfBadOptions=function(a){f.get(t).notify(a)};p.prototype.getFilters=function(){return this._filters};p.prototype.getAllRows=function(){return k(".mw-changeslist > ul > li")};
p.prototype.filterNone=function(){this.getAllRows().show()};p.prototype.filterAll=function(){var a=this.getAllRows(),b=a;this.getFilters().forEach(function(a){b=a.filter(b)});b.show();a.not(b).hide()};p.prototype.load=function(){var a=this,b=k("#mw-watchlist-options :submit"),c=k('<input type="button" />').val(f.get(q).getGlobal("save")).click(function(){a.saveState()})[0],e=k('<input type="button" />').val(f.get(q).getGlobal("reset")).click(function(){a.reset()})[0];this._originalElements=k(k.map(this.getFilters(),
function(a){return a.getOriginalElements()}));this._toggleElements=k(k.map(this.getFilters(),function(a){return a.loadElements()})).prepend("<br/>").add("<br/>").add([c,e]);this._toggleButton=k('<input type="button" />').click(this.toggle.bind(this)).insertAfter(b).after(this._toggleElements);this._untoggleElements=this._originalElements.closest(".mw-input-with-label").add(b);this.loadState();this.toggle()};p.prototype.toggle=function(){(this._active=!this._active)?(this.notifyIfBadOptions(this._originalElements.filter(":checked")),
this.filterAll()):this.getAllRows().show();this._untoggleElements.toggle(!this._active);this._toggleElements.toggle(this._active);this._toggleButton.val(f.get(q).getGlobal(this._active?"standardWatchlist":"expandWatchlist"))};p.prototype.addFilters=function(a){this._filters=this._filters.concat(a)};p.prototype.reset=function(){var a=f.get(u),b=f.get(q);a.set("expanded",!1);a.set("state","");r.notify(b.getGlobal("preferences-cleared"))};p.prototype.saveState=function(){var a=f.get(u),b=f.get(q);a.set("expanded",
!0);a.set("state",JSON.stringify(g(this._filters.map(function(a){return[a.getName(),a.serialize()]}))));r.notify(b.getGlobal("preferences-saved"))};p.prototype.loadState=function(){this._active=!f.get(u).get("expanded");var a=f.get(u).get("state");if(a){var b=JSON.parse(a);this._filters.forEach(function(a){a.unserialize(b[a.getName()])})}};n=function(){};n.prototype.getMyMessage=function(a){return f.get(q).getTool(this.getName(),a)};n.prototype.getOriginalElementIds=function(){return[]};n.prototype.getOriginalElements=
function(){return this.getOriginalElementIds().map(function(a){return document.getElementById(a)}).filter(function(a){return a})};n.prototype.setNotify=function(a){this._notify=a};n.prototype.getNotify=function(){return this._notify};m=function(a){return n.apply(this,arguments)||this};d.inherits(m,n);m.prototype.loadElements=function(){this.getChangeElements().change(this.getNotify());return[]};m.prototype.serialize=function(){return JSON.stringify(g(this.getChangeElements().get().map(function(a){return[k(a).attr("id"),
k(a).val()]})))};m.prototype.unserialize=function(a){var b=JSON.parse(a);Object.keys(b).forEach(function(a){k(document.getElementById(a)).val(b[a])})};b=function(a){return n.apply(this,arguments)||this};d.inherits(b,n);b.prototype.filter=function(a){var b=k(document.getElementsByName(this.getName())).filter(":checked").val();if("show"!==b){var c=this.doFilter(a);"hide"===b&&(c=a.not(c));a=c}return a};b.prototype.doFilter=function(a){return a.filter(this.getToolFilter())};b.prototype.loadElements=
function(){var a=this,b=this.getDisabledState(),c=this.getMyMessage("longDesc"),e=k.map(["show","hide","only"],function(e){var g=a.getName()+"-"+e,h;h=b?b===e:"show"===e;h=k("<input type='radio'/>").attr({id:g,value:e,name:a.getName(),title:c,disabled:!!b}).prop("checked",h).change(a.getNotify());e=k("<label/>").attr({"for":g,title:c}).html(f.get(q).getGlobal(e));return[h[0],e[0]]}),g=this.getMyMessage("shortDesc");b&&(g+=k('<span style="font-size: 90%"></span>').html("("+f.get(q).getGlobal("disabled")+
")")[0].outerHTML);e.unshift(k("<span></span>").html(g).attr("title",c)[0]);b&&k(e).css("color","#848484");this._radios=k(e).filter("input");return k('<div style="line-height: 0.5em;"></div>').append(e)[0]};b.prototype.getDisabledState=function(){return k(this.getOriginalElements()).is(":checked")&&"hide"};b.prototype.serialize=function(){return this._radios.filter(":checked").val()||""};b.prototype.unserialize=function(a){var b=this;this._radios.prop("checked",function(c){return b._radios.eq(c).val()===
a})};if("Special:Watchlist"!==r.config.get("wgPageName")){e=1;break}f=new x;f.register(new B);f.register(new w);l=a.expandedWatchlist=f.get(p);r.hook("gadget.expandedWatchlist.define").fire();e=2;return{value:c(),done:!1};case 2:if(void 0===v){e=3;break}e=-1;throw v;case 3:l.load();case 1:e=-1;default:return{value:void 0,done:!0}}}var e=0,l,f,b,m,n,p,q,t,u,w,B,x,r,k,v={next:function(a){return h(a,void 0)},"throw":function(a){return h(void 0,a)},"return":function(){throw Error("Not yet implemented");
}};d.initSymbolIterator();v[Symbol.iterator]=function(){return this};return v}())})(window);
   //code from Closure compiler ends here
}());
/* jshint ignore:end */