Skip to content

Commit

Permalink
tabs, pages, controls
Browse files Browse the repository at this point in the history
  • Loading branch information
ncase committed Jun 28, 2017
1 parent 14bf47f commit e8c18fd
Show file tree
Hide file tree
Showing 15 changed files with 452 additions and 214 deletions.
Binary file added assets/sandbox_tabs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 39 additions & 6 deletions css/slides.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
}

body{

margin:0;
overflow: hidden;

background: #fff; /*url('[email protected]');
background-size: 100px 100px;*/

font-family: 'FuturaHandwritten';
color: #333;
font-size: 20px;

}
#main{
width: 100%;
Expand All @@ -30,7 +36,7 @@ body{
#slideshow{

/*background: #bada55;*/
/*border: 1px solid rgba(0,0,0,0.2);*/
border: 1px solid rgba(0,0,0,0.2);
width:960px;
height:540px;

Expand All @@ -55,15 +61,15 @@ body{

/******** Text Box ********/

.textbox{
font-family: 'FuturaHandwritten';
color: #333;
font-size: 20px;
}
.textbox{}
.textbox > div{
position: absolute;
}

.label{
position: absolute;
}

/********* Button ********/

.button{
Expand Down Expand Up @@ -112,6 +118,33 @@ body{
display: none;
}


/*************************/
/****** SANDBOX UI *******/
/*************************/

#sandbox_tabs{
position: absolute;
left: 460px; top:-10px;
background: url(../assets/sandbox_tabs.png);
width:500px; height:470px;
background-size: auto 100%;
}
#sandbox_tabs > div{
position: absolute;
}
#sandbox_tabs .hitbox{
cursor: pointer;
font-size: 25px;
top: 22px;
}
#sandbox_tabs .sandbox_page{
width: 433px;
height: 385px;
left: 33px;
top: 80px;
}

/*************************/
/***** SLIDE SELECT ******/
/*************************/
Expand Down
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<!-- Libraries -->
<script src="js/lib/helpers.js"></script>
<script src="js/lib/pegasus.min.js"></script>
<script src="js/lib/pegasus.js"></script>
<script src="js/lib/minpubsub.src.js"></script>
<script src="js/lib/q.js"></script>
<script src="js/lib/pixi.min.js"></script>
Expand All @@ -36,9 +36,10 @@
<script src="js/sims/PD.js"></script>
<script src="js/sims/SillyPixi.js"></script>
<script src="js/sims/Tournament.js"></script>
<script src="js/sims/SandboxUI.js"></script>

<!-- Slides -->
<script src="js/slides/Slides_Ecology.js"></script>
<script src="js/slides/Slides_Sandbox.js"></script>

<!-- Main Code -->
<script>
Expand Down
5 changes: 4 additions & 1 deletion js/core/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ function Button(config){
// Customize DOM
button.style.left = config.x+"px";
button.style.top = config.y+"px";
text.innerHTML = Words.get(config.text_id);
config.upperCase = (config.upperCase===undefined) ? true : config.upperCase;
var words = Words.get(config.text_id);
if(config.upperCase) words=words.toUpperCase();
text.innerHTML = words;

// On hover...
hitbox.onmouseover = function(){
Expand Down
12 changes: 12 additions & 0 deletions js/lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ var _removeFade = function(self, INSTANT){
}
};

// Make Label
var _makeLabel = function(wordID, x, y, width, height){
var dom = document.createElement("div");
dom.className = "label";
if(x!==undefined) dom.style.left = x+"px";
if(y!==undefined) dom.style.top = y+"px";
if(width!==undefined) dom.style.width = width+"px";
if(height!==undefined) dom.style.height = height+"px";
dom.innerHTML = Words.get(wordID);
return dom;
};

/*******
Make a Sprite. e.g:
Expand Down
53 changes: 53 additions & 0 deletions js/lib/pegasus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// a url (naming it a, because it will be reused to store callbacks)
// e timeout error placeholder to avoid using var, not to be used
// xhr placeholder to avoid using var, not to be used
function pegasus(a, e, xhr) {
xhr = new XMLHttpRequest();

// Set URL
xhr.open('GET', a);

// Don't need a to store URL anymore
// Reuse it to store callbacks
a = [];

pegasus.timeout && (xhr.timeout = pegasus.timeout);

xhr.ontimeout = function (event) {
e = event
}

xhr.onreadystatechange = xhr.then = function(onSuccess, onError, cb, data) {
// Test if onSuccess is a function
// Means that the user called xhr.then
if (onSuccess && onSuccess.call) {
a = [,onSuccess, onError];
}

// Test if there's a timeout error
e && a[2] && a[2](e, xhr)

// Test if request is complete
if (xhr.readyState == 4) {
// index will be:
// 0 if undefined
// 1 if status is between 200 and 399
// 2 if status is over
cb = a[0|xhr.status / 200];
if (cb) {
/*try {
data = JSON.parse(xhr.responseText) // NICKY FIX -- don't be helpful
} catch (e) {*/
data = null;
//}
cb(data, xhr);
}
}
};

// Send the GET request
xhr.send();

// Return request
return xhr;
}
2 changes: 0 additions & 2 deletions js/lib/pegasus.min.js

This file was deleted.

4 changes: 2 additions & 2 deletions js/lib/q.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

var hasStacks = false;
try {
throw new Error();
// throw new Error(); // NICKY FIX -- STOP TRYING TO BE HELPFUL
} catch (e) {
hasStacks = !!e.stack;
}
Expand Down Expand Up @@ -461,7 +461,7 @@ function captureLine() {
}

try {
throw new Error();
// throw new Error(); // NICKY FIX -- STOP TRYING TO BE HELPFUL
} catch (e) {
var lines = e.stack.split("\n");
var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2];
Expand Down
107 changes: 0 additions & 107 deletions js/main.js

This file was deleted.

2 changes: 1 addition & 1 deletion js/sims/PD.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PD.PAYOFFS_DEFAULT = {

PD.PAYOFFS = PD.PAYOFFS_DEFAULT;

PD.NOISE = 0.05;
PD.NOISE = 0;

PD.getPayoffs = function(move1, move2){
var payoffs = PD.PAYOFFS;
Expand Down
Loading

0 comments on commit e8c18fd

Please sign in to comment.