Replace image link with images
Anyway, I have a fast connection and I like to see the images directly in the threads. So I modified a script I found online to serve this purpose. If you copy this line and insert it into your address bar and execute it will replace all image links with the actual image:
javascript: (function () {function I(u) {var t = u.split('.'),e = t[t.length - 1].toLowerCase();return {gif: 1,jpg: 1,jpeg: 1,png: 1,mng: 1}[e]}function hE(s) {return s.replace(/&/g, '&').replace(/>/g, '>').replace(/</g, '<').replace(/"/g, '"');}var q, h, i;for (i = 0; q = document.links[i]; ++i) {h = q.href;if (h && I(h)){q.innerHTML = '<img src="' + hE(h) + '" />';}}})()Here is an example image that you can test with:
autosportlogo
Restrict the width of posts
After request I have also added this script for limiting the width of a post. It will limit the with of a post to fit within the current browser width and rescale the image to fit within the view:
javascript: (function () {var margin = 220;function getWidth() {var myWidth = 0;if (typeof( window.innerWidth ) == 'number' ) {myWidth = window.innerWidth;}else if (document.documentElement && ( document.documentElement.clientWidth) ){myWidth = document.documentElement.clientWidth;}return myWidth;}var ss = document.styleSheets[document.styleSheets.length-1];var l=0;if (ss.cssRules) { l = ss.cssRules.length;} else if (ss.rules) { l = ss.rules.length;}if (ss.insertRule) { ss.insertRule('.postcolor { overflow:auto; width:' + (getWidth() - margin) + 'px; }',l); ss.insertRule('img { max-width: ' + (getWidth() - margin) + 'px; }',l+1);} else if (ss.addRule) { ss.addRule('.postcolor', 'overflow:auto; width:' + (getWidth() - margin) + 'px;', l); ss.addRule('.postcolor', 'max-width: ' + (getWidth() - margin) + 'px;', l+1);}})()Image to test this (run show images script first):
test image
Replace with link with image AND limit width (a combination of the two above)
javascript: (function () {var margin = 220;function I(u) {var t = u.split('.'),e = t[t.length - 1].toLowerCase();return {gif: 1,jpg: 1,jpeg: 1,png: 1,mng: 1}[e]}function hE(s) {return s.replace(/&/g, '&').replace(/>/g, '>').replace(/</g, '<').replace(/"/g, '"');}var q, h, i;for (i = 0; q = document.links[i]; ++i) {h = q.href;if (h && I(h)){q.innerHTML = '<img src="' + hE(h) + '" />';}}function getWidth() {var myWidth = 0;if (typeof( window.innerWidth ) == 'number' ) {myWidth = window.innerWidth;}else if (document.documentElement && ( document.documentElement.clientWidth) ){myWidth = document.documentElement.clientWidth;}return myWidth;}var ss = document.styleSheets[document.styleSheets.length-1];var l=0;if (ss.cssRules) { l = ss.cssRules.length;} else if (ss.rules) { l = ss.rules.length;}if (ss.insertRule) { ss.insertRule('.postcolor { overflow:auto; width:' + (getWidth() - margin) + 'px; }',l); ss.insertRule('img { max-width: ' + (getWidth() - margin) + 'px; }',l+1);} else if (ss.addRule) { ss.addRule('.postcolor', 'overflow:auto; width:' + (getWidth() - margin) + 'px;', l); ss.addRule('.postcolor', 'max-width: ' + (getWidth() - margin) + 'px;', l+1);}})()
enjoy!
Tested in: FireFox 3.6, WebKit (Safari, Chrome, etc.), IE8 (image resize doesn't work though)
Edited by imightbewrong, 10 February 2010 - 08:43.