diff --git a/css/index.css b/css/index.css index 07d504f..b3397d5 100644 --- a/css/index.css +++ b/css/index.css @@ -317,6 +317,23 @@ b, strong{ #sound[mute=yes] > #sound_off{ display: block; } +#translations{ + position: absolute; + top: 14px; + left: calc(50% - 400px); + width: 800px; + text-align: center; + color: #fff; + font-size: 16px; + line-height: 16px; + letter-spacing: 0.5px; +} +#translations a{ + color: #ff4040; +} +#translations a:hover{ + color: #ff6060; +} #navigation{ display: none; diff --git a/index.html b/index.html index 6949a15..d5d7cf6 100644 --- a/index.html +++ b/index.html @@ -127,6 +127,7 @@ MY "WHY" FOR MAKING THIS: +
@@ -831,6 +832,17 @@ MY "WHY" FOR MAKING THIS: reset & re-draw + + Fan-made translations: + + + + + What the, no fan-made translations exist yet?! + + + (add your own!) + @@ -1063,7 +1075,7 @@ MY "WHY" FOR MAKING THIS: by Vi Hart and Nicky Case (2014). A story about how harmless choices can create a harmful world. Based off a Nobel Prize-winning game theorist's work, - this interactive shows how discrimination and/or diversity can arise from the bottom up. + this interactive shows how discrimination and diversity can arise from the bottom up. @@ -1542,6 +1554,7 @@ MY "WHY" FOR MAKING THIS: + diff --git a/js/main.js b/js/main.js index cdc4c67..0cd9255 100644 --- a/js/main.js +++ b/js/main.js @@ -40,7 +40,8 @@ subscribe("START", function(){ SOUNDS.bg_music.loop(true); SOUNDS.bg_music.play(); - // Show Navigation + // Hide translations, show navigation + $("#translations").style.display = "none"; $("#navigation").style.display = "block"; // Show Skip Button diff --git a/js/slideshow/Modal.js b/js/slideshow/Modal.js index 51e8a0c..1562908 100644 --- a/js/slideshow/Modal.js +++ b/js/slideshow/Modal.js @@ -20,12 +20,14 @@ subscribe("key/down/escape", function(){ }); window.Modal = { + currentlyShowing: "", show: function(large){ $("#modal_container").setAttribute("show","yes"); $("#modal").setAttribute("size", large ? "large" : "small"); $("#modal_content_container").scrollTop = 0; // scroll to top }, hide: function(){ + Modal.currentlyShowing = ""; publish("sound/button"); $("#modal_container").removeAttribute("show"); }, @@ -49,8 +51,45 @@ $("#modal_close").onclick = Modal.hide; // Show big collected modals subscribe("modal/bonus", function(){ - Modal.showAll("bonus"); + if(Modal.currentlyShowing == "bonus"){ + Modal.hide(); + }else{ + Modal.currentlyShowing = "bonus"; + Modal.showAll("bonus"); + } }); subscribe("modal/references", function(){ - Modal.showAll("reference"); -}); \ No newline at end of file + if(Modal.currentlyShowing == "reference"){ + Modal.hide(); + }else{ + Modal.currentlyShowing = "reference"; + Modal.showAll("reference"); + } +}); + +// Translations +subscribe("modal/translations", function(){ + + if(Modal.currentlyShowing == "translations"){ + Modal.hide(); + }else{ + Modal.currentlyShowing = "translations"; + + // Translation HTML + var html = ""; + if(window.TRANSLATIONS.length>0){ + html += getWords("translations_exist"); + }else{ + html += getWords("translations_do_not_exist"); + } + html += " "+getWords("translations_add")+""; + html += "
"; + html += _createLinks(" · "); + $("#modal_content").innerHTML = html; + + // Show in large box + Modal.show(false); + + } + +}); diff --git a/js/slideshow/Preloader.js b/js/slideshow/Preloader.js index d4661fd..7624373 100644 --- a/js/slideshow/Preloader.js +++ b/js/slideshow/Preloader.js @@ -21,9 +21,11 @@ subscribe("prepreload", function(){ var pre_preloader = $("#pre_preloader"); pre_preloader.parentNode.removeChild(pre_preloader); - //slideshow.gotoChapter("Preloader"); + slideshow.gotoChapter("Preloader"); + /* slideshow.gotoChapter("Credits"); $("#navigation").style.display = "block"; + */ publish("preload"); } diff --git a/js/slideshow/Translations.js b/js/slideshow/Translations.js new file mode 100644 index 0000000..6b1c576 --- /dev/null +++ b/js/slideshow/Translations.js @@ -0,0 +1,54 @@ +window.TRANSLATIONS = []; +window.ADD_YOUR_OWN_LINK = "http://derp"; + +var r = new XMLHttpRequest(); +r.open("GET", "translations.txt", true); +r.onreadystatechange = function () { + + if(r.readyState != 4 || r.status != 200) return; + + // Parse available translations + // Only lines of the form "nn: name" + var response = r.responseText; + var lines = response.split("\n"); + var available = lines.filter(function(line){ + return (/^\w\w\:?\s+(.+)/).test(line); // ww: wwwwww + }); + for(var i=0; ib.lang; + }); + + // Show translations (if any) + if(TRANSLATIONS.length>0){ + var html = ""; + html += getWords("translations_exist").toLowerCase(); + html += " "+getWords("translations_add")+""; + html += " | "; + html += _createLinks(" · "); + $("#translations").innerHTML = html; + } + +}; +r.send(); + +function _createLinks(separator){ + var html = ""; + for(var i=0; i0) html+=separator; + html += ""; + html += t.lang; + html += ""; + } + return html; +} \ No newline at end of file diff --git a/translations.txt b/translations.txt index af94abc..0727ffb 100644 --- a/translations.txt +++ b/translations.txt @@ -1,7 +1,27 @@ +// Once you've finished your translation, +// the website needs to "know" it exists! +// This text file is how the website "knows". // -// herp derp -// herp derp derp +// First, look up the language you're translating to on this page: +// https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes // -// +// Then, at the bottom of this file, enter on a new line: +// [two-letter code]: [native name of language] +// For example: +// en: English +// de: Deutsch +// zh: 中文 +// ar: العربية +// +// (Note: if you paste the native name of a right-to-left language here, +// it might show up as reversed here, but it'll show correctly on the website) +// Also, make sure the .html file of your translation +// uses the two-letter code, like "en.html", "de.html", "zh.html" +// +// Thank you again so much! :) -en: English \ No newline at end of file +///////////////////////////// +// AVAILABLE TRANSLATIONS: // +///////////////////////////// + +en: English