// ==UserScript==
// @name Yandex :: Show cache link
// @version 1.00
// @createDate 2016-04-17
// @modifyDate
// @description Restore Yandex Cache link
// @include https://*yandex.*
// ==/UserScript==
var css = "\
span.serp-url__arrow {display: none !important;}\
div.popup2.popup2_target_anchor.popup2_theme_normal.popup2_autoclosable_yes.serp-url__popup.i-bem, div.popup2.popup2_target_anchor.popup2_autoclosable_yes.popup2_theme_normal.extralinks__popup.i-bem {\
color: black !important;\
display: block !important;\
visibility: visible !important;\
border: 1px solid black !important;\
background-color: red !important;\
margin: 0 !important;\
padding: 0 !important;\
position: absolute !important;\
left: 0 !important;\
top: 0 !important;\
height: auto !important;\
line-height: auto !important;\
z-index: 1000 !important;\
}\
";
if (typeof GM_addStyle != "undefined") {
GM_addStyle(css);
} else if (typeof PRO_addStyle != "undefined") {
PRO_addStyle(css);
} else if (typeof addStyle != "undefined") {
addStyle(css);
} else {
var heads = document.getElementsByTagName("head");
if (heads.length > 0) {
var node = document.createElement("style");
node.type = "text/css";
node.appendChild(document.createTextNode(css));
heads[0].appendChild(node);
}
}
function linksJob(links) {
for (var i=0; i<links.length; i++) {
var obj = links[i].nextSibling.lastChild;
console.log("className: " + obj.className);
obj.style.display = "inline !important";
obj.style.visibility = "visible !important";
obj.style.border = "1px solid black !important";
}
}
var QUERY = 'h2.serp-item__title';
linksJob(document.querySelectorAll(QUERY));
// ==UserScript==
// @name Yandex :: Show cache link
// @version 1.01
// @author Ciber SLasH
// @createDate 2016-04-17
// @modifyDate
// @description Restore Yandex Cache link
// @include https://*yandex.*
// ==/UserScript==
function linksJob(links) {
for (var i=0; i<links.length; i++) {
// div.popup2 popup2_target_anchor popup2_theme_normal popup2_autoclosable_yes serp-url__popup i-bem
var obj = links[i].nextSibling.lastChild;
for (var j = 1; j < obj.childNodes.length; j++) {
obj.removeChild(obj.childNodes[j]);
}
var curObj = obj.firstChild;
if (curObj.tagName == 'A' &&
curObj.className.indexOf('link') != -1
) {
var link = curObj.href;
// target: span.serp-url__arrow
var targetElemem = curObj.parentNode;
targetElemem.previousSibling.setAttribute('style', [
'margin-left: 1em !important;',
'background: none !important;',
'display: inline !important;',
'color: black !important;',
].join('\r\n'));
var newElem = document.createElement('A');
newElem.href = link;
newElem.text = curObj.text;
targetElemem.previousSibling.appendChild(newElem);