News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Snow Flakes (Or What) :D

Started by glc, November 30, 2008, 04:37:49 PM

Previous topic - Next topic

glc

Ok, I want on my forum on the occasion of Christmas, New Year holidays put some little things that I would get a Christmas atmosphere
That means I wanted since I have seen in a couple of forums, to put the snow flakes that fall on the forum ... You know what I'm talking abouth ...

and where I could not get the flakes to be put to the forum

Dekudude

http://dynamicdrive.com/dynamicindex3/snow.htm

Follow those instructions. You will have to edit the forum template files, but that's not too hard. :) You can do it! If you run into any problems, let me know.

glc

ooo man tny very much.. I will not close topic till I manage this to work ;)

tny again

Doc.Blade

which file(s) in particular do you need to edit?

Thank you in advance for any help you can offer :)

Doc

Doc.Blade

I have tried this on the index.template.php file for my theme, and keep getting parse errors.

Not sure if this code works with the current version of SMF.  Anyone got anything that works, or got this one to work?

I am using SMF 1.1.7 and the Blue Rose theme.

Cheers

Doc

tampaba1

www.lightamillioncandles.com
Light a candle against online child abuse!!

glc

I still get that parse error :S

this code I use

<script type="text/javascript">

/******************************************
* Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
* Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code
* Last updated Nov 9th, 05' by DD. This notice must stay intact for use
******************************************/
 
  //Configure below to change URL path to the snow image
  var snowsrc="samp/Themes/gold/images/snow3.gif"
  // Configure below to change number of snow to render
  var no = 15;
  // Configure whether snow should disappear after x seconds (0=never):
  var hidesnowtime = 0;
  // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
  var snowdistance = "pageheight";

///////////Stop Config//////////////////////////////////

  var ie4up = (document.all) ? 1 : 0;
  var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

   function iecompattest(){
   return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
   }

  var dx, xp, yp;    // coordinate and position variables
  var am, stx, sty;  // amplitude and step variables
  var i, doc_width = 800, doc_height = 600;
 
  if (ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up) {
    doc_width = iecompattest().clientWidth;
    doc_height = iecompattest().clientHeight;
  }

  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();
  snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "samp/Themes/gold/images/snow3.gif" : snowsrc
  for (i = 0; i < no; ++ i) { 
    dx[i] = 0;                        // set coordinate variables
    xp[i] = Math.random()*(doc_width-50);  // set position variables
    yp[i] = Math.random()*doc_height;
    am[i] = Math.random()*20;         // set amplitude variables
    stx[i] = 0.02 + Math.random()/10; // set step variables
    sty[i] = 0.7 + Math.random();     // set step variables
      if (ie4up||ns6up) {
      if (i == 0) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://dynamicdrive.com\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>");
      } else {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
      }
    }
  }

  function snowIE_NS6() {  // IE and NS6 main animation function
    doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
      doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp[i] += sty[i];
      if (yp[i] > doc_height-50) {
        xp[i] = Math.random()*(doc_width-am[i]-30);
        yp[i] = 0;
        stx[i] = 0.02 + Math.random()/10;
        sty[i] = 0.7 + Math.random();
      }
      dx[i] += stx[i];
      document.getElementById("dot"+i).style.top=yp[i]+"px";
      document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px"; 
    }
    snowtimer=setTimeout("snowIE_NS6()", 10);
  }

   function hidesnow(){
      if (window.snowtimer) clearTimeout(snowtimer)
      for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
   }
     

if (ie4up||ns6up){
    snowIE_NS6();
      if (hidesnowtime>0)
      setTimeout("hidesnow()", hidesnowtime*1000)
      }

</script>

Kermit

try to put your code between the echo' ';

also

echo'
your code
';
My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

glc

nottin happend... now I have bigger error than parse one ... :S


Kermit

index.template.php

Code (find) Select

</head>
<body>';


Code (add after) Select

echo'
<script type="text/javascript">

/******************************************
* Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
* Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code
* Last updated Nov 9th, 05' by DD. This notice must stay intact for use
******************************************/

  //Configure below to change URL path to the snow image
  var snowsrc="', $settings['images_url'], '/snow3.gif"
  // Configure below to change number of snow to render
  var no = 15;
  // Configure whether snow should disappear after x seconds (0=never):
  var hidesnowtime = 0;
  // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
  var snowdistance = "pageheight";

///////////Stop Config//////////////////////////////////

  var ie4up = (document.all) ? 1 : 0;
  var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

   function iecompattest(){
   return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
   }

  var dx, xp, yp;    // coordinate and position variables
  var am, stx, sty;  // amplitude and step variables
  var i, doc_width = 800, doc_height = 600;

  if (ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up) {
    doc_width = iecompattest().clientWidth;
    doc_height = iecompattest().clientHeight;
  }

  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();
  snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "samp/Themes/gold/images/snow3.gif" : snowsrc
  for (i = 0; i < no; ++ i) {
    dx[i] = 0;                        // set coordinate variables
    xp[i] = Math.random()*(doc_width-50);  // set position variables
    yp[i] = Math.random()*doc_height;
    am[i] = Math.random()*20;         // set amplitude variables
    stx[i] = 0.02 + Math.random()/10; // set step variables
    sty[i] = 0.7 + Math.random();     // set step variables
      if (ie4up||ns6up) {
      if (i == 0) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://dynamicdrive.com\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>");
      } else {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
      }
    }
  }

  function snowIE_NS6() {  // IE and NS6 main animation function
    doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
      doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp[i] += sty[i];
      if (yp[i] > doc_height-50) {
        xp[i] = Math.random()*(doc_width-am[i]-30);
        yp[i] = 0;
        stx[i] = 0.02 + Math.random()/10;
        sty[i] = 0.7 + Math.random();
      }
      dx[i] += stx[i];
      document.getElementById("dot"+i).style.top=yp[i]+"px";
      document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";
    }
    snowtimer=setTimeout("snowIE_NS6()", 10);
  }

   function hidesnow(){
      if (window.snowtimer) clearTimeout(snowtimer)
      for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
   }
     

if (ie4up||ns6up){
    snowIE_NS6();
      if (hidesnowtime>0)
      setTimeout("hidesnow()", hidesnowtime*1000)
      }

</script>';



snow3.gif should be moved into images directory
My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

EdwardR

I'm not sure if this is relevant but a good feature to make this buzzing add-on even better would be to allow members to turn it off. Just a thought... Moment of randomness over  :-X

Ed
You got the best of me ... Now I'm losing it .. Oh Oh Oh la la la oh oh!

glc

#11
Quote from: Duncan85 on December 02, 2008, 07:34:20 AM
index.template.php

Code (find) Select

</head>
<body>';


Code (add after) Select

echo'
<script type="text/javascript">

/******************************************
* Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
* Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code
* Last updated Nov 9th, 05' by DD. This notice must stay intact for use
******************************************/

  //Configure below to change URL path to the snow image
  var snowsrc="', $settings['images_url'], '/snow3.gif"
  // Configure below to change number of snow to render
  var no = 15;
  // Configure whether snow should disappear after x seconds (0=never):
  var hidesnowtime = 0;
  // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
  var snowdistance = "pageheight";

///////////Stop Config//////////////////////////////////

  var ie4up = (document.all) ? 1 : 0;
  var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

   function iecompattest(){
   return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
   }

  var dx, xp, yp;    // coordinate and position variables
  var am, stx, sty;  // amplitude and step variables
  var i, doc_width = 800, doc_height = 600;

  if (ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up) {
    doc_width = iecompattest().clientWidth;
    doc_height = iecompattest().clientHeight;
  }

  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();
  snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "samp/Themes/gold/images/snow3.gif" : snowsrc
  for (i = 0; i < no; ++ i) {
    dx[i] = 0;                        // set coordinate variables
    xp[i] = Math.random()*(doc_width-50);  // set position variables
    yp[i] = Math.random()*doc_height;
    am[i] = Math.random()*20;         // set amplitude variables
    stx[i] = 0.02 + Math.random()/10; // set step variables
    sty[i] = 0.7 + Math.random();     // set step variables
      if (ie4up||ns6up) {
      if (i == 0) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://dynamicdrive.com\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>");
      } else {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
      }
    }
  }

  function snowIE_NS6() {  // IE and NS6 main animation function
    doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
      doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp[i] += sty[i];
      if (yp[i] > doc_height-50) {
        xp[i] = Math.random()*(doc_width-am[i]-30);
        yp[i] = 0;
        stx[i] = 0.02 + Math.random()/10;
        sty[i] = 0.7 + Math.random();
      }
      dx[i] += stx[i];
      document.getElementById("dot"+i).style.top=yp[i]+"px";
      document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";
    }
    snowtimer=setTimeout("snowIE_NS6()", 10);
  }

   function hidesnow(){
      if (window.snowtimer) clearTimeout(snowtimer)
      for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
   }
     

