User:Dipankan001/freesearch.js

importScriptURI('http://en.wikipedia.org/w/index.php?title=User:Drilnoth/toolkit.js&action=raw&ctype=text/javascript');

addOnloadHook(start_freesearch); //Initiates the script on page load

function start_freesearch{ //Begins the script mw.util.addPortletLink('p-tb', 'javascript:freesearch_form', 'Search free images', 'tb-freesearch', 'Find free images using Google'); //Add link in toolbox }

function freesearch_form{ var floatbox = new Floatbox("Find free images using Google (Version by Dipankan001)");

var mainform = floatbox.create_form; mainform.setAttribute("action", "javascript:freesearch_eval;");

var searchterm = floatbox.form_input("text", "searchterm"); searchterm.value = wgTitle;

floatbox.form_append("label", "Search term(s)");

floatbox.form_append("br");

var submitbutton = floatbox.form_input("submit", "submit"); submitbutton.value = "Search free images"; }

function freesearch_eval{ var w = window.open("http://images.google.com/images?as_rights=(cc_publicdomain|cc_attribute|cc_sharealike).-(cc_noncommercial|cc_nonderived)&as_eq=wikipedia+wikimedia&as_q=" + enc(id("floatbox-floatform").searchterm.value)); id("content").removeChild(id("floatbox-main")); }