Geni Profile Helper

Go to profiles and trees from search results

目前為 2023-04-12 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Geni Profile Helper
// @namespace    nikku
// @license      MIT
// @version      0.2
// @description  Go to profiles and trees from search results
// @author       nikku
// @match        https://www.geni.com/search*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=geni.com
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    var trs = document.querySelectorAll('.sortable_table > tbody > tr');
    trs.forEach(function(tr) {
        var pid = tr.querySelector('.similar_profiles').id.replace('similar_profiles_link_', '');
        var profile = tr.querySelector('.profile-grid-area > div > a');
        if (profile.hasAttribute('onclick')) {
            var peopleUrl = '/people/-/' + pid;
            profile.removeAttribute('onclick');
            profile.href = peopleUrl;

            var manager = tr.querySelector('.manager-grid-area > a');
            if (manager) {
                manager.removeAttribute('onclick');
                manager.removeAttribute('href');
            }

            var name = tr.querySelector('.name-grid-area > div > span > a');
            name.removeAttribute('onclick');
            name.href = peopleUrl;
            name.classList.add('tipped-tip');
            name.setAttribute('bypass_newsfeed_helper', 'true');
            name.setAttribute('data-offset-x', '-10');
            name.setAttribute('data-offset-y', '-10');
            name.setAttribute('data-position', 'topleft');
            name.setAttribute('data-remote-data', '/profile/hovercard');
            name.setAttribute('data-remote-params', '{id:' + pid + '}');
            name.setAttribute('data-show-delay', '800');
            name.setAttribute('data-skin', 'hovercard');
            name.setAttribute('data-template', 'hover.profile');

            var actionList = tr.querySelector('.action-grid-area > .action_list');
            if (actionList) {
                actionList.innerHTML = '<li class="first"><a href="/family-tree/index/' + pid + '" draggable="false" ' +
                    'show_icon="true"><span><img src="https://www.geni.com/images/icn_family_tree.gif"> Открыть древо' +
                    '</span></a></li><li><a href="/list?focus_id=' + pid + '" draggable="false" show_icon="true"><span>' +
                    '<img src="https://www.geni.com/images/icn_settings.gif"> Показать список</span></a></li>';
            }
        }
    });
})();