Switched to jQuery event handlers
This commit is contained in:
parent
c50ac9e462
commit
dad5188e19
@ -65,7 +65,7 @@ define('CONN', (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "")?'http':'ht
|
||||
<h2 id="loading"><img src="img/loading.gif" /><br/>Loading..</h2>
|
||||
<hr class="small">
|
||||
<span style="text-shadow: 0px 0px 12px #000000;" class="subheading">Give it a try! <input id="showcase_url" type="url" placeholder="eg. http://xkcd.com" />
|
||||
<input id="showcase_button" type="button" onclick="web2pic();" value="GO" /></div>
|
||||
<input id="showcase_button" type="button" value="GO" /></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,20 +1,30 @@
|
||||
function web2pic()
|
||||
{
|
||||
$("#showcase_button").attr("disabled","true");
|
||||
var url = $("#showcase_url").val();
|
||||
var urlenc = encodeURIComponent(url);
|
||||
var imageURL = "api.php?js=no&token=0e316498db6211f940951e"+(urlenc)+"8be8cdf7089770&type=$type&viewport=1200x330&url="+urlenc;
|
||||
//$("#intro-header").css('background-image', 'url(\'/img/loading.gif\')');
|
||||
$(function() {
|
||||
function web2pic(url)
|
||||
{
|
||||
$("#showcase_button").attr("disabled","true");
|
||||
var urlenc = encodeURIComponent(url);
|
||||
var imageURL = "http://http2pic.haschek.at/api.php?js=no&token=0e316498db6211f940951e"+(urlenc)+"8be8cdf7089770&type=$type&viewport=1200x330&url="+urlenc;
|
||||
//$("#intro-header").css('background-image', 'url(\'/img/loading.gif\')');
|
||||
|
||||
$("#loading").show();
|
||||
$("#loading").show();
|
||||
|
||||
console.log(imageURL);
|
||||
|
||||
$("#preloader").attr('src',imageURL);
|
||||
$("#preloader").load(function() {
|
||||
$("#intro-header").css('background-image', 'url(\'' + imageURL + '\')');
|
||||
$("#loading").hide();
|
||||
$("#preloader").attr('src',imageURL);
|
||||
$("#preloader").load(function() {
|
||||
$("#intro-header").css('background-image', 'url(\'' + imageURL + '\')');
|
||||
$("#loading").hide();
|
||||
$("#showcase_button").removeAttr("disabled");
|
||||
});
|
||||
}
|
||||
|
||||
$("#showcase_button").click(function() {
|
||||
web2pic($('#showcase_url').val());
|
||||
});
|
||||
console.log(imageURL);
|
||||
|
||||
setTimeout(function(){$("#showcase_button").removeAttr("disabled");},2000);
|
||||
}
|
||||
$("#showcase_url").keypress(function(e) {
|
||||
if(e.keyCode === 13) {
|
||||
web2pic($("#showcase_url").val());
|
||||
}
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user