Jump to content

User:GhostInTheMachine/test.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by GhostInTheMachine (talk | contribs) at 23:50, 15 February 2020 (go for it). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
// $("#mw-content-text a[href^='/wiki/'].nonimage").prepend(' <<').append('>> ');

// $('#firstHeading').append(' ###');

$('#firstHeading').append(' <a id="make_link_list" href="#"> Make link list </a>');

$(function(){
    $('#make_link_list').click(make_link_list);
});

function make_link_list(){
    var links = $("#mw-content-text a[href^='/wiki/'].nonimage");
    var body = $("#mw-content-text");
    body.html("<ul>");
    links.each(function() {
        body.append( $("<li>").html($( this ).text() ));
    });
}