StackExchange link newtaber

this code opens links from posts, answers, comments and user signatures in the new tab instead of the annoying in-place opening

Από την 03/04/2018. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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            StackExchange link newtaber
// @namespace       almaceleste
// @version         0.3.8
// @description     this code opens links from posts, answers, comments and user signatures in the new tab instead of the annoying in-place opening
// @description:ru  этот код открывает ссылки из постов, ответов, комментариев и подписей пользователей в новой вкладке вместо надоедливого открытия в текущей
// @author          (ɔ) Paola Captanovska
// @license         AGPL-3.0+; http://www.gnu.org/licenses/agpl.txt
// @icon            https://cdn1.iconfinder.com/data/icons/simple-icons/32/stackexchange-32-black.png
// @icon64          https://cdn1.iconfinder.com/data/icons/simple-icons/128/stackexchange-128-black.png

// @homepageURL     https://greatest.deepsurf.us/en/users/174037-almaceleste
// @homepageURL     https://openuserjs.org/users/almaceleste
// @homepageURL     https://github.com/almaceleste/userscripts
// @supportURL      https://github.com/almaceleste/userscripts/issues

// @require         https://openuserjs.org/src/libs/sizzle/GM_config.js
// @grant           GM_getValue
// @grant           GM_setValue
// @grant           GM_registerMenuCommand

// @match           https://*.stackexchange.com/questions/*
// @match           https://*.stackoverflow.com/questions/*
// @match           https://askubuntu.com/questions/*
// @match           https://mathoverflow.net/questions/*
// @match           https://serverfault.com/questions/*
// @match           https://stackapps.com/questions/*
// @match           https://superuser.com/questions/*
// ==/UserScript==

// ==OpenUserJS==
// @author almaceleste
// ==/OpenUserJS==

const postlink = '.post-text a';
const commentlink = '.comment-copy a';
const userdetailslink = '.user-details a';

const windowcss = '#newtaberCfg {background-color: lightblue;} #newtaberCfg .reset_holder {float: left; position: relative; bottom: -1em;} #newtaberCfg .saveclose_buttons {margin: .7em;}';
const iframecss = 'height: 19.2em; width: 30em; border: 1px solid; border-radius: 3px; position: fixed; z-index: 999;';

GM_registerMenuCommand('StackExchange link newtaber Settings', opencfg);

function opencfg()
{
	GM_config.open();
	newtaberCfg.style = iframecss;
}

GM_config.init(
{
    id: 'newtaberCfg',
    title: 'StackExchange link newtaber Settings',
    fields:
    {
        postlink:
        {
            section: ['Link types', 'Choose link types to open in new tab'],
            label: 'post links',
            labelPos: 'right',
            type: 'checkbox',
            default: true,
        },
        commentlink:
        {
            label: 'comment links',
            labelPos: 'right',
            type: 'checkbox',
            default: true,
        },
        userdetailslink:
        {
            label: 'userdetails links',
            labelPos: 'right',
            type: 'checkbox',
            default: true,
        },
    },
    css: windowcss,
    events:
    {
        save: function() {
            GM_config.close();
        }
    },
});

(function() {
    'use strict';

    var links = [];

    if(GM_config.get('postlink')) links.push(postlink);
    if(GM_config.get('commentlink')) links.push(commentlink);
    if(GM_config.get('userdetailslink')) links.push(userdetailslink);

    var pattern = links.join(', ');

    $(pattern).each(function() {
        $(this).click(function(event) {
            event.preventDefault();
            event.stopPropagation();
            window.open(this.href, '_blank');
        });
    });
})();