Request: Open all threads with new posts in tabs(vBulletin)

in Ideas and script requests
Subscribe to Request: Open all threads with new posts in tabs(vBulletin) 11 posts, 3 voices



Seph_VII User

Well, my idea should be firly obvious, and(I hope) simple to write,

I'd like a script which adds a button to vBulletin 3-based fora. These fora already have a "Go to first new post" button in front of every topic with new posts since you last opened it, but for simplicity, I'd like tojust click one button to activate all the "Go to first new post" buttons, and open them in tabs.

 
gollum Scriptwright

IBDoF openInTabs This was written for a phpbbV2 site, hopefully I've embedded enough comments to help in getting started.
If you have trouble, point me to your site of choice, and I'll have a go at adapting it.

 
Seph_VII User

I must admit that I have no idea how to write a script, and I'd like for this to work. Therefore, I think I'll accept your offer and ask you to cutumize the script for this site: http://forums.e-mpire.com

Please use the PlayStation Insider skin.

 
gollum Scriptwright

Reading your request again I think this might be closer to what you wanted?

vB New Topics in Tabs

// ==UserScript==
// @name           vB New Topics
// @namespace      http://userscripts.org/forums/2/topics/1801
// @description    Open all forum new topics in tabs
// @include        http://forums.e-mpire.com/forumdisplay.php*
// ==/UserScript==

var newposts = new Array();
var lnks = document.getElementById('threadslist').getElementsByTagName('a');
for (var i=0; i < lnks.length; i++) {
  if (/showthread.php\?goto=newpost/.test(lnks[i].href)) {
    newposts.push(lnks[i].href);
  }
}

// DON'T DISPLAY IF NO NEW POSTS IN FORUM
if (!newposts.length) return;
var btn = document.getElementById('inlinemodform').getElementsByTagName('td')[0].appendChild(document.createElement('button'));
btn.innerHTML = "Read ALL new posts";
btn.style.marginLeft = '10px';
btn.style.position = 'relative';
btn.style.top = '-5px';
btn.addEventListener("click",
  function(e) {
    for (var i=0; i < newposts.length; i++) {
      GM_openInTab(newposts[i]);
      e.preventDefault();
    }
  }
, false);

 
Seph_VII User

Thanks, it works great :D

Not really that important, but it doesn't always mark all the threads it opens. Is there any way to make it activate the "mark all threads as read" button when used?

 
gollum Scriptwright

Hmm, a page refresh does the same job for topics in that thread.
If I click "Mark all threads as Read" doesn't that mark ALL sub-fora as read also? Is that really what you want to do? Without visiting those forum pages?

BTW: Updated script to prevent button showing on "No NEW Posts" :oops:

 
Mithrandir Scriptwright

@Seph_VIII:
Reading status is managed by cookies - the script is too fast and so the threads status won't be changed. With some help by Dr. Evil (user in german firefox-forum) i changed gollum's great script, so
- the button works with timeout (that'll nearly solve the ugly cookie problem)
- you can choose, when the button should be shown
- you can set the number of opened threads

Have a look at http://www.ardiman.de/assets/files/firefox/vbne... (button's caption is german, sorry)

@gollum: Feel free to copy the code and update your script (if you want to).

 
gollum Scriptwright

Mithrandir wrote: @Seph_VIII: Reading status is managed by cookies - the script is too fast and so the threads status won't be changed. With some help by Dr. Evil (user in german firefox-forum) i changed gollum's great script, so - the button works with timeout (that'll nearly solve the ugly cookie problem) ...

Thread-read status not being influenced by the timeout delay - on my FF(2.0.0.12), Opera(9.25), IE7 setup. Added option to turn delay off.

Mithrandir wrote: @gollum: Feel free to copy the code and update your script (if you want to).

Thanks @Mithandir, grabbed the code and updated - also made x-browser with Opera(9.25) and IE7.

 
Mithrandir Scriptwright

Nice work! Thank you.

Here's another suggestion. Please insert a var "oMode" in configuration:

var oMode = true; // =true: show first unread post, =false: show first post/beginning of thread

and change this section:

for (var i=0; i < lnks.length; i++) {
  if (/showthread.php\?goto=newpost/.test(lnks[i].href)) {
    if (oMode) {
      newposts.push(lnks[i].href);
      } else {
      newposts.push(lnks[i].href.replace(/goto=newpost&/, ""));
    }
    f++
    if (f+1 > maxlnks && maxlnks > 0) break;
  }
}

I hope this is my last idea. ;)

 
gollum Scriptwright

Mithrandir wrote:

Nice work! Thank you.

I got another suggestion. Please insert a var "oMode" in configuration:
... snip ...

I hope this is my last idea. ;)

Putting it in, plus working on settings form - ready soon

Keep the ideas comin' :lol:

 
Seph_VII User

Thanks for all the hard work, this script has turned out really well! However, it doesn't seem to appear here: http://forums.e-mpire.com/search.php?do=getnew

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel