|
2 | 2 | <html>
|
3 | 3 |
|
4 | 4 | <head>
|
5 |
| -<!-- COMMON TAGS --> |
6 |
| -<meta charset="utf-8"> |
7 |
| -<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
8 |
| -<title>Git Cheats - Cheatsheet For Git Commands</title> |
9 |
| -<!-- Search Engine --> |
10 |
| -<meta name="description" content="Git Cheats is an open source project which aims to save you time from searching for git commands through the web by filtering and categorizing."> |
11 |
| -<meta name="image" content="https://raw.githubusercontent.com/excalith/Git-Cheats/master/images/card.png"> |
12 |
| -<meta name="keywords" content="git,cheatsheet,commands,github,bitbucket,gitlab,open,source"> |
13 |
| -<meta name="robots" content="index, nofollow"> |
14 |
| -<!-- Schema.org for Google --> |
15 |
| -<meta itemprop="name" content="Git Cheats - Cheatsheet For Git Commands"> |
16 |
| -<meta itemprop="description" content="Git Cheats is an open source project which aims to save you time from searching for git commands through the web by filtering and categorizing."> |
17 |
| -<meta itemprop="image" content="https://raw.githubusercontent.com/excalith/Git-Cheats/master/images/card.png"> |
18 |
| -<!-- Twitter --> |
19 |
| -<meta name="twitter:card" content="summary"> |
20 |
| -<meta name="twitter:title" content="Git Cheats - Cheatsheet For Git Commands"> |
21 |
| -<meta name="twitter:description" content="Git Cheats is an open source project which aims to save you time from searching for git commands through the web by filtering and categorizing."> |
22 |
| -<meta name="twitter:image:src" content="http://gitcheats.com/"> |
23 |
| -<!-- Open Graph general (Facebook, Pinterest & Google+) --> |
24 |
| -<meta name="og:title" content="Git Cheats - Cheatsheet For Git Commands"> |
25 |
| -<meta name="og:description" content="Git Cheats is an open source project which aims to save you time from searching for git commands through the web by filtering and categorizing."> |
26 |
| -<meta name="og:image" content="https://raw.githubusercontent.com/excalith/Git-Cheats/master/images/card.png"> |
27 |
| -<meta name="og:url" content="http://gitcheats.com/"> |
28 |
| -<meta name="og:site_name" content="Git Cheats - Cheatsheet For Git Commands"> |
29 |
| -<meta name="og:type" content="website"> |
30 |
| - |
31 |
| -<link rel="shortcut icon" type="image/png" href="images/favicon.png" /> |
32 |
| -<link rel="stylesheet" href="css/master.css" /> |
33 |
| -<script src="js/jquery-3.3.1.min.js"></script> |
34 |
| -<script src="js/isotope.pkgd.min.js"></script> |
35 |
| -<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" |
36 |
| - crossorigin="anonymous"> |
| 5 | + <!-- COMMON TAGS --> |
| 6 | + <meta charset="utf-8"> |
| 7 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 8 | + <title>Git Cheats - Cheatsheet For Git Commands</title> |
| 9 | + <!-- Search Engine --> |
| 10 | + <meta name="description" content="Git Cheats is an open source project which aims to save you time from searching for git commands through the web by filtering and categorizing."> |
| 11 | + <meta name="image" content="https://raw.githubusercontent.com/excalith/Git-Cheats/master/images/card.png"> |
| 12 | + <meta name="keywords" content="git,cheatsheet,commands,github,bitbucket,gitlab,open,source"> |
| 13 | + <meta name="robots" content="index, nofollow"> |
| 14 | + <!-- Schema.org for Google --> |
| 15 | + <meta itemprop="name" content="Git Cheats - Cheatsheet For Git Commands"> |
| 16 | + <meta itemprop="description" content="Git Cheats is an open source project which aims to save you time from searching for git commands through the web by filtering and categorizing."> |
| 17 | + <meta itemprop="image" content="https://raw.githubusercontent.com/excalith/Git-Cheats/master/images/card.png"> |
| 18 | + <!-- Twitter --> |
| 19 | + <meta name="twitter:card" content="summary"> |
| 20 | + <meta name="twitter:title" content="Git Cheats - Cheatsheet For Git Commands"> |
| 21 | + <meta name="twitter:description" content="Git Cheats is an open source project which aims to save you time from searching for git commands through the web by filtering and categorizing."> |
| 22 | + <meta name="twitter:image:src" content="http://gitcheats.com/"> |
| 23 | + <!-- Open Graph general (Facebook, Pinterest & Google+) --> |
| 24 | + <meta name="og:title" content="Git Cheats - Cheatsheet For Git Commands"> |
| 25 | + <meta name="og:description" content="Git Cheats is an open source project which aims to save you time from searching for git commands through the web by filtering and categorizing."> |
| 26 | + <meta name="og:image" content="https://raw.githubusercontent.com/excalith/Git-Cheats/master/images/card.png"> |
| 27 | + <meta name="og:url" content="http://gitcheats.com/"> |
| 28 | + <meta name="og:site_name" content="Git Cheats - Cheatsheet For Git Commands"> |
| 29 | + <meta name="og:type" content="website"> |
| 30 | + |
| 31 | + <link rel="shortcut icon" type="image/png" href="images/favicon.png" /> |
| 32 | + <link rel="stylesheet" href="css/master.css" /> |
| 33 | + <script src="js/jquery-3.3.1.min.js"></script> |
| 34 | + <script src="js/isotope.pkgd.min.js"></script> |
| 35 | + <script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script> |
| 36 | + <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" |
| 37 | + crossorigin="anonymous"> |
37 | 38 | </head>
|
38 | 39 |
|
39 | 40 | <body>
|
|
59 | 60 | <div class="dropdown-content">
|
60 | 61 | <label class="checkbox">
|
61 | 62 | <span class="advanced-label"></span>
|
62 |
| - <input id="ShowAdvanced" type="checkbox" checked="checked"> |
| 63 | + <input id="ShowAdvanced" type="checkbox"> |
63 | 64 | <span class="checkmark"></span>
|
64 | 65 | </label>
|
65 | 66 | <hr>
|
|
73 | 74 | </div>
|
74 | 75 |
|
75 | 76 | <script>
|
76 |
| - // init isotope |
| 77 | + // Cookies |
| 78 | + var isAdvanced = false; |
77 | 79 | var lang = "en";
|
| 80 | + |
| 81 | + if (Cookies.get('language')) |
| 82 | + lang = Cookies.get('language'); |
| 83 | + |
| 84 | + if (Cookies.get('showAdvanced')) { |
| 85 | + isAdvanced = Cookies.get('showAdvanced') == "true" ? true : false; |
| 86 | + $('#ShowAdvanced').prop('checked', isAdvanced); |
| 87 | + }; |
| 88 | + |
| 89 | + // init isotope |
78 | 90 | var qsRegex;
|
79 | 91 | var $grid = $('.grid').isotope({
|
80 | 92 | itemSelector: '.grid-item',
|
81 | 93 | layoutMode: 'fitRows',
|
82 | 94 | filter: function () {
|
83 |
| - // This allows user to find all text within grid-items. Disabled for request |
84 |
| - //return qsRegex ? $(this).text().match(qsRegex) : true; |
85 |
| - |
86 |
| - // This allows user to find only keywords within keywords attribute. |
87 | 95 | return qsRegex ? $(this).attr('keywords').match(qsRegex) : true;
|
88 | 96 | }
|
89 | 97 | });
|
|
132 | 140 |
|
133 | 141 | $('input[name="lang"]').change(function () {
|
134 | 142 | lang = $('input[name=lang]:checked').val();
|
| 143 | + Cookies.set('language', lang); |
| 144 | + |
135 | 145 | refreshList();
|
136 | 146 | });
|
137 | 147 |
|
138 | 148 | // commands (skip first index for ui localization)
|
139 | 149 | for (i = 1; i < json.length; i++) {
|
140 | 150 | // if command is advanced check ShowAdvanced
|
141 |
| - if (json[i].advanced == true && $('#ShowAdvanced').prop('checked') || json[i].advanced == false) { |
| 151 | + if (json[i].advanced == true && isAdvanced || json[i].advanced == false) { |
142 | 152 | var $item = $(
|
143 | 153 | "<div class='grid-item " + json[i].category + "' keywords='" + json[i].keywords + "'>" +
|
144 | 154 | "<p class='title'>" + json[i].title + "</p>" +
|
|
149 | 159 | // command options
|
150 | 160 | for (j = 0; j < json[i].options.length; j++) {
|
151 | 161 | // if command option is advanced check ShowAdvanced
|
152 |
| - if (json[i].options[j].advanced == true && $('#ShowAdvanced').prop('checked') || json[i].options[j].advanced == false) { |
| 162 | + if (json[i].options[j].advanced == true && isAdvanced || json[i].options[j].advanced == false) { |
153 | 163 | $item.append("<p class='code'>" + json[i].options[j].code + "</p>");
|
154 | 164 | $item.append("<p class='desc'>" + json[i].options[j].desc[!json[i].options[j].desc[lang].length ? "en" : lang] + "</p>");
|
155 | 165 | }
|
|
190 | 200 | });
|
191 | 201 |
|
192 | 202 | $('#ShowAdvanced').change(function () {
|
| 203 | + isAdvanced = $('#ShowAdvanced').prop('checked'); |
| 204 | + Cookies.set('showAdvanced', isAdvanced); |
193 | 205 | refreshList();
|
194 | 206 | });
|
195 | 207 |
|
| 208 | + |
196 | 209 | </script>
|
197 | 210 |
|
198 | 211 | </body>
|
|
0 commit comments