We have a Lore FAQ page. If you have Story/Lore related questions - make sure to check it out!

Difference between revisions of "MediaWiki:Common.js"

From The Ark: NieR Automata Lore
Jump to: navigation, search
Line 2: Line 2:
  
 
  $('.rss-date').each(function() {
 
  $('.rss-date').each(function() {
     var a = $(this).html().replace(/http.* /g, ' ')
+
     var a = $(this).html().replace(/http.* /g, ' ');
 +
    a = a.replace('/u/','');
 
     $(this).html(a.replace(/(\/u\/.* )/g,"<a href='https://www.reddit.com/user/$1'>$1</a> "));
 
     $(this).html(a.replace(/(\/u\/.* )/g,"<a href='https://www.reddit.com/user/$1'>$1</a> "));
 
  });
 
  });

Revision as of 23:25, 3 October 2017

jQuery(document).ready( function( $ ) {

 $('.rss-date').each(function() {
     var a = $(this).html().replace(/http.* /g, ' ');
     a = a.replace('/u/','');
    $(this).html(a.replace(/(\/u\/.* )/g,"<a href='https://www.reddit.com/user/$1'>$1</a> "));
 });

 $('td[data-sort-value]').each(function() {
    var value = $(this).attr('data-sort-value')
    color = getRandomColor()
    $('td[data-sort-value]').each(function() {
       if (value == $(this).attr('data-sort-value')) {
          $(this).css("background-color", color)
         }
    });
});
});

function getRandomColor() {
    var letters = 'BCDEF'.split('');
    var color = '#';
    for (var i = 0; i < 6; i++ ) {
        color += letters[Math.floor(Math.random() * letters.length)];
    }
    return color;
}