mirror of
https://github.com/tcsenpai/Zundler.git
synced 2025-06-06 11:35:40 +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 favicon = window.document.querySelector("link[rel*='icon']");
|
||||
if (favicon) { favicon = favicon.getAttribute('href'); }
|
||||
var title = window.document.querySelector('head>title');
|
||||
if (title) { title = title.innerText; }
|
||||
var main = function() {
|
||||
// Set parent window title and trigger data transmission
|
||||
var favicon = window.document.querySelector("link[rel*='icon']");
|
||||
if (favicon) { favicon = favicon.getAttribute('href'); }
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user