X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=www%2Fjssrc%2Fblerg%2FWelcome.js;h=32301cea49d90916fe8cf48c2bc67d44b6564f1d;hb=80ad774f55998cc11e08694245dfd6cb1b49a86f;hp=769450e67b310165d9f3db63f7586f4e50f85ca6;hpb=a579fec94d5058776ea0fb6f47f922ea48ff876f;p=blerg.git diff --git a/www/jssrc/blerg/Welcome.js b/www/jssrc/blerg/Welcome.js index 769450e..32301ce 100644 --- a/www/jssrc/blerg/Welcome.js +++ b/www/jssrc/blerg/Welcome.js @@ -1,111 +1,111 @@ enyo.kind({ - name: "blerg.Welcome", - statics: { - locationDetect: function(l) { - if (l.hash.match(/^(#\/?)?$/)) - return {kind: "blerg.Welcome"} - else - return false; - } - }, - components: [ - {components: [ - {style: "float: right; text-align: center; margin: 0 0 1em 1em", components: [ - {style: "font-size: 14pt; margin-bottom: 4pt", content: "Curious? Click this unbelievably obnoxious button!"}, - {kind: "onyx.Button", content: "I want to Blërg!", style: "font-size: 40pt; padding: 1em; background-color: #C0F; color: #F88", onclick: "startSignup"} - ]} - ]}, - {allowHtml: true, content: '

I am 12 and what is this

Blërg is a microblogging platform. Or maybe a miniblogging platform. Blërg is not sure. Blërg is a lot like Twitter, but aims to fix some of its idiosyncracies. Blërg does not want to be a full blogging platform like Wordpress or Livejournal. Blërg is also an open source tagged text database engine written in C that does the back-end work. Blërg\'s author finds it entertaining to anthropomorphize Blërg in the third person.

'}, - {name: "moreLink", kind: "blerg.Link", onNavigate: "loadMore", content: "Tell me more..."}, - {style: "clear: both"}, - {name: "contentBox", allowHtml: true}, - {classes: "latest", components: [ - {tag: "h2", content: "Latest posts"}, - {name: "latestPosts", classes: "latest-posts", onmouseover: "pauseTicker", onmouseout: "startTicker"}, - {tag: "h2", content: "Latest tags"}, - {name: "latestTags", classes: "latest-tags"} - ]} - ], - create: function() { - this.inherited(arguments); + name: "blerg.Welcome", + statics: { + locationDetect: function(l) { + if (l.hash.match(/^(#\/?)?$/)) + return {kind: "blerg.Welcome"} + else + return false; + } + }, + components: [ + {components: [ + {style: "float: right; text-align: center; margin: 0 0 1em 1em", components: [ + {style: "font-size: 14pt; margin-bottom: 4pt", content: "Curious? Click this unbelievably obnoxious button!"}, + {kind: "onyx.Button", content: "I want to Blërg!", style: "font-size: 40pt; padding: 1em; background-color: #C0F; color: #F88", onclick: "startSignup"} + ]} + ]}, + {allowHtml: true, content: '

I am 12 and what is this

Blërg is a microblogging platform. Or maybe a miniblogging platform. Blërg is not sure. Blërg is a lot like Twitter, but aims to fix some of its idiosyncracies. Blërg does not want to be a full blogging platform like Wordpress or Livejournal. Blërg is also an open source tagged text database engine written in C that does the back-end work. Blërg\'s author finds it entertaining to anthropomorphize Blërg in the third person.

'}, + {name: "moreLink", kind: "blerg.Link", onNavigate: "loadMore", content: "Tell me more..."}, + {style: "clear: both"}, + {name: "contentBox", allowHtml: true}, + {classes: "latest", components: [ + {tag: "h2", content: "Latest posts"}, + {name: "latestPosts", classes: "latest-posts", onmouseover: "pauseTicker", onmouseout: "startTicker"}, + {tag: "h2", content: "Latest tags"}, + {name: "latestTags", classes: "latest-tags"} + ]} + ], + create: function() { + this.inherited(arguments); - this.bubble("onSetTitle", {section: "Welcome!"}); - this.loadLatest(); - }, - destroy: function() { - this.stopTicker(); - this.inherited(arguments); - }, - loadMore: function() { - var req = new enyo.Ajax({ - url: "/welcome.html", - handleAs: "text" - }); - req.response(function(inSender, inResponse) { - this.$.contentBox.setContent(inResponse); - this.$.moreLink.hide(); - }.bind(this)); - req.go(); - }, - startSignup: function() { - this.bubble('onStartSignup'); - }, - loadLatest: function() { - var req = new enyo.Ajax({ - url: baseURL + '/latest.json' - }); - req.response(function(inSender, inResponse) { - this.$.latestTags.destroyComponents(); - for (var i = 0; i < inResponse.tags.length; i++) { - var v = inResponse.tags[i]; - this.$.latestTags.createComponent({ - kind: "blerg.Link", - href: baseURL + "/#/tag/" + v, - content: "#" + v, - classes: "ref" - }); - this.$.latestTags.createComponent({noDom: true, content: " "}); - } - this.$.latestTags.render(); + this.bubble("onSetTitle", {section: "Welcome!"}); + this.loadLatest(); + }, + destroy: function() { + this.stopTicker(); + this.inherited(arguments); + }, + loadMore: function() { + var req = new enyo.Ajax({ + url: "/welcome.html", + handleAs: "text" + }); + req.response(function(inSender, inResponse) { + this.$.contentBox.setContent(inResponse); + this.$.moreLink.hide(); + }.bind(this)); + req.go(); + }, + startSignup: function() { + this.bubble('onStartSignup'); + }, + loadLatest: function() { + var req = new enyo.Ajax({ + url: baseURL + '/latest.json' + }); + req.response(function(inSender, inResponse) { + this.$.latestTags.destroyComponents(); + for (var i = 0; i < inResponse.tags.length; i++) { + var v = inResponse.tags[i]; + this.$.latestTags.createComponent({ + kind: "blerg.Link", + href: baseURL + "/#/tag/" + v, + content: "#" + v, + classes: "ref" + }); + this.$.latestTags.createComponent({noDom: true, content: " "}); + } + this.$.latestTags.render(); - this.$.latestPosts.destroyComponents(); - for (var i = 0; i < inResponse.records.length; i++) { - var v = inResponse.records[i]; - this.$.latestPosts.createComponent({kind: "blerg.BriefRecord"}, v); - } - this.$.latestPosts.render(); - this.startTickerCycle(); - }.bind(this)); - req.go(); - }, - startTickerCycle: function() { - this.tickerTimeout = setTimeout(function() { - this.$.latestPosts.node.scrollTop = 0; - this.startTicker(); - }.bind(this), 2500); - }, - startTicker: function() { - if (this.tickerInterval) - return; - this.tickerInterval = setInterval(this.ticker.bind(this), 100); - }, - pauseTicker: function() { - clearInterval(this.tickerInterval); - this.tickerInterval = null; - }, - stopTicker: function() { - clearTimeout(this.tickerTimeout); - this.tickerTimeout = null; - clearInterval(this.tickerInterval); - this.tickerInterval = null; - }, - ticker: function() { - var n = this.$.latestPosts.node; - if (n.scrollTop < n.scrollHeight - n.clientHeight) { - n.scrollTop += 2; - } else { - this.stopTicker(); - this.startTickerCycle(); - } - } + this.$.latestPosts.destroyComponents(); + for (var i = 0; i < inResponse.records.length; i++) { + var v = inResponse.records[i]; + this.$.latestPosts.createComponent({kind: "blerg.BriefRecord"}, v); + } + this.$.latestPosts.render(); + this.startTickerCycle(); + }.bind(this)); + req.go(); + }, + startTickerCycle: function() { + this.tickerTimeout = setTimeout(function() { + this.$.latestPosts.node.scrollTop = 0; + this.startTicker(); + }.bind(this), 2500); + }, + startTicker: function() { + if (this.tickerInterval) + return; + this.tickerInterval = setInterval(this.ticker.bind(this), 100); + }, + pauseTicker: function() { + clearInterval(this.tickerInterval); + this.tickerInterval = null; + }, + stopTicker: function() { + clearTimeout(this.tickerTimeout); + this.tickerTimeout = null; + clearInterval(this.tickerInterval); + this.tickerInterval = null; + }, + ticker: function() { + var n = this.$.latestPosts.node; + if (n.scrollTop < n.scrollHeight - n.clientHeight) { + n.scrollTop += 2; + } else { + this.stopTicker(); + this.startTickerCycle(); + } + } });