From 73a1174eca9932fa03220d13222b6a62eda2bfa1 Mon Sep 17 00:00:00 2001 From: Chip Black Date: Mon, 28 May 2012 00:29:21 -0700 Subject: [PATCH] Add post formatting help --- www/css/blerg.css | 41 +++++++++++++-- www/doc/post_help.html | 113 ++++++++++++++++++++++++++++++++++++++++ www/jssrc/blerg/Post.js | 27 +++++++++- 3 files changed, 177 insertions(+), 4 deletions(-) create mode 100644 www/doc/post_help.html diff --git a/www/css/blerg.css b/www/css/blerg.css index f0e5568..cec598b 100644 --- a/www/css/blerg.css +++ b/www/css/blerg.css @@ -37,15 +37,18 @@ a > img { text-shadow: black 0px 2px; } -.blerg-header a { - color: inherit; +.blerg-header h1 a { text-decoration: none; } -.blerg-header a:hover { +.blerg-header h1 a:hover { text-decoration: underline; } +.blerg-header a { + color: inherit; +} + .blerg-header h2 { margin: 0; font-size: 28px; @@ -202,6 +205,34 @@ h1, h2, h3 { color: #8F8F8F; } +.record h1 { + font-size: 18pt; + margin: 1em 0; +} + +.record h2 { + font-size: 16pt; + margin: 1em 0; +} + +.record h3 { + font-size: 14pt; + margin: 1em 0; +} + +.record h4 { + font-size: 14pt; + font-weight: normal; + margin: 1em 0; +} + +.record h5 { + font-size: 14pt; + font-weight: normal; + font-style: italic; + margin: 1em 0; +} + .latest h2 { font-size: 16pt; } @@ -268,3 +299,7 @@ h1, h2, h3 { color: red; font-weight: bold; } + +table.help td { + padding: 2pt 8pt; +} diff --git a/www/doc/post_help.html b/www/doc/post_help.html new file mode 100644 index 0000000..a30c1f1 --- /dev/null +++ b/www/doc/post_help.html @@ -0,0 +1,113 @@ +

Post Help

+ +

Blërg supports a limited subset of Markdown/wiki style formatting. + +

Tags and Mentions

+ + + + + + + + + + + +
#bananas#bananas
@bananymous@bananymous
+ +

Text Style

+ + + + + + + + + + + + + + + + + +
*A Christmas Carol* + A Christmas Carol +
**2 Legit 2 Quit** + 2 Legit 2 Quit +
# First-level Title +
## Second-level Title +
### Third-level Title +
#### Fourth-level Title +
##### Fifth-level Title +
+

First-level Title

+

Second-level Title

+

Third-level Title

+

Fourth-level Title

+
Fifth-level Title
+
(Also works for = instead of #)
+ +

Lists

+ + + + + + +
* one fish +
* two fish +
* red fish +
* blue fish +
+
    +
  • one fish
  • +
  • two fish
  • +
  • red fish
  • +
  • blue fish
  • +
+
+ +

Quoting

+ + + + + + +
> Something someone else said +
Something someone else said +
+ +

Links

+ + + + + + + + + + + + + + + + + +
http://any.url + http://any.url +
[A Descriptive Name](http://any.url) + A Descriptive Name +
[A Descriptive Name](http://any.url/audio.mp3) +
[A Descriptive Name](http://any.url/audio audio:mp3)
+ A Descriptive Name + + (Where the audio format is supported. Blërg recognizes mp3, ogg, and wav.)
+ +

diff --git a/www/jssrc/blerg/Post.js b/www/jssrc/blerg/Post.js index 0c72a99..79ab126 100644 --- a/www/jssrc/blerg/Post.js +++ b/www/jssrc/blerg/Post.js @@ -9,7 +9,12 @@ enyo.kind({ }, resizePostContentTimeout: null, components: [ - {tag: "h2", content: "What's on your mind?"}, + {name: "helpContent", allowHtml: true, showing: false}, + {style: "position: relative", components: [ + {tag: "h2", content: "What's on your mind?", style: "width: 75%",}, + {name: "showHelpLink", kind: "blerg.Link", onNavigate: "showHelp", content: "Help!", style: "position: absolute; right: 1pt; bottom: 1pt; font-weight: bold; font-size: large"}, + {name: "hideHelpLink", kind: "blerg.Link", onNavigate: "hideHelp", content: "Hide Help", style: "position: absolute; right: 1pt; bottom: 1pt; font-weight: bold; font-size: large", showing: false} + ]}, {kind: "onyx.InputDecorator", components: [ {name: "postContent", classes: "content", kind: "onyx.TextArea", onkeydown: "resizePostContent", attributes: {tabindex: 4}} ]}, @@ -88,5 +93,25 @@ enyo.kind({ loggedOut: function() { this.$.postButton.setDisabled(true); this.$.loginReminder.show(); + }, + showHelp: function() { + this.$.helpContent.show(); + this.$.showHelpLink.hide(); + this.$.hideHelpLink.show(); + if (this.$.helpContent.getContent() == '') { + var req = new enyo.Ajax({ + url: baseURL + '/doc/post_help.html', + handleAs: 'text' + }); + req.response(function(inSender, inResponse) { + this.$.helpContent.setContent(inResponse); + }.bind(this)); + req.go(); + } + }, + hideHelp: function() { + this.$.helpContent.hide(); + this.$.showHelpLink.show(); + this.$.hideHelpLink.hide(); } }); -- 2.25.1