From b27a626b66b98df7177adaca23d691e3bc443a75 Mon Sep 17 00:00:00 2001 From: Rogan Creswick Date: Mon, 17 Jun 2013 16:22:09 -0700 Subject: accounted for background images when highlighting problems --- src/js/fiveui/injected/ui.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/js/fiveui/injected/ui.js b/src/js/fiveui/injected/ui.js index 221a979..d75cf20 100644 --- a/src/js/fiveui/injected/ui.js +++ b/src/js/fiveui/injected/ui.js @@ -62,17 +62,33 @@ }, 10); }; + /** + * Temp storage for the old in-line styles on elements. + * + * XXX account for marking multiple elements at once. + * (or use a different approach for marking elements) + */ + core.oldStyle = ''; + core.highlightProblem = function(elt) { core.maskRules(function() { - elt.css('background-color', 'rgba(255,0,0,0.3)') - .addClass('uic-problem'); + core.oldStyle = elt.attr('style'); + console.log('old style: '+core.oldStyle); + + elt.attr('style', 'background-color: rgba(255,0,0,0.3); background-image: none;'); + elt.addClass('uic-problem'); }); }; core.maskProblem = function(elt) { core.maskRules(function() { - elt.css('background-color', '') - .removeClass('uic-problem'); + if (core.oldStyle == undefined) { + elt.removeAttr('style'); + } else { + elt.attr('style', core.oldStyle); + } + + elt.removeClass('uic-problem'); }); }; -- cgit v1.2.3