Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: yonran/dochub
...
head fork: yonran/dochub
  • 7 commits
  • 4 files changed
  • 0 commit comments
  • 3 contributors
View
2  static/css/custom.css
@@ -256,6 +256,8 @@ table.listing td {
}
code{
background-color: #eee;
+ padding: 2px 0px;
+ margin: 5px;
}
.jq-primaryContent pre code{
background: none;
View
2  static/js/router.js
@@ -132,7 +132,7 @@ define([
};
_.bindAll(cb, 'fn');
// match #languageName/:query or #languageName/ or just #languageName
- this.route(new RegExp("^" + languageName + '(?:/([^/])?)?$'),
+ this.route(new RegExp("^" + languageName + '(?:/([^/]*))?$'),
languageName, cb.fn);
}
},
View
15 static/js/views/languageview.js
@@ -94,13 +94,26 @@ define([
this.mainResultsView.startSpinner();
var self = this;
this.collection.fetch({
+ xhr: function() {
+ var xhr = jQuery.ajaxSettings.xhr();
+ if (xhr instanceof window.XMLHttpRequest) {
+ // XMLHttpRequest 2
+ xhr.addEventListener("progress", function(evt) {
+ if (evt.lengthComputable) {
+ self.mainResultsView.setDownloadProgress(evt.loaded, evt.total);
+ }
+ }, false);
+ }
+ return xhr;
+ },
success: function(coll, resp) {
console.log('[Success fetching ' + self.languageName + '.]');
self.searchHeaderView.lastQuery = null; // TODO: use abstractions
self.searchHeaderView.onSearch();
self.mainResultsView.spinner.stop();
+ self.mainResultsView.removeDownlaodProgress();
self.active = true;
- }
+ },
});
}
} else if (!active && this.active) {
View
31 static/js/views/searchresults.js
@@ -27,12 +27,39 @@ define([
shadow : false // Whether to render a shadow
};
this.spinner = new Spinner(opts).spin();
- $(this.spinner.el).css('margin-top', $(window).height()/4);
- $(this.spinner.el).css('margin-left', $(window).width()/4);
+ var halfHeight = opts.radius + opts.length + opts.width;
+ $(this.spinner.el).css('margin-top', $(window).height()/4 + halfHeight);
+ $(this.spinner.el).css('margin-left', "50%");
+ $(this.spinner.el).css("height", halfHeight + "px");
$(this.el).append(this.spinner.el);
}
},
+ setDownloadProgress: function(receivedB, totalB) {
+ if (!this.options.spinner)
+ return;
+ if (!this.progressEl) {
+ this.progressEl = $(
+ '<div style="text-align:center; width:100%; max-width: 100%;">' +
+ ' <progress></progress>' +
+ ' <br>' +
+ ' <span class="progress-text"></span>' +
+ '</div>').get(0);
+ $(this.el).append(this.progressEl);
+ }
+ var receivedMB = Math.round(receivedB/1024/1024*10)/10
+ , totalMB = Math.round(totalB/1024/1024*10)/10;
+ $(this.progressEl)
+ .find("progress").prop("max", totalB).prop("value", receivedB).end()
+ .find(".progress-text").text(receivedMB + "MB/" + totalMB + "MB");
+ },
+ removeDownlaodProgress: function() {
+ if (this.progressEl) {
+ $(this.progressEl).remove();
+ this.progressEl = undefined;
+ }
+ },
+
render: function() {
console.log('[Data loaded, rendering models.]');
// render a subview for each model in the collection

No commit comments for this range

Something went wrong with that request. Please try again.