$(document).ready(function() {
! $.get("pages/title.html",function(r) {
! ! $(".page_text").html(r);
! }, "html");
! setInterval(function() {
! ! var currentpage = parseInt($("#currentpage").val()),
! ! ! num = window.location.hash.substring(1) || 0;
! ! if (currentpage != num) {
! ! ! goToPage(num);
! ! }
! }, 100);
! $(".continue a").click(function(e) {
! ! e.preventDefault();
! ! goToPage(parseInt($("#currentpage").val())+1);
! });!
! $(".choose a").click(function(e) {
! ! e.preventDefault();
! ! var newpage = $(this).attr("rel");
! ! goToPage(newpage);
! });!
! $(document).bind("keydown",function(e) {! !
! ! clearTimeout(typingPause);! !
! ! var currentpage = parseInt($("#currentpage").val());
! ! var k = keys[e.keyCode];
! ! if (k == "left") {
! ! ! currentpage--;
! ! ! goToPage(currentpage);
! ! } else if (k == "right") {
! ! ! currentpage++;
! ! ! goToPage(currentpage);
! ! } else if (k) {
! ! ! newpage += "" + k;
! ! ! typingPause = setTimeout(
! ! ! ! function() {
! ! ! ! ! goToPage(newpage);
! ! ! ! }, 500);
! ! }! !
! });!
! $('.pan-container').each(function(){
! ! var $this=$(this).css({position:'relative', overflow:'hidden', cursor:'move'})
! ! var $img=$this.children().eq(0) //image to pan
! ! var options={$pancontainer:$this, pos:$this.attr('data-orient'), curzoom:1, canzoom:$this.attr('data-canzoom'), wrappersize:[$this.width(),
! ! $img.imgmover(options)
! })
});
var newpage = "";
var typingPause;
function goToPage(pagenum, pagetext, pageimg) {!
! $("#currentpage").val(pagenum);
! window.location.hash = pagenum;!
! newpage = "";
! parseInt(pagenum) ? $("h3 span").text(pagenum) : $("h3 span").text("");! !
! $.get("pages/" + pagetext,function(r) {
! ! $(".page_text").html(r);! !
! ! pageimg ? $(".page_image").html('
') : $(".page_image").html("");
! ! if ($(".page_image").children().length) {
! ! ! $(".page_image").children().each(function() {
! ! ! ! $(this).zoomin({
! ! ! ! ! bgcolor: "#999"
! ! ! ! });
! ! ! });
! ! }! !
! ! $(".continue a").click(function(e) {
! ! ! e.preventDefault();
! ! ! goToPage(parseInt($("#currentpage").val())+1);
! ! });! !
! ! $(".choose a").click(function(e) {
! ! ! e.preventDefault();
! ! ! var newpage = $(this).attr("rel");
! ! ! goToPage(newpage);
! ! });
3
Monday, November 14, 2011