Geni Profile Helper

Go to profiles and trees from search results

当前为 2023-04-12 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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>';
            }
        }
    });
})();