Add external URL Post method
name: "blerg.Blerg",
kind: "Control",
lastHash: null,
+ pathHandlers: [ blerg.User, blerg.Tag, blerg.Feed, blerg.ExternalURLPost, blerg.Welcome ],
handlers: {
onStartSignup: "showSignupDialog",
onTryLogin: "tryLogin",
onLoginFailed: "loginFailed",
onLogoutSuccessful: "logout"}
],
- urlmap: [
- ['search', /^\?post\/([^/]+)\/(.+)/, "blerg.ExternalURLPost"],
- ['hash', /^#\/(ref|tag)\/([A-Za-z0-9_-]+)(?:\/p(\d+))?$/, "blerg.Tag"],
- ['hash', /^#\/feed(?:\/p(\d+))?$/, "blerg.Feed"],
- ['hash', /^#([A-Za-z0-9_-]+)(?:\/(p)?(\d+))?$/, "blerg.User"]
- ],
- pathHandlers: [ blerg.User, blerg.Tag, blerg.Feed, blerg.Welcome ],
rendered: function() {
this.inherited(arguments);
+enyo.kind({
+ name: "blerg.ExternalURLPost",
+ published: {
+ title: "",
+ url: ""
+ },
+ statics: {
+ locationDetect: function(l) {
+ var m = l.search.match(/^\?post\/([^/]+)\/(.+)/);
+ if (m) {
+ return {
+ kind: "blerg.ExternalURLPost",
+ title: decodeURIComponent(m[1]).replace(']','').replace('[',''),
+ url: decodeURIComponent(m[2])
+ };
+ } else {
+ return false;
+ }
+ }
+ },
+ create: function() {
+ this.inherited(arguments);
+
+ this.bubble("onSetTitle", {section: "Blerg It!"});
+ this.bubble("onPostVisibility", {
+ showing: true,
+ data: '[' + this.title + '](' + this.url + ')'
+ });
+ },
+});
'User.js',
'Tag.js',
'Feed.js',
+ 'ExternalURLPost.js',
'Blerg.js'
);