summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjules <jules@okfoc.us>2014-01-26 23:17:22 -0500
committerjules <jules@okfoc.us>2014-01-26 23:17:22 -0500
commitaaab024a42bf576095d94e069de9f2f17d083bd7 (patch)
tree89a1a3764eb3ea5a5e146326afc33d4a33d98056
parentcdf9588d8bb71082671e538a3902f2f59e714a76 (diff)
autofetch random images
-rw-r--r--js/asdf.js5
-rw-r--r--shader-combo.html3
2 files changed, 6 insertions, 2 deletions
diff --git a/js/asdf.js b/js/asdf.js
index 53222e8..6006eea 100644
--- a/js/asdf.js
+++ b/js/asdf.js
@@ -1,7 +1,7 @@
//
// asdf .. asdf.us/im search api
-var asdf = { fetching: false }
+var asdf = { fetching: false, fetched: false }
asdf.random = function (e){
status("fetching random photoblasts")
e && e.preventDefault();
@@ -13,7 +13,7 @@ asdf.random = function (e){
asdf.fetch = function (opt){
if (asdf.fetching) return;
- asdf.fetching = true;
+ asdf.fetching = true
var params = {random:1};
$.ajax({
'url': "http://asdf.us/cgi-bin/im/list",
@@ -21,6 +21,7 @@ asdf.fetch = function (opt){
'dataType': "jsonp",
'success': function(urls){
asdf.fetching = false;
+ asdf.fetched = true
opt.success && opt.success(urls)
},
'error': opt.error || function(err){
diff --git a/shader-combo.html b/shader-combo.html
index 3c9569e..e27c1a4 100644
--- a/shader-combo.html
+++ b/shader-combo.html
@@ -213,6 +213,9 @@ function init(){
$("#gallery-form").show()
$(".bold").removeClass("bold")
$(this).addClass("bold")
+ if (! asdf.fetched) {
+ $("#gallery-random").trigger("click")
+ }
})
$(".toggle-off").click(function(){
$("#header .form").hide()