User:DannyS712/SectionMover.js: Difference between revisions

Content deleted Content added
m Flooded with them hundreds moved page User:Flooded with them hundreds/SectionMover.js to User:Flooded with them hundreds/sectionmover.js without leaving a redirect: lower
m links
 
(11 intermediate revisions by 3 users not shown)
Line 1:
// Originaly by User:Flooded with them hundreds
// Copied to [[User:DannyS712/SectionMover.js]] after FWTH retired, who took over as maintainer
// Install with:
// <code><nowiki> {{subst:Iusc|User:DannyS712/SectionMover.js}} </nowiki></code>
// or with
// <code><nowiki> importScript( 'User:DannyS712/SectionMover.js' ); // Backlink: [[User:DannyS712/SectionMover.js]] </nowiki></code>
//
// If forking this script, please give both of use credit
$.when( mw.loader.using(['mediawiki.util','mediawiki.api']), $.ready).done( function () {
var validSections = {},
Line 10 ⟶ 18:
}
$( 'head' ).append(
'<style>a.arkylinkarxylink { font-weight:bold } .arkyhighlightarxyhighlight { background-color:#aef9fc }</style>'
);
 
Line 16 ⟶ 24:
'p-cactions',
'#',
'XXXMove section',
'pt-oeca',
'Enter/exit the process',
Line 24 ⟶ 32:
overlay = $( document.createElement( 'button' ) );
$( startMoveButton ).click( function ( e ) {
$( '.arkylinkarxylink' ).click();
$( '.arkyarxy' ).toggle();
$( '#Movebutton' ).toggle();
} );
overlay.html( 'move the selected sections' )
.attr( 'id', 'Movebutton' )
.css( 'position', 'fixed' )
.css( 'bottom', 0'20px' )
.css( 'height', '44px50px' )
.css( 'width', '100%' )
.css( 'font-size', '200%' );
Line 45 ⟶ 53:
cutOffset = numOfThreads = 0;
revisedPage = wikiText;
sections = $( 'a.arkylinkarxylink' ).map( function () {
return $( this ).attr( 'data-section' );
} );
Line 78 ⟶ 86:
title: mw.config.get( 'wgPageName' ),
text: revisedPage,
summary: 'Moved ' + numOfThreads + ' sections to [[' + archiveTarget + ']] using [[User:DannyS712/SectionMover.js|SectionMover]]',
basetimestamp: revStamp,
starttimestamp: revStamp
Line 91 ⟶ 99:
title: archiveTarget,
appendtext: '\n' + archiveThis,
summary: 'Moved sections from [[' + mw.config.get( 'wgPageName' ) + ']] using [[User:DannyS712/SectionMover.js|SectionMover]]'
}
).done( function ( res2 ) {
Line 102 ⟶ 110:
} );
} ).fail( function ( res1 ) {
alert( 'failed to removemove sections from page. aborting process.' );
console.log( res1 );
window.___location.reload();
Line 153 ⟶ 161:
if ( validSections.hasOwnProperty( sectionNumber ) ) {
editSection[ 0 ].innerHTML += '&nbsp;'
+ '<span class=arkyarxy style=display:none>'
+ '<span class=mw-editsection-bracket>[</span>'
+ '<a data-section=' + sectionNumber + ' '
+ 'onclick=$(this).closest(\':header\').toggleClass(\'arkyhighlightarxyhighlight\');$(this).toggleClass(\'arkylinkarxylink\');>'
+ 'archivemove section</a>'
+ '<span class=mw-editsection-bracket>]</span>'
+ '</span>';