Skip to content

Commit

Permalink
iframe!
Browse files Browse the repository at this point in the history
  • Loading branch information
fs-context committed Nov 24, 2024
1 parent c40fb80 commit 954e3ed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/fs-context/samples/fs-iframe/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ let translator = Translator.create("zh-cn", {
move: "移动$name到$pos",
resize: "调整$name的尺寸为$size",
setLayer: "设置$name的图层为$layer",
remove: "移除$name"
});
interface Position {
x: number;
Expand All @@ -18,7 +19,7 @@ interface Position {
export default class FSIFrame extends Extension {
id = "fsiframe";
displayName = translator.load("name");
version = new Version(1, 0, 0);
version = new Version(1, 0, 2);
description = translator.load("description");
collaborators = [
new Collaborator("FallingShrimp", "https://rundll86.github.io")
Expand All @@ -43,6 +44,7 @@ export default class FSIFrame extends Extension {
}
]
}, function createIF(arg) {
if (document.getElementById(`fsiframe-${arg.$name}`)) return;
let pos = parsePos(arg.$pos);
let size = parsePos(arg.$size);
let iframe = Unnecessary.elementTree("iframe")
Expand Down Expand Up @@ -115,6 +117,15 @@ export default class FSIFrame extends Extension {
}, function setLayer(arg) {
let iframe = document.getElementById(`fsiframe-${arg.$name}`);
iframe?.style.setProperty("zIndex", arg.$layer);
}),
Block.create(translator.load("remove"), {
arguments: [
{
name: "$name"
}
]
}, function remove(arg) {
document.getElementById(`fsiframe-${arg.$name}`)?.remove();
})
]
init(runtime: Scratch) {
Expand Down
2 changes: 2 additions & 0 deletions src/fs-context/samples/fs-iframe/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@

.fsi-iframe {
position: absolute;
border:none;
outline:none;
}

0 comments on commit 954e3ed

Please sign in to comment.