|
5 | 5 | <meta name="viewport" content="width=device-width, initial-scale=1">
|
6 | 6 | <title>ReactPHP</title>
|
7 | 7 |
|
8 |
| - <style id="css-config"> |
9 |
| - :root { |
10 |
| - --color-base: #2b3e51; |
11 |
| - --color-highlight: #fc4349; |
12 |
| - } |
13 |
| - </style> |
14 |
| - |
15 | 8 | <link href="https://fonts.googleapis.com/css?family=Raleway:300,700|Source+Sans+Pro:400,400i,700,700i|Roboto Mono" rel="stylesheet">
|
16 | 9 | <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.css" rel="stylesheet">
|
17 | 10 | <link href="style.css" rel="stylesheet">
|
@@ -235,103 +228,5 @@ <h2>Example</h2>
|
235 | 228 |
|
236 | 229 | <script>hljs.configure({classPrefix: ''});hljs.initHighlightingOnLoad();</script>
|
237 | 230 |
|
238 |
| -<style> |
239 |
| -#color-picker { |
240 |
| - position: fixed; |
241 |
| - bottom: 0; |
242 |
| - left: 50%; |
243 |
| - transform: translateX(-50%); |
244 |
| - padding: 5px; |
245 |
| - background: #fff; |
246 |
| - box-shadow: 0 0 5px rgba(0, 0, 0, .5); |
247 |
| -} |
248 |
| - |
249 |
| -#color-picker fieldset { |
250 |
| - display: inline-block; |
251 |
| - white-space: nowrap; |
252 |
| - border: 0; |
253 |
| - padding: 5px; |
254 |
| -} |
255 |
| -</style> |
256 |
| -<form id="color-picker"> |
257 |
| - <fieldset> |
258 |
| - <label>Base</label> |
259 |
| - <input type="color" value="#2B3E51" id="base"> |
260 |
| - </fieldset> |
261 |
| - |
262 |
| - <fieldset> |
263 |
| - <label>Highlight</label> |
264 |
| - <input type="color" value="#FC4349" id="highlight"> |
265 |
| - </fieldset> |
266 |
| -</form> |
267 |
| - |
268 |
| -<script> |
269 |
| - function parseQueryParams(query){ |
270 |
| - if (query.indexOf('?') === 0) { |
271 |
| - query = query.substr(1); |
272 |
| - } |
273 |
| - if (query.indexOf('#') === 0) { |
274 |
| - query = query.substr(1); |
275 |
| - } |
276 |
| - |
277 |
| - if (!query) { |
278 |
| - return {}; |
279 |
| - } |
280 |
| - |
281 |
| - var pairs = query.split('&'); |
282 |
| - var obj = {}, p; |
283 |
| - |
284 |
| - for (var i = 0, n = pairs.length; i < n; i++) { |
285 |
| - if (!pairs[i]) { |
286 |
| - continue; |
287 |
| - } |
288 |
| - |
289 |
| - p = pairs[i].split('='); |
290 |
| - obj[p[0]] = decodeURIComponent(p[1]); |
291 |
| - } |
292 |
| - |
293 |
| - return obj; |
294 |
| - } |
295 |
| - |
296 |
| - function getColors() { |
297 |
| - var query = parseQueryParams(location.hash); |
298 |
| - |
299 |
| - query.base = query.base || '#2b3e51'; |
300 |
| - query.highlight = query.highlight || '#fc4349'; |
301 |
| - |
302 |
| - return query; |
303 |
| - } |
304 |
| - |
305 |
| - function setColors() { |
306 |
| - var colors = getColors(); |
307 |
| - |
308 |
| - document.getElementById('css-config').innerHTML = ':root { --color-base: ' + colors.base + '; --color-highlight: ' + colors.highlight + '; }'; |
309 |
| - } |
310 |
| - |
311 |
| - function changeColor(type, color) { |
312 |
| - var colors = getColors(); |
313 |
| - |
314 |
| - colors[type] = color; |
315 |
| - location.hash = 'base=' + encodeURIComponent(colors.base) + '&highlight=' + encodeURIComponent(colors.highlight); |
316 |
| - } |
317 |
| - |
318 |
| - var base = document.getElementById('base'); |
319 |
| - var highlight = document.getElementById('highlight'); |
320 |
| - |
321 |
| - var colors = getColors(); |
322 |
| - |
323 |
| - base.setAttribute('value', colors.base); |
324 |
| - base.addEventListener('change', function(e) { |
325 |
| - changeColor('base', e.target.value); |
326 |
| - }, false); |
327 |
| - |
328 |
| - highlight.setAttribute('value', colors.highlight); |
329 |
| - highlight.addEventListener('change', function(e) { |
330 |
| - changeColor('highlight', e.target.value); |
331 |
| - }, false); |
332 |
| - |
333 |
| - setColors(); |
334 |
| - window.onhashchange = setColors; |
335 |
| -</script> |
336 | 231 | </body>
|
337 | 232 | </html>
|
0 commit comments