Skip to content

Instantly share code, notes, and snippets.

@g-rohit
Last active May 8, 2023 08:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save g-rohit/f47170c8b3b302bcbe214ba624d636bc to your computer and use it in GitHub Desktop.
Save g-rohit/f47170c8b3b302bcbe214ba624d636bc to your computer and use it in GitHub Desktop.
Add image and video access on right click of the mouse on web instagram
// ==UserScript==
// @name Instagram-@grohit;
// @version 1.00
// @Date 12th Nov 2020
// @author github.com/g-rohit
// ==/UserScript==
// Desc: Add image and video access on right click of the mouse on web instagram
setInterval(function () {
if (window.location.href.includes("instagram")) {
// checking if any video posts are available,
// .PyenC is parent classname , .fXIG0 is child class name for video post
if (document.querySelector(".PyenC")) {
if (document.querySelector(".fXIG0")) {
document.querySelector(".PyenC").classList.remove("PyenC");
// loading the video by clicking the video container
document.querySelector(".fXIG0").click();
console.log("video played");
// pausing the videos so they dont keep playing
document.querySelectorAll(".tWeCl").forEach((each) => {
each.pause();
// add controls for video
each.toggleAttribute('controls');
});
console.log("video paused");
// removing the class so the video access is added to the mouse right click
document.querySelector(".fXIG0").classList.remove("fXIG0");
}
// console.log("found video post");
} else {
// console.log("keep scrolling down ur feed");
}
// selecting all image class container and assigning it to a constant
const nodelist = document.querySelectorAll("._9AhH0");
// running a loop to add image access on right click of mouse
for (let index = 0; index < 5; index++) {
if (nodelist[index]) {
nodelist[index].classList.remove("_9AhH0");
// console.log("now do right click on img and save");
} else {
console.log("scroll down for new posts");
}
}
}
}, 1000);
@Poopooracoocoo
Copy link

does this still work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment