Skip to content

Commit dfdb9cf

Browse files
committed
Gadgets/Stdrev: Store the visibility of rev tables
1 parent 40f2bb7 commit dfdb9cf

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

gadgets/standard_revisions.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -844,24 +844,38 @@ $(function() {
844844
}
845845
};
846846

847-
/* Handles inclusions of Template:rev_begin, Template:rev and
847+
/* Handles inclusion of Template:rev_begin, Template:rev and
848848
Template:rev_end.
849849
850850
We don't copy the contents of this templates around. We just add the
851851
rows to the element tracker and show and hide them as needed. To hide
852852
the frame on non-diff revisions, we have special treatment in
853853
on_selection_change. Note, that in order for this to work, the revision
854854
marks must not be touched.
855+
856+
The visibility map of whole table is stored as 'visible' data member
857+
of the jquery element.
855858
*/
856-
StandardRevisionPlugin.prototype.prepare_all_revs = function(scope) {
857-
var rev_elems = scope.rev_tables.children('tbody').children('.t-rev');
859+
StandardRevisionPlugin.prototype.prepare_rev = function(el) {
860+
var rev_elems = el.children('tbody').children('.t-rev');
858861
var self = this;
862+
var table_visible = new VisibilityMap();
863+
859864
rev_elems.each(function() {
860865
var visible = get_visibility_map($(this));
861866
visible.add(Rev.DIFF);
867+
total_visible.combine_or(visible);
862868

863869
self.tracker.add_diff_object($(this), visible);
864870
});
871+
el.data('visible', table_visible);
872+
};
873+
874+
StandardRevisionPlugin.prototype.prepare_all_revs = function(scope) {
875+
var self = this;
876+
scope.rev_tables.each(function() {
877+
self.prepare_rev($(this));
878+
});
865879
};
866880

867881
/** Handles inclusions of Template:rev_inl

0 commit comments

Comments
 (0)