Bitcoin Forum
July 14, 2024, 10:18:18 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [Bookmarklet] Open all "new" links (watchlist, unread, new replies, etc)  (Read 1053 times)
nimda (OP)
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1000


0xFB0D8D1534241423


View Profile
January 24, 2013, 01:03:32 AM
 #1

Meta seemed an appropriate place, as this is "discussion about the Bitcoin Forum," but I'm half-expecting this topic to be moved.

A bookmarklet is a small piece of javascript inside a bookmark. All modern browsers can use them.
I made one to open all "new" links on the watchlist page. Coupled with the right browser settings to make pop-ups appear in tabs, (or for Chrome, the One Window extension) it makes reading much easier.
Code:
var ls = new Array();
var ln = document.links.length;
var h; var n;
for(i=0;i<ln;i++){
h = document.links[i].href;
if(h.indexOf('new')>0){
ls.push(h);
}
}
if (ls.length > 6){
n = prompt("How many links?", 6);
}else{
n = ls.length;
}
for(i=0;i<n;i++){
window.open(ls[i]);
}
void(0);
Condensed:
Code:
javascript:(function(){var%20ls=new%20Array();var%20ln=document.links.length;var%20h;var%20n;for(i=0;i%3Cln;i++){h=document.links[i].href;if(h.indexOf('new')%3E0){ls.push(h);}}if(ls.length%20%3E%2010){n=prompt(%22How%20many%20links%3F%22,10);}else{n=ls.length;}for(i=0;i%3Cn;i++){window.open(ls[i]);}void(0);})();
Obviously I didn't spend any time optimizing, prettifying, or anything of that sort. It works.
World
Hero Member
*****
Offline Offline

Activity: 743
Merit: 500



View Profile
January 24, 2013, 02:04:18 AM
 #2

useful thank you

Supporting people with beautiful creative ideas. Bitcoin is because of the developers,exchanges,merchants,miners,investors,users,machines and blockchain technologies work together.
nimda (OP)
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1000


0xFB0D8D1534241423


View Profile
February 25, 2013, 11:05:39 PM
 #3

Probably should reload the watchlist afterward.
Code:
javascript:(function(){var ls=new Array();var ln=document.links.length;var h;var n;for(i=0;i<ln;i++){h=document.links[i].href;if(h.indexOf('new')>0){ls.push(h);}}if(ls.length > 8){n=prompt("How many links%3F",8);}else{n=ls.length;}for(i=0;i<n;i++){window.open(ls[i]);}location.reload();void(0);})();
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!