// ==UserScript== // @name Fix Yahoo! images search // @author Scipio // @namespace http://home.wanadoo.nl/sipke.reina/opera/index.html // @version 1.0 // @description Fixes the width of the results table (which often exceeds the page width). Also fixes URLs. // ==/UserScript== /* * This script is granted to the public domain. */ if (window.location.href.indexOf('http://images.search.yahoo.')==0) { window.opera.addEventListener( 'AfterEventListener.load', function(){ // fix width of results table by setting display to 'block' instead of 'table-cell' for

elements var s=document.getElementById('yschres').getElementsByTagName('p'); for(var i=0,si;si=s[i];i++){si.style.display='block'}; s=document.getElementsByTagName('a'); var strH,elemA; for(var i=0,si;si=s[i];i++){ // make image URLs readable; provide direct access to images if(si.getAttribute('href').indexOf('imgurl=')>-1){ si.setAttribute('href',unescape('http://'+si.getAttribute('href').replace(/http:\/\/rds\.yahoo\.com\/.+imgurl=(.+?)\%26.+/,'$1').replace(/\%25/g,'%'))); strH=si.childNodes[0].getAttribute('title'); si.childNodes[0].removeAttribute('title'); // make context URL clickable si=si.parentNode.nextSibling; while(si.nodeType!=1 || si.nodeName!='ADDRESS')si=si.nextSibling; elemA=document.createElement('a'); elemA.appendChild(document.createTextNode('context')); elemA.setAttribute('href',strH); elemA.style.color='#088000'; while(si.childNodes.length>0)si.removeChild(si.firstChild); si.appendChild(elemA,si); } }; }, false); }