Greasy Fork

Greasy Fork is available in English.

vk.com del redir

Deletes VK.com url redirects

目前为 2020-02-02 提交的版本。查看 最新版本

// ==UserScript==
// @name         vk.com del redir
// @version      1.0
// @description  Deletes VK.com url redirects
// @author       AndShy
// @match        http://vk.com/*
// @match        https://vk.com/*
// @license      GPL-3.0
// @homepageURL  http://greasyfork.icu/en/users/384289-andshy
// @run-at       document-end
// @grant        none
// @namespace http://greasyfork.icu/users/384289
// ==/UserScript==

(function() {
  'use strict';

    document.onmouseover = handler;

    function handler(event) {
      var evt = event.target
      if (evt) {
        //console.log(evt.tagName)
        if (evt.tagName.includes('A')) {
          //console.log(evt.href)
          if (evt.href){
            //console.log(decodeURIComponent(evt.href))
            var link = decodeURIComponent(evt.href)
            evt.href = link.replace(/^(?:http.?.*\?to\=)(.*?)(?:\&.*)?$/,'$1')
          }
        }
      }
    }

})();