if (ie4up||ns6up){
    snowIE_NS6();
      if (hidesnowtime>0)
      setTimeout("hidesnow()", hidesnowtime*1000)
      }

</script>';



snow3.gif should be moved into images directory

Ooo thats another thing... all thos people say that I must put code after <body> tag not after that you post...
One question...
images direcotry of them ???

i'll try that ;)

Quote from: EdwardR on December 02, 2008, 08:18:54 AM
I'm not sure if this is relevant but a good feature to make this buzzing add-on even better would be to allow members to turn it off. Just a thought... Moment of randomness over  :-X

Ed
That was grat idea, can anyone make package of this ???

kizley

i m folloowing this topic ,i also need this feature :=)

glc

#13
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in .../Themes/ice_Stars_En/index.template.php on line 178

169: // ]]></script>
170: </head>
171: <body>';
172: echo'
173: <script type="text/javascript">
174:
175: /******************************************
176: * Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
177: * Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code

178: * Last updated Nov 9th, 05' by DD. This notice must stay intact for use

179: ******************************************/
180: 
181:   //Configure below to change URL path to the snow image
182:   var snowsrc="', $settings['images_url'], '/snow3.gif"


I got i 178 line ERROR :S ??


when I fix 178 I get another error on 266 :S

this isn't working :S



for holidays I am using Ice_Star_EN theme..
I put snow3.gif in imgaes direcotory of theme...
I have put cod exactly that you said in your post

And ZERO ... :S

Kermit

try this

index.template.php

Code (find) Select

</head>
<body>';



Code (add after) Select

echo'<SCRIPT type="text/javascript">
/******************************************
* Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
* Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code
* Last updated Nov 9th, 05\' by DD. This notice must stay intact for use
******************************************/
 
var snowsrc="', $settings['images_url'], '/snow3.gif"
var no = 10;
var hidesnowtime = 0;
var snowdistance = "windowheight";

var ie4up = (document.all) ? 1 : 0;
var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

function iecompattest()
{
   return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

var dx, xp, yp;
var am, stx, sty;
var i, doc_width = 800, doc_height = 600;
 
if (ns6up)
{
   doc_width = self.innerWidth;
   doc_height = self.innerHeight;
}
else
if (ie4up)
{
   doc_width = document.body.clientWidth;
   doc_height = document.body.clientHeight;
}

dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();

for (i = 0; i < no; ++ i)

   dx[i] = 0;
   xp[i] = Math.random()*(doc_width-50);
   yp[i] = Math.random()*doc_height;
   am[i] = Math.random()*20;
   stx[i] = 0.02 + Math.random()/10;
   sty[i] = 0.7 + Math.random();
   if (ie4up||ns6up)
   {
      if (i == 0)
      {
         document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src=\'"+snowsrc+"\' border=\"0\"><\/a><\/div>");
      }
      else
      {
         document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src=\'"+snowsrc+"\' border=\"0\"><\/a><\/div>");
      }
   }
}

function snowIE_NS6()
{
   doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
   doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
   for (i = 0; i < no; ++ i)
   {
      yp[i] += sty[i];
      if (yp[i] > doc_height-50)
      {
         xp[i] = Math.random()*(doc_width-am[i]-30);
         yp[i] = 0;
         stx[i] = 0.02 + Math.random()/10;
         sty[i] = 0.7 + Math.random();
      }
      dx[i] += stx[i];
      document.getElementById("dot"+i).style.top=yp[i]+"px";
      document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px"; 
   }
   snowtimer=setTimeout("snowIE_NS6()", 10);
}

function hidesnow()
{
   if (window.snowtimer) clearTimeout(snowtimer)
      for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
}


if (ie4up||ns6up)
{
   snowIE_NS6();
   if (hidesnowtime>0)
      setTimeout("hidesnow()", hidesnowtime*1000)
}

</SCRIPT>';



snow3.gif should be moved into images directory of your custom theme
My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

glc

#15
In my language I will describe my happines


JOOJ SRCE MOJE VEOMA HVALA NA POMOCI ;D hjehe


translated: ooh my heart ( sounds little gay :D ) tny very much on help

ITS WORKING YEEA


This working only in first section of forum thill first board...

flakes don't fall on all sections of forum ??

why **

Doc.Blade

Love your work Duncan85, you are a dead set legend!

Worked perfectly first time!

Thank you so much, i really appreciate it!

Doc

W. Riker

Do you all have problems with very slow upload of page after adding this "application"?

tanny

hmmm

the problem is that forum will be slower and  the CPU of Pc will increase to 100% with All Browsers IE/FF/CH/SF/


tanny

tampaba1

Quote from: tanny on December 13, 2008, 05:22:10 AM
hmmm

the problem is that forum will be slower and  the CPU of Pc will increase to 100% with All Browsers IE/FF/CH/SF/


tanny
If your forum seems to be running slower it's because your browser isn't reading the java script effectively. There are other means to accomplish the effect such as using jquery or mootools, you just have to search for them.

As for your the cpu of your pc jumping to 100% with all your browsers, I would check my computer out to see what else is going on. Granted FF is a power hog, and IE isn't much better but, I never have that much of an increase with other browsers.
www.lightamillioncandles.com
Light a candle against online child abuse!!

RustyBarnacle

On most java based snow effects I see my CPU usage go to 50%

tampaba1

Quote from: RustyBarnacle on December 14, 2008, 02:22:07 AM
On most java based snow effects I see my CPU usage go to 50%
CPU usage going up to 50% is within the norm but, 100% would concern me.
www.lightamillioncandles.com
Light a candle against online child abuse!!

fyndler

