完成10%

This commit is contained in:
rain
2026-07-24 18:11:16 +08:00
parent 8716a68fdb
commit 8870136d1b
33 changed files with 3853 additions and 336 deletions
+42 -1
View File
@@ -121,6 +121,43 @@
});
}
function getGenealogyId(search) {
var source = search === undefined ? (window.location && window.location.search) : search;
var params = new URLSearchParams(String(source || '').replace(/^\?/, ''));
return params.get('genealogyId') || '';
}
function withGenealogyId(href, genealogyId) {
var value = String(href || '');
var hashIndex;
var hash = '';
var parts;
var params;
if (!genealogyId || !value || value.charAt(0) === '#' || /^(?:https?:|mailto:|tel:)/i.test(value)) return value;
hashIndex = value.indexOf('#');
if (hashIndex >= 0) {
hash = value.slice(hashIndex);
value = value.slice(0, hashIndex);
}
parts = value.split('?');
params = new URLSearchParams(parts[1] || '');
params.set('genealogyId', genealogyId);
return parts[0] + '?' + params.toString() + hash;
}
function syncGenealogyContextLinks() {
var genealogyId = getGenealogyId();
if (!genealogyId) return;
$('[data-genealogy-context-link]').each(function () {
var $link = $(this);
$link.attr('href', withGenealogyId($link.attr('href'), genealogyId));
});
}
function updateDisplay($trigger, value) {
var target = $trigger.attr('data-update-target');
var $target = target ? $(target) : $trigger.closest('p').find('b').first();
@@ -226,11 +263,15 @@
bindSelectActions();
bindMessageActions();
bindSelectableCards();
syncGenealogyContextLinks();
});
window.ProfileUI = {
confirm: openConfirm,
closeLogout: closeLegacyLogout,
initLayui: initLayui
initLayui: initLayui,
getGenealogyId: getGenealogyId,
withGenealogyId: withGenealogyId,
syncGenealogyContextLinks: syncGenealogyContextLinks
};
})(window, window.jQuery || (window.layui && window.layui.$));