200 lines
5.3 KiB
JavaScript
200 lines
5.3 KiB
JavaScript
|
/***********************************************************************************************
|
||
|
Script to swap between stylesheets
|
||
|
Written by Mark Wilton-Jones, 05/12/2002. v2.2 updated 29/04/2004 for Konqeror XHTML fix
|
||
|
************************************************************************************************
|
||
|
|
||
|
Please see http://www.howtocreate.co.uk/jslibs/ for details and a demo of this script
|
||
|
Please see http://www.howtocreate.co.uk/jslibs/termsOfUse.html for terms of use
|
||
|
*/
|
||
|
|
||
|
function getAllSheets()
|
||
|
{
|
||
|
|
||
|
if (navigator.appName == "Netscape" && navigator.appVersion[0] > "4")
|
||
|
{
|
||
|
if( !window.ScriptEngine && navigator.__ice_version )
|
||
|
{ return document.styleSheets; }
|
||
|
|
||
|
if( document.getElementsByTagName )
|
||
|
{
|
||
|
var Lt = document.getElementsByTagName('link'), St = document.getElementsByTagName('style');
|
||
|
}
|
||
|
else if( document.styleSheets && document.all )
|
||
|
{
|
||
|
var Lt = document.all.tags('LINK'), St = document.all.tags('STYLE');
|
||
|
}
|
||
|
else
|
||
|
{ return [];
|
||
|
}
|
||
|
|
||
|
for( var x = 0, os = []; Lt[x]; x++ )
|
||
|
{
|
||
|
var rel = Lt[x].rel ? Lt[x].rel : Lt[x].getAttribute ? Lt[x].getAttribute('rel') : '';
|
||
|
if( typeof( rel ) == 'string' && rel.toLowerCase().indexOf('style') + 1 )
|
||
|
{
|
||
|
os[os.length] = Lt[x];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
for( var x = 0; St[x]; x++ )
|
||
|
{
|
||
|
os[os.length] = St[x];
|
||
|
}
|
||
|
return os;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function changeStyle()
|
||
|
{
|
||
|
if (navigator.appName == "Netscape" && navigator.appVersion[0] > "4")
|
||
|
{
|
||
|
window.userHasChosen = window.MWJss;
|
||
|
for( var x = 0, ss = getAllSheets(); ss[x]; x++ )
|
||
|
{
|
||
|
if( ss[x].title )
|
||
|
{
|
||
|
ss[x].disabled = true;
|
||
|
}
|
||
|
|
||
|
for( var y = 0; y < arguments.length; y++ )
|
||
|
{
|
||
|
if( ss[x].title == arguments[y] )
|
||
|
{ ss[x].disabled = false; }
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function rememberStyle( cookieName, cookieLife )
|
||
|
{
|
||
|
if (navigator.appName == "Netscape" && navigator.appVersion[0] > "4")
|
||
|
{
|
||
|
for( var viewUsed = false, ss = getAllSheets(), x = 0; window.MWJss && ss[x]; x++ )
|
||
|
{
|
||
|
if( ss[x].disabled != MWJss[x] )
|
||
|
{
|
||
|
viewUsed = true;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if( !window.userHasChosen && !viewUsed )
|
||
|
{ return; }
|
||
|
|
||
|
for( var x = 0, outLine = '', doneYet = []; ss[x]; x++ )
|
||
|
{
|
||
|
if( ss[x].title && ss[x].disabled == false && !doneYet[ss[x].title] )
|
||
|
{
|
||
|
doneYet[ss[x].title] = true; outLine += ( outLine ? ' MWJ ' : '' ) + escape( ss[x].title );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if( ss.length )
|
||
|
{ document.cookie = escape( cookieName ) + '=' + escape( outLine ) + ';domain=.tourmentine.com' + ( cookieLife ? ';expires=' + new Date( ( new Date() ).getTime() + ( cookieLife * 86400000 ) ).toGMTString() : '' ) + ';path=/'; }
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
/*function useStyleAgain( cookieName )
|
||
|
{
|
||
|
if (navigator.appName == "Netscape" && navigator.appVersion[0] > "4")
|
||
|
{
|
||
|
for( var x = 0; x < document.cookie.split( "; " ).length; x++ )
|
||
|
{
|
||
|
var oneCookie = document.cookie.split( "; " )[x].split( "=" );
|
||
|
|
||
|
if( oneCookie[0] == escape( cookieName ) )
|
||
|
{
|
||
|
var styleStrings = unescape( oneCookie[1] ).split( " MWJ " );
|
||
|
for( var y = 0, funcStr = ''; styleStrings[y]; y++ )
|
||
|
{
|
||
|
funcStr += ( y ? ',' : '' ) + 'unescape( styleStrings[' + y + '] )';
|
||
|
}
|
||
|
eval( 'changeStyle(' + funcStr + ');' ); break;
|
||
|
}
|
||
|
}
|
||
|
window.MWJss = [];
|
||
|
for( var ss = getAllSheets(), x = 0; ss[x]; x++ )
|
||
|
{
|
||
|
MWJss[x] = ss[x].disabled;
|
||
|
}
|
||
|
}
|
||
|
}*/
|
||
|
|
||
|
function togglehelp(lang)
|
||
|
{
|
||
|
if (lang == "fr")
|
||
|
{
|
||
|
if (document.getElementById('hidehelp').value == 'Cacher Aide')
|
||
|
{
|
||
|
document.getElementById('hidehelp').value='Aide';
|
||
|
document.getElementById('wikihelp').style.visibility='hidden';
|
||
|
document.getElementById('wikihelp').style.display='none';
|
||
|
document.getElementById('wikihelp_title').style.display='none';
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
document.getElementById('hidehelp').value = 'Cacher Aide';
|
||
|
document.getElementById('wikihelp').style.visibility='visible';
|
||
|
document.getElementById('wikihelp').style.display='block';
|
||
|
document.getElementById('wikihelp_title').style.display='block';
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (document.getElementById('hidehelp').value == 'Hide Help')
|
||
|
{
|
||
|
document.getElementById('hidehelp').value='Help';
|
||
|
document.getElementById('wikihelp').style.visibility='hidden';
|
||
|
document.getElementById('wikihelp').style.display='none';
|
||
|
document.getElementById('wikihelp_title').style.display='none';
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
document.getElementById('hidehelp').value = 'Hide Help';
|
||
|
document.getElementById('wikihelp').style.visibility='visible';
|
||
|
document.getElementById('wikihelp').style.display='block';
|
||
|
document.getElementById('wikihelp_title').style.display='block';
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function clockTick()
|
||
|
{
|
||
|
currentTime = new Date();
|
||
|
document.clock.value = " "+currentTime;
|
||
|
document.clock.blur();
|
||
|
setTimeout("clockTick()", 1000);
|
||
|
}
|
||
|
|
||
|
|
||
|
/*By JavaScript Kit
|
||
|
http://javascriptkit.com
|
||
|
Credit MUST stay intact for use
|
||
|
*/
|
||
|
|
||
|
function show2(){
|
||
|
if (!document.all&&!document.getElementById)
|
||
|
return
|
||
|
thelement=document.getElementById? document.getElementById("tick2"): document.all.tick2
|
||
|
var Digital=new Date()
|
||
|
var hours=Digital.getHours()
|
||
|
var minutes=Digital.getMinutes()
|
||
|
var seconds=Digital.getSeconds()
|
||
|
var dn="PM"
|
||
|
if (hours<12)
|
||
|
dn="AM"
|
||
|
if (hours>12)
|
||
|
hours=hours-12
|
||
|
if (hours==0)
|
||
|
hours=12
|
||
|
if (minutes<=9)
|
||
|
minutes="0"+minutes
|
||
|
if (seconds<=9)
|
||
|
seconds="0"+seconds
|
||
|
var ctime=hours+":"+minutes+":"+seconds+" "+dn
|
||
|
thelement.innerHTML="<b style='font-size:14;color:blue;'>"+ctime+"</b>"
|
||
|
setTimeout("show2()",1000)
|
||
|
}
|
||
|
window.onload=show2
|