Permalink
Browse files

random background from multiple awesome sources.

  • Loading branch information...
1 parent 9bef21e commit c61f7e8ed20d2f3c362d91495c520fe5ba4edb6b @gugod gugod committed Mar 4, 2012
@@ -1,3 +1,7 @@
+modes = ["kitten", "dreamy", "lorempixel", "placeholdit" ]
+
+mode = "kitten"
+
changing = 0
change = ->
@@ -8,22 +12,44 @@ change = ->
changing = 0
else if (changing == 0)
+ mode = modes[ (1 + modes.indexOf(mode)) % modes.length ]
changing = 1
load_text()
load_background()
setTimeout change, 3000
load_text = ->
- $("#loader p").moreText { 'n': 3, 'max': 45, 'callback': (sentences) ->
+ $("#loader p").moreText { 'n': 1, 'max': 45, 'callback': (sentences) ->
$(this).html(sentences.join("<br>"))
changing = changing + 1
}
load_background = ->
- url = location.protocol + "//" + location.host + "/pictures/" + parseInt(Math.random()*1000000000000).toString(16) + "/960x960.jpg";
+ random_width = 960
+ random_height = Math.round(Math.random() * 460 + 500)
+ grey = ""
+ grey = "g" if Math.random() > 0.5
+
+ if mode == "kitten"
+ url = "http://placekitten.com/" + grey + "/" + random_width + "/" + random_height
+
+ else if mode == "lorempixel"
+ url = "http://lorempixel.com/" + grey + "/" + random_width + "/" + random_height
+
+ else if mode == "placeholdit"
+ url = "http://placeholdit/" + random_width + "x" + random_height
+
+ else # "dreamy"
+ url = location.protocol + "//" + location.host + "/pictures/" + parseInt(Math.random()*1000000000000).toString(16) + "/" + random_width + "x" + random_height + ".jpg";
+
+ too_long = setTimeout ->
+ changing = changing + 1
+ , 7000
+
img = new Image();
$(img).on "load", ->
+ clearTimeout too_long
changing = changing + 1
$("#loader").append(img)
img.src = url
@@ -1,5 +1,9 @@
(function() {
- var change, changing, load_background, load_text;
+ var change, changing, load_background, load_text, mode, modes;
+
+ modes = ["kitten", "dreamy", "lorempixel", "placeholdit"];
+
+ mode = "kitten";
changing = 0;
@@ -10,6 +14,7 @@
$("#screen p").html($("#loader p").html());
changing = 0;
} else if (changing === 0) {
+ mode = modes[(1 + modes.indexOf(mode)) % modes.length];
changing = 1;
load_text();
load_background();
@@ -19,7 +24,7 @@
load_text = function() {
return $("#loader p").moreText({
- 'n': 3,
+ 'n': 1,
'max': 45,
'callback': function(sentences) {
$(this).html(sentences.join("<br>"));
@@ -29,10 +34,26 @@
};
load_background = function() {
- var img, url;
- url = location.protocol + "//" + location.host + "/pictures/" + parseInt(Math.random() * 1000000000000).toString(16) + "/960x960.jpg";
+ var grey, img, random_height, random_width, too_long, url;
+ random_width = 960;
+ random_height = Math.round(Math.random() * 460 + 500);
+ grey = "";
+ if (Math.random() > 0.5) grey = "g";
+ if (mode === "kitten") {
+ url = "http://placekitten.com/" + grey + "/" + random_width + "/" + random_height;
+ } else if (mode === "lorempixel") {
+ url = "http://lorempixel.com/" + grey + "/" + random_width + "/" + random_height;
+ } else if (mode === "placeholdit") {
+ url = "http://placeholdit/" + random_width + "x" + random_height;
+ } else {
+ url = location.protocol + "//" + location.host + "/pictures/" + parseInt(Math.random() * 1000000000000).toString(16) + "/" + random_width + "x" + random_height + ".jpg";
+ }
+ too_long = setTimeout(function() {
+ return changing = changing + 1;
+ }, 7000);
img = new Image();
$(img).on("load", function() {
+ clearTimeout(too_long);
return changing = changing + 1;
});
$("#loader").append(img);

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -14,15 +14,15 @@ body {
height: 100%;
min-height: 2048px;
font-size: 36px;
- line-height: 72px;
- background: #000 top left no-repeat;
+ background: #555 top left no-repeat;
background-size: 100%;
padding-top: 3em;
p {
- width: 960px;
+ line-height: 72px;
+ width: 720px;
margin: 0 auto;
- @include text-shadow(2px 2px 36px #fff);
+ @include text-shadow( 1px 0 1px #fff, 0 -1px 1px #fff, 0 1px 1px #fff, -1px 0 1px #fff, 0 0 36px #fff );
}
}
View
@@ -8,7 +8,7 @@
</head>
<body>
<div id="screen">
- <p></p>
+ <p>Relaxing...</p>
</div>
<div id="loader">

0 comments on commit c61f7e8

Please sign in to comment.