Last active
April 5, 2019 13:33
-
-
Save Ser-Gen/844b1ab256573bcf86e71c6bf2212310 to your computer and use it in GitHub Desktop.
end.user.js
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 end | |
// @namespace styles | |
// @include http*//*.* | |
// @version 4 | |
// @grant none | |
// ==/UserScript== | |
if (window.location.href.match('duckduckgo.com')) { | |
if (document.querySelector('.msg--noscript a')) { | |
document.querySelector('.msg--noscript a').click(); | |
}; | |
} | |
else if (window.location.href.match('google.')) { | |
if (document.querySelector('form[action*="search"] input[title]')) { | |
document.querySelector('form[action*="search"] input[title]').focus() | |
}; | |
document.onkeydown = function (e) { | |
if (e.target.closest('input')) { return; }; | |
(document.querySelectorAll('h3 a')[e.key - 1] || document.querySelectorAll('h3 a')[0]).click(); | |
}; | |
} | |
else if (window.location.href.match('bureau.ru')) { | |
document.querySelectorAll('.image[data-src]').forEach(function (item) { | |
item.style.backgroundImage = 'url('+ item.dataset.src +')'; | |
}); | |
document.body.style.visibility = 'visible'; | |
} | |
else if (window.location.href.match('vk.com')) { | |
document.querySelectorAll('a').forEach(function (a) { | |
if (a.href.match('/away.php')) { | |
a.href = decodeURIComponent(a.href.split('to=')[1].split('&post=')[0]); | |
} | |
else if (a.classList.contains('wall_reply_more')) { | |
a.nextElementSibling.style.display = 'block'; | |
a.parentNode.removeChild(a); | |
} | |
}); | |
}; | |
if (document.querySelector('iframe[src*="youtube.com/embed"]')) { | |
document.querySelectorAll('iframe[src*="youtube.com/embed"]').forEach(function (iframe) { | |
var a = document.createElement('a'); | |
a.href = iframe.src; | |
a.innerHTML = iframe.src; | |
a.target = '_blank'; | |
iframe.parentNode.insertBefore(a, iframe); | |
}) | |
} | |
if (document.querySelector('img[src*="habrastorage.org/"]')) { | |
document.querySelectorAll('img[src*="habrastorage.org/"]').forEach(function (img) { | |
if (img.src.match('avatars')) { return } | |
var a = document.createElement('a'); | |
a.href = img.src; | |
a.innerHTML = img.src; | |
a.target = '_blank'; | |
img.parentNode.insertBefore(a, img); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment