Skip to content

Instantly share code, notes, and snippets.

@fastcodecoq
Created September 14, 2013 08:01
Show Gist options
  • Save fastcodecoq/6559796 to your computer and use it in GitHub Desktop.
Save fastcodecoq/6559796 to your computer and use it in GitHub Desktop.
$("#captura_").off("submit").on( "submit" , function send(e){
if(running)
return false;
e.preventDefault();
e.stopPropagation();
$("#error").hide().text("");
var url = $("input[name=\"url\"]").val();
if( /^www\./.test(url))
url = "http://" + url;
console.log(url)
if(!/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/.test(url))
{
$("#error").text("La url que ingresaste no es correcta").show();
return false;
}
running = true;
$("#over").show();
socket.emit("takeshot", {url : url});
return false;
});
$("*[data-action=\"shot\"]").on("click", function(e){
e.preventDefault();
e.stopPropagation();
var stateObj = { foo: "bar" };
history.pushState(stateObj, "page 2", "s");
$("#captura_").trigger("submit");
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment