It appears you have not yet registered with our community. To register for free click here
DIR Explorers
       

How do I / Site Help Baffled by anything on the site, ask the admins how to make DIRX work for you.

Reply
 
Thread Tools
Old November 24th, 2007, 10:50 PM   #1 (permalink)
tobi(Offline)
New Member
 
tobi's Avatar
 

Join Date: Oct 2006
Location: Germany
Posts: 40
tobi is on a distinguished road

Firefox and Greasemonkey: Opening new threads

Hi all,

Since I am a lazy bum and like my machine to do things for me, I came up with a little script which allows me to have all new threads opened in new windows/tabs, and I'd like to share that here - but let me explain:

The Mozilla family of browsers (Firefox and Seamonkey) can be enhanced with an extension called Greasemonkey (link -->) Greasespot which allows you to do a bunch of fancy things. These things are done by installing scripts, which have been written by other people, or yourself.

I found myself quite often hitting the "New Posts" menu link and then go through all those threads with new entries, hitting each of those pesky little icons with a middle mouse click, so opening it in a new tab of my Firefox browser.

This is tedious.

If you download and install Greasemonkey from the above link, you can then install the attached script by either copying it into the directory where your scripts reside (using the Greasemonkey script naming convention, name.user.js - and then enabling the script in the "manage user scripts" menu), or by "adding a new script" and simply copy/pasting the script into the editor.

If all goes well, it is supposed to create a new link at the top of the new post search results page (cleverly called "Open all new threads in new Windows") - and once you click it, all new threads on this page are each opened in a new window/tab, depending on your FF-settings.

Here it seems to do its job nicely, but I'd be very interested in how it works for others.

HTH, enjoy, greets, tobi...

Code:
// ==UserScript==
// @name          Dir Explorers: Open new threads
// @namespace     http://tobihofmann.de/
// @description   Opens all those new threads in a new window/tab each
// @include       http://www.direxplorers.com/search.php?searchid=*
// @include       http://*.direxplorers.com/search.php?searchid=*
// ==/UserScript==

function embedFunction(s) {
document.body.appendChild(document.createElement('script')).innerHTML=s.toString().replace(/([\s\S]*?return;){2}([\s\S]*)}/,'$2');
}

function openallnewthreadsDirX() {

var allLinks, thisLink;
allLinks = document.evaluate(
    "//a[starts-with(@id,'thread_gotonew')]",
    document,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);
for (var i = 0; i < allLinks.snapshotLength; i++) {
    thisLink = allLinks.snapshotItem(i);
    // do something with thisLink
    window.open(thisLink);
   }
}

embedFunction(openallnewthreadsDirX);

// add banner with download link

var my_banner = document.createElement("div");
my_banner.innerHTML = '<div style="border-bottom: 1px solid #CCCCCC; margin-bottom: 10px; font-size: small; background-color: #FF0000; color: #FFFFFF;">' +
    '<p style="margin:0px;padding: 5px;text-align:center;">' +
    '<a href="javascript:openallnewthreadsDirX()" style="color:#FFFFFF; font-weight:bold; font-size:10px;">Open all new threads in new Windows</a>' +
    '</p></div>';
document.body.insertBefore(my_banner, document.body.firstChild);
 
Digg this Post!Add Post to del.icio.us
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


All times are GMT +1. The time now is 01:57 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0 RC4
DirExplorers.Com ©2005 - 2008
All rights reserved, no republishing of content without written permission.
By using this website you have agreed to our Terms & Conditions of Use

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48