mirror of
https://github.com/tcsenpai/Zundler.git
synced 2025-06-07 03:55:26 +00:00
Use main() function in inject.js
This commit is contained in:
parent
c0951bc3c0
commit
649324d576
@ -232,17 +232,24 @@ const observer = new MutationObserver((mutationList) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Set parent window title and trigger data transmission
|
var main = function() {
|
||||||
var favicon = window.document.querySelector("link[rel*='icon']");
|
// Set parent window title and trigger data transmission
|
||||||
if (favicon) { favicon = favicon.getAttribute('href'); }
|
var favicon = window.document.querySelector("link[rel*='icon']");
|
||||||
var title = window.document.querySelector('head>title');
|
if (favicon) { favicon = favicon.getAttribute('href'); }
|
||||||
if (title) { title = title.innerText; }
|
var title = window.document.querySelector('head>title');
|
||||||
|
if (title) { title = title.innerText; }
|
||||||
|
|
||||||
|
window.parent.postMessage({
|
||||||
|
action: "set_title",
|
||||||
|
argument: {
|
||||||
|
title: title,
|
||||||
|
favicon: favicon
|
||||||
|
}
|
||||||
|
}, '*');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
window.addEventListener('load', main);
|
||||||
|
|
||||||
|
|
||||||
window.parent.postMessage({
|
|
||||||
action: "set_title",
|
|
||||||
argument: {
|
|
||||||
title: title,
|
|
||||||
favicon: favicon
|
|
||||||
}
|
|
||||||
}, '*');
|
|
||||||
//# inject.js
|
//# inject.js
|
||||||
|
Loading…
x
Reference in New Issue
Block a user