Clan Adverts

Sponsors

CT on Facebook

Latest Product

User Box

Anonymous
38.107.179.217
Nickname:

Password:

Security Code
Security Code
Type Security Code


PND Downloads Feed

Phpnuke Downloads
How to Delete or Reset yo...
How to Delete or Reset your PHPNuke Admin Account
Lost your admin password ?  Cant login to your admin account ?This sh...
Back Online & Stuff
Back Online & Stuff
Look at us with our nifty website back up and running… Seriousl...
How to edit the admins in...
How to edit the admins in the forums
Here is a way to make someone admin in your forums on your Evo site. I...
Demo Splash Screen
Demo Splash Screen
Ped @ Clan Themes has released a simple splash screen entrance hack. ...
Free Phpnuke Business The...
Free Phpnuke Business Theme 6
This is the 6th Business theme for Phpnuke that Clan Themes has releas...
Tricked Out Slider
Tricked Out Slider
We have seen some great new things come out of Tricked Out News and th...

Custom Work

PHP Nuke Custom Work

www.clanthemes.com :: View topic - 2 scripts, trouble!
2 scripts, trouble!

1 Replies / 1183 Views


Post new topic   Reply to topic  

   www.clanthemes.com Forum Index » Scripts

View previous topic :: View next topic


cupoftea
Reputation: 21.7 Add RepSubtract Rep
Local time: 8:57 PM
Location: Behind My Computer
belgium.gif

Spammer
Spammer

0.08 posts per day
Medals: 0

Joined: Apr 30, 2008
Last Visit: 14 Mar 2009
Posts: 113
Points: 2379 

Post 2 scripts, trouble! Posted: Sun Feb 01, 2009 5:14 pm

Hey guys,

I have added a javascript to my site, and my theme uses a script too. My script uses body onload, and the theme script uses window.onload. They don't work together, and i'd like to change that.
My script (in includes/javascript.php):
Code:
//CLOCK AND SCOLLER IN STATUSBAR
    cookiedecode($user);
    $username = $cookie[1];
    if ($username == "") {
        $username = "Anonymous";
    }
echo "<script language=\"JavaScript\">
<!-- verbergen voor niet-Javascript browsers


// definieer de tekst in de scroller
var scrtxt = \"Welcome To CupOfTea - \" +
             \"Have Fun $username!\";
var length = scrtxt.length;
var width = 100;
var pos = -(width + 2);
var devide = \"     |\";

function scroller() {

  // display the tekst uiterst rechts en wacht een beetje

  // ga een stap verder
  pos++;

  // bereken het deel van de tekst dat getoond wordt
  var scroller = \"\";
  if (pos == length) {
    pos = -(width + 2);
  }

  // Indien de tekst nog niet volledig links is aangekomen dan moeten we
  // spaties toevoegen - indien niet dan moeten we een deel van de
  // tekst afkappen (het gedeelte wat links verdwenen is)
  if (pos < 0) {
    for (var i = 1; i <= Math.abs(pos); i++) {
      scroller = scroller + \" \";}
    scroller = scroller + scrtxt.substring(0, width - i + 1);
  }
  else {
    scroller = scroller + scrtxt.substring(pos, width + pos);
  }

    var Today = new Date();
    var hours = Today.getHours();
    var min = Today.getMinutes();
    var sec = Today.getSeconds();
    var Time = ((hours > 12) ? hours - 12 :(hours == 0) ? 12 :hours);
    Time += ((min < 10) ? \":0\" : \":\") + min;
    Time += ((sec < 10) ? \":0\" : \":\") + sec;
    Time += (hours >= 12) ? \" PM\" : \" AM\";
    window.status = Time;
  window.status += devide;
  // toon de tekst in de statusbalk
  window.status += scroller;
  // wacht gedurende 100 milliseconden
  setTimeout(\"scroller()\", 100);
}

  // end hide -->
</SCRIPT> ";
//END CLOCK AND SCROLLER

The Theme script (is included using a .js file)
Code:
//In theme.php
  echo "<script language=\"javascript\" src=\"themes/Creation/clock.js\"></script>\n";

//clock.js
///////////////////////////////////////////////////////////
// "Live Clock" script (3.0)
// By Mark Plachetta (astroboy@zip.com.au)
// http://www.zip.com.au/~astroboy/liveclock/
///////////////////////////////////////////////////////////

var LC_Style=[
   "Arial",         // clock font
   "2",            // font size
   "black",         // font colour
   "white",         // background colour
   "The time is: ",   // html before time
   "",               // html after time
   130,            // clock width
   2,               // 12(1) or 24(0) hour?
   1,               // update never(0) secondly(1) minutely(2)
   3,               // no date(0) dd/mm/yy(1) mm/dd/yy(2) DDDD MMMM(3) DDDD MMMM YYYY(4)
   0,               // abbreviate days/months yes(1) no(0)
   null            // gmt offset (null to disable)
];

///////////////////////////////////////////////////////////

var LC_IE=(document.all);
var LC_NS=(document.layers);
var LC_N6=(window.sidebar);
var LC_Old=(!LC_IE && !LC_NS && !LC_N6);

var LC_Clocks=new Array();

var LC_DaysOfWeek=[
   ["Sunday","Sun"],
   ["Monday","Mon"],
   ["Tuesday","Tue"],
   ["Wednesday","Wed"],
   ["Thursday","Thu"],
   ["Friday","Fri"],
   ["Saturday","Sat"]
];

var LC_MonthsOfYear=[
   ["January","Jan"],
   ["February","Feb"],
   ["March","Mar"],
   ["April","Apr"],
   ["May","May"],
   ["June","Jun"],
   ["July","Jul"],
   ["August","Aug"],
   ["September","Sep"],
   ["October","Oct"],
   ["November","Nov"],
   ["December","Dec"]
];

var LC_ClockUpdate=[0,1000,60000];

///////////////////////////////////////////////////////////

function LC_CreateClock(c) {
   if(LC_IE||LC_N6){clockTags='<span id="'+c.Name+'" style="width:'+c.Width+'px;background-color:'+c.BackColor+'"></span>'}
   else if(LC_NS){clockTags='<ilayer width="'+c.Width+'" bgColor="'+c.BackColor+'" id="'+c.Name+'Pos"><layer id="'+c.Name+'"></layer></ilayer>'}

   if(!LC_Old){document.write(clockTags)}
   else{LC_UpdateClock(LC_Clocks.length-1)}
}

function LC_InitializeClocks(){
   LC_OtherOnloads();
   if(LC_Old){return}
   for(i=0;i<LC_Clocks.length;i++){
      LC_UpdateClock(i);
      if (LC_Clocks[i].Update) {
         eval('var '+LC_Clocks[i].Name+'=setInterval("LC_UpdateClock("+'+i+'+")",'+LC_ClockUpdate[LC_Clocks[i].Update]+')');
      }
   }
}

function LC_UpdateClock(Clock){
   var c=LC_Clocks[Clock];

   var t=new Date();
   if(!isNaN(c.GMT)){
   var offset=t.getTimezoneOffset();
   if(navigator.appVersion.indexOf('MSIE 3') != -1){offset=offset*(-1)}
      t.setTime(t.getTime()+offset*60000);
      t.setTime(t.getTime()+c.GMT*3600000);
   }
   var day=t.getDay();
   var md=t.getDate();
   var mnth=t.getMonth();
   var hrs=t.getHours();
   var mins=t.getMinutes();
   var secs=t.getSeconds();
   var yr=t.getYear();

   if(yr<1900){yr+=1900}

   if(c.DisplayDate>=3){
      md+="";
      abbrev="th";
      if(md.charAt(md.length-2)!=1){
         var tmp=md.charAt(md.length-1);
         if(tmp==1){abbrev="st"}
         else if(tmp==2){abbrev="nd"}
         else if(tmp==3){abbrev="rd"}
      }
      md+=abbrev;
   }

   var ampm="";
   if(c.Hour12==1){
      ampm="am";
      if(hrs>=12){ampm="am"; hrs-=12}
      if(hrs==0){hrs=12}
   }
   if(mins<=9){mins="0"+mins}
   if(secs<=9){secs="0"+secs}

   //var html = '<font color="'+c.FntColor+'" face="'+c.FntFace+'" size="'+c.FntSize+'">';
   var html = '<font class="copyright">';
   html+=c.OpenTags;
   html+=hrs+':'+mins;
   if(c.Update==1){html+=':'+secs}
   if(c.Hour12){html+=' '+ampm}
   if(c.DisplayDate==1){html+=' '+md+'/'+(mnth+1)+'/'+yr}
   if(c.DisplayDate==2){html+=' '+(mnth+1)+'/'+md+'/'+yr}
   if(c.DisplayDate>=3){html+=' on '+LC_DaysOfWeek[day][c.Abbreviate]+', '+md+' '+LC_MonthsOfYear[mnth][c.Abbreviate]}
   if(c.DisplayDate>=4){html+=' '+yr}
   html+=c.CloseTags;
   html+='</font>';

   if(LC_NS){
      var l=document.layers[c.Name+"Pos"].document.layers[c.Name].document;
      l.open();
      l.write(html);
      l.close();
   }else if(LC_N6||LC_IE){
      document.getElementById(c.Name).innerHTML=html;
   }else{
      document.write(html);
   }
}

function LiveClock(a,b,c,d,e,f,g,h,i,j,k,l){
   this.Name='LiveClock'+LC_Clocks.length;
   this.FntFace=a||LC_Style[0];
   this.FntSize=b||LC_Style[1];
   this.FntColor=c||LC_Style[2];
   this.BackColor=d||LC_Style[3];
   this.OpenTags=e||LC_Style[4];
   this.CloseTags=f||LC_Style[5];
   this.Width=g||LC_Style[6];
   this.Hour12=h||LC_Style[7];
   this.Update=i||LC_Style[8];
   this.Abbreviate=j||LC_Style[10];
   this.DisplayDate=k||LC_Style[9];
   this.GMT=l||LC_Style[11];
   LC_Clocks[LC_Clocks.length]=this;
   LC_CreateClock(this);
}

///////////////////////////////////////////////////////////

LC_OtherOnloads=(window.onload)?window.onload:new Function;
window.onload=LC_InitializeClocks;



also in theme.php:
Code:
  echo "<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onload=\"scroller()>"
 

Grtz, CupOfTea --- My Nuke Version: 8.0 Patched 3.5 ---  
View user's profileSend private messageSend e-mailVisit poster's websiteMSN Messenger Reply with quote

cupoftea
Reputation: 21.7 Add RepSubtract Rep
Local time: 8:57 PM
Location: Behind My Computer
belgium.gif

Spammer
Spammer

0.08 posts per day
Medals: 0

Joined: Apr 30, 2008
Last Visit: 14 Mar 2009
Posts: 113
Points: 2379 

Post 2 scripts, trouble! Posted: Tue Feb 03, 2009 3:54 pm

I've fixed it myself:

In theme.php
Code:
  echo "<script language=\"javascript\" src=\"themes/Creation/clock.js\"></script>\n";
  echo "<script language=\"javascript\">\n";
  echo "function onloads() { \n";
  echo "scroller(); \n";
  echo "LC_InitializeClocks(); \n";
  echo "}\n";
  echo "</script>\n";
  echo "<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onload=\"onloads()\">"


Removed in clock.js
Code:
window.onload=LC_InitializeClocks;
 

 
View user's profileSend private messageSend e-mailVisit poster's websiteMSN Messenger Reply with quote
Post new topic   Reply to topic  
   www.clanthemes.com Forum Index » Scripts


 
1 Replies / 1183 Views
Page 1 of 1
All times are GMT
Display posts from previous:   
 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum