Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add a button to Bing Search bottom bar to find the image URL of the current screen.
// ==UserScript==
// @name Bing Search Image Finder
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Add a button to Bing Search bottom bar to find the image URL of the current screen.
// @author Reed
// @match https://*.bing.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const ul = document.querySelector("#b_footerItems > ul");
const newElement = document.createElement("li");
const newElementLink = document.createElement("a");
newElement.style.cursor = "pointer";
newElementLink.innerHTML = "Get Image";
newElement.onclick = () => {
let currentLink = document.getElementById("bgDiv").style.backgroundImage.replace("url(\"", '').replace("\")", '');
if (!currentLink) {
currentLink = document.getElementById("bgLink").href.replace("url(\"", '').replace("\")", '')
}
window.open(currentLink);
};
newElement.appendChild(newElementLink);
ul.appendChild(newElement);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.