Jump to content

es131245

Members
  • Posts

    209
  • Joined

  • Last visited

Posts posted by es131245

  1. I'm geting array of page urls from ul list.

    Then i'll have to check variables on those pages. Maybe send few other ajax requests.

    This should be done on JS.

    Ajax "success" isnt good idea becaue ajax functions are used from other libraries.

    So easiest solution is setTimeout.

  2. You can use AJAX to load page content rather than an iframe.

     

    I'm using it at the moment

    function page(url,link){$('html').append('<img src="/source/images/progress.gif" />'); $('img[src="/source/images/progress.gif"]').css({borderRadius:'15px',boxShadow:'0 0 15px blue',height:'48px',left:'50%',marginLeft:'-150px',marginTop:'-24px',opacity:0,position:'fixed',top:'50%',width:'300px'}); $('html').animate({scrollTop:$('body').offset().top},350); $('img[src="/source/images/progress.gif"]').fadeTo(500,1); $('body').fadeTo(500,.15,function() {$.ajax(((url.indexOf('?')==-1)?(url+'?ajax'):(url+'&ajax')))  .done(function(data)  {var html=$('body').html().substr(0,$('body').html().indexOf('n  </ul>')+8)+"n"+data+'  <a>'+$('body>a:last-of-type').html()+'</a>';   $('body').empty().append(html);})  .fail(function()  {var html=$('body').html().substr(0,$('body').html().indexOf('n  </ul>')+8)+"n"+'<h2>Error 404</h2>n        <h3>File not found</h3>'+"n"+'  <a>'+$('body>a:last-of-type').html()+'</a>';   $('body').empty().append(html);})  .always(function()  {tools();   links(link);   $('body').fadeTo(300,1);   $('img[src="/images/progress.gif"]').fadeTo(300,0,function()    {$('img[src="/images/progress.gif"]').remove();});     $('body>ul:first-of-type>li:last-of-type>ul>li').stop().slideUp(200,function(){$('body>ul:first-of-type>li:last-of-type>ul').css({marginTop:'-10px'});});});});}function links(from){$('a').each(function() {if(typeof($(this).attr('href'))!='undefined'&&$(this).attr('href').substr(0,1)=='#')  {$(this).unbind('click').click(function()   {$('html,body').animate({scrollTop: $($(this).attr('href')).offset().top},'slow');    return false;});}  else if(typeof($(this).attr('href'))!='undefined'&&$(this).attr('href').indexOf(':')==-1&&$(this).attr('href').indexOf('.')==-1)  {$(this).unbind('click').click(function()   {$(this).css({'textDecoration':'underline'});    page($(this).attr('href'),$(this));    return false;});}});}$(document).ready(function(){links();});

    It has a problem. Then I serfing site the content if fine but url path does not change at all.

  3. The only solution that i could think of.

    <!DOCTYPE html><html lang="en"> <head>  // HEADINGS </head> <body>  // HEADER  // NAVIGATION <div></div>  <iframe src="pages.html" style="display:none;" onload="copyContentFromIframeToDiv();"></iframe>  // FOOTER </body></html>
  4. The idea is to load "full" page only once.

    As a full page I meen title bar, navigation, content and footer.

    After loading jquery will update links to adding get parameter that will tell php to load "content" only.

    <?php if(isset($_GET)&&isset($_GET['ajax']))getContent('pages.html');?><!DOCTYPE html><html lang="en"> <head>  // HEADINGS </head> <body>  // HEADER  // NAVIGATION  <iframe src="pages.html"></iframe>  // FOOTER </body></html>

    The question is how to evade scrollbar of a iframe? Scrollbar of a body is the only allowed.

  5. First of all, i dont know anything about flash =( W3schools dont teach flash and I'm loyal to w3s.

     

    There is a flash game in internet. The game is good but its contols are terrible.

    It makes person to click rows of objects thousands of times.

     

    Is there a way in flash like "GreasyMonkey" for JS using which i can modify controls without editing the game swf file?

     

    I got an idea to do a highligthing to controls.

  6. Is this a rotating set of images or something like a framegrab of a live webcam?

    Yes it is.

     

    The browser could then get the timer to load the images in sync with the server imagefile updates.

    Images are updated by shell script on a separate machine! There aren't any timers here. All i can do is to get mtime by php then page loads for synchronization. But i don't care much about synchronization. All i want is a part of javascript/jquery code that checks if there is an newer image at all (if there is a point of loading large image at all). Script might be turned off and i need to check that.

     

    On web cam example. Javascript should check if camera works for saving watcher from loading the same image tons of times.

  7.  

    What if a browser is downloading the image when the server changes the image?

    I'm getting corrupted images in that situation, but i dont have solution for that so i going to leave it as it is.

     

     

    Maybe Ajax could be used to get all the timers synchronized?

     

    The situation is that script doent work all the time. So I just need to let js in browser know when its useless to update picture every 3 seconds. How could timer help here? There are no time dependance here.

  8. Server runs shell script that updates image on the site every 3 seconds.

    Its makes "framed image" for the site. Browser part is:

     setInterval(function(){$('#picID').attr('src','/images/URL.jpg?'+new Date().getTime());},3000);

    It works fine but update script doent work all the time. So i want to find a way for javascript to check if image on the site differ from downloaded one. Is it posible to check if it differ without downloading whole image? Like check if file size have changed?

     

    Moreover is there a "better" method of forcing image to download instead of "+new Date().getTime()"?

  9. <!DOCTYPE html><html><body><input type="text" id="first" value="0" /><input type="text" id="second" value="2" /><input type="button" onclick="check()" /><script>function check(){if( parseInt(document.getElementById('first').value) > parseInt(document.getElementById('second').value) ) alert('1>2');else alert('2>1');}</script></body></html>
×
×
  • Create New...