linkedin-clean-url

Cleans the tracking stuff from LinkedIn URLs.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        linkedin-clean-url
// @description Cleans the tracking stuff from LinkedIn URLs.
// @homepageURL https://github.com/caglartoklu/linkedin-clean-url.user.js
// @author      Caglar Toklu
// @version     1.0.0
// @date        2016-04-11
// @namespace   https://github.com/caglartoklu/greasemonkey
// @license     BSD 2-Clause
// @copyright   2016, Caglar Toklu
// @include     http://*linkedin.com/*
// @include     https://*linkedin.com/*
// @run-at      document-start
// @grant       none
// ==/UserScript==

// if you use this script,
// https://www.linkedin.com/pulse/some-topic-some-guy?trk=eml-b...
// becomes:
// https://www.linkedin.com/pulse/some-topic-some-guy

// also, the following:
// https://www.linkedin.com/home?trk=nav_responsive_tab_home
// becomes:
// https://www.linkedin.com/home

// This script does not increase the security, nor it provides privacy.
// LinkedIn will still be able to track you.

(function () {

  var debugPrint = function (message) {
    var indicator = "linkedin-clean-url.user.js : ";
    var debugMode = false;
    if (debugMode) {
      console.log(indicator + message);
    }
  };

  var deleteAfter = function (haystack, needle) {
    // Returns a copy of haystack where all the characters after needle is removed.
    // If needle does not occur in haystack, then haystack will be returned as it is.
    // haystack: string, the big string.
    // needle: string, the small string to be found.
    var result = haystack;
    var position = haystack.indexOf(needle);
    if (position > - 1) {
      result = haystack.substr(0, position);
    }
    return result;
  };

  var cleanLinkedInUrl = function (url) {
    var needle = '?trk=';
    return deleteAfter(url, needle);
  };

  var currentUrl = window.location.href;
  var newUrl = cleanLinkedInUrl(window.location.href);
  if (currentUrl != newUrl) {
    // change the URL if and only if has tracking.
    window.location.replace(newUrl);
  }
}());