Make config.json into config.example.json also

This commit is contained in:
Lim Chee Aun 2013-11-28 23:19:29 +08:00
parent 7a4eb5b109
commit 6c74174e5f
3 changed files with 13 additions and 3 deletions

View File

@ -26,7 +26,7 @@ How to setup your own *Life*
1. Fork this project. 1. Fork this project.
2. `git checkout -b gh-pages` (or any branch name you like) 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`. 4. Add your life events into `life.md`.
5. Commit `life.md` (not in `master` branch). 5. Commit `life.md` (not in `master` branch).
6. `git push origin gh-pages` and publish to [GitHub Pages](http://pages.github.com/). 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* 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*. - `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. - `yearLength` - (*number*, default to `120`) The width of the year grids, in pixels.

View File

@ -114,7 +114,14 @@ h1{
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open('GET', 'config.json', true); xhr.open('GET', 'config.json', true);
xhr.onload = function(){ 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(); xhr.send();
}, },