Difference between revisions of "User:RJackson/vector.js"

From Team Fortress Wiki
Jump to: navigation, search
m (Load moose's blockdelete straight from github.)
(go away mouss)
Line 66: Line 66:
  
 
importScriptURI('https://raw.github.com/Moussekateer/TFWiki-scripts/master/spambot_killer.js', 'text/javascript');
 
importScriptURI('https://raw.github.com/Moussekateer/TFWiki-scripts/master/spambot_killer.js', 'text/javascript');
 +
 +
 +
// 3D STUFF
 +
 +
$("#switch-to-3d").click(function() {
 +
  $("#2d-container").hide();
 +
  $(".viewer-3d").show();
 +
});
 +
 +
$("#switch-to-2d").click(function() {
 +
  $(".viewer-3d").hide();
 +
  $("#2d-container").show();
 +
});

Revision as of 18:27, 14 June 2013

/*BEGIN UTC CLOCK 

Modifications:
  Added timerTimezoneLabel, timer now displays (TIMEZONE UTC-X) if this is set.
    - RJackson, Aug 19th 2011

*/

/** additional monobook scripts **/
hookEvent( 'load', displayTimer );

/**** function displayTimer.js
 * by Patrick Westerhoff [poke]
 */
function displayTimer ()
{
  if ( typeof( timerDisplay ) !== 'undefined' && timerDisplay === false )
    return;
  
  /* Time-zone settings */
  var timerTimezone = -8;        /* Leave blank for UTC */
  var timerTimezoneLabel = "PST";  /* Leave blank to display "(UTC)" or "(UTC-X)".  Fill in to display "(TIMEZONE UTC-X)" */

  var date;
  var timerParent = document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0];
  var timerLink   = document.createElement( 'a' );
  var timerObj    = document.createElement( 'li' );
  timerLink.href               = '/wiki/' + wgPageName + '?action=purge';
  timerLink.title              = 'Purge the server cache and update the contents of this page.'
  timerObj.id                  = 'pt-timer';
  timerObj.style.textTransform = 'none';
  timerObj.appendChild( timerLink );
  timerParent.insertBefore( timerObj, timerParent.firstChild );
  
  function actualizeUTC ()
  {
    timerDate           = new Date();
    timerLink.innerHTML = ( timerDate.getUTCHours()   < 10 ? '0' : '' ) + timerDate.getUTCHours()   + ':'
                        + ( timerDate.getUTCMinutes() < 10 ? '0' : '' ) + timerDate.getUTCMinutes() + ':'
                        + ( timerDate.getUTCSeconds() < 10 ? '0' : '' ) + timerDate.getUTCSeconds() + ' (UTC)';
  }
  
  function actualizeCustom ()
  {
    timerDate           = new Date();
    timerDate.setMinutes( timerDate.getMinutes() + timerDate.getTimezoneOffset() + timerTimezone * 60 );
    timerLink.innerHTML = ( timerDate.getHours()   < 10 ? '0' : '' ) + timerDate.getHours()   + ':'
                        + ( timerDate.getMinutes() < 10 ? '0' : '' ) + timerDate.getMinutes() + ':'
                        + ( timerDate.getSeconds() < 10 ? '0' : '' ) + timerDate.getSeconds()
                        + ' (' + ( timerTimezoneLabel != null ? timerTimezoneLabel + ', ' : '' ) + 'UTC' + ( timerTimezone < 0 ? '' : '+' ) + timerTimezone + ')';
  }
  
  // start
  if ( typeof( timerTimezone ) !== 'number' )
  {
    actualizeUTC();
    setInterval( actualizeUTC, 1000 );
  }
  else
  {
    actualizeCustom();
    setInterval( actualizeCustom, 1000 );
  }
}
/*END UTC CLOCK*/

importScriptURI('https://raw.github.com/Moussekateer/TFWiki-scripts/master/spambot_killer.js', 'text/javascript');


// 3D STUFF

$("#switch-to-3d").click(function() {
  $("#2d-container").hide();
  $(".viewer-3d").show();
});

$("#switch-to-2d").click(function() {
  $(".viewer-3d").hide();
  $("#2d-container").show();
});