104.com.tw Helper

Add useful links to 104 job pages.

2018-10-14 기준 버전입니다. 최신 버전을 확인하세요.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        104.com.tw Helper
// @namespace   https://github.com/gslin/104-helper-userscript
// @description Add useful links to 104 job pages.
// @include     https://www.104.com.tw/*
// @version     0.20181013.6
// @license     MIT
// ==/UserScript==

(function(){
    'use strict';

    let company_name_normalize = function(name){
        return name
            .trim()
            .replace(/^(法|英|)屬/, '')
            .replace(/^(開曼群島|英|美|港|香港)商/, '')
            .replace(/(台|臺)灣(子|分)公司$/, '')
            .replace(/(子|分)公司$/, '')
            .replace(/股份有限公司$/, '')
            .replace(/有限公司$/, '')
            .replace(/公司$/, '');
    };

    let pathname = document.location.pathname;

    if ('/jobbank/custjob/index.php' === pathname) {
        let company_el = document.querySelector('li.comp_name h1');
        let company_name = company_name_normalize(company_el.textContent);

        let qollie_link = 'https://www.qollie.com/search?keyword=' + encodeURIComponent(company_name) + '&kind=company';
        let qollie_el = document.createElement('a');
        qollie_el.setAttribute('href', qollie_link);
        qollie_el.setAttribute('style', 'display: block;');
        qollie_el.innerHTML = '去 Qollie 看看';
        company_el.parentElement.appendChild(qollie_el);

        let ursalary_link = 'http://ursalary0.com/salaries/salary_lists_tw/q:' + encodeURIComponent(company_name);
        let ursalary_el = document.createElement('a');
        ursalary_el.setAttribute('href', ursalary_link);
        ursalary_el.setAttribute('style', 'display: block;');
        ursalary_el.innerHTML = '去 Ursalary 看看';
        company_el.parentElement.appendChild(ursalary_el);

        let ptt_link = 'https://www.google.com/search?q=' + encodeURIComponent(company_name) + '+site:www.ptt.cc';
        let ptt_el = document.createElement('a');
        ptt_el.setAttribute('href', ptt_link);
        ptt_el.setAttribute('style', 'display: block;');
        ptt_el.innerHTML = '去 Ptt 看看 (by Google)';
        company_el.parentElement.appendChild(ptt_el);

        let google_link = 'https://www.google.com/search?q=' + encodeURIComponent(company_name) + '+面試';
        let google_el = document.createElement('a');
        google_el.setAttribute('href', google_link);
        google_el.setAttribute('style', 'display: block;');
        google_el.innerHTML = '去 Google 看看';
        company_el.parentElement.appendChild(google_el);

        return;
    }

    if ('/job/' === pathname) {
        let company_el = document.querySelector('span.company a');
        let company_name = company_name_normalize(company_el.textContent);

        let qollie_link = 'https://www.qollie.com/search?keyword=' + encodeURIComponent(company_name) + '&kind=company';
        let qollie_el = document.createElement('a');
        qollie_el.setAttribute('href', qollie_link);
        qollie_el.setAttribute('style', 'display: block;');
        qollie_el.innerHTML = '去 Qollie 看看';
        company_el.parentElement.parentElement.appendChild(qollie_el);

        let ursalary_link = 'http://ursalary0.com/salaries/salary_lists_tw/q:' + encodeURIComponent(company_name);
        let ursalary_el = document.createElement('a');
        ursalary_el.setAttribute('href', ursalary_link);
        ursalary_el.setAttribute('style', 'display: block;');
        ursalary_el.innerHTML = '去 Ursalary 看看';
        company_el.parentElement.parentElement.appendChild(ursalary_el);

        let ptt_link = 'https://www.google.com/search?q=' + encodeURIComponent(company_name) + '+site:www.ptt.cc';
        let ptt_el = document.createElement('a');
        ptt_el.setAttribute('href', ptt_link);
        ptt_el.setAttribute('style', 'display: block;');
        ptt_el.innerHTML = '去 Ptt 看看 (by Google)';
        company_el.parentElement.parentElement.appendChild(ptt_el);

        let google_link = 'https://www.google.com/search?q=' + encodeURIComponent(company_name) + '+面試';
        let google_el = document.createElement('a');
        google_el.setAttribute('href', google_link);
        google_el.setAttribute('style', 'display: block;');
        google_el.innerHTML = '去 Google 看看';
        company_el.parentElement.parentElement.appendChild(google_el);

        return;
    }
})();