MCPcopy Index your code
hub / github.com/XIU2/UserScript / addHistory

Function addHistory

Autopage.user.js:2304–2315  ·  view source on GitHub ↗
(pageE, title, url)

Source from the content-addressed store, hash-verified

2302 }
2303 // 添加历史记录
2304 function addHistory(pageE, title, url) {
2305 if (!curSite.pageUrl) return
2306 // 对于自带类似功能 或者 覆盖了 history 原生函数的网站,则跳过不再添加历史记录
2307 if (window.top.history.toString() !== '[object History]') return
2308 title = title || ((pageE.querySelector('title')) ? pageE.querySelector('title').textContent : window.top.document.title);
2309 url = url || curSite.pageUrl;
2310 window.top.document.Autopage_nowUrl = curSite.pageUrl;
2311 // 对于下一页 URL 和当前网页 URL 的协议不同时,以当前网页 URL 协议为准
2312 if (url.indexOf(window.top.location.protocol) === -1) url = url.replace(/^https?:/,window.top.location.protocol)
2313 window.top.history.pushState('Autopage_history', title, url);
2314 window.top.document.title = title;
2315 }
2316 // 插入 <Script>
2317 function insScript(selector, contextNode = document, toE = document.body) {
2318 let scriptElems = contextNode;

Callers 5

mangabz_insertEFunction · 0.85
dm5_insertEFunction · 0.85
xmanhua_insertEFunction · 0.85
insIframeFunction · 0.85
processElemsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected