StackExchange Link Personalizer

Personalizes links to questions with your userID for sharing and collecting (Announcer/Booster/Publicist) badges

Από την 26/02/2017. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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==
// @id             izzysoft_SELP
// @name           StackExchange Link Personalizer
// @version        1.3
// @namespace      http://projects.izzysoft.de/
// @author         IzzySoft
// @description    Personalizes links to questions with your userID for sharing and collecting (Announcer/Booster/Publicist) badges
// @license        CC BY-NC-SA
// @include        http*://*.stackexchange.com/*
// @include        http*://askubuntu.com/*
// @include        http*://mathoverflow.net/*
// @include        http*://serverfault.com/*
// @include        http*://stackapps.com/*
// @include        http*://stackoverflow.com/*
// @include        http*://meta.stackoverflow.com/*
// @include        http*://superuser.com/*
// @run-at         document-end
// ==/UserScript==
var skipClasses = ['flag-post-link','close-question-link','edit-post','comments-link '];

if ( document.getElementsByClassName('profile-me')[0].href.match(/\/users\/(\d+)\/.*/i) ) {
  var user_id = RegExp.$1;

  for(var i = 0; i < document.links.length; i++) {
    var elem = document.links[i];
    if ( skipClasses.indexOf(elem.className) != -1 ) continue;
    if ( elem.hostname != document.location.hostname ) continue;
    if ( elem.href.match(/\/questions\/(\d+)\/.*(\?.+#.+)/i) ) {
      null; // doesn't work with replaced URL here for some reason
    } else if ( elem.href.match(/\/questions\/(\d+)\/.*(#.+)/i) ) {
      elem.href='/q/'+RegExp.$1+'/'+user_id+RegExp.$2;
    } else if ( elem.href.match(/\/questions\/(\d+)\/.*/i) ) {
      elem.href='/q/'+RegExp.$1+'/'+user_id;
    }
  }
}