Post subject: [Greasemonkey] Silkroad Online Forums Script - Resize images
Posted: Mon Dec 29, 2008 9:05 pm
Banned User
Joined: Aug 2007 Posts: 1108 Location:
About: Long time ago StealMySoda released his script which can be found here. I know, his has some more features, but in my opinion they're not needed. I may add features by request.
Now to my script itself. It will resize any image that will be posted in a normal post, quote or an attachment (new feature).
Steps To Install:
Use one of the following browsers: Firefox, Flock, any other that supports extensions
Click here to install the script If the file is not available follow these steps:
Open a plain text editor (Notepad, Notepad++...)
Copy the code bellow to the editor
Save the file as srf.user.js (the extension must be *.user.js)
Drag the file to your browser (here, where you can see the websites)
Install the script
You're done
Credits:
StealMySoda - for the base script
Nixie (TheSpy <safilix@gmail.com>) - for the edit
Moderator - didn't delete or lock my testing thread in Off-Topic
Members - didn't spam in my testing thread in Off-Topic
The code is in the spoiler tag.
Spoiler!
Code:
// ==UserScript== // @name Silkroad Online Forums Script - Resize Images // @namespace Silkroad Online Forums Script - Resize Images // @description A script to resize any image that is to huge to display to a lower size. Made by StealMySoda, edited by Nixie (TheSpy <safilix@gmail.com>) // @include http://*silkroadforums.com/posting.php* // @include http://*silkroadforums.com/viewtopic.php*
// set the maximum width of a picture maxWidth = 600;
// used to take care of all images function resizeImages(arrayWithImages) { // loop through all images for(var j = 0; j < arrayWithImages.length; j++) { // create a new Image (will be used to get the image width) var im = new Image(); im.src = arrayWithImages[j].src;
// do we have to resize it? if(im.width > maxWidth) { // has the image a parent node containing 'href'? (used to 'destroy' the <a> tag) if(arrayWithImages[j].parentNode.href) arrayWithImages[j].parentNode.removeAttribute('href');
// resize the image arrayWithImages[j].style.maxWidth = maxWidth + 'px';
// assign it a title arrayWithImages[j].title = 'Click for the original size.';
// add a paragraph newDiv = document.createElement('div'); newDiv.innerHTML = '<b>The image bellow has been resized. Please click it to open it in a new window.</b>'; arrayWithImages[j].parentNode.insertBefore(newDiv, arrayWithImages[j]);
As happy as you are, I just went through the code and guess what. I used that many loops, when entering 56k threads your browser may eventually freeze. You may expect a little update in a few minutes.
Edit: here you go. If you have already installed a previous version, just click install link above, it will overwrite your old copy.
_________________ << banned for proof of botting. -cin >>
Users browsing this forum: No registered users and 9 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum