mirror of
https://github.com/scratchfoundation/scratchx.git
synced 2024-11-28 18:45:49 -05:00
Add handlers for file and url inputs
This commit is contained in:
parent
34d59aab3e
commit
ece03eb8c5
2 changed files with 23 additions and 2 deletions
|
@ -41,7 +41,7 @@
|
||||||
<p><a href="">What is a .sbx file?</a></p>
|
<p><a href="">What is a .sbx file?</a></p>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<button>Browse for local file</button>
|
<button data-action="load-file">Browse for local file</button>
|
||||||
</section>
|
</section>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
<p><a href="">What is a ScratchX URL?</a></p>
|
<p><a href="">What is a ScratchX URL?</a></p>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<div class="input-plus-button">
|
<div class="input-plus-button" data-action="load-url">
|
||||||
<input type="text" placeholder="paste url..." />
|
<input type="text" placeholder="paste url..." />
|
||||||
<button>Open</button>
|
<button>Open</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -104,6 +104,27 @@ swfobject.switchOffAutoHideShow();
|
||||||
swfobject.embedSWF('Scratch.swf', 'editor', '100%', '100%', '11.7.0', 'libs/expressInstall.swf',
|
swfobject.embedSWF('Scratch.swf', 'editor', '100%', '100%', '11.7.0', 'libs/expressInstall.swf',
|
||||||
flashVars, params, null, handleEmbedStatus);
|
flashVars, params, null, handleEmbedStatus);
|
||||||
|
|
||||||
|
|
||||||
|
/* File uploads */
|
||||||
|
|
||||||
|
function sendFileToFlash() {
|
||||||
|
var file = this.files[0];
|
||||||
|
console.log("Got file for Flash", file);
|
||||||
|
}
|
||||||
|
|
||||||
|
$("[data-action='load-file']").click(function(e) {
|
||||||
|
$('<input type="file" />').on('change', sendFileToFlash).click();
|
||||||
|
});
|
||||||
|
|
||||||
|
function sendURLtoFlash(url) {
|
||||||
|
console.log("Got URL for Flash", url)
|
||||||
|
}
|
||||||
|
|
||||||
|
$("[data-action='load-url'] button").click(function(e) {
|
||||||
|
sendURLtoFlash($(e.target).siblings('input[type="text"]').val());
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/* Page switching */
|
/* Page switching */
|
||||||
|
|
||||||
$("[data-staticlink]").click(function(e) {
|
$("[data-staticlink]").click(function(e) {
|
||||||
|
|
Loading…
Reference in a new issue