User:Y2K/monobook.js

From Homestar Runner Wiki

(Difference between revisions)
Jump to: navigation, search
(Revert per user request)
(Adding to here, too.)
Line 1: Line 1:
-
// ==UserScript==
 
-
// @name          Y2K's Monobook JS
 
-
// @namespace    http://fanstuff.hrwiki.org/
 
-
// @include      http://hrwiki.org/*
 
-
// @include      http://www.hrwiki.org/*
 
-
// @include      http://fanstuff.hrwiki.org/*
 
-
// ==/UserScript==
 
-
// The code above is for if you wanna install this as a Greasemonkey user script.
 
-
// NOTE: If you install this as a user script, the time will never "finish loading".
 
-
 
-
function addQuickbarLink(href, title, before, tooltip)
 
-
{
 
-
  var li = document.createElement('li');
 
-
  var a = document.createElement('a');
 
-
  a.appendChild(document.createTextNode(title));
 
-
  a.href = href;
 
-
  a.title = tooltip;
 
-
  li.appendChild(a);
 
-
  if (!before)
 
-
  {
 
-
    document.getElementById('pt-logout').parentNode.appendChild(li);
 
-
  }
 
-
  else
 
-
  {
 
-
    before = document.getElementById('pt-'+before);
 
-
    before.parentNode.insertBefore(li, before);
 
-
  }
 
-
}
 
-
function addLinks()
 
-
{
 
-
  addQuickbarLink("/index.php/User:Y2K/monobook.js", "my js", "preferences", "My custom MonoBook JavaScript");
 
-
  addQuickbarLink("/index.php/User:Y2K/monobook.css", "my css", "preferences", "My custom Monobook CSS");
 
-
  addQuickbarLink("http://fanstuff.hrwiki.org/index.php/User:Y2K/IRC", "my irc toolkit", "preferences", "My toolbox for IRC emulators");
 
-
  addQuickbarLink("http://fanstuff.hrwiki.org/index.php/User_talk:Y2K#.2Fjoin_.23virus-irc", "#virus-irc", "preferences", "My IRC emulator");
 
-
  addQuickbarLink("http://fanstuff.hrwiki.org/index.php/What's Her Face Answering Machine", "whf answering machine", "preferences", "What's Her Face Answering Machine");
 
-
  addQuickbarLink("/index.php/User:Y2K/sig", "my sig", "preferences", "My signature");
 
-
}
 
-
if (window.addEventListener) window.addEventListener('load', addLinks, false);
 
-
else if (window.attachEvent) window.attachEvent('onload', addLinks);
 
-
 
-
// Add Sydney time just below the "personal menu" list at the top of the page.
 
-
// Created by Wikipedia:User:Mathwiz2020, modified by User:JoeyDay, modified again by User:Y2K to show Sydney time
 
-
//
 
-
function getTime() {
 
-
  var time = new Date();
 
-
  var hours = time.getUTCHours();
 
-
  if (hours < 14) { hours = 10 + hours; }
 
-
  else if (hours > 13)
 
-
  {
 
-
    hours = hours - 14
 
-
    if (hours < 10) { hours = "0" + hours; }
 
-
  }
 
-
  var minutes = time.getUTCMinutes();
 
-
  if (minutes < 10) { minutes = "0" + minutes; }
 
-
  var seconds = time.getUTCSeconds();
 
-
  if (seconds < 10) { seconds = "0" + seconds; }
 
-
  var currentTime = hours + ":" + minutes + ":" + seconds;
 
-
  document.getElementById('pt-time').childNodes[0].childNodes[0].replaceData(0, 8, currentTime);
 
-
  doTime = window.setTimeout("getTime()", 1000);
 
-
}
 
-
function makeTime() {
 
-
  var div = document.createElement( 'div' );
 
-
  div.id = 'pt-time';
 
-
  var mySpan = document.createElement( 'span' );
 
-
  mySpan.appendChild( document.createTextNode( '10:00:00' ) );
 
-
  div.appendChild( mySpan );
 
-
  document.getElementById( 'globalWrapper' ).parentNode.appendChild( div );
 
-
  doTime = window.setTimeout("getTime()", 1000);
 
-
}
 
-
if (window.addEventListener) window.addEventListener ('load', makeTime, false);
 
-
else if (window.attachEvent) window.attachEvent ('onload', makeTime);
 
-
 
// Adds a purge tab. Found this on Lapper's JS.
// Adds a purge tab. Found this on Lapper's JS.
function addPurgeButton()
function addPurgeButton()
Line 91: Line 19:
else if ( window.attachEvent ) window.attachEvent( "onload", addPurgeButton );
else if ( window.attachEvent ) window.attachEvent( "onload", addPurgeButton );
-
// include comfortable javascript editor by [[wikipedia:User:Cacycle]]
+
// generate a random logo (only works in Firefox)
-
 
+
// started by me, fixed by Phlip
-
 
+
function changelogo() {
-
// levels of undo (each level holds the whole text)
+
  var logos = new Array(
-
undoBufferMax = 20;
+
    "/images/3/36/Logo_Redesign_Almost_Everybody.png",
-
 
+
    "/images/thumb/b/ba/Logo_Redesign_Basement.png/150px-Logo_Redesign_Basement.png",
-
 
+
    "/images/0/05/Logo_Redesign_Black_Background.png",
-
// style for preview box
+
    "/images/7/7d/Logo_Redesign_Current_Updated.gif",
-
stylePreviewBox = 'background-color: #f9f9f9;';
+
    "/images/thumb/3/38/Logo_Redesign_Edit_Link.png/150px-Logo_Redesign_Edit_Link.png",
-
 
+
    "/images/2/24/Logo_Redesign_Encyclopedia.png",
-
 
+
    "/images/thumb/7/74/Logo_Redesign_Everybody_Everybody.png/150px-Logo_Redesign_Everybody_Everybody.png",
-
// style for custom edit buttons
+
    "/images/thumb/2/21/Puzzle_FCUSA.PNG/150px-Puzzle_FCUSA.PNG",
-
styleButtons = 'font-size: smaller; padding-left: 0.1em; padding-right: 0.1em';
+
    "/images/thumb/8/8e/Logo_Redesign_Field.png/150px-Logo_Redesign_Field.png",
-
 
+
    "/images/b/bb/Logo_Redesign_Homestar_and_SB.gif",
-
 
+
    "/images/a/a8/Logo_Redesign_sbhrfield.png",
-
// presets for input field dropdown options
+
    "/images/thumb/d/d0/Logo_Redesign_Homestar_Front.PNG/150px-Logo_Redesign_Homestar_Front.PNG",
-
findHistoryLength = 10;
+
    "/images/7/74/Logo_Redesign_Homestar_Star.png",
-
 
+
    "/images/0/0d/Dotjoey.png",
-
 
+
    "/images/c/c5/Logo_Redesign_FullBody_Blur.gif",
-
// preset for combo box select options
+
    "/images/1/15/Logo_Redesign_Lappy.gif",
-
presetOptions = [];
+
    "/images/4/42/Logo_Redesign_Official_Logo_Homestar.png",
-
presetOptions['summary'] = [
+
    "/images/2/20/hrwlogoidea-fixed.png",
-
 
+
    "/images/3/36/Logo_Redesign_Old_New_Star.gif",
-
 
+
    "/images/thumb/f/f7/Logo_Redesign_Puzzle.png/150px-Logo_Redesign_Puzzle.png",
-
'Copyedit',
+
    "/images/thumb/3/36/Logo_Redesign_Running_Intro.png/150px-Logo_Redesign_Running_Intro.png",
-
'Linkfix',
+
    "/images/7/70/Logo_Redesign_Then_and_Now.png",
-
'Reverting vandalism',
+
    "/images/thumb/9/93/Logo_Redesign_Weclome_Back.png/150px-Logo_Redesign_Weclome_Back.png",
-
'Formatting source text'
+
    "/images/d/d5/Logo_Redesign_WikiGlobe.png",
-
 
+
    "/images/5/51/Logo_Redesign_World_LighterGrad.png"
-
 
+
  );
-
 
+
   var i = Math.floor(Math.random() * logos.length);
-
];
+
  document.getElementById('p-logo').getElementsByTagName('a')[0].style.setProperty("background-image", "url(" + logos[i] + ")", "important");
-
 
+
}
-
 
+
addOnloadHook(changelogo);
-
// expiration time span for history cookies in seconds
+
-
cookieExpireSec = (365 * 24 * 60 * 60);
+
-
 
+
-
 
+
-
// enable cursor horizontal position memory
+
-
cursorMemory = true;
+
-
 
+
-
 
+
-
// show at least this number of lines ahead of cursor movement
+
-
scrollMargin = 1;
+
-
 
+
-
 
+
-
// show at least this number of lines ahead of cursor movement for
+
-
findMargin = 2;
+
-
 
+
-
 
+
-
// find ahead checkbox selected by default
+
-
findAheadSelected = true;
+
-
 
+
-
 
+
-
// css for change indicators
+
-
styleDelete = 'font-weight: normal; text-decoration: none; color: #ffffff; background-color: #990033;';
+
-
styleInsert = 'font-weight: normal; text-decoration: none; color: #ffffff; background-color: #009933;';
+
-
styleMoved  = 'font-weight: bold; vertical-align: text-bottom; font-size: xx-small; padding: 0; border: solid 1px;';
+
-
styleBlock  = [
+
-
 
+
-
 
+
-
      'background-color: #ffff44;',
+
-
      'background-color: #b0ff90;',
+
-
      'background-color: #ffcc99;',
+
-
      'background-color: #99ffff;',
+
-
      'background-color: #99ccff;',
+
-
      'background-color: #cc99ff;',
+
-
      'background-color: #ff99cc;',
+
-
      'background-color: #ffd040;',
+
-
      'background-color: #d0d0d0;'
+
-
 
+
-
 
+
-
 
+
-
];
+
-
 
+
-
 
+
-
// html for change indicators, {number} is replaced by the block number, {block} is replaced by the block style
+
-
htmlMovedRight  = '<input type="button" value=">" style="' + styleMoved + ' {block}">';
+
-
htmlMovedLeft  = '<input type="button" value="<" style="' + styleMoved + ' {block}">';
+
-
 
+
-
 
+
-
htmlBlockStart  = '<span style="{block}">';
+
-
htmlBlockEnd    = '</span>';
+
-
 
+
-
 
+
-
htmlDeleteStart = '<span style="' + styleDelete + '">';
+
-
htmlDeleteEnd   = '</span>';
+
-
 
+
-
 
+
-
htmlInsertStart = '<span style="' + styleInsert + '">';
+
-
htmlInsertEnd  = '</span>';
+
-
 
+
-
 
+
-
// minimal number of real words for a moved block (0 for always displaying block move indicators)
+
-
blockMinLength = 3;
+
-
 
+
-
 
+
-
// exclude identical sequence starts and endings from change marking
+
-
wordDiff = true;
+
-
 
+
-
 
+
-
// enable recursive diff to resolve problematic sequences
+
-
recursiveDiff = true;
+
-
 
+
-
 
+
-
// enable block move display
+
-
showBlockMoves = true;
+
-
 
+
-
// Installation code for editor removed as I have it running on Greasemonkey
+

Revision as of 00:52, 30 November 2006

// Adds a purge tab. Found this on Lapper's JS.
function addPurgeButton()
{
  var href = document.location.href;
  {
    var historyHref = document.getElementById( "ca-history" ).firstChild.href;
    var div = document.getElementById( "p-cactions" );
    var ul = div.getElementsByTagName( "ul" )[0];
    var newLi = document.createElement( "li" );
    var newA = document.createElement( "a" );
    newA.setAttribute( "href" , historyHref.replace( "=history" , "=purge" ) );
    var text = document.createTextNode( "purge" );
    newA.appendChild( text );
    newLi.appendChild( newA );
    ul.appendChild( newLi );
  }
}
if ( window.addEventListener ) window.addEventListener( "load" , addPurgeButton , false );
else if ( window.attachEvent ) window.attachEvent( "onload", addPurgeButton );

// generate a random logo (only works in Firefox)
// started by me, fixed by Phlip
function changelogo() {
  var logos = new Array(
    "/images/3/36/Logo_Redesign_Almost_Everybody.png",
    "/images/thumb/b/ba/Logo_Redesign_Basement.png/150px-Logo_Redesign_Basement.png",
    "/images/0/05/Logo_Redesign_Black_Background.png",
    "/images/7/7d/Logo_Redesign_Current_Updated.gif",
    "/images/thumb/3/38/Logo_Redesign_Edit_Link.png/150px-Logo_Redesign_Edit_Link.png",
    "/images/2/24/Logo_Redesign_Encyclopedia.png",
    "/images/thumb/7/74/Logo_Redesign_Everybody_Everybody.png/150px-Logo_Redesign_Everybody_Everybody.png",
    "/images/thumb/2/21/Puzzle_FCUSA.PNG/150px-Puzzle_FCUSA.PNG",
    "/images/thumb/8/8e/Logo_Redesign_Field.png/150px-Logo_Redesign_Field.png",
    "/images/b/bb/Logo_Redesign_Homestar_and_SB.gif",
    "/images/a/a8/Logo_Redesign_sbhrfield.png",
    "/images/thumb/d/d0/Logo_Redesign_Homestar_Front.PNG/150px-Logo_Redesign_Homestar_Front.PNG",
    "/images/7/74/Logo_Redesign_Homestar_Star.png",
    "/images/0/0d/Dotjoey.png",
    "/images/c/c5/Logo_Redesign_FullBody_Blur.gif",
    "/images/1/15/Logo_Redesign_Lappy.gif",
    "/images/4/42/Logo_Redesign_Official_Logo_Homestar.png",
    "/images/2/20/hrwlogoidea-fixed.png",
    "/images/3/36/Logo_Redesign_Old_New_Star.gif",
    "/images/thumb/f/f7/Logo_Redesign_Puzzle.png/150px-Logo_Redesign_Puzzle.png",
    "/images/thumb/3/36/Logo_Redesign_Running_Intro.png/150px-Logo_Redesign_Running_Intro.png",
    "/images/7/70/Logo_Redesign_Then_and_Now.png",
    "/images/thumb/9/93/Logo_Redesign_Weclome_Back.png/150px-Logo_Redesign_Weclome_Back.png",
    "/images/d/d5/Logo_Redesign_WikiGlobe.png",
    "/images/5/51/Logo_Redesign_World_LighterGrad.png"
  );
  var i = Math.floor(Math.random() * logos.length);
  document.getElementById('p-logo').getElementsByTagName('a')[0].style.setProperty("background-image", "url(" + logos[i] + ")", "important");
}
addOnloadHook(changelogo);
Personal tools