LinkedIn Recent Activity Redirect

Redirects LinkedIn profile pages to recent activity

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

Advertisement:

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

Advertisement:

// ==UserScript==
// @name         LinkedIn Recent Activity Redirect
// @namespace    https://github.com/chr1sx
// @version      1.0.1
// @description  Redirects LinkedIn profile pages to recent activity
// @author       chr1sx
// @match        https://www.linkedin.com/*
// @grant        window.onurlchange
// @run-at       document-start
// @license      MIT
// @icon         https://www.google.com/s2/favicons?domain=linkedin.com&sz=64
// ==/UserScript==

(function() {
    'use strict';

    function checkAndRedirect() {
        const currentUrl = window.location.href;

        const profileRegex = /^https:\/\/www\.linkedin\.com\/in\/[^/]+\/?(\?.*)?$/;

        if (profileRegex.test(currentUrl)) {
            if (!currentUrl.includes('/recent-activity')) {
                const baseUrl = currentUrl.split('?')[0].replace(/\/$/, "");
                const activityUrl = `${baseUrl}/recent-activity/all/`;

                console.log('[Redirector] Redirecting to:', activityUrl);
                window.location.replace(activityUrl);
            }
        }
    }

    checkAndRedirect();

    let lastUrl = location.href;
    const observer = new MutationObserver(() => {
        const url = location.href;
        if (url !== lastUrl) {
            lastUrl = url;
            checkAndRedirect();
        }
    });

    observer.observe(document, { subtree: true, childList: true });

    window.addEventListener('popstate', checkAndRedirect);

    const pushState = history.pushState;
    history.pushState = function() {
        pushState.apply(history, arguments);
        checkAndRedirect();
    };
})();