history.pushState
), testing if they match the isPageToReplace
criteria, then replacing a specified element with another element.
The element that is replaced is specified by a CSS selector and usually represents the “main content” container of the page. The “replacement” works by setting display: none
on the original content and adding the new content immediately after it in the DOM.
The following table shows the SetupPageReplacer
’s configuration properties, their types, and descriptions:
true
if the provided URL is a page where the
replacement should be active.isPageToReplace
returns true
."append"
, the new element will be appended to the element that is
found by selectorToReplace
instead of replacing it.document.title
should be changed to when page replacement is
active.onExistsObserver
’s configuration properties, their types, and descriptions:
onExistsObserver
function returns an object with a disconnect
function that can be called to disconnect the observer.
getContentBlocksByRow
, which returns the current blocks, and
setContentBlocksByRow
, which takes a new JSUIContentBlocksByRow-array and updates
the blocks. The returned getContentBlocksByRow
function has to be passed to CategoryPage
/SearchPage
.
The function signature looks as follows:
ImagePlaceholder
), to avoid layout shifts and ensure scroll restoration works correctly.