]> asedeno.scripts.mit.edu Git - git.git/blobdiff - gitweb/gitweb.js
Merge branch 'tc/maint-transport-ls-remote-with-void'
[git.git] / gitweb / gitweb.js
index f1ba9ae52bcb5f998069e37810b0a87836fd205a..9c66928c4af8cf37b9c13a6a40936523e16fcc6f 100644 (file)
@@ -64,19 +64,19 @@ function fixLinks() {
 
 /**
  * pad number N with nonbreakable spaces on the left, to WIDTH characters
- * example: padLeftStr(12, 3, ' ') == ' 12'
- *          (' ' is nonbreakable space)
+ * example: padLeftStr(12, 3, '\u00A0') == '\u00A012'
+ *          ('\u00A0' is nonbreakable space)
  *
  * @param {Number|String} input: number to pad
  * @param {Number} width: visible width of output
- * @param {String} str: string to prefix to string, e.g. ' '
+ * @param {String} str: string to prefix to string, e.g. '\u00A0'
  * @returns {String} INPUT prefixed with (WIDTH - INPUT.length) x STR
  */
 function padLeftStr(input, width, str) {
        var prefix = '';
 
        width -= input.toString().length;
-       while (width > 1) {
+       while (width > 0) {
                prefix += str;
                width--;
        }
@@ -192,7 +192,7 @@ function updateProgressInfo() {
 
        if (div_progress_info) {
                div_progress_info.firstChild.data  = blamedLines + ' / ' + totalLines +
-                       ' (' + padLeftStr(percentage, 3, ' ') + '%)';
+                       ' (' + padLeftStr(percentage, 3, '\u00A0') + '%)';
        }
 
        if (div_progress_bar) {
@@ -562,7 +562,12 @@ function handleLine(commit, group) {
                        td_sha1.rowSpan = group.numlines;
 
                        a_sha1.href = projectUrl + 'a=commit;h=' + commit.sha1;
-                       a_sha1.firstChild.data = commit.sha1.substr(0, 8);
+                       if (a_sha1.firstChild) {
+                               a_sha1.firstChild.data = commit.sha1.substr(0, 8);
+                       } else {
+                               a_sha1.appendChild(
+                                       document.createTextNode(commit.sha1.substr(0, 8)));
+                       }
                        if (group.numlines >= 2) {
                                var fragment = document.createDocumentFragment();
                                var br   = document.createElement("br");
@@ -774,7 +779,12 @@ function handleResponse() {
        }
 
        // the server returned error
-       if (xhr.readyState === 3 && xhr.status !== 200) {
+       // try ... catch block is to work around bug in IE8
+       try {
+               if (xhr.readyState === 3 && xhr.status !== 200) {
+                       return;
+               }
+       } catch (e) {
                return;
        }
        if (xhr.readyState === 4 && xhr.status !== 200) {