mirror of
https://github.com/Dasemu/X-GeoBlock.git
synced 2026-11-26 15:26:09 +00:00
fix: render about fallback in same-origin page frame
This commit is contained in:
1 parent
067cbfd24c
commit
5a492b0cc3
7 files changed
+76
-99
No files matched your search
@@ -12,25 +12,5 @@ extensionApi.runtime.onMessage.addListener((message, _sender, sendResponse) => {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (message?.type === "create-about-frame") {
|
||||
removeFrame(message.username);
|
||||
const frame = document.createElement("iframe");
|
||||
frame.dataset.xGeoBlockUser = message.username.toLowerCase();
|
||||
frame.hidden = true;
|
||||
frame.src = `https://x.com/${encodeURIComponent(message.username)}/about`;
|
||||
document.querySelector("#frames").append(frame);
|
||||
sendResponse({ ok: true });
|
||||
return false;
|
||||
}
|
||||
if (message?.type === "remove-about-frame") {
|
||||
removeFrame(message.username);
|
||||
sendResponse({ ok: true });
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
function removeFrame(username) {
|
||||
const key = String(username).toLowerCase();
|
||||
document.querySelector(`iframe[data-x-geo-block-user="${CSS.escape(key)}"]`)?.remove();
|
||||
}
|
||||
Reference in new issue
Block a user