From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

/*  

This script will place a button at the top of any NRHP county/state list that when clicked on will check and automatically fix

the ordering of the numbers in the first column of the NRHP table. If no reordering is needed, a null edit will be performed.

This is useful when a property has been added to or removed from the list, causing all rows below it to be off by one.

*/

function RenumberButton() {

    if (mw.config.get('wgPageName').search("National_Register_of_Historic_Places_listings_in")==-1) return

    var button=document.createElement("input")

    button.setAttribute("type", "button");

    button.setAttribute("value", "Renumber list");

    button.setAttribute("id", "button");

    button.setAttribute("onclick", "RenumberClick()");

    var content=document.getElementById('mw-content-text')

 

    content.parentNode.insertBefore(button, content)

}

 

function RenumberClick() { 

    var button = document.getElementById('button')

    button.value = "Working..."

    button.disabled = true

    getListWikitext(mw.config.get('wgPageName'))

}

 

function getListWikitext(title) {

    $.getJSON(

        mw.util.wikiScript('api'),

        {

            format: 'json',

            action: 'query',

            prop: 'revisions',

            rvprop: 'content',

            titles: title,

            indexpageids: true

        }

    )

        .done(function (data) {

            var page, wikitext;

            for (page in data.query.pages) {

                wikitext = data.query.pagespage].revisions0]['*'];

                RenumberList(wikitext)

            }

        })

        .fail(function() {

            alert('Could not get wikitext; failure.');

        });

}

 

function RenumberList(wikitext) {

    var splittext = wikitext.split("|}")

 

    var newwikitext = ''

    for (var j=0; j<splittext.length-1; j++) {

 

        var StartIndex = 0

        var str = "|pos="

        var skip = str.length;

        var index, RowLocations = [];

        while ((index = splittextj].indexOf(str, StartIndex)) > -1) {

            RowLocations.push(index);

            StartIndex = index + skip;

        }

 

        var stop=RowLocations.length+1

        for (var i=1; i<stop; i++) {

            var StartIndex = RowLocationsi-1+1

            var str="|"

            var NextParam = splittextj].indexOf(str,StartIndex)

            splittextj = splittextj].substr(0,RowLocationsi-1])+"|pos="+i+splittextj].substr(NextParam-1,splittextj].length-NextParam+1)

 

            var StartIndex = 0

            var str = "|pos="

            var skip = str.length;

            var index, RowLocations = [];

            while ((index = splittextj].indexOf(str, StartIndex)) > -1) {

                RowLocations.push(index);

                StartIndex = index + skip;

            }

        }

        newwikitext+=splittextj+"|}"

    }

    newwikitext+=splittextsplittext.length-1

    editNRHPPage({

        title: mw.config.get('wgPageName'),

        text: newwikitext,

        summary: '[[User:Dudemanfellabra/ReorderNRHPlist.js|Semi-automated]] renumbering of list items after addition/deletion.'

    });

}

 

function editNRHPPage(info) {

    $.ajax({

        url: mw.util.wikiScript( 'api' ),

        type: 'POST',

        dataType: 'json',

        async: false,

        data: {

            format: 'json',

            action: 'edit',

            title: info.title,

            text: info.text,

            summary: info.summary,

            token: mw.user.tokens.get( 'csrfToken' )

        }

    })

        .done (function( data ) {

            if (data && data. && data..result && data..result == 'Success') {

                alert("Success! Rows renumbered!")

            } else {

                alert("Error! Rows not renumbered! Refresh the page to try again")

            }

        })

        .fail (function() {

            alert('Ajax failure.');

        });

}

 

$(RenumberButton);

importScript('User:Dudemanfellabra/AddCommonsCatLinks.js')



/* User:Technical_13/Scripts/OneClickArchiver */

importScript( 'User:Technical_13/Scripts/OneClickArchiver.js' );// Backlink: [[User:Technical_13/Scripts/OneClickArchiver]]



mw.loader.load( "https://meta.wikimedia.org/?title=User:Zhaofeng_Li/Reflinks.js&action=raw&ctype=text/javascript" );



importScript( 'User:Joeytje50/JWB.js/load.js' ); // Backlink: [[User:Joeytje50/JWB.js/load.js]]
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

/*  

This script will place a button at the top of any NRHP county/state list that when clicked on will check and automatically fix

the ordering of the numbers in the first column of the NRHP table. If no reordering is needed, a null edit will be performed.

This is useful when a property has been added to or removed from the list, causing all rows below it to be off by one.

*/

function RenumberButton() {

    if (mw.config.get('wgPageName').search("National_Register_of_Historic_Places_listings_in")==-1) return

    var button=document.createElement("input")

    button.setAttribute("type", "button");

    button.setAttribute("value", "Renumber list");

    button.setAttribute("id", "button");

    button.setAttribute("onclick", "RenumberClick()");

    var content=document.getElementById('mw-content-text')

 

    content.parentNode.insertBefore(button, content)

}

 

function RenumberClick() { 

    var button = document.getElementById('button')

    button.value = "Working..."

    button.disabled = true

    getListWikitext(mw.config.get('wgPageName'))

}

 

function getListWikitext(title) {

    $.getJSON(

        mw.util.wikiScript('api'),

        {

            format: 'json',

            action: 'query',

            prop: 'revisions',

            rvprop: 'content',

            titles: title,

            indexpageids: true

        }

    )

        .done(function (data) {

            var page, wikitext;

            for (page in data.query.pages) {

                wikitext = data.query.pagespage].revisions0]['*'];

                RenumberList(wikitext)

            }

        })

        .fail(function() {

            alert('Could not get wikitext; failure.');

        });

}

 

function RenumberList(wikitext) {

    var splittext = wikitext.split("|}")

 

    var newwikitext = ''

    for (var j=0; j<splittext.length-1; j++) {

 

        var StartIndex = 0

        var str = "|pos="

        var skip = str.length;

        var index, RowLocations = [];

        while ((index = splittextj].indexOf(str, StartIndex)) > -1) {

            RowLocations.push(index);

            StartIndex = index + skip;

        }

 

        var stop=RowLocations.length+1

        for (var i=1; i<stop; i++) {

            var StartIndex = RowLocationsi-1+1

            var str="|"

            var NextParam = splittextj].indexOf(str,StartIndex)

            splittextj = splittextj].substr(0,RowLocationsi-1])+"|pos="+i+splittextj].substr(NextParam-1,splittextj].length-NextParam+1)

 

            var StartIndex = 0

            var str = "|pos="

            var skip = str.length;

            var index, RowLocations = [];

            while ((index = splittextj].indexOf(str, StartIndex)) > -1) {

                RowLocations.push(index);

                StartIndex = index + skip;

            }

        }

        newwikitext+=splittextj+"|}"

    }

    newwikitext+=splittextsplittext.length-1

    editNRHPPage({

        title: mw.config.get('wgPageName'),

        text: newwikitext,

        summary: '[[User:Dudemanfellabra/ReorderNRHPlist.js|Semi-automated]] renumbering of list items after addition/deletion.'

    });

}

 

function editNRHPPage(info) {

    $.ajax({

        url: mw.util.wikiScript( 'api' ),

        type: 'POST',

        dataType: 'json',

        async: false,

        data: {

            format: 'json',

            action: 'edit',

            title: info.title,

            text: info.text,

            summary: info.summary,

            token: mw.user.tokens.get( 'csrfToken' )

        }

    })

        .done (function( data ) {

            if (data && data. && data..result && data..result == 'Success') {

                alert("Success! Rows renumbered!")

            } else {

                alert("Error! Rows not renumbered! Refresh the page to try again")

            }

        })

        .fail (function() {

            alert('Ajax failure.');

        });

}

 

$(RenumberButton);

importScript('User:Dudemanfellabra/AddCommonsCatLinks.js')



/* User:Technical_13/Scripts/OneClickArchiver */

importScript( 'User:Technical_13/Scripts/OneClickArchiver.js' );// Backlink: [[User:Technical_13/Scripts/OneClickArchiver]]



mw.loader.load( "https://meta.wikimedia.org/?title=User:Zhaofeng_Li/Reflinks.js&action=raw&ctype=text/javascript" );



importScript( 'User:Joeytje50/JWB.js/load.js' ); // Backlink: [[User:Joeytje50/JWB.js/load.js]]

Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook