|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | +<meta charset="utf-8"> |
| 5 | +<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 6 | +<title>CSS selector-based cosmetic filters</title> |
| 7 | +<style> |
| 8 | + .filters { |
| 9 | + font-family: monospace; |
| 10 | + white-space: pre; |
| 11 | + } |
| 12 | + .tests { |
| 13 | + align-items: flex-start; |
| 14 | + display: flex; |
| 15 | + flex-wrap: wrap; |
| 16 | + } |
| 17 | + .tile { |
| 18 | + display: inline-flex; |
| 19 | + flex-direction: column; |
| 20 | + margin: 0 20px 10px 0; |
| 21 | + min-width: 200px; |
| 22 | + } |
| 23 | + .tile div { |
| 24 | + align-items: center; |
| 25 | + color: white; |
| 26 | + display: flex; |
| 27 | + justify-content: center; |
| 28 | + } |
| 29 | + .tile > div { |
| 30 | + height: 50px; |
| 31 | + position: relative; |
| 32 | + } |
| 33 | + .tile > div > div { |
| 34 | + height: 100%; |
| 35 | + left: 0; |
| 36 | + position: absolute; |
| 37 | + top: 0; |
| 38 | + width: 100%; |
| 39 | + } |
| 40 | + .tile > code { |
| 41 | + align-self: center; |
| 42 | + } |
| 43 | + .pass { |
| 44 | + background-color: green; |
| 45 | + } |
| 46 | + .pass::before { |
| 47 | + content: 'pass'; |
| 48 | + } |
| 49 | + .fail { |
| 50 | + background-color: red; |
| 51 | + } |
| 52 | + .fail::before { |
| 53 | + content: 'fail'; |
| 54 | + } |
| 55 | + .tests a, .tests b { |
| 56 | + display: none; |
| 57 | + } |
| 58 | + .tests a::before { |
| 59 | + opacity: 0; |
| 60 | + } |
| 61 | + .tests b::after { |
| 62 | + opacity: 0; |
| 63 | + } |
| 64 | + .fail-pseudo::before { |
| 65 | + align-items: center; |
| 66 | + background-color: red; |
| 67 | + content: 'fail'; |
| 68 | + display: flex; |
| 69 | + height: 100%; |
| 70 | + justify-content: center; |
| 71 | + left: 0; |
| 72 | + position: absolute; |
| 73 | + top: 0; |
| 74 | + width: 100%; |
| 75 | + } |
| 76 | +</style> |
| 77 | +</head> |
| 78 | +<body> |
| 79 | +<h1>CSS selector-based cosmetic filters</h1> |
| 80 | +<p><a href="./.">Back</a> |
| 81 | +<br><br></p> |
| 82 | +<h3>Filters</h3> |
| 83 | +<div class="filters"><noscript>Enable JavaScript to see needed filters</noscript></div> |
| 84 | + |
| 85 | +<h3>Tests</h3> |
| 86 | +<div id="ccf" class="tests"> |
| 87 | + |
| 88 | +<div id="a1" class="tile"> |
| 89 | + <div class="pass"><div class="fail"><a><b></b></a></div></div> |
| 90 | + <code class="generic">#ccf #a1 .fail</code> |
| 91 | + </div> |
| 92 | + |
| 93 | +<div id="a2" class="tile"> |
| 94 | + <div class="pass"><div class="fail"><a><b></b></a></div></div> |
| 95 | + <code class="generic">#ccf #a2 .fail:not(.a2)</code> |
| 96 | + </div> |
| 97 | + |
| 98 | +<div id="a3" class="tile"> |
| 99 | + <div class="pass"><div class="fail"><a><b></b></a></div></div> |
| 100 | + <code>#ccf #a3 .fail</code> |
| 101 | + </div> |
| 102 | + |
| 103 | +<div id="a4" class="tile"> |
| 104 | + <div class="pass"><div class="fail"><a><b></b></a></div></div> |
| 105 | + <code>#ccf #a4 .fail:not(.a4)</code> |
| 106 | + </div> |
| 107 | + |
| 108 | +<div id="a5" class="tile"> |
| 109 | + <div class="pass"><div class="fail"><a><b></b></a></div></div> |
| 110 | + <code>#ccf #a5 .fail:style(visibility: hidden)</code> |
| 111 | + </div> |
| 112 | + |
| 113 | +<div id="a6" class="tile"> |
| 114 | + <div class="pass"><div class="fail-pseudo"><a><b></b></a></div></div> |
| 115 | + <code class="generic">#ccf #a6 .fail-pseudo::before</code> |
| 116 | + </div> |
| 117 | + |
| 118 | +<div id="a7" class="tile"> |
| 119 | + <div class="pass"><div class="fail-pseudo"><a><b></b></a></div></div> |
| 120 | + <code>#ccf #a7 .fail-pseudo::before</code> |
| 121 | + </div> |
| 122 | + |
| 123 | +<div id="a8" class="tile"> |
| 124 | + <div class="pass"><div class="fail-pseudo"><a><b></b></a></div></div> |
| 125 | + <code>#ccf #a8 .fail-pseudo::before:style(visibility: hidden)</code> |
| 126 | + </div> |
| 127 | + |
| 128 | +</div> |
| 129 | + |
| 130 | +<script> |
| 131 | + const hostname = self.location.hostname; |
| 132 | + const filters = []; |
| 133 | + const fragment = document.createDocumentFragment(); |
| 134 | + for ( const node of document.querySelectorAll('code') ) { |
| 135 | + const div = document.createElement('div'); |
| 136 | + let text = '##' + node.textContent; |
| 137 | + if ( node.classList.contains('generic') === false ) { |
| 138 | + text = hostname + text; |
| 139 | + } |
| 140 | + div.textContent = text; |
| 141 | + fragment.appendChild(div); |
| 142 | + } |
| 143 | + const parent = document.querySelector('.filters'); |
| 144 | + while ( parent.lastElementChild !== null ) { |
| 145 | + parent.removeChild(parent.lastElementChild); |
| 146 | + } |
| 147 | + parent.appendChild(fragment); |
| 148 | +</script> |
| 149 | +</body> |
| 150 | +</html> |
0 commit comments