VK любить следить по каким вы ходите ссылкам (vk.com/away.php) что меня дико раздражает, поэтому я накатал тут (взяв за основу чужой скрипт) такое:
// VKontakte click tracking gone
// version 0.1
// Release Date: 11-11-11
//
// ===== INSTRUCTIONS =====
//
// This is a Greasemonkey user script.
//
// To use this script, get Greasemonkey: http://greasemonkey.mozdev.org/
// After you've installed it, come back to this page. A dialog box will
// appear asking you if you want to install this script.
//
// To uninstall, go to Tools->Greasemonkey->Manage User Scripts, select
// "VKontakte click tracking gone" from the list on the left, and click
// Uninstall.
//
// ==UserScript==
// @name VKontakte click tracking gone
// @namespace http://sbdev.org
// @description Removes click tracking from VK web sites
//
// @include http://vkontakte.ru/*
// @include http://vk.com/*
// ==/UserScript==
// doIt();
document.addEventListener('DOMAttrModified', function (event) {
doIt();
}, false);
document.addEventListener('DOMNodeInserted', function (event) {
doIt();
}, false);
function doIt() {
resultLinks = $x("//a");
resultLinks.forEach(function(link) { // loop over links
var oldLink = link.href;
if (/^http:\/\/vk.com/.test(oldLink) || /^http:\/\/vkontakte.ru/.test(oldLink)) {
var matches = /away.php\?(to)=(.+?)&/.exec(oldLink);
if (matches != null) {
link.href = unescape(matches[2]);
}
}
});
}
// XPath helper, from
// http://wiki.greasespot.net/Code_snippets
function $x() {
var x='', // default values
node=document,
type=0,
fix=true,
i=0,
toAr=function(xp){ // XPathResult to array
var final=[], next;
while(next=xp.iterateNext())
final.push(next);
return final
},
cur;
while (cur=arguments[i++]) // argument handler
switch(typeof cur) {
case "string":x+=(x=='') ? cur : " | " + cur;continue;
case "number":type=cur;continue;
case "object":node=cur;continue;
case "boolean":fix=cur;continue;
}
if (fix) { // array conversion logic
if (type==6) type=4;
if (type==7) type=5;
}
if (!/^\//.test(x)) x="//"+x; // selection mistake helper
if (node!=document && !/^\./.test(x)) x="."+x; // context mistake helper
var temp=document.evaluate(x,node,null,type,null); //evaluate!
if (fix)
switch(type) { // automatically return special type
case 1:return temp.numberValue;
case 2:return temp.stringValue;
case 3:return temp.booleanValue;
case 8:return temp.singleNodeValue;
case 9:return temp.singleNodeValue;
}
return fix ? toAr(temp) : temp;
}
Одна проблема - Firefox жутко тормозит при открытии страниц и пролистывании бесконечных списков (комментариев, новостей и прочих лент).
Как бы это оптимизировать?