// WTM Extras // Copyright (c) 2009, Franck Quélain // Released under the GPL license // http://www.gnu.org/copyleft/gpl.html // // -------------------------------------------------------------------- // This is a Greasemonkey user script. // // To install, you need Greasemonkey: http://greasemonkey.mozdev.org/ // Then restart Firefox and revisit this script. // Under Tools, there will be a new menu item to "Install User Script". // Accept the default configuration and install. // // To uninstall, go to Tools/Manage User Scripts, // select "wtm_extras", and click Uninstall. // // -------------------------------------------------------------------- // CHANGELOG // // 2009-07-06 : // * Creation // -------------------------------------------------------------------- // // ==UserScript== // @name wtm_extras // @namespace http://infernal-quack.net/ // @description WhatTheMovie Extras! - version 2009.07.06 // @include http://*whatthemovie.com/shot/* // ==/UserScript== (function(){ // ============= Show solutions for already solved movie // Display title by double-click on the image... document.getElementById("image_container").addEventListener("dblclick", showMovieTitle, false); // ...or by clicking on the arrow var showMovieNameLink = document.createElement("span"); showMovieNameLink.setAttribute("style","color:white;font-size:150%;cursor:pointer"); showMovieNameLink.addEventListener("click", showMovieTitle, false); showMovieNameLink.appendChild(document.createTextNode("►")); var node = document.getElementById("shot_msg"); node.appendChild(showMovieNameLink); function showMovieTitle() { if(unsafeWindow.amazonMovieName) { var completeMovieName=unescape(unescape(unsafeWindow.amazonMovieName)); // Remove year var movieName = completeMovieName.replace(/ \([0-9]{4}\)$/,""); document.getElementById("guess").value=movieName; var movieNameStrong = document.createElement("strong"); movieNameStrong.appendChild(document.createTextNode(completeMovieName)); document.getElementById("shot_title").appendChild(movieNameStrong); return false; } } // ============== TinEye image search engine link var imageSrc = document.getElementById("shot_still").getAttribute("src"); var searchTinEye = document.createElement("a"); searchTinEye.setAttribute("href","http://tineye.com/search?url="+imageSrc); searchTinEye.setAttribute("id","wtm_extras_links"); searchTinEye.appendChild(document.createTextNode("► Search on TinEye")); document.getElementById("image_container").insertBefore(searchTinEye,document.getElementById("image_container").firstChild); // CSS for added elements var styleObj=document.createElement("style"); styleObj.setAttribute("type","text/css"); document.getElementsByTagName("head")[0].appendChild(styleObj); styleObj.appendChild(document.createTextNode( "#image_container:hover #wtm_extras_links { \n\ visibility: visible; \n\ }\n\ #wtm_extras_links { \n\ visibility: hidden; \n\ display:block; \n\ width:150px; \n\ position:absolute; \n\ right:0; \n\ top:0; \n\ background:white; \n\ z-index:10; \n\ }\n" )); } )();