User:Technical 13/vector.js

From OpenStreetMap Wiki
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* UserCSSJS
** To make it easy to navigate to your own custom CSS and JS pages
** [[Special:MyPage/common.css]] [[Special:MyPage/common.js]]
** [[Special:MyPage/vector.css]] [[Special:MyPage/vector.js]]
**/

/* RC long dates */
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Recentchanges' ){
  var arrDaysOfWeek = [ 'Sunday', 'Monday',  'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ];
  $( 'div h4' ).each( function( j, h4date ) {
    if ( j % 2 === 1 ) {
      h4date.remove();
    } else {
      var n = j / 2;
      var strDate = h4date.innerText;
      var thisDay = ( new Date( strDate ) ).getDay();
      if ( n === 0 ) {
        h4date.id = "today";
      } else {
        h4date.id = arrDaysOfWeek[ thisDay ] + ( Math.floor( n / 7 ) + 1 );
      }
      h4date.innerText = arrDaysOfWeek[ thisDay ] + ', ' + strDate;
    }
  } );

  $( 'body' ).append( '<div id="RCnav" style="position: fixed; left: 5px; bottom: 20px; display: block; width: 150px; z-index: 999; overflow: hidden; border: 1px solid #A7D7F9; background-color: #FFFFFF; text-align: center;"><a href="#today"><small style="font-weight: bold;">&uArr; &nbsp; &uArr; &nbsp; Today &nbsp; &uArr; &nbsp; &uArr;</small></a></div>' );
}