-
Notifications
You must be signed in to change notification settings - Fork 4
/
css background images.js
39 lines (34 loc) · 2.52 KB
/
css background images.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//Outline AND option to Hide CSS background images
function(){
var tags=document.getElementsByTagName('*');
var element;
for(var i=0; i<tags.length; i++) {
element=tags[i];
if(element.currentStyle) {
if(element.currentStyle['backgroundImage']!=='none')element.style.outline='2px solid #f00';
} else if(window.getComputedStyle){
if(document.defaultView.getComputedStyle(element,null).getPropertyValue('background-image')!=='none')element.style.outline='2px solid #f00';
}
}
//want to hide the CSS background images?
if (confirm("Do you want to hide the background images?")== true) {
//hide the CSS background images
//var d = document,s = window.getComputedStyle;
//Array.prototype.forEach.call(d.querySelectorAll("body *"),
// if (s(el).backgroundImage.match(/url/)){
// el.style.backgroundImage="none";
for(var i=0; i<tags.length; i++) {
element=tags[i];
if(element.currentStyle) {
if(element.currentStyle['backgroundImage']!=='none') element.style.backgroundImage='none';
} else if(window.getComputedStyle){
if(document.defaultView.getComputedStyle(element,null).getPropertyValue('background-image')!=='none') element.style.backgroundImage='none';
}
}
} else {
alert ("Background images will be outlined.");
}
}
//Outline CSS images GOOD
javascript:(function(){var tags=document.getElementsByTagName('*');var element;for(var i=0;i<tags.length;i++){element=tags[i];if(element.currentStyle){if(element.currentStyle['backgroundImage']!=='none')element.style.outline='2px solid #f00';}else if(window.getComputedStyle){if(document.defaultView.getComputedStyle(element,null).getPropertyValue('background-image')!=='none')element.style.outline='2px solid #f00';}}})();
javascript:(function(){var tags=document.getElementsByTagName('*');var element;for(var i=0;i<tags.length;i++){element=tags[i];if(element.currentStyle){if(element.currentStyle['backgroundImage']!=='none')element.style.outline='2px solid #f00';}else if(window.getComputedStyle){if(document.defaultView.getComputedStyle(element,null).getPropertyValue('background-image')!=='none')element.style.outline='2px solid #f00';}}if(confirm("Do you want to hide the background images?")==true){if(element.currentStyle){if(element.currentStyle['backgroundImage']!=='none')element.style.backgroundImage='none';}else if(window.getComputedStyle){if(document.defaultView.getComputedStyle(element,null).getPropertyValue('background-image')!=='none')element.style.backgroundImage='none';};}else{alert("We're done.");}})();