Skip to content

Instantly share code, notes, and snippets.

@LordJZ
Last active August 25, 2017 11:31
Show Gist options
  • Save LordJZ/5194de8100d8e318489b to your computer and use it in GitHub Desktop.
Save LordJZ/5194de8100d8e318489b to your computer and use it in GitHub Desktop.
VK patch reduces background VK messenger traffic 100 times
// ==UserScript==
// @name VK fixes
// @namespace vk-com
// @include https://vk.com/*
// @include http://vk.com/*
// @version 1
// @grant none
// ==/UserScript==
/* recommended filters in addition to EasyList
! =========================
! VK filers
! =========================
$third-party,domain=vk.com
@@||vk.me^
@@||vk-cdn.net^
/q_frame.php$subdocument,domain=vk.com
vk.com###feed_recommends
! VK API on other sites
||vk.com/js/api/openapi.js*$third-party
! VK Widgets on other sites
||vk.com/widget*$domain=~vk.com
##a[href^="https://vk.com/share.php?url="]
*/
let oldPost = window.ajax.post;
let regex = /al_update_ad/;
window.ajax.post = function (url, args, args2) {
if (regex.test(url)) {
return;
}
if (args && args.act) {
switch (args.act) {
case 'a_typing':
case 'a_mark_read':
case 'a_mark':
//args2 && args2.onDone && args2.onDone();
return;
}
}
oldPost.apply(this, arguments);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment