Skip to content

Instantly share code, notes, and snippets.

@Eduardo-Morales-Alberti
Created August 27, 2019 16:14
Show Gist options
  • Save Eduardo-Morales-Alberti/70b06c505a5be298bd3344c532cdc5ea to your computer and use it in GitHub Desktop.
Save Eduardo-Morales-Alberti/70b06c505a5be298bd3344c532cdc5ea to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *instagram.com/*
// @grant window.open
// @grant window.focus
// @require http://code.jquery.com/jquery-3.4.1.min.js
// ==/UserScript==
function round() {
var min = 500;
var max = 2500;
var random = Math.random() * (+max - +min) + +min;
return Math.round(random);
}
jQuery = $;
jQuery(document).ready(function() {
var load = localStorage.getItem('load');
// If load not defined, define insta and load.
if (load == null) {
localStorage.setItem('load', 'yes');
}
var interval = null;
// TESTING
// localStorage.setItem('test', 'testing');
if (localStorage.getItem('test') == 'testing') {
localStorage.setItem('load', 'no');
var testing = localStorage.getItem('insta').split(',');
testing.pop();
localStorage.setItem('insta', testing);
localStorage.setItem('stop', 'false');
}
var stop = localStorage.getItem('stop');
var load = localStorage.getItem('load');
var item = localStorage.getItem('insta');
var insta;
if (item != null) {
insta = item.split(',');
} else {
insta = [];
}
var found = false;
jQuery('._bz0w > a:first-child').each(function() {
if (Array.isArray(insta) && !insta.includes(jQuery(this).attr('href'))) {
if (load != "yes") {
found = true;
var audio = window.open("http://soundbible.com/mp3/submarine-diving-alarm-daniel_simon.mp3", '_blank');
var url = 'https://www.instagram.com/forocochescom' + $(this).attr('href');
var win = window.open("", "Encontrado", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=200,top=" + (screen.height - 400) + ",left=" + (screen.width - 840));
win.document.body.innerHTML = "<a href='" + url + "'><h1>" + url + "</h1>";
console.log('Nueva Url:' + url);
//var instaw = window.open(url, '_blank');
if (audio != null) {
setTimeout(function() {
audio.focus()
}, 1000);
}
}
insta.push(jQuery(this).attr('href'));
}
});
var insta_clear = insta.filter(function(elem, index, self) {
return index === self.indexOf(elem);
});
localStorage.setItem('insta', insta_clear);
localStorage.setItem('load', 'no');
if (!found && stop != "stop") {
interval = setTimeout(function() {
location.reload();
}, round());
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment