find out how fast is the processor on client side

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pippo
    New Member
    • May 2007
    • 2

    #1

    find out how fast is the processor on client side

    browsing the web, I made a site with several slideshows, these are with a lot of big pics (610x400), in order not to clog the stream, I had to limit the preloads of images to just 3 of them at time,(actually when the shows start are 3, then 2 of them, in case you change direction), I put some fade effect too, that's fine with not too fast processer: the fade in works, with dual core instead everything run so fast that the pics is visible immediatly.If I rise the timeout to make the effect visible, on slower computer it takes too long.
    it' not too bad, but I wonder if there is a way to find out how fast the client computers runs, this way I could just put one "if" to change the speed.
    thanks
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    You have posted this question in the Articles section. I am moving it to the Javascript forum.

    ADMIN

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      You shouldn't need to do that. If you post some code, it might help so we can see how you're coding the fade.

      Comment

      • pippo
        New Member
        • May 2007
        • 2

        #4
        Originally posted by acoder
        You shouldn't need to do that. If you post some code, it might help so we can see how you're coding the fade.
        hope I posted this on the right section
        you may guess, I'm not too good at coding, but hope to find a way

        Code:
        //orologio
        var timerID = null;
        var timerRunning = false;
        var timeValue = 400; 
        var count = 0;
        var finish = false;
        direz="";
        image00 = new Image(); image00.src='../../../imagebar/image-00.gif';
        image01 = new Image(); image01.src='../../../imagebar/image-01.gif';
        image02 = new Image(); image02.src='../../../imagebar/image-02.gif';
        image03 = new Image(); image03.src='../../../imagebar/image-03.gif';
        image04 = new Image(); image04.src='../../../imagebar/image-04.gif';
        image05 = new Image(); image05.src='../../../imagebar/image-05.gif';
        image06 = new Image(); image06.src='../../../imagebar/image-06.gif';
        image07 = new Image(); image07.src='../../../imagebar/image-07.gif';
        image08 = new Image(); image08.src='../../../imagebar/image-08.gif';
        image09 = new Image(); image09.src='../../../imagebar/image-09.gif';
        image10 = new Image(); image10.src='../../../imagebar/image-10.gif';
        forw1 = new Image(); forw1.src='../../immagini/rollover/slideava.gif'	
        bacw1 = new Image(); bacw1.src='../../immagini/rollover/slideind.gif';
        forwno = new Image(); forwno.src='../../immagini/rollover/slideavano.gif'	
        bacwno = new Image(); bacwno.src='../../immagini/rollover/slideindno.gif';	
        tu="you have"
        vedi="pictures to see"
        stato= null;
        visteava=0;
        visteind=0;
        var lunga;
        var sezione;
        var numpagina;
        function increment() {
        count += 1;
        if (direz == "ava"){
            if (count == 0)
        {document.images.barra.src=image00.src;document.images.avanti.src=forw1.src;}
        	if (count == 1)
        {document.images.barra.src=image01.src;document.images.avanti.src=forwno.src;}
        	if (count == 2)
        {document.images.barra.src=image02.src;document.images.avanti.src=forw1.src;}
        	if (count == 3) {document.images.barra.src=image03.src;document.images.avanti.src=forwno.src;}
        	if (count == 4) {document.images.barra.src=image04.src;document.images.avanti.src=forw1.src;}
        	if (count == 5) {document.images.barra.src=image05.src;document.images.avanti.src=forwno.src;}
        	if (count == 6) {document.images.barra.src=image06.src;document.images.avanti.src=forw1.src;}
        	if (count == 7) {document.images.barra.src=image07.src;document.images.avanti.src=forwno.src;}
        	if (count == 8) {document.images.barra.src=image08.src;document.images.avanti.src=forw1.src;}	
        	if (count == 9) {document.images.barra.src=image09.src;document.images.avanti.src=forwno.src;}
        	if (count == 10)
        	{document.images.barra.src=image10.src;document.images.avanti.src=forw1.src; count=-1;
           updateBar();
        	forw();}}
        if (direz == "ind"){
            if (count == 0)
        {document.images.barra.src=image10.src;document.images.indietro.src=bacw1.src;}
        	if (count == 1)
        {document.images.barra.src=image09.src;document.images.indietro.src=bacwno.src;}
        	if (count == 2)
        {document.images.barra.src=image08.src;document.images.indietro.src=bacw1.src;}
        	if (count == 3) {document.images.barra.src=image07.src;document.images.indietro.src=bacwno.src;}
        	if (count == 4) {document.images.barra.src=image06.src;document.images.indietro.src=bacw1.src;}
        	if (count == 5) {document.images.barra.src=image05.src;document.images.indietro.src=bacwno.src;}
        	if (count == 6) {document.images.barra.src=image04.src;document.images.indietro.src=bacw1.src;}
        	if (count == 7) {document.images.barra.src=image03.src;document.images.indietro.src=bacwno.src;}
        	if (count == 8) {document.images.barra.src=image02.src;document.images.indietro.src=bacw1.src;}
        	if (count == 9) {document.images.barra.src=image01.src;document.images.indietro.src=bacwno.src;}
        	if (count == 10)
        {document.images.barra.src=image00.src;document.images.indietro.src=bacw1.src; count=-0; 
        	 updateBar();
        	bacw();}}}
        function stopclock() {
        	if (timerRunning)
        		clearInterval(timerID);
        	timerRunning = false;	}
        function end() {
        	if (finish == true) {
        		stopclock();
        		window.close();}
        	else {finish = true;} }
        function startclock(){
        tuttava=tutte;
        tuttind=tutte;
        	stopclock();
        	timerID = setInterval("increment()", timeValue);
        	timerRunning = true;
        	document.images.barra.src=image00.src;}
        function updateBar(){
        stato = document.getElementById("stat");
        you = document.getElementById("still");
        more = document.getElementById("daved");
        stato1 = document.getElementById("stat1");
        you1 = document.getElementById("still1");
        more1 = document.getElementById("daved1");
        if (direz == "ava")
        {visteava=visteava+1
        davede=tuttava-visteava
        viste=visteava}
        if (direz == "ind")
        {visteind=visteind+1
        davede=tuttind-visteind
        viste=visteind}
        davede=davede+""
        if (viste >= tutte){
        davede="seen"
        vedi="all pictures"}
        if (direz == "ava"){
        document.images.indietro.src=bacwno.src;
        stato.innerHTML = davede;
        you.innerHTML = tu;
        more.innerHTML =vedi;
        stato1.innerHTML = "";
        you1.innerHTML = "";
        more1.innerHTML ="";}
        else{
        document.images.avanti.src=forwno.src;
        stato1.innerHTML = davede;
        you1.innerHTML = tu;
        more1.innerHTML =vedi;
        stato.innerHTML = "";
        you.innerHTML = "";
        more.innerHTML ="";}}
        
        //opaco    
        function initImage() {
        	imageId = 'thephoto';
        	image = document.getElementById(imageId);
        	setOpacity(image, 0);
        	image.style.visibility = "visible";
        	fadeIn(imageId,0);}
        function fadeIn(objId,opacity) {
        	if (document.getElementById) {
        		obj = document.getElementById(objId);
        		if (opacity <= 100) {
        			setOpacity(obj, opacity);
        			opacity += 10;
        //iwith tihi opacity shows the fading on slow computer, but you can barely notice on faster machine, decreasin it takes too long on the slower one, but works on the faster one
        window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 10);}}}
        function setOpacity(obj, opacity) {
        	opacity = (opacity == 100)?99.999:opacity;
        	obj.style.filter = "alpha(opacity:"+opacity+")";
        	obj.style.KHTMLOpacity = opacity/100;
        	obj.style.MozOpacity = opacity/100;
        	obj.style.opacity = opacity/100;
        	}
        //auto
        function stoppa(){
        MM_showHideLayers('sinistra','','hide','destra','','hide','copribase','','show','base','','hide','mainContentDiv','','show','downArrows','','show','upArrows','','show','scrollThumb','','show','scrollBar','','show','pagina','','hide');
        stopclock()}
        function backa(){
        avaind();
        bacw();}
        function forwa(){
        avaind();
        forw();}
        function avaind(){
        MM_showHideLayers('sinistra','','hide','destra','','hide','base','','hide');
        stopclock();}
        function perauto(mia){
        MM_showHideLayers('sinistra','','hide','destra','','show','copribase','','hide','base','','show');
        direz=mia;
        startclock();}
        function pausea(){
        MM_showHideLayers('sinistra','','hide','destra','','hide','base','','hide');
        stopclock()}
        function est(a){
        numpagina=a 
        descri.innerHTML = ((tit[a*1]).substr(3));
        lung = a.length;
        if (lung == 1){a="00"+a}
        else if (lung == 2){a="0"+a}
        punto.innerHTML = numpagina;
        prova();automatico()} 
        function prova(){
        MM_showHideLayers('base','','hide','mainContentDiv','','hide','downArrows','','hide','upArrows','','hide','scrollThumb','','hide','scrollBar','','hide','pagina','','show');
        }
        function forw(){
        MM_showHideLayers('thephoto','','hide'); 
        numpagina = numpagina * 1;
        numpagina = numpagina + 1;
        if (numpagina>tutte) 
         numpagina = 1
        automatico();}  
        function bacw(){
        MM_showHideLayers('thephoto','','hide'); 
        numpagina = numpagina * 1;
        numpagina = numpagina - 1;
        if (numpagina<1) 
         numpagina = tutte
        automatico();}  
         function automatico(){
        b=numpagina+1
        c=numpagina-1 
        if (b>tutte) 
        b = 1
        if (c<1) 
        c = tutte;
        b=b+"";
        c=c+"";
        a=numpagina+"";
        lung = a.length;
        if (lung == 1){a="00"+a}
        else if (lung == 2){a="0"+a}
        lung = b.length;
        if (lung == 1){b="00"+b}
        else if (lung == 2){b="0"+b}
        lung = c.length;
        if (lung == 1){c="00"+c}
        else if (lung == 2){c="0"+c}
        punto.innerHTML = numpagina;
        descri.innerHTML = ((tit[a*1]).substr(3));
        document.images.thephoto.src=nini+a+'.jpg';
        MM_showHideLayers('thephoto','','show');
        document.images.thephoto.src=nono+a+'.jpg';
        document.images.kkkk.src=nono+b+'.jpg';
        document.images.hhhh.src=nono+c+'.jpg';	
        initImage();
        }
        Last edited by acoder; May 11 '07, 10:11 AM. Reason: Code in tags

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          In setTimeout, the last argument is the number of milliseconds, so the reason why you can't see it is because the total time is 1/10th of a second. The old computers are probably having a problem elsewhere, not in the setTimeout. Do you want it to occur in 1 second? If so, make it 100 milliseconds (* 10 = 1 second).

          Comment

          Working...