Line 6: |
Line 6: |
| */ | | */ |
| // See also: MediaWiki:Gadget-EmptyDetect.js and MediaWiki:Gadget-RfDHelper.js | | // See also: MediaWiki:Gadget-EmptyDetect.js and MediaWiki:Gadget-RfDHelper.js |
− |
| |
− |
| |
| | | |
| (function ($, mw, OO) { | | (function ($, mw, OO) { |
| + | 'use strict'; |
| + | var messages, entityId = mw.config.get('wbEntityId'), api = new mw.Api(); |
| | | |
− | 'use strict';
| |
− | var messages;
| |
− | var entityId = mw.config.get( 'wbEntityId' );
| |
− | var api = new mw.Api();
| |
− | console.log("Got API "+ entityId);
| |
| messages = (function () { | | messages = (function () { |
| var translations = { | | var translations = { |
Line 671: |
Line 666: |
| mw.storage.remove('merge-pending-id'); | | mw.storage.remove('merge-pending-id'); |
| } | | } |
− |
| |
| | | |
| /** | | /** |
Line 713: |
Line 707: |
| }); | | }); |
| } | | } |
− |
| |
| | | |
| /** | | /** |
Line 804: |
Line 797: |
| } | | } |
| }, function (code, result) { | | }, function (code, result) { |
− | self.emit('error', result.error.extradata[0] || result.error.info); | + | self.emit('error', result.error.info || result.error.extradata[0] ); |
| }); | | }); |
| }; | | }; |
− |
| |
| | | |
| /** | | /** |
Line 863: |
Line 855: |
| this.entityId = config.entityId; | | this.entityId = config.entityId; |
| } | | } |
− | console.log("about to call OO.inheritClass")
| |
| OO.inheritClass(MergeDialog, OO.ui.ProcessDialog); | | OO.inheritClass(MergeDialog, OO.ui.ProcessDialog); |
− | console.log("called OO.inheritClass")
| |
| | | |
| MergeDialog.static.name = 'mergeDialog'; | | MergeDialog.static.name = 'mergeDialog'; |
Line 889: |
Line 879: |
| } | | } |
| ]; | | ]; |
− |
| + | |
| /** | | /** |
| * @inheritdoc | | * @inheritdoc |
Line 948: |
Line 938: |
| ]); | | ]); |
| this.mergeUnwatch = new OO.ui.CheckboxInputWidget({ | | this.mergeUnwatch = new OO.ui.CheckboxInputWidget({ |
− | selected: mw.storage.get('merge-unwatch') === true | + | selected: mw.storage.get('merge-unwatch') === 'true' |
| }); | | }); |
| fieldset.addItems([ | | fieldset.addItems([ |
Line 960: |
Line 950: |
| ]); | | ]); |
| this.loadMergeDestination = new OO.ui.CheckboxInputWidget({ | | this.loadMergeDestination = new OO.ui.CheckboxInputWidget({ |
− | selected: mw.storage.get('merge-load-destination') !== false | + | selected: mw.storage.get('merge-load-destination') !== 'false' |
| }); | | }); |
| fieldset.addItems([ | | fieldset.addItems([ |
Line 1,000: |
Line 990: |
| */ | | */ |
| MergeDialog.prototype.saveOptions = function () { | | MergeDialog.prototype.saveOptions = function () { |
− | mw.storage.set('merge-always-lowest-id', this.mergeAlwaysLowestId.isSelected()); | + | mw.storage.set('merge-always-lowest-id', this.mergeAlwaysLowestId.isSelected().toString()); |
− | mw.storage.set('merge-unwatch', this.mergeUnwatch.isSelected()); | + | mw.storage.set('merge-unwatch', this.mergeUnwatch.isSelected().toString()); |
− | mw.storage.set('merge-create-redirect', this.mergeCreateRedirect.isSelected()); | + | mw.storage.set('merge-create-redirect', this.mergeCreateRedirect.isSelected().toString()); |
− | mw.storage.set('merge-load-destination', this.loadMergeDestination.isSelected()); | + | mw.storage.set('merge-load-destination', this.loadMergeDestination.isSelected().toString()); |
| }; | | }; |
| | | |
Line 1,119: |
Line 1,109: |
| windowManager.openWindow(dialog); | | windowManager.openWindow(dialog); |
| } | | } |
− |
| |
| | | |
| // Initialization | | // Initialization |
| if (entityId !== null && | | if (entityId !== null && |
− | [0, 146].indexOf(mw.config.get('wgNamespaceNumber')) !== -1 && | + | [120, 146].indexOf(mw.config.get('wgNamespaceNumber')) !== -1 && |
| mw.config.get('wgAction') === 'view') { | | mw.config.get('wgAction') === 'view') { |
| $(window).on('focus storage', function () { | | $(window).on('focus storage', function () { |
Line 1,175: |
Line 1,164: |
| launchDialog: launchDialog | | launchDialog: launchDialog |
| }; | | }; |
− |
| |
| }(jQuery, mediaWiki, OO)); | | }(jQuery, mediaWiki, OO)); |