Only get template parse error :/ were should it be ? i tryed after body wont work :(

Thanks


// The main sub template above the content.
function template_main_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;

// Show right to left and the character set for ease of translating.
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '><head>
<meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
<meta name="description" content="', $context['page_title'], '" />', empty($context['robot_no_index']) ? '' : '
<meta name="robots" content="noindex" />', '
<meta name="keywords" content="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" />
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js?fin11"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "', $settings['theme_url'], '";
var smf_images_url = "', $settings['images_url'], '";
var smf_scripturl = "', $scripturl, '";
var smf_iso_case_folding = ', $context['server']['iso_case_folding'] ? 'true' : 'false', ';
var smf_charset = "', $context['character_set'], '";
// ]]></script>
<title>', $context['page_title'], '</title>';

// The ?fin11 part of this link is just here to make sure browsers don't cache it wrongly.
echo '
<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css?fin11" />
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/print.css?fin11" media="print" />';

/* Internet Explorer 4/5 and Opera 6 just don't do font sizes properly. (they are big...)
Thus, in Internet Explorer 4, 5, and Opera 6 this will show fonts one size smaller than usual.
Note that this is affected by whether IE 6 is in standards compliance mode.. if not, it will also be big.
Standards compliance mode happens when you use xhtml... */
if ($context['browser']['needs_size_fix'])
echo '
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/fonts-compat.css" />';

// Show all the relative links, such as help, search, contents, and the like.
echo '
<link rel="help" href="', $scripturl, '?action=help" target="_blank" />
<link rel="search" href="' . $scripturl . '?action=search" />
<link rel="contents" href="', $scripturl, '" />';

// If RSS feeds are enabled, advertise the presence of one.
if (!empty($modSettings['xmlnews_enable']))
echo '
<link rel="alternate" type="application/rss+xml" title="', $context['forum_name'], ' - RSS" href="', $scripturl, '?type=rss;action=.xml" />';

// If we're viewing a topic, these should be the previous and next topics, respectively.
if (!empty($context['current_topic']))
echo '
<link rel="prev" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=prev" />
<link rel="next" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=next" />';

// If we're in a board, or a topic for that matter, the index will be the board's index.
if (!empty($context['current_board']))
echo '
<link rel="index" href="' . $scripturl . '?board=' . $context['current_board'] . '.0" />';

// We'll have to use the cookie to remember the header...
if ($context['user']['is_guest'])
{
$options['collapse_header'] = !empty($_COOKIE['upshrink']);
$options['collapse_header_ic'] = !empty($_COOKIE['upshrinkIC']);
}

// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'], '

<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var current_header = ', empty($options['collapse_header']) ? 'false' : 'true', ';

function shrinkHeader(mode)
{';

// Guests don't have theme options!!
if ($context['user']['is_guest'])
echo '
document.cookie = "upshrink=" + (mode ? 1 : 0);';
else
echo '
smf_setThemeOption("collapse_header", mode ? 1 : 0, null, "', $context['session_id'], '");';

echo '
document.getElementById("upshrink").src = smf_images_url + (mode ? "/upshrink2.gif" : "/upshrink.gif");

document.getElementById("upshrinkHeader").style.display = mode ? "none" : "";
document.getElementById("upshrinkHeader2").style.display = mode ? "none" : "";

current_header = mode;
}
// ]]></script>';

// the routine for the info center upshrink
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var current_header_ic = ', empty($options['collapse_header_ic']) ? 'false' : 'true', ';

function shrinkHeaderIC(mode)
{';

if ($context['user']['is_guest'])
echo '
document.cookie = "upshrinkIC=" + (mode ? 1 : 0);';
else
echo '
smf_setThemeOption("collapse_header_ic", mode ? 1 : 0, null, "', $context['session_id'], '");';

echo '
document.getElementById("upshrink_ic").src = smf_images_url + (mode ? "/expand.gif" : "/collapse.gif");

document.getElementById("upshrinkHeaderIC").style.display = mode ? "none" : "";

current_header_ic = mode;
}
// ]]></script>

</head>
<body>
<div class="wrapper">
<div id="hdr-l">
<div id="hdr-r">
<div id="header">
<div id="time">', $context['current_time'],'</div>
<div id="searcharea">';
echo '
<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
<input type="text" name="search" value="', $txt[182], '..." onfocus="this.value = \'\';" onblur="if(this.value==\'\') this.value=\'', $txt[182], '...\';" /> ';

// Search within current topic?
if (!empty($context['current_topic']))
echo '
<input type="hidden" name="topic" value="', $context['current_topic'], '" />';

// If we're on a certain board, limit it to this board ;).
elseif (!empty($context['current_board']))
echo '
<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

echo '
</form>

glc

Quote from: tampaba1 on December 14, 2008, 01:19:37 AM
Quote from: tanny on December 13, 2008, 05:22:10 AM
hmmm

the problem is that forum will be slower and  the CPU of Pc will increase to 100% with All Browsers IE/FF/CH/SF/


tanny
If your forum seems to be running slower it's because your browser isn't reading the java script effectively. There are other means to accomplish the effect such as using jquery or mootools, you just have to search for them.

As for your the cpu of your pc jumping to 100% with all your browsers, I would check my computer out to see what else is going on. Granted FF is a power hog, and IE isn't much better but, I never have that much of an increase with other browsers.
it isn't metter of your broswer, when I'm running script, my host alerts me that CPU is VERY HIGH, so it's bigger problem than browser javascrript

City Builder

Before I add this to my websites forums, what was the end result, was it that there is an issue with the host running high cpu power when this snow script is active or not?

The only thing I could come up with in my own mind is maybe that the browser continually calls to the server to get the snow image and the server simply responds, "here it is, it's not moved, go get it if you are not caching it already" (laugh - or something like that).

Anyway, I'd like to apply a snowflake system to my site for the rest of the holiday season so if this one is an issue please point me to a more relative one that might not be or just let everybody know that this one is not an issue since the last post in the thread seemed to say that running this script caused their host to tell them that the CPU usage on the server was high when they run this script on their forum.

Thanks,

P.S. Yes, I know it's an 10 month old thread, but it is relative to me for this holiday season as it's the one that popped up when I was looking to put snowflakes into my forum for the holiday so please excuse the necro.

RustyBarnacle

The issue wasn't server side.  The issue was with users that had under powered computers and java script using way too much of their CPU time.

City Builder

Quote from: RustyBarnacle on December 26, 2009, 08:15:17 PM
The issue wasn't server side.  The issue was with users that had under powered computers and java script using way too much of their CPU time.
Okay, I was only going by the last response in this thread:
Quoteit isn't metter of your broswer, when I'm running script, my host alerts me that CPU is VERY HIGH, so it's bigger problem than browser javascrript
which seemed to intimate that his web host was telling him that his cpu usage was very high.  Which personally I found rather strange since the server only need spit out the html code of the page the snow is on to the browser not actually do much else with it if I understand it correctly, so thought it was strange but felt it best to ask.

Thanks for the reply.

Arantor

All these scripts add load to the index.template.php meaning the server still has to work harder to process it, doubly so if the script in question loads images from your server.

Advertisement: