Skip to content

Commit

Permalink
forced synchronous layout... implemented. we are horrible people. 20,…
Browse files Browse the repository at this point in the history
…000% slower
  • Loading branch information
cameronwp committed Sep 18, 2014
1 parent 79dff93 commit fc95ac8
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions views/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ function getNoun(y) {
return places;
case "scifi":
var scifi = ["robot", "alien", "raygun", "spaceship", "UFO", "rocket", "phaser", "astronaut", "spaceman", "planet", "star", "galaxy",
"computer", "future", "timeMachine", "wormHole", "timeTraveller", "scientist", "invention", "martian", "pluto", "jupiter", "saturn", "mars",
"computer", "future", "timeMachine", "wormHole", "timeTraveler", "scientist", "invention", "martian", "pluto", "jupiter", "saturn", "mars",
"quasar", "blackHole", "warpDrive", "laser", "orbit", "gears", "molecule", "electron", "neutrino", "proton", "experiment", "photon", "apparatus",
"universe", "gravity", "darkMatter", "constellation", "circuit", "asteroid"];
return scifi;
default:
var scifi = ["robot", "alien", "raygun", "spaceship", "UFO", "rocket", "phaser", "astronaut", "spaceman", "planet", "star", "galaxy",
"computer", "future", "timeMachine", "wormHole", "timeTraveller", "scientist", "invention", "martian", "pluto", "jupiter", "saturn", "mars",
"computer", "future", "timeMachine", "wormHole", "timeTraveler", "scientist", "invention", "martian", "pluto", "jupiter", "saturn", "mars",
"quasar", "blackHole", "warpDrive", "laser", "orbit", "gears", "molecule", "electron", "neutrino", "proton", "experiment", "photon", "apparatus",
"universe", "gravity", "darkMatter", "constellation", "circuit", "asteroid"];
return scifi;
Expand Down Expand Up @@ -357,8 +357,9 @@ var checkHeight = function(elem) {

var pizzaElementGenerator = function(i) {
var pizzaContainer = document.createElement("div");
pizzaContainer.classList.add("col-md-3","randomPizzaContainer");
// pizzaContainer.style.height = "100%";
// pizzaContainer.classList.add("col-md-3","randomPizzaContainer");
pizzaContainer.classList.add("randomPizzaContainer");
pizzaContainer.style.width = "50%";
pizzaContainer.id = "pizza" + i;

var pizzaImageContainer = document.createElement("div");
Expand Down Expand Up @@ -448,14 +449,18 @@ var resizePizzas = function(size) { // size is one of: "small", "medium", "lar
// console.log("changed pizza classes");
// }

function calculateNewWidth (elem) {
var oldwidth = elem.offsetWidth;
newwidth = 100 / ((100 / oldwidth) + 1);
return newwidth;
}

// make this slower
function changePizzaClasses (oldsize, newsize) {
function changePizzaSizes () {

for (var i = 0; i < document.querySelectorAll(".randomPizzaContainer").length; i++) {
for (var i = 0; i < document.querySelectorAll(".randomPizzaContainer").length; i++) { // this is bad
var pizzas = document.querySelector("#randomPizzas");
oldsize = findCurrentSize();
pizzas.children[i].classList.remove(oldsize);
pizzas.children[i].classList.add(newsize);
pizzas.children[i].style.width = calculateNewWidth( pizzas.children[i] );
}

console.log("changed pizza classes");
Expand All @@ -465,7 +470,7 @@ var resizePizzas = function(size) { // size is one of: "small", "medium", "lar
console.log("no size change");
return;
} else {
changePizzaClasses(oldsize, newsize);
changePizzaSizes(oldsize, newsize);
}

// changePizzaClasses(oldsize, newsize);
Expand Down

0 comments on commit fc95ac8

Please sign in to comment.