Browse Source

hide social tag when loading ! :-)

pull/1/head
wes 8 years ago
parent
commit
37d3aef002
  1. 20
      src/scripts/post.tag
  2. 2
      src/scripts/social.tag

20
src/scripts/post.tag

@ -10,16 +10,20 @@
next={this.next} next={this.next}
> >
</div> </div>
<div class="text-break animated fadeIn"> <div class="text-break">
<loading if={this.loading}></loading> <div class={"animated " + (this.loading ? "invisible" : "fadeIn")}>
<div <social
class={this.loading ? "invisible" : ""} show={!this.loading}
ref="social"
postid={this.opts.state._id}
> >
<social ref="social" postid={this.opts.state._id}>
</social> </social>
<h4 class="post-title">{ this.title }</h4> <h4 class="post-title">{ this.title }</h4>
<p class="post-content centered text-break"> <p class="post-content centered text-break">
<raw content="{ this.converter.makeHtml(this.content) }"></raw> <raw
content="{ this.converter.makeHtml(this.content) }"
>
</raw>
</p> </p>
<div class="divider"></div> <div class="divider"></div>
</div> </div>
@ -116,7 +120,6 @@ updatePost(postcontent) {
self.title = postcontent.title; self.title = postcontent.title;
self.swipe = !self.swipe; self.swipe = !self.swipe;
self.loading = false; self.loading = false;
self.one("updated", self.toTop);
self.prevloading = ""; self.prevloading = "";
self.nextloading = ""; self.nextloading = "";
self.route(`/posts/${self._id}`); self.route(`/posts/${self._id}`);
@ -128,6 +131,7 @@ updatePost(postcontent) {
} }
nextPost(_id) { nextPost(_id) {
self.update({"loading" : true});
fetch(`/blog/switchpost/${_id.slice(-hashLength)}`) fetch(`/blog/switchpost/${_id.slice(-hashLength)}`)
.then((resp) => resp.text()) .then((resp) => resp.text())
.then((resp) => { .then((resp) => {
@ -147,6 +151,7 @@ nextPost(_id) {
} }
prevPost(_id) { prevPost(_id) {
self.update({"loading" : true});
fetch(`/blog/prevpost/${_id.slice(-hashLength)}`) fetch(`/blog/prevpost/${_id.slice(-hashLength)}`)
.then((resp) => resp.text()) .then((resp) => resp.text())
.then((resp) => { .then((resp) => {
@ -156,6 +161,7 @@ prevPost(_id) {
} }
getPost(_id) { getPost(_id) {
self.update({"loading" : true});
var url; var url;
if (_id !== undefined && _id) { if (_id !== undefined && _id) {
url = `/blog/getpost/${_id.slice(-hashLength)}`; url = `/blog/getpost/${_id.slice(-hashLength)}`;

2
src/scripts/social.tag

@ -16,7 +16,7 @@ updateButton(_id, title) {
} }
if (_id != self._id) { if (_id != self._id) {
self.tweetHtml = `<a style="display:none;" class="twitter-share-button" data-text="${title} by @weskerfoot" data-show-count="false" data-url="https://primop.me/${_id}" ref="tweet">Tweet ${_id}</a>`; self.tweetHtml = `<a style="display:none;" class="twitter-share-button" data-text="${title}" data-via="weskerfoot" data-show-count="false" data-url="https://primop.me/blog/#!posts/${_id}" ref="tweet">Tweet ${_id}</a>`;
self._id = _id; self._id = _id;
self.update(); self.update();
} }

Loading…
Cancel
Save