Last active
August 25, 2017 12:10
-
-
Save rEtSaMfF/14f4faaf1ad58bed7d3669f2da7be719 to your computer and use it in GitHub Desktop.
Remove VK outgoing URL tracking.
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 fixVK | |
// @namespace fixVK | |
// @description Remove VK.com outgoing URL tracking. | |
// @include /^https?://vk\.com/?.*$/ | |
// @version 2016-09-29 | |
// @run-at document-idle | |
// @grant none | |
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.slim.min.js | |
// ==/UserScript== | |
function fixVK() { | |
console.log('fixVK'); | |
$('a').each(function() { | |
var href = $(this).attr('href'); | |
if (href && href.includes('/away.php?to=')) { | |
var one = href.split('=')[1]; | |
var two = one.split('&'); | |
var decodedURL = decodeURIComponent(two[0]); | |
$(this).attr('href', decodedURL); | |
$(this).text(decodedURL); | |
// console.log($(this).attr('href')); | |
} | |
}); | |
} | |
fixVK(); | |
// Expand all posts | |
$('a.wall_post_more').click(); | |
// Prevent the modal view from appearing | |
$('div.post').prop('onclick', null).off('click'); | |
// Remove mouse cursor | |
$('.wall_post_text').hover(function() { | |
$(this).css('cursor', 'default'); | |
}); | |
// Prevent the load_more by deleting the node | |
$('a#fw_load_more').remove(); | |
// Remove the scroll to top | |
$('div#stl_left').remove(); | |
$('div#stl_side').remove(); | |
// How to execute fixVK() after loading the next page? | |
//$('a.pg_lnk').click(fixVK); | |
// For now prevent regular pagination | |
//$('a.pg_lnk').prop('onclick', null).off('click').click(fixVK); | |
//$('a.pg_lnk').prop('onclick', null).off('click'); | |
$('a.pg_lnk').prop('onclick', null); | |
$('a.pg_lnk').off('click'); | |
// This does not seem to work | |
// Unfocus search bar | |
$('#wall_search').blur(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment