4 locationDetect: function(l) {
5 if (l.hash.match(/^(#\/?)?$/))
6 return {kind: "blerg.Welcome"}
13 {style: "float: right; text-align: center; margin: 0 0 1em 1em;", components: [
14 {style: "font-size: 14pt; margin-bottom: 4pt;", content: "Curious? Click this unbelievably obnoxious button!"},
15 {kind: "onyx.Button", content: "I want to Blërg!", classes: "signup-button", onclick: "startSignup"}
18 {allowHtml: true, content: '<h2>I am 12 and what is this</h2> <p>Blërg is a microblogging platform. Or maybe a miniblogging platform. Blërg is not sure. Blërg is a lot like <a href="http://twitter.com/">Twitter</a>, but aims to fix some of its idiosyncracies. Blërg does not want to be a full blogging platform like <a href="http://wordpress.com/">Wordpress</a> or <a href="http://livejournal.com/">Livejournal</a>. Blërg is also an <a href="/doc/">open source tagged text database engine</a> written in C that does the back-end work. Blërg\'s author finds it entertaining to anthropomorphize Blërg in the third person.</p>'},
19 {name: "moreLink", kind: "blerg.Link", onNavigate: "loadMore", content: "Tell me more..."},
20 {style: "clear: both;"},
21 {name: "contentBox", allowHtml: true},
22 {classes: "latest", components: [
23 {classes: "latest-posts", components: [
24 {name: "latestPostsScroller", classes: "latest-scroller", onmouseover: "pauseTicker", onmouseout: "startTicker", components: [
25 {tag: "h2", content: "Latest posts"},
29 {classes: "latest-tags", components: [
30 {classes: "latest-scroller", components: [
31 {tag: "h2", content: "Latest tags"},
38 this.inherited(arguments);
40 this.bubble("onSetTitle", {section: "Welcome!"});
45 this.inherited(arguments);
47 loadMore: function() {
48 var req = new enyo.Ajax({
52 req.response(function(inSender, inResponse) {
53 this.$.contentBox.setContent(inResponse);
54 this.$.moreLink.hide();
58 startSignup: function() {
59 this.bubble('onStartSignup');
61 loadLatest: function() {
62 var req = new enyo.Ajax({
63 url: baseURL + '/latest.json'
65 req.response(function(inSender, inResponse) {
66 this.$.latestTags.destroyComponents();
67 for (var i = 0; i < inResponse.tags.length; i++) {
68 var v = inResponse.tags[i];
69 this.$.latestTags.createComponent({
71 href: baseURL + "/#/tag/" + v,
75 this.$.latestTags.createComponent({tag: null, content: " "});
77 this.$.latestTags.render();
79 this.$.latestPosts.destroyComponents();
80 for (var i = 0; i < inResponse.records.length; i++) {
81 var v = inResponse.records[i];
82 this.$.latestPosts.createComponent({kind: "blerg.BriefRecord"}, v);
84 this.$.latestPosts.render();
85 this.startTickerCycle();
89 startTickerCycle: function() {
90 var starter = function() {
91 if (this.$.latestPostsScroller.hasNode()) {
92 var n = this.$.latestPostsScroller.node;
93 if (n.scrollTop >= n.scrollHeight - n.clientHeight)
97 this.tickerTimeout = setTimeout(starter, 1000);
100 this.tickerTimeout = setTimeout(starter, 2500);
102 startTicker: function() {
103 if (this.tickerInterval)
105 this.tickerInterval = setInterval(this.ticker.bind(this), 100);
107 pauseTicker: function() {
108 clearInterval(this.tickerInterval);
109 this.tickerInterval = null;
111 stopTicker: function() {
112 clearTimeout(this.tickerTimeout);
113 this.tickerTimeout = null;
114 clearInterval(this.tickerInterval);
115 this.tickerInterval = null;
118 var n = this.$.latestPostsScroller.node;
119 if (n.scrollTop < n.scrollHeight - n.clientHeight) {
123 this.startTickerCycle();