diff --git a/morebits-test.js b/morebits-test.js deleted file mode 100644 index 0e6ef76..0000000 --- a/morebits-test.js +++ /dev/null @@ -1,183 +0,0 @@ -/* global Morebits */ - -// Script depends on jQuery dialog widget, loaded through jquery.ui after -// T219604 (1.35-wmf.2 circa 22 Oct 2019) -mw.loader.using('jquery.ui', function() { - // Construct object (to prevent namespace conflicts) - Twinkle.morebitsTest = { - - launchDialog: function(userInterface) { - userInterface.dialog('open'); - }, - - initSimpleWindow: function() { - var Window = new Morebits.simpleWindow(600, 400); - Window.setTitle('Test morebits.js'); - Window.display(); - var form = new Morebits.quickForm(null); - form.append({ - type: 'select', - name: 'main_group', - event: null - }); - var result = form.render(); - Window.setContent(result); - Window.display(); - result.main_group.root = result; - Morebits.status.init(result); - Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName'); - Morebits.wiki.actionCompleted.notice = 'Test complete, reloading talk page in a few seconds'; - }, - - setPageOptions: function(page) { - page.setEditSummary($('#editSummary').val()); - if ($('#runTestForm input[name="followRedirect"]').attr('checked')) { - page.setFollowRedirect(true); - } - if ($('#runTestForm input[name="minorEdit"]').attr('checked')) { - page.setMinorEdit(true); - } - if ($('#runTestForm input[name="watchlist"]').attr('checked')) { - page.setWatchlist(true); - } - if ($('#runTestForm input[name="watchlistFromPreferences"]').attr('checked')) { - page.setWatchlistFromPreferences(true); - } - if ($('#runTestForm input[name="noRetries"]').attr('checked')) { - page.setMaxConflictRetries(0); - page.setMaxRetries(0); - } - var section = $('#runTestForm input[name="sectionNumber"]').val(); - if (section !== '') { - page.setPageSection(Number(section)); - } - page.setCreateOption(window.morebits_test_createOption); - - if ($('#runTestForm input[name="lookupCreator"]').attr('checked')) { - page.lookupCreator(Twinkle.morebitsTest.lookupCreatorCallback); - } - }, - - loadCallbackInsert: function(page) { - var params = page.getCallbackParameters(); - var text = page.getPageText(); - var pos = text.indexOf(params.beforeText); - if (pos === -1) { - alert('Search text "' + params.beforeText + '" not found!'); - return; - } - page.setPageText(text.substr(0, pos) + params.newText + text.substr(pos)); - page.save(Twinkle.morebitsTest.finalSaveCallback); - }, - - loadCallbackReplace: function(page) { - var params = page.getCallbackParameters(); - page.setPageText(params.newText); - page.save(Twinkle.morebitsTest.finalSaveCallback); - }, - - lookupCreatorCallback: function(page) { - alert('Page was created by: ' + page.getCreator()); - }, - - finalSaveCallback: function(page) { - Morebits.wiki.actionCompleted.redirect = page.getPageName(); // get result of redirects - }, - - initialize: function() { - - // Define runTest interface - // Can also use alternative syntax new to jQuery 1.4: - // $('
').html( 'Text to be added:' ) - // → $('', { css: { 'margin-top': '0.4em' }, text: 'Text to be added:' } ) - - window.morebits_test_createOption = null; - - Twinkle.morebitsTest.$runTests = $('') - .append($('').html('Text to be added: