Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name images tool insta9999
- // @namespace ale
- // @version 1
- // @description -
- // @author -
- // @require http://code.jquery.com/jquery-3.6.0.min.js
- // @include https://www.google.com/search?tbm=isch&q=*#imgrc=*
- // @match https://*instagram.com/*
- // @grant GM_setClipboard
- // @grant GM_download
- // @inject-into content
- // @run-at document-idle
- // ==/UserScript==
- (() => { let LAST_VISITED_URL = window.location.href;
- setInterval(() => {
- if(window.location.href != LAST_VISITED_URL){
- handleNewPage(window.location);
- LAST_VISITED_URL = window.location.href;
- }
- }, 500);
- const handleNewPage = page => {
- console.log("Host:", page.host, "Hash", page.hash);
- switch(page.host) {
- case "www.google.com":
- handleGoogle();
- break;
- case "www.instagram.com":
- handleInstagram();
- break;
- // more sites...
- }
- };
- })();
- function handleGoogle() { console.log("$('body').on('click','img', displayContextMenu);
- function displayContextMenu(e) {
- e.preventDefault();
- currentTarget = e.target;
- var srcd = $(currentTarget).prop("src");GM_setClipboard(srcd);
- }
- });"); }
- function handleInstagram() { console.log("$('body').on('click','img', displayContextMenu);
- function displayContextMenu(e) {
- e.preventDefault();
- currentTarget = e.target;
- var srcd = $(currentTarget).prop("src");GM_setClipboard(srcd);
- }
- });"); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement