Skip to content

Commit

Permalink
Add loading indication, fixes #15
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Apr 27, 2013
1 parent 2c8143f commit 781405b
Show file tree
Hide file tree
Showing 7 changed files with 1,810 additions and 1,796 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ JS_COMPILER = uglifyjs

all: js/bundle.min.js

js/bundle.js: js/site.js
js/bundle.js: js/site.js index.js
browserify js/site.js > js/bundle.js

js/bundle.min.js: js/bundle.js
Expand Down
Binary file added css/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions css/mistakes.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,8 @@ body {
.CodeMirror { font-size: 14px !important; }
.button { font-size: 12px; }
}

.loading {
background: url(loading.gif);
background-size:50px 50px;
}
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ function mistakes(__div) {
var content = editor.getValue();
var h = new window.XMLHttpRequest();

document.body.className = 'loading';
h.onload = function() {
document.body.className = '';
var d = (JSON.parse(h.responseText));
window.location.hash = '#' + d.id;
};
Expand Down Expand Up @@ -91,11 +93,13 @@ function mistakes(__div) {
return __content(res);
});
} else {
document.body.className = 'loading';
xhr({ path: '/gists/' + id,
host: 'api.github.com',
port: 443,
scheme: 'https'
}, function(res) {
document.body.className = '';
__showGistButton(id);
var r = jsonify.parse(res);
for (var k in r.files) {
Expand Down
Loading

0 comments on commit 781405b

Please sign in to comment.