Silkroad Forum Greasemonkey Script (Updated January 14th 08)

Anything related to Silkroad Online Forums. Report problems and bugs, or ask questions. Discuss latest features and additions.
User avatar
StealMySoda
Ex-Staff
Posts: 5245
Joined: Sun Sep 03, 2006 2:37 pm
Quick Reply: Yes
Location: Off Topic
Contact:

Silkroad Forum Greasemonkey Script (Updated January 14th 08)

Post by StealMySoda »

Updated January 14th 08


Greasemonkey is a Firefox extension that allows you to write scripts that alter the web pages you visit. You can use it to make a web site more readable or more usable. You can fix rendering bugs that the site owner can't be bothered to fix themselves. You can alter pages so they work better with assistive technologies that speak a web page out loud or convert it to Braille. You can even automatically retrieve data from other sites to make two sites more interconnected.

With this in mind, I decided to make a script for the forum. It started off as something that would make the job of modding for I and others easier. However as I thought it would also benefit the community at large I decided to release a version for you guys.

Features Include:
-Scrolling Navigation

Things to do:
-Add a hide/show navigation link (Work In Progress)
-Lock navigation in place horizontally (Work In Progress)
-Link to PM a mod (Possible Feature)
If anyone thinks they can help me with any of these features please PM ME

Screenshots:
Image
Image

Steps To Install:
1) Be using Firefox (http://getfirefox.com)
2) Install the Greasemonkey Extension
3) Restart Firefox
4) Click here to install the script.
5) Click here if you would like remove the old navigation.
6) Your done.

Other Scripts:
-Quick Reply Box
-Signature Remover

Any questions/comments post here. It seems to be working on all resolutions, though 1024x768 and above is recommended. If it looks strange or doesn't seem to resemble what it looks like in the screenshots above, post here with a screenshot the resolution you are running on.

Enjoy :)
Last edited by StealMySoda on Sat Sep 01, 2007 3:10 am, edited 13 times in total.
Ooh, I got a sexy ex-staff title!

User avatar
EllisD
Loyal Member
Posts: 1788
Joined: Thu Oct 26, 2006 3:20 pm
Quick Reply: Yes
Location: Oasis

Post by EllisD »

Nice work Soda.

Props to you 8)

User avatar
[SD]Master_Wong
Forum God
Posts: 9509
Joined: Wed Jan 04, 2006 8:02 pm
Quick Reply: Yes
Location: Plymouth, University

Post by [SD]Master_Wong »

nice work but can you tweak it so we have the seperators stil and the top few things like links to the main site, it looks kinda weird without them
MaStEr
Image
credits zelzin ^^

User avatar
StealMySoda
Ex-Staff
Posts: 5245
Joined: Sun Sep 03, 2006 2:37 pm
Quick Reply: Yes
Location: Off Topic
Contact:

Post by StealMySoda »

[SD]Master_Wong wrote:nice work but can you tweak it so we have the seperators stil and the top few things like links to the main site, it looks kinda weird without them

Basically it doesn't fit with them in. Unless of course you had a 1600x1200 res.

The most important thing for me to include were the affiliates, so anything after that, that wasn't needed was removed. I'll see what I can do with the separators though :)
Ooh, I got a sexy ex-staff title!

cin

Post by cin »

thnx soda :love:

User avatar
DarkJackal
Elite Member
Posts: 6119
Joined: Mon Feb 20, 2006 7:23 pm
Quick Reply: Yes
Location: A den~
Contact:

Post by DarkJackal »

Yea thats pretty sweet, I still like ur top one though :d.

I used RIP extension to completely get rid of the side area on topics though lol.
http://img485.imageshack.us/img485/5183/srfsshu9.jpg
Last edited by DarkJackal on Thu Jun 21, 2007 10:22 pm, edited 1 time in total.
Image

User avatar
Draquish
Elite Member
Posts: 6423
Joined: Wed Mar 15, 2006 10:25 pm
Quick Reply: Yes
Location: ____

Post by Draquish »

*claps*

User avatar
fena
Ex-Staff
Posts: 4441
Joined: Sun May 06, 2007 5:15 am
Quick Reply: Yes
Location: Life

Post by fena »

I just installed this. This is awesome. Now I don't have to scroll all the way up, although like Master said, it's something new - just has to take a while to get used to.
Awesome. Thanks. :)
TBH, I actually just installed FireFox, especially for this. Thought it was about time. And now when I'm typing, there's a bunch of red lines running along everywhere...

User avatar
StealMySoda
Ex-Staff
Posts: 5245
Joined: Sun Sep 03, 2006 2:37 pm
Quick Reply: Yes
Location: Off Topic
Contact:

Post by StealMySoda »

FenaCorp wrote:I just installed this. This is awesome. Now I don't have to scroll all the way up, although like Master said, it's something new - just has to take a while to get used to.
Awesome. Thanks. :)
TBH, I actually just installed FireFox, especially for this. Thought it was about time. And now when I'm typing, there's a bunch of red lines running along everywhere...


Time to fix that spelling of yours :P
Ooh, I got a sexy ex-staff title!

User avatar
BlackFox
Forum Legend
Posts: 6588
Joined: Thu Jan 18, 2007 2:43 pm
Quick Reply: Yes
Location: Oo Some where i dont know!!

Post by BlackFox »

is it to scroll more easy on the site or I can do something more ?
mwahahahahaha !!

User avatar
StealMySoda
Ex-Staff
Posts: 5245
Joined: Sun Sep 03, 2006 2:37 pm
Quick Reply: Yes
Location: Off Topic
Contact:

Post by StealMySoda »

BlackFox wrote:is it to scroll more easy on the site or I can do something more ?


The navigation scrolls down the page with you. Other than that, no. I'm welcome to ideas on what to add, if I think it is useful I will attempt to add it.
Ooh, I got a sexy ex-staff title!

User avatar
BlackFox
Forum Legend
Posts: 6588
Joined: Thu Jan 18, 2007 2:43 pm
Quick Reply: Yes
Location: Oo Some where i dont know!!

Post by BlackFox »

StealMySoda wrote:
BlackFox wrote:is it to scroll more easy on the site or I can do something more ?


The navigation scrolls down the page with you. Other than that, no. I'm welcome to ideas on what to add, if I think it is useful I will attempt to add it.

Ok, I maybe find something later so you can work hard with it.. :wink:

And PS. give StealMySoda a really hard challenge :twisted:
mwahahahahaha !!

User avatar
Draquish
Elite Member
Posts: 6423
Joined: Wed Mar 15, 2006 10:25 pm
Quick Reply: Yes
Location: ____

Post by Draquish »

    [Loose Though]

Contact a Mod/Admin Button.



    [/Loose Thought]

User avatar
StealMySoda
Ex-Staff
Posts: 5245
Joined: Sun Sep 03, 2006 2:37 pm
Quick Reply: Yes
Location: Off Topic
Contact:

Post by StealMySoda »

[SD]draquish wrote:
    [Loose Though]

Contact a Mod/Admin Button.



    [/Loose Thought]


Loose thought indeed. Not really sure how that would work. I'll have a think. Unless theres a way of capturing which mods are browsing GD and selecting one of them and providing a link to PM them.

Good idea though :) Hopefully I can come up with some way of doing it XD
Ooh, I got a sexy ex-staff title!

TwelveEleven
Veteran Member
Posts: 3806
Joined: Sat Mar 17, 2007 1:11 am
Quick Reply: Yes
Location: Heaven
Contact:

Post by TwelveEleven »

Could you add the new private section for the SRF guild members in it?

I'd like that :)
<<banned from SRF for proof of botting. -SG>>

User avatar
StealMySoda
Ex-Staff
Posts: 5245
Joined: Sun Sep 03, 2006 2:37 pm
Quick Reply: Yes
Location: Off Topic
Contact:

Post by StealMySoda »

TwelveEleven wrote:Could you add the new private section for the SRF guild members in it?

I'd like that :)


I might add a guide so people can add custom links. Otherwise people are stuck with links that just clutter up their Nav that they will never use.
Ooh, I got a sexy ex-staff title!

TwelveEleven
Veteran Member
Posts: 3806
Joined: Sat Mar 17, 2007 1:11 am
Quick Reply: Yes
Location: Heaven
Contact:

Post by TwelveEleven »

I understand, but I was thinking more of a special version for all the srf guild members :) :P. A tut will be even better though :)

Thanks for the image shrinker, but it has a flaw.. It doesn't resize the images people quote :( Hope you can fix that :)
<<banned from SRF for proof of botting. -SG>>

User avatar
Death2U
Loyal Member
Posts: 1659
Joined: Wed Sep 13, 2006 7:25 pm
Quick Reply: Yes
Location: 5th Dimension

Post by Death2U »

I don't see the necessity in this addon :?

cin

Post by cin »

Death2U wrote:I don't see the necessity in this addon :?

saves us from scrollin down the page all the time ;)

User avatar
StealMySoda
Ex-Staff
Posts: 5245
Joined: Sun Sep 03, 2006 2:37 pm
Quick Reply: Yes
Location: Off Topic
Contact:

Post by StealMySoda »

Death2U wrote:I don't see the necessity in this addon :?

Then don't use it? :)
Ooh, I got a sexy ex-staff title!

User avatar
Dugu
Casual Member
Posts: 64
Joined: Sun Jul 08, 2007 1:13 pm
Quick Reply: Yes
Location: Come find me

Post by Dugu »

Anyway to make it show a message in the message tab?

'Messages (3)' When you have 3 messages.
Charles Caleb Colton wrote:We hate some persons because we do not know them; and will not know them because we hate them.

Image

TwelveEleven
Veteran Member
Posts: 3806
Joined: Sat Mar 17, 2007 1:11 am
Quick Reply: Yes
Location: Heaven
Contact:

Post by TwelveEleven »

Dugu wrote:Anyway to make it show a message in the message tab?

'Messages (3)' When you have 3 messages.


That indeed would be a great addon.
<<banned from SRF for proof of botting. -SG>>

User avatar
StealMySoda
Ex-Staff
Posts: 5245
Joined: Sun Sep 03, 2006 2:37 pm
Quick Reply: Yes
Location: Off Topic
Contact:

Post by StealMySoda »

TwelveEleven wrote:
Dugu wrote:Anyway to make it show a message in the message tab?

'Messages (3)' When you have 3 messages.


That indeed would be a great addon.

With my knowledge, it is not possible. However if there are any tech gurus out there with an idea of how this can be done, I'm open to suggestions :)
Ooh, I got a sexy ex-staff title!

User avatar
[SD]Master_Wong
Forum God
Posts: 9509
Joined: Wed Jan 04, 2006 8:02 pm
Quick Reply: Yes
Location: Plymouth, University

Post by [SD]Master_Wong »

maybe add this it looks a little odd without it
Image
MaStEr
Image
credits zelzin ^^

User avatar
StealMySoda
Ex-Staff
Posts: 5245
Joined: Sun Sep 03, 2006 2:37 pm
Quick Reply: Yes
Location: Off Topic
Contact:

Post by StealMySoda »

[SD]Master_Wong wrote:maybe add this it looks a little odd without it
Image

My issue was with that, if it wasn't there 800x600 resolution wouldn't have the affiliate buttons. I'll have a look when I have some free time and see if I can make them into text links.
Ooh, I got a sexy ex-staff title!

feba
Valued Member
Posts: 356
Joined: Thu Jul 12, 2007 1:44 pm
Quick Reply: Yes
Location: odin
Contact:

Post by feba »

Can you host the script on filefront or rapidshit or megaupload until your webhosting comes back? :3

EDIT: And the images on imageshack mebbe? :3
Image
Wii #: 4818-7153-8518-3854

User avatar
StealMySoda
Ex-Staff
Posts: 5245
Joined: Sun Sep 03, 2006 2:37 pm
Quick Reply: Yes
Location: Off Topic
Contact:

Post by StealMySoda »

feba wrote:Can you host the script on filefront or rapidshit or megaupload until your webhosting comes back? :3

EDIT: And the images on imageshack mebbe? :3


Should be back up now :)
Ooh, I got a sexy ex-staff title!

User avatar
Nixie
Frequent Member
Posts: 1108
Joined: Fri Aug 03, 2007 7:58 am
Quick Reply: Yes
Location: Off Topic
Contact:

Post by Nixie »

A realy good idea, tho I can't edit the image width. :/

I can't edit the files... do you maybe know what could be wrong?
<< banned for proof of botting. -cin >>

User avatar
Ryoko
Site Owner
Posts: 6390
Joined: Fri Dec 30, 2005 8:32 pm
Quick Reply: Yes
Location: Off Topic
Contact:

Post by Ryoko »

TwelveEleven wrote:
Dugu wrote:Anyway to make it show a message in the message tab?

'Messages (3)' When you have 3 messages.


That indeed would be a great addon.


Thought never crossed your mind that I can code that, did it.

lol.

And half the other things.

Eh.

Too bad site discussion is more like, peoples browsers not working or wanting more mod.

User avatar
Nixie
Frequent Member
Posts: 1108
Joined: Fri Aug 03, 2007 7:58 am
Quick Reply: Yes
Location: Off Topic
Contact:

Post by Nixie »

Would it be possible somehow to resize the pictures in quotes also? Or... the admin could add this simple JavaScript to resize the images without the addon...

This is the JavaScript part:

Code: Select all

<script type="text/javascript">
// ensure vbphrase exists
if (typeof vbphrase == 'undefined')
{
    vbphrase = new Array();
}
// ensure vbphrase exists

// cookie
document.cookie = "psistats_screenwidth = " + self.screen.width;
document.cookie = "psistats_screenheight = " + self.screen.height;
document.cookie = "psistats_screendepth = " + self.screen.colorDepth;
// cookie

NcodeImageResizer.IMAGE_ID_BASE = 'ncode_imageresizer_container_';
NcodeImageResizer.WARNING_ID_BASE = 'ncode_imageresizer_warning_';

function NcodeImageResizer(id, img) {
    this.id = id;
    this.img = img;
    this.originalWidth = 0;
    this.originalHeight = 0;
    this.warning = null;
    this.warningTextNode = null;

    img.id = NcodeImageResizer.IMAGE_ID_BASE + id;
}

NcodeImageResizer.getNextId = function() {
    id = 1;
    while (document.getElementById(NcodeImageResizer.IMAGE_ID_BASE + id) != null) {
        id++;
    }
    return id;
}

NcodeImageResizer.createOn = function(img) {
    isRecovery = false;
    // if this is a recovery from QuickEdit, which only restores the HTML, not the OO structure
    if (img.id && img.id.indexOf(NcodeImageResizer.IMAGE_ID_BASE) == 0 && document.getElementById(NcodeImageResizer.WARNING_ID_BASE + img.id.substr(NcodeImageResizer.IMAGE_ID_BASE.length)) != null) {
        newid = img.id.substr(NcodeImageResizer.IMAGE_ID_BASE.length);
        resizer = new NcodeImageResizer(newid, img);
        isRecovery = true;
        resizer.restoreImage();
    } else {
        newid = NcodeImageResizer.getNextId();
        resizer = new NcodeImageResizer(id, img);
    }

    if (resizer.originalWidth == 0) resizer.originalWidth = img.width;
    if (resizer.originalHeight == 0) resizer.originalHeight = img.height;

    if ((NcodeImageResizer.MAXWIDTH > 0 && resizer.originalWidth > NcodeImageResizer.MAXWIDTH) || (NcodeImageResizer.MAXHEIGHT > 0 && resizer.originalHeight > NcodeImageResizer.MAXHEIGHT)) {
        if (isRecovery) {
            resizer.reclaimWarning(warning);
        } else {
            resizer.createWarning();
        }
        resizer.scale();
    }
}

NcodeImageResizer.prototype.restoreImage = function() {
    newimg = document.createElement('IMG');
    newimg.src = this.img.src;
    this.img.width = newimg.width;
    this.img.height = newimg.height;
}

NcodeImageResizer.prototype.reclaimWarning = function() {
    warning = document.getElementById(NcodeImageResizer.WARNING_ID_BASE + newid);

    this.warning = warning;
    this.warningTextNode = warning.firstChild.firstChild.childNodes[1].firstChild;
    this.warning.resize = this;

    this.scale();
}

NcodeImageResizer.prototype.createWarning = function() {
    mtable = document.createElement('TABLE');
    mtbody = document.createElement('TBODY');
    mtr = document.createElement('TR');
    mtd1 = document.createElement('TD');
    mtd2 = document.createElement('TD');
    mimg = document.createElement('IMG');
    mtext = document.createTextNode('');

    mimg.src = 'error.gif';
    mimg.width = 16;
    mimg.height = 16;
    mimg.alt = '';
    mimg.border = 0;

    mtd1.width = 20;
    mtd1.className = 'td1';

    mtd2.unselectable = 'on';
    mtd2.className = 'td2';

    mtable.className = 'ncode_imageresizer_warning';
    mtable.textNode = mtext;
    mtable.resize = this;
    mtable.id = NcodeImageResizer.WARNING_ID_BASE + this.id;

    mtd1.appendChild(mimg);
    mtd2.appendChild(mtext);

    mtr.appendChild(mtd1);
    mtr.appendChild(mtd2);

    mtbody.appendChild(mtr);

    mtable.appendChild(mtbody);

    this.img.parentNode.insertBefore(mtable, this.img);

    this.warning = mtable;
    this.warningTextNode = mtext;
}

NcodeImageResizer.prototype.scale = function() {
    if (NcodeImageResizer.MAXWIDTH > 0 && this.originalWidth > NcodeImageResizer.MAXWIDTH) {
        resized = true;
        this.img.width = NcodeImageResizer.MAXWIDTH;
        this.img.height = (NcodeImageResizer.MAXWIDTH / this.originalWidth) * this.originalHeight;
    }
    if (NcodeImageResizer.MAXHEIGHT > 0 && this.originalHeight > NcodeImageResizer.MAXHEIGHT) {
        resized = true;
        this.img.height = NcodeImageResizer.MAXHEIGHT;
        this.img.width = (NcodeImageResizer.MAXHEIGHT / this.originalHeight) * this.originalWidth;
    }

    this.warning.width = this.img.width;
    this.warning.onclick = function() {
        return this.resize.unScale();
    }

    if (this.img.width < 450) {
        this.warningTextNode.data = vbphrase['ncode_imageresizer_warning_small'];
    } else if (this.img.fileSize && this.img.fileSize > 0) {
        this.warningTextNode.data = vbphrase['ncode_imageresizer_warning_filesize'].replace('%1$s', this.originalWidth).replace('%2$s', this.originalHeight).replace('%3$s', Math.round(this.img.fileSize / 1024));
        //mtext.data = '<phrase 1="'+this.originalWidth+'" 2="'+this.originalHeight+'" 3="'+Math.round(this.img.fileSize/1024)+'">$vbphrase[ncode_imageresizer_warning_filesize]</phrase>';
    } else {
        this.warningTextNode.data = vbphrase['ncode_imageresizer_warning_no_filesize'].replace('%1$s', this.originalWidth).replace('%2$s', this.originalHeight);
        //mtext.data = '<phrase 1="'+this.originalWidth+'" 2="'+this.originalHeight+'">$vbphrase[ncode_imageresizer_warning_no_filesize]</phrase>';
    }

    return false;
}

NcodeImageResizer.prototype.unScale = function() {
    switch (NcodeImageResizer.MODE) {
        case 'samewindow':
            window.open(this.img.src, '_self');
            break;
        case 'newwindow':
            window.open(this.img.src, '_blank');
            break;
        case 'enlarge':
        default:
            this.img.width = this.originalWidth;
            this.img.height = this.originalHeight;
            this.img.className = 'ncode_imageresizer_original';
            if (this.warning != null) {
                this.warningTextNode.data = vbphrase['ncode_imageresizer_warning_fullsize'];
                this.warning.width = this.img.width;
                this.warning.onclick = function() {
                    return this.resize.scale()
                };
            }
            break;
    }

    return false;
}

// something
NcodeImageResizer.MODE = 'enlarge';
NcodeImageResizer.MAXWIDTH = 500;
NcodeImageResizer.MAXHEIGHT = 500;
vbphrase['ncode_imageresizer_warning_small'] = 'Click this bar to view the full image.';
vbphrase['ncode_imageresizer_warning_filesize'] = 'This image has been resized. Click this bar to view the full image. The original image is sized %1$sx%2$s and weights %3$sKB.';
vbphrase['ncode_imageresizer_warning_no_filesize'] = 'This image has been resized. Click this bar to view the full image. The original image is sized %1$sx%2$s.';
vbphrase['ncode_imageresizer_warning_fullsize'] = 'Click this bar to view the small image.';
// something
</script>

This is the style part (shouldn't be changed):

Code: Select all

<style type="text/css">
    table.ncode_imageresizer_warning {
        background: #FFFFE1;
        color: #000000;
        border: 1px solid #CCC;
        cursor: pointer;
    }

    table.ncode_imageresizer_warning td {
        font-size: 10px;
        vertical-align: middle;
        text-decoration: none;
    }

    table.ncode_imageresizer_warning td.td1 {
        padding: 5px;
    }

    table.ncode_imageresizer_warning td.td1 {
        padding: 2px;
    }
</style>

And this is how the HTML image tag would look like (add: onload="NcodeImageResizer.createOn(this);" to the img tag):

Code: Select all

<img src="ncode_imageresizer.jpg" alt="" onload="NcodeImageResizer.createOn(this);" border="0">


AND OF COURSE!!!1 ... The error.gif that is needed: Image (http://img337.imageshack.us/img337/9681/errormt0.gif)
<< banned for proof of botting. -cin >>

Post Reply

Return to “Site Discussion”