Help:MassRollback (gadget)/new.js: Difference between revisions
From Test Wiki
Content deleted Content added
m Protected "Help:MassRollback (gadget)/new.js" ([Edit=Allow only bureaucrats] (indefinite) [Move=Allow only bureaucrats] (indefinite) [Delete=Allow only bureaucrats] (indefinite) [Protect=Allow only bureaucrats] (indefinite)) Tags: Mobile edit Mobile web edit |
No edit summary |
||
| Line 5: | Line 5: | ||
init: function() { |
init: function() { |
||
| ⚫ | |||
if (mw.config.get('wgCanonicalSpecialPageName') !== 'Contributions') { |
if (mw.config.get('wgCanonicalSpecialPageName') !== 'Contributions') { |
||
return; |
return; |
||
| Line 15: | Line 14: | ||
createUI: function() { |
createUI: function() { |
||
| ⚫ | |||
const $container = $(` |
const $container = $(` |
||
<div id="mass-rollback-container" style="border: 1px solid #ccc; padding: 15px; margin-bottom: 20px; border-radius: 4px; background: #f9f9f9;"> |
<div id="mass-rollback-container" style="border: 1px solid #ccc; padding: 15px; margin-bottom: 20px; border-radius: 4px; background: #f9f9f9; display: none;"> |
||
<h3 style="margin-top: 0;">Mass Rollback Tool</h3> |
<h3 style="margin-top: 0;">Mass Rollback Tool</h3> |
||
| Line 129: | Line 129: | ||
</div> |
</div> |
||
`); |
`); |
||
| ⚫ | |||
const $toggleButton = $(` |
|||
<button id="mass-rollback-toggle" style="padding: 5px 10px; margin-bottom: 10px; background-color: #007bff; color: #fff; border: none; border-radius: 3px; cursor: pointer;"> |
|||
Show/Hide MassRollback |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
$toggleButton.on('click', function() { |
|||
$('#mass-rollback-container').slideToggle(); |
|||
| ⚫ | |||
const btn = $(this); |
|||
btn.text(btn.text() === 'Open MassRollback' ? 'Show/Hide MassRollback' : 'Show/Hide MassRollback'); |
|||
}); |
|||
$('#mw-content-text').prepend($toggleButton).prepend($container); |
|||
}, |
}, |
||
| Line 152: | Line 168: | ||
$('#rollback-all').on('click', this.rollbackAll.bind(this)); |
$('#rollback-all').on('click', this.rollbackAll.bind(this)); |
||
| ⚫ | |||
$(document).on('change', '#select-all', function() { |
$(document).on('change', '#select-all', function() { |
||
const isChecked = $(this).is(':checked'); |
const isChecked = $(this).is(':checked'); |
||
| Line 158: | Line 173: | ||
}); |
}); |
||
| ⚫ | |||
$('li[data-mw-revid]').each(function() { |
$('li[data-mw-revid]').each(function() { |
||
const $li = $(this); |
const $li = $(this); |
||
| Line 196: | Line 210: | ||
}, |
}, |
||
| ⚫ | |||
getNamespaceName: function(ns) { |
getNamespaceName: function(ns) { |
||
const nsMapping = { |
const nsMapping = { |
||
| Line 228: | Line 241: | ||
const sortOrder = $('#sort-order').val(); |
const sortOrder = $('#sort-order').val(); |
||
| ⚫ | |||
if (namespaceFilter.includes('all')) { |
if (namespaceFilter.includes('all')) { |
||
namespaceFilter = []; |
namespaceFilter = []; |
||
| Line 249: | Line 261: | ||
}); |
}); |
||
| ⚫ | |||
filtered.sort((a, b) => { |
filtered.sort((a, b) => { |
||
return sortOrder === 'asc' |
return sortOrder === 'asc' |
||
| Line 293: | Line 304: | ||
}); |
}); |
||
} |
} |
||
$('#filtered-edits-container'). |
$('#filtered-edits-container').css("display", "block"); |
||
$('#filtered-edits-container').slideDown(); |
$('#filtered-edits-container').slideDown(); |
||
}); |
}); |
||