Bitcoin Forum
January 21, 2019, 09:05:45 PM *
News: Latest Bitcoin Core release: 0.17.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: BitcoinTalk Unread Post AutoUpdate  (Read 579 times)
001sonkit
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1000


Casper - A failed entrepenuer who looks like Zhou


View Profile WWW
August 29, 2013, 03:19:51 PM
 #1

Made a snippet for the Unread Post since last visit page to auto update itself without all the refresh, ugly code Tongue

At least it updates and you can catch up the latest news!

Code:
var script = document.createElement('script');
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js';
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
script.onload = function() {
setTimeout('confirminit()',1000)
};
function confirminit(){
$('#bodyarea').prepend('<br><center><a href="#" style="font-size:16px" onclick="iaa=0;ajaxinit()">Press to start autoupdates (12 seconds interval)</a><br></center>')

}
var audioElement = document.createElement('audio'); audioElement.setAttribute('src', 'http://chromaticcreative.net/bitcoin/p.mp3')
var $page
var iaa=0
function ajaxinit(){
iaa++
if(iaa>50){
$('#bodyarea').prepend('<br><br><center><a href="#" style="font-size:16px" onclick="iaa=0;ajaxinit()">Timeout, press to reconnect updates</a><br></center>');return false;
}
$.get(location.href, function(data) {
  $page = $(data);
if($('#bodyarea table.bordercolor table.bordercolor tr:nth-child(2) td:nth-child(3)').html()!=$page[42].children[2].children[0].children[0].children[0].children[0].children[0].children[1].children[2].innerHTML){
audioElement .play()
}
$('#bodyarea').html($page[42].innerHTML)
setTimeout('ajaxinit();$(".catbg span").text("Bitcoin Forum")',12000)
setTimeout('$(".catbg span").text("Until Next Update: 5")',7000)
setTimeout('$(".catbg span").text("Until Next Update: 4")',8000)
setTimeout('$(".catbg span").text("Until Next Update: 3")',9000)
setTimeout('$(".catbg span").text("Until Next Update: 2")',10000)
setTimeout('$(".catbg span").text("Until Next Update: 1")',11000)

});
}

GEMINI ACCOUNT REVIEW - Source of Funds Request
1548104745
Hero Member
*
Offline Offline

Posts: 1548104745

View Profile Personal Message (Offline)

Ignore
1548104745
Reply with quote  #2

1548104745
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1548104745
Hero Member
*
Offline Offline

Posts: 1548104745

View Profile Personal Message (Offline)

Ignore
1548104745
Reply with quote  #2

1548104745
Report to moderator
1548104745
Hero Member
*
Offline Offline

Posts: 1548104745

View Profile Personal Message (Offline)

Ignore
1548104745
Reply with quote  #2

1548104745
Report to moderator
bitspill
Legendary
*
Offline Offline

Activity: 1834
Merit: 1006



View Profile
August 29, 2013, 05:25:22 PM
 #2

Code:
$page[42].children[2].children[0].children[0].children[0].children[0].children[0].children[1].children[2].innerHTML
You weren't kidding when you said ugly code Wink

{ BitSpill }
Pages: [1]
  Print  
 
Jump to:  

Bitcointalk.org is not available or authorized for sale. Do not believe any fake listings.
Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!