diff --git a/ch2.html b/ch2.html index 74ab5e4..9df409f 100644 --- a/ch2.html +++ b/ch2.html @@ -590,7 +590,6 @@ Early feedback helps me a lot. Many thanks in advance! - @@ -931,7 +930,6 @@ Early feedback helps me a lot. Many thanks in advance! - diff --git a/ch3.html b/ch3.html new file mode 100644 index 0000000..720eed9 --- /dev/null +++ b/ch3.html @@ -0,0 +1,80 @@ + + + + + An Interactive Comic + + + + + + + +
+ + + + + + + + + + + + + dasd sad assad ddasdasdasdas asdasdsd asds + + + asdasdassaasd asdassadas sadasd s asdas as + + + + + + + + + + + dasd sad assad ddasdasdasdas asdasdsd asds + + + asdasdassaasd asdassadas sadasd s asdas as + + + + + + + + + + + + + +
+ + + +
+
+ What's this? +
+
+ +
+ Mitochondria +
+
+ +
+ + + + + + + + diff --git a/js/comic.js b/js/comic.js index 5e0c777..0fe6f72 100644 --- a/js/comic.js +++ b/js/comic.js @@ -88,6 +88,16 @@ window.getLabel = function(name){ return $("#"+name).innerHTML; } -window.broadcastMessage = function(message){ - publish(message); +window.broadcastMessage = function(message, args){ + publish(message, args); }; + +// Editable Flashcard Labels +$all("div[editable]").forEach(function(dom){ + + var cardname = dom.getAttribute("editable"); + subscribe("answer_edit_"+cardname, function(text){ + dom.innerText = text; + }); + +}); diff --git a/sims/singlecard/singlecard.js b/sims/singlecard/singlecard.js index 48f7a2c..2c8932f 100644 --- a/sims/singlecard/singlecard.js +++ b/sims/singlecard/singlecard.js @@ -39,4 +39,25 @@ $("#front").innerHTML = frontHTML; $("#back").innerHTML = backHTML; _modifyFlashCard($("#front")); -_modifyFlashCard($("#back")); \ No newline at end of file +_modifyFlashCard($("#back")); + +// Refresh in real time... +if(_getQueryVariable("refresh")=="yes"){ + + var dom = back.querySelector(".fcard_center"); + + dom.style.top = "auto"; + dom.style.bottom = "auto"; + + var _reAlign = function(){ + var bounds = dom.getBoundingClientRect(); + dom.style.top = (((240-bounds.height)/2)-10) +"px"; + }; + _reAlign(); + + window.top.subscribe("answer_edit_"+cardname, function(new_answer){ + dom.innerText = new_answer; + _reAlign(); + }); + +} diff --git a/sims/type/index.html b/sims/type/index.html new file mode 100644 index 0000000..57dff58 --- /dev/null +++ b/sims/type/index.html @@ -0,0 +1,24 @@ + + + + + + Typing + + + + + + + + + \ No newline at end of file diff --git a/sims/type/type.css b/sims/type/type.css new file mode 100644 index 0000000..e69de29 diff --git a/sims/type/type.js b/sims/type/type.js new file mode 100644 index 0000000..b891375 --- /dev/null +++ b/sims/type/type.js @@ -0,0 +1,12 @@ +window.cardname = _getQueryVariable("card"); + +$("#answer").oninput = function(){ + + // Also, send message (when flipped for first time) + if(window.top.broadcastMessage){ + setTimeout(function(){ + window.top.broadcastMessage("answer_edit_"+cardname, [$("#answer").value]); + },1); + } + +}; \ No newline at end of file