@@ -233,6 +233,8 @@ coverage.index_ready = function ($) {
233
233
234
234
// -- pyfile stuff --
235
235
236
+ coverage . LINE_FILTERS_STORAGE = "COVERAGE_LINE_FILTERS" ;
237
+
236
238
coverage . pyfile_ready = function ( $ ) {
237
239
// If we're directed to a particular line number, highlight the line.
238
240
var frag = location . hash ;
@@ -256,6 +258,22 @@ coverage.pyfile_ready = function ($) {
256
258
$ ( ".button_toggle_mis" ) . click ( function ( evt ) { coverage . toggle_lines ( evt . target , "mis" ) ; } ) ;
257
259
$ ( ".button_toggle_par" ) . click ( function ( evt ) { coverage . toggle_lines ( evt . target , "par" ) ; } ) ;
258
260
261
+ coverage . filters = undefined ;
262
+ try {
263
+ coverage . filters = localStorage . getItem ( coverage . LINE_FILTERS_STORAGE ) ;
264
+ } catch ( err ) { }
265
+
266
+ if ( coverage . filters ) {
267
+ coverage . filters = JSON . parse ( coverage . filters ) ;
268
+ }
269
+ else {
270
+ coverage . filters = { run : false , exc : true , mis : true , par : true } ;
271
+ }
272
+
273
+ for ( cls in coverage . filters ) {
274
+ coverage . set_line_visibilty ( cls , coverage . filters [ cls ] ) ;
275
+ }
276
+
259
277
coverage . assign_shortkeys ( ) ;
260
278
coverage . wire_up_help_panel ( ) ;
261
279
@@ -266,17 +284,26 @@ coverage.pyfile_ready = function ($) {
266
284
} ;
267
285
268
286
coverage . toggle_lines = function ( btn , cls ) {
269
- btn = $ ( btn ) ;
270
- var show = "show_" + cls ;
271
- if ( btn . hasClass ( show ) ) {
272
- $ ( "#source ." + cls ) . removeClass ( show ) ;
273
- btn . removeClass ( show ) ;
274
- }
275
- else {
287
+ var onoff = ! $ ( btn ) . hasClass ( "show_" + cls ) ;
288
+ coverage . set_line_visibilty ( cls , onoff ) ;
289
+ coverage . build_scroll_markers ( ) ;
290
+ coverage . filters [ cls ] = onoff ;
291
+ try {
292
+ localStorage . setItem ( coverage . LINE_FILTERS_STORAGE , JSON . stringify ( coverage . filters ) ) ;
293
+ } catch ( err ) { }
294
+ } ;
295
+
296
+ coverage . set_line_visibilty = function ( cls , onoff ) {
297
+ var show = "show_" + cls ;
298
+ var btn = $ ( ".button_toggle_" + cls ) ;
299
+ if ( onoff ) {
276
300
$ ( "#source ." + cls ) . addClass ( show ) ;
277
301
btn . addClass ( show ) ;
278
302
}
279
- coverage . build_scroll_markers ( ) ;
303
+ else {
304
+ $ ( "#source ." + cls ) . removeClass ( show ) ;
305
+ btn . removeClass ( show ) ;
306
+ }
280
307
} ;
281
308
282
309
// Return the nth line div.
0 commit comments