Merge branch 'master' into gh-pages

This commit is contained in:
Nicky Case 2018-04-30 18:47:18 +01:00
commit 5227926ecf
9 changed files with 1841 additions and 19 deletions

View File

@ -26,6 +26,7 @@ and was possible thanks to these open source/Creative Commons resources:
* [Howler.js](https://howlerjs.com/) for the audio
* [MinPubSub](https://github.com/daniellmb/MinPubSub) for publish/subscribe
* [iNoBounce](https://github.com/lazd/iNoBounce/) for making iOS stop acting like a such a jerk
**Font:** [Patrick Hand](https://fonts.google.com/specimen/Patrick+Hand) by Patrick Wagesreiter

View File

@ -41,6 +41,7 @@ a:hover{
width: 100%;
height: calc(100% - 60px);
cursor: none;
overflow: hidden; /* modal's being awful */
}
#container[sim_is_running]{
background: #eee;

View File

@ -65,7 +65,7 @@ Good luck, and thanks again!
<meta property="og:image" content="http://ncase.me/crowds/social/thumb.png">
<!-- Styles -->
<link rel="stylesheet" type="text/css" href="css/index.css?v=3">
<link rel="stylesheet" type="text/css" href="css/index.css?v=4">
</head>
<body>
@ -214,6 +214,7 @@ Good luck, and thanks again!
<!-- - - - - -->
<script src="js/lib/helpers.js"></script>
<script src="js/lib/inobounce.js"></script>
<script src="js/lib/minpubsub.src.js"></script>
<script src="js/lib/howler.min.js"></script>
<script src="js/lib/Key.js"></script>
@ -229,7 +230,7 @@ Good luck, and thanks again!
<script src="js/slideshow/SandboxUI.js"></script>
<script src="js/slideshow/Modal.js"></script>
<script src="js/slideshow/Preloader.js"></script>
<script src="js/slideshow/Translations.js?v=2"></script>
<script src="js/slideshow/Translations.js?v=3"></script>
<script src="js/sim/Peep.js?v=2"></script>
<script src="js/sim/Connection.js"></script>
@ -606,7 +607,7 @@ Also, <b></b> bolds a word/phrase, and <i></i> italicizes a word/phrase.
<b>NOTE:</b> Volunteering is just <i>one</i> of many complex contagions!
Others include: voter turnout, lifestyle habits,
challenging your beliefs,
taking time to understand a issue deeply &mdash; anything
taking time to understand an issue deeply &mdash; anything
that needs more than one "exposure".
Complex contagions aren't <i>necessarily</i> wise,
but being wise is a complex contagion.
@ -993,13 +994,13 @@ Also, <b></b> bolds a word/phrase, and <i></i> italicizes a word/phrase.
lots of love and thanks to</span>
<div style="font-size: 3em; line-height: 1.0em;">
MY PATREON SUPPORTERS</div>
<a onclick='publish("reference/show", ["supporters"]);'>
see names &amp; drawings of supporters</a> ·
<a onclick='publish("reference/show", ["playtesters"]);'>
see playtesters</a>
<br>
<a target="_blank" href="https://www.patreon.com/ncase" style="text-decoration:none">
help me make more like this! &lt;3</a>
<br>
<a onclick='publish("reference/show", ["supporters"]);'>
see my supporters</a> ·
<a onclick='publish("reference/show", ["playtesters"]);'>
see my playtesters</a>
<br><br>
@ -1043,6 +1044,11 @@ Also, <b></b> bolds a word/phrase, and <i></i> italicizes a word/phrase.
<words id="translations_add">
(add your own!)
</words>
<words id="translations_original">
<!-- No need to translate this, because, I assume, -->
<!-- if someone wants to play the game in English, they can read English -->
(original in English)
</words>
<!-- - - - - - - -->
<!-- BONUS BOXES -->
@ -1623,12 +1629,13 @@ Final thing! These references also need you to TRANSLATE:
</reference>
<reference id="supporters" hidden=yes large=yes>
<div>
To
<a target="_blank" href="https://www.patreon.com/ncase">my supporters on Patreon</a>:
I'm deeply grateful.
Your generosity <i>literally</i> feeds me and pays my rent,
and grants me the creative freedom to make these weird math/social-science games.
From the bottom of my heart, thank you!
Dear Patreon supporters:
Your generosity <i>literally</i> feeds me and pays my rent.
You give me the freedom to make these weird educational games,
so, from the bottom of my heart, thank you. &lt;3
<br>
<a target="_blank" href="https://www.patreon.com/ncase" style="text-decoration:none">
(want to support me in making more stuff like this? check out my Patreon!)</a>
</div>
</reference>
<reference id="playtesters" hidden=yes large=yes>
@ -1679,4 +1686,4 @@ Thank you so, so much for doing this again, wow.
Finally, go to "translations.txt" and follow the instructions there,
in order to let this game "know" your translation exists.
-->
-->

1675
it.html Normal file

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,12 @@ function cloneObject(obj){
// Get words
function getWords(wordsID){
return $("words#"+wordsID).innerHTML.trim();
var dom = $("words#"+wordsID);
if(dom){
return dom.innerHTML.trim();
}else{
return "";
}
}
// Remove from array

131
js/lib/inobounce.js Normal file
View File

@ -0,0 +1,131 @@
/*! iNoBounce - v0.1.6
* https://github.com/lazd/iNoBounce/
* Copyright (c) 2013 Larry Davis <lazdnet@gmail.com>; Licensed BSD */
(function(global) {
// Stores the Y position where the touch started
var startY = 0;
// Store enabled status
var enabled = false;
var supportsPassiveOption = false;
try {
var opts = Object.defineProperty({}, 'passive', {
get: function() {
supportsPassiveOption = true;
}
});
window.addEventListener('test', null, opts);
} catch (e) {}
var handleTouchmove = function(evt) {
// Get the element that was scrolled upon
var el = evt.target;
// Check all parent elements for scrollability
while (el !== document.body && el !== document) {
// Get some style properties
var style = window.getComputedStyle(el);
if (!style) {
// If we've encountered an element we can't compute the style for, get out
break;
}
// Ignore range input element
if (el.nodeName === 'INPUT' && el.getAttribute('type') === 'range') {
return;
}
var scrolling = style.getPropertyValue('-webkit-overflow-scrolling');
var overflowY = style.getPropertyValue('overflow-y');
var height = parseInt(style.getPropertyValue('height'), 10);
// Determine if the element should scroll
var isScrollable = scrolling === 'touch' && (overflowY === 'auto' || overflowY === 'scroll');
var canScroll = el.scrollHeight > el.offsetHeight;
if (isScrollable && canScroll) {
// Get the current Y position of the touch
var curY = evt.touches ? evt.touches[0].screenY : evt.screenY;
// Determine if the user is trying to scroll past the top or bottom
// In this case, the window will bounce, so we have to prevent scrolling completely
var isAtTop = (startY <= curY && el.scrollTop === 0);
var isAtBottom = (startY >= curY && el.scrollHeight - el.scrollTop === height);
// Stop a bounce bug when at the bottom or top of the scrollable element
if (isAtTop || isAtBottom) {
evt.preventDefault();
}
// No need to continue up the DOM, we've done our job
return;
}
// Test the next parent
el = el.parentNode;
}
// Stop the bouncing -- no parents are scrollable
evt.preventDefault();
};
var handleTouchstart = function(evt) {
// Store the first Y position of the touch
startY = evt.touches ? evt.touches[0].screenY : evt.screenY;
};
var enable = function() {
// Listen to a couple key touch events
window.addEventListener('touchstart', handleTouchstart, supportsPassiveOption ? { passive : false } : false);
window.addEventListener('touchmove', handleTouchmove, supportsPassiveOption ? { passive : false } : false);
enabled = true;
};
var disable = function() {
// Stop listening
window.removeEventListener('touchstart', handleTouchstart, false);
window.removeEventListener('touchmove', handleTouchmove, false);
enabled = false;
};
var isEnabled = function() {
return enabled;
};
// Enable by default if the browser supports -webkit-overflow-scrolling
// Test this by setting the property with JavaScript on an element that exists in the DOM
// Then, see if the property is reflected in the computed style
var testDiv = document.createElement('div');
document.documentElement.appendChild(testDiv);
testDiv.style.WebkitOverflowScrolling = 'touch';
var scrollSupport = 'getComputedStyle' in window && window.getComputedStyle(testDiv)['-webkit-overflow-scrolling'] === 'touch';
document.documentElement.removeChild(testDiv);
if (scrollSupport) {
enable();
}
// A module to support enabling/disabling iNoBounce
var iNoBounce = {
enable: enable,
disable: disable,
isEnabled: isEnabled
};
if (typeof module !== 'undefined' && module.exports) {
// Node.js Support
module.exports = iNoBounce;
}
if (typeof global.define === 'function') {
// AMD Support
(function(define) {
define('iNoBounce', [], function() { return iNoBounce; });
}(global.define));
}
else {
// Browser support
global.iNoBounce = iNoBounce;
}
}(this));

View File

@ -106,7 +106,8 @@ subscribe("modal/translations", function(){
html += getWords("translations_do_not_exist");
}
html += " <a target='_blank' href='"+window.ADD_YOUR_OWN_LINK+"'>"+getWords("translations_add")+"</a>";
html += "<br>";
html += " <a href='.'>"+getWords("translations_original")+"</a>";
html += "<div style='height:12px'></div>";
html += _createLinks(" · ");
$("#modal_content").innerHTML = html;

View File

@ -2,7 +2,7 @@ window.TRANSLATIONS = [];
window.ADD_YOUR_OWN_LINK = "https://github.com/ncase/crowds#how-to-translate-this-thing";
var r = new XMLHttpRequest();
r.open("GET", "translations.txt", true);
r.open("GET", "translations.txt?cache="+Math.round(1000*Math.random()), true); // force cache refresh
r.onreadystatechange = function () {
if(r.readyState != 4 || r.status != 200) return;

View File

@ -27,4 +27,5 @@
// AVAILABLE TRANSLATIONS: //
/////////////////////////////
en: English
en: English
it: Italiano