Created
April 11, 2012 14:12
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
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="/files/cover.css" /> | |
<script type="text/javascript" src="/files/js/jquery-1.7.1.min.js"></script> | |
<script type="text/javascript" src="/files/js/jquery-ui-1.8.18.custom.min.js"></script> | |
<script> | |
$(function() { | |
$.ajaxSetup({ | |
beforeSend: function(xhr, settings) { | |
function getCookie(name) { | |
var cookieValue = null; | |
if (document.cookie && document.cookie != '') { | |
var cookies = document.cookie.split(';'); | |
for (var i = 0; i < cookies.length; i++) { | |
var cookie = jQuery.trim(cookies[i]); | |
// Does this cookie string begin with the name we want? | |
if (cookie.substring(0, name.length + 1) == (name + '=')) { | |
cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); | |
break; | |
} | |
} | |
} | |
return cookieValue; | |
} | |
if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) { | |
// Only send the token to relative URLs i.e. locally. | |
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); | |
} | |
} | |
}); | |
$("#bb").draggable({ scroll: false }); | |
$("#submit").click(function(){ | |
var t = $("#bb").position().top; | |
var l = $("#bb").position().left; | |
var n = $("#name").val(); | |
var h = $("#headline").val(); | |
$.post("check/", { top: t, left: l, name: n, headline: h}, function(data) { | |
window.location.href = "/"; | |
} | |
); | |
}); | |
$("#box").draggable({ scroll: false, handle: "div#bar" }); | |
$("#name").keyup(function() { | |
$("div#n").html('<p id="nf">'+this.value+'</p>'); | |
}); | |
$("#headline").keyup(function() { | |
$("div#h").html('<p id="hf">'+this.value+'</p>'); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<div id="bb"> | |
<div id="n"> | |
</div> | |
<div id="h"> | |
</div> | |
</div> | |
<div id="box"> | |
<div id="bar"> | |
</div> | |
<form class="f"> | |
Name:<input type="text" id="name" /> | |
Headline:<input type="text" id="headline" /> | |
<input type="submit" value="Next" id="submit" /> | |
</form> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment