]> granicus.if.org Git - transmission/commitdiff
don't use Object.keys(), since it's not supported in IE8.
authorJordan Lee <jordan@transmissionbt.com>
Thu, 1 Sep 2011 17:24:49 +0000 (17:24 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Thu, 1 Sep 2011 17:24:49 +0000 (17:24 +0000)
web/javascript/transmission.js

index d8526fdac3b918f6e73de926093b44edf8d458fb..b2d542546616e7720bdcf080eea632d6a9af9314 100644 (file)
@@ -1899,16 +1899,23 @@ Transmission.prototype =
 
        refreshFilterButton: function()
        {
-               var text,
+               var o, tmp, text, torrent_count,
                    state = this[Prefs._FilterMode],
                    state_all = state == Prefs._FilterAll,
                    state_string = this.getStateString(state),
                    tracker = this.filterTracker,
                    tracker_all = !tracker,
                    tracker_string = tracker ? this.getReadableDomain(tracker) : '',
-                   torrent_count = Object.keys(this._torrents).length,
                    visible_count = this._rows.length;
 
+               // count the total number of torrents
+               // torrent_count = Object.keys(this._torrents).length; // IE8 doesn't support Object.keys(
+               torrent_count = 0;
+               o = this._torrents;
+               for (tmp in o)
+                       if (o.hasOwnProperty(tmp))
+                               ++torrent_count;
+
                text = 'Show <span class="filter-selection">';
                if (state_all && tracker_all)
                        text += 'All';
@@ -2130,7 +2137,12 @@ Transmission.prototype =
                ***/
 
                var trackers = this.getTrackers();
-               var names = Object.keys(trackers).sort();
+               //var names = Object.keys(trackers).sort(); (IE8 doesn't have Object.keys)
+               var name, name=[];
+               var names = [];
+               for  (name in trackers)
+                       names.push (name);
+               names.sort();
 
                var fragment = document.createDocumentFragment();
                var div = document.createElement('div');