Last active
April 21, 2021 19:54
-
-
Save ahmic/7af9da9dd56b3bbed864193ec4d58905 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Maskica Dizajn | |
// @namespace http://www.webmonkey.com | |
// @description A Greasemonkey script that finds h2 tags and creates a floating menu of them. | |
// @include https://www.pinterest.com/ | |
// @include https://www.pinterest.com | |
// @include https://www.pinterest.com* | |
// ==/UserScript== | |
var menu = ''; | |
setInterval(function(){ | |
removeElementsByClass('imglinkkkkkk'); | |
if (typeof document.querySelectorAll('[data-test-id="image-link"]')[0] !== 'undefined') { | |
var imglink = document.querySelectorAll('[data-test-id="image-link"]')[0].getElementsByTagName('img')[1].getAttribute('src'); | |
menu = '<a href="https://novamaskica.netlify.app/#' + imglink + '" target="_blank" style="padding: 5px; font-size: 33px; display: block;">iPhone</a>'; | |
menu = menu + '<a href="https://novamaskica.netlify.app/p20.html#' + imglink + '" target="_blank" style="padding: 5px; font-size: 33px; display: block;">P20 pro</a>'; | |
menu = menu + '<a href="https://novamaskica.netlify.app/clear.html#' + imglink + '" target="_blank" style="padding: 5px; font-size: 33px; display: block;">Clear</a>'; | |
} else { | |
menuobj = document.createElement('div'); | |
menuobj.style.position = 'fixed'; | |
menuobj.style.top = '170px'; | |
menuobj.style.left = '50px'; | |
menuobj.style.padding = '10px 20px'; | |
menuobj.style.backgroundColor = '#3ebd1b'; | |
menuobj.innerHTML = 'x'; | |
menuobj.classList.add('imglinkkkkkk'); | |
body = document.getElementsByTagName('body')[0]; | |
//body.appendChild(menuobj); | |
} | |
// Create menu | |
if (menu != '') | |
{ | |
menuobj = document.createElement('div'); | |
menuobj.classList.add('imglinkkkkkk'); | |
menuobj.style.position = 'fixed'; | |
menuobj.style.top = '170px'; | |
menuobj.style.left = '50px'; | |
menuobj.style.padding = '10px 20px'; | |
menuobj.style.backgroundColor = '#3ebd1b'; | |
menuobj.innerHTML = menu; | |
body = document.getElementsByTagName('body')[0]; | |
body.appendChild(menuobj); | |
} | |
}, 1000); | |
function removeElementsByClass(className){ | |
var elements = document.getElementsByClassName(className); | |
while(elements.length > 0){ | |
elements[0].parentNode.removeChild(elements[0]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment