Skip to content

Instantly share code, notes, and snippets.

@ahmic
Last active April 21, 2021 19:54
Show Gist options
  • Select an option

  • Save ahmic/7af9da9dd56b3bbed864193ec4d58905 to your computer and use it in GitHub Desktop.

Select an option

Save ahmic/7af9da9dd56b3bbed864193ec4d58905 to your computer and use it in GitHub Desktop.

Revisions

  1. ahmic revised this gist Apr 21, 2021. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion maskica-dizajn.js
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,9 @@ if (typeof document.querySelectorAll('[data-test-id="image-link"]')[0] !== 'unde

    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;">Link</a>';
    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 {


  2. ahmic created this gist Aug 7, 2020.
    95 changes: 95 additions & 0 deletions maskica-dizajn.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,95 @@
    // ==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;">Link</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]);
    }
    }