|
1 | | -<!doctype html> |
| 1 | +<!DOCTYPE html> |
2 | 2 | <html data-framework="vue"> |
3 | | - |
4 | | -<head> |
5 | | - <meta charset="utf-8"> |
6 | | - <title>Vue.js • TodoMVC</title> |
7 | | - <link rel="stylesheet" href="vendor/index.css"> |
8 | | - <!-- usually we can just let the browser load additional styles if the user's OS |
| 3 | + <head> |
| 4 | + <meta charset="utf-8" /> |
| 5 | + <title>Vue.js • TodoMVC</title> |
| 6 | + <link rel="stylesheet" href="vendor/index.css" /> |
| 7 | + <!-- usually we can just let the browser load additional styles if the user's OS |
9 | 8 | has preference for dark theme |
10 | 9 | <link rel="stylesheet" media="(prefers-color-scheme: dark)" href="vendor/dark.css"> |
11 | 10 | --> |
12 | | - <!-- but to be able to control the dark theme load programmatically and from E2E tests |
| 11 | + <!-- but to be able to control the dark theme load programmatically and from E2E tests |
13 | 12 | we need to use JavaScript and check preference using "window.matchMedia" call --> |
14 | | - <script> |
15 | | - if (window.matchMedia('(prefers-color-scheme: dark)').matches) { |
16 | | - const link = document.createElement("link") |
17 | | - link.type = "text/css"; |
18 | | - link.rel = "stylesheet"; |
19 | | - link.href = 'vendor/dark.css'; |
20 | | - document.head.appendChild(link) |
21 | | - } |
22 | | - </script> |
23 | | - <style> |
24 | | - [v-cloak] { |
25 | | - display: none; |
26 | | - } |
27 | | - </style> |
28 | | -</head> |
| 13 | + <script> |
| 14 | + if (window.matchMedia('(prefers-color-scheme: dark)').matches) { |
| 15 | + const link = document.createElement('link') |
| 16 | + link.type = 'text/css' |
| 17 | + link.rel = 'stylesheet' |
| 18 | + link.href = 'vendor/dark.css' |
| 19 | + document.head.appendChild(link) |
| 20 | + } |
| 21 | + </script> |
| 22 | + <style> |
| 23 | + [v-cloak] { |
| 24 | + display: none; |
| 25 | + } |
| 26 | + .loading-container { |
| 27 | + display: flex; |
| 28 | + justify-content: center; |
| 29 | + align-items: center; |
| 30 | + } |
| 31 | + .loading { |
| 32 | + padding: 1em; |
| 33 | + font-size: larger; |
| 34 | + font-weight: bolder; |
| 35 | + } |
| 36 | + </style> |
| 37 | + </head> |
29 | 38 |
|
30 | | -<body> |
31 | | - <section class="todoapp"> |
32 | | - <header class="header"> |
33 | | - <h1 data-cy="app-title">todos</h1> |
34 | | - <input class="new-todo" autofocus autocomplete="off" placeholder="What needs to be done?" :value="newTodo" |
35 | | - @input="setNewTodo" @keyup.enter="addTodo"> |
36 | | - </header> |
37 | | - <section class="main" v-show="todos.length" v-cloak> |
38 | | - <ul class="todo-list"> |
39 | | - <li v-for="todo in todos" class="todo" :key="todo.id" :class="{ completed: todo.completed }"> |
40 | | - <div class="view"> |
41 | | - <input class="toggle" type="checkbox" v-model="todo.completed"> |
42 | | - <label>{{ todo.title }}</label> |
43 | | - <button class="destroy" @click="removeTodo(todo)"></button> |
44 | | - </div> |
45 | | - </li> |
46 | | - </ul> |
| 39 | + <body> |
| 40 | + <section class="todoapp"> |
| 41 | + <header class="header"> |
| 42 | + <h1 data-cy="app-title">todos</h1> |
| 43 | + <input |
| 44 | + class="new-todo" |
| 45 | + autofocus |
| 46 | + autocomplete="off" |
| 47 | + placeholder="What needs to be done?" |
| 48 | + :value="newTodo" |
| 49 | + @input="setNewTodo" |
| 50 | + @keyup.enter="addTodo" |
| 51 | + /> |
| 52 | + </header> |
| 53 | + <section class="main" v-show="todos.length" v-cloak> |
| 54 | + <ul class="todo-list"> |
| 55 | + <li |
| 56 | + v-for="todo in todos" |
| 57 | + class="todo" |
| 58 | + :key="todo.id" |
| 59 | + :class="{ completed: todo.completed }" |
| 60 | + > |
| 61 | + <div class="view"> |
| 62 | + <input class="toggle" type="checkbox" v-model="todo.completed" /> |
| 63 | + <label>{{ todo.title }}</label> |
| 64 | + <button class="destroy" @click="removeTodo(todo)"></button> |
| 65 | + </div> |
| 66 | + </li> |
| 67 | + </ul> |
| 68 | + </section> |
| 69 | + <div class="loading-container"> |
| 70 | + <div class="loading" v-show="loading">Loading data ...</div> |
| 71 | + </div> |
47 | 72 | </section> |
48 | | - <div class="loading" v-show="loading">Loading data ...</div> |
49 | | - </section> |
50 | | - <footer class="info"> |
51 | | - <p>Written by |
52 | | - <a href="http://evanyou.me">Evan You</a> |
53 | | - </p> |
54 | | - <p>Part of |
55 | | - <a href="http://todomvc.com">TodoMVC</a> |
56 | | - </p> |
57 | | - </footer> |
58 | | - |
59 | | - <script src="vendor/polyfill.min.js"></script> |
60 | | - <script src="vendor/vue.js"></script> |
61 | | - <script src="vendor/vuex.js"></script> |
62 | | - <script src="vendor/axios.min.js"></script> |
63 | | - <script src="app.js"></script> |
64 | | -</body> |
| 73 | + <footer class="info"> |
| 74 | + <p> |
| 75 | + Written by |
| 76 | + <a href="http://evanyou.me">Evan You</a> |
| 77 | + </p> |
| 78 | + <p> |
| 79 | + Part of |
| 80 | + <a href="http://todomvc.com">TodoMVC</a> |
| 81 | + </p> |
| 82 | + </footer> |
65 | 83 |
|
| 84 | + <script src="vendor/polyfill.min.js"></script> |
| 85 | + <script src="vendor/vue.js"></script> |
| 86 | + <script src="vendor/vuex.js"></script> |
| 87 | + <script src="vendor/axios.min.js"></script> |
| 88 | + <script src="app.js"></script> |
| 89 | + </body> |
66 | 90 | </html> |
0 commit comments