Skip to content

Commit

Permalink
Format JavaScript
Browse files Browse the repository at this point in the history
  • Loading branch information
J2TEAM committed Feb 25, 2017
1 parent cb6e667 commit 02ff8b8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@

hljs.initHighlightingOnLoad();
marked.setOptions({
highlight: function(code) {
return hljs.highlightAuto(code).value;
}
highlight: function(code) {
return hljs.highlightAuto(code).value;
}
});

var open = function(url) {
return new Promise(function(resolve, reject){
return new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest;
xhr.open('GET', url, true);

xhr.onload = function () {
xhr.onload = function() {
if (xhr.status == 200) {
resolve(xhr.response);
} else {
Expand All @@ -42,16 +42,16 @@
var body = document.querySelector(".main");
var file = window.location.hash.replace(/#/g, '') + '.md';
if (body != undefined) {
open('./posts/' + file).then(function(data){
open('./posts/' + file).then(function(data) {
if (data != '') {
var lines = data.split('\n');
var title = blogTitle;
if (lines.length > 0) title = lines[0].replace(/#/g, '') + ' | ' + blogTitle;
body.innerHTML = marked(data);
document.title = title;
}
}, function(){
open('./posts/home.md').then(function(data){
}, function() {
open('./posts/home.md').then(function(data) {
document.title = blogTitle;
body.innerHTML = marked(data);
});
Expand Down

0 comments on commit 02ff8b8

Please sign in to comment.