Browse Source

fix for PhantomJS

pull/1/head
wes 8 years ago
parent
commit
e7385b9499
  1. 7
      src/scripts/app.tag
  2. 5
      src/scripts/editor.tag
  3. 2
      src/scripts/links.tag
  4. 8
      src/scripts/post.tag
  5. 2
      src/scripts/projects.tag
  6. 4
      src/scripts/sidebar.tag
  7. 4
      src/scripts/social.tag
  8. 2
      src/templates/index.html

7
src/scripts/app.tag

@ -176,10 +176,9 @@ menuOff(ev) {
function activate(page) { function activate(page) {
return function() { return function() {
if (page !== "posts") { if (page !== "posts") {
document.title = `${page.slice(0,1).toUpperCase()}${page.slice(1,page.length)}`; document.title = page.slice(0,1).toUpperCase()+" "+page.slice(1,page.length);
self.currentPage = document.title; self.currentPage = document.title;
} }
console.log(`activating ${page}`);
self.active = lens.setActive(self.active, page); self.active = lens.setActive(self.active, page);
self.update(); self.update();
}; };
@ -222,7 +221,7 @@ self.one("updated", () => {
function loaduser() { function loaduser() {
/* https://api.github.com/users/${self.username}/repos?sort=updated&direction=desc */ /* https://api.github.com/users/${self.username}/repos?sort=updated&direction=desc */
self.cached(`/blog/projects`) self.cached("/blog/projects")
.then((resp) => resp.json()) .then((resp) => resp.json())
.then((resp) => { .then((resp) => {
self.state.projects = Z.fromList( self.state.projects = Z.fromList(
@ -235,7 +234,7 @@ function loaduser() {
} }
function getcategories() { function getcategories() {
self.cached(`/blog/categories`) self.cached("/blog/categories")
.then((resp) => resp.json()) .then((resp) => resp.json())
.then((resp) => { .then((resp) => {
self.categories = resp; self.categories = resp;

5
src/scripts/editor.tag

@ -214,7 +214,7 @@ loadPost(_id) {
return false; return false;
} }
self.update({"loading" : true}); self.update({"loading" : true});
axios.get(`/blog/getpost/${_id.slice(-8)}`) axios.get("/blog/getpost/"+_id.slice(-8))
.then(function(resp) { .then(function(resp) {
self.update({"loading" : false}); self.update({"loading" : false});
self.refs.textarea.value = resp.data.content; self.refs.textarea.value = resp.data.content;
@ -240,7 +240,7 @@ deletePost(_id) {
return false; return false;
} }
self.update({"loading" : true}); self.update({"loading" : true});
axios.get(`/blog/deletepost/${self._id}`) axios.get("/blog/deletepost/"+self._id)
.then(function(resp) { .then(function(resp) {
console.log(resp); console.log(resp);
self.listPosts(); self.listPosts();
@ -256,7 +256,6 @@ listPosts() {
axios.get("/blog/allposts") axios.get("/blog/allposts")
.then(function(resp) { .then(function(resp) {
var postsList = Z.extend(Z.empty, resp.data); var postsList = Z.extend(Z.empty, resp.data);
console.log(`trying to load post with id ${Z.focus(postsList, self.defaultPost)._id}`);
var currentPost = Z.focus(postsList, self.defaultPost); var currentPost = Z.focus(postsList, self.defaultPost);
if (currentPost == self.defaultPost) { if (currentPost == self.defaultPost) {

2
src/scripts/links.tag

@ -45,7 +45,7 @@ self.groups = []
getLinks() { getLinks() {
self.update({"loading" : true}); self.update({"loading" : true});
self.opts.cached(`/blog/links/`) self.opts.cached("/blog/links/")
.then((resp) => resp.text()) .then((resp) => resp.text())
.then((resp) => { .then((resp) => {
self.update( self.update(

8
src/scripts/post.tag

@ -131,7 +131,7 @@ updatePost(postcontent) {
self.loading = false; self.loading = false;
self.prevloading = ""; self.prevloading = "";
self.nextloading = ""; self.nextloading = "";
self.route(`/posts/${self._id}`); self.route("/posts/"+self._id);
RiotControl.trigger("postswitch", {"title" : self.title}); RiotControl.trigger("postswitch", {"title" : self.title});
@ -145,7 +145,7 @@ updatePost(postcontent) {
nextPost(_id) { nextPost(_id) {
self.update({"loading" : true}); self.update({"loading" : true});
self.opts.cached(`/blog/switchpost/${_id.slice(-hashLength)}/${self.category}`) self.opts.cached("/blog/switchpost/"+_id.slice(-hashLength)+"/"+self.category)
.then((resp) => resp.text()) .then((resp) => resp.text())
.then((resp) => { .then((resp) => {
var content = JSON.parse(resp); var content = JSON.parse(resp);
@ -165,7 +165,7 @@ nextPost(_id) {
prevPost(_id) { prevPost(_id) {
self.update({"loading" : true}); self.update({"loading" : true});
self.opts.cached(`/blog/prevpost/${_id.slice(-hashLength)}/${self.category}`) self.opts.cached("/blog/prevpost/"+_id.slice(-hashLength)+"/"+self.category)
.then((resp) => resp.text()) .then((resp) => resp.text())
.then((resp) => { .then((resp) => {
self.updatePost(JSON.parse(resp)) self.updatePost(JSON.parse(resp))
@ -176,7 +176,7 @@ getPost(_id) {
self.update({"loading" : true}); self.update({"loading" : true});
var url; var url;
if (_id !== undefined && _id) { if (_id !== undefined && _id) {
url = `/blog/getpost/${_id.slice(-hashLength)}/${self.category}`; url = "/blog/getpost/"+_id.slice(-hashLength)+"/"+self.category;
} }
else { else {
url = "/blog/switchpost/"; url = "/blog/switchpost/";

2
src/scripts/projects.tag

@ -15,7 +15,7 @@
</div> </div>
<div class="text-break"> <div class="text-break">
<div if={this.swipe} class={`card animated ${this.transition}`}> <div if={this.swipe} class={"card animated "+this.transition}>
<div class="card-header"> <div class="card-header">
<h3 class="card-title project-title">{ this.project().name }</h3> <h3 class="card-title project-title">{ this.project().name }</h3>
<h5 class="project-description">{ this.project().description }</h5> <h5 class="project-description">{ this.project().description }</h5>

4
src/scripts/sidebar.tag

@ -16,7 +16,7 @@
show={this.swiped !== undefined} show={this.swiped !== undefined}
style={ this.styles() } style={ this.styles() }
id="sidebar" id="sidebar"
class={`animated ${this.swiped !== undefined ? (this.swiped ? "fadeInLeft" : "fadeOutLeft") : "" } container`} class={"animated "+(this.swiped !== undefined ? (this.swiped ? "fadeInLeft" : "fadeOutLeft") : "" ) +" container"}
> >
<div <div
style={{"height" : "100%", "overflow-x" : "hidden"}} style={{"height" : "100%", "overflow-x" : "hidden"}}
@ -60,7 +60,7 @@
<div <div
style={buttonStyles()} style={buttonStyles()}
class={`column ${this.open ? "col-1" : "col-12"}`} class={"column "+(this.open ? "col-1" : "col-12")}
onclick={this.swipe} onclick={this.swipe}
> >
</div> </div>

4
src/scripts/social.tag

@ -28,8 +28,8 @@ updateButton(_id, title) {
} }
if (_id != self._id) { if (_id != self._id) {
self.tweetHtml = `<a style="display:none;" data-size="small" class="twitter-share-button btn" data-text="${title}" data-via="weskerfoot" data-show-count="false" data-url="https://primop.me/blog/#!posts/${_id}" ref="tweet">Tweet ${_id}</a>`; self.tweetHtml = '<a style="display:none;" data-size="small" class="twitter-share-button btn" data-text="'+title+'" data-via="weskerfoot" data-show-count="false" data-url="https://primop.me/blog/#!posts/'+_id+'" ref="tweet">Tweet '+_id+'</a>';
self.fbHtml = `<div class="fb-share-button" data-href="https://primop.me/blog/#!posts/${_id}" data-layout="button_count"></div>`; self.fbHtml = '<div class="fb-share-button" data-href="https://primop.me/blog/#!posts/'+_id+'" data-layout="button_count"></div>';
self._id = _id; self._id = _id;
self.update(); self.update();
} }

2
src/templates/index.html

@ -6,7 +6,7 @@
</head> </head>
<html> <html>
<body> <body>
<div data-is="app" csrf_token="{{ csrf_token() }}"></div> <div data-is="app" initial_post="{{ initial_post }}" csrf_token="{{ csrf_token() }}"></div>
</body> </body>
<footer> <footer>
<script> <script>

Loading…
Cancel
Save