Allow loading URLs from links

This commit is contained in:
Ray Schamp 2015-05-06 19:55:28 -04:00
parent 83f2b0fa7e
commit 06e031cdc8
2 changed files with 11 additions and 5 deletions

View file

@ -52,7 +52,7 @@
<p><a href="">What is a ScratchX URL?</a></p>
</section>
<section>
<form class="input-plus-button" data-action="load-url">
<form class="input-plus-button url-load-form">
<input type="text" placeholder="paste url..." />
<button type="submit">Open</button>
</form>
@ -66,15 +66,15 @@
</section>
<section>
<ul>
<li><a href="">
<li><a href="?url=./scratch_extensions/picoExtension.js" data-action="load-url">
<h3>Extension 1</h3>
<p>Extension 1 description</p>
</a></li>
<li><a href="">
<li><a href="?url=./scratch_extensions/picoExtension.js" data-action="load-url">
<h3>Extension 2</h3>
<p>Extension 2 description</p>
</a></li>
<li><a href="">
<li><a href="?url=./scratch_extensions/picoExtension.js" data-action="load-url">
<h3>Extension 3</h3>
<p>Extension 3 description</p>
</a></li>

View file

@ -139,7 +139,13 @@ function sendURLtoFlash(url) {
}
}
$("[data-action='load-url']").submit(function(e) {
$("[data-action='load-url']").click(function(e) {
e.preventDefault();
showPage("editor");
sendURLtoFlash($(this).attr("href"));
});
$(".url-load-form").submit(function(e) {
e.preventDefault();
showPage("editor");
sendURLtoFlash($('input[type="text"]', this).val());