├── .gitattributes ├── .gitignore ├── LICENSE.txt ├── README.md ├── css ├── codemirror.css ├── content.css ├── tit-fontello.css └── w3.css ├── font ├── LICENSE.txt ├── tit-fontello.eot ├── tit-fontello.svg ├── tit-fontello.ttf ├── tit-fontello.woff └── tit-fontello.woff2 ├── images └── driveicon_32.png ├── js ├── FileSaver.js └── codemirror │ ├── addon │ ├── edit │ │ ├── closebrackets.js │ │ └── closetag.js │ └── fold │ │ └── xml-fold.js │ ├── codemirror.js │ └── mode │ ├── css │ └── css.js │ ├── htmlmixed │ └── htmlmixed.js │ ├── javascript │ └── javascript.js │ └── xml │ └── xml.js ├── test ├── Test-navbar-dropdown.html └── test.html └── tryit.3.7.html /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | CMakeCache.txt 2 | CMakeFiles 3 | CMakeScripts 4 | Testing 5 | Makefile 6 | cmake_install.cmake 7 | install_manifest.txt 8 | compile_commands.json 9 | CTestTestfile.cmake 10 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Marco Antoniazzi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Try It Editor Offline 2 | 3 | This is a wysiwyg "live" offline html editor. It is derived from [Try It Editor v3.3](http://www.learningslack.com/html/tryitfb35.html?filename=tryhtml_default) and [Try It Editor v3.5](https://www.w3schools.com/html/tryit.asp?filename=tryhtml_default). 4 | 5 | It uses: 6 | - Fontello fonts 7 | - w3.css 8 | - codemirror.css 9 | - `Codemirror.js` 10 | - `FileSaver.js` 11 | 12 | Main differences from original **Try It Editor v3.5** : 13 | - It updates preview at every key stroke 14 | - When divider is moved it preserves its position 15 | - It is possible to download previewed html 16 | - It can show the HTML source in a different tab/window 17 | 18 | Due to origin restrisctions of the browsers, you can not save the document wherever you want and load one from wherever you want. What you should do is: download the document to the directory of this editor; load the document from the same directory of this editor, otherwise you will not be able to modify the loaded file. 19 | When you save to localStorage the filename in the input field is used as the local name, so it is possible to save many pages but the available space in localStorage is limited so better not abuse of it. -------------------------------------------------------------------------------- /css/codemirror.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2016 by Marijn Haverbeke and others 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | 24 | /* BASICS */ 25 | 26 | .CodeMirror { 27 | /* Set height, width, borders, and global font properties here */ 28 | font-family: consolas,monospace; 29 | font-size:15px; 30 | height: 300px; 31 | color: black; 32 | } 33 | 34 | /* PADDING */ 35 | 36 | .CodeMirror-lines { 37 | padding: 4px 0; /* Vertical padding around content */ 38 | } 39 | .CodeMirror pre { 40 | padding: 0 4px; /* Horizontal padding of content */ 41 | } 42 | 43 | .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { 44 | background-color: white; /* The little square between H and V scrollbars */ 45 | } 46 | 47 | /* GUTTER */ 48 | 49 | .CodeMirror-gutters { 50 | border-right: 1px solid #ddd; 51 | background-color: #f7f7f7; 52 | white-space: nowrap; 53 | } 54 | .CodeMirror-linenumbers {} 55 | .CodeMirror-linenumber { 56 | padding: 0 3px 0 5px; 57 | min-width: 20px; 58 | text-align: right; 59 | color: #999; 60 | white-space: nowrap; 61 | } 62 | 63 | .CodeMirror-guttermarker { color: black; } 64 | .CodeMirror-guttermarker-subtle { color: #999; } 65 | 66 | /* CURSOR */ 67 | 68 | .CodeMirror-cursor { 69 | border-left: 1px solid black; 70 | border-right: none; 71 | width: 0; 72 | } 73 | /* Shown when moving in bi-directional text */ 74 | .CodeMirror div.CodeMirror-secondarycursor { 75 | border-left: 1px solid silver; 76 | } 77 | .cm-fat-cursor .CodeMirror-cursor { 78 | width: auto; 79 | border: 0 !important; 80 | background: #7e7; 81 | } 82 | .cm-fat-cursor div.CodeMirror-cursors { 83 | z-index: 1; 84 | } 85 | 86 | .cm-animate-fat-cursor { 87 | width: auto; 88 | border: 0; 89 | -webkit-animation: blink 1.06s steps(1) infinite; 90 | -moz-animation: blink 1.06s steps(1) infinite; 91 | animation: blink 1.06s steps(1) infinite; 92 | background-color: #7e7; 93 | } 94 | @-moz-keyframes blink { 95 | 0% {} 96 | 50% { background-color: transparent; } 97 | 100% {} 98 | } 99 | @-webkit-keyframes blink { 100 | 0% {} 101 | 50% { background-color: transparent; } 102 | 100% {} 103 | } 104 | @keyframes blink { 105 | 0% {} 106 | 50% { background-color: transparent; } 107 | 100% {} 108 | } 109 | 110 | /* Can style cursor different in overwrite (non-insert) mode */ 111 | .CodeMirror-overwrite .CodeMirror-cursor {} 112 | 113 | .cm-tab { display: inline-block; text-decoration: inherit; } 114 | 115 | .CodeMirror-rulers { 116 | position: absolute; 117 | left: 0; right: 0; top: -50px; bottom: -20px; 118 | overflow: hidden; 119 | } 120 | .CodeMirror-ruler { 121 | border-left: 1px solid #ccc; 122 | top: 0; bottom: 0; 123 | position: absolute; 124 | } 125 | 126 | /* DEFAULT THEME */ 127 | 128 | .cm-s-default .cm-header {color: blue;} 129 | .cm-s-default .cm-quote {color: #090;} 130 | .cm-negative {color: #d44;} 131 | .cm-positive {color: #292;} 132 | .cm-header, .cm-strong {font-weight: bold;} 133 | .cm-em {font-style: italic;} 134 | .cm-link {text-decoration: underline;} 135 | .cm-strikethrough {text-decoration: line-through;} 136 | 137 | .cm-s-default .cm-keyword {color: mediumblue/*#708*/;} 138 | .cm-s-default .cm-atom {color: mediumblue/*#219*/;} 139 | .cm-s-default .cm-number {color: mediumblue/*#164*/;} 140 | .cm-s-default .cm-m-javascript.cm-number {color: red;} 141 | .cm-s-default .cm-m-sql.cm-number {color: red;} 142 | .cm-s-default .cm-def {color: black/*#00f*/;} 143 | .cm-s-default .cm-variable {color:black;} 144 | .cm-s-default .cm-m-css.cm-variable {color:mediumblue;} 145 | .cm-s-default .cm-punctuation {} 146 | .cm-s-default .cm-property {color:red;} 147 | .cm-s-default .cm-m-javascript.cm-property {color: black;} 148 | .cm-s-default .cm-operator {} 149 | .cm-s-default .cm-variable-2 {color:black/*#05a*/;} 150 | .cm-s-default .cm-variable-3 {color: #085;} 151 | .cm-s-default .cm-comment {color: green/*#a50*/;} 152 | .cm-s-default .cm-string {color: mediumblue/*#a11*/;} 153 | .cm-s-default .cm-m-javascript.cm-string {color: brown;} 154 | .cm-s-default .cm-m-sql.cm-string {color: brown;} 155 | .cm-s-default .cm-string-2 {color: #f50;} 156 | .cm-s-default .cm-meta {color: #555;} 157 | .cm-s-default .cm-qualifier {color: brown/*#555*/;} 158 | .cm-s-default .cm-builtin {color: brown/*#30a*/;} 159 | .cm-s-default .cm-tag {color: brown/*#170*/;} 160 | .cm-s-default .cm-bracket {color: mediumblue/*#997*/;} 161 | .cm-s-default .cm-attribute {color: red/*#00c*/;} 162 | .cm-s-default .cm-hr {color: #999;} 163 | .cm-s-default .cm-link {color: #00c;} 164 | 165 | .cm-s-default .cm-error {color: #f00;} 166 | .cm-invalidchar {color: #f00;} 167 | 168 | .CodeMirror-composing { border-bottom: 2px solid; } 169 | 170 | /* Default styles for common addons */ 171 | 172 | div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;} 173 | div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} 174 | .CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); } 175 | .CodeMirror-activeline-background {background: #e8f2ff;} 176 | 177 | /* STOP */ 178 | 179 | /* The rest of this file contains styles related to the mechanics of 180 | the editor. You probably shouldn't touch them. */ 181 | 182 | .CodeMirror { 183 | position: relative; 184 | overflow: hidden; 185 | background: white; 186 | } 187 | 188 | .CodeMirror-scroll { 189 | overflow: scroll !important; /* Things will break if this is overridden */ 190 | /* 30px is the magic margin used to hide the element's real scrollbars */ 191 | /* See overflow: hidden in .CodeMirror */ 192 | margin-bottom: -30px; margin-right: -30px; 193 | padding-bottom: 30px; 194 | height: 100%; 195 | outline: none; /* Prevent dragging from highlighting the element */ 196 | position: relative; 197 | } 198 | .CodeMirror-sizer { 199 | position: relative; 200 | border-right: 30px solid transparent; 201 | } 202 | 203 | /* The fake, visible scrollbars. Used to force redraw during scrolling 204 | before actual scrolling happens, thus preventing shaking and 205 | flickering artifacts. */ 206 | .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { 207 | position: absolute; 208 | z-index: 3; 209 | display: none; 210 | } 211 | .CodeMirror-vscrollbar { 212 | right: 0; top: 0; 213 | overflow-x: hidden; 214 | overflow-y: scroll; 215 | } 216 | .CodeMirror-hscrollbar { 217 | bottom: 0; left: 0; 218 | overflow-y: hidden; 219 | overflow-x: scroll; 220 | } 221 | .CodeMirror-scrollbar-filler { 222 | right: 0; bottom: 0; 223 | } 224 | .CodeMirror-gutter-filler { 225 | left: 0; bottom: 0; 226 | } 227 | 228 | .CodeMirror-gutters { 229 | position: absolute; left: 0; top: 0; 230 | min-height: 100%; 231 | z-index: 3; 232 | } 233 | .CodeMirror-gutter { 234 | white-space: normal; 235 | height: 100%; 236 | display: inline-block; 237 | vertical-align: top; 238 | margin-bottom: -30px; 239 | } 240 | .CodeMirror-gutter-wrapper { 241 | position: absolute; 242 | z-index: 4; 243 | background: none !important; 244 | border: none !important; 245 | } 246 | .CodeMirror-gutter-background { 247 | position: absolute; 248 | top: 0; bottom: 0; 249 | z-index: 4; 250 | } 251 | .CodeMirror-gutter-elt { 252 | position: absolute; 253 | cursor: default; 254 | z-index: 4; 255 | } 256 | .CodeMirror-gutter-wrapper { 257 | -webkit-user-select: none; 258 | -moz-user-select: none; 259 | user-select: none; 260 | } 261 | 262 | .CodeMirror-lines { 263 | cursor: text; 264 | min-height: 1px; /* prevents collapsing before first draw */ 265 | } 266 | .CodeMirror pre { 267 | /* Reset some styles that the rest of the page might have set */ 268 | -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; 269 | border-width: 0; 270 | background: transparent; 271 | font-family: inherit; 272 | font-size: inherit; 273 | margin: 0; 274 | white-space: pre; 275 | word-wrap: normal; 276 | line-height: inherit; 277 | color: inherit; 278 | z-index: 2; 279 | position: relative; 280 | overflow: visible; 281 | -webkit-tap-highlight-color: transparent; 282 | -webkit-font-variant-ligatures: none; 283 | font-variant-ligatures: none; 284 | } 285 | .CodeMirror-wrap pre { 286 | word-wrap: break-word; 287 | white-space: pre-wrap; 288 | word-break: normal; 289 | } 290 | 291 | .CodeMirror-linebackground { 292 | position: absolute; 293 | left: 0; right: 0; top: 0; bottom: 0; 294 | z-index: 0; 295 | } 296 | 297 | .CodeMirror-linewidget { 298 | position: relative; 299 | z-index: 2; 300 | overflow: auto; 301 | } 302 | 303 | .CodeMirror-widget {} 304 | 305 | .CodeMirror-code { 306 | outline: none; 307 | } 308 | 309 | /* Force content-box sizing for the elements where we expect it */ 310 | .CodeMirror-scroll, 311 | .CodeMirror-sizer, 312 | .CodeMirror-gutter, 313 | .CodeMirror-gutters, 314 | .CodeMirror-linenumber { 315 | -moz-box-sizing: content-box; 316 | box-sizing: content-box; 317 | } 318 | 319 | .CodeMirror-measure { 320 | position: absolute; 321 | width: 100%; 322 | height: 0; 323 | overflow: hidden; 324 | visibility: hidden; 325 | } 326 | 327 | .CodeMirror-cursor { 328 | position: absolute; 329 | pointer-events: none; 330 | } 331 | .CodeMirror-measure pre { position: static; } 332 | 333 | div.CodeMirror-cursors { 334 | visibility: hidden; 335 | position: relative; 336 | z-index: 3; 337 | } 338 | div.CodeMirror-dragcursors { 339 | visibility: visible; 340 | } 341 | 342 | .CodeMirror-focused div.CodeMirror-cursors { 343 | visibility: visible; 344 | } 345 | 346 | .CodeMirror-selected { background: #d9d9d9; } 347 | .CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } 348 | .CodeMirror-crosshair { cursor: crosshair; } 349 | .CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; } 350 | .CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; } 351 | 352 | .cm-searching { 353 | background: #ffa; 354 | background: rgba(255, 255, 0, .4); 355 | } 356 | 357 | /* Used to force a border model for a node */ 358 | .cm-force-border { padding-right: .1px; } 359 | 360 | @media print { 361 | /* Hide the cursor when printing */ 362 | .CodeMirror div.CodeMirror-cursors { 363 | visibility: hidden; 364 | } 365 | } 366 | 367 | /* See issue #2901 */ 368 | .cm-tab-wrap-hack:after { content: ''; } 369 | 370 | /* Help users use markselection to safely style text background */ 371 | span.CodeMirror-selectedtext { background: none; } 372 | -------------------------------------------------------------------------------- /css/content.css: -------------------------------------------------------------------------------- 1 | @import url('//fonts.googleapis.com/css?family=Open+Sans:300,400,600,800'); 2 | @import url("../css/fontello.css"); /* backward compatible */ 3 | @import url("../css/ionicons.min.css"); 4 | 5 | 6 | /********************************** 7 | Adjustment for Default 8 | ***********************************/ 9 | 10 | 11 | .container > .row, .container > div > .row {padding-top:10px;padding-bottom:10px} 12 | .row img { margin:1.4em 0 1em; } 13 | 14 | 15 | 16 | /********************************** 17 | General 18 | ***********************************/ 19 | 20 | html { font-size: 100%; } 21 | body { 22 | margin: 0; 23 | font-family: "Open Sans", sans-serif; 24 | font-size: 100%; 25 | line-height: 2; 26 | font-weight: 300; 27 | } 28 | p, td, li, label { 29 | font-size: 1.07em; 30 | line-height: 2; 31 | font-weight: 300; 32 | } 33 | h1, h2, h3, h4, h5, h6 { 34 | font-family: "Open Sans", sans-serif; 35 | font-weight: 300; 36 | letter-spacing: 0px; 37 | line-height: 1.4; 38 | } 39 | 40 | h1 {font-size: 2.36em;margin:0.4em 0;} 41 | h2 {font-size: 2em;margin:0.6em 0;} 42 | h3 {font-size: 1.73em;margin:0.7em 0;} 43 | h4 {font-size: 1.6em;margin:0.8em 0;} 44 | h5 {font-size: 1.48em;margin:0.8em 0;} 45 | h6 {font-size: 1.3em;margin:0.8em 0;} 46 | p {margin:1em 0;} 47 | 48 | .display { margin-bottom: 0.5em; } 49 | .display h1 { 50 | font-weight: 800; 51 | font-size: 3em; 52 | line-height:1.4; 53 | text-transform: uppercase; 54 | } 55 | .display p { 56 | font-size: 1.3em; 57 | font-style: italic; 58 | } 59 | 60 | @media all and (max-width: 1024px) { 61 | h1 {font-size: 2em;} 62 | h2 {font-size: 1.73em;} 63 | h3 {font-size: 1.6em;} 64 | h4 {font-size: 1.48em;} 65 | h5 {font-size: 1.3em;font-weight:bold;} 66 | h6 {font-size: 1em;font-weight:bold;} 67 | .display h1 { font-size: 2.2em; } 68 | .display p { font-size: 1.1em; } 69 | } 70 | 71 | a {color: #009E91;} 72 | hr {border:none;border-top: rgba(0, 0, 0, 0.18) 1px solid;margin: 2em 0 !important;} 73 | img {max-width:100%;} 74 | figure {margin:0} 75 | ol, ul {line-height: inherit; font-weight: inherit;} 76 | 77 | 78 | /********************************** 79 | Grid 80 | ***********************************/ 81 | .container { 82 | margin: 0 auto; 83 | max-width: 980px; 84 | width: 90%; 85 | } 86 | @media (min-width: 40rem) { 87 | .column { 88 | float: left; 89 | padding-left: 1rem; /* beta3 */ 90 | padding-right: 1rem; /* beta3 */ 91 | -moz-box-sizing: border-box; 92 | -webkit-box-sizing: border-box; 93 | box-sizing: border-box; 94 | } 95 | .column.full { width: 100%; } 96 | .column.two-third { width: 66.7%; } 97 | .column.two-fourth { width: 75%; } 98 | .column.two-fifth { width: 80%; } 99 | .column.two-sixth { width: 83.3%; } 100 | .column.half { width: 50%; } 101 | .column.third { width: 33.3%; } 102 | .column.fourth { width: 25%; } 103 | .column.fifth { width: 20%; } 104 | .column.sixth { width: 16.6%; } 105 | .column.flow-opposite { float: right; } 106 | } 107 | .clearfix:before, .clearfix:after {content: " ";display: table;} 108 | .clearfix:after {clear: both;} 109 | .clearfix {*zoom: 1;} 110 | 111 | 112 | /********************************** 113 | Elements 114 | ***********************************/ 115 | 116 | .center {text-align:center} 117 | .right {text-align:right} 118 | .left {text-align:left} 119 | .padding-20 {padding:20px} 120 | .padding-25 {padding:25px} 121 | .padding-30 {padding:30px} 122 | .padding-35 {padding:35px} 123 | .padding-40 {padding:40px} 124 | @media all and (max-width: 540px) { 125 | .center {text-align:initial} 126 | .right {text-align:initial} 127 | .left {text-align:initial} 128 | .padding-20 {padding:0} 129 | .padding-25 {padding:0} 130 | .padding-30 {padding:0} 131 | .padding-35 {padding:0} 132 | .padding-40 {padding:0} 133 | } 134 | 135 | .margin-0 {margin:0 !important} 136 | .margin-20 {margin:20px !important} 137 | .margin-25 {margin:25px !important} 138 | .margin-30 {margin:30px !important} 139 | .margin-35 {margin:35px !important} 140 | .margin-40 {margin:40px !important} 141 | .is-card { display:table; background-color:#fff; } 142 | .is-card > * { display:table; } 143 | .is-card-circle { width:280px; height: 280px; border-radius:500px; padding:70px; margin:0 auto; } 144 | @media all and (max-width: 540px) { 145 | .is-card-circle { zoom:0.7; -moz-transform: scale(0.7); } 146 | } 147 | .is-card-content-centered { display:table-cell;vertical-align:middle;text-align:center; } 148 | .max-390 { max-width:390px;margin:0 auto; } 149 | .shadow-1 { /* card */ 150 | -webkit-box-shadow: 0 1px 3px rgba(0,0,0, 0.12), 0 1px 2px rgba(0,0,0, 0.24); 151 | -moz-box-shadow: 0 1px 3px rgba(0,0,0, 0.12), 0 1px 2px rgba(0,0,0, 0.24); 152 | box-shadow: 0 1px 3px rgba(0,0,0, 0.12), 0 1px 2px rgba(0,0,0, 0.24); 153 | } 154 | .shadow-2 { /* screenshot */ 155 | -webkit-box-shadow: 0 30px 50px rgba(0, 0, 0, 0.15); 156 | -moz-box-shadow: 0 30px 50px rgba(0, 0, 0, 0.15); 157 | box-shadow: 0 30px 50px rgba(0, 0, 0, 0.15); 158 | } 159 | .shadow-3 { /* highlight */ 160 | -webkit-box-shadow: 0 0px 100px rgba(0, 0, 0, 0.2); 161 | -moz-box-shadow: 0 0px 100px rgba(0, 0, 0, 0.2); 162 | box-shadow: 0 0px 100px rgba(0, 0, 0, 0.2); 163 | } 164 | 165 | img.circle {border-radius:500px;margin-top:0;} 166 | img.bordered {border: #ccc 1px solid;} 167 | 168 | .embed-responsive {position: relative;display:block;height:0;padding:0;overflow:hidden;margin-top: 1.4em;margin-bottom: 1em;} 169 | .embed-responsive.embed-responsive-16by9 {padding-bottom: 56.25%;} 170 | .embed-responsive.embed-responsive-4by3 {padding-bottom: 75%;} 171 | .embed-responsive iframe {position: absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0;} 172 | 173 | .list {position:relative;margin:1.5em 0;} 174 | .list > i {position:absolute;left:-3px;top:7px;font-size:1.7em;line-height:1;} 175 | .list > h2, .list > h3 {margin: 0 0 0 50px;} 176 | .list > p {margin: 5px 0 0 50px} 177 | 178 | .quote {position:relative;margin:1.5em 0;} 179 | .quote > i {position: absolute;top: -10px; left: -7px;font-size: 2em;} 180 | .quote > small {margin-left:50px;opacity: 0.7;font-size: 1em;} 181 | .quote > p {margin-left:50px;font-size: 1.5em;} 182 | @media all and (max-width: 540px) { 183 | .quote > i {left: -15px;font-size:1.5em;} 184 | .quote > small {margin-left:20px;ont-size: 1em;} 185 | .quote > p {margin-left:20px;font-size: 1.2em;} 186 | } 187 | 188 | .is-social {line-height:1;margin-bottom:1.5em} 189 | .is-social a > i {text-decoration:none;color:#333;font-size:1.2em;margin:0 15px 0 0;-webkit-transition: all 0.1s ease-in-out;transition: all 0.1s ease-in-out;} 190 | .is-social a:hover > i {color:#08c9b9;} 191 | .is-light-text .is-social a > i {color:#fff} 192 | .is-light-text .is-social a:hover > i {color:#fff} 193 | .is-dark-text .is-social a > i {color:#000} 194 | .is-dark-text .is-social a:hover > i {color:#000} 195 | 196 | /* backward compatible */ 197 | .social {line-height:1;margin-bottom:1.5em} 198 | .social a > i {text-decoration:none;color:#333;font-size:1.2em;margin:0 15px 0 0;-webkit-transition: all 0.1s ease-in-out;transition: all 0.1s ease-in-out;} 199 | .social a:hover > i {color:#08c9b9;} 200 | .is-light-text .social a > i {color:#fff} 201 | .is-light-text .social a:hover > i {color:#fff} 202 | 203 | .is-rounded-button-big {display:inline-block;} 204 | .is-rounded-button-big a {display:table;float:left;text-align:center;margin:0 20px;border-radius: 500px; width: 110px; height: 110px;background-color: #aaa;} 205 | .is-rounded-button-big a i {display:table-cell;width:100%;height:100%;vertical-align:middle;color:#ffffff;font-size:40px} 206 | .is-rounded-button-big a:first-child {margin:0 20px 0 0;} 207 | .is-rounded-button-big a:last-child {margin:0 0 0 20px;} 208 | 209 | .is-rounded-button-medium {display:inline-block;} 210 | .is-rounded-button-medium a {display:table;float:left;text-align:center;margin:0 20px;border-radius: 500px; width: 70px; height: 70px;background-color: #aaa;} 211 | .is-rounded-button-medium a i {display:table-cell;width:100%;height:100%;vertical-align:middle;color:#ffffff;font-size:30px} 212 | 213 | .is-boxed-button-big {display:inline-block;} 214 | .is-boxed-button-big a {display:table;float:left;text-align:center;margin:0 30px 0 0;width: 110px; height: 110px;background-color: #aaa;} 215 | .is-boxed-button-big a i {display:table-cell;width:100%;height:100%;vertical-align:middle;color:#ffffff;font-size:40px} 216 | 217 | .is-boxed-button-big2 {display:inline-block;} 218 | .is-boxed-button-big2 a {display:table;float:left;text-align:center;margin:0 30px 0 0;width: 150px; height: 70px;background-color: #aaa;} 219 | .is-boxed-button-big2 a i {display:table-cell;width:100%;height:100%;vertical-align:middle;color:#ffffff;font-size:35px} 220 | 221 | .is-boxed-button-medium {display:inline-block;} 222 | .is-boxed-button-medium a {display:table;float:left;text-align:center;margin:0 30px 0 0;width: 70px; height: 70px;background-color: #aaa;} 223 | .is-boxed-button-medium a i {display:table-cell;width:100%;height:100%;vertical-align:middle;color:#ffffff;font-size:30px} 224 | 225 | .is-boxed-button-medium2 {display:inline-block;} 226 | .is-boxed-button-medium2 a {display:table;float:left;text-align:center;margin:0 30px 0 0;width: 100px; height: 50px;background-color: #aaa;} 227 | .is-boxed-button-medium2 a i {display:table-cell;width:100%;height:100%;vertical-align:middle;color:#ffffff;font-size:25px} 228 | 229 | .is-boxed-button-small {display:inline-block;} 230 | .is-boxed-button-small a {display:table;float:left;text-align:center;margin:0 20px 0 0;width: 50px; height: 50px;background-color: #aaa;} 231 | .is-boxed-button-small a i {display:table-cell;width:100%;height:100%;vertical-align:middle;color:#ffffff;font-size:20px} 232 | 233 | .size-12 {font-size:12px} 234 | .size-14 {font-size:14px} 235 | .size-16 {font-size:16px} 236 | .size-18 {font-size:18px} 237 | .size-21 {font-size:21px} 238 | .size-24 {font-size:24px} 239 | .size-32 {font-size:32px} 240 | .size-48 {font-size:48px} 241 | .size-64 {font-size:64px} 242 | .size-80 {font-size:80px} 243 | .size-96 {font-size:96px} 244 | @media all and (max-width: 1024px) { 245 | .size-12 {font-size:12px} 246 | .size-14 {font-size:14px} 247 | .size-16 {font-size:16px} 248 | .size-18 {font-size:18px} 249 | .size-21 {font-size:21px} 250 | .size-24 {font-size:24px} 251 | .size-32 {font-size:28px} 252 | .size-48 {font-size:32px} 253 | .size-64 {font-size:36px} 254 | .size-80 {font-size:40px} 255 | .size-96 {font-size:44px} 256 | } 257 | 258 | 259 | /********************************** 260 | Title Styles 261 | ***********************************/ 262 | 263 | .is-light-text * {color: #fff;} 264 | .is-dark-text * {color: #000;} 265 | 266 | /* Style 1 */ 267 | 268 | .is-title1-96 {margin-top:20px;margin-bottom:20px;} 269 | .is-title1-80 {margin-top:15px;margin-bottom:15px;} 270 | .is-title1-64 {margin-top:15px;margin-bottom:15px;} 271 | .is-title1-48 {margin-top:15px;margin-bottom:15px;} 272 | .is-title1-32 {margin-top:15px;margin-bottom:15px;} 273 | 274 | /* Style 2 */ 275 | 276 | .is-title2-96 {margin-top:25px;margin-bottom:20px;} 277 | .is-title2-80 {margin-top:20px;margin-bottom:15px;} 278 | .is-title2-64 {margin-top:20px;margin-bottom:15px;} 279 | .is-title2-48 {margin-top:15px;margin-bottom:15px;} 280 | .is-title2-32 {margin-top:10px;margin-bottom:15px;} 281 | 282 | /* Style 3 */ 283 | 284 | .is-title3-96 {margin-top:30px;margin-bottom:35px;padding:20px 0;border-top:#000 2px solid;border-bottom:#000 2px solid;} 285 | .is-title3-80 {margin-top:25px;margin-bottom:33px;padding:20px 0;border-top:#000 2px solid;border-bottom:#000 2px solid;} 286 | .is-title3-64 {margin-top:20px;margin-bottom:30px;padding:18px 0;border-top:#000 2px solid;border-bottom:#000 2px solid;} 287 | .is-title3-48 {margin-top:20px;margin-bottom:25px;padding:18px 0;border-top:#000 2px solid;border-bottom:#000 2px solid;} 288 | .is-title3-32 {margin-top:20px;margin-bottom:20px;padding:15px 0;border-top:#000 2px solid;border-bottom:#000 2px solid;} 289 | 290 | .is-light-text .is-title3-96 {border-top:#fff 2px solid;border-bottom:#fff 2px solid;} 291 | .is-light-text .is-title3-80 {border-top:#fff 2px solid;border-bottom:#fff 2px solid;} 292 | .is-light-text .is-title3-64 {border-top:#fff 2px solid;border-bottom:#fff 2px solid;} 293 | .is-light-text .is-title3-48 {border-top:#fff 2px solid;border-bottom:#fff 2px solid;} 294 | .is-light-text .is-title3-32 {border-top:#fff 2px solid;border-bottom:#fff 2px solid;} 295 | 296 | .is-dark-text .is-title3-96 {border-top:#000 2px solid;border-bottom:#000 2px solid;} 297 | .is-dark-text .is-title3-80 {border-top:#000 2px solid;border-bottom:#000 2px solid;} 298 | .is-dark-text .is-title3-64 {border-top:#000 2px solid;border-bottom:#000 2px solid;} 299 | .is-dark-text .is-title3-48 {border-top:#000 2px solid;border-bottom:#000 2px solid;} 300 | .is-dark-text .is-title3-32 {border-top:#000 2px solid;border-bottom:#000 2px solid;} 301 | 302 | /* Style 4 */ 303 | 304 | .is-title4-96 {margin-top:30px;margin-bottom:35px;padding:20px 30px;border:#000 2px solid;} 305 | .is-title4-80 {margin-top:25px;margin-bottom:33px;padding:20px 30px;border:#000 2px solid;} 306 | .is-title4-64 {margin-top:20px;margin-bottom:30px;padding:18px 28px;border:#000 2px solid;} 307 | .is-title4-48 {margin-top:20px;margin-bottom:25px;padding:18px 25px;border:#000 2px solid;} 308 | .is-title4-32 {margin-top:20px;margin-bottom:20px;padding:15px 20px;border:#000 2px solid;} 309 | 310 | .is-light-text .is-title4-96 {border:#fff 2px solid;} 311 | .is-light-text .is-title4-80 {border:#fff 2px solid;} 312 | .is-light-text .is-title4-64 {border:#fff 2px solid;} 313 | .is-light-text .is-title4-48 {border:#fff 2px solid;} 314 | .is-light-text .is-title4-32 {border:#fff 2px solid;} 315 | 316 | .is-dark-text .is-title4-96 {border:#000 2px solid;} 317 | .is-dark-text .is-title4-80 {border:#000 2px solid;} 318 | .is-dark-text .is-title4-64 {border:#000 2px solid;} 319 | .is-dark-text .is-title4-48 {border:#000 2px solid;} 320 | .is-dark-text .is-title4-32 {border:#000 2px solid;} 321 | 322 | /* Style 5 */ 323 | 324 | .is-title5-96 {margin-top:10px;margin-bottom:35px;padding-bottom:25px;border-bottom:#000 2px solid;} 325 | .is-title5-80 {margin-top:10px;margin-bottom:33px;padding-bottom:25px;border-bottom:#000 2px solid;} 326 | .is-title5-64 {margin-top:10px;margin-bottom:30px;padding-bottom:20px;border-bottom:#000 2px solid;} 327 | .is-title5-48 {margin-top:10px;margin-bottom:25px;padding-bottom:20px;border-bottom:#000 2px solid;} 328 | .is-title5-32 {margin-top:10px;margin-bottom:20px;padding-bottom:20px;border-bottom:#000 2px solid;} 329 | 330 | .is-light-text .is-title5-96 {border-bottom:#fff 2px solid;} 331 | .is-light-text .is-title5-80 {border-bottom:#fff 2px solid;} 332 | .is-light-text .is-title5-64 {border-bottom:#fff 2px solid;} 333 | .is-light-text .is-title5-48 {border-bottom:#fff 2px solid;} 334 | .is-light-text .is-title5-32 {border-bottom:#fff 2px solid;} 335 | 336 | .is-dark-text .is-title5-96 {border-bottom:#000 2px solid;} 337 | .is-dark-text .is-title5-80 {border-bottom:#000 2px solid;} 338 | .is-dark-text .is-title5-64 {border-bottom:#000 2px solid;} 339 | .is-dark-text .is-title5-48 {border-bottom:#000 2px solid;} 340 | .is-dark-text .is-title5-32 {border-bottom:#000 2px solid;} 341 | 342 | /* Extra Title Styles */ 343 | 344 | .is-title-lite {letter-spacing:3px;word-spacing:5px;} 345 | .is-title-lite.is-title3-96, .is-title-lite.is-title4-96, .is-title-lite.is-title5-96 {letter-spacing:4px;word-spacing:8px;} 346 | .is-title-lite.is-title3-80, .is-title-lite.is-title4-80, .is-title-lite.is-title5-80 {letter-spacing:4px;word-spacing:8px;} 347 | .is-title-lite.is-title3-64, .is-title-lite.is-title4-64, .is-title-lite.is-title5-64 {letter-spacing:4px;word-spacing:8px;} 348 | .is-title-lite.is-title3-48, .is-title-lite.is-title4-48, .is-title-lite.is-title5-48 {letter-spacing:4px;word-spacing:8px;} 349 | .is-title-lite.is-title3-32, .is-title-lite.is-title4-32, .is-title-lite.is-title5-32 {letter-spacing:3px;word-spacing:5px;} 350 | 351 | .is-title-bold {font-weight:800;} 352 | .is-title-bold.is-title3-96, .is-title-bold.is-title4-96, .is-title-bold.is-title5-96 {border-width:4px;} 353 | .is-title-bold.is-title3-80, .is-title-bold.is-title4-80, .is-title-bold.is-title5-80 {border-width:4px;} 354 | .is-title-bold.is-title3-64, .is-title-bold.is-title4-64, .is-title-bold.is-title5-64 {border-width:3px;} 355 | .is-title-bold.is-title3-48, .is-title-bold.is-title4-48, .is-title-bold.is-title5-48 {border-width:3px;} 356 | .is-title-bold.is-title3-32, .is-title-bold.is-title4-32, .is-title-bold.is-title5-32 {border-width:2px;} 357 | 358 | 359 | /********************************** 360 | Into Styles 361 | ***********************************/ 362 | 363 | .is-info1 {margin-top:10px;margin-bottom:0px;font-style:italic;} 364 | .is-info1.size-21 {margin-top:12px;} 365 | .is-info1.size-24 {margin-top:15px;} 366 | 367 | .is-info2 {margin-top:10px;margin-bottom:0px;} 368 | .is-info2.size-21 {margin-top:12px;} 369 | .is-info2.size-24 {margin-top:15px;} 370 | 371 | 372 | /********************************** 373 | Buttons Styles 374 | ***********************************/ 375 | 376 | .is-btn { 377 | padding: 10px 50px; 378 | font-size: 1em; 379 | line-height: 2em; 380 | border-radius: 0; 381 | letter-spacing: 3px; 382 | 383 | display: inline-block; 384 | margin-bottom: 0; 385 | font-weight: normal; 386 | text-align: center; 387 | text-decoration: none; 388 | vertical-align: middle; 389 | cursor: pointer; 390 | background-image: none; 391 | border: 1px solid transparent; 392 | white-space: nowrap; 393 | -webkit-transition: all 0.16s ease; 394 | transition: all 0.16s ease; 395 | } 396 | 397 | /* ghost1 default */ 398 | .is-btn-ghost1 { color: #000; border: 2px solid #111; } 399 | .is-btn-ghost1:hover, .is-btn-ghost1:active, .is-btn-ghost1:focus { 400 | color: #fff; 401 | background-color: #111; 402 | border: 2px solid #111; 403 | } 404 | 405 | /* ghost1 light-text */ 406 | .is-light-text .is-btn-ghost1, 407 | .is-dark-text .is-light-text .is-btn-ghost1 { color: #fff; border: 2px solid #fff;} 408 | .is-light-text .is-btn-ghost1:hover, .is-light-text .is-btn-ghost1:active, .is-light-text .is-btn-ghost1:focus, 409 | .is-dark-text .is-light-text .is-btn-ghost1:hover, .is-dark-text .is-light-text .is-btn-ghost1:active, .is-dark-text .is-light-text .is-btn-ghost1:focus { 410 | color: #000; 411 | background-color: #fff; 412 | border: 2px solid #fff; 413 | } 414 | 415 | /* ghost1 dark-text */ 416 | .is-dark-text .is-btn-ghost1, 417 | .is-light-text .is-dark-text .is-btn-ghost1 { color: #000; border: 2px solid #111; } 418 | .is-dark-text .is-btn-ghost1:hover, .is-dark-text .is-btn-ghost1:active, .is-dark-text .is-btn-ghost1:focus, 419 | .is-light-text .is-dark-text .is-btn-ghost1:hover, .is-light-text .is-dark-text .is-btn-ghost1:active, .is-light-text .is-dark-text .is-btn-ghost1:focus { 420 | color: #fff; 421 | background-color: #111; 422 | border: 2px solid #111; 423 | } 424 | 425 | /* ghost2 default */ 426 | .is-btn-ghost2 { color: #000; border: 2px solid #d7d7d7; background-color: #d7d7d7; } 427 | .is-btn-ghost2:hover, .is-btn-ghost2:active, .is-btn-ghost2:focus { 428 | color: #000; 429 | background-color: #cdcdcd; 430 | border: 2px solid #cdcdcd; 431 | } 432 | 433 | /* ghost2 light-text */ 434 | .is-light-text .is-btn-ghost2, 435 | .is-dark-text .is-light-text .is-btn-ghost2 { color: #000; border: 2px solid #f9f9f9; background-color: #f9f9f9; } 436 | .is-light-text .is-btn-ghost2:hover, .is-light-text .is-btn-ghost2:active, .is-light-text .is-btn-ghost2:focus, 437 | .is-dark-text .is-light-text .is-btn-ghost2:hover, .is-dark-text .is-light-text .is-btn-ghost2:active, .is-dark-text .is-light-text .is-btn-ghost2:focus { 438 | color: #000; 439 | background-color: #fff; 440 | border: 2px solid #fff; 441 | } 442 | 443 | /* ghost2 dark-text */ 444 | .is-dark-text .is-btn-ghost2, 445 | .is-light-text .is-dark-text .is-btn-ghost2 { color: #000; border: 2px solid #d7d7d7; background-color: #d7d7d7; } 446 | .is-dark-text .is-btn-ghost2:hover, .is-dark-text .is-btn-ghost2:active, .is-dark-text .is-btn-ghost2:focus, 447 | .is-light-text .is-dark-text .is-btn-ghost2:hover, .is-light-text .is-dark-text .is-btn-ghost2:active, .is-light-text .is-dark-text .is-btn-ghost2:focus { 448 | color: #000; 449 | background-color: #cdcdcd; 450 | border: 2px solid #cdcdcd; 451 | } 452 | 453 | .is-btn-small { padding: 5px 25px; font-size: 0.85em; } 454 | .is-upper { text-transform:uppercase; } 455 | .is-rounded-30 { border-radius: 30px; } 456 | 457 | 458 | 459 | /* Old Buttons */ 460 | 461 | .btn { 462 | padding: 7px 25px; 463 | font-size: 1em; 464 | line-height: 2em; 465 | border-radius: 5px; 466 | letter-spacing: 1px; 467 | 468 | display: inline-block; 469 | margin-bottom: 0; 470 | font-weight: normal; 471 | text-align: center; 472 | text-decoration: none; 473 | vertical-align: middle; 474 | cursor: pointer; 475 | background-image: none; 476 | border: 1px solid transparent; 477 | white-space: nowrap; 478 | -webkit-transition: all 0.16s ease; 479 | transition: all 0.16s ease; 480 | } 481 | 482 | .btn.btn-primary {color: #ffffff;background-color: #08c9b9;} 483 | .btn.btn-primary:hover {color: #ffffff;background-color: #07b0a2;border-color: #07b0a2;} 484 | .btn.btn-default {color: #333333;background-color: #d3d3d3;} 485 | .btn.btn-default:hover {color: #111;background-color: #ccc;border-color: #ccc;} 486 | 487 | 488 | /********************************** 489 | Header Image with Caption 490 | ***********************************/ 491 | figure.hdr { 492 | position: relative; 493 | width: 100%; 494 | overflow:hidden; 495 | background-color: #000; 496 | } 497 | figure.hdr img { 498 | position: relative; 499 | display: block; 500 | width: 100%; 501 | opacity: 0.8; 502 | -webkit-transition: opacity 0.35s, -webkit-transform 0.35s; 503 | transition: opacity 0.35s, transform 0.35s; 504 | -webkit-transform: scale(1.2); 505 | transform: scale(1.2); 506 | } 507 | figure.hdr:hover img { 508 | opacity: 0.5; 509 | -webkit-transform: scale(1); 510 | transform: scale(1); 511 | } 512 | figure.hdr figcaption { 513 | position: absolute; 514 | top: auto; 515 | bottom: 0; 516 | left: 0; 517 | width: 100%; 518 | height: 60%; 519 | padding: 0 2.5em; 520 | color: #fff; 521 | font-size: 1.55em; 522 | text-align: center; 523 | box-sizing: border-box; 524 | z-index:1; 525 | } 526 | /* Text */ 527 | figure.hdr h2 { 528 | font-weight: 300; 529 | text-transform: uppercase; 530 | } 531 | figure.hdr h2 span { 532 | font-weight: 800; 533 | } 534 | figure.hdr p { 535 | letter-spacing: 1px; 536 | font-size: 68.5%; 537 | text-transform: uppercase; 538 | } 539 | figure.hdr h2, figure.hdr p { 540 | margin: 0; 541 | z-index:10000; 542 | } 543 | /* Cosmetic */ 544 | figure.hdr div { 545 | height: 100%; 546 | z-index:0; 547 | } 548 | figure.hdr div::before, 549 | figure.hdr div::after { 550 | position: absolute; 551 | content: ''; 552 | } 553 | /* One */ 554 | figure.one div::before { 555 | top: 50px; 556 | right: 30px; 557 | bottom: 50px; 558 | left: 30px; 559 | border-top: 1px solid #fff; 560 | border-bottom: 1px solid #fff; 561 | } 562 | figure.one div::after { 563 | top: 30px; 564 | right: 50px; 565 | bottom: 30px; 566 | left: 50px; 567 | border-right: 1px solid #fff; 568 | border-left: 1px solid #fff; 569 | } 570 | /* Two */ 571 | figure.two div::before { 572 | top: 30px; 573 | right: 30px; 574 | bottom: 30px; 575 | left: 30px; 576 | border-top: 1px solid #fff; 577 | border-bottom: 1px solid #fff; 578 | } 579 | figure.two div::after { 580 | top: 30px; 581 | right: 30px; 582 | bottom: 30px; 583 | left: 30px; 584 | border-right: 1px solid #fff; 585 | border-left: 1px solid #fff; 586 | } 587 | /* Three */ 588 | figure.three figcaption { 589 | height: 70%; 590 | } 591 | figure.three p { 592 | margin: 1em 0 0; 593 | padding: 2em; 594 | border: 1px solid #fff; 595 | } 596 | /* Four */ 597 | figure.four figcaption { 598 | height: 60%; 599 | text-align: left; 600 | } 601 | figure.four p { 602 | position: absolute; 603 | right: 50px; 604 | bottom: 50px; 605 | left: 50px; 606 | padding: 2em; 607 | border: 7px solid #fff; 608 | } 609 | /* Five */ 610 | figure.five figcaption { 611 | height: 100%; 612 | text-align: right; 613 | } 614 | figure.five h2 { 615 | position: absolute; 616 | left: 50px; 617 | right: 50px; 618 | top: 10%; 619 | border-bottom: 5px solid #fff; 620 | } 621 | figure.five p { 622 | position: absolute; 623 | right: 50px; 624 | bottom: 10%; 625 | } 626 | /* Six */ 627 | figure.six figcaption { 628 | height: 70%; 629 | } 630 | figure.six h2 { 631 | padding-bottom: 3%; 632 | border-bottom: 1px solid #fff; 633 | } 634 | figure.six p { 635 | padding-top: 6%; 636 | } 637 | /* Seven */ 638 | figure.seven figcaption { 639 | height: 90%; 640 | text-align:left; 641 | } 642 | figure.seven h2 { 643 | border-bottom: 3px solid #fff; 644 | } 645 | figure.seven p { 646 | padding-top: 1em; 647 | } 648 | /* Eight */ 649 | figure.eight figcaption { 650 | height: 100%; 651 | text-align: right; 652 | } 653 | figure.eight h2 { 654 | position: absolute; 655 | left: 50%; 656 | right: 50px; 657 | bottom: 10%; 658 | } 659 | figure.eight p { 660 | position: absolute; 661 | left: 50px; 662 | right: 50%; 663 | top: 10%; 664 | padding-right:0.5em; 665 | border-right: 1px solid #fff; 666 | } -------------------------------------------------------------------------------- /css/tit-fontello.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'tit-fontello'; 3 | src: url('../font/tit-fontello.eot?26419932'); 4 | src: url('../font/tit-fontello.eot?26419932#iefix') format('embedded-opentype'), 5 | url('../font/tit-fontello.woff2?26419932') format('woff2'), 6 | url('../font/tit-fontello.woff?26419932') format('woff'), 7 | url('../font/tit-fontello.ttf?26419932') format('truetype'), 8 | url('../font/tit-fontello.svg?26419932#tit-fontello') format('svg'); 9 | font-weight: normal; 10 | font-style: normal; 11 | } 12 | /* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */ 13 | /* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */ 14 | /* 15 | @media screen and (-webkit-min-device-pixel-ratio:0) { 16 | @font-face { 17 | font-family: 'tit-fontello'; 18 | src: url('../font/tit-fontello.svg?26419932#tit-fontello') format('svg'); 19 | } 20 | } 21 | */ 22 | 23 | [class^="tit-icon-"]:before, [class*=" tit-icon-"]:before { 24 | font-family: "tit-fontello"; 25 | font-style: normal; 26 | font-weight: normal; 27 | speak: none; 28 | 29 | display: inline-block; 30 | text-decoration: inherit; 31 | width: 1em; 32 | margin-right: .2em; 33 | text-align: center; 34 | /* opacity: .8; */ 35 | 36 | /* For safety - reset parent styles, that can break glyph codes*/ 37 | font-variant: normal; 38 | text-transform: none; 39 | 40 | /* fix buttons height, for twitter bootstrap */ 41 | line-height: 1em; 42 | 43 | /* Animation center compensation - margins should be symmetric */ 44 | /* remove if not needed */ 45 | margin-left: .2em; 46 | 47 | /* you can be more comfortable with increased icons size */ 48 | /* font-size: 120%; */ 49 | 50 | /* Font smoothing. That was taken from TWBS */ 51 | -webkit-font-smoothing: antialiased; 52 | -moz-osx-font-smoothing: grayscale; 53 | 54 | /* Uncomment for 3D effect */ 55 | /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */ 56 | } 57 | 58 | .tit-icon-floppy:before { content: '\e800'; } /* '' */ 59 | .tit-icon-upload:before { content: '\e801'; } /* '' */ 60 | .tit-icon-download-alt:before { content: '\e802'; } /* '' */ 61 | .tit-icon-download-2:before { content: '\e803'; } /* '' */ 62 | .tit-icon-arrows-cw:before { content: '\e804'; } /* '' */ 63 | .tit-icon-arrows-cw-1:before { content: '\e805'; } /* '' */ 64 | .tit-icon-eye:before { content: '\e806'; } /* '' */ 65 | .tit-icon-eye-1:before { content: '\e807'; } /* '' */ 66 | .tit-icon-eye-off:before { content: '\e808'; } /* '' */ 67 | .tit-icon-lock:before { content: '\e809'; } /* '' */ 68 | .tit-icon-lock-open:before { content: '\e80a'; } /* '' */ 69 | .tit-icon-block:before { content: '\e80b'; } /* '' */ 70 | .tit-icon-monitor:before { content: '\e80c'; } /* '' */ 71 | .tit-icon-mobile-1:before { content: '\e80d'; } /* '' */ 72 | .tit-icon-reply:before { content: '\e80e'; } /* '' */ 73 | .tit-icon-forward:before { content: '\e80f'; } /* '' */ 74 | .tit-icon-desktop-1:before { content: '\e810'; } /* '' */ 75 | .tit-icon-mobile-2:before { content: '\e811'; } /* '' */ 76 | .tit-icon-help:before { content: '\e812'; } /* '' */ 77 | .tit-icon-code:before { content: '\e913'; } /* '' */ 78 | .tit-icon-trash:before { content: '\e921'; } /* '' */ 79 | .tit-icon-download:before { content: '\e923'; } /* '' */ 80 | .tit-icon-cog:before { content: '\e925'; } /* '' */ 81 | .tit-icon-file-code:before { content: '\e933'; } /* '' */ 82 | .tit-icon-download-1:before { content: '\f02e'; } /* '' */ 83 | .tit-icon-upload-1:before { content: '\f02f'; } /* '' */ 84 | .tit-icon-menu:before { content: '\f0c9'; } /* '' */ 85 | .tit-icon-desktop:before { content: '\f108'; } /* '' */ 86 | .tit-icon-mobile:before { content: '\f10b'; } /* '' */ 87 | .tit-icon-info:before { content: '\f129'; } /* '' */ 88 | .tit-icon-lock-open-alt:before { content: '\f13e'; } /* '' */ 89 | .tit-icon-sliders:before { content: '\f1de'; } /* '' */ -------------------------------------------------------------------------------- /css/w3.css: -------------------------------------------------------------------------------- 1 | /* W3.CSS 4.04 Apr 2017 by Jan Egil and Borge Refsnes */ 2 | html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit} 3 | /* Extract from normalize.css by Nicolas Gallagher and Jonathan Neal git.io/normalize */ 4 | html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0} 5 | article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block} 6 | audio,canvas,progress,video{display:inline-block}progress{vertical-align:baseline} 7 | audio:not([controls]){display:none;height:0}[hidden],template{display:none} 8 | a{background-color:transparent;-webkit-text-decoration-skip:objects} 9 | a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted} 10 | dfn{font-style:italic}mark{background:#ff0;color:#000} 11 | small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline} 12 | sub{bottom:-0.25em}sup{top:-0.5em}figure{margin:1em 40px}img{border-style:none}svg:not(:root){overflow:hidden} 13 | code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}hr{box-sizing:content-box;height:0;overflow:visible} 14 | button,input,select,textarea{font:inherit;margin:0}optgroup{font-weight:bold} 15 | button,input{overflow:visible}button,select{text-transform:none} 16 | button,html [type=button],[type=reset],[type=submit]{-webkit-appearance:button} 17 | button::-moz-focus-inner, [type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner{border-style:none;padding:0} 18 | button:-moz-focusring, [type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring{outline:1px dotted ButtonText} 19 | fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:.35em .625em .75em} 20 | legend{color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto} 21 | [type=checkbox],[type=radio]{padding:0} 22 | [type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto} 23 | [type=search]{-webkit-appearance:textfield;outline-offset:-2px} 24 | [type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none} 25 | ::-webkit-input-placeholder{color:inherit;opacity:0.54} 26 | ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit} 27 | /* End extract */ 28 | html,body{font-family:Verdana,sans-serif;font-size:15px;line-height:1.5}html{overflow-x:hidden} 29 | h1{font-size:36px}h2{font-size:30px}h3{font-size:24px}h4{font-size:20px}h5{font-size:18px}h6{font-size:16px}.w3-serif{font-family:serif} 30 | h1,h2,h3,h4,h5,h6{font-family:"Segoe UI",Arial,sans-serif;font-weight:400;margin:10px 0}.w3-wide{letter-spacing:4px} 31 | hr{border:0;border-top:1px solid #eee;margin:20px 0} 32 | .w3-image{max-width:100%;height:auto}img{margin-bottom:-5px}a{color:inherit} 33 | .w3-table,.w3-table-all{border-collapse:collapse;border-spacing:0;width:100%;display:table}.w3-table-all{border:1px solid #ccc} 34 | .w3-bordered tr,.w3-table-all tr{border-bottom:1px solid #ddd}.w3-striped tbody tr:nth-child(even){background-color:#f1f1f1} 35 | .w3-table-all tr:nth-child(odd){background-color:#fff}.w3-table-all tr:nth-child(even){background-color:#f1f1f1} 36 | .w3-hoverable tbody tr:hover,.w3-ul.w3-hoverable li:hover{background-color:#ccc}.w3-centered tr th,.w3-centered tr td{text-align:center} 37 | .w3-table td,.w3-table th,.w3-table-all td,.w3-table-all th{padding:8px 8px;display:table-cell;text-align:left;vertical-align:top} 38 | .w3-table th:first-child,.w3-table td:first-child,.w3-table-all th:first-child,.w3-table-all td:first-child{padding-left:16px} 39 | .w3-btn,.w3-button{border:none;display:inline-block;outline:0;padding:8px 16px;vertical-align:middle;overflow:hidden;text-decoration:none;color:inherit;background-color:inherit;text-align:center;cursor:pointer;white-space:nowrap} 40 | .w3-btn:hover{box-shadow:0 8px 16px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19)} 41 | .w3-btn,.w3-button{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none} 42 | .w3-disabled,.w3-btn:disabled,.w3-button:disabled{cursor:not-allowed;opacity:0.3}.w3-disabled *,:disabled *{pointer-events:none} 43 | .w3-btn.w3-disabled:hover,.w3-btn:disabled:hover{box-shadow:none} 44 | .w3-badge,.w3-tag{background-color:#000;color:#fff;display:inline-block;padding-left:8px;padding-right:8px;text-align:center}.w3-badge{border-radius:50%} 45 | .w3-ul{list-style-type:none;padding:0;margin:0}.w3-ul li{padding:8px 16px;border-bottom:1px solid #ddd}.w3-ul li:last-child{border-bottom:none} 46 | .w3-tooltip,.w3-display-container{position:relative}.w3-tooltip .w3-text{display:none}.w3-tooltip:hover .w3-text{display:inline-block} 47 | .w3-ripple:active{opacity:0.5}.w3-ripple{transition:opacity 0s} 48 | .w3-input{padding:8px;display:block;border:none;border-bottom:1px solid #ccc;width:100%} 49 | .w3-select{padding:9px 0;width:100%;border:none;border-bottom:1px solid #ccc} 50 | .w3-dropdown-click,.w3-dropdown-hover{position:relative;display:inline-block;cursor:pointer} 51 | .w3-dropdown-hover:hover .w3-dropdown-content{display:block;z-index:1} 52 | .w3-dropdown-hover:first-child,.w3-dropdown-click:hover{background-color:#ccc;color:#000} 53 | .w3-dropdown-hover:hover > .w3-button:first-child,.w3-dropdown-click:hover > .w3-button:first-child{background-color:#ccc;color:#000} 54 | .w3-dropdown-content{cursor:auto;color:#000;background-color:#fff;display:none;position:absolute;min-width:160px;margin:0;padding:0} 55 | .w3-check,.w3-radio{width:24px;height:24px;position:relative;top:6px} 56 | .w3-sidebar{height:100%;width:200px;background-color:#fff;position:fixed!important;z-index:1;overflow:auto} 57 | .w3-bar-block .w3-dropdown-hover,.w3-bar-block .w3-dropdown-click{width:100%} 58 | .w3-bar-block .w3-dropdown-hover .w3-dropdown-content,.w3-bar-block .w3-dropdown-click .w3-dropdown-content{min-width:100%} 59 | .w3-bar-block .w3-dropdown-hover .w3-button,.w3-bar-block .w3-dropdown-click .w3-button{width:100%;text-align:left;padding:8px 16px} 60 | .w3-main,#main{transition:margin-left .4s} 61 | .w3-modal{z-index:3;display:none;padding-top:100px;position:fixed;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgb(0,0,0);background-color:rgba(0,0,0,0.4)} 62 | .w3-modal-content{margin:auto;background-color:#fff;position:relative;padding:0;outline:0;width:600px} 63 | .w3-bar{width:100%;overflow:hidden}.w3-center .w3-bar{display:inline-block;width:auto} 64 | .w3-bar .w3-bar-item{padding:8px 16px;float:left;width:auto;border:none;outline:none;display:block} 65 | .w3-bar .w3-dropdown-hover,.w3-bar .w3-dropdown-click{position:static;float:left} 66 | .w3-bar .w3-button{white-space:normal} 67 | .w3-bar-block .w3-bar-item{width:100%;display:block;padding:8px 16px;text-align:left;border:none;outline:none;white-space:normal;float:none} 68 | .w3-bar-block.w3-center .w3-bar-item{text-align:center}.w3-block{display:block;width:100%} 69 | .w3-responsive{overflow-x:auto} 70 | .w3-container:after,.w3-container:before,.w3-panel:after,.w3-panel:before,.w3-row:after,.w3-row:before,.w3-row-padding:after,.w3-row-padding:before, 71 | .w3-cell-row:before,.w3-cell-row:after,.w3-clear:after,.w3-clear:before,.w3-bar:before,.w3-bar:after{content:"";display:table;clear:both} 72 | .w3-col,.w3-half,.w3-third,.w3-twothird,.w3-threequarter,.w3-quarter{float:left;width:100%} 73 | .w3-col.s1{width:8.33333%}.w3-col.s2{width:16.66666%}.w3-col.s3{width:24.99999%}.w3-col.s4{width:33.33333%} 74 | .w3-col.s5{width:41.66666%}.w3-col.s6{width:49.99999%}.w3-col.s7{width:58.33333%}.w3-col.s8{width:66.66666%} 75 | .w3-col.s9{width:74.99999%}.w3-col.s10{width:83.33333%}.w3-col.s11{width:91.66666%}.w3-col.s12{width:99.99999%} 76 | @media (min-width:601px){.w3-col.m1{width:8.33333%}.w3-col.m2{width:16.66666%}.w3-col.m3,.w3-quarter{width:24.99999%}.w3-col.m4,.w3-third{width:33.33333%} 77 | .w3-col.m5{width:41.66666%}.w3-col.m6,.w3-half{width:49.99999%}.w3-col.m7{width:58.33333%}.w3-col.m8,.w3-twothird{width:66.66666%} 78 | .w3-col.m9,.w3-threequarter{width:74.99999%}.w3-col.m10{width:83.33333%}.w3-col.m11{width:91.66666%}.w3-col.m12{width:99.99999%}} 79 | @media (min-width:993px){.w3-col.l1{width:8.33333%}.w3-col.l2{width:16.66666%}.w3-col.l3{width:24.99999%}.w3-col.l4{width:33.33333%} 80 | .w3-col.l5{width:41.66666%}.w3-col.l6{width:49.99999%}.w3-col.l7{width:58.33333%}.w3-col.l8{width:66.66666%} 81 | .w3-col.l9{width:74.99999%}.w3-col.l10{width:83.33333%}.w3-col.l11{width:91.66666%}.w3-col.l12{width:99.99999%}} 82 | .w3-content{max-width:980px;margin:auto}.w3-rest{overflow:hidden} 83 | .w3-cell-row{display:table;width:100%}.w3-cell{display:table-cell} 84 | .w3-cell-top{vertical-align:top}.w3-cell-middle{vertical-align:middle}.w3-cell-bottom{vertical-align:bottom} 85 | .w3-hide{display:none!important}.w3-show-block,.w3-show{display:block!important}.w3-show-inline-block{display:inline-block!important} 86 | @media (max-width:600px){.w3-modal-content{margin:0 10px;width:auto!important}.w3-modal{padding-top:30px} 87 | .w3-dropdown-hover.w3-mobile .w3-dropdown-content,.w3-dropdown-click.w3-mobile .w3-dropdown-content{position:relative} 88 | .w3-hide-small{display:none!important}.w3-mobile{display:block;width:100%!important}.w3-bar-item.w3-mobile,.w3-dropdown-hover.w3-mobile,.w3-dropdown-click.w3-mobile{text-align:center} 89 | .w3-dropdown-hover.w3-mobile,.w3-dropdown-hover.w3-mobile .w3-btn,.w3-dropdown-hover.w3-mobile .w3-button,.w3-dropdown-click.w3-mobile,.w3-dropdown-click.w3-mobile .w3-btn,.w3-dropdown-click.w3-mobile .w3-button{width:100%}} 90 | @media (max-width:768px){.w3-modal-content{width:500px}.w3-modal{padding-top:50px}} 91 | @media (min-width:993px){.w3-modal-content{width:900px}.w3-hide-large{display:none!important}.w3-sidebar.w3-collapse{display:block!important}} 92 | @media (max-width:992px) and (min-width:601px){.w3-hide-medium{display:none!important}} 93 | @media (max-width:992px){.w3-sidebar.w3-collapse{display:none}.w3-main{margin-left:0!important;margin-right:0!important}} 94 | .w3-top,.w3-bottom{position:fixed;width:100%;z-index:1}.w3-top{top:0}.w3-bottom{bottom:0} 95 | .w3-overlay{position:fixed;display:none;width:100%;height:100%;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,0.5);z-index:2} 96 | .w3-display-topleft{position:absolute;left:0;top:0}.w3-display-topright{position:absolute;right:0;top:0} 97 | .w3-display-bottomleft{position:absolute;left:0;bottom:0}.w3-display-bottomright{position:absolute;right:0;bottom:0} 98 | .w3-display-middle{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%)} 99 | .w3-display-left{position:absolute;top:50%;left:0%;transform:translate(0%,-50%);-ms-transform:translate(-0%,-50%)} 100 | .w3-display-right{position:absolute;top:50%;right:0%;transform:translate(0%,-50%);-ms-transform:translate(0%,-50%)} 101 | .w3-display-topmiddle{position:absolute;left:50%;top:0;transform:translate(-50%,0%);-ms-transform:translate(-50%,0%)} 102 | .w3-display-bottommiddle{position:absolute;left:50%;bottom:0;transform:translate(-50%,0%);-ms-transform:translate(-50%,0%)} 103 | .w3-display-container:hover .w3-display-hover{display:block}.w3-display-container:hover span.w3-display-hover{display:inline-block}.w3-display-hover{display:none} 104 | .w3-display-position{position:absolute} 105 | .w3-circle{border-radius:50%} 106 | .w3-round-small{border-radius:2px}.w3-round,.w3-round-medium{border-radius:4px}.w3-round-large{border-radius:8px}.w3-round-xlarge{border-radius:16px}.w3-round-xxlarge{border-radius:32px} 107 | .w3-row-padding,.w3-row-padding>.w3-half,.w3-row-padding>.w3-third,.w3-row-padding>.w3-twothird,.w3-row-padding>.w3-threequarter,.w3-row-padding>.w3-quarter,.w3-row-padding>.w3-col{padding:0 8px} 108 | .w3-container,.w3-panel{padding:0.01em 16px}.w3-panel{margin-top:16px;margin-bottom:16px} 109 | .w3-code,.w3-codespan{font-family:Consolas,"courier new";font-size:16px} 110 | .w3-code{width:auto;background-color:#fff;padding:8px 12px;border-left:4px solid #4CAF50;word-wrap:break-word} 111 | .w3-codespan{color:crimson;background-color:#f1f1f1;padding-left:4px;padding-right:4px;font-size:110%} 112 | .w3-card,.w3-card-2{box-shadow:0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12)} 113 | .w3-card-4,.w3-hover-shadow:hover{box-shadow:0 4px 10px 0 rgba(0,0,0,0.2),0 4px 20px 0 rgba(0,0,0,0.19)} 114 | .w3-spin{animation:w3-spin 2s infinite linear}@keyframes w3-spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}} 115 | .w3-animate-fading{animation:fading 10s infinite}@keyframes fading{0%{opacity:0}50%{opacity:1}100%{opacity:0}} 116 | .w3-animate-opacity{animation:opac 0.8s}@keyframes opac{from{opacity:0} to{opacity:1}} 117 | .w3-animate-top{position:relative;animation:animatetop 0.4s}@keyframes animatetop{from{top:-300px;opacity:0} to{top:0;opacity:1}} 118 | .w3-animate-left{position:relative;animation:animateleft 0.4s}@keyframes animateleft{from{left:-300px;opacity:0} to{left:0;opacity:1}} 119 | .w3-animate-right{position:relative;animation:animateright 0.4s}@keyframes animateright{from{right:-300px;opacity:0} to{right:0;opacity:1}} 120 | .w3-animate-bottom{position:relative;animation:animatebottom 0.4s}@keyframes animatebottom{from{bottom:-300px;opacity:0} to{bottom:0;opacity:1}} 121 | .w3-animate-zoom {animation:animatezoom 0.6s}@keyframes animatezoom{from{transform:scale(0)} to{transform:scale(1)}} 122 | .w3-animate-input{transition:width 0.4s ease-in-out}.w3-animate-input:focus{width:100%!important} 123 | .w3-opacity,.w3-hover-opacity:hover{opacity:0.60}.w3-opacity-off,.w3-hover-opacity-off:hover{opacity:1} 124 | .w3-opacity-max{opacity:0.25}.w3-opacity-min{opacity:0.75} 125 | .w3-greyscale-max,.w3-grayscale-max,.w3-hover-greyscale:hover,.w3-hover-grayscale:hover{filter:grayscale(100%)} 126 | .w3-greyscale,.w3-grayscale{filter:grayscale(75%)}.w3-greyscale-min,.w3-grayscale-min{filter:grayscale(50%)} 127 | .w3-sepia{filter:sepia(75%)}.w3-sepia-max,.w3-hover-sepia:hover{filter:sepia(100%)}.w3-sepia-min{filter:sepia(50%)} 128 | .w3-tiny{font-size:10px!important}.w3-small{font-size:12px!important}.w3-medium{font-size:15px!important}.w3-large{font-size:18px!important} 129 | .w3-xlarge{font-size:24px!important}.w3-xxlarge{font-size:36px!important}.w3-xxxlarge{font-size:48px!important}.w3-jumbo{font-size:64px!important} 130 | .w3-left-align{text-align:left!important}.w3-right-align{text-align:right!important}.w3-justify{text-align:justify!important}.w3-center{text-align:center!important} 131 | .w3-border-0{border:0!important}.w3-border{border:1px solid #ccc!important} 132 | .w3-border-top{border-top:1px solid #ccc!important}.w3-border-bottom{border-bottom:1px solid #ccc!important} 133 | .w3-border-left{border-left:1px solid #ccc!important}.w3-border-right{border-right:1px solid #ccc!important} 134 | .w3-topbar{border-top:6px solid #ccc!important}.w3-bottombar{border-bottom:6px solid #ccc!important} 135 | .w3-leftbar{border-left:6px solid #ccc!important}.w3-rightbar{border-right:6px solid #ccc!important} 136 | .w3-section,.w3-code{margin-top:16px!important;margin-bottom:16px!important} 137 | .w3-margin{margin:16px!important}.w3-margin-top{margin-top:16px!important}.w3-margin-bottom{margin-bottom:16px!important} 138 | .w3-margin-left{margin-left:16px!important}.w3-margin-right{margin-right:16px!important} 139 | .w3-padding-small{padding:4px 8px!important}.w3-padding{padding:8px 16px!important}.w3-padding-large{padding:12px 24px!important} 140 | .w3-padding-16{padding-top:16px!important;padding-bottom:16px!important}.w3-padding-24{padding-top:24px!important;padding-bottom:24px!important} 141 | .w3-padding-32{padding-top:32px!important;padding-bottom:32px!important}.w3-padding-48{padding-top:48px!important;padding-bottom:48px!important} 142 | .w3-padding-64{padding-top:64px!important;padding-bottom:64px!important} 143 | .w3-left{float:left!important}.w3-right{float:right!important} 144 | .w3-button:hover{color:#000!important;background-color:#ccc!important} 145 | .w3-transparent,.w3-hover-none:hover{background-color:transparent!important} 146 | .w3-hover-none:hover{box-shadow:none!important} 147 | /* Colors */ 148 | .w3-amber,.w3-hover-amber:hover{color:#000!important;background-color:#ffc107!important} 149 | .w3-aqua,.w3-hover-aqua:hover{color:#000!important;background-color:#00ffff!important} 150 | .w3-blue,.w3-hover-blue:hover{color:#fff!important;background-color:#2196F3!important} 151 | .w3-light-blue,.w3-hover-light-blue:hover{color:#000!important;background-color:#87CEEB!important} 152 | .w3-brown,.w3-hover-brown:hover{color:#fff!important;background-color:#795548!important} 153 | .w3-cyan,.w3-hover-cyan:hover{color:#000!important;background-color:#00bcd4!important} 154 | .w3-blue-grey,.w3-hover-blue-grey:hover,.w3-blue-gray,.w3-hover-blue-gray:hover{color:#fff!important;background-color:#607d8b!important} 155 | .w3-green,.w3-hover-green:hover{color:#fff!important;background-color:#4CAF50!important} 156 | .w3-light-green,.w3-hover-light-green:hover{color:#000!important;background-color:#8bc34a!important} 157 | .w3-indigo,.w3-hover-indigo:hover{color:#fff!important;background-color:#3f51b5!important} 158 | .w3-khaki,.w3-hover-khaki:hover{color:#000!important;background-color:#f0e68c!important} 159 | .w3-lime,.w3-hover-lime:hover{color:#000!important;background-color:#cddc39!important} 160 | .w3-orange,.w3-hover-orange:hover{color:#000!important;background-color:#ff9800!important} 161 | .w3-deep-orange,.w3-hover-deep-orange:hover{color:#fff!important;background-color:#ff5722!important} 162 | .w3-pink,.w3-hover-pink:hover{color:#fff!important;background-color:#e91e63!important} 163 | .w3-purple,.w3-hover-purple:hover{color:#fff!important;background-color:#9c27b0!important} 164 | .w3-deep-purple,.w3-hover-deep-purple:hover{color:#fff!important;background-color:#673ab7!important} 165 | .w3-red,.w3-hover-red:hover{color:#fff!important;background-color:#f44336!important} 166 | .w3-sand,.w3-hover-sand:hover{color:#000!important;background-color:#fdf5e6!important} 167 | .w3-teal,.w3-hover-teal:hover{color:#fff!important;background-color:#009688!important} 168 | .w3-yellow,.w3-hover-yellow:hover{color:#000!important;background-color:#ffeb3b!important} 169 | .w3-white,.w3-hover-white:hover{color:#000!important;background-color:#fff!important} 170 | .w3-black,.w3-hover-black:hover{color:#fff!important;background-color:#000!important} 171 | .w3-grey,.w3-hover-grey:hover,.w3-gray,.w3-hover-gray:hover{color:#000!important;background-color:#bbb!important} 172 | .w3-light-grey,.w3-hover-light-grey:hover,.w3-light-gray,.w3-hover-light-gray:hover{color:#000!important;background-color:#f1f1f1!important} 173 | .w3-dark-grey,.w3-hover-dark-grey:hover,.w3-dark-gray,.w3-hover-dark-gray:hover{color:#fff!important;background-color:#616161!important} 174 | .w3-pale-red,.w3-hover-pale-red:hover{color:#000!important;background-color:#ffdddd!important} 175 | .w3-pale-green,.w3-hover-pale-green:hover{color:#000!important;background-color:#ddffdd!important} 176 | .w3-pale-yellow,.w3-hover-pale-yellow:hover{color:#000!important;background-color:#ffffcc!important} 177 | .w3-pale-blue,.w3-hover-pale-blue:hover{color:#000!important;background-color:#ddffff!important} 178 | .w3-text-red,.w3-hover-text-red:hover{color:#f44336!important} 179 | .w3-text-green,.w3-hover-text-green:hover{color:#4CAF50!important} 180 | .w3-text-blue,.w3-hover-text-blue:hover{color:#2196F3!important} 181 | .w3-text-yellow,.w3-hover-text-yellow:hover{color:#ffeb3b!important} 182 | .w3-text-white,.w3-hover-text-white:hover{color:#fff!important} 183 | .w3-text-black,.w3-hover-text-black:hover{color:#000!important} 184 | .w3-text-grey,.w3-hover-text-grey:hover,.w3-text-gray,.w3-hover-text-gray:hover{color:#757575!important} 185 | .w3-text-amber{color:#ffc107!important} 186 | .w3-text-aqua{color:#00ffff!important} 187 | .w3-text-light-blue{color:#87CEEB!important} 188 | .w3-text-brown{color:#795548!important} 189 | .w3-text-cyan{color:#00bcd4!important} 190 | .w3-text-blue-grey,.w3-text-blue-gray{color:#607d8b!important} 191 | .w3-text-light-green{color:#8bc34a!important} 192 | .w3-text-indigo{color:#3f51b5!important} 193 | .w3-text-khaki{color:#b4aa50!important} 194 | .w3-text-lime{color:#cddc39!important} 195 | .w3-text-orange{color:#ff9800!important} 196 | .w3-text-deep-orange{color:#ff5722!important} 197 | .w3-text-pink{color:#e91e63!important} 198 | .w3-text-purple{color:#9c27b0!important} 199 | .w3-text-deep-purple{color:#673ab7!important} 200 | .w3-text-sand{color:#fdf5e6!important} 201 | .w3-text-teal{color:#009688!important} 202 | .w3-text-light-grey,.w3-hover-text-light-grey:hover,.w3-text-light-gray,.w3-hover-text-light-gray:hover{color:#f1f1f1!important} 203 | .w3-text-dark-grey,.w3-hover-text-dark-grey:hover,.w3-text-dark-gray,.w3-hover-text-dark-gray:hover{color:#3a3a3a!important} 204 | .w3-border-red,.w3-hover-border-red:hover{border-color:#f44336!important} 205 | .w3-border-green,.w3-hover-border-green:hover{border-color:#4CAF50!important} 206 | .w3-border-blue,.w3-hover-border-blue:hover{border-color:#2196F3!important} 207 | .w3-border-yellow,.w3-hover-border-yellow:hover{border-color:#ffeb3b!important} 208 | .w3-border-white,.w3-hover-border-white:hover{border-color:#fff!important} 209 | .w3-border-black,.w3-hover-border-black:hover{border-color:#000!important} 210 | .w3-border-grey,.w3-hover-border-grey:hover,.w3-border-gray,.w3-hover-border-gray:hover{border-color:#bbb!important} -------------------------------------------------------------------------------- /font/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Font license info 2 | 3 | 4 | ## Font Awesome 5 | 6 | Copyright (C) 2016 by Dave Gandy 7 | 8 | Author: Dave Gandy 9 | License: SIL () 10 | Homepage: http://fortawesome.github.com/Font-Awesome/ 11 | 12 | 13 | ## Entypo 14 | 15 | Copyright (C) 2012 by Daniel Bruce 16 | 17 | Author: Daniel Bruce 18 | License: SIL (http://scripts.sil.org/OFL) 19 | Homepage: http://www.entypo.com 20 | 21 | 22 | ## Elusive 23 | 24 | Copyright (C) 2013 by Aristeides Stathopoulos 25 | 26 | Author: Aristeides Stathopoulos 27 | License: SIL (http://scripts.sil.org/OFL) 28 | Homepage: http://aristeides.com/ 29 | 30 | 31 | ## Web Symbols 32 | 33 | Copyright (c) 2011 by Just Be Nice studio. All rights reserved. 34 | 35 | Author: Just Be Nice studio 36 | License: SIL (http://scripts.sil.org/OFL) 37 | Homepage: http://www.justbenicestudio.com/ 38 | 39 | 40 | ## Linecons 41 | 42 | Copyright (C) 2013 by Designmodo 43 | 44 | Author: Designmodo for Smashing Magazine 45 | License: CC BY () 46 | Homepage: http://designmodo.com/linecons-free/ 47 | 48 | 49 | ## MFG Labs 50 | 51 | Copyright (C) 2012 by Daniel Bruce 52 | 53 | Author: MFG Labs 54 | License: SIL (http://scripts.sil.org/OFL) 55 | Homepage: http://www.mfglabs.com/ 56 | 57 | 58 | -------------------------------------------------------------------------------- /font/tit-fontello.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luce80/Try-It-Editor-Offline/b078ca731854338ab7a577d59559bde80abfcc98/font/tit-fontello.eot -------------------------------------------------------------------------------- /font/tit-fontello.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Copyright (C) 2017 by original authors @ fontello.com 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 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /font/tit-fontello.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luce80/Try-It-Editor-Offline/b078ca731854338ab7a577d59559bde80abfcc98/font/tit-fontello.ttf -------------------------------------------------------------------------------- /font/tit-fontello.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luce80/Try-It-Editor-Offline/b078ca731854338ab7a577d59559bde80abfcc98/font/tit-fontello.woff -------------------------------------------------------------------------------- /font/tit-fontello.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luce80/Try-It-Editor-Offline/b078ca731854338ab7a577d59559bde80abfcc98/font/tit-fontello.woff2 -------------------------------------------------------------------------------- /images/driveicon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luce80/Try-It-Editor-Offline/b078ca731854338ab7a577d59559bde80abfcc98/images/driveicon_32.png -------------------------------------------------------------------------------- /js/FileSaver.js: -------------------------------------------------------------------------------- 1 | /* FileSaver.js 2 | * A saveAs() FileSaver implementation. 3 | * 1.3.2 4 | * 2016-06-16 18:25:19 5 | * 6 | * By Eli Grey, http://eligrey.com 7 | * License: MIT 8 | * See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md 9 | */ 10 | 11 | /*global self */ 12 | /*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */ 13 | 14 | /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ 15 | 16 | var saveAs = saveAs || (function(view) { 17 | "use strict"; 18 | // IE <10 is explicitly unsupported 19 | if (typeof view === "undefined" || typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) { 20 | return; 21 | } 22 | var 23 | doc = view.document 24 | // only get URL when necessary in case Blob.js hasn't overridden it yet 25 | , get_URL = function() { 26 | return view.URL || view.webkitURL || view; 27 | } 28 | , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a") 29 | , can_use_save_link = "download" in save_link 30 | , click = function(node) { 31 | var event = new MouseEvent("click"); 32 | node.dispatchEvent(event); 33 | } 34 | , is_safari = /constructor/i.test(view.HTMLElement) || view.safari 35 | , is_chrome_ios =/CriOS\/[\d]+/.test(navigator.userAgent) 36 | , throw_outside = function(ex) { 37 | (view.setImmediate || view.setTimeout)(function() { 38 | throw ex; 39 | }, 0); 40 | } 41 | , force_saveable_type = "application/octet-stream" 42 | // the Blob API is fundamentally broken as there is no "downloadfinished" event to subscribe to 43 | , arbitrary_revoke_timeout = 1000 * 40 // in ms 44 | , revoke = function(file) { 45 | var revoker = function() { 46 | if (typeof file === "string") { // file is an object URL 47 | get_URL().revokeObjectURL(file); 48 | } else { // file is a File 49 | file.remove(); 50 | } 51 | }; 52 | setTimeout(revoker, arbitrary_revoke_timeout); 53 | } 54 | , dispatch = function(filesaver, event_types, event) { 55 | event_types = [].concat(event_types); 56 | var i = event_types.length; 57 | while (i--) { 58 | var listener = filesaver["on" + event_types[i]]; 59 | if (typeof listener === "function") { 60 | try { 61 | listener.call(filesaver, event || filesaver); 62 | } catch (ex) { 63 | throw_outside(ex); 64 | } 65 | } 66 | } 67 | } 68 | , auto_bom = function(blob) { 69 | // prepend BOM for UTF-8 XML and text/* types (including HTML) 70 | // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF 71 | if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) { 72 | return new Blob([String.fromCharCode(0xFEFF), blob], {type: blob.type}); 73 | } 74 | return blob; 75 | } 76 | , FileSaver = function(blob, name, no_auto_bom) { 77 | if (!no_auto_bom) { 78 | blob = auto_bom(blob); 79 | } 80 | // First try a.download, then web filesystem, then object URLs 81 | var 82 | filesaver = this 83 | , type = blob.type 84 | , force = type === force_saveable_type 85 | , object_url 86 | , dispatch_all = function() { 87 | dispatch(filesaver, "writestart progress write writeend".split(" ")); 88 | } 89 | // on any filesys errors revert to saving with object URLs 90 | , fs_error = function() { 91 | if ((is_chrome_ios || (force && is_safari)) && view.FileReader) { 92 | // Safari doesn't allow downloading of blob urls 93 | var reader = new FileReader(); 94 | reader.onloadend = function() { 95 | var url = is_chrome_ios ? reader.result : reader.result.replace(/^data:[^;]*;/, 'data:attachment/file;'); 96 | var popup = view.open(url, '_blank'); 97 | if(!popup) view.location.href = url; 98 | url=undefined; // release reference before dispatching 99 | filesaver.readyState = filesaver.DONE; 100 | dispatch_all(); 101 | }; 102 | reader.readAsDataURL(blob); 103 | filesaver.readyState = filesaver.INIT; 104 | return; 105 | } 106 | // don't create more object URLs than needed 107 | if (!object_url) { 108 | object_url = get_URL().createObjectURL(blob); 109 | } 110 | if (force) { 111 | view.location.href = object_url; 112 | } else { 113 | var opened = view.open(object_url, "_blank"); 114 | if (!opened) { 115 | // Apple does not allow window.open, see https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html 116 | view.location.href = object_url; 117 | } 118 | } 119 | filesaver.readyState = filesaver.DONE; 120 | dispatch_all(); 121 | revoke(object_url); 122 | } 123 | ; 124 | filesaver.readyState = filesaver.INIT; 125 | 126 | if (can_use_save_link) { 127 | object_url = get_URL().createObjectURL(blob); 128 | setTimeout(function() { 129 | save_link.href = object_url; 130 | save_link.download = name; 131 | click(save_link); 132 | dispatch_all(); 133 | revoke(object_url); 134 | filesaver.readyState = filesaver.DONE; 135 | }); 136 | return; 137 | } 138 | 139 | fs_error(); 140 | } 141 | , FS_proto = FileSaver.prototype 142 | , saveAs = function(blob, name, no_auto_bom) { 143 | return new FileSaver(blob, name || blob.name || "download", no_auto_bom); 144 | } 145 | ; 146 | // IE 10+ (native saveAs) 147 | if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) { 148 | return function(blob, name, no_auto_bom) { 149 | name = name || blob.name || "download"; 150 | 151 | if (!no_auto_bom) { 152 | blob = auto_bom(blob); 153 | } 154 | return navigator.msSaveOrOpenBlob(blob, name); 155 | }; 156 | } 157 | 158 | FS_proto.abort = function(){}; 159 | FS_proto.readyState = FS_proto.INIT = 0; 160 | FS_proto.WRITING = 1; 161 | FS_proto.DONE = 2; 162 | 163 | FS_proto.error = 164 | FS_proto.onwritestart = 165 | FS_proto.onprogress = 166 | FS_proto.onwrite = 167 | FS_proto.onabort = 168 | FS_proto.onerror = 169 | FS_proto.onwriteend = 170 | null; 171 | 172 | return saveAs; 173 | }( 174 | typeof self !== "undefined" && self 175 | || typeof window !== "undefined" && window 176 | || this.content 177 | )); 178 | // `self` is undefined in Firefox for Android content script context 179 | // while `this` is nsIContentFrameMessageManager 180 | // with an attribute `content` that corresponds to the window 181 | 182 | if (typeof module !== "undefined" && module.exports) { 183 | module.exports.saveAs = saveAs; 184 | } else if ((typeof define !== "undefined" && define !== null) && (define.amd !== null)) { 185 | define("FileSaver.js", function() { 186 | return saveAs; 187 | }); 188 | } 189 | -------------------------------------------------------------------------------- /js/codemirror/addon/edit/closebrackets.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | var defaults = { 13 | pairs: "()[]{}''\"\"", 14 | triples: "", 15 | explode: "[]{}" 16 | }; 17 | 18 | var Pos = CodeMirror.Pos; 19 | 20 | CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) { 21 | if (old && old != CodeMirror.Init) { 22 | cm.removeKeyMap(keyMap); 23 | cm.state.closeBrackets = null; 24 | } 25 | if (val) { 26 | ensureBound(getOption(val, "pairs")) 27 | cm.state.closeBrackets = val; 28 | cm.addKeyMap(keyMap); 29 | } 30 | }); 31 | 32 | function getOption(conf, name) { 33 | if (name == "pairs" && typeof conf == "string") return conf; 34 | if (typeof conf == "object" && conf[name] != null) return conf[name]; 35 | return defaults[name]; 36 | } 37 | 38 | var keyMap = {Backspace: handleBackspace, Enter: handleEnter}; 39 | function ensureBound(chars) { 40 | for (var i = 0; i < chars.length; i++) { 41 | var ch = chars.charAt(i), key = "'" + ch + "'" 42 | if (!keyMap[key]) keyMap[key] = handler(ch) 43 | } 44 | } 45 | ensureBound(defaults.pairs + "`") 46 | 47 | function handler(ch) { 48 | return function(cm) { return handleChar(cm, ch); }; 49 | } 50 | 51 | function getConfig(cm) { 52 | var deflt = cm.state.closeBrackets; 53 | if (!deflt || deflt.override) return deflt; 54 | var mode = cm.getModeAt(cm.getCursor()); 55 | return mode.closeBrackets || deflt; 56 | } 57 | 58 | function handleBackspace(cm) { 59 | var conf = getConfig(cm); 60 | if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass; 61 | 62 | var pairs = getOption(conf, "pairs"); 63 | var ranges = cm.listSelections(); 64 | for (var i = 0; i < ranges.length; i++) { 65 | if (!ranges[i].empty()) return CodeMirror.Pass; 66 | var around = charsAround(cm, ranges[i].head); 67 | if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass; 68 | } 69 | for (var i = ranges.length - 1; i >= 0; i--) { 70 | var cur = ranges[i].head; 71 | cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1), "+delete"); 72 | } 73 | } 74 | 75 | function handleEnter(cm) { 76 | var conf = getConfig(cm); 77 | var explode = conf && getOption(conf, "explode"); 78 | if (!explode || cm.getOption("disableInput")) return CodeMirror.Pass; 79 | 80 | var ranges = cm.listSelections(); 81 | for (var i = 0; i < ranges.length; i++) { 82 | if (!ranges[i].empty()) return CodeMirror.Pass; 83 | var around = charsAround(cm, ranges[i].head); 84 | if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass; 85 | } 86 | cm.operation(function() { 87 | cm.replaceSelection("\n\n", null); 88 | cm.execCommand("goCharLeft"); 89 | ranges = cm.listSelections(); 90 | for (var i = 0; i < ranges.length; i++) { 91 | var line = ranges[i].head.line; 92 | cm.indentLine(line, null, true); 93 | cm.indentLine(line + 1, null, true); 94 | } 95 | }); 96 | } 97 | 98 | function contractSelection(sel) { 99 | var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0; 100 | return {anchor: new Pos(sel.anchor.line, sel.anchor.ch + (inverted ? -1 : 1)), 101 | head: new Pos(sel.head.line, sel.head.ch + (inverted ? 1 : -1))}; 102 | } 103 | 104 | function handleChar(cm, ch) { 105 | var conf = getConfig(cm); 106 | if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass; 107 | 108 | var pairs = getOption(conf, "pairs"); 109 | var pos = pairs.indexOf(ch); 110 | if (pos == -1) return CodeMirror.Pass; 111 | var triples = getOption(conf, "triples"); 112 | 113 | var identical = pairs.charAt(pos + 1) == ch; 114 | var ranges = cm.listSelections(); 115 | var opening = pos % 2 == 0; 116 | 117 | var type; 118 | for (var i = 0; i < ranges.length; i++) { 119 | var range = ranges[i], cur = range.head, curType; 120 | var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1)); 121 | if (opening && !range.empty()) { 122 | curType = "surround"; 123 | } else if ((identical || !opening) && next == ch) { 124 | if (identical && stringStartsAfter(cm, cur)) 125 | curType = "both"; 126 | else if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch) 127 | curType = "skipThree"; 128 | else 129 | curType = "skip"; 130 | } else if (identical && cur.ch > 1 && triples.indexOf(ch) >= 0 && 131 | cm.getRange(Pos(cur.line, cur.ch - 2), cur) == ch + ch && 132 | (cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != ch)) { 133 | curType = "addFour"; 134 | } else if (identical) { 135 | if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, ch)) curType = "both"; 136 | else return CodeMirror.Pass; 137 | } else if (opening && (cm.getLine(cur.line).length == cur.ch || 138 | isClosingBracket(next, pairs) || 139 | /\s/.test(next))) { 140 | curType = "both"; 141 | } else { 142 | return CodeMirror.Pass; 143 | } 144 | if (!type) type = curType; 145 | else if (type != curType) return CodeMirror.Pass; 146 | } 147 | 148 | var left = pos % 2 ? pairs.charAt(pos - 1) : ch; 149 | var right = pos % 2 ? ch : pairs.charAt(pos + 1); 150 | cm.operation(function() { 151 | if (type == "skip") { 152 | cm.execCommand("goCharRight"); 153 | } else if (type == "skipThree") { 154 | for (var i = 0; i < 3; i++) 155 | cm.execCommand("goCharRight"); 156 | } else if (type == "surround") { 157 | var sels = cm.getSelections(); 158 | for (var i = 0; i < sels.length; i++) 159 | sels[i] = left + sels[i] + right; 160 | cm.replaceSelections(sels, "around"); 161 | sels = cm.listSelections().slice(); 162 | for (var i = 0; i < sels.length; i++) 163 | sels[i] = contractSelection(sels[i]); 164 | cm.setSelections(sels); 165 | } else if (type == "both") { 166 | cm.replaceSelection(left + right, null); 167 | cm.triggerElectric(left + right); 168 | cm.execCommand("goCharLeft"); 169 | } else if (type == "addFour") { 170 | cm.replaceSelection(left + left + left + left, "before"); 171 | cm.execCommand("goCharRight"); 172 | } 173 | }); 174 | } 175 | 176 | function isClosingBracket(ch, pairs) { 177 | var pos = pairs.lastIndexOf(ch); 178 | return pos > -1 && pos % 2 == 1; 179 | } 180 | 181 | function charsAround(cm, pos) { 182 | var str = cm.getRange(Pos(pos.line, pos.ch - 1), 183 | Pos(pos.line, pos.ch + 1)); 184 | return str.length == 2 ? str : null; 185 | } 186 | 187 | // Project the token type that will exists after the given char is 188 | // typed, and use it to determine whether it would cause the start 189 | // of a string token. 190 | function enteringString(cm, pos, ch) { 191 | var line = cm.getLine(pos.line); 192 | var token = cm.getTokenAt(pos); 193 | if (/\bstring2?\b/.test(token.type) || stringStartsAfter(cm, pos)) return false; 194 | var stream = new CodeMirror.StringStream(line.slice(0, pos.ch) + ch + line.slice(pos.ch), 4); 195 | stream.pos = stream.start = token.start; 196 | for (;;) { 197 | var type1 = cm.getMode().token(stream, token.state); 198 | if (stream.pos >= pos.ch + 1) return /\bstring2?\b/.test(type1); 199 | stream.start = stream.pos; 200 | } 201 | } 202 | 203 | function stringStartsAfter(cm, pos) { 204 | var token = cm.getTokenAt(Pos(pos.line, pos.ch + 1)) 205 | return /\bstring/.test(token.type) && token.start == pos.ch 206 | } 207 | }); 208 | -------------------------------------------------------------------------------- /js/codemirror/addon/edit/closetag.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | /** 5 | * Tag-closer extension for CodeMirror. 6 | * 7 | * This extension adds an "autoCloseTags" option that can be set to 8 | * either true to get the default behavior, or an object to further 9 | * configure its behavior. 10 | * 11 | * These are supported options: 12 | * 13 | * `whenClosing` (default true) 14 | * Whether to autoclose when the '/' of a closing tag is typed. 15 | * `whenOpening` (default true) 16 | * Whether to autoclose the tag when the final '>' of an opening 17 | * tag is typed. 18 | * `dontCloseTags` (default is empty tags for HTML, none for XML) 19 | * An array of tag names that should not be autoclosed. 20 | * `indentTags` (default is block tags for HTML, none for XML) 21 | * An array of tag names that should, when opened, cause a 22 | * blank line to be added inside the tag, and the blank line and 23 | * closing line to be indented. 24 | * 25 | * See demos/closetag.html for a usage example. 26 | */ 27 | 28 | (function(mod) { 29 | if (typeof exports == "object" && typeof module == "object") // CommonJS 30 | mod(require("../../lib/codemirror"), require("../fold/xml-fold")); 31 | else if (typeof define == "function" && define.amd) // AMD 32 | define(["../../lib/codemirror", "../fold/xml-fold"], mod); 33 | else // Plain browser env 34 | mod(CodeMirror); 35 | })(function(CodeMirror) { 36 | CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) { 37 | if (old != CodeMirror.Init && old) 38 | cm.removeKeyMap("autoCloseTags"); 39 | if (!val) return; 40 | var map = {name: "autoCloseTags"}; 41 | if (typeof val != "object" || val.whenClosing) 42 | map["'/'"] = function(cm) { return autoCloseSlash(cm); }; 43 | if (typeof val != "object" || val.whenOpening) 44 | map["'>'"] = function(cm) { return autoCloseGT(cm); }; 45 | cm.addKeyMap(map); 46 | }); 47 | 48 | var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", 49 | "source", "track", "wbr"]; 50 | var htmlIndent = ["applet", "blockquote", "body", "button", "div", "dl", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4", 51 | "h5", "h6", "head", "html", "iframe", "layer", "legend", "object", "ol", "p", "select", "table", "ul"]; 52 | 53 | function autoCloseGT(cm) { 54 | if (cm.getOption("disableInput")) return CodeMirror.Pass; 55 | var ranges = cm.listSelections(), replacements = []; 56 | for (var i = 0; i < ranges.length; i++) { 57 | if (!ranges[i].empty()) return CodeMirror.Pass; 58 | var pos = ranges[i].head, tok = cm.getTokenAt(pos); 59 | var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state; 60 | if (inner.mode.name != "xml" || !state.tagName) return CodeMirror.Pass; 61 | 62 | var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html"; 63 | var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose); 64 | var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent); 65 | 66 | var tagName = state.tagName; 67 | if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch); 68 | var lowerTagName = tagName.toLowerCase(); 69 | // Don't process the '>' at the end of an end-tag or self-closing tag 70 | if (!tagName || 71 | tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) || 72 | tok.type == "tag" && state.type == "closeTag" || 73 | tok.string.indexOf("/") == (tok.string.length - 1) || // match something like 74 | dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 || 75 | closingTagExists(cm, tagName, pos, state, true)) 76 | return CodeMirror.Pass; 77 | 78 | var indent = indentTags && indexOf(indentTags, lowerTagName) > -1; 79 | replacements[i] = {indent: indent, 80 | text: ">" + (indent ? "\n\n" : "") + "", 81 | newPos: indent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1)}; 82 | } 83 | 84 | for (var i = ranges.length - 1; i >= 0; i--) { 85 | var info = replacements[i]; 86 | cm.replaceRange(info.text, ranges[i].head, ranges[i].anchor, "+insert"); 87 | var sel = cm.listSelections().slice(0); 88 | sel[i] = {head: info.newPos, anchor: info.newPos}; 89 | cm.setSelections(sel); 90 | if (info.indent) { 91 | cm.indentLine(info.newPos.line, null, true); 92 | cm.indentLine(info.newPos.line + 1, null, true); 93 | } 94 | } 95 | } 96 | 97 | function autoCloseCurrent(cm, typingSlash) { 98 | var ranges = cm.listSelections(), replacements = []; 99 | var head = typingSlash ? "/" : "") replacement += ">"; 126 | replacements[i] = replacement; 127 | } 128 | cm.replaceSelections(replacements); 129 | ranges = cm.listSelections(); 130 | for (var i = 0; i < ranges.length; i++) 131 | if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line) 132 | cm.indentLine(ranges[i].head.line); 133 | } 134 | 135 | function autoCloseSlash(cm) { 136 | if (cm.getOption("disableInput")) return CodeMirror.Pass; 137 | return autoCloseCurrent(cm, true); 138 | } 139 | 140 | CodeMirror.commands.closeTag = function(cm) { return autoCloseCurrent(cm); }; 141 | 142 | function indexOf(collection, elt) { 143 | if (collection.indexOf) return collection.indexOf(elt); 144 | for (var i = 0, e = collection.length; i < e; ++i) 145 | if (collection[i] == elt) return i; 146 | return -1; 147 | } 148 | 149 | // If xml-fold is loaded, we use its functionality to try and verify 150 | // whether a given tag is actually unclosed. 151 | function closingTagExists(cm, tagName, pos, state, newTag) { 152 | if (!CodeMirror.scanForClosingTag) return false; 153 | var end = Math.min(cm.lastLine() + 1, pos.line + 500); 154 | var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end); 155 | if (!nextClose || nextClose.tag != tagName) return false; 156 | var cx = state.context; 157 | // If the immediate wrapping context contains onCx instances of 158 | // the same tag, a closing tag only exists if there are at least 159 | // that many closing tags of that type following. 160 | for (var onCx = newTag ? 1 : 0; cx && cx.tagName == tagName; cx = cx.prev) ++onCx; 161 | pos = nextClose.to; 162 | for (var i = 1; i < onCx; i++) { 163 | var next = CodeMirror.scanForClosingTag(cm, pos, null, end); 164 | if (!next || next.tag != tagName) return false; 165 | pos = next.to; 166 | } 167 | return true; 168 | } 169 | }); 170 | -------------------------------------------------------------------------------- /js/codemirror/addon/fold/xml-fold.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | var Pos = CodeMirror.Pos; 15 | function cmp(a, b) { return a.line - b.line || a.ch - b.ch; } 16 | 17 | var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; 18 | var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; 19 | var xmlTagStart = new RegExp("<(/?)([" + nameStartChar + "][" + nameChar + "]*)", "g"); 20 | 21 | function Iter(cm, line, ch, range) { 22 | this.line = line; this.ch = ch; 23 | this.cm = cm; this.text = cm.getLine(line); 24 | this.min = range ? Math.max(range.from, cm.firstLine()) : cm.firstLine(); 25 | this.max = range ? Math.min(range.to - 1, cm.lastLine()) : cm.lastLine(); 26 | } 27 | 28 | function tagAt(iter, ch) { 29 | var type = iter.cm.getTokenTypeAt(Pos(iter.line, ch)); 30 | return type && /\btag\b/.test(type); 31 | } 32 | 33 | function nextLine(iter) { 34 | if (iter.line >= iter.max) return; 35 | iter.ch = 0; 36 | iter.text = iter.cm.getLine(++iter.line); 37 | return true; 38 | } 39 | function prevLine(iter) { 40 | if (iter.line <= iter.min) return; 41 | iter.text = iter.cm.getLine(--iter.line); 42 | iter.ch = iter.text.length; 43 | return true; 44 | } 45 | 46 | function toTagEnd(iter) { 47 | for (;;) { 48 | var gt = iter.text.indexOf(">", iter.ch); 49 | if (gt == -1) { if (nextLine(iter)) continue; else return; } 50 | if (!tagAt(iter, gt + 1)) { iter.ch = gt + 1; continue; } 51 | var lastSlash = iter.text.lastIndexOf("/", gt); 52 | var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt)); 53 | iter.ch = gt + 1; 54 | return selfClose ? "selfClose" : "regular"; 55 | } 56 | } 57 | function toTagStart(iter) { 58 | for (;;) { 59 | var lt = iter.ch ? iter.text.lastIndexOf("<", iter.ch - 1) : -1; 60 | if (lt == -1) { if (prevLine(iter)) continue; else return; } 61 | if (!tagAt(iter, lt + 1)) { iter.ch = lt; continue; } 62 | xmlTagStart.lastIndex = lt; 63 | iter.ch = lt; 64 | var match = xmlTagStart.exec(iter.text); 65 | if (match && match.index == lt) return match; 66 | } 67 | } 68 | 69 | function toNextTag(iter) { 70 | for (;;) { 71 | xmlTagStart.lastIndex = iter.ch; 72 | var found = xmlTagStart.exec(iter.text); 73 | if (!found) { if (nextLine(iter)) continue; else return; } 74 | if (!tagAt(iter, found.index + 1)) { iter.ch = found.index + 1; continue; } 75 | iter.ch = found.index + found[0].length; 76 | return found; 77 | } 78 | } 79 | function toPrevTag(iter) { 80 | for (;;) { 81 | var gt = iter.ch ? iter.text.lastIndexOf(">", iter.ch - 1) : -1; 82 | if (gt == -1) { if (prevLine(iter)) continue; else return; } 83 | if (!tagAt(iter, gt + 1)) { iter.ch = gt; continue; } 84 | var lastSlash = iter.text.lastIndexOf("/", gt); 85 | var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt)); 86 | iter.ch = gt + 1; 87 | return selfClose ? "selfClose" : "regular"; 88 | } 89 | } 90 | 91 | function findMatchingClose(iter, tag) { 92 | var stack = []; 93 | for (;;) { 94 | var next = toNextTag(iter), end, startLine = iter.line, startCh = iter.ch - (next ? next[0].length : 0); 95 | if (!next || !(end = toTagEnd(iter))) return; 96 | if (end == "selfClose") continue; 97 | if (next[1]) { // closing tag 98 | for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == next[2]) { 99 | stack.length = i; 100 | break; 101 | } 102 | if (i < 0 && (!tag || tag == next[2])) return { 103 | tag: next[2], 104 | from: Pos(startLine, startCh), 105 | to: Pos(iter.line, iter.ch) 106 | }; 107 | } else { // opening tag 108 | stack.push(next[2]); 109 | } 110 | } 111 | } 112 | function findMatchingOpen(iter, tag) { 113 | var stack = []; 114 | for (;;) { 115 | var prev = toPrevTag(iter); 116 | if (!prev) return; 117 | if (prev == "selfClose") { toTagStart(iter); continue; } 118 | var endLine = iter.line, endCh = iter.ch; 119 | var start = toTagStart(iter); 120 | if (!start) return; 121 | if (start[1]) { // closing tag 122 | stack.push(start[2]); 123 | } else { // opening tag 124 | for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == start[2]) { 125 | stack.length = i; 126 | break; 127 | } 128 | if (i < 0 && (!tag || tag == start[2])) return { 129 | tag: start[2], 130 | from: Pos(iter.line, iter.ch), 131 | to: Pos(endLine, endCh) 132 | }; 133 | } 134 | } 135 | } 136 | 137 | CodeMirror.registerHelper("fold", "xml", function(cm, start) { 138 | var iter = new Iter(cm, start.line, 0); 139 | for (;;) { 140 | var openTag = toNextTag(iter), end; 141 | if (!openTag || iter.line != start.line || !(end = toTagEnd(iter))) return; 142 | if (!openTag[1] && end != "selfClose") { 143 | var startPos = Pos(iter.line, iter.ch); 144 | var endPos = findMatchingClose(iter, openTag[2]); 145 | return endPos && {from: startPos, to: endPos.from}; 146 | } 147 | } 148 | }); 149 | CodeMirror.findMatchingTag = function(cm, pos, range) { 150 | var iter = new Iter(cm, pos.line, pos.ch, range); 151 | if (iter.text.indexOf(">") == -1 && iter.text.indexOf("<") == -1) return; 152 | var end = toTagEnd(iter), to = end && Pos(iter.line, iter.ch); 153 | var start = end && toTagStart(iter); 154 | if (!end || !start || cmp(iter, pos) > 0) return; 155 | var here = {from: Pos(iter.line, iter.ch), to: to, tag: start[2]}; 156 | if (end == "selfClose") return {open: here, close: null, at: "open"}; 157 | 158 | if (start[1]) { // closing tag 159 | return {open: findMatchingOpen(iter, start[2]), close: here, at: "close"}; 160 | } else { // opening tag 161 | iter = new Iter(cm, to.line, to.ch, range); 162 | return {open: here, close: findMatchingClose(iter, start[2]), at: "open"}; 163 | } 164 | }; 165 | 166 | CodeMirror.findEnclosingTag = function(cm, pos, range, tag) { 167 | var iter = new Iter(cm, pos.line, pos.ch, range); 168 | for (;;) { 169 | var open = findMatchingOpen(iter, tag); 170 | if (!open) break; 171 | var forward = new Iter(cm, pos.line, pos.ch, range); 172 | var close = findMatchingClose(forward, open.tag); 173 | if (close) return {open: open, close: close}; 174 | } 175 | }; 176 | 177 | // Used by addon/edit/closetag.js 178 | CodeMirror.scanForClosingTag = function(cm, pos, name, end) { 179 | var iter = new Iter(cm, pos.line, pos.ch, end ? {from: 0, to: end} : null); 180 | return findMatchingClose(iter, name); 181 | }; 182 | }); 183 | -------------------------------------------------------------------------------- /js/codemirror/mode/css/css.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("css", function(config, parserConfig) { 15 | var inline = parserConfig.inline 16 | if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css"); 17 | 18 | var indentUnit = config.indentUnit, 19 | tokenHooks = parserConfig.tokenHooks, 20 | documentTypes = parserConfig.documentTypes || {}, 21 | mediaTypes = parserConfig.mediaTypes || {}, 22 | mediaFeatures = parserConfig.mediaFeatures || {}, 23 | mediaValueKeywords = parserConfig.mediaValueKeywords || {}, 24 | propertyKeywords = parserConfig.propertyKeywords || {}, 25 | nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {}, 26 | fontProperties = parserConfig.fontProperties || {}, 27 | counterDescriptors = parserConfig.counterDescriptors || {}, 28 | colorKeywords = parserConfig.colorKeywords || {}, 29 | valueKeywords = parserConfig.valueKeywords || {}, 30 | allowNested = parserConfig.allowNested, 31 | lineComment = parserConfig.lineComment, 32 | supportsAtComponent = parserConfig.supportsAtComponent === true; 33 | 34 | var type, override; 35 | function ret(style, tp) { type = tp; return style; } 36 | 37 | // Tokenizers 38 | 39 | function tokenBase(stream, state) { 40 | var ch = stream.next(); 41 | if (tokenHooks[ch]) { 42 | var result = tokenHooks[ch](stream, state); 43 | if (result !== false) return result; 44 | } 45 | if (ch == "@") { 46 | stream.eatWhile(/[\w\\\-]/); 47 | return ret("def", stream.current()); 48 | } else if (ch == "=" || (ch == "~" || ch == "|") && stream.eat("=")) { 49 | return ret(null, "compare"); 50 | } else if (ch == "\"" || ch == "'") { 51 | state.tokenize = tokenString(ch); 52 | return state.tokenize(stream, state); 53 | } else if (ch == "#") { 54 | stream.eatWhile(/[\w\\\-]/); 55 | return ret("atom", "hash"); 56 | } else if (ch == "!") { 57 | stream.match(/^\s*\w*/); 58 | return ret("keyword", "important"); 59 | } else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) { 60 | stream.eatWhile(/[\w.%]/); 61 | return ret("number", "unit"); 62 | } else if (ch === "-") { 63 | if (/[\d.]/.test(stream.peek())) { 64 | stream.eatWhile(/[\w.%]/); 65 | return ret("number", "unit"); 66 | } else if (stream.match(/^-[\w\\\-]+/)) { 67 | stream.eatWhile(/[\w\\\-]/); 68 | if (stream.match(/^\s*:/, false)) 69 | return ret("variable-2", "variable-definition"); 70 | return ret("variable-2", "variable"); 71 | } else if (stream.match(/^\w+-/)) { 72 | return ret("meta", "meta"); 73 | } 74 | } else if (/[,+>*\/]/.test(ch)) { 75 | return ret(null, "select-op"); 76 | } else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) { 77 | return ret("qualifier", "qualifier"); 78 | } else if (/[:;{}\[\]\(\)]/.test(ch)) { 79 | return ret(null, ch); 80 | } else if ((ch == "u" && stream.match(/rl(-prefix)?\(/)) || 81 | (ch == "d" && stream.match("omain(")) || 82 | (ch == "r" && stream.match("egexp("))) { 83 | stream.backUp(1); 84 | state.tokenize = tokenParenthesized; 85 | return ret("property", "word"); 86 | } else if (/[\w\\\-]/.test(ch)) { 87 | stream.eatWhile(/[\w\\\-]/); 88 | return ret("property", "word"); 89 | } else { 90 | return ret(null, null); 91 | } 92 | } 93 | 94 | function tokenString(quote) { 95 | return function(stream, state) { 96 | var escaped = false, ch; 97 | while ((ch = stream.next()) != null) { 98 | if (ch == quote && !escaped) { 99 | if (quote == ")") stream.backUp(1); 100 | break; 101 | } 102 | escaped = !escaped && ch == "\\"; 103 | } 104 | if (ch == quote || !escaped && quote != ")") state.tokenize = null; 105 | return ret("string", "string"); 106 | }; 107 | } 108 | 109 | function tokenParenthesized(stream, state) { 110 | stream.next(); // Must be '(' 111 | if (!stream.match(/\s*[\"\')]/, false)) 112 | state.tokenize = tokenString(")"); 113 | else 114 | state.tokenize = null; 115 | return ret(null, "("); 116 | } 117 | 118 | // Context management 119 | 120 | function Context(type, indent, prev) { 121 | this.type = type; 122 | this.indent = indent; 123 | this.prev = prev; 124 | } 125 | 126 | function pushContext(state, stream, type, indent) { 127 | state.context = new Context(type, stream.indentation() + (indent === false ? 0 : indentUnit), state.context); 128 | return type; 129 | } 130 | 131 | function popContext(state) { 132 | if (state.context.prev) 133 | state.context = state.context.prev; 134 | return state.context.type; 135 | } 136 | 137 | function pass(type, stream, state) { 138 | return states[state.context.type](type, stream, state); 139 | } 140 | function popAndPass(type, stream, state, n) { 141 | for (var i = n || 1; i > 0; i--) 142 | state.context = state.context.prev; 143 | return pass(type, stream, state); 144 | } 145 | 146 | // Parser 147 | 148 | function wordAsValue(stream) { 149 | var word = stream.current().toLowerCase(); 150 | if (valueKeywords.hasOwnProperty(word)) 151 | override = "atom"; 152 | else if (colorKeywords.hasOwnProperty(word)) 153 | override = "keyword"; 154 | else 155 | override = "variable"; 156 | } 157 | 158 | var states = {}; 159 | 160 | states.top = function(type, stream, state) { 161 | if (type == "{") { 162 | return pushContext(state, stream, "block"); 163 | } else if (type == "}" && state.context.prev) { 164 | return popContext(state); 165 | } else if (supportsAtComponent && /@component/.test(type)) { 166 | return pushContext(state, stream, "atComponentBlock"); 167 | } else if (/^@(-moz-)?document$/.test(type)) { 168 | return pushContext(state, stream, "documentTypes"); 169 | } else if (/^@(media|supports|(-moz-)?document|import)$/.test(type)) { 170 | return pushContext(state, stream, "atBlock"); 171 | } else if (/^@(font-face|counter-style)/.test(type)) { 172 | state.stateArg = type; 173 | return "restricted_atBlock_before"; 174 | } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) { 175 | return "keyframes"; 176 | } else if (type && type.charAt(0) == "@") { 177 | return pushContext(state, stream, "at"); 178 | } else if (type == "hash") { 179 | override = "builtin"; 180 | } else if (type == "word") { 181 | override = "tag"; 182 | } else if (type == "variable-definition") { 183 | return "maybeprop"; 184 | } else if (type == "interpolation") { 185 | return pushContext(state, stream, "interpolation"); 186 | } else if (type == ":") { 187 | return "pseudo"; 188 | } else if (allowNested && type == "(") { 189 | return pushContext(state, stream, "parens"); 190 | } 191 | return state.context.type; 192 | }; 193 | 194 | states.block = function(type, stream, state) { 195 | if (type == "word") { 196 | var word = stream.current().toLowerCase(); 197 | if (propertyKeywords.hasOwnProperty(word)) { 198 | override = "property"; 199 | return "maybeprop"; 200 | } else if (nonStandardPropertyKeywords.hasOwnProperty(word)) { 201 | override = "string-2"; 202 | return "maybeprop"; 203 | } else if (allowNested) { 204 | override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag"; 205 | return "block"; 206 | } else { 207 | override += " error"; 208 | return "maybeprop"; 209 | } 210 | } else if (type == "meta") { 211 | return "block"; 212 | } else if (!allowNested && (type == "hash" || type == "qualifier")) { 213 | override = "error"; 214 | return "block"; 215 | } else { 216 | return states.top(type, stream, state); 217 | } 218 | }; 219 | 220 | states.maybeprop = function(type, stream, state) { 221 | if (type == ":") return pushContext(state, stream, "prop"); 222 | return pass(type, stream, state); 223 | }; 224 | 225 | states.prop = function(type, stream, state) { 226 | if (type == ";") return popContext(state); 227 | if (type == "{" && allowNested) return pushContext(state, stream, "propBlock"); 228 | if (type == "}" || type == "{") return popAndPass(type, stream, state); 229 | if (type == "(") return pushContext(state, stream, "parens"); 230 | 231 | if (type == "hash" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) { 232 | override += " error"; 233 | } else if (type == "word") { 234 | wordAsValue(stream); 235 | } else if (type == "interpolation") { 236 | return pushContext(state, stream, "interpolation"); 237 | } 238 | return "prop"; 239 | }; 240 | 241 | states.propBlock = function(type, _stream, state) { 242 | if (type == "}") return popContext(state); 243 | if (type == "word") { override = "property"; return "maybeprop"; } 244 | return state.context.type; 245 | }; 246 | 247 | states.parens = function(type, stream, state) { 248 | if (type == "{" || type == "}") return popAndPass(type, stream, state); 249 | if (type == ")") return popContext(state); 250 | if (type == "(") return pushContext(state, stream, "parens"); 251 | if (type == "interpolation") return pushContext(state, stream, "interpolation"); 252 | if (type == "word") wordAsValue(stream); 253 | return "parens"; 254 | }; 255 | 256 | states.pseudo = function(type, stream, state) { 257 | if (type == "meta") return "pseudo"; 258 | 259 | if (type == "word") { 260 | override = "variable-3"; 261 | return state.context.type; 262 | } 263 | return pass(type, stream, state); 264 | }; 265 | 266 | states.documentTypes = function(type, stream, state) { 267 | if (type == "word" && documentTypes.hasOwnProperty(stream.current())) { 268 | override = "tag"; 269 | return state.context.type; 270 | } else { 271 | return states.atBlock(type, stream, state); 272 | } 273 | }; 274 | 275 | states.atBlock = function(type, stream, state) { 276 | if (type == "(") return pushContext(state, stream, "atBlock_parens"); 277 | if (type == "}" || type == ";") return popAndPass(type, stream, state); 278 | if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top"); 279 | 280 | if (type == "interpolation") return pushContext(state, stream, "interpolation"); 281 | 282 | if (type == "word") { 283 | var word = stream.current().toLowerCase(); 284 | if (word == "only" || word == "not" || word == "and" || word == "or") 285 | override = "keyword"; 286 | else if (mediaTypes.hasOwnProperty(word)) 287 | override = "attribute"; 288 | else if (mediaFeatures.hasOwnProperty(word)) 289 | override = "property"; 290 | else if (mediaValueKeywords.hasOwnProperty(word)) 291 | override = "keyword"; 292 | else if (propertyKeywords.hasOwnProperty(word)) 293 | override = "property"; 294 | else if (nonStandardPropertyKeywords.hasOwnProperty(word)) 295 | override = "string-2"; 296 | else if (valueKeywords.hasOwnProperty(word)) 297 | override = "atom"; 298 | else if (colorKeywords.hasOwnProperty(word)) 299 | override = "keyword"; 300 | else 301 | override = "error"; 302 | } 303 | return state.context.type; 304 | }; 305 | 306 | states.atComponentBlock = function(type, stream, state) { 307 | if (type == "}") 308 | return popAndPass(type, stream, state); 309 | if (type == "{") 310 | return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top", false); 311 | if (type == "word") 312 | override = "error"; 313 | return state.context.type; 314 | }; 315 | 316 | states.atBlock_parens = function(type, stream, state) { 317 | if (type == ")") return popContext(state); 318 | if (type == "{" || type == "}") return popAndPass(type, stream, state, 2); 319 | return states.atBlock(type, stream, state); 320 | }; 321 | 322 | states.restricted_atBlock_before = function(type, stream, state) { 323 | if (type == "{") 324 | return pushContext(state, stream, "restricted_atBlock"); 325 | if (type == "word" && state.stateArg == "@counter-style") { 326 | override = "variable"; 327 | return "restricted_atBlock_before"; 328 | } 329 | return pass(type, stream, state); 330 | }; 331 | 332 | states.restricted_atBlock = function(type, stream, state) { 333 | if (type == "}") { 334 | state.stateArg = null; 335 | return popContext(state); 336 | } 337 | if (type == "word") { 338 | if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) || 339 | (state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase()))) 340 | override = "error"; 341 | else 342 | override = "property"; 343 | return "maybeprop"; 344 | } 345 | return "restricted_atBlock"; 346 | }; 347 | 348 | states.keyframes = function(type, stream, state) { 349 | if (type == "word") { override = "variable"; return "keyframes"; } 350 | if (type == "{") return pushContext(state, stream, "top"); 351 | return pass(type, stream, state); 352 | }; 353 | 354 | states.at = function(type, stream, state) { 355 | if (type == ";") return popContext(state); 356 | if (type == "{" || type == "}") return popAndPass(type, stream, state); 357 | if (type == "word") override = "tag"; 358 | else if (type == "hash") override = "builtin"; 359 | return "at"; 360 | }; 361 | 362 | states.interpolation = function(type, stream, state) { 363 | if (type == "}") return popContext(state); 364 | if (type == "{" || type == ";") return popAndPass(type, stream, state); 365 | if (type == "word") override = "variable"; 366 | else if (type != "variable" && type != "(" && type != ")") override = "error"; 367 | return "interpolation"; 368 | }; 369 | 370 | return { 371 | startState: function(base) { 372 | return {tokenize: null, 373 | state: inline ? "block" : "top", 374 | stateArg: null, 375 | context: new Context(inline ? "block" : "top", base || 0, null)}; 376 | }, 377 | 378 | token: function(stream, state) { 379 | if (!state.tokenize && stream.eatSpace()) return null; 380 | var style = (state.tokenize || tokenBase)(stream, state); 381 | if (style && typeof style == "object") { 382 | type = style[1]; 383 | style = style[0]; 384 | } 385 | override = style; 386 | if (type != "comment") 387 | state.state = states[state.state](type, stream, state); 388 | return override; 389 | }, 390 | 391 | indent: function(state, textAfter) { 392 | var cx = state.context, ch = textAfter && textAfter.charAt(0); 393 | var indent = cx.indent; 394 | if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev; 395 | if (cx.prev) { 396 | if (ch == "}" && (cx.type == "block" || cx.type == "top" || 397 | cx.type == "interpolation" || cx.type == "restricted_atBlock")) { 398 | // Resume indentation from parent context. 399 | cx = cx.prev; 400 | indent = cx.indent; 401 | } else if (ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") || 402 | ch == "{" && (cx.type == "at" || cx.type == "atBlock")) { 403 | // Dedent relative to current context. 404 | indent = Math.max(0, cx.indent - indentUnit); 405 | } 406 | } 407 | return indent; 408 | }, 409 | 410 | electricChars: "}", 411 | blockCommentStart: "/*", 412 | blockCommentEnd: "*/", 413 | lineComment: lineComment, 414 | fold: "brace" 415 | }; 416 | }); 417 | 418 | function keySet(array) { 419 | var keys = {}; 420 | for (var i = 0; i < array.length; ++i) { 421 | keys[array[i].toLowerCase()] = true; 422 | } 423 | return keys; 424 | } 425 | 426 | var documentTypes_ = [ 427 | "domain", "regexp", "url", "url-prefix" 428 | ], documentTypes = keySet(documentTypes_); 429 | 430 | var mediaTypes_ = [ 431 | "all", "aural", "braille", "handheld", "print", "projection", "screen", 432 | "tty", "tv", "embossed" 433 | ], mediaTypes = keySet(mediaTypes_); 434 | 435 | var mediaFeatures_ = [ 436 | "width", "min-width", "max-width", "height", "min-height", "max-height", 437 | "device-width", "min-device-width", "max-device-width", "device-height", 438 | "min-device-height", "max-device-height", "aspect-ratio", 439 | "min-aspect-ratio", "max-aspect-ratio", "device-aspect-ratio", 440 | "min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color", 441 | "max-color", "color-index", "min-color-index", "max-color-index", 442 | "monochrome", "min-monochrome", "max-monochrome", "resolution", 443 | "min-resolution", "max-resolution", "scan", "grid", "orientation", 444 | "device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio", 445 | "pointer", "any-pointer", "hover", "any-hover" 446 | ], mediaFeatures = keySet(mediaFeatures_); 447 | 448 | var mediaValueKeywords_ = [ 449 | "landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover", 450 | "interlace", "progressive" 451 | ], mediaValueKeywords = keySet(mediaValueKeywords_); 452 | 453 | var propertyKeywords_ = [ 454 | "align-content", "align-items", "align-self", "alignment-adjust", 455 | "alignment-baseline", "anchor-point", "animation", "animation-delay", 456 | "animation-direction", "animation-duration", "animation-fill-mode", 457 | "animation-iteration-count", "animation-name", "animation-play-state", 458 | "animation-timing-function", "appearance", "azimuth", "backface-visibility", 459 | "background", "background-attachment", "background-blend-mode", "background-clip", 460 | "background-color", "background-image", "background-origin", "background-position", 461 | "background-repeat", "background-size", "baseline-shift", "binding", 462 | "bleed", "bookmark-label", "bookmark-level", "bookmark-state", 463 | "bookmark-target", "border", "border-bottom", "border-bottom-color", 464 | "border-bottom-left-radius", "border-bottom-right-radius", 465 | "border-bottom-style", "border-bottom-width", "border-collapse", 466 | "border-color", "border-image", "border-image-outset", 467 | "border-image-repeat", "border-image-slice", "border-image-source", 468 | "border-image-width", "border-left", "border-left-color", 469 | "border-left-style", "border-left-width", "border-radius", "border-right", 470 | "border-right-color", "border-right-style", "border-right-width", 471 | "border-spacing", "border-style", "border-top", "border-top-color", 472 | "border-top-left-radius", "border-top-right-radius", "border-top-style", 473 | "border-top-width", "border-width", "bottom", "box-decoration-break", 474 | "box-shadow", "box-sizing", "break-after", "break-before", "break-inside", 475 | "caption-side", "caret-color", "clear", "clip", "color", "color-profile", "column-count", 476 | "column-fill", "column-gap", "column-rule", "column-rule-color", 477 | "column-rule-style", "column-rule-width", "column-span", "column-width", 478 | "columns", "content", "counter-increment", "counter-reset", "crop", "cue", 479 | "cue-after", "cue-before", "cursor", "direction", "display", 480 | "dominant-baseline", "drop-initial-after-adjust", 481 | "drop-initial-after-align", "drop-initial-before-adjust", 482 | "drop-initial-before-align", "drop-initial-size", "drop-initial-value", 483 | "elevation", "empty-cells", "fit", "fit-position", "flex", "flex-basis", 484 | "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap", 485 | "float", "float-offset", "flow-from", "flow-into", "font", "font-feature-settings", 486 | "font-family", "font-kerning", "font-language-override", "font-size", "font-size-adjust", 487 | "font-stretch", "font-style", "font-synthesis", "font-variant", 488 | "font-variant-alternates", "font-variant-caps", "font-variant-east-asian", 489 | "font-variant-ligatures", "font-variant-numeric", "font-variant-position", 490 | "font-weight", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow", 491 | "grid-auto-rows", "grid-column", "grid-column-end", "grid-column-gap", 492 | "grid-column-start", "grid-gap", "grid-row", "grid-row-end", "grid-row-gap", 493 | "grid-row-start", "grid-template", "grid-template-areas", "grid-template-columns", 494 | "grid-template-rows", "hanging-punctuation", "height", "hyphens", 495 | "icon", "image-orientation", "image-rendering", "image-resolution", 496 | "inline-box-align", "justify-content", "justify-items", "justify-self", "left", "letter-spacing", 497 | "line-break", "line-height", "line-stacking", "line-stacking-ruby", 498 | "line-stacking-shift", "line-stacking-strategy", "list-style", 499 | "list-style-image", "list-style-position", "list-style-type", "margin", 500 | "margin-bottom", "margin-left", "margin-right", "margin-top", 501 | "marks", "marquee-direction", "marquee-loop", 502 | "marquee-play-count", "marquee-speed", "marquee-style", "max-height", 503 | "max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index", 504 | "nav-left", "nav-right", "nav-up", "object-fit", "object-position", 505 | "opacity", "order", "orphans", "outline", 506 | "outline-color", "outline-offset", "outline-style", "outline-width", 507 | "overflow", "overflow-style", "overflow-wrap", "overflow-x", "overflow-y", 508 | "padding", "padding-bottom", "padding-left", "padding-right", "padding-top", 509 | "page", "page-break-after", "page-break-before", "page-break-inside", 510 | "page-policy", "pause", "pause-after", "pause-before", "perspective", 511 | "perspective-origin", "pitch", "pitch-range", "place-content", "place-items", "place-self", "play-during", "position", 512 | "presentation-level", "punctuation-trim", "quotes", "region-break-after", 513 | "region-break-before", "region-break-inside", "region-fragment", 514 | "rendering-intent", "resize", "rest", "rest-after", "rest-before", "richness", 515 | "right", "rotation", "rotation-point", "ruby-align", "ruby-overhang", 516 | "ruby-position", "ruby-span", "shape-image-threshold", "shape-inside", "shape-margin", 517 | "shape-outside", "size", "speak", "speak-as", "speak-header", 518 | "speak-numeral", "speak-punctuation", "speech-rate", "stress", "string-set", 519 | "tab-size", "table-layout", "target", "target-name", "target-new", 520 | "target-position", "text-align", "text-align-last", "text-decoration", 521 | "text-decoration-color", "text-decoration-line", "text-decoration-skip", 522 | "text-decoration-style", "text-emphasis", "text-emphasis-color", 523 | "text-emphasis-position", "text-emphasis-style", "text-height", 524 | "text-indent", "text-justify", "text-outline", "text-overflow", "text-shadow", 525 | "text-size-adjust", "text-space-collapse", "text-transform", "text-underline-position", 526 | "text-wrap", "top", "transform", "transform-origin", "transform-style", 527 | "transition", "transition-delay", "transition-duration", 528 | "transition-property", "transition-timing-function", "unicode-bidi", 529 | "user-select", "vertical-align", "visibility", "voice-balance", "voice-duration", 530 | "voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress", 531 | "voice-volume", "volume", "white-space", "widows", "width", "will-change", "word-break", 532 | "word-spacing", "word-wrap", "z-index", 533 | // SVG-specific 534 | "clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color", 535 | "flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events", 536 | "color-interpolation", "color-interpolation-filters", 537 | "color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering", 538 | "marker", "marker-end", "marker-mid", "marker-start", "shape-rendering", "stroke", 539 | "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", 540 | "stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering", 541 | "baseline-shift", "dominant-baseline", "glyph-orientation-horizontal", 542 | "glyph-orientation-vertical", "text-anchor", "writing-mode" 543 | ], propertyKeywords = keySet(propertyKeywords_); 544 | 545 | var nonStandardPropertyKeywords_ = [ 546 | "scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color", 547 | "scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color", 548 | "scrollbar-3d-light-color", "scrollbar-track-color", "shape-inside", 549 | "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button", 550 | "searchfield-results-decoration", "zoom" 551 | ], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_); 552 | 553 | var fontProperties_ = [ 554 | "font-family", "src", "unicode-range", "font-variant", "font-feature-settings", 555 | "font-stretch", "font-weight", "font-style" 556 | ], fontProperties = keySet(fontProperties_); 557 | 558 | var counterDescriptors_ = [ 559 | "additive-symbols", "fallback", "negative", "pad", "prefix", "range", 560 | "speak-as", "suffix", "symbols", "system" 561 | ], counterDescriptors = keySet(counterDescriptors_); 562 | 563 | var colorKeywords_ = [ 564 | "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", 565 | "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", 566 | "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", 567 | "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", 568 | "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", 569 | "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", 570 | "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", 571 | "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", 572 | "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", 573 | "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", 574 | "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", 575 | "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", 576 | "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink", 577 | "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", 578 | "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", 579 | "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", 580 | "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", 581 | "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", 582 | "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", 583 | "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", 584 | "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", 585 | "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", 586 | "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", 587 | "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", 588 | "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", 589 | "whitesmoke", "yellow", "yellowgreen" 590 | ], colorKeywords = keySet(colorKeywords_); 591 | 592 | var valueKeywords_ = [ 593 | "above", "absolute", "activeborder", "additive", "activecaption", "afar", 594 | "after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate", 595 | "always", "amharic", "amharic-abegede", "antialiased", "appworkspace", 596 | "arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page", 597 | "avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary", 598 | "bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box", 599 | "both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel", 600 | "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian", 601 | "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", 602 | "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch", 603 | "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote", 604 | "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse", 605 | "compact", "condensed", "contain", "content", "contents", 606 | "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop", 607 | "cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal", 608 | "decimal-leading-zero", "default", "default-button", "dense", "destination-atop", 609 | "destination-in", "destination-out", "destination-over", "devanagari", "difference", 610 | "disc", "discard", "disclosure-closed", "disclosure-open", "document", 611 | "dot-dash", "dot-dot-dash", 612 | "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", 613 | "element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", 614 | "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er", 615 | "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", 616 | "ethiopic-halehame-aa-et", "ethiopic-halehame-am-et", 617 | "ethiopic-halehame-gez", "ethiopic-halehame-om-et", 618 | "ethiopic-halehame-sid-et", "ethiopic-halehame-so-et", 619 | "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", 620 | "ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed", 621 | "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes", 622 | "forwards", "from", "geometricPrecision", "georgian", "graytext", "grid", "groove", 623 | "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew", 624 | "help", "hidden", "hide", "higher", "highlight", "highlighttext", 625 | "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "icon", "ignore", 626 | "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", 627 | "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis", 628 | "inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert", 629 | "italic", "japanese-formal", "japanese-informal", "justify", "kannada", 630 | "katakana", "katakana-iroha", "keep-all", "khmer", 631 | "korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal", 632 | "landscape", "lao", "large", "larger", "left", "level", "lighter", "lighten", 633 | "line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem", 634 | "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian", 635 | "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian", 636 | "lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "match", "matrix", "matrix3d", 637 | "media-controls-background", "media-current-time-display", 638 | "media-fullscreen-button", "media-mute-button", "media-play-button", 639 | "media-return-to-realtime-button", "media-rewind-button", 640 | "media-seek-back-button", "media-seek-forward-button", "media-slider", 641 | "media-sliderthumb", "media-time-remaining-display", "media-volume-slider", 642 | "media-volume-slider-container", "media-volume-sliderthumb", "medium", 643 | "menu", "menulist", "menulist-button", "menulist-text", 644 | "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", 645 | "mix", "mongolian", "monospace", "move", "multiple", "multiply", "myanmar", "n-resize", 646 | "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", 647 | "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap", 648 | "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "opacity", "open-quote", 649 | "optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset", 650 | "outside", "outside-shape", "overlay", "overline", "padding", "padding-box", 651 | "painted", "page", "paused", "persian", "perspective", "plus-darker", "plus-lighter", 652 | "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", 653 | "progress", "push-button", "radial-gradient", "radio", "read-only", 654 | "read-write", "read-write-plaintext-only", "rectangle", "region", 655 | "relative", "repeat", "repeating-linear-gradient", 656 | "repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse", 657 | "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY", 658 | "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running", 659 | "s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen", 660 | "scroll", "scrollbar", "scroll-position", "se-resize", "searchfield", 661 | "searchfield-cancel-button", "searchfield-decoration", 662 | "searchfield-results-button", "searchfield-results-decoration", "self-start", "self-end", 663 | "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama", 664 | "simp-chinese-formal", "simp-chinese-informal", "single", 665 | "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal", 666 | "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow", 667 | "small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "somali", 668 | "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "space-evenly", "spell-out", "square", 669 | "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub", 670 | "subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table", 671 | "table-caption", "table-cell", "table-column", "table-column-group", 672 | "table-footer-group", "table-header-group", "table-row", "table-row-group", 673 | "tamil", 674 | "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai", 675 | "thick", "thin", "threeddarkshadow", "threedface", "threedhighlight", 676 | "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er", 677 | "tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top", 678 | "trad-chinese-formal", "trad-chinese-informal", "transform", 679 | "translate", "translate3d", "translateX", "translateY", "translateZ", 680 | "transparent", "ultra-condensed", "ultra-expanded", "underline", "unset", "up", 681 | "upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal", 682 | "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url", 683 | "var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted", 684 | "visibleStroke", "visual", "w-resize", "wait", "wave", "wider", 685 | "window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor", 686 | "xx-large", "xx-small" 687 | ], valueKeywords = keySet(valueKeywords_); 688 | 689 | var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_) 690 | .concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_) 691 | .concat(valueKeywords_); 692 | CodeMirror.registerHelper("hintWords", "css", allWords); 693 | 694 | function tokenCComment(stream, state) { 695 | var maybeEnd = false, ch; 696 | while ((ch = stream.next()) != null) { 697 | if (maybeEnd && ch == "/") { 698 | state.tokenize = null; 699 | break; 700 | } 701 | maybeEnd = (ch == "*"); 702 | } 703 | return ["comment", "comment"]; 704 | } 705 | 706 | CodeMirror.defineMIME("text/css", { 707 | documentTypes: documentTypes, 708 | mediaTypes: mediaTypes, 709 | mediaFeatures: mediaFeatures, 710 | mediaValueKeywords: mediaValueKeywords, 711 | propertyKeywords: propertyKeywords, 712 | nonStandardPropertyKeywords: nonStandardPropertyKeywords, 713 | fontProperties: fontProperties, 714 | counterDescriptors: counterDescriptors, 715 | colorKeywords: colorKeywords, 716 | valueKeywords: valueKeywords, 717 | tokenHooks: { 718 | "/": function(stream, state) { 719 | if (!stream.eat("*")) return false; 720 | state.tokenize = tokenCComment; 721 | return tokenCComment(stream, state); 722 | } 723 | }, 724 | name: "css" 725 | }); 726 | 727 | CodeMirror.defineMIME("text/x-scss", { 728 | mediaTypes: mediaTypes, 729 | mediaFeatures: mediaFeatures, 730 | mediaValueKeywords: mediaValueKeywords, 731 | propertyKeywords: propertyKeywords, 732 | nonStandardPropertyKeywords: nonStandardPropertyKeywords, 733 | colorKeywords: colorKeywords, 734 | valueKeywords: valueKeywords, 735 | fontProperties: fontProperties, 736 | allowNested: true, 737 | lineComment: "//", 738 | tokenHooks: { 739 | "/": function(stream, state) { 740 | if (stream.eat("/")) { 741 | stream.skipToEnd(); 742 | return ["comment", "comment"]; 743 | } else if (stream.eat("*")) { 744 | state.tokenize = tokenCComment; 745 | return tokenCComment(stream, state); 746 | } else { 747 | return ["operator", "operator"]; 748 | } 749 | }, 750 | ":": function(stream) { 751 | if (stream.match(/\s*\{/, false)) 752 | return [null, null] 753 | return false; 754 | }, 755 | "$": function(stream) { 756 | stream.match(/^[\w-]+/); 757 | if (stream.match(/^\s*:/, false)) 758 | return ["variable-2", "variable-definition"]; 759 | return ["variable-2", "variable"]; 760 | }, 761 | "#": function(stream) { 762 | if (!stream.eat("{")) return false; 763 | return [null, "interpolation"]; 764 | } 765 | }, 766 | name: "css", 767 | helperType: "scss" 768 | }); 769 | 770 | CodeMirror.defineMIME("text/x-less", { 771 | mediaTypes: mediaTypes, 772 | mediaFeatures: mediaFeatures, 773 | mediaValueKeywords: mediaValueKeywords, 774 | propertyKeywords: propertyKeywords, 775 | nonStandardPropertyKeywords: nonStandardPropertyKeywords, 776 | colorKeywords: colorKeywords, 777 | valueKeywords: valueKeywords, 778 | fontProperties: fontProperties, 779 | allowNested: true, 780 | lineComment: "//", 781 | tokenHooks: { 782 | "/": function(stream, state) { 783 | if (stream.eat("/")) { 784 | stream.skipToEnd(); 785 | return ["comment", "comment"]; 786 | } else if (stream.eat("*")) { 787 | state.tokenize = tokenCComment; 788 | return tokenCComment(stream, state); 789 | } else { 790 | return ["operator", "operator"]; 791 | } 792 | }, 793 | "@": function(stream) { 794 | if (stream.eat("{")) return [null, "interpolation"]; 795 | if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/, false)) return false; 796 | stream.eatWhile(/[\w\\\-]/); 797 | if (stream.match(/^\s*:/, false)) 798 | return ["variable-2", "variable-definition"]; 799 | return ["variable-2", "variable"]; 800 | }, 801 | "&": function() { 802 | return ["atom", "atom"]; 803 | } 804 | }, 805 | name: "css", 806 | helperType: "less" 807 | }); 808 | 809 | CodeMirror.defineMIME("text/x-gss", { 810 | documentTypes: documentTypes, 811 | mediaTypes: mediaTypes, 812 | mediaFeatures: mediaFeatures, 813 | propertyKeywords: propertyKeywords, 814 | nonStandardPropertyKeywords: nonStandardPropertyKeywords, 815 | fontProperties: fontProperties, 816 | counterDescriptors: counterDescriptors, 817 | colorKeywords: colorKeywords, 818 | valueKeywords: valueKeywords, 819 | supportsAtComponent: true, 820 | tokenHooks: { 821 | "/": function(stream, state) { 822 | if (!stream.eat("*")) return false; 823 | state.tokenize = tokenCComment; 824 | return tokenCComment(stream, state); 825 | } 826 | }, 827 | name: "css", 828 | helperType: "gss" 829 | }); 830 | 831 | }); 832 | -------------------------------------------------------------------------------- /js/codemirror/mode/htmlmixed/htmlmixed.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../xml/xml"), require("../javascript/javascript"), require("../css/css")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript", "../css/css"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | var defaultTags = { 15 | script: [ 16 | ["lang", /(javascript|babel)/i, "javascript"], 17 | ["type", /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i, "javascript"], 18 | ["type", /./, "text/plain"], 19 | [null, null, "javascript"] 20 | ], 21 | style: [ 22 | ["lang", /^css$/i, "css"], 23 | ["type", /^(text\/)?(x-)?(stylesheet|css)$/i, "css"], 24 | ["type", /./, "text/plain"], 25 | [null, null, "css"] 26 | ] 27 | }; 28 | 29 | function maybeBackup(stream, pat, style) { 30 | var cur = stream.current(), close = cur.search(pat); 31 | if (close > -1) { 32 | stream.backUp(cur.length - close); 33 | } else if (cur.match(/<\/?$/)) { 34 | stream.backUp(cur.length); 35 | if (!stream.match(pat, false)) stream.match(cur); 36 | } 37 | return style; 38 | } 39 | 40 | var attrRegexpCache = {}; 41 | function getAttrRegexp(attr) { 42 | var regexp = attrRegexpCache[attr]; 43 | if (regexp) return regexp; 44 | return attrRegexpCache[attr] = new RegExp("\\s+" + attr + "\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*"); 45 | } 46 | 47 | function getAttrValue(text, attr) { 48 | var match = text.match(getAttrRegexp(attr)) 49 | return match ? /^\s*(.*?)\s*$/.exec(match[2])[1] : "" 50 | } 51 | 52 | function getTagRegexp(tagName, anchored) { 53 | return new RegExp((anchored ? "^" : "") + "<\/\s*" + tagName + "\s*>", "i"); 54 | } 55 | 56 | function addTags(from, to) { 57 | for (var tag in from) { 58 | var dest = to[tag] || (to[tag] = []); 59 | var source = from[tag]; 60 | for (var i = source.length - 1; i >= 0; i--) 61 | dest.unshift(source[i]) 62 | } 63 | } 64 | 65 | function findMatchingMode(tagInfo, tagText) { 66 | for (var i = 0; i < tagInfo.length; i++) { 67 | var spec = tagInfo[i]; 68 | if (!spec[0] || spec[1].test(getAttrValue(tagText, spec[0]))) return spec[2]; 69 | } 70 | } 71 | 72 | CodeMirror.defineMode("htmlmixed", function (config, parserConfig) { 73 | var htmlMode = CodeMirror.getMode(config, { 74 | name: "xml", 75 | htmlMode: true, 76 | multilineTagIndentFactor: parserConfig.multilineTagIndentFactor, 77 | multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag 78 | }); 79 | 80 | var tags = {}; 81 | var configTags = parserConfig && parserConfig.tags, configScript = parserConfig && parserConfig.scriptTypes; 82 | addTags(defaultTags, tags); 83 | if (configTags) addTags(configTags, tags); 84 | if (configScript) for (var i = configScript.length - 1; i >= 0; i--) 85 | tags.script.unshift(["type", configScript[i].matches, configScript[i].mode]) 86 | 87 | function html(stream, state) { 88 | var style = htmlMode.token(stream, state.htmlState), tag = /\btag\b/.test(style), tagName 89 | if (tag && !/[<>\s\/]/.test(stream.current()) && 90 | (tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase()) && 91 | tags.hasOwnProperty(tagName)) { 92 | state.inTag = tagName + " " 93 | } else if (state.inTag && tag && />$/.test(stream.current())) { 94 | var inTag = /^([\S]+) (.*)/.exec(state.inTag) 95 | state.inTag = null 96 | var modeSpec = stream.current() == ">" && findMatchingMode(tags[inTag[1]], inTag[2]) 97 | var mode = CodeMirror.getMode(config, modeSpec) 98 | var endTagA = getTagRegexp(inTag[1], true), endTag = getTagRegexp(inTag[1], false); 99 | state.token = function (stream, state) { 100 | if (stream.match(endTagA, false)) { 101 | state.token = html; 102 | state.localState = state.localMode = null; 103 | return null; 104 | } 105 | return maybeBackup(stream, endTag, state.localMode.token(stream, state.localState)); 106 | }; 107 | state.localMode = mode; 108 | state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, "")); 109 | } else if (state.inTag) { 110 | state.inTag += stream.current() 111 | if (stream.eol()) state.inTag += " " 112 | } 113 | return style; 114 | }; 115 | 116 | return { 117 | startState: function () { 118 | var state = CodeMirror.startState(htmlMode); 119 | return {token: html, inTag: null, localMode: null, localState: null, htmlState: state}; 120 | }, 121 | 122 | copyState: function (state) { 123 | var local; 124 | if (state.localState) { 125 | local = CodeMirror.copyState(state.localMode, state.localState); 126 | } 127 | return {token: state.token, inTag: state.inTag, 128 | localMode: state.localMode, localState: local, 129 | htmlState: CodeMirror.copyState(htmlMode, state.htmlState)}; 130 | }, 131 | 132 | token: function (stream, state) { 133 | return state.token(stream, state); 134 | }, 135 | 136 | indent: function (state, textAfter, line) { 137 | if (!state.localMode || /^\s*<\//.test(textAfter)) 138 | return htmlMode.indent(state.htmlState, textAfter); 139 | else if (state.localMode.indent) 140 | return state.localMode.indent(state.localState, textAfter, line); 141 | else 142 | return CodeMirror.Pass; 143 | }, 144 | 145 | innerMode: function (state) { 146 | return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode}; 147 | } 148 | }; 149 | }, "xml", "javascript", "css"); 150 | 151 | CodeMirror.defineMIME("text/html", "htmlmixed"); 152 | }); 153 | -------------------------------------------------------------------------------- /js/codemirror/mode/javascript/javascript.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineMode("javascript", function(config, parserConfig) { 15 | var indentUnit = config.indentUnit; 16 | var statementIndent = parserConfig.statementIndent; 17 | var jsonldMode = parserConfig.jsonld; 18 | var jsonMode = parserConfig.json || jsonldMode; 19 | var isTS = parserConfig.typescript; 20 | var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/; 21 | 22 | // Tokenizer 23 | 24 | var keywords = function(){ 25 | function kw(type) {return {type: type, style: "keyword"};} 26 | var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"); 27 | var operator = kw("operator"), atom = {type: "atom", style: "atom"}; 28 | 29 | var jsKeywords = { 30 | "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B, 31 | "return": C, "break": C, "continue": C, "new": kw("new"), "delete": C, "void": C, "throw": C, "debugger": C, 32 | "var": kw("var"), "const": kw("var"), "let": kw("var"), 33 | "function": kw("function"), "catch": kw("catch"), 34 | "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"), 35 | "in": operator, "typeof": operator, "instanceof": operator, 36 | "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom, 37 | "this": kw("this"), "class": kw("class"), "super": kw("atom"), 38 | "yield": C, "export": kw("export"), "import": kw("import"), "extends": C, 39 | "await": C 40 | }; 41 | 42 | // Extend the 'normal' keywords with the TypeScript language extensions 43 | if (isTS) { 44 | var type = {type: "variable", style: "type"}; 45 | var tsKeywords = { 46 | // object-like things 47 | "interface": kw("class"), 48 | "implements": C, 49 | "namespace": C, 50 | "module": kw("module"), 51 | "enum": kw("module"), 52 | 53 | // scope modifiers 54 | "public": kw("modifier"), 55 | "private": kw("modifier"), 56 | "protected": kw("modifier"), 57 | "abstract": kw("modifier"), 58 | "readonly": kw("modifier"), 59 | 60 | // types 61 | "string": type, "number": type, "boolean": type, "any": type 62 | }; 63 | 64 | for (var attr in tsKeywords) { 65 | jsKeywords[attr] = tsKeywords[attr]; 66 | } 67 | } 68 | 69 | return jsKeywords; 70 | }(); 71 | 72 | var isOperatorChar = /[+\-*&%=<>!?|~^@]/; 73 | var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/; 74 | 75 | function readRegexp(stream) { 76 | var escaped = false, next, inSet = false; 77 | while ((next = stream.next()) != null) { 78 | if (!escaped) { 79 | if (next == "/" && !inSet) return; 80 | if (next == "[") inSet = true; 81 | else if (inSet && next == "]") inSet = false; 82 | } 83 | escaped = !escaped && next == "\\"; 84 | } 85 | } 86 | 87 | // Used as scratch variables to communicate multiple values without 88 | // consing up tons of objects. 89 | var type, content; 90 | function ret(tp, style, cont) { 91 | type = tp; content = cont; 92 | return style; 93 | } 94 | function tokenBase(stream, state) { 95 | var ch = stream.next(); 96 | if (ch == '"' || ch == "'") { 97 | state.tokenize = tokenString(ch); 98 | return state.tokenize(stream, state); 99 | } else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) { 100 | return ret("number", "number"); 101 | } else if (ch == "." && stream.match("..")) { 102 | return ret("spread", "meta"); 103 | } else if (/[\[\]{}\(\),;\:\.]/.test(ch)) { 104 | return ret(ch); 105 | } else if (ch == "=" && stream.eat(">")) { 106 | return ret("=>", "operator"); 107 | } else if (ch == "0" && stream.eat(/x/i)) { 108 | stream.eatWhile(/[\da-f]/i); 109 | return ret("number", "number"); 110 | } else if (ch == "0" && stream.eat(/o/i)) { 111 | stream.eatWhile(/[0-7]/i); 112 | return ret("number", "number"); 113 | } else if (ch == "0" && stream.eat(/b/i)) { 114 | stream.eatWhile(/[01]/i); 115 | return ret("number", "number"); 116 | } else if (/\d/.test(ch)) { 117 | stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/); 118 | return ret("number", "number"); 119 | } else if (ch == "/") { 120 | if (stream.eat("*")) { 121 | state.tokenize = tokenComment; 122 | return tokenComment(stream, state); 123 | } else if (stream.eat("/")) { 124 | stream.skipToEnd(); 125 | return ret("comment", "comment"); 126 | } else if (expressionAllowed(stream, state, 1)) { 127 | readRegexp(stream); 128 | stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/); 129 | return ret("regexp", "string-2"); 130 | } else { 131 | stream.eatWhile(isOperatorChar); 132 | return ret("operator", "operator", stream.current()); 133 | } 134 | } else if (ch == "`") { 135 | state.tokenize = tokenQuasi; 136 | return tokenQuasi(stream, state); 137 | } else if (ch == "#") { 138 | stream.skipToEnd(); 139 | return ret("error", "error"); 140 | } else if (isOperatorChar.test(ch)) { 141 | if (ch != ">" || !state.lexical || state.lexical.type != ">") 142 | stream.eatWhile(isOperatorChar); 143 | return ret("operator", "operator", stream.current()); 144 | } else if (wordRE.test(ch)) { 145 | stream.eatWhile(wordRE); 146 | var word = stream.current() 147 | if (state.lastType != ".") { 148 | if (keywords.propertyIsEnumerable(word)) { 149 | var kw = keywords[word] 150 | return ret(kw.type, kw.style, word) 151 | } 152 | if (word == "async" && stream.match(/^\s*[\(\w]/, false)) 153 | return ret("async", "keyword", word) 154 | } 155 | return ret("variable", "variable", word) 156 | } 157 | } 158 | 159 | function tokenString(quote) { 160 | return function(stream, state) { 161 | var escaped = false, next; 162 | if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){ 163 | state.tokenize = tokenBase; 164 | return ret("jsonld-keyword", "meta"); 165 | } 166 | while ((next = stream.next()) != null) { 167 | if (next == quote && !escaped) break; 168 | escaped = !escaped && next == "\\"; 169 | } 170 | if (!escaped) state.tokenize = tokenBase; 171 | return ret("string", "string"); 172 | }; 173 | } 174 | 175 | function tokenComment(stream, state) { 176 | var maybeEnd = false, ch; 177 | while (ch = stream.next()) { 178 | if (ch == "/" && maybeEnd) { 179 | state.tokenize = tokenBase; 180 | break; 181 | } 182 | maybeEnd = (ch == "*"); 183 | } 184 | return ret("comment", "comment"); 185 | } 186 | 187 | function tokenQuasi(stream, state) { 188 | var escaped = false, next; 189 | while ((next = stream.next()) != null) { 190 | if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) { 191 | state.tokenize = tokenBase; 192 | break; 193 | } 194 | escaped = !escaped && next == "\\"; 195 | } 196 | return ret("quasi", "string-2", stream.current()); 197 | } 198 | 199 | var brackets = "([{}])"; 200 | // This is a crude lookahead trick to try and notice that we're 201 | // parsing the argument patterns for a fat-arrow function before we 202 | // actually hit the arrow token. It only works if the arrow is on 203 | // the same line as the arguments and there's no strange noise 204 | // (comments) in between. Fallback is to only notice when we hit the 205 | // arrow, and not declare the arguments as locals for the arrow 206 | // body. 207 | function findFatArrow(stream, state) { 208 | if (state.fatArrowAt) state.fatArrowAt = null; 209 | var arrow = stream.string.indexOf("=>", stream.start); 210 | if (arrow < 0) return; 211 | 212 | if (isTS) { // Try to skip TypeScript return type declarations after the arguments 213 | var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow)) 214 | if (m) arrow = m.index 215 | } 216 | 217 | var depth = 0, sawSomething = false; 218 | for (var pos = arrow - 1; pos >= 0; --pos) { 219 | var ch = stream.string.charAt(pos); 220 | var bracket = brackets.indexOf(ch); 221 | if (bracket >= 0 && bracket < 3) { 222 | if (!depth) { ++pos; break; } 223 | if (--depth == 0) { if (ch == "(") sawSomething = true; break; } 224 | } else if (bracket >= 3 && bracket < 6) { 225 | ++depth; 226 | } else if (wordRE.test(ch)) { 227 | sawSomething = true; 228 | } else if (/["'\/]/.test(ch)) { 229 | return; 230 | } else if (sawSomething && !depth) { 231 | ++pos; 232 | break; 233 | } 234 | } 235 | if (sawSomething && !depth) state.fatArrowAt = pos; 236 | } 237 | 238 | // Parser 239 | 240 | var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true}; 241 | 242 | function JSLexical(indented, column, type, align, prev, info) { 243 | this.indented = indented; 244 | this.column = column; 245 | this.type = type; 246 | this.prev = prev; 247 | this.info = info; 248 | if (align != null) this.align = align; 249 | } 250 | 251 | function inScope(state, varname) { 252 | for (var v = state.localVars; v; v = v.next) 253 | if (v.name == varname) return true; 254 | for (var cx = state.context; cx; cx = cx.prev) { 255 | for (var v = cx.vars; v; v = v.next) 256 | if (v.name == varname) return true; 257 | } 258 | } 259 | 260 | function parseJS(state, style, type, content, stream) { 261 | var cc = state.cc; 262 | // Communicate our context to the combinators. 263 | // (Less wasteful than consing up a hundred closures on every call.) 264 | cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style; 265 | 266 | if (!state.lexical.hasOwnProperty("align")) 267 | state.lexical.align = true; 268 | 269 | while(true) { 270 | var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement; 271 | if (combinator(type, content)) { 272 | while(cc.length && cc[cc.length - 1].lex) 273 | cc.pop()(); 274 | if (cx.marked) return cx.marked; 275 | if (type == "variable" && inScope(state, content)) return "variable-2"; 276 | return style; 277 | } 278 | } 279 | } 280 | 281 | // Combinator utils 282 | 283 | var cx = {state: null, column: null, marked: null, cc: null}; 284 | function pass() { 285 | for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]); 286 | } 287 | function cont() { 288 | pass.apply(null, arguments); 289 | return true; 290 | } 291 | function register(varname) { 292 | function inList(list) { 293 | for (var v = list; v; v = v.next) 294 | if (v.name == varname) return true; 295 | return false; 296 | } 297 | var state = cx.state; 298 | cx.marked = "def"; 299 | if (state.context) { 300 | if (inList(state.localVars)) return; 301 | state.localVars = {name: varname, next: state.localVars}; 302 | } else { 303 | if (inList(state.globalVars)) return; 304 | if (parserConfig.globalVars) 305 | state.globalVars = {name: varname, next: state.globalVars}; 306 | } 307 | } 308 | 309 | // Combinators 310 | 311 | var defaultVars = {name: "this", next: {name: "arguments"}}; 312 | function pushcontext() { 313 | cx.state.context = {prev: cx.state.context, vars: cx.state.localVars}; 314 | cx.state.localVars = defaultVars; 315 | } 316 | function popcontext() { 317 | cx.state.localVars = cx.state.context.vars; 318 | cx.state.context = cx.state.context.prev; 319 | } 320 | function pushlex(type, info) { 321 | var result = function() { 322 | var state = cx.state, indent = state.indented; 323 | if (state.lexical.type == "stat") indent = state.lexical.indented; 324 | else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev) 325 | indent = outer.indented; 326 | state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info); 327 | }; 328 | result.lex = true; 329 | return result; 330 | } 331 | function poplex() { 332 | var state = cx.state; 333 | if (state.lexical.prev) { 334 | if (state.lexical.type == ")") 335 | state.indented = state.lexical.indented; 336 | state.lexical = state.lexical.prev; 337 | } 338 | } 339 | poplex.lex = true; 340 | 341 | function expect(wanted) { 342 | function exp(type) { 343 | if (type == wanted) return cont(); 344 | else if (wanted == ";") return pass(); 345 | else return cont(exp); 346 | }; 347 | return exp; 348 | } 349 | 350 | function statement(type, value) { 351 | if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex); 352 | if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex); 353 | if (type == "keyword b") return cont(pushlex("form"), statement, poplex); 354 | if (type == "{") return cont(pushlex("}"), block, poplex); 355 | if (type == ";") return cont(); 356 | if (type == "if") { 357 | if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex) 358 | cx.state.cc.pop()(); 359 | return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse); 360 | } 361 | if (type == "function") return cont(functiondef); 362 | if (type == "for") return cont(pushlex("form"), forspec, statement, poplex); 363 | if (type == "variable") { 364 | if (isTS && value == "type") { 365 | cx.marked = "keyword" 366 | return cont(typeexpr, expect("operator"), typeexpr, expect(";")); 367 | } if (isTS && value == "declare") { 368 | cx.marked = "keyword" 369 | return cont(statement) 370 | } else { 371 | return cont(pushlex("stat"), maybelabel); 372 | } 373 | } 374 | if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"), 375 | block, poplex, poplex); 376 | if (type == "case") return cont(expression, expect(":")); 377 | if (type == "default") return cont(expect(":")); 378 | if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"), 379 | statement, poplex, popcontext); 380 | if (type == "class") return cont(pushlex("form"), className, poplex); 381 | if (type == "export") return cont(pushlex("stat"), afterExport, poplex); 382 | if (type == "import") return cont(pushlex("stat"), afterImport, poplex); 383 | if (type == "module") return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex) 384 | if (type == "async") return cont(statement) 385 | if (value == "@") return cont(expression, statement) 386 | return pass(pushlex("stat"), expression, expect(";"), poplex); 387 | } 388 | function expression(type) { 389 | return expressionInner(type, false); 390 | } 391 | function expressionNoComma(type) { 392 | return expressionInner(type, true); 393 | } 394 | function parenExpr(type) { 395 | if (type != "(") return pass() 396 | return cont(pushlex(")"), expression, expect(")"), poplex) 397 | } 398 | function expressionInner(type, noComma) { 399 | if (cx.state.fatArrowAt == cx.stream.start) { 400 | var body = noComma ? arrowBodyNoComma : arrowBody; 401 | if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, expect("=>"), body, popcontext); 402 | else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext); 403 | } 404 | 405 | var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma; 406 | if (atomicTypes.hasOwnProperty(type)) return cont(maybeop); 407 | if (type == "function") return cont(functiondef, maybeop); 408 | if (type == "class") return cont(pushlex("form"), classExpression, poplex); 409 | if (type == "keyword c" || type == "async") return cont(noComma ? maybeexpressionNoComma : maybeexpression); 410 | if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop); 411 | if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression); 412 | if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop); 413 | if (type == "{") return contCommasep(objprop, "}", null, maybeop); 414 | if (type == "quasi") return pass(quasi, maybeop); 415 | if (type == "new") return cont(maybeTarget(noComma)); 416 | return cont(); 417 | } 418 | function maybeexpression(type) { 419 | if (type.match(/[;\}\)\],]/)) return pass(); 420 | return pass(expression); 421 | } 422 | function maybeexpressionNoComma(type) { 423 | if (type.match(/[;\}\)\],]/)) return pass(); 424 | return pass(expressionNoComma); 425 | } 426 | 427 | function maybeoperatorComma(type, value) { 428 | if (type == ",") return cont(expression); 429 | return maybeoperatorNoComma(type, value, false); 430 | } 431 | function maybeoperatorNoComma(type, value, noComma) { 432 | var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma; 433 | var expr = noComma == false ? expression : expressionNoComma; 434 | if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext); 435 | if (type == "operator") { 436 | if (/\+\+|--/.test(value) || isTS && value == "!") return cont(me); 437 | if (value == "?") return cont(expression, expect(":"), expr); 438 | return cont(expr); 439 | } 440 | if (type == "quasi") { return pass(quasi, me); } 441 | if (type == ";") return; 442 | if (type == "(") return contCommasep(expressionNoComma, ")", "call", me); 443 | if (type == ".") return cont(property, me); 444 | if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me); 445 | if (isTS && value == "as") { cx.marked = "keyword"; return cont(typeexpr, me) } 446 | if (type == "regexp") { 447 | cx.state.lastType = cx.marked = "operator" 448 | cx.stream.backUp(cx.stream.pos - cx.stream.start - 1) 449 | return cont(expr) 450 | } 451 | } 452 | function quasi(type, value) { 453 | if (type != "quasi") return pass(); 454 | if (value.slice(value.length - 2) != "${") return cont(quasi); 455 | return cont(expression, continueQuasi); 456 | } 457 | function continueQuasi(type) { 458 | if (type == "}") { 459 | cx.marked = "string-2"; 460 | cx.state.tokenize = tokenQuasi; 461 | return cont(quasi); 462 | } 463 | } 464 | function arrowBody(type) { 465 | findFatArrow(cx.stream, cx.state); 466 | return pass(type == "{" ? statement : expression); 467 | } 468 | function arrowBodyNoComma(type) { 469 | findFatArrow(cx.stream, cx.state); 470 | return pass(type == "{" ? statement : expressionNoComma); 471 | } 472 | function maybeTarget(noComma) { 473 | return function(type) { 474 | if (type == ".") return cont(noComma ? targetNoComma : target); 475 | else if (type == "variable" && isTS) return cont(maybeTypeArgs, noComma ? maybeoperatorNoComma : maybeoperatorComma) 476 | else return pass(noComma ? expressionNoComma : expression); 477 | }; 478 | } 479 | function target(_, value) { 480 | if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); } 481 | } 482 | function targetNoComma(_, value) { 483 | if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); } 484 | } 485 | function maybelabel(type) { 486 | if (type == ":") return cont(poplex, statement); 487 | return pass(maybeoperatorComma, expect(";"), poplex); 488 | } 489 | function property(type) { 490 | if (type == "variable") {cx.marked = "property"; return cont();} 491 | } 492 | function objprop(type, value) { 493 | if (type == "async") { 494 | cx.marked = "property"; 495 | return cont(objprop); 496 | } else if (type == "variable" || cx.style == "keyword") { 497 | cx.marked = "property"; 498 | if (value == "get" || value == "set") return cont(getterSetter); 499 | var m // Work around fat-arrow-detection complication for detecting typescript typed arrow params 500 | if (isTS && cx.state.fatArrowAt == cx.stream.start && (m = cx.stream.match(/^\s*:\s*/, false))) 501 | cx.state.fatArrowAt = cx.stream.pos + m[0].length 502 | return cont(afterprop); 503 | } else if (type == "number" || type == "string") { 504 | cx.marked = jsonldMode ? "property" : (cx.style + " property"); 505 | return cont(afterprop); 506 | } else if (type == "jsonld-keyword") { 507 | return cont(afterprop); 508 | } else if (type == "modifier") { 509 | return cont(objprop) 510 | } else if (type == "[") { 511 | return cont(expression, expect("]"), afterprop); 512 | } else if (type == "spread") { 513 | return cont(expression, afterprop); 514 | } else if (type == ":") { 515 | return pass(afterprop) 516 | } 517 | } 518 | function getterSetter(type) { 519 | if (type != "variable") return pass(afterprop); 520 | cx.marked = "property"; 521 | return cont(functiondef); 522 | } 523 | function afterprop(type) { 524 | if (type == ":") return cont(expressionNoComma); 525 | if (type == "(") return pass(functiondef); 526 | } 527 | function commasep(what, end, sep) { 528 | function proceed(type, value) { 529 | if (sep ? sep.indexOf(type) > -1 : type == ",") { 530 | var lex = cx.state.lexical; 531 | if (lex.info == "call") lex.pos = (lex.pos || 0) + 1; 532 | return cont(function(type, value) { 533 | if (type == end || value == end) return pass() 534 | return pass(what) 535 | }, proceed); 536 | } 537 | if (type == end || value == end) return cont(); 538 | return cont(expect(end)); 539 | } 540 | return function(type, value) { 541 | if (type == end || value == end) return cont(); 542 | return pass(what, proceed); 543 | }; 544 | } 545 | function contCommasep(what, end, info) { 546 | for (var i = 3; i < arguments.length; i++) 547 | cx.cc.push(arguments[i]); 548 | return cont(pushlex(end, info), commasep(what, end), poplex); 549 | } 550 | function block(type) { 551 | if (type == "}") return cont(); 552 | return pass(statement, block); 553 | } 554 | function maybetype(type, value) { 555 | if (isTS) { 556 | if (type == ":") return cont(typeexpr); 557 | if (value == "?") return cont(maybetype); 558 | } 559 | } 560 | function typeexpr(type, value) { 561 | if (type == "variable" || value == "void") { 562 | if (value == "keyof") { 563 | cx.marked = "keyword" 564 | return cont(typeexpr) 565 | } else { 566 | cx.marked = "type" 567 | return cont(afterType) 568 | } 569 | } 570 | if (type == "string" || type == "number" || type == "atom") return cont(afterType); 571 | if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType) 572 | if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType) 573 | if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType) 574 | } 575 | function maybeReturnType(type) { 576 | if (type == "=>") return cont(typeexpr) 577 | } 578 | function typeprop(type, value) { 579 | if (type == "variable" || cx.style == "keyword") { 580 | cx.marked = "property" 581 | return cont(typeprop) 582 | } else if (value == "?") { 583 | return cont(typeprop) 584 | } else if (type == ":") { 585 | return cont(typeexpr) 586 | } else if (type == "[") { 587 | return cont(expression, maybetype, expect("]"), typeprop) 588 | } 589 | } 590 | function typearg(type) { 591 | if (type == "variable") return cont(typearg) 592 | else if (type == ":") return cont(typeexpr) 593 | } 594 | function afterType(type, value) { 595 | if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType) 596 | if (value == "|" || type == ".") return cont(typeexpr) 597 | if (type == "[") return cont(expect("]"), afterType) 598 | if (value == "extends") return cont(typeexpr) 599 | } 600 | function maybeTypeArgs(_, value) { 601 | if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType) 602 | } 603 | function vardef() { 604 | return pass(pattern, maybetype, maybeAssign, vardefCont); 605 | } 606 | function pattern(type, value) { 607 | if (type == "modifier") return cont(pattern) 608 | if (type == "variable") { register(value); return cont(); } 609 | if (type == "spread") return cont(pattern); 610 | if (type == "[") return contCommasep(pattern, "]"); 611 | if (type == "{") return contCommasep(proppattern, "}"); 612 | } 613 | function proppattern(type, value) { 614 | if (type == "variable" && !cx.stream.match(/^\s*:/, false)) { 615 | register(value); 616 | return cont(maybeAssign); 617 | } 618 | if (type == "variable") cx.marked = "property"; 619 | if (type == "spread") return cont(pattern); 620 | if (type == "}") return pass(); 621 | return cont(expect(":"), pattern, maybeAssign); 622 | } 623 | function maybeAssign(_type, value) { 624 | if (value == "=") return cont(expressionNoComma); 625 | } 626 | function vardefCont(type) { 627 | if (type == ",") return cont(vardef); 628 | } 629 | function maybeelse(type, value) { 630 | if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex); 631 | } 632 | function forspec(type) { 633 | if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex); 634 | } 635 | function forspec1(type) { 636 | if (type == "var") return cont(vardef, expect(";"), forspec2); 637 | if (type == ";") return cont(forspec2); 638 | if (type == "variable") return cont(formaybeinof); 639 | return pass(expression, expect(";"), forspec2); 640 | } 641 | function formaybeinof(_type, value) { 642 | if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); } 643 | return cont(maybeoperatorComma, forspec2); 644 | } 645 | function forspec2(type, value) { 646 | if (type == ";") return cont(forspec3); 647 | if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); } 648 | return pass(expression, expect(";"), forspec3); 649 | } 650 | function forspec3(type) { 651 | if (type != ")") cont(expression); 652 | } 653 | function functiondef(type, value) { 654 | if (value == "*") {cx.marked = "keyword"; return cont(functiondef);} 655 | if (type == "variable") {register(value); return cont(functiondef);} 656 | if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, maybetype, statement, popcontext); 657 | if (isTS && value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, functiondef) 658 | } 659 | function funarg(type, value) { 660 | if (value == "@") cont(expression, funarg) 661 | if (type == "spread" || type == "modifier") return cont(funarg); 662 | return pass(pattern, maybetype, maybeAssign); 663 | } 664 | function classExpression(type, value) { 665 | // Class expressions may have an optional name. 666 | if (type == "variable") return className(type, value); 667 | return classNameAfter(type, value); 668 | } 669 | function className(type, value) { 670 | if (type == "variable") {register(value); return cont(classNameAfter);} 671 | } 672 | function classNameAfter(type, value) { 673 | if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, classNameAfter) 674 | if (value == "extends" || value == "implements" || (isTS && type == ",")) 675 | return cont(isTS ? typeexpr : expression, classNameAfter); 676 | if (type == "{") return cont(pushlex("}"), classBody, poplex); 677 | } 678 | function classBody(type, value) { 679 | if (type == "modifier" || type == "async" || 680 | (type == "variable" && 681 | (value == "static" || value == "get" || value == "set") && 682 | cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false))) { 683 | cx.marked = "keyword"; 684 | return cont(classBody); 685 | } 686 | if (type == "variable" || cx.style == "keyword") { 687 | cx.marked = "property"; 688 | return cont(isTS ? classfield : functiondef, classBody); 689 | } 690 | if (type == "[") 691 | return cont(expression, expect("]"), isTS ? classfield : functiondef, classBody) 692 | if (value == "*") { 693 | cx.marked = "keyword"; 694 | return cont(classBody); 695 | } 696 | if (type == ";") return cont(classBody); 697 | if (type == "}") return cont(); 698 | if (value == "@") return cont(expression, classBody) 699 | } 700 | function classfield(type, value) { 701 | if (value == "?") return cont(classfield) 702 | if (type == ":") return cont(typeexpr, maybeAssign) 703 | if (value == "=") return cont(expressionNoComma) 704 | return pass(functiondef) 705 | } 706 | function afterExport(type, value) { 707 | if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); } 708 | if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); } 709 | if (type == "{") return cont(commasep(exportField, "}"), maybeFrom, expect(";")); 710 | return pass(statement); 711 | } 712 | function exportField(type, value) { 713 | if (value == "as") { cx.marked = "keyword"; return cont(expect("variable")); } 714 | if (type == "variable") return pass(expressionNoComma, exportField); 715 | } 716 | function afterImport(type) { 717 | if (type == "string") return cont(); 718 | return pass(importSpec, maybeMoreImports, maybeFrom); 719 | } 720 | function importSpec(type, value) { 721 | if (type == "{") return contCommasep(importSpec, "}"); 722 | if (type == "variable") register(value); 723 | if (value == "*") cx.marked = "keyword"; 724 | return cont(maybeAs); 725 | } 726 | function maybeMoreImports(type) { 727 | if (type == ",") return cont(importSpec, maybeMoreImports) 728 | } 729 | function maybeAs(_type, value) { 730 | if (value == "as") { cx.marked = "keyword"; return cont(importSpec); } 731 | } 732 | function maybeFrom(_type, value) { 733 | if (value == "from") { cx.marked = "keyword"; return cont(expression); } 734 | } 735 | function arrayLiteral(type) { 736 | if (type == "]") return cont(); 737 | return pass(commasep(expressionNoComma, "]")); 738 | } 739 | 740 | function isContinuedStatement(state, textAfter) { 741 | return state.lastType == "operator" || state.lastType == "," || 742 | isOperatorChar.test(textAfter.charAt(0)) || 743 | /[,.]/.test(textAfter.charAt(0)); 744 | } 745 | 746 | function expressionAllowed(stream, state, backUp) { 747 | return state.tokenize == tokenBase && 748 | /^(?:operator|sof|keyword [bc]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(state.lastType) || 749 | (state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0)))) 750 | } 751 | 752 | // Interface 753 | 754 | return { 755 | startState: function(basecolumn) { 756 | var state = { 757 | tokenize: tokenBase, 758 | lastType: "sof", 759 | cc: [], 760 | lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false), 761 | localVars: parserConfig.localVars, 762 | context: parserConfig.localVars && {vars: parserConfig.localVars}, 763 | indented: basecolumn || 0 764 | }; 765 | if (parserConfig.globalVars && typeof parserConfig.globalVars == "object") 766 | state.globalVars = parserConfig.globalVars; 767 | return state; 768 | }, 769 | 770 | token: function(stream, state) { 771 | if (stream.sol()) { 772 | if (!state.lexical.hasOwnProperty("align")) 773 | state.lexical.align = false; 774 | state.indented = stream.indentation(); 775 | findFatArrow(stream, state); 776 | } 777 | if (state.tokenize != tokenComment && stream.eatSpace()) return null; 778 | var style = state.tokenize(stream, state); 779 | if (type == "comment") return style; 780 | state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type; 781 | return parseJS(state, style, type, content, stream); 782 | }, 783 | 784 | indent: function(state, textAfter) { 785 | if (state.tokenize == tokenComment) return CodeMirror.Pass; 786 | if (state.tokenize != tokenBase) return 0; 787 | var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top 788 | // Kludge to prevent 'maybelse' from blocking lexical scope pops 789 | if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) { 790 | var c = state.cc[i]; 791 | if (c == poplex) lexical = lexical.prev; 792 | else if (c != maybeelse) break; 793 | } 794 | while ((lexical.type == "stat" || lexical.type == "form") && 795 | (firstChar == "}" || ((top = state.cc[state.cc.length - 1]) && 796 | (top == maybeoperatorComma || top == maybeoperatorNoComma) && 797 | !/^[,\.=+\-*:?[\(]/.test(textAfter)))) 798 | lexical = lexical.prev; 799 | if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat") 800 | lexical = lexical.prev; 801 | var type = lexical.type, closing = firstChar == type; 802 | 803 | if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0); 804 | else if (type == "form" && firstChar == "{") return lexical.indented; 805 | else if (type == "form") return lexical.indented + indentUnit; 806 | else if (type == "stat") 807 | return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0); 808 | else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false) 809 | return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit); 810 | else if (lexical.align) return lexical.column + (closing ? 0 : 1); 811 | else return lexical.indented + (closing ? 0 : indentUnit); 812 | }, 813 | 814 | electricInput: /^\s*(?:case .*?:|default:|\{|\})$/, 815 | blockCommentStart: jsonMode ? null : "/*", 816 | blockCommentEnd: jsonMode ? null : "*/", 817 | lineComment: jsonMode ? null : "//", 818 | fold: "brace", 819 | closeBrackets: "()[]{}''\"\"``", 820 | 821 | helperType: jsonMode ? "json" : "javascript", 822 | jsonldMode: jsonldMode, 823 | jsonMode: jsonMode, 824 | 825 | expressionAllowed: expressionAllowed, 826 | 827 | skipExpression: function(state) { 828 | var top = state.cc[state.cc.length - 1] 829 | if (top == expression || top == expressionNoComma) state.cc.pop() 830 | } 831 | }; 832 | }); 833 | 834 | CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/); 835 | 836 | CodeMirror.defineMIME("text/javascript", "javascript"); 837 | CodeMirror.defineMIME("text/ecmascript", "javascript"); 838 | CodeMirror.defineMIME("application/javascript", "javascript"); 839 | CodeMirror.defineMIME("application/x-javascript", "javascript"); 840 | CodeMirror.defineMIME("application/ecmascript", "javascript"); 841 | CodeMirror.defineMIME("application/json", {name: "javascript", json: true}); 842 | CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true}); 843 | CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true}); 844 | CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true }); 845 | CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true }); 846 | 847 | }); 848 | -------------------------------------------------------------------------------- /js/codemirror/mode/xml/xml.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: http://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | var htmlConfig = { 15 | autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true, 16 | 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true, 17 | 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true, 18 | 'track': true, 'wbr': true, 'menuitem': true}, 19 | implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true, 20 | 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true, 21 | 'th': true, 'tr': true}, 22 | contextGrabbers: { 23 | 'dd': {'dd': true, 'dt': true}, 24 | 'dt': {'dd': true, 'dt': true}, 25 | 'li': {'li': true}, 26 | 'option': {'option': true, 'optgroup': true}, 27 | 'optgroup': {'optgroup': true}, 28 | 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true, 29 | 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true, 30 | 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true, 31 | 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true, 32 | 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true}, 33 | 'rp': {'rp': true, 'rt': true}, 34 | 'rt': {'rp': true, 'rt': true}, 35 | 'tbody': {'tbody': true, 'tfoot': true}, 36 | 'td': {'td': true, 'th': true}, 37 | 'tfoot': {'tbody': true}, 38 | 'th': {'td': true, 'th': true}, 39 | 'thead': {'tbody': true, 'tfoot': true}, 40 | 'tr': {'tr': true} 41 | }, 42 | doNotIndent: {"pre": true}, 43 | allowUnquoted: true, 44 | allowMissing: true, 45 | caseFold: true 46 | } 47 | 48 | var xmlConfig = { 49 | autoSelfClosers: {}, 50 | implicitlyClosed: {}, 51 | contextGrabbers: {}, 52 | doNotIndent: {}, 53 | allowUnquoted: false, 54 | allowMissing: false, 55 | caseFold: false 56 | } 57 | 58 | CodeMirror.defineMode("xml", function(editorConf, config_) { 59 | var indentUnit = editorConf.indentUnit 60 | var config = {} 61 | var defaults = config_.htmlMode ? htmlConfig : xmlConfig 62 | for (var prop in defaults) config[prop] = defaults[prop] 63 | for (var prop in config_) config[prop] = config_[prop] 64 | 65 | // Return variables for tokenizers 66 | var type, setStyle; 67 | 68 | function inText(stream, state) { 69 | function chain(parser) { 70 | state.tokenize = parser; 71 | return parser(stream, state); 72 | } 73 | 74 | var ch = stream.next(); 75 | if (ch == "<") { 76 | if (stream.eat("!")) { 77 | if (stream.eat("[")) { 78 | if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>")); 79 | else return null; 80 | } else if (stream.match("--")) { 81 | return chain(inBlock("comment", "-->")); 82 | } else if (stream.match("DOCTYPE", true, true)) { 83 | stream.eatWhile(/[\w\._\-]/); 84 | return chain(doctype(1)); 85 | } else { 86 | return null; 87 | } 88 | } else if (stream.eat("?")) { 89 | stream.eatWhile(/[\w\._\-]/); 90 | state.tokenize = inBlock("meta", "?>"); 91 | return "meta"; 92 | } else { 93 | type = stream.eat("/") ? "closeTag" : "openTag"; 94 | state.tokenize = inTag; 95 | return "tag bracket"; 96 | } 97 | } else if (ch == "&") { 98 | var ok; 99 | if (stream.eat("#")) { 100 | if (stream.eat("x")) { 101 | ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";"); 102 | } else { 103 | ok = stream.eatWhile(/[\d]/) && stream.eat(";"); 104 | } 105 | } else { 106 | ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";"); 107 | } 108 | return ok ? "atom" : "error"; 109 | } else { 110 | stream.eatWhile(/[^&<]/); 111 | return null; 112 | } 113 | } 114 | inText.isInText = true; 115 | 116 | function inTag(stream, state) { 117 | var ch = stream.next(); 118 | if (ch == ">" || (ch == "/" && stream.eat(">"))) { 119 | state.tokenize = inText; 120 | type = ch == ">" ? "endTag" : "selfcloseTag"; 121 | return "tag bracket"; 122 | } else if (ch == "=") { 123 | type = "equals"; 124 | return null; 125 | } else if (ch == "<") { 126 | state.tokenize = inText; 127 | state.state = baseState; 128 | state.tagName = state.tagStart = null; 129 | var next = state.tokenize(stream, state); 130 | return next ? next + " tag error" : "tag error"; 131 | } else if (/[\'\"]/.test(ch)) { 132 | state.tokenize = inAttribute(ch); 133 | state.stringStartCol = stream.column(); 134 | return state.tokenize(stream, state); 135 | } else { 136 | stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/); 137 | return "word"; 138 | } 139 | } 140 | 141 | function inAttribute(quote) { 142 | var closure = function(stream, state) { 143 | while (!stream.eol()) { 144 | if (stream.next() == quote) { 145 | state.tokenize = inTag; 146 | break; 147 | } 148 | } 149 | return "string"; 150 | }; 151 | closure.isInAttribute = true; 152 | return closure; 153 | } 154 | 155 | function inBlock(style, terminator) { 156 | return function(stream, state) { 157 | while (!stream.eol()) { 158 | if (stream.match(terminator)) { 159 | state.tokenize = inText; 160 | break; 161 | } 162 | stream.next(); 163 | } 164 | return style; 165 | }; 166 | } 167 | function doctype(depth) { 168 | return function(stream, state) { 169 | var ch; 170 | while ((ch = stream.next()) != null) { 171 | if (ch == "<") { 172 | state.tokenize = doctype(depth + 1); 173 | return state.tokenize(stream, state); 174 | } else if (ch == ">") { 175 | if (depth == 1) { 176 | state.tokenize = inText; 177 | break; 178 | } else { 179 | state.tokenize = doctype(depth - 1); 180 | return state.tokenize(stream, state); 181 | } 182 | } 183 | } 184 | return "meta"; 185 | }; 186 | } 187 | 188 | function Context(state, tagName, startOfLine) { 189 | this.prev = state.context; 190 | this.tagName = tagName; 191 | this.indent = state.indented; 192 | this.startOfLine = startOfLine; 193 | if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent)) 194 | this.noIndent = true; 195 | } 196 | function popContext(state) { 197 | if (state.context) state.context = state.context.prev; 198 | } 199 | function maybePopContext(state, nextTagName) { 200 | var parentTagName; 201 | while (true) { 202 | if (!state.context) { 203 | return; 204 | } 205 | parentTagName = state.context.tagName; 206 | if (!config.contextGrabbers.hasOwnProperty(parentTagName) || 207 | !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) { 208 | return; 209 | } 210 | popContext(state); 211 | } 212 | } 213 | 214 | function baseState(type, stream, state) { 215 | if (type == "openTag") { 216 | state.tagStart = stream.column(); 217 | return tagNameState; 218 | } else if (type == "closeTag") { 219 | return closeTagNameState; 220 | } else { 221 | return baseState; 222 | } 223 | } 224 | function tagNameState(type, stream, state) { 225 | if (type == "word") { 226 | state.tagName = stream.current(); 227 | setStyle = "tag"; 228 | return attrState; 229 | } else { 230 | setStyle = "error"; 231 | return tagNameState; 232 | } 233 | } 234 | function closeTagNameState(type, stream, state) { 235 | if (type == "word") { 236 | var tagName = stream.current(); 237 | if (state.context && state.context.tagName != tagName && 238 | config.implicitlyClosed.hasOwnProperty(state.context.tagName)) 239 | popContext(state); 240 | if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) { 241 | setStyle = "tag"; 242 | return closeState; 243 | } else { 244 | setStyle = "tag error"; 245 | return closeStateErr; 246 | } 247 | } else { 248 | setStyle = "error"; 249 | return closeStateErr; 250 | } 251 | } 252 | 253 | function closeState(type, _stream, state) { 254 | if (type != "endTag") { 255 | setStyle = "error"; 256 | return closeState; 257 | } 258 | popContext(state); 259 | return baseState; 260 | } 261 | function closeStateErr(type, stream, state) { 262 | setStyle = "error"; 263 | return closeState(type, stream, state); 264 | } 265 | 266 | function attrState(type, _stream, state) { 267 | if (type == "word") { 268 | setStyle = "attribute"; 269 | return attrEqState; 270 | } else if (type == "endTag" || type == "selfcloseTag") { 271 | var tagName = state.tagName, tagStart = state.tagStart; 272 | state.tagName = state.tagStart = null; 273 | if (type == "selfcloseTag" || 274 | config.autoSelfClosers.hasOwnProperty(tagName)) { 275 | maybePopContext(state, tagName); 276 | } else { 277 | maybePopContext(state, tagName); 278 | state.context = new Context(state, tagName, tagStart == state.indented); 279 | } 280 | return baseState; 281 | } 282 | setStyle = "error"; 283 | return attrState; 284 | } 285 | function attrEqState(type, stream, state) { 286 | if (type == "equals") return attrValueState; 287 | if (!config.allowMissing) setStyle = "error"; 288 | return attrState(type, stream, state); 289 | } 290 | function attrValueState(type, stream, state) { 291 | if (type == "string") return attrContinuedState; 292 | if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;} 293 | setStyle = "error"; 294 | return attrState(type, stream, state); 295 | } 296 | function attrContinuedState(type, stream, state) { 297 | if (type == "string") return attrContinuedState; 298 | return attrState(type, stream, state); 299 | } 300 | 301 | return { 302 | startState: function(baseIndent) { 303 | var state = {tokenize: inText, 304 | state: baseState, 305 | indented: baseIndent || 0, 306 | tagName: null, tagStart: null, 307 | context: null} 308 | if (baseIndent != null) state.baseIndent = baseIndent 309 | return state 310 | }, 311 | 312 | token: function(stream, state) { 313 | if (!state.tagName && stream.sol()) 314 | state.indented = stream.indentation(); 315 | 316 | if (stream.eatSpace()) return null; 317 | type = null; 318 | var style = state.tokenize(stream, state); 319 | if ((style || type) && style != "comment") { 320 | setStyle = null; 321 | state.state = state.state(type || style, stream, state); 322 | if (setStyle) 323 | style = setStyle == "error" ? style + " error" : setStyle; 324 | } 325 | return style; 326 | }, 327 | 328 | indent: function(state, textAfter, fullLine) { 329 | var context = state.context; 330 | // Indent multi-line strings (e.g. css). 331 | if (state.tokenize.isInAttribute) { 332 | if (state.tagStart == state.indented) 333 | return state.stringStartCol + 1; 334 | else 335 | return state.indented + indentUnit; 336 | } 337 | if (context && context.noIndent) return CodeMirror.Pass; 338 | if (state.tokenize != inTag && state.tokenize != inText) 339 | return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0; 340 | // Indent the starts of attribute names. 341 | if (state.tagName) { 342 | if (config.multilineTagIndentPastTag !== false) 343 | return state.tagStart + state.tagName.length + 2; 344 | else 345 | return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1); 346 | } 347 | if (config.alignCDATA && /$/, 376 | blockCommentStart: "", 378 | 379 | configuration: config.htmlMode ? "html" : "xml", 380 | helperType: config.htmlMode ? "html" : "xml", 381 | 382 | skipAttribute: function(state) { 383 | if (state.state == attrValueState) 384 | state.state = attrState 385 | } 386 | }; 387 | }); 388 | 389 | CodeMirror.defineMIME("text/xml", "xml"); 390 | CodeMirror.defineMIME("application/xml", "xml"); 391 | if (!CodeMirror.mimeModes.hasOwnProperty("text/html")) 392 | CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true}); 393 | 394 | }); 395 | -------------------------------------------------------------------------------- /test/Test-navbar-dropdown.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 57 | 58 | 59 | 60 | 74 |
75 |

Dropdown Menu inside a Navigation Bar

76 |

Click on the "Dropdown" link to see the dropdown menu.

77 |
78 | 79 | 80 | -------------------------------------------------------------------------------- /test/test.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Sort a HTML List Alphabetically 5 | 6 | 7 | 8 |

This is a heading

9 |

This is a paragraph. Click the button to sort the list alphabetically:

10 | 11 | 12 | 20 | 21 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /tryit.3.7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Tryit Editor v3.7 luce80 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 41 | 42 | 214 | 222 | 223 | 224 | 225 | 226 | 260 | 261 |
262 | 263 |
264 | 265 |
266 | 325 |
326 |
327 |
328 | 330 |
331 |
332 | 333 | 570 | 571 | 582 | 583 | 584 | --------------------------------------------------------------------------------