NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name real_url_tooltip // @namespace http://tampermonkey.net/ // @version 0.2 // @description Display the real URL location in a tooltip, allowing user to jump to this URL without any tracker triggering any anchor events. The script saves each domain name status. Default activation status is OFF. Activating is made by using shortcut "Alt+Ctrl+U". // @author You // @include * // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js // @grant GM_getValue // @grant GM_setValue // @copyright 2017, GBO (https://openuserjs.org/users/GBO) // @license MIT // ==/UserScript== (function() { 'use strict'; var dn = document.location.href.replace(/https?:\/\/([^\/]+).*/gi, '$1'); var activated = GM_getValue(dn); var remember; function initRUT() { // Real URL toolip var $rut = $('#real_url_tooltip'); if (!$rut.length) { $('body').append('<span id="real_url_tooltip" style="display: block; position: absolute; z-index: 10000; border: 1px solid grey; border-radius: 5px; background-color: #FFFFE0; padding: 2px 4px; font-family: sans-serif;">...</span>'); $rut = $('#real_url_tooltip'); $rut.fadeOut(); $('body').click(function() { $rut.fadeOut(); remember = ''; }); } // RUT A tag management $('a').mouseenter(function() { if (activated) { var $self = $(this); if ($self.attr('href') != remember) { $rut.hide(); remember = $self.attr('href'); $rut.promise().done(function() { var href = $self.attr('href'); if (href) { $rut.html('<a href="' + href + '" style="color: black;">' + href.replace(/(https?:\/\/)([^\/]+)(\/*)/i, '$1<strong>$2</strong>$3') + '</a>'); } else { $rut.html('N/A'); } $rut.fadeIn(); $rut.offset({ top: $self.offset().top + $self.height(), left: $self.offset().left }); }); } } }); // RUT Activator var $ruta = $('#real_url_tooltip_activator'); if (!$ruta.length) { $('body').append('<a id="real_url_tooltip_activator" style="display: block; position: fixed; z-index: 10000; border: 1px solid grey; border-radius: 8px; background-color: #B0FFB0; width: 16px; height: 16px; cursor: pointer;"></a>'); $ruta = $('#real_url_tooltip_activator'); $ruta.offset({ top: $( window ).height() - 40, left: -10 }); $ruta.click(function() { if (activated) { $ruta.css('background-color', '#FFB0B0'); activated = false; } else { $ruta.css('background-color', '#B0FFB0'); activated = true; } GM_setValue(dn, activated); }); activated = !activated; $ruta.click(); } } $(document).ready(function() { if (activated) { initRUT(); } else { document.addEventListener ('keydown', function (zEvent) { if (zEvent.ctrlKey && zEvent.altKey && zEvent.code === 'KeyU') { activated = true; initRUT(); } }); } }); })();