Browse Source

tweak loading

pull/1/head
wes 7 years ago
parent
commit
e7c99fe4fe
  1. 12
      build/scripts/riotblog.min.js
  2. 25
      src/scripts/post.tag
  3. 2
      src/scripts/postcontrols.tag

12
build/scripts/riotblog.min.js

File diff suppressed because one or more lines are too long

25
src/scripts/post.tag

@ -5,17 +5,11 @@
if={this.swipe}
class={`animated ${this.transition}`}
>
<div if={this.nomore}>
<h4>No more posts!</h4>
</div>
<div if={!this.nomore}>
<h4>{ this.title }</h4>
<h5>Posted by { this.author }</h5>
<p class="post-content centered text-break">
{ this.content }
</p>
</div>
<h4>{ this.title }</h4>
<h5>Posted by { this.author }</h5>
<p class="post-content centered text-break">
{ this.content }
</p>
<div class="divider"></div>
</div>
</div>
@ -78,8 +72,7 @@ next(ev) {
}
setPost(pid, transition) {
this.opts.state.pid = pid;
fetch(`/blog/switchpost/${this.opts.state.pid-1}`)
fetch(`/blog/switchpost/${pid-1}`)
.then((resp) => resp.text())
.then(
(body) => {
@ -87,8 +80,6 @@ setPost(pid, transition) {
self.nomore = true;
self.prevloading = "";
self.nextloading = "";
self.swipe = true;
self.transition = transition;
self.update()
return;
}
@ -99,10 +90,12 @@ setPost(pid, transition) {
self.nextloading = "";
self.nomore = true;
self.swipe = true;
self.transition = transition;
self.transition = "";
self.opts.state.pid--;
self.update();
return;
}
self.opts.state.pid = pid;
self.author = postcontent[0].doc.author[0];
self.content = postcontent[0].doc.content[0];
self.title = postcontent[0].doc.title[0];

2
src/scripts/postcontrols.tag

@ -1,5 +1,5 @@
<postcontrols>
<div class="container centered">
<div class="container">
<div class="columns">
<div class="column col-6">
<button class={"btn btn-lg nav-button float-right " + (this.opts.state.pid <= 1 ? "disabled" : " ") + this.opts.prevloading}

Loading…
Cancel
Save