Doodletoo

Image search as a reference for doodletoo

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Advertisement:

// ==UserScript==
// @name     Doodletoo
// @version  1
// @grant    none
// @match    http://www.doodletoo.com/*
// @author   TheOriginalBob
// @description Image search as a reference for doodletoo
// @namespace https://greasyfork.org/users/169540
// ==/UserScript==

var inputText = document.createElement('input');
inputText.id = 'searchInput';
inputText.setAttribute('type','text');
inputText.style.position = 'fixed';
inputText.style.zIndex = 1000;
inputText.style.top = '650px';
inputText.style.left = '10px';

document.getElementById('shadow').appendChild(inputText);

var imageResult = document.createElement('img');
imageResult.id = 'imageResult';
imageResult.style.position = 'fixed';
imageResult.style.zIndex = 1000;
imageResult.style.top = '400px';
imageResult.style.left = '10px';
imageResult.style.width = '400px';
imageResult.style.height = '250px';

document.getElementById('shadow').appendChild(imageResult);

imageResult.addEventListener('click',function(ele){
	imageResult.style.display = 'none';
});

inputText.addEventListener('keyup', function(ele){
	if (ele.keyCode == 13) {
    var xmlHttp = new XMLHttpRequest();
 	 	xmlHttp.open('GET', "https://api.qwant.com/api/search/images?count=1&offset=0&q=" + inputText.value,false);
  	xmlHttp.send();
  	var result = JSON.parse(xmlHttp.responseText);
    if (result.status == 'error') {
  		return alert('An Error Occured While Getting Image');
  	} else {
  		result = result.data.result.items[0].media;
  	}
    imageResult.setAttribute('src',result);
    imageResult.style.display = ''
  	inputText.value = null;
  }
});