Page 1 of 2
Silkroad Forum Greasemonkey Script (Updated January 14th 08)
Posted: Wed Jun 20, 2007 5:35 pm
by StealMySoda
Updated January 14th 08Greasemonkey 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 MEScreenshots:

Steps To Install:1) Be using Firefox (
http://getfirefox.com)
2) Install the
Greasemonkey Extension3) 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 RemoverAny 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

Posted: Wed Jun 20, 2007 5:45 pm
by EllisD
Nice work Soda.
Props to you

Posted: Wed Jun 20, 2007 7:18 pm
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
Posted: Wed Jun 20, 2007 8:07 pm
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

Posted: Thu Jun 21, 2007 12:02 am
by cin
thnx soda

Posted: Thu Jun 21, 2007 8:46 pm
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
Posted: Thu Jun 21, 2007 8:59 pm
by Draquish
*claps*
Posted: Sun Jun 24, 2007 8:07 am
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...
Posted: Sun Jun 24, 2007 2:40 pm
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

Posted: Sun Jun 24, 2007 5:34 pm
by BlackFox
is it to scroll more easy on the site or I can do something more ?
Posted: Sun Jun 24, 2007 10:56 pm
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.
Posted: Sun Jun 24, 2007 11:35 pm
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..
And PS. give StealMySoda a really hard challenge

Posted: Mon Jun 25, 2007 3:30 am
by Draquish
Contact a Mod/Admin Button.
Posted: Tue Jun 26, 2007 2:47 am
by StealMySoda
[SD]draquish wrote:Contact a Mod/Admin Button.
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
Posted: Thu Jun 28, 2007 3:10 pm
by TwelveEleven
Could you add the new private section for the SRF guild members in it?
I'd like that

Posted: Thu Jun 28, 2007 9:04 pm
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.
Posted: Mon Jul 02, 2007 2:35 am
by TwelveEleven
I understand, but I was thinking more of a special version for all the srf guild members

. 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

Posted: Tue Jul 10, 2007 7:14 am
by Death2U
I don't see the necessity in this addon

Posted: Tue Jul 10, 2007 9:20 am
by cin
Death2U wrote:I don't see the necessity in this addon

saves us from scrollin down the page all the time

Posted: Tue Jul 10, 2007 1:57 pm
by StealMySoda
Death2U wrote:I don't see the necessity in this addon

Then don't use it?

Posted: Sun Jul 15, 2007 3:12 am
by Dugu
Anyway to make it show a message in the message tab?
'Messages (3)' When you have 3 messages.
Posted: Mon Jul 16, 2007 12:03 am
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.
Posted: Mon Jul 16, 2007 6:49 am
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

Posted: Mon Jul 16, 2007 10:24 am
by [SD]Master_Wong
maybe add this it looks a little odd without it

Posted: Mon Jul 16, 2007 4:21 pm
by StealMySoda
[SD]Master_Wong wrote:maybe add this it looks a little odd without it

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.
Posted: Thu Jul 19, 2007 4:36 pm
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
Posted: Sat Jul 21, 2007 4:00 pm
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

Posted: Fri Aug 03, 2007 4:43 pm
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?
Posted: Tue Aug 07, 2007 5:03 pm
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.
Posted: Sun Aug 26, 2007 10:41 pm
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:

(
http://img337.imageshack.us/img337/9681/errormt0.gif)