-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
made lively_iframe live_programmable
SQUASHED: AUTO-COMMIT-src-components-widgets-lively-iframe.html,AUTO-COMMIT-src-components-widgets-lively-iframe.js,AUTO-COMMIT-src-components-widgets-lively-iframe.js.l4a,
- Loading branch information
Showing
2 changed files
with
47 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
} | ||
|
||
input { | ||
width: 40px; | ||
width: 400px; | ||
flex: 1; | ||
margin: 2px; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,60 @@ | ||
import Morph from 'src/components/widgets/lively-morph.js'; | ||
|
||
export default class LivelyIFrame extends Morph { | ||
|
||
get input() { | ||
return this.get("#input"); | ||
} | ||
|
||
get frame() { | ||
return this.get("#frame"); | ||
} | ||
|
||
async initialize() { | ||
this.windowTitle = "iFrame Browser" | ||
var input = this.get("#input"); | ||
input.onchange = () => this.update(); | ||
|
||
if (!this.getAttribute("src")) { | ||
this.setURL("//lively-kernel.org/") | ||
} else { | ||
this.setURL(this.getAttribute("src")) | ||
this.windowTitle = "iFrame Browser"; | ||
this.input.onchange = () => this.update(); | ||
|
||
if (this.getAttribute("src")) { | ||
this.setURL(this.getAttribute("src")); | ||
} | ||
} | ||
|
||
update() { | ||
var input = this.get("#input"); | ||
this.get("#frame").src = input.value; | ||
const url = this.input.value; | ||
this.updatePersistence(url); | ||
this.updateFrame(url); | ||
} | ||
|
||
setURL(url){ | ||
this.setAttribute("src", url) | ||
this.get("#input").value = url | ||
this.get("#frame").src = url; | ||
|
||
updateFrame(url) { | ||
this.frame.src = url; | ||
} | ||
|
||
|
||
updatePersistence(url) { | ||
this.setAttribute("src", url); | ||
} | ||
|
||
getURL() { | ||
return this.getAttribute("src"); | ||
} | ||
|
||
setURL(url) { | ||
this.input.value = url; | ||
this.updatePersistence(url); | ||
this.updateFrame(url); | ||
} | ||
|
||
hideMenubar() { | ||
this.get("#menubar").hidden = true | ||
this.get("#menubar").hidden = true; | ||
} | ||
|
||
showMenubar() { | ||
this.get("#menubar").hidden = false | ||
this.get("#menubar").hidden = false; | ||
} | ||
|
||
livelyMigrate(other) { | ||
this.setURL(other.getURL()); | ||
} | ||
|
||
livelyExample() { | ||
this.setURL('//lively-kernel.org/') | ||
} | ||
|
||
} |