/**
* URL utilities - scroll-to-UUID and edit-draft-from-URL
*
* Reads: SFE.TIMING (set early in frontend-inline-edit.js)
* Exposes: SFE.UrlUtils { scrollToUUID, handleEditDraftFromURL }
*
* This module self-registers its own DOMContentLoaded and hashchange listeners,
* so those can be removed from frontend-inline-edit.js entirely.
*/
(function() {
'use strict';
window.MWP = window.MWP || {};
window.MWP.SFE = window.MWP.SFE || {};
const SFE = window.MWP.SFE;
SFE.ManagerData = SFE.ManagerData || {};
/**
* Custom scroll function to smoothly scroll to a specific UUID
*/
function scrollToUUID() {
if (!location.hash) return;
const uuid = decodeURIComponent(location.hash.slice(1));
const el = document.querySelector(
`[data-mwp-sfe-uuid="${CSS.escape(uuid)}"]`
);
if (!el) return;
requestAnimationFrame(() => {
requestAnimationFrame(() => {
const rect = el.getBoundingClientRect();
const top =
window.pageYOffset +
rect.top -
window.innerHeight / 2 +
rect.height / 2;
window.scrollTo({
top,
behavior: 'smooth'
});
el.focus({ preventScroll: true });
});
});
}
/**
* Auto-trigger draft edit mode if URL contains action=edit-draft
*/
function handleEditDraftFromURL() {
const TIMING = SFE.TIMING;
const urlParams = new URLSearchParams(window.location.search);
const action = urlParams.get('action');
if (action === 'edit-draft' && location.hash) {
const uuid = decodeURIComponent(location.hash.slice(1));
if (!uuid) return;
const element = document.querySelector(`[data-mwp-sfe-uuid="${CSS.escape(uuid)}"]`);
if (!element) return;
// Mark element for auto-edit after preview loads
element.dataset.autoEditDraft = 'true';
// Wait for page to settle, then trigger preview
setTimeout(() => {
// CSS [data-mwp-sfe-uuid] handles scroll
element.scrollIntoView({ behavior: 'smooth', block: 'start' });
// Trigger click to start preview
setTimeout(() => {
element.click();
}, TIMING.TRIGGER_DELAY);
}, 100);
}
}
// Initial load
document.addEventListener('DOMContentLoaded', () => {
scrollToUUID();
handleEditDraftFromURL();
});
// Hash changes (clicks, back/forward)
window.addEventListener('hashchange', scrollToUUID);
SFE.UrlUtils = { scrollToUUID, handleEditDraftFromURL };
})();
Comentarios en: Hello world!
https://obresvall.com/hello-world/
Thu, 17 Sep 2026 08:53:03 +0000
hourly
1
Por: binance
https://obresvall.com/hello-world/#comment-66739
Thu, 17 Sep 2026 08:53:03 +0000http://dentalsantjordi.online/?p=1#comment-66739Your article helped me a lot, is there any more related content? Thanks!
]]>
Por: Bonus d'inscription Binance
https://obresvall.com/hello-world/#comment-66738
Wed, 16 Sep 2026 17:08:33 +0000http://dentalsantjordi.online/?p=1#comment-66738Thanks for sharing. I read many of your blog posts, cool, your blog is very good. https://accounts.binance.bh/register/person?ref=JW3W4Y3A
]]>
Por: Binance推荐代码
https://obresvall.com/hello-world/#comment-66737
Wed, 16 Sep 2026 13:04:41 +0000http://dentalsantjordi.online/?p=1#comment-66737Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://www.binance.com/ar-BH/register?ref=UT2YTZSU
]]>
Por: b^onus de indicac~ao da binance
https://obresvall.com/hello-world/#comment-66736
Wed, 16 Sep 2026 03:46:37 +0000http://dentalsantjordi.online/?p=1#comment-66736Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
]]>
Por: www.binance.info注册
https://obresvall.com/hello-world/#comment-66735
Tue, 15 Sep 2026 11:47:22 +0000http://dentalsantjordi.online/?p=1#comment-66735Your point of view caught my eye and was very interesting. Thanks. I have a question for you. https://www.binance.info/de/register?ref=W0BCQMF1
]]>
Por: Registrera
https://obresvall.com/hello-world/#comment-66734
Tue, 15 Sep 2026 06:40:50 +0000http://dentalsantjordi.online/?p=1#comment-66734Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://accounts.binance.bh/register/person?ref=IHJUI7TF
]]>
Por: 创建免费账户
https://obresvall.com/hello-world/#comment-66733
Tue, 15 Sep 2026 00:46:54 +0000http://dentalsantjordi.online/?p=1#comment-66733Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
]]>
Por: skapa binance-konto
https://obresvall.com/hello-world/#comment-66732
Mon, 14 Sep 2026 23:44:51 +0000http://dentalsantjordi.online/?p=1#comment-66732Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
]]>
Por: anm"ala dig till binance
https://obresvall.com/hello-world/#comment-66731
Mon, 14 Sep 2026 20:19:21 +0000http://dentalsantjordi.online/?p=1#comment-66731Your point of view caught my eye and was very interesting. Thanks. I have a question for you. https://accounts.binance.info/es-MX/register-person?ref=A00OPRX4
]]>
Por: binance registration
https://obresvall.com/hello-world/#comment-66730
Mon, 14 Sep 2026 11:09:59 +0000http://dentalsantjordi.online/?p=1#comment-66730Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
]]>