<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/wb/ (C) Ken Webb Tue Feb 12 2013 05:43:56 GMT-0500 (EST)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Flashcards
Description: Learn with flashcards using Xholon Workbooks
Url: http://www.primordion.com/Xholon/wb/xholon
InternalName:
YoutubeId:
Keywords:
My Notes
--------
How to run the flashcard demo::
Click the Run button above.
Then either
Click the Step button in the overlay, and
Continue to click either the Step button or the large green area at the bottom of the overlay.
Or
Click once on the Pause button to start (unpause) continuous display.
Flashcards can be a useful way to learn a set of facts. In this workbook I will create a simple flashcard player.
I've googled for the term "flashcard" and have located at least two online services that have a developer API::
http://www.flashcardexchange.com/docs/api
https://quizlet.com/api/2.0/docs/
Both require the use of an application ID, so I'll have to register with either or both sites.
To get started, I've created a simple app with some test flashcards, all on this page.
How to change the code::
Scroll down to the Deckbehavior editor.
When you've made your changes, click Run or Refresh.
How to reverse the order of display::
var textA = card.children(".B").attr("val_string");
var textB = card.children(".A").attr("val_string");
How to randomize the order of display::
cards = $this.children(".Card");
card = cards.eq(Math.random() * cards.length);
]]></Notes>
<script implName="lang:python:inline:"><![CDATA[
print "learn"
print " | "
print "aprender\n"
]]></script>
<script implName="lang:javascript:inline:"><![CDATA[
print("learn");
print(" | ");
println("apprendre");
]]></script>
<_-.XholonClass>
<!-- types of domain objects -->
<FlashcardSystem/>
<Deck/>
<Card/>
<Side>
<A/>
<B/>
<C/>
</Side>
<DeckSelector/>
</_-.XholonClass>
<xholonClassDetails>
</xholonClassDetails>
<FlashcardSystem>
<Deck roleName="Intro">
<Card><A>Welcome to</A><B>Xholon Workbook Flashcards</B></Card>
</Deck>
<!-- <Card><A></A><B></B></Card> -->
<Deck rolename="Spanish verbs">
<Card><A>learn</A><B>aprender</B></Card>
<Card><A>think</A><B>pensar</B></Card>
<Card><A>eat</A><B>comer</B></Card>
<Card><A>buy</A><B>comprar</B></Card>
<Card><A>sell</A><B>vender</B></Card>
<Card><A>write</A><B>escribir</B></Card>
<Card><A>use</A><B>usar</B></Card>
<Card><A>speak</A><B>hablar</B></Card>
<Card><A>live</A><B>vivir</B></Card>
<Card><A>drink</A><B>beber</B></Card>
<Card><A>open</A><B>abrir</B></Card>
<Card><A>finish</A><B>acabar</B></Card>
<Card><A>accompany</A><B>acompañar</B></Card>
<Card><A>walk</A><B>andar</B></Card>
<Card><A>pick up</A><B>recoger</B></Card>
<Card><A>go over</A><B>recorrer</B></Card>
<Card><A>subdue, conquer</A><B>rendir</B></Card>
<Card><A>surrender</A><B>rendirse</B></Card>
</Deck>
<!-- palabras que son siempre dificil para mi -->
<!-- <Card><A></A><B></B></Card> -->
<Deck roleName="español 201302">
<Card><A>mientras</A><B>while, meanwhile, whereas</B></Card>
<Card><A>cadena</A><B>chain</B></Card>
<Card><A>aunque</A><B>although</B></Card>
<Card><A>fuente</A><B>source</B></Card>
<Card><A>todavia</A><B>still, yet</B></Card>
<Card><A>a menudo</A><B>frequently</B></Card>
<Card><A>semejante</A><B>similar</B></Card>
<Card><A>cogelo o dejalo</A><B>take it or leave it</B></Card>
<Card><A>cabo</A><B>end, stub</B></Card>
<Card><A>encima</A><B>over, above, on</B></Card>
<Card><A>apenas</A><B>hardly</B></Card>
<Card><A>coger</A><B>to take, seize, take hold of</B></Card>
<Card><A>además</A><B>also, in addition, besides, furthermore</B></Card>
<Card><A>ni siquiera</A><B>not even</B></Card>
<Card><A>lograr</A><B>to obtain, achieve, get</B></Card>
<Card><A>éxito</A><B>success</B></Card>
<Card><A>aun</A><B>even</B></Card>
<Card><A>es decir</A><B>that is to say</B></Card>
<Card><A>respuesta</A><B>answer</B></Card>
<Card><A>echar</A><B>to throw, cast</B></Card>
<Card><A>despertar</A><B>to wake up</B></Card>
<Card><A>recoger</A><B>to gather, pick up</B></Card>
<Card><A>dejar</A><B>to leave</B></Card>
<Card><A>acaso</A><B>perhaps, maybe</B></Card>
<Card><A>cumplir</A><B>to accomplish, carry out</B></Card>
<Card><A>aún</A><B>still, yet</B></Card>
<Card><A>sino</A><B>but, rather</B></Card>
<Card><A>hallar</A><B>to find, discover</B></Card>
<Card><A>sacar</A><B>to remove, take out</B></Card>
<Card><A>así</A><B>so, in this way</B></Card>
<Card><A>rato</A><B>short while</B></Card>
</Deck>
<!-- a few words and phrases for use in the 1480 workbook(s)
http://en.wikipedia.org/wiki/Quechua_languages
http://es.wikipedia.org/wiki/Lenguas_quechuas
http://es.wikibooks.org/wiki/Quechua/sureño
-->
<!-- <Card><A></A><B></B></Card> -->
<Deck roleName="Quechua vocabulary">
<Card><A>house</A><B>wasi</B></Card>
<Card><A>white</A><B>yuraq</B></Card>
<Card><A>white house</A><B>yuraq wasi</B></Card>
<Card><A>white houses</A><B>yuraq wasikuna</B></Card>
<Card><A>the plural suffix</A><B>-kuna</B></Card>
<Card><A>my white house</A><B>yuraq wasiy</B></Card>
<Card><A>I speak Quechua.</A><B>runasimita rimami</B></Card>
<Card><A>What is your name?</A><B>Iman sutiyki</B></Card>
<Card><A>My name is </A><B>Sutiymi kan</B></Card>
<Card><A>My time machine crashed and burned.</A><B>on second thought ...</B></Card>
<Card><A>Take me to your leader.</A><B>THE essential classic line</B></Card>
<Card><A>red</A><B>puka</B></Card>
<Card><A>orange</A><B>killmu</B></Card>
<Card><A>yellow</A><B>q’illu</B></Card>
<Card><A>green</A><B>qumir</B></Card>
<Card><A>light blue</A><B>qhusi</B></Card>
<Card><A>blue</A><B>anqash</B></Card>
<Card><A>purple</A><B>kulli</B></Card>
<Card><A>grey</A><B>uqi</B></Card>
<Card><A>black</A><B>yana</B></Card>
<Card><A>0</A><B>illa</B></Card>
<Card><A>1</A><B>huk</B></Card>
<Card><A>2</A><B>iskay</B></Card>
<Card><A>3</A><B>kimsa</B></Card>
<Card><A>4</A><B>tawa</B></Card>
<Card><A>5</A><B>phisqa</B></Card>
<Card><A>6</A><B>suqta</B></Card>
<Card><A>7</A><B>qanchis</B></Card>
<Card><A>8</A><B>pusaq</B></Card>
<Card><A>9</A><B>isq’un</B></Card>
<Card><A>10</A><B>chunka</B></Card>
<Card><A>19</A><B>chunka isq’unniyuq</B></Card>
<Card><A>34</A><B>kinsa chunka tawayuq</B></Card>
<Card><A>100</A><B>pachak</B></Card>
</Deck>
<!-- examples of many languages and scripts; from Wikipedia welcome and main pages -->
<!-- <Card><A></A><B></B></Card> -->
<Deck roleName="Many languages">
<Card><A>Добро пожаловать</A><B>Russian</B></Card>
<Card><A>Welcome</A><B>English</B></Card>
<Card><A>ويكيبيديا:ترحيب بالقادمين الجدد</A><B>Arabic</B></Card>
<Card><A>विकिपीडिया:स्वागत</A><B>Nepali</B></Card>
<Card><A>欢迎</A><B>Chinese</B></Card>
</Deck>
<DeckSelector>español 201302</DeckSelector>
</FlashcardSystem>
<Blockbehavior implName="lang:python:inline:"><![CDATA[
]]></Blockbehavior>
<Blockbehavior implName="lang:javascript:inline:"><![CDATA[
]]></Blockbehavior>
<Deckbehavior implName="lang:webEditionjs:inline:"><![CDATA[
function postConfigure() {
var $this = this.parent();
$this.data("card", $this.children(".Card:first"));
$this.application("setConfigParam", "TimeStepInterval", "2000");
$this.data("state", 0);
}
function act() {
var $this = this.parent();
if ($this.data("state") == 0) {
var svg = $($('div#mySVGDiv > object')[0].contentDocument.getElementsByTagNameNS(svgns, 'svg')[0]);
$this.data("sideA", svg.children('g').children('text#A'));
$this.data("sideB", svg.children('g').children('text#B'));
svg.children('g').children('rect').bind( 'click', function() {
$this.application("step");
});
$this.data("state", 1);
}
var card = $this.data("card");
var textA = card.children(".A").attr("val_string");
var textB = card.children(".B").attr("val_string");
if ($this.data("state") == 1) {
$this.data("sideA").text(textA);
$this.data("sideB").text("");
$this.data("state", 2);
}
else {
$this.data("sideB").text(textB);
card = card.next(".Card");
if (!card.length) {
card = $this.children(".Card:first");
}
// to randomize the order of display, comment out the previous 4 lines, uncomment the next 2 lines
//var cards = $this.children(".Card");
//card = cards.eq(Math.random() * cards.length);
$this.data("card", card);
$this.data("state", 1);
}
}
]]></Deckbehavior>
<Cardbehavior implName="lang:webEditionjs:inline:"><![CDATA[
function postConfigure() {
var sides = this.siblings();
sides.each( function() {
var $this = $(this);
if (!$this.attr("val_string")) {
// the contents may be a number (ex: 4)
$this.attr("val_string", $this.attr("val"));
}
});
this.remove();
}
]]></Cardbehavior>
<DeckSelectorbehavior implName="lang:webEditionjs:inline:"><![CDATA[
function postConfigure() {
var $this = this.parent();
var selected = $this.attr("val_string");
//println(selected);
var decks = $this.siblings(".Deck");
decks.each( function() {
var $thisDeck = $(this);
//println($thisDeck.attr("rolename"));
if (!($thisDeck.attr("rolename") == selected)) {
$thisDeck.remove();
}
});
$this.remove();
}
]]></DeckSelectorbehavior>
<Blockbehavior implName="lang:bsh:inline:"><![CDATA[
]]></Blockbehavior>
<Blockbehavior implName="lang:jruby:inline:"><![CDATA[
]]></Blockbehavior>
<Blockbehavior implName="lang:groovy:inline:"><![CDATA[
]]></Blockbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="500" height="100" xmlns="http://www.w3.org/2000/svg">
<g>
<rect id="Card" fill="#98FB98" width="500" height="100" x="0" y="0"/>
<text id="A" font-size="24" x="10" y="30">Click the Step button to get started.</text>
<text id="B" font-size="24" x="10" y="85">Continue to click Step, or click here.</text>
</g>
</svg>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>