From 6c74174e5f017b57e4ccbdf1baa3cd0fc28bca5d Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Thu, 28 Nov 2013 23:19:29 +0800 Subject: [PATCH] Make config.json into config.example.json also --- README.md | 7 +++++-- config.json => config.example.json | 0 index.html | 9 ++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) rename config.json => config.example.json (100%) diff --git a/README.md b/README.md index d65def7..80061d0 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ How to setup your own *Life* 1. Fork this project. 2. `git checkout -b gh-pages` (or any branch name you like) -3. Make a copy `life.example.md`, rename it to `life.md`. +3. Make a copy of `life.example.md`, rename it to `life.md`. 4. Add your life events into `life.md`. 5. Commit `life.md` (not in `master` branch). 6. `git push origin gh-pages` and publish to [GitHub Pages](http://pages.github.com/). @@ -44,7 +44,10 @@ How to upgrade your *Life* How to configure your *Life* ---------------------------- -Modify `config.json`. The configuration: +1. Make a copy of `config.example.json`, rename it to `config.json`. +2. Only commit it in `gh-pages` branch. + +The configuration: - `customStylesheetURL` - (*string*, default to `null`) Path to a custom stylesheet file, for those who doesn't like the default *theme*. - `yearLength` - (*number*, default to `120`) The width of the year grids, in pixels. diff --git a/config.json b/config.example.json similarity index 100% rename from config.json rename to config.example.json diff --git a/index.html b/index.html index cd9d818..73706cc 100644 --- a/index.html +++ b/index.html @@ -114,7 +114,14 @@ h1{ var xhr = new XMLHttpRequest(); xhr.open('GET', 'config.json', true); xhr.onload = function(){ - if (xhr.status == 200) fn(JSON.parse(xhr.responseText)); + if (xhr.status == 200){ + fn(JSON.parse(xhr.responseText)); + } else { + fn({}); + } + }; + xhr.onerror = xhr.onabort = function(){ + fn({}); }; xhr.send(); },