├── .gitignore ├── LICENSE ├── README.md ├── ccr ├── __init__.py ├── admin.py ├── migrations │ └── __init__.py ├── models.py ├── static │ └── ccr │ │ ├── css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap.css │ │ ├── editor.css │ │ ├── main.css │ │ └── monokai.css │ │ ├── images │ │ ├── fb.png │ │ ├── github.png │ │ ├── gmail.png │ │ ├── header.jpg │ │ └── logo.jpg │ │ └── js │ │ ├── ace.js │ │ ├── bootstrap.js │ │ ├── editor.js │ │ ├── jquery-2.1.4.js │ │ ├── mode-c_cpp.js │ │ ├── mode-python.js │ │ └── theme-monokai.js ├── templates │ └── ccr │ │ ├── main.html │ │ └── status.html ├── tests.py ├── urls.py └── views.py ├── codes ├── .gitignore ├── saved │ ├── .gitignore │ └── .txt └── tmp │ └── .gitignore ├── coding_companion ├── __init__.py ├── settings.py ├── urls.py └── wsgi.py ├── install.sh ├── manage.py ├── run.sh └── screenshots └── run.png /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | coding_companion/connections.py 3 | compile/migrations/ 4 | *.cpp 5 | manage.py 6 | a.out 7 | codes/code.py 8 | db.sqlite3 9 | input.txt 10 | ./codes/46cba143d0ff7956c0fd0afa9a991d7633f9472dc159a4fd5147b190.txt 11 | ./codes/d24938ff4064870c5f8520d8a041eabc7d50a2f917130d3e649b194a.txt 12 | ./codes/d50baf2add4766001a674319955f9755816a3edcae7441975072bb15.txt 13 | ./codes/input.txt 14 | ./codes/out46cba143d0ff7956c0fd0afa9a991d7633f9472dc159a4fd5147b190.txt 15 | ./codes/outd50baf2add4766001a674319955f9755816a3edcae7441975072bb15.txt 16 | ./codes/outSmxgkW1jXO3xCCzJscZehr9lRhu1Wo4X.txt 17 | ./codes/SmxgkW1jXO3xCCzJscZehr9lRhu1Wo4X.txt 18 | ./codes/46cba143d0ff7956c0fd0afa9a991d7633f9472dc159a4fd5147b190.cpp 19 | ./codes/code.cpp 20 | ./codes/d24938ff4064870c5f8520d8a041eabc7d50a2f917130d3e649b194a.cpp 21 | ./codes/d50baf2add4766001a674319955f9755816a3edcae7441975072bb15.cpp 22 | ./codes/SmxgkW1jXO3xCCzJscZehr9lRhu1Wo4X.cpp 23 | ./a.out 24 | codes/saved/hello.txt 25 | codes/saved/template.txt 26 | codes/saved/STROPR.txt 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Nikhil Sheoran 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. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # coding_companion 2 | An offline IDE for C++, although similar to ideone.com, but ensures that your code doesn't fall into wrong hands :p 3 | 4 | ###Installing 5 | 1. Clone the repository on your PC `git clone https://github.com/nikhil96sher/coding_companion/` 6 | 2. Go to coding_companion `cd coding_companion` 7 | 3. Run `./install.sh` 8 | 9 | **Note** : `install.sh` installs python, g++ and Django 1.8.1 . If these are already installed, you can skip the installation. 10 | 11 | **Note** : If the `install.sh` command results in permission denied error, then first run `chmod 777 install.sh` and then try running `install.sh` again. 12 | 13 | ###Using 14 | 1. Go to the `coding_companion` directory 15 | 2. Run `./run.sh` 16 | 17 | **Note** : If the `run.sh` command results in permission denied error, then first run `chmod 777 run.sh` and then try running `run.sh` again. 18 | 19 | **Note** : If the `run.sh` command results in "The port is already in use", try running the server on another port by using `python manage.py runserver `. For example : `python manage.py runserver 60002` 20 | 21 | ###Features 22 | 1. Compile and Run C++ code. 23 | 2. Create a template, so you need not type your #defines again and again. 24 | 25 | **How To** : Write your code, and save it in a file named `template`. You can modify it by overwriting it anytime. 26 | 3. Save code on your PC. (Although a temporary copy is always saved as a backup) 27 | 28 | **How To** : Clicking on `save` saves the code in the directory `codes/saved` in the app's directory. The temporary codes are saved in the directory `codes/tmp` 29 | 30 | ###Screenshots 31 | ![Alt text](https://github.com/nikhil96sher/coding_companion/blob/master/screenshots/run.png "Screenshot") 32 | 33 | ###Resources 34 | 1. Django (https://www.djangoproject.com/) 35 | 2. Ace Editor (https://github.com/ajaxorg/ace) 36 | 3. Bootstrap CSS (http://getbootstrap.com/css/) 37 | 4. jQuery (https://jquery.com/) 38 | -------------------------------------------------------------------------------- /ccr/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikhil96sher/coding_companion/bb5d9596dff74e342ca07b6d95c37fb491877224/ccr/__init__.py -------------------------------------------------------------------------------- /ccr/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /ccr/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikhil96sher/coding_companion/bb5d9596dff74e342ca07b6d95c37fb491877224/ccr/migrations/__init__.py -------------------------------------------------------------------------------- /ccr/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /ccr/static/ccr/css/bootstrap-theme.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.3.5 (http://getbootstrap.com) 3 | * Copyright 2011-2015 Twitter, Inc. 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5 | */ 6 | .btn-default, 7 | .btn-primary, 8 | .btn-success, 9 | .btn-info, 10 | .btn-warning, 11 | .btn-danger { 12 | text-shadow: 0 -1px 0 rgba(0, 0, 0, .2); 13 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075); 14 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075); 15 | } 16 | .btn-default:active, 17 | .btn-primary:active, 18 | .btn-success:active, 19 | .btn-info:active, 20 | .btn-warning:active, 21 | .btn-danger:active, 22 | .btn-default.active, 23 | .btn-primary.active, 24 | .btn-success.active, 25 | .btn-info.active, 26 | .btn-warning.active, 27 | .btn-danger.active { 28 | -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); 29 | box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125); 30 | } 31 | .btn-default.disabled, 32 | .btn-primary.disabled, 33 | .btn-success.disabled, 34 | .btn-info.disabled, 35 | .btn-warning.disabled, 36 | .btn-danger.disabled, 37 | .btn-default[disabled], 38 | .btn-primary[disabled], 39 | .btn-success[disabled], 40 | .btn-info[disabled], 41 | .btn-warning[disabled], 42 | .btn-danger[disabled], 43 | fieldset[disabled] .btn-default, 44 | fieldset[disabled] .btn-primary, 45 | fieldset[disabled] .btn-success, 46 | fieldset[disabled] .btn-info, 47 | fieldset[disabled] .btn-warning, 48 | fieldset[disabled] .btn-danger { 49 | -webkit-box-shadow: none; 50 | box-shadow: none; 51 | } 52 | .btn-default .badge, 53 | .btn-primary .badge, 54 | .btn-success .badge, 55 | .btn-info .badge, 56 | .btn-warning .badge, 57 | .btn-danger .badge { 58 | text-shadow: none; 59 | } 60 | .btn:active, 61 | .btn.active { 62 | background-image: none; 63 | } 64 | .btn-default { 65 | text-shadow: 0 1px 0 #fff; 66 | background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%); 67 | background-image: -o-linear-gradient(top, #fff 0%, #e0e0e0 100%); 68 | background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#e0e0e0)); 69 | background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%); 70 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0); 71 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); 72 | background-repeat: repeat-x; 73 | border-color: #dbdbdb; 74 | border-color: #ccc; 75 | } 76 | .btn-default:hover, 77 | .btn-default:focus { 78 | background-color: #e0e0e0; 79 | background-position: 0 -15px; 80 | } 81 | .btn-default:active, 82 | .btn-default.active { 83 | background-color: #e0e0e0; 84 | border-color: #dbdbdb; 85 | } 86 | .btn-default.disabled, 87 | .btn-default[disabled], 88 | fieldset[disabled] .btn-default, 89 | .btn-default.disabled:hover, 90 | .btn-default[disabled]:hover, 91 | fieldset[disabled] .btn-default:hover, 92 | .btn-default.disabled:focus, 93 | .btn-default[disabled]:focus, 94 | fieldset[disabled] .btn-default:focus, 95 | .btn-default.disabled.focus, 96 | .btn-default[disabled].focus, 97 | fieldset[disabled] .btn-default.focus, 98 | .btn-default.disabled:active, 99 | .btn-default[disabled]:active, 100 | fieldset[disabled] .btn-default:active, 101 | .btn-default.disabled.active, 102 | .btn-default[disabled].active, 103 | fieldset[disabled] .btn-default.active { 104 | background-color: #e0e0e0; 105 | background-image: none; 106 | } 107 | .btn-primary { 108 | background-image: -webkit-linear-gradient(top, #337ab7 0%, #265a88 100%); 109 | background-image: -o-linear-gradient(top, #337ab7 0%, #265a88 100%); 110 | background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#265a88)); 111 | background-image: linear-gradient(to bottom, #337ab7 0%, #265a88 100%); 112 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0); 113 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); 114 | background-repeat: repeat-x; 115 | border-color: #245580; 116 | } 117 | .btn-primary:hover, 118 | .btn-primary:focus { 119 | background-color: #265a88; 120 | background-position: 0 -15px; 121 | } 122 | .btn-primary:active, 123 | .btn-primary.active { 124 | background-color: #265a88; 125 | border-color: #245580; 126 | } 127 | .btn-primary.disabled, 128 | .btn-primary[disabled], 129 | fieldset[disabled] .btn-primary, 130 | .btn-primary.disabled:hover, 131 | .btn-primary[disabled]:hover, 132 | fieldset[disabled] .btn-primary:hover, 133 | .btn-primary.disabled:focus, 134 | .btn-primary[disabled]:focus, 135 | fieldset[disabled] .btn-primary:focus, 136 | .btn-primary.disabled.focus, 137 | .btn-primary[disabled].focus, 138 | fieldset[disabled] .btn-primary.focus, 139 | .btn-primary.disabled:active, 140 | .btn-primary[disabled]:active, 141 | fieldset[disabled] .btn-primary:active, 142 | .btn-primary.disabled.active, 143 | .btn-primary[disabled].active, 144 | fieldset[disabled] .btn-primary.active { 145 | background-color: #265a88; 146 | background-image: none; 147 | } 148 | .btn-success { 149 | background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%); 150 | background-image: -o-linear-gradient(top, #5cb85c 0%, #419641 100%); 151 | background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#419641)); 152 | background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%); 153 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0); 154 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); 155 | background-repeat: repeat-x; 156 | border-color: #3e8f3e; 157 | } 158 | .btn-success:hover, 159 | .btn-success:focus { 160 | background-color: #419641; 161 | background-position: 0 -15px; 162 | } 163 | .btn-success:active, 164 | .btn-success.active { 165 | background-color: #419641; 166 | border-color: #3e8f3e; 167 | } 168 | .btn-success.disabled, 169 | .btn-success[disabled], 170 | fieldset[disabled] .btn-success, 171 | .btn-success.disabled:hover, 172 | .btn-success[disabled]:hover, 173 | fieldset[disabled] .btn-success:hover, 174 | .btn-success.disabled:focus, 175 | .btn-success[disabled]:focus, 176 | fieldset[disabled] .btn-success:focus, 177 | .btn-success.disabled.focus, 178 | .btn-success[disabled].focus, 179 | fieldset[disabled] .btn-success.focus, 180 | .btn-success.disabled:active, 181 | .btn-success[disabled]:active, 182 | fieldset[disabled] .btn-success:active, 183 | .btn-success.disabled.active, 184 | .btn-success[disabled].active, 185 | fieldset[disabled] .btn-success.active { 186 | background-color: #419641; 187 | background-image: none; 188 | } 189 | .btn-info { 190 | background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%); 191 | background-image: -o-linear-gradient(top, #5bc0de 0%, #2aabd2 100%); 192 | background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#2aabd2)); 193 | background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%); 194 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0); 195 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); 196 | background-repeat: repeat-x; 197 | border-color: #28a4c9; 198 | } 199 | .btn-info:hover, 200 | .btn-info:focus { 201 | background-color: #2aabd2; 202 | background-position: 0 -15px; 203 | } 204 | .btn-info:active, 205 | .btn-info.active { 206 | background-color: #2aabd2; 207 | border-color: #28a4c9; 208 | } 209 | .btn-info.disabled, 210 | .btn-info[disabled], 211 | fieldset[disabled] .btn-info, 212 | .btn-info.disabled:hover, 213 | .btn-info[disabled]:hover, 214 | fieldset[disabled] .btn-info:hover, 215 | .btn-info.disabled:focus, 216 | .btn-info[disabled]:focus, 217 | fieldset[disabled] .btn-info:focus, 218 | .btn-info.disabled.focus, 219 | .btn-info[disabled].focus, 220 | fieldset[disabled] .btn-info.focus, 221 | .btn-info.disabled:active, 222 | .btn-info[disabled]:active, 223 | fieldset[disabled] .btn-info:active, 224 | .btn-info.disabled.active, 225 | .btn-info[disabled].active, 226 | fieldset[disabled] .btn-info.active { 227 | background-color: #2aabd2; 228 | background-image: none; 229 | } 230 | .btn-warning { 231 | background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%); 232 | background-image: -o-linear-gradient(top, #f0ad4e 0%, #eb9316 100%); 233 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#eb9316)); 234 | background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%); 235 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0); 236 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); 237 | background-repeat: repeat-x; 238 | border-color: #e38d13; 239 | } 240 | .btn-warning:hover, 241 | .btn-warning:focus { 242 | background-color: #eb9316; 243 | background-position: 0 -15px; 244 | } 245 | .btn-warning:active, 246 | .btn-warning.active { 247 | background-color: #eb9316; 248 | border-color: #e38d13; 249 | } 250 | .btn-warning.disabled, 251 | .btn-warning[disabled], 252 | fieldset[disabled] .btn-warning, 253 | .btn-warning.disabled:hover, 254 | .btn-warning[disabled]:hover, 255 | fieldset[disabled] .btn-warning:hover, 256 | .btn-warning.disabled:focus, 257 | .btn-warning[disabled]:focus, 258 | fieldset[disabled] .btn-warning:focus, 259 | .btn-warning.disabled.focus, 260 | .btn-warning[disabled].focus, 261 | fieldset[disabled] .btn-warning.focus, 262 | .btn-warning.disabled:active, 263 | .btn-warning[disabled]:active, 264 | fieldset[disabled] .btn-warning:active, 265 | .btn-warning.disabled.active, 266 | .btn-warning[disabled].active, 267 | fieldset[disabled] .btn-warning.active { 268 | background-color: #eb9316; 269 | background-image: none; 270 | } 271 | .btn-danger { 272 | background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%); 273 | background-image: -o-linear-gradient(top, #d9534f 0%, #c12e2a 100%); 274 | background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c12e2a)); 275 | background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%); 276 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0); 277 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); 278 | background-repeat: repeat-x; 279 | border-color: #b92c28; 280 | } 281 | .btn-danger:hover, 282 | .btn-danger:focus { 283 | background-color: #c12e2a; 284 | background-position: 0 -15px; 285 | } 286 | .btn-danger:active, 287 | .btn-danger.active { 288 | background-color: #c12e2a; 289 | border-color: #b92c28; 290 | } 291 | .btn-danger.disabled, 292 | .btn-danger[disabled], 293 | fieldset[disabled] .btn-danger, 294 | .btn-danger.disabled:hover, 295 | .btn-danger[disabled]:hover, 296 | fieldset[disabled] .btn-danger:hover, 297 | .btn-danger.disabled:focus, 298 | .btn-danger[disabled]:focus, 299 | fieldset[disabled] .btn-danger:focus, 300 | .btn-danger.disabled.focus, 301 | .btn-danger[disabled].focus, 302 | fieldset[disabled] .btn-danger.focus, 303 | .btn-danger.disabled:active, 304 | .btn-danger[disabled]:active, 305 | fieldset[disabled] .btn-danger:active, 306 | .btn-danger.disabled.active, 307 | .btn-danger[disabled].active, 308 | fieldset[disabled] .btn-danger.active { 309 | background-color: #c12e2a; 310 | background-image: none; 311 | } 312 | .thumbnail, 313 | .img-thumbnail { 314 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075); 315 | box-shadow: 0 1px 2px rgba(0, 0, 0, .075); 316 | } 317 | .dropdown-menu > li > a:hover, 318 | .dropdown-menu > li > a:focus { 319 | background-color: #e8e8e8; 320 | background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); 321 | background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); 322 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8)); 323 | background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); 324 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); 325 | background-repeat: repeat-x; 326 | } 327 | .dropdown-menu > .active > a, 328 | .dropdown-menu > .active > a:hover, 329 | .dropdown-menu > .active > a:focus { 330 | background-color: #2e6da4; 331 | background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%); 332 | background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%); 333 | background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4)); 334 | background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%); 335 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0); 336 | background-repeat: repeat-x; 337 | } 338 | .navbar-default { 339 | background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%); 340 | background-image: -o-linear-gradient(top, #fff 0%, #f8f8f8 100%); 341 | background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f8f8f8)); 342 | background-image: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%); 343 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0); 344 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); 345 | background-repeat: repeat-x; 346 | border-radius: 4px; 347 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075); 348 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075); 349 | } 350 | .navbar-default .navbar-nav > .open > a, 351 | .navbar-default .navbar-nav > .active > a { 352 | background-image: -webkit-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%); 353 | background-image: -o-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%); 354 | background-image: -webkit-gradient(linear, left top, left bottom, from(#dbdbdb), to(#e2e2e2)); 355 | background-image: linear-gradient(to bottom, #dbdbdb 0%, #e2e2e2 100%); 356 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0); 357 | background-repeat: repeat-x; 358 | -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075); 359 | box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075); 360 | } 361 | .navbar-brand, 362 | .navbar-nav > li > a { 363 | text-shadow: 0 1px 0 rgba(255, 255, 255, .25); 364 | } 365 | .navbar-inverse { 366 | background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222 100%); 367 | background-image: -o-linear-gradient(top, #3c3c3c 0%, #222 100%); 368 | background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#222)); 369 | background-image: linear-gradient(to bottom, #3c3c3c 0%, #222 100%); 370 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0); 371 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); 372 | background-repeat: repeat-x; 373 | border-radius: 4px; 374 | } 375 | .navbar-inverse .navbar-nav > .open > a, 376 | .navbar-inverse .navbar-nav > .active > a { 377 | background-image: -webkit-linear-gradient(top, #080808 0%, #0f0f0f 100%); 378 | background-image: -o-linear-gradient(top, #080808 0%, #0f0f0f 100%); 379 | background-image: -webkit-gradient(linear, left top, left bottom, from(#080808), to(#0f0f0f)); 380 | background-image: linear-gradient(to bottom, #080808 0%, #0f0f0f 100%); 381 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0); 382 | background-repeat: repeat-x; 383 | -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25); 384 | box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25); 385 | } 386 | .navbar-inverse .navbar-brand, 387 | .navbar-inverse .navbar-nav > li > a { 388 | text-shadow: 0 -1px 0 rgba(0, 0, 0, .25); 389 | } 390 | .navbar-static-top, 391 | .navbar-fixed-top, 392 | .navbar-fixed-bottom { 393 | border-radius: 0; 394 | } 395 | @media (max-width: 767px) { 396 | .navbar .navbar-nav .open .dropdown-menu > .active > a, 397 | .navbar .navbar-nav .open .dropdown-menu > .active > a:hover, 398 | .navbar .navbar-nav .open .dropdown-menu > .active > a:focus { 399 | color: #fff; 400 | background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%); 401 | background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%); 402 | background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4)); 403 | background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%); 404 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0); 405 | background-repeat: repeat-x; 406 | } 407 | } 408 | .alert { 409 | text-shadow: 0 1px 0 rgba(255, 255, 255, .2); 410 | -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05); 411 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05); 412 | } 413 | .alert-success { 414 | background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%); 415 | background-image: -o-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%); 416 | background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#c8e5bc)); 417 | background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%); 418 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0); 419 | background-repeat: repeat-x; 420 | border-color: #b2dba1; 421 | } 422 | .alert-info { 423 | background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%); 424 | background-image: -o-linear-gradient(top, #d9edf7 0%, #b9def0 100%); 425 | background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#b9def0)); 426 | background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%); 427 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0); 428 | background-repeat: repeat-x; 429 | border-color: #9acfea; 430 | } 431 | .alert-warning { 432 | background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%); 433 | background-image: -o-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%); 434 | background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#f8efc0)); 435 | background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%); 436 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0); 437 | background-repeat: repeat-x; 438 | border-color: #f5e79e; 439 | } 440 | .alert-danger { 441 | background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%); 442 | background-image: -o-linear-gradient(top, #f2dede 0%, #e7c3c3 100%); 443 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#e7c3c3)); 444 | background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%); 445 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0); 446 | background-repeat: repeat-x; 447 | border-color: #dca7a7; 448 | } 449 | .progress { 450 | background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%); 451 | background-image: -o-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%); 452 | background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f5f5f5)); 453 | background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%); 454 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0); 455 | background-repeat: repeat-x; 456 | } 457 | .progress-bar { 458 | background-image: -webkit-linear-gradient(top, #337ab7 0%, #286090 100%); 459 | background-image: -o-linear-gradient(top, #337ab7 0%, #286090 100%); 460 | background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#286090)); 461 | background-image: linear-gradient(to bottom, #337ab7 0%, #286090 100%); 462 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0); 463 | background-repeat: repeat-x; 464 | } 465 | .progress-bar-success { 466 | background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%); 467 | background-image: -o-linear-gradient(top, #5cb85c 0%, #449d44 100%); 468 | background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#449d44)); 469 | background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%); 470 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0); 471 | background-repeat: repeat-x; 472 | } 473 | .progress-bar-info { 474 | background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); 475 | background-image: -o-linear-gradient(top, #5bc0de 0%, #31b0d5 100%); 476 | background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#31b0d5)); 477 | background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%); 478 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0); 479 | background-repeat: repeat-x; 480 | } 481 | .progress-bar-warning { 482 | background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); 483 | background-image: -o-linear-gradient(top, #f0ad4e 0%, #ec971f 100%); 484 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#ec971f)); 485 | background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%); 486 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0); 487 | background-repeat: repeat-x; 488 | } 489 | .progress-bar-danger { 490 | background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%); 491 | background-image: -o-linear-gradient(top, #d9534f 0%, #c9302c 100%); 492 | background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c9302c)); 493 | background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%); 494 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0); 495 | background-repeat: repeat-x; 496 | } 497 | .progress-bar-striped { 498 | background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); 499 | background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); 500 | background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); 501 | } 502 | .list-group { 503 | border-radius: 4px; 504 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075); 505 | box-shadow: 0 1px 2px rgba(0, 0, 0, .075); 506 | } 507 | .list-group-item.active, 508 | .list-group-item.active:hover, 509 | .list-group-item.active:focus { 510 | text-shadow: 0 -1px 0 #286090; 511 | background-image: -webkit-linear-gradient(top, #337ab7 0%, #2b669a 100%); 512 | background-image: -o-linear-gradient(top, #337ab7 0%, #2b669a 100%); 513 | background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2b669a)); 514 | background-image: linear-gradient(to bottom, #337ab7 0%, #2b669a 100%); 515 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0); 516 | background-repeat: repeat-x; 517 | border-color: #2b669a; 518 | } 519 | .list-group-item.active .badge, 520 | .list-group-item.active:hover .badge, 521 | .list-group-item.active:focus .badge { 522 | text-shadow: none; 523 | } 524 | .panel { 525 | -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05); 526 | box-shadow: 0 1px 2px rgba(0, 0, 0, .05); 527 | } 528 | .panel-default > .panel-heading { 529 | background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); 530 | background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%); 531 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8)); 532 | background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%); 533 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0); 534 | background-repeat: repeat-x; 535 | } 536 | .panel-primary > .panel-heading { 537 | background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%); 538 | background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%); 539 | background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4)); 540 | background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%); 541 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0); 542 | background-repeat: repeat-x; 543 | } 544 | .panel-success > .panel-heading { 545 | background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%); 546 | background-image: -o-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%); 547 | background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#d0e9c6)); 548 | background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%); 549 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0); 550 | background-repeat: repeat-x; 551 | } 552 | .panel-info > .panel-heading { 553 | background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%); 554 | background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%); 555 | background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3)); 556 | background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%); 557 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0); 558 | background-repeat: repeat-x; 559 | } 560 | .panel-warning > .panel-heading { 561 | background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%); 562 | background-image: -o-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%); 563 | background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#faf2cc)); 564 | background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%); 565 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0); 566 | background-repeat: repeat-x; 567 | } 568 | .panel-danger > .panel-heading { 569 | background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%); 570 | background-image: -o-linear-gradient(top, #f2dede 0%, #ebcccc 100%); 571 | background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#ebcccc)); 572 | background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%); 573 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0); 574 | background-repeat: repeat-x; 575 | } 576 | .well { 577 | background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%); 578 | background-image: -o-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%); 579 | background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#f5f5f5)); 580 | background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%); 581 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0); 582 | background-repeat: repeat-x; 583 | border-color: #dcdcdc; 584 | -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1); 585 | box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1); 586 | } 587 | /*# sourceMappingURL=bootstrap-theme.css.map */ 588 | -------------------------------------------------------------------------------- /ccr/static/ccr/css/editor.css: -------------------------------------------------------------------------------- 1 | #editor 2 | { 3 | margin-left: 1%; 4 | margin-right: 1%; 5 | position: relative; 6 | width: 98%; 7 | height: 50%; 8 | } 9 | 10 | #operations 11 | { 12 | position: relative; 13 | margin-left: 1%; 14 | } 15 | 16 | #status 17 | { 18 | position: relative; 19 | margin-left:1%; 20 | } 21 | 22 | #input_output 23 | { 24 | position: relative; 25 | width:100%; 26 | margin-left: 1%; 27 | } 28 | 29 | textarea 30 | { 31 | resize:none; 32 | min-height: 25%; 33 | width:47.5%; 34 | } -------------------------------------------------------------------------------- /ccr/static/ccr/css/main.css: -------------------------------------------------------------------------------- 1 | /* Temp styles */ 2 | .content, .sidebar, .footer { border-top: none; } 3 | .sidebar.right { border-right: none; } 4 | .sidebar.left { border-left: none; } 5 | /* Core styles */ 6 | .header 7 | { 8 | background-color:rgb(34,34,34); 9 | color: rgb(150,170,170); 10 | position: relative; /* needed for stacking */ 11 | font-family: monospace; 12 | font-variant: small-caps; 13 | font-size: 40; 14 | height: 10%; 15 | width: 100%; 16 | } 17 | .content 18 | { 19 | position: relative; /* needed for stacking */ 20 | width: 100%; 21 | height: 85%; 22 | } 23 | 24 | .links 25 | { 26 | margin-top: 2px; 27 | width: 25px; 28 | height: 25px; 29 | } 30 | 31 | #content-inner 32 | { 33 | float: left; 34 | width: 63%; 35 | height: 100%; 36 | } 37 | .sidebar-left 38 | { 39 | float: left; 40 | height: 100%; 41 | width: 0%; 42 | } 43 | .sidebar-right 44 | { 45 | float: right; 46 | height: 100%; 47 | width: 35%; 48 | } 49 | .footer 50 | { 51 | background-color: rgb(34,34,34); 52 | color: rgb(150,170,170); 53 | position: relative; /* needed for stacking */ 54 | width: 100%; 55 | height: 5%; 56 | } 57 | 58 | #file_name 59 | { 60 | height: 20px; 61 | } -------------------------------------------------------------------------------- /ccr/static/ccr/css/monokai.css: -------------------------------------------------------------------------------- 1 | .ace-monokai .ace_gutter { 2 | background: #2F3129; 3 | color: #8F908A 4 | } 5 | 6 | .ace-monokai .ace_print-margin { 7 | width: 1px; 8 | background: #555651 9 | } 10 | 11 | .ace-monokai { 12 | background-color: #272822; 13 | color: #F8F8F2 14 | } 15 | 16 | .ace-monokai .ace_cursor { 17 | color: #F8F8F0 18 | } 19 | 20 | .ace-monokai .ace_marker-layer .ace_selection { 21 | background: #49483E 22 | } 23 | 24 | .ace-monokai.ace_multiselect .ace_selection.ace_start { 25 | box-shadow: 0 0 3px 0px #272822; 26 | } 27 | 28 | .ace-monokai .ace_marker-layer .ace_step { 29 | background: rgb(102, 82, 0) 30 | } 31 | 32 | .ace-monokai .ace_marker-layer .ace_bracket { 33 | margin: -1px 0 0 -1px; 34 | border: 1px solid #49483E 35 | } 36 | 37 | .ace-monokai .ace_marker-layer .ace_active-line { 38 | background: #202020 39 | } 40 | 41 | .ace-monokai .ace_gutter-active-line { 42 | background-color: #272727 43 | } 44 | 45 | .ace-monokai .ace_marker-layer .ace_selected-word { 46 | border: 1px solid #49483E 47 | } 48 | 49 | .ace-monokai .ace_invisible { 50 | color: #52524d 51 | } 52 | 53 | .ace-monokai .ace_entity.ace_name.ace_tag, 54 | .ace-monokai .ace_keyword, 55 | .ace-monokai .ace_meta.ace_tag, 56 | .ace-monokai .ace_storage { 57 | color: #F92672 58 | } 59 | 60 | .ace-monokai .ace_punctuation, 61 | .ace-monokai .ace_punctuation.ace_tag { 62 | color: #fff 63 | } 64 | 65 | .ace-monokai .ace_constant.ace_character, 66 | .ace-monokai .ace_constant.ace_language, 67 | .ace-monokai .ace_constant.ace_numeric, 68 | .ace-monokai .ace_constant.ace_other { 69 | color: #AE81FF 70 | } 71 | 72 | .ace-monokai .ace_invalid { 73 | color: #F8F8F0; 74 | background-color: #F92672 75 | } 76 | 77 | .ace-monokai .ace_invalid.ace_deprecated { 78 | color: #F8F8F0; 79 | background-color: #AE81FF 80 | } 81 | 82 | .ace-monokai .ace_support.ace_constant, 83 | .ace-monokai .ace_support.ace_function { 84 | color: #66D9EF 85 | } 86 | 87 | .ace-monokai .ace_fold { 88 | background-color: #A6E22E; 89 | border-color: #F8F8F2 90 | } 91 | 92 | .ace-monokai .ace_storage.ace_type, 93 | .ace-monokai .ace_support.ace_class, 94 | .ace-monokai .ace_support.ace_type { 95 | font-style: italic; 96 | color: #66D9EF 97 | } 98 | 99 | .ace-monokai .ace_entity.ace_name.ace_function, 100 | .ace-monokai .ace_entity.ace_other, 101 | .ace-monokai .ace_entity.ace_other.ace_attribute-name, 102 | .ace-monokai .ace_variable { 103 | color: #A6E22E 104 | } 105 | 106 | .ace-monokai .ace_variable.ace_parameter { 107 | font-style: italic; 108 | color: #FD971F 109 | } 110 | 111 | .ace-monokai .ace_string { 112 | color: #E6DB74 113 | } 114 | 115 | .ace-monokai .ace_comment { 116 | color: #75715E 117 | } 118 | 119 | .ace-monokai .ace_indent-guide { 120 | background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y 121 | } -------------------------------------------------------------------------------- /ccr/static/ccr/images/fb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikhil96sher/coding_companion/bb5d9596dff74e342ca07b6d95c37fb491877224/ccr/static/ccr/images/fb.png -------------------------------------------------------------------------------- /ccr/static/ccr/images/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikhil96sher/coding_companion/bb5d9596dff74e342ca07b6d95c37fb491877224/ccr/static/ccr/images/github.png -------------------------------------------------------------------------------- /ccr/static/ccr/images/gmail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikhil96sher/coding_companion/bb5d9596dff74e342ca07b6d95c37fb491877224/ccr/static/ccr/images/gmail.png -------------------------------------------------------------------------------- /ccr/static/ccr/images/header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikhil96sher/coding_companion/bb5d9596dff74e342ca07b6d95c37fb491877224/ccr/static/ccr/images/header.jpg -------------------------------------------------------------------------------- /ccr/static/ccr/images/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikhil96sher/coding_companion/bb5d9596dff74e342ca07b6d95c37fb491877224/ccr/static/ccr/images/logo.jpg -------------------------------------------------------------------------------- /ccr/static/ccr/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.3.5 (http://getbootstrap.com) 3 | * Copyright 2011-2015 Twitter, Inc. 4 | * Licensed under the MIT license 5 | */ 6 | 7 | if (typeof jQuery === 'undefined') { 8 | throw new Error('Bootstrap\'s JavaScript requires jQuery') 9 | } 10 | 11 | +function ($) { 12 | 'use strict'; 13 | var version = $.fn.jquery.split(' ')[0].split('.') 14 | if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) { 15 | throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher') 16 | } 17 | }(jQuery); 18 | 19 | /* ======================================================================== 20 | * Bootstrap: transition.js v3.3.5 21 | * http://getbootstrap.com/javascript/#transitions 22 | * ======================================================================== 23 | * Copyright 2011-2015 Twitter, Inc. 24 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 25 | * ======================================================================== */ 26 | 27 | 28 | +function ($) { 29 | 'use strict'; 30 | 31 | // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) 32 | // ============================================================ 33 | 34 | function transitionEnd() { 35 | var el = document.createElement('bootstrap') 36 | 37 | var transEndEventNames = { 38 | WebkitTransition : 'webkitTransitionEnd', 39 | MozTransition : 'transitionend', 40 | OTransition : 'oTransitionEnd otransitionend', 41 | transition : 'transitionend' 42 | } 43 | 44 | for (var name in transEndEventNames) { 45 | if (el.style[name] !== undefined) { 46 | return { end: transEndEventNames[name] } 47 | } 48 | } 49 | 50 | return false // explicit for ie8 ( ._.) 51 | } 52 | 53 | // http://blog.alexmaccaw.com/css-transitions 54 | $.fn.emulateTransitionEnd = function (duration) { 55 | var called = false 56 | var $el = this 57 | $(this).one('bsTransitionEnd', function () { called = true }) 58 | var callback = function () { if (!called) $($el).trigger($.support.transition.end) } 59 | setTimeout(callback, duration) 60 | return this 61 | } 62 | 63 | $(function () { 64 | $.support.transition = transitionEnd() 65 | 66 | if (!$.support.transition) return 67 | 68 | $.event.special.bsTransitionEnd = { 69 | bindType: $.support.transition.end, 70 | delegateType: $.support.transition.end, 71 | handle: function (e) { 72 | if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) 73 | } 74 | } 75 | }) 76 | 77 | }(jQuery); 78 | 79 | /* ======================================================================== 80 | * Bootstrap: alert.js v3.3.5 81 | * http://getbootstrap.com/javascript/#alerts 82 | * ======================================================================== 83 | * Copyright 2011-2015 Twitter, Inc. 84 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 85 | * ======================================================================== */ 86 | 87 | 88 | +function ($) { 89 | 'use strict'; 90 | 91 | // ALERT CLASS DEFINITION 92 | // ====================== 93 | 94 | var dismiss = '[data-dismiss="alert"]' 95 | var Alert = function (el) { 96 | $(el).on('click', dismiss, this.close) 97 | } 98 | 99 | Alert.VERSION = '3.3.5' 100 | 101 | Alert.TRANSITION_DURATION = 150 102 | 103 | Alert.prototype.close = function (e) { 104 | var $this = $(this) 105 | var selector = $this.attr('data-target') 106 | 107 | if (!selector) { 108 | selector = $this.attr('href') 109 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 110 | } 111 | 112 | var $parent = $(selector) 113 | 114 | if (e) e.preventDefault() 115 | 116 | if (!$parent.length) { 117 | $parent = $this.closest('.alert') 118 | } 119 | 120 | $parent.trigger(e = $.Event('close.bs.alert')) 121 | 122 | if (e.isDefaultPrevented()) return 123 | 124 | $parent.removeClass('in') 125 | 126 | function removeElement() { 127 | // detach from parent, fire event then clean up data 128 | $parent.detach().trigger('closed.bs.alert').remove() 129 | } 130 | 131 | $.support.transition && $parent.hasClass('fade') ? 132 | $parent 133 | .one('bsTransitionEnd', removeElement) 134 | .emulateTransitionEnd(Alert.TRANSITION_DURATION) : 135 | removeElement() 136 | } 137 | 138 | 139 | // ALERT PLUGIN DEFINITION 140 | // ======================= 141 | 142 | function Plugin(option) { 143 | return this.each(function () { 144 | var $this = $(this) 145 | var data = $this.data('bs.alert') 146 | 147 | if (!data) $this.data('bs.alert', (data = new Alert(this))) 148 | if (typeof option == 'string') data[option].call($this) 149 | }) 150 | } 151 | 152 | var old = $.fn.alert 153 | 154 | $.fn.alert = Plugin 155 | $.fn.alert.Constructor = Alert 156 | 157 | 158 | // ALERT NO CONFLICT 159 | // ================= 160 | 161 | $.fn.alert.noConflict = function () { 162 | $.fn.alert = old 163 | return this 164 | } 165 | 166 | 167 | // ALERT DATA-API 168 | // ============== 169 | 170 | $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) 171 | 172 | }(jQuery); 173 | 174 | /* ======================================================================== 175 | * Bootstrap: button.js v3.3.5 176 | * http://getbootstrap.com/javascript/#buttons 177 | * ======================================================================== 178 | * Copyright 2011-2015 Twitter, Inc. 179 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 180 | * ======================================================================== */ 181 | 182 | 183 | +function ($) { 184 | 'use strict'; 185 | 186 | // BUTTON PUBLIC CLASS DEFINITION 187 | // ============================== 188 | 189 | var Button = function (element, options) { 190 | this.$element = $(element) 191 | this.options = $.extend({}, Button.DEFAULTS, options) 192 | this.isLoading = false 193 | } 194 | 195 | Button.VERSION = '3.3.5' 196 | 197 | Button.DEFAULTS = { 198 | loadingText: 'loading...' 199 | } 200 | 201 | Button.prototype.setState = function (state) { 202 | var d = 'disabled' 203 | var $el = this.$element 204 | var val = $el.is('input') ? 'val' : 'html' 205 | var data = $el.data() 206 | 207 | state += 'Text' 208 | 209 | if (data.resetText == null) $el.data('resetText', $el[val]()) 210 | 211 | // push to event loop to allow forms to submit 212 | setTimeout($.proxy(function () { 213 | $el[val](data[state] == null ? this.options[state] : data[state]) 214 | 215 | if (state == 'loadingText') { 216 | this.isLoading = true 217 | $el.addClass(d).attr(d, d) 218 | } else if (this.isLoading) { 219 | this.isLoading = false 220 | $el.removeClass(d).removeAttr(d) 221 | } 222 | }, this), 0) 223 | } 224 | 225 | Button.prototype.toggle = function () { 226 | var changed = true 227 | var $parent = this.$element.closest('[data-toggle="buttons"]') 228 | 229 | if ($parent.length) { 230 | var $input = this.$element.find('input') 231 | if ($input.prop('type') == 'radio') { 232 | if ($input.prop('checked')) changed = false 233 | $parent.find('.active').removeClass('active') 234 | this.$element.addClass('active') 235 | } else if ($input.prop('type') == 'checkbox') { 236 | if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false 237 | this.$element.toggleClass('active') 238 | } 239 | $input.prop('checked', this.$element.hasClass('active')) 240 | if (changed) $input.trigger('change') 241 | } else { 242 | this.$element.attr('aria-pressed', !this.$element.hasClass('active')) 243 | this.$element.toggleClass('active') 244 | } 245 | } 246 | 247 | 248 | // BUTTON PLUGIN DEFINITION 249 | // ======================== 250 | 251 | function Plugin(option) { 252 | return this.each(function () { 253 | var $this = $(this) 254 | var data = $this.data('bs.button') 255 | var options = typeof option == 'object' && option 256 | 257 | if (!data) $this.data('bs.button', (data = new Button(this, options))) 258 | 259 | if (option == 'toggle') data.toggle() 260 | else if (option) data.setState(option) 261 | }) 262 | } 263 | 264 | var old = $.fn.button 265 | 266 | $.fn.button = Plugin 267 | $.fn.button.Constructor = Button 268 | 269 | 270 | // BUTTON NO CONFLICT 271 | // ================== 272 | 273 | $.fn.button.noConflict = function () { 274 | $.fn.button = old 275 | return this 276 | } 277 | 278 | 279 | // BUTTON DATA-API 280 | // =============== 281 | 282 | $(document) 283 | .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { 284 | var $btn = $(e.target) 285 | if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') 286 | Plugin.call($btn, 'toggle') 287 | if (!($(e.target).is('input[type="radio"]') || $(e.target).is('input[type="checkbox"]'))) e.preventDefault() 288 | }) 289 | .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { 290 | $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) 291 | }) 292 | 293 | }(jQuery); 294 | 295 | /* ======================================================================== 296 | * Bootstrap: carousel.js v3.3.5 297 | * http://getbootstrap.com/javascript/#carousel 298 | * ======================================================================== 299 | * Copyright 2011-2015 Twitter, Inc. 300 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 301 | * ======================================================================== */ 302 | 303 | 304 | +function ($) { 305 | 'use strict'; 306 | 307 | // CAROUSEL CLASS DEFINITION 308 | // ========================= 309 | 310 | var Carousel = function (element, options) { 311 | this.$element = $(element) 312 | this.$indicators = this.$element.find('.carousel-indicators') 313 | this.options = options 314 | this.paused = null 315 | this.sliding = null 316 | this.interval = null 317 | this.$active = null 318 | this.$items = null 319 | 320 | this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this)) 321 | 322 | this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element 323 | .on('mouseenter.bs.carousel', $.proxy(this.pause, this)) 324 | .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) 325 | } 326 | 327 | Carousel.VERSION = '3.3.5' 328 | 329 | Carousel.TRANSITION_DURATION = 600 330 | 331 | Carousel.DEFAULTS = { 332 | interval: 5000, 333 | pause: 'hover', 334 | wrap: true, 335 | keyboard: true 336 | } 337 | 338 | Carousel.prototype.keydown = function (e) { 339 | if (/input|textarea/i.test(e.target.tagName)) return 340 | switch (e.which) { 341 | case 37: this.prev(); break 342 | case 39: this.next(); break 343 | default: return 344 | } 345 | 346 | e.preventDefault() 347 | } 348 | 349 | Carousel.prototype.cycle = function (e) { 350 | e || (this.paused = false) 351 | 352 | this.interval && clearInterval(this.interval) 353 | 354 | this.options.interval 355 | && !this.paused 356 | && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) 357 | 358 | return this 359 | } 360 | 361 | Carousel.prototype.getItemIndex = function (item) { 362 | this.$items = item.parent().children('.item') 363 | return this.$items.index(item || this.$active) 364 | } 365 | 366 | Carousel.prototype.getItemForDirection = function (direction, active) { 367 | var activeIndex = this.getItemIndex(active) 368 | var willWrap = (direction == 'prev' && activeIndex === 0) 369 | || (direction == 'next' && activeIndex == (this.$items.length - 1)) 370 | if (willWrap && !this.options.wrap) return active 371 | var delta = direction == 'prev' ? -1 : 1 372 | var itemIndex = (activeIndex + delta) % this.$items.length 373 | return this.$items.eq(itemIndex) 374 | } 375 | 376 | Carousel.prototype.to = function (pos) { 377 | var that = this 378 | var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) 379 | 380 | if (pos > (this.$items.length - 1) || pos < 0) return 381 | 382 | if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" 383 | if (activeIndex == pos) return this.pause().cycle() 384 | 385 | return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos)) 386 | } 387 | 388 | Carousel.prototype.pause = function (e) { 389 | e || (this.paused = true) 390 | 391 | if (this.$element.find('.next, .prev').length && $.support.transition) { 392 | this.$element.trigger($.support.transition.end) 393 | this.cycle(true) 394 | } 395 | 396 | this.interval = clearInterval(this.interval) 397 | 398 | return this 399 | } 400 | 401 | Carousel.prototype.next = function () { 402 | if (this.sliding) return 403 | return this.slide('next') 404 | } 405 | 406 | Carousel.prototype.prev = function () { 407 | if (this.sliding) return 408 | return this.slide('prev') 409 | } 410 | 411 | Carousel.prototype.slide = function (type, next) { 412 | var $active = this.$element.find('.item.active') 413 | var $next = next || this.getItemForDirection(type, $active) 414 | var isCycling = this.interval 415 | var direction = type == 'next' ? 'left' : 'right' 416 | var that = this 417 | 418 | if ($next.hasClass('active')) return (this.sliding = false) 419 | 420 | var relatedTarget = $next[0] 421 | var slideEvent = $.Event('slide.bs.carousel', { 422 | relatedTarget: relatedTarget, 423 | direction: direction 424 | }) 425 | this.$element.trigger(slideEvent) 426 | if (slideEvent.isDefaultPrevented()) return 427 | 428 | this.sliding = true 429 | 430 | isCycling && this.pause() 431 | 432 | if (this.$indicators.length) { 433 | this.$indicators.find('.active').removeClass('active') 434 | var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]) 435 | $nextIndicator && $nextIndicator.addClass('active') 436 | } 437 | 438 | var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" 439 | if ($.support.transition && this.$element.hasClass('slide')) { 440 | $next.addClass(type) 441 | $next[0].offsetWidth // force reflow 442 | $active.addClass(direction) 443 | $next.addClass(direction) 444 | $active 445 | .one('bsTransitionEnd', function () { 446 | $next.removeClass([type, direction].join(' ')).addClass('active') 447 | $active.removeClass(['active', direction].join(' ')) 448 | that.sliding = false 449 | setTimeout(function () { 450 | that.$element.trigger(slidEvent) 451 | }, 0) 452 | }) 453 | .emulateTransitionEnd(Carousel.TRANSITION_DURATION) 454 | } else { 455 | $active.removeClass('active') 456 | $next.addClass('active') 457 | this.sliding = false 458 | this.$element.trigger(slidEvent) 459 | } 460 | 461 | isCycling && this.cycle() 462 | 463 | return this 464 | } 465 | 466 | 467 | // CAROUSEL PLUGIN DEFINITION 468 | // ========================== 469 | 470 | function Plugin(option) { 471 | return this.each(function () { 472 | var $this = $(this) 473 | var data = $this.data('bs.carousel') 474 | var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) 475 | var action = typeof option == 'string' ? option : options.slide 476 | 477 | if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) 478 | if (typeof option == 'number') data.to(option) 479 | else if (action) data[action]() 480 | else if (options.interval) data.pause().cycle() 481 | }) 482 | } 483 | 484 | var old = $.fn.carousel 485 | 486 | $.fn.carousel = Plugin 487 | $.fn.carousel.Constructor = Carousel 488 | 489 | 490 | // CAROUSEL NO CONFLICT 491 | // ==================== 492 | 493 | $.fn.carousel.noConflict = function () { 494 | $.fn.carousel = old 495 | return this 496 | } 497 | 498 | 499 | // CAROUSEL DATA-API 500 | // ================= 501 | 502 | var clickHandler = function (e) { 503 | var href 504 | var $this = $(this) 505 | var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 506 | if (!$target.hasClass('carousel')) return 507 | var options = $.extend({}, $target.data(), $this.data()) 508 | var slideIndex = $this.attr('data-slide-to') 509 | if (slideIndex) options.interval = false 510 | 511 | Plugin.call($target, options) 512 | 513 | if (slideIndex) { 514 | $target.data('bs.carousel').to(slideIndex) 515 | } 516 | 517 | e.preventDefault() 518 | } 519 | 520 | $(document) 521 | .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) 522 | .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler) 523 | 524 | $(window).on('load', function () { 525 | $('[data-ride="carousel"]').each(function () { 526 | var $carousel = $(this) 527 | Plugin.call($carousel, $carousel.data()) 528 | }) 529 | }) 530 | 531 | }(jQuery); 532 | 533 | /* ======================================================================== 534 | * Bootstrap: collapse.js v3.3.5 535 | * http://getbootstrap.com/javascript/#collapse 536 | * ======================================================================== 537 | * Copyright 2011-2015 Twitter, Inc. 538 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 539 | * ======================================================================== */ 540 | 541 | 542 | +function ($) { 543 | 'use strict'; 544 | 545 | // COLLAPSE PUBLIC CLASS DEFINITION 546 | // ================================ 547 | 548 | var Collapse = function (element, options) { 549 | this.$element = $(element) 550 | this.options = $.extend({}, Collapse.DEFAULTS, options) 551 | this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' + 552 | '[data-toggle="collapse"][data-target="#' + element.id + '"]') 553 | this.transitioning = null 554 | 555 | if (this.options.parent) { 556 | this.$parent = this.getParent() 557 | } else { 558 | this.addAriaAndCollapsedClass(this.$element, this.$trigger) 559 | } 560 | 561 | if (this.options.toggle) this.toggle() 562 | } 563 | 564 | Collapse.VERSION = '3.3.5' 565 | 566 | Collapse.TRANSITION_DURATION = 350 567 | 568 | Collapse.DEFAULTS = { 569 | toggle: true 570 | } 571 | 572 | Collapse.prototype.dimension = function () { 573 | var hasWidth = this.$element.hasClass('width') 574 | return hasWidth ? 'width' : 'height' 575 | } 576 | 577 | Collapse.prototype.show = function () { 578 | if (this.transitioning || this.$element.hasClass('in')) return 579 | 580 | var activesData 581 | var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing') 582 | 583 | if (actives && actives.length) { 584 | activesData = actives.data('bs.collapse') 585 | if (activesData && activesData.transitioning) return 586 | } 587 | 588 | var startEvent = $.Event('show.bs.collapse') 589 | this.$element.trigger(startEvent) 590 | if (startEvent.isDefaultPrevented()) return 591 | 592 | if (actives && actives.length) { 593 | Plugin.call(actives, 'hide') 594 | activesData || actives.data('bs.collapse', null) 595 | } 596 | 597 | var dimension = this.dimension() 598 | 599 | this.$element 600 | .removeClass('collapse') 601 | .addClass('collapsing')[dimension](0) 602 | .attr('aria-expanded', true) 603 | 604 | this.$trigger 605 | .removeClass('collapsed') 606 | .attr('aria-expanded', true) 607 | 608 | this.transitioning = 1 609 | 610 | var complete = function () { 611 | this.$element 612 | .removeClass('collapsing') 613 | .addClass('collapse in')[dimension]('') 614 | this.transitioning = 0 615 | this.$element 616 | .trigger('shown.bs.collapse') 617 | } 618 | 619 | if (!$.support.transition) return complete.call(this) 620 | 621 | var scrollSize = $.camelCase(['scroll', dimension].join('-')) 622 | 623 | this.$element 624 | .one('bsTransitionEnd', $.proxy(complete, this)) 625 | .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]) 626 | } 627 | 628 | Collapse.prototype.hide = function () { 629 | if (this.transitioning || !this.$element.hasClass('in')) return 630 | 631 | var startEvent = $.Event('hide.bs.collapse') 632 | this.$element.trigger(startEvent) 633 | if (startEvent.isDefaultPrevented()) return 634 | 635 | var dimension = this.dimension() 636 | 637 | this.$element[dimension](this.$element[dimension]())[0].offsetHeight 638 | 639 | this.$element 640 | .addClass('collapsing') 641 | .removeClass('collapse in') 642 | .attr('aria-expanded', false) 643 | 644 | this.$trigger 645 | .addClass('collapsed') 646 | .attr('aria-expanded', false) 647 | 648 | this.transitioning = 1 649 | 650 | var complete = function () { 651 | this.transitioning = 0 652 | this.$element 653 | .removeClass('collapsing') 654 | .addClass('collapse') 655 | .trigger('hidden.bs.collapse') 656 | } 657 | 658 | if (!$.support.transition) return complete.call(this) 659 | 660 | this.$element 661 | [dimension](0) 662 | .one('bsTransitionEnd', $.proxy(complete, this)) 663 | .emulateTransitionEnd(Collapse.TRANSITION_DURATION) 664 | } 665 | 666 | Collapse.prototype.toggle = function () { 667 | this[this.$element.hasClass('in') ? 'hide' : 'show']() 668 | } 669 | 670 | Collapse.prototype.getParent = function () { 671 | return $(this.options.parent) 672 | .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') 673 | .each($.proxy(function (i, element) { 674 | var $element = $(element) 675 | this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element) 676 | }, this)) 677 | .end() 678 | } 679 | 680 | Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) { 681 | var isOpen = $element.hasClass('in') 682 | 683 | $element.attr('aria-expanded', isOpen) 684 | $trigger 685 | .toggleClass('collapsed', !isOpen) 686 | .attr('aria-expanded', isOpen) 687 | } 688 | 689 | function getTargetFromTrigger($trigger) { 690 | var href 691 | var target = $trigger.attr('data-target') 692 | || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 693 | 694 | return $(target) 695 | } 696 | 697 | 698 | // COLLAPSE PLUGIN DEFINITION 699 | // ========================== 700 | 701 | function Plugin(option) { 702 | return this.each(function () { 703 | var $this = $(this) 704 | var data = $this.data('bs.collapse') 705 | var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) 706 | 707 | if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false 708 | if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) 709 | if (typeof option == 'string') data[option]() 710 | }) 711 | } 712 | 713 | var old = $.fn.collapse 714 | 715 | $.fn.collapse = Plugin 716 | $.fn.collapse.Constructor = Collapse 717 | 718 | 719 | // COLLAPSE NO CONFLICT 720 | // ==================== 721 | 722 | $.fn.collapse.noConflict = function () { 723 | $.fn.collapse = old 724 | return this 725 | } 726 | 727 | 728 | // COLLAPSE DATA-API 729 | // ================= 730 | 731 | $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { 732 | var $this = $(this) 733 | 734 | if (!$this.attr('data-target')) e.preventDefault() 735 | 736 | var $target = getTargetFromTrigger($this) 737 | var data = $target.data('bs.collapse') 738 | var option = data ? 'toggle' : $this.data() 739 | 740 | Plugin.call($target, option) 741 | }) 742 | 743 | }(jQuery); 744 | 745 | /* ======================================================================== 746 | * Bootstrap: dropdown.js v3.3.5 747 | * http://getbootstrap.com/javascript/#dropdowns 748 | * ======================================================================== 749 | * Copyright 2011-2015 Twitter, Inc. 750 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 751 | * ======================================================================== */ 752 | 753 | 754 | +function ($) { 755 | 'use strict'; 756 | 757 | // DROPDOWN CLASS DEFINITION 758 | // ========================= 759 | 760 | var backdrop = '.dropdown-backdrop' 761 | var toggle = '[data-toggle="dropdown"]' 762 | var Dropdown = function (element) { 763 | $(element).on('click.bs.dropdown', this.toggle) 764 | } 765 | 766 | Dropdown.VERSION = '3.3.5' 767 | 768 | function getParent($this) { 769 | var selector = $this.attr('data-target') 770 | 771 | if (!selector) { 772 | selector = $this.attr('href') 773 | selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 774 | } 775 | 776 | var $parent = selector && $(selector) 777 | 778 | return $parent && $parent.length ? $parent : $this.parent() 779 | } 780 | 781 | function clearMenus(e) { 782 | if (e && e.which === 3) return 783 | $(backdrop).remove() 784 | $(toggle).each(function () { 785 | var $this = $(this) 786 | var $parent = getParent($this) 787 | var relatedTarget = { relatedTarget: this } 788 | 789 | if (!$parent.hasClass('open')) return 790 | 791 | if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return 792 | 793 | $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)) 794 | 795 | if (e.isDefaultPrevented()) return 796 | 797 | $this.attr('aria-expanded', 'false') 798 | $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget) 799 | }) 800 | } 801 | 802 | Dropdown.prototype.toggle = function (e) { 803 | var $this = $(this) 804 | 805 | if ($this.is('.disabled, :disabled')) return 806 | 807 | var $parent = getParent($this) 808 | var isActive = $parent.hasClass('open') 809 | 810 | clearMenus() 811 | 812 | if (!isActive) { 813 | if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { 814 | // if mobile we use a backdrop because click events don't delegate 815 | $(document.createElement('div')) 816 | .addClass('dropdown-backdrop') 817 | .insertAfter($(this)) 818 | .on('click', clearMenus) 819 | } 820 | 821 | var relatedTarget = { relatedTarget: this } 822 | $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) 823 | 824 | if (e.isDefaultPrevented()) return 825 | 826 | $this 827 | .trigger('focus') 828 | .attr('aria-expanded', 'true') 829 | 830 | $parent 831 | .toggleClass('open') 832 | .trigger('shown.bs.dropdown', relatedTarget) 833 | } 834 | 835 | return false 836 | } 837 | 838 | Dropdown.prototype.keydown = function (e) { 839 | if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return 840 | 841 | var $this = $(this) 842 | 843 | e.preventDefault() 844 | e.stopPropagation() 845 | 846 | if ($this.is('.disabled, :disabled')) return 847 | 848 | var $parent = getParent($this) 849 | var isActive = $parent.hasClass('open') 850 | 851 | if (!isActive && e.which != 27 || isActive && e.which == 27) { 852 | if (e.which == 27) $parent.find(toggle).trigger('focus') 853 | return $this.trigger('click') 854 | } 855 | 856 | var desc = ' li:not(.disabled):visible a' 857 | var $items = $parent.find('.dropdown-menu' + desc) 858 | 859 | if (!$items.length) return 860 | 861 | var index = $items.index(e.target) 862 | 863 | if (e.which == 38 && index > 0) index-- // up 864 | if (e.which == 40 && index < $items.length - 1) index++ // down 865 | if (!~index) index = 0 866 | 867 | $items.eq(index).trigger('focus') 868 | } 869 | 870 | 871 | // DROPDOWN PLUGIN DEFINITION 872 | // ========================== 873 | 874 | function Plugin(option) { 875 | return this.each(function () { 876 | var $this = $(this) 877 | var data = $this.data('bs.dropdown') 878 | 879 | if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) 880 | if (typeof option == 'string') data[option].call($this) 881 | }) 882 | } 883 | 884 | var old = $.fn.dropdown 885 | 886 | $.fn.dropdown = Plugin 887 | $.fn.dropdown.Constructor = Dropdown 888 | 889 | 890 | // DROPDOWN NO CONFLICT 891 | // ==================== 892 | 893 | $.fn.dropdown.noConflict = function () { 894 | $.fn.dropdown = old 895 | return this 896 | } 897 | 898 | 899 | // APPLY TO STANDARD DROPDOWN ELEMENTS 900 | // =================================== 901 | 902 | $(document) 903 | .on('click.bs.dropdown.data-api', clearMenus) 904 | .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) 905 | .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) 906 | .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown) 907 | .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown) 908 | 909 | }(jQuery); 910 | 911 | /* ======================================================================== 912 | * Bootstrap: modal.js v3.3.5 913 | * http://getbootstrap.com/javascript/#modals 914 | * ======================================================================== 915 | * Copyright 2011-2015 Twitter, Inc. 916 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 917 | * ======================================================================== */ 918 | 919 | 920 | +function ($) { 921 | 'use strict'; 922 | 923 | // MODAL CLASS DEFINITION 924 | // ====================== 925 | 926 | var Modal = function (element, options) { 927 | this.options = options 928 | this.$body = $(document.body) 929 | this.$element = $(element) 930 | this.$dialog = this.$element.find('.modal-dialog') 931 | this.$backdrop = null 932 | this.isShown = null 933 | this.originalBodyPad = null 934 | this.scrollbarWidth = 0 935 | this.ignoreBackdropClick = false 936 | 937 | if (this.options.remote) { 938 | this.$element 939 | .find('.modal-content') 940 | .load(this.options.remote, $.proxy(function () { 941 | this.$element.trigger('loaded.bs.modal') 942 | }, this)) 943 | } 944 | } 945 | 946 | Modal.VERSION = '3.3.5' 947 | 948 | Modal.TRANSITION_DURATION = 300 949 | Modal.BACKDROP_TRANSITION_DURATION = 150 950 | 951 | Modal.DEFAULTS = { 952 | backdrop: true, 953 | keyboard: true, 954 | show: true 955 | } 956 | 957 | Modal.prototype.toggle = function (_relatedTarget) { 958 | return this.isShown ? this.hide() : this.show(_relatedTarget) 959 | } 960 | 961 | Modal.prototype.show = function (_relatedTarget) { 962 | var that = this 963 | var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) 964 | 965 | this.$element.trigger(e) 966 | 967 | if (this.isShown || e.isDefaultPrevented()) return 968 | 969 | this.isShown = true 970 | 971 | this.checkScrollbar() 972 | this.setScrollbar() 973 | this.$body.addClass('modal-open') 974 | 975 | this.escape() 976 | this.resize() 977 | 978 | this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) 979 | 980 | this.$dialog.on('mousedown.dismiss.bs.modal', function () { 981 | that.$element.one('mouseup.dismiss.bs.modal', function (e) { 982 | if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true 983 | }) 984 | }) 985 | 986 | this.backdrop(function () { 987 | var transition = $.support.transition && that.$element.hasClass('fade') 988 | 989 | if (!that.$element.parent().length) { 990 | that.$element.appendTo(that.$body) // don't move modals dom position 991 | } 992 | 993 | that.$element 994 | .show() 995 | .scrollTop(0) 996 | 997 | that.adjustDialog() 998 | 999 | if (transition) { 1000 | that.$element[0].offsetWidth // force reflow 1001 | } 1002 | 1003 | that.$element.addClass('in') 1004 | 1005 | that.enforceFocus() 1006 | 1007 | var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) 1008 | 1009 | transition ? 1010 | that.$dialog // wait for modal to slide in 1011 | .one('bsTransitionEnd', function () { 1012 | that.$element.trigger('focus').trigger(e) 1013 | }) 1014 | .emulateTransitionEnd(Modal.TRANSITION_DURATION) : 1015 | that.$element.trigger('focus').trigger(e) 1016 | }) 1017 | } 1018 | 1019 | Modal.prototype.hide = function (e) { 1020 | if (e) e.preventDefault() 1021 | 1022 | e = $.Event('hide.bs.modal') 1023 | 1024 | this.$element.trigger(e) 1025 | 1026 | if (!this.isShown || e.isDefaultPrevented()) return 1027 | 1028 | this.isShown = false 1029 | 1030 | this.escape() 1031 | this.resize() 1032 | 1033 | $(document).off('focusin.bs.modal') 1034 | 1035 | this.$element 1036 | .removeClass('in') 1037 | .off('click.dismiss.bs.modal') 1038 | .off('mouseup.dismiss.bs.modal') 1039 | 1040 | this.$dialog.off('mousedown.dismiss.bs.modal') 1041 | 1042 | $.support.transition && this.$element.hasClass('fade') ? 1043 | this.$element 1044 | .one('bsTransitionEnd', $.proxy(this.hideModal, this)) 1045 | .emulateTransitionEnd(Modal.TRANSITION_DURATION) : 1046 | this.hideModal() 1047 | } 1048 | 1049 | Modal.prototype.enforceFocus = function () { 1050 | $(document) 1051 | .off('focusin.bs.modal') // guard against infinite focus loop 1052 | .on('focusin.bs.modal', $.proxy(function (e) { 1053 | if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { 1054 | this.$element.trigger('focus') 1055 | } 1056 | }, this)) 1057 | } 1058 | 1059 | Modal.prototype.escape = function () { 1060 | if (this.isShown && this.options.keyboard) { 1061 | this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) { 1062 | e.which == 27 && this.hide() 1063 | }, this)) 1064 | } else if (!this.isShown) { 1065 | this.$element.off('keydown.dismiss.bs.modal') 1066 | } 1067 | } 1068 | 1069 | Modal.prototype.resize = function () { 1070 | if (this.isShown) { 1071 | $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) 1072 | } else { 1073 | $(window).off('resize.bs.modal') 1074 | } 1075 | } 1076 | 1077 | Modal.prototype.hideModal = function () { 1078 | var that = this 1079 | this.$element.hide() 1080 | this.backdrop(function () { 1081 | that.$body.removeClass('modal-open') 1082 | that.resetAdjustments() 1083 | that.resetScrollbar() 1084 | that.$element.trigger('hidden.bs.modal') 1085 | }) 1086 | } 1087 | 1088 | Modal.prototype.removeBackdrop = function () { 1089 | this.$backdrop && this.$backdrop.remove() 1090 | this.$backdrop = null 1091 | } 1092 | 1093 | Modal.prototype.backdrop = function (callback) { 1094 | var that = this 1095 | var animate = this.$element.hasClass('fade') ? 'fade' : '' 1096 | 1097 | if (this.isShown && this.options.backdrop) { 1098 | var doAnimate = $.support.transition && animate 1099 | 1100 | this.$backdrop = $(document.createElement('div')) 1101 | .addClass('modal-backdrop ' + animate) 1102 | .appendTo(this.$body) 1103 | 1104 | this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { 1105 | if (this.ignoreBackdropClick) { 1106 | this.ignoreBackdropClick = false 1107 | return 1108 | } 1109 | if (e.target !== e.currentTarget) return 1110 | this.options.backdrop == 'static' 1111 | ? this.$element[0].focus() 1112 | : this.hide() 1113 | }, this)) 1114 | 1115 | if (doAnimate) this.$backdrop[0].offsetWidth // force reflow 1116 | 1117 | this.$backdrop.addClass('in') 1118 | 1119 | if (!callback) return 1120 | 1121 | doAnimate ? 1122 | this.$backdrop 1123 | .one('bsTransitionEnd', callback) 1124 | .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : 1125 | callback() 1126 | 1127 | } else if (!this.isShown && this.$backdrop) { 1128 | this.$backdrop.removeClass('in') 1129 | 1130 | var callbackRemove = function () { 1131 | that.removeBackdrop() 1132 | callback && callback() 1133 | } 1134 | $.support.transition && this.$element.hasClass('fade') ? 1135 | this.$backdrop 1136 | .one('bsTransitionEnd', callbackRemove) 1137 | .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : 1138 | callbackRemove() 1139 | 1140 | } else if (callback) { 1141 | callback() 1142 | } 1143 | } 1144 | 1145 | // these following methods are used to handle overflowing modals 1146 | 1147 | Modal.prototype.handleUpdate = function () { 1148 | this.adjustDialog() 1149 | } 1150 | 1151 | Modal.prototype.adjustDialog = function () { 1152 | var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight 1153 | 1154 | this.$element.css({ 1155 | paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '', 1156 | paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '' 1157 | }) 1158 | } 1159 | 1160 | Modal.prototype.resetAdjustments = function () { 1161 | this.$element.css({ 1162 | paddingLeft: '', 1163 | paddingRight: '' 1164 | }) 1165 | } 1166 | 1167 | Modal.prototype.checkScrollbar = function () { 1168 | var fullWindowWidth = window.innerWidth 1169 | if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8 1170 | var documentElementRect = document.documentElement.getBoundingClientRect() 1171 | fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left) 1172 | } 1173 | this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth 1174 | this.scrollbarWidth = this.measureScrollbar() 1175 | } 1176 | 1177 | Modal.prototype.setScrollbar = function () { 1178 | var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) 1179 | this.originalBodyPad = document.body.style.paddingRight || '' 1180 | if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) 1181 | } 1182 | 1183 | Modal.prototype.resetScrollbar = function () { 1184 | this.$body.css('padding-right', this.originalBodyPad) 1185 | } 1186 | 1187 | Modal.prototype.measureScrollbar = function () { // thx walsh 1188 | var scrollDiv = document.createElement('div') 1189 | scrollDiv.className = 'modal-scrollbar-measure' 1190 | this.$body.append(scrollDiv) 1191 | var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth 1192 | this.$body[0].removeChild(scrollDiv) 1193 | return scrollbarWidth 1194 | } 1195 | 1196 | 1197 | // MODAL PLUGIN DEFINITION 1198 | // ======================= 1199 | 1200 | function Plugin(option, _relatedTarget) { 1201 | return this.each(function () { 1202 | var $this = $(this) 1203 | var data = $this.data('bs.modal') 1204 | var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) 1205 | 1206 | if (!data) $this.data('bs.modal', (data = new Modal(this, options))) 1207 | if (typeof option == 'string') data[option](_relatedTarget) 1208 | else if (options.show) data.show(_relatedTarget) 1209 | }) 1210 | } 1211 | 1212 | var old = $.fn.modal 1213 | 1214 | $.fn.modal = Plugin 1215 | $.fn.modal.Constructor = Modal 1216 | 1217 | 1218 | // MODAL NO CONFLICT 1219 | // ================= 1220 | 1221 | $.fn.modal.noConflict = function () { 1222 | $.fn.modal = old 1223 | return this 1224 | } 1225 | 1226 | 1227 | // MODAL DATA-API 1228 | // ============== 1229 | 1230 | $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { 1231 | var $this = $(this) 1232 | var href = $this.attr('href') 1233 | var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7 1234 | var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) 1235 | 1236 | if ($this.is('a')) e.preventDefault() 1237 | 1238 | $target.one('show.bs.modal', function (showEvent) { 1239 | if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown 1240 | $target.one('hidden.bs.modal', function () { 1241 | $this.is(':visible') && $this.trigger('focus') 1242 | }) 1243 | }) 1244 | Plugin.call($target, option, this) 1245 | }) 1246 | 1247 | }(jQuery); 1248 | 1249 | /* ======================================================================== 1250 | * Bootstrap: tooltip.js v3.3.5 1251 | * http://getbootstrap.com/javascript/#tooltip 1252 | * Inspired by the original jQuery.tipsy by Jason Frame 1253 | * ======================================================================== 1254 | * Copyright 2011-2015 Twitter, Inc. 1255 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 1256 | * ======================================================================== */ 1257 | 1258 | 1259 | +function ($) { 1260 | 'use strict'; 1261 | 1262 | // TOOLTIP PUBLIC CLASS DEFINITION 1263 | // =============================== 1264 | 1265 | var Tooltip = function (element, options) { 1266 | this.type = null 1267 | this.options = null 1268 | this.enabled = null 1269 | this.timeout = null 1270 | this.hoverState = null 1271 | this.$element = null 1272 | this.inState = null 1273 | 1274 | this.init('tooltip', element, options) 1275 | } 1276 | 1277 | Tooltip.VERSION = '3.3.5' 1278 | 1279 | Tooltip.TRANSITION_DURATION = 150 1280 | 1281 | Tooltip.DEFAULTS = { 1282 | animation: true, 1283 | placement: 'top', 1284 | selector: false, 1285 | template: '', 1286 | trigger: 'hover focus', 1287 | title: '', 1288 | delay: 0, 1289 | html: false, 1290 | container: false, 1291 | viewport: { 1292 | selector: 'body', 1293 | padding: 0 1294 | } 1295 | } 1296 | 1297 | Tooltip.prototype.init = function (type, element, options) { 1298 | this.enabled = true 1299 | this.type = type 1300 | this.$element = $(element) 1301 | this.options = this.getOptions(options) 1302 | this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport)) 1303 | this.inState = { click: false, hover: false, focus: false } 1304 | 1305 | if (this.$element[0] instanceof document.constructor && !this.options.selector) { 1306 | throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!') 1307 | } 1308 | 1309 | var triggers = this.options.trigger.split(' ') 1310 | 1311 | for (var i = triggers.length; i--;) { 1312 | var trigger = triggers[i] 1313 | 1314 | if (trigger == 'click') { 1315 | this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) 1316 | } else if (trigger != 'manual') { 1317 | var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' 1318 | var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' 1319 | 1320 | this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) 1321 | this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) 1322 | } 1323 | } 1324 | 1325 | this.options.selector ? 1326 | (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : 1327 | this.fixTitle() 1328 | } 1329 | 1330 | Tooltip.prototype.getDefaults = function () { 1331 | return Tooltip.DEFAULTS 1332 | } 1333 | 1334 | Tooltip.prototype.getOptions = function (options) { 1335 | options = $.extend({}, this.getDefaults(), this.$element.data(), options) 1336 | 1337 | if (options.delay && typeof options.delay == 'number') { 1338 | options.delay = { 1339 | show: options.delay, 1340 | hide: options.delay 1341 | } 1342 | } 1343 | 1344 | return options 1345 | } 1346 | 1347 | Tooltip.prototype.getDelegateOptions = function () { 1348 | var options = {} 1349 | var defaults = this.getDefaults() 1350 | 1351 | this._options && $.each(this._options, function (key, value) { 1352 | if (defaults[key] != value) options[key] = value 1353 | }) 1354 | 1355 | return options 1356 | } 1357 | 1358 | Tooltip.prototype.enter = function (obj) { 1359 | var self = obj instanceof this.constructor ? 1360 | obj : $(obj.currentTarget).data('bs.' + this.type) 1361 | 1362 | if (!self) { 1363 | self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) 1364 | $(obj.currentTarget).data('bs.' + this.type, self) 1365 | } 1366 | 1367 | if (obj instanceof $.Event) { 1368 | self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true 1369 | } 1370 | 1371 | if (self.tip().hasClass('in') || self.hoverState == 'in') { 1372 | self.hoverState = 'in' 1373 | return 1374 | } 1375 | 1376 | clearTimeout(self.timeout) 1377 | 1378 | self.hoverState = 'in' 1379 | 1380 | if (!self.options.delay || !self.options.delay.show) return self.show() 1381 | 1382 | self.timeout = setTimeout(function () { 1383 | if (self.hoverState == 'in') self.show() 1384 | }, self.options.delay.show) 1385 | } 1386 | 1387 | Tooltip.prototype.isInStateTrue = function () { 1388 | for (var key in this.inState) { 1389 | if (this.inState[key]) return true 1390 | } 1391 | 1392 | return false 1393 | } 1394 | 1395 | Tooltip.prototype.leave = function (obj) { 1396 | var self = obj instanceof this.constructor ? 1397 | obj : $(obj.currentTarget).data('bs.' + this.type) 1398 | 1399 | if (!self) { 1400 | self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) 1401 | $(obj.currentTarget).data('bs.' + this.type, self) 1402 | } 1403 | 1404 | if (obj instanceof $.Event) { 1405 | self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false 1406 | } 1407 | 1408 | if (self.isInStateTrue()) return 1409 | 1410 | clearTimeout(self.timeout) 1411 | 1412 | self.hoverState = 'out' 1413 | 1414 | if (!self.options.delay || !self.options.delay.hide) return self.hide() 1415 | 1416 | self.timeout = setTimeout(function () { 1417 | if (self.hoverState == 'out') self.hide() 1418 | }, self.options.delay.hide) 1419 | } 1420 | 1421 | Tooltip.prototype.show = function () { 1422 | var e = $.Event('show.bs.' + this.type) 1423 | 1424 | if (this.hasContent() && this.enabled) { 1425 | this.$element.trigger(e) 1426 | 1427 | var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) 1428 | if (e.isDefaultPrevented() || !inDom) return 1429 | var that = this 1430 | 1431 | var $tip = this.tip() 1432 | 1433 | var tipId = this.getUID(this.type) 1434 | 1435 | this.setContent() 1436 | $tip.attr('id', tipId) 1437 | this.$element.attr('aria-describedby', tipId) 1438 | 1439 | if (this.options.animation) $tip.addClass('fade') 1440 | 1441 | var placement = typeof this.options.placement == 'function' ? 1442 | this.options.placement.call(this, $tip[0], this.$element[0]) : 1443 | this.options.placement 1444 | 1445 | var autoToken = /\s?auto?\s?/i 1446 | var autoPlace = autoToken.test(placement) 1447 | if (autoPlace) placement = placement.replace(autoToken, '') || 'top' 1448 | 1449 | $tip 1450 | .detach() 1451 | .css({ top: 0, left: 0, display: 'block' }) 1452 | .addClass(placement) 1453 | .data('bs.' + this.type, this) 1454 | 1455 | this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) 1456 | this.$element.trigger('inserted.bs.' + this.type) 1457 | 1458 | var pos = this.getPosition() 1459 | var actualWidth = $tip[0].offsetWidth 1460 | var actualHeight = $tip[0].offsetHeight 1461 | 1462 | if (autoPlace) { 1463 | var orgPlacement = placement 1464 | var viewportDim = this.getPosition(this.$viewport) 1465 | 1466 | placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : 1467 | placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : 1468 | placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : 1469 | placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : 1470 | placement 1471 | 1472 | $tip 1473 | .removeClass(orgPlacement) 1474 | .addClass(placement) 1475 | } 1476 | 1477 | var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) 1478 | 1479 | this.applyPlacement(calculatedOffset, placement) 1480 | 1481 | var complete = function () { 1482 | var prevHoverState = that.hoverState 1483 | that.$element.trigger('shown.bs.' + that.type) 1484 | that.hoverState = null 1485 | 1486 | if (prevHoverState == 'out') that.leave(that) 1487 | } 1488 | 1489 | $.support.transition && this.$tip.hasClass('fade') ? 1490 | $tip 1491 | .one('bsTransitionEnd', complete) 1492 | .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : 1493 | complete() 1494 | } 1495 | } 1496 | 1497 | Tooltip.prototype.applyPlacement = function (offset, placement) { 1498 | var $tip = this.tip() 1499 | var width = $tip[0].offsetWidth 1500 | var height = $tip[0].offsetHeight 1501 | 1502 | // manually read margins because getBoundingClientRect includes difference 1503 | var marginTop = parseInt($tip.css('margin-top'), 10) 1504 | var marginLeft = parseInt($tip.css('margin-left'), 10) 1505 | 1506 | // we must check for NaN for ie 8/9 1507 | if (isNaN(marginTop)) marginTop = 0 1508 | if (isNaN(marginLeft)) marginLeft = 0 1509 | 1510 | offset.top += marginTop 1511 | offset.left += marginLeft 1512 | 1513 | // $.fn.offset doesn't round pixel values 1514 | // so we use setOffset directly with our own function B-0 1515 | $.offset.setOffset($tip[0], $.extend({ 1516 | using: function (props) { 1517 | $tip.css({ 1518 | top: Math.round(props.top), 1519 | left: Math.round(props.left) 1520 | }) 1521 | } 1522 | }, offset), 0) 1523 | 1524 | $tip.addClass('in') 1525 | 1526 | // check to see if placing tip in new offset caused the tip to resize itself 1527 | var actualWidth = $tip[0].offsetWidth 1528 | var actualHeight = $tip[0].offsetHeight 1529 | 1530 | if (placement == 'top' && actualHeight != height) { 1531 | offset.top = offset.top + height - actualHeight 1532 | } 1533 | 1534 | var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) 1535 | 1536 | if (delta.left) offset.left += delta.left 1537 | else offset.top += delta.top 1538 | 1539 | var isVertical = /top|bottom/.test(placement) 1540 | var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight 1541 | var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' 1542 | 1543 | $tip.offset(offset) 1544 | this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) 1545 | } 1546 | 1547 | Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) { 1548 | this.arrow() 1549 | .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') 1550 | .css(isVertical ? 'top' : 'left', '') 1551 | } 1552 | 1553 | Tooltip.prototype.setContent = function () { 1554 | var $tip = this.tip() 1555 | var title = this.getTitle() 1556 | 1557 | $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) 1558 | $tip.removeClass('fade in top bottom left right') 1559 | } 1560 | 1561 | Tooltip.prototype.hide = function (callback) { 1562 | var that = this 1563 | var $tip = $(this.$tip) 1564 | var e = $.Event('hide.bs.' + this.type) 1565 | 1566 | function complete() { 1567 | if (that.hoverState != 'in') $tip.detach() 1568 | that.$element 1569 | .removeAttr('aria-describedby') 1570 | .trigger('hidden.bs.' + that.type) 1571 | callback && callback() 1572 | } 1573 | 1574 | this.$element.trigger(e) 1575 | 1576 | if (e.isDefaultPrevented()) return 1577 | 1578 | $tip.removeClass('in') 1579 | 1580 | $.support.transition && $tip.hasClass('fade') ? 1581 | $tip 1582 | .one('bsTransitionEnd', complete) 1583 | .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : 1584 | complete() 1585 | 1586 | this.hoverState = null 1587 | 1588 | return this 1589 | } 1590 | 1591 | Tooltip.prototype.fixTitle = function () { 1592 | var $e = this.$element 1593 | if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') { 1594 | $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') 1595 | } 1596 | } 1597 | 1598 | Tooltip.prototype.hasContent = function () { 1599 | return this.getTitle() 1600 | } 1601 | 1602 | Tooltip.prototype.getPosition = function ($element) { 1603 | $element = $element || this.$element 1604 | 1605 | var el = $element[0] 1606 | var isBody = el.tagName == 'BODY' 1607 | 1608 | var elRect = el.getBoundingClientRect() 1609 | if (elRect.width == null) { 1610 | // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 1611 | elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) 1612 | } 1613 | var elOffset = isBody ? { top: 0, left: 0 } : $element.offset() 1614 | var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } 1615 | var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null 1616 | 1617 | return $.extend({}, elRect, scroll, outerDims, elOffset) 1618 | } 1619 | 1620 | Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { 1621 | return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : 1622 | placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : 1623 | placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : 1624 | /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } 1625 | 1626 | } 1627 | 1628 | Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { 1629 | var delta = { top: 0, left: 0 } 1630 | if (!this.$viewport) return delta 1631 | 1632 | var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 1633 | var viewportDimensions = this.getPosition(this.$viewport) 1634 | 1635 | if (/right|left/.test(placement)) { 1636 | var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll 1637 | var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight 1638 | if (topEdgeOffset < viewportDimensions.top) { // top overflow 1639 | delta.top = viewportDimensions.top - topEdgeOffset 1640 | } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow 1641 | delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset 1642 | } 1643 | } else { 1644 | var leftEdgeOffset = pos.left - viewportPadding 1645 | var rightEdgeOffset = pos.left + viewportPadding + actualWidth 1646 | if (leftEdgeOffset < viewportDimensions.left) { // left overflow 1647 | delta.left = viewportDimensions.left - leftEdgeOffset 1648 | } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow 1649 | delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset 1650 | } 1651 | } 1652 | 1653 | return delta 1654 | } 1655 | 1656 | Tooltip.prototype.getTitle = function () { 1657 | var title 1658 | var $e = this.$element 1659 | var o = this.options 1660 | 1661 | title = $e.attr('data-original-title') 1662 | || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) 1663 | 1664 | return title 1665 | } 1666 | 1667 | Tooltip.prototype.getUID = function (prefix) { 1668 | do prefix += ~~(Math.random() * 1000000) 1669 | while (document.getElementById(prefix)) 1670 | return prefix 1671 | } 1672 | 1673 | Tooltip.prototype.tip = function () { 1674 | if (!this.$tip) { 1675 | this.$tip = $(this.options.template) 1676 | if (this.$tip.length != 1) { 1677 | throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!') 1678 | } 1679 | } 1680 | return this.$tip 1681 | } 1682 | 1683 | Tooltip.prototype.arrow = function () { 1684 | return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) 1685 | } 1686 | 1687 | Tooltip.prototype.enable = function () { 1688 | this.enabled = true 1689 | } 1690 | 1691 | Tooltip.prototype.disable = function () { 1692 | this.enabled = false 1693 | } 1694 | 1695 | Tooltip.prototype.toggleEnabled = function () { 1696 | this.enabled = !this.enabled 1697 | } 1698 | 1699 | Tooltip.prototype.toggle = function (e) { 1700 | var self = this 1701 | if (e) { 1702 | self = $(e.currentTarget).data('bs.' + this.type) 1703 | if (!self) { 1704 | self = new this.constructor(e.currentTarget, this.getDelegateOptions()) 1705 | $(e.currentTarget).data('bs.' + this.type, self) 1706 | } 1707 | } 1708 | 1709 | if (e) { 1710 | self.inState.click = !self.inState.click 1711 | if (self.isInStateTrue()) self.enter(self) 1712 | else self.leave(self) 1713 | } else { 1714 | self.tip().hasClass('in') ? self.leave(self) : self.enter(self) 1715 | } 1716 | } 1717 | 1718 | Tooltip.prototype.destroy = function () { 1719 | var that = this 1720 | clearTimeout(this.timeout) 1721 | this.hide(function () { 1722 | that.$element.off('.' + that.type).removeData('bs.' + that.type) 1723 | if (that.$tip) { 1724 | that.$tip.detach() 1725 | } 1726 | that.$tip = null 1727 | that.$arrow = null 1728 | that.$viewport = null 1729 | }) 1730 | } 1731 | 1732 | 1733 | // TOOLTIP PLUGIN DEFINITION 1734 | // ========================= 1735 | 1736 | function Plugin(option) { 1737 | return this.each(function () { 1738 | var $this = $(this) 1739 | var data = $this.data('bs.tooltip') 1740 | var options = typeof option == 'object' && option 1741 | 1742 | if (!data && /destroy|hide/.test(option)) return 1743 | if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) 1744 | if (typeof option == 'string') data[option]() 1745 | }) 1746 | } 1747 | 1748 | var old = $.fn.tooltip 1749 | 1750 | $.fn.tooltip = Plugin 1751 | $.fn.tooltip.Constructor = Tooltip 1752 | 1753 | 1754 | // TOOLTIP NO CONFLICT 1755 | // =================== 1756 | 1757 | $.fn.tooltip.noConflict = function () { 1758 | $.fn.tooltip = old 1759 | return this 1760 | } 1761 | 1762 | }(jQuery); 1763 | 1764 | /* ======================================================================== 1765 | * Bootstrap: popover.js v3.3.5 1766 | * http://getbootstrap.com/javascript/#popovers 1767 | * ======================================================================== 1768 | * Copyright 2011-2015 Twitter, Inc. 1769 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 1770 | * ======================================================================== */ 1771 | 1772 | 1773 | +function ($) { 1774 | 'use strict'; 1775 | 1776 | // POPOVER PUBLIC CLASS DEFINITION 1777 | // =============================== 1778 | 1779 | var Popover = function (element, options) { 1780 | this.init('popover', element, options) 1781 | } 1782 | 1783 | if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') 1784 | 1785 | Popover.VERSION = '3.3.5' 1786 | 1787 | Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { 1788 | placement: 'right', 1789 | trigger: 'click', 1790 | content: '', 1791 | template: '' 1792 | }) 1793 | 1794 | 1795 | // NOTE: POPOVER EXTENDS tooltip.js 1796 | // ================================ 1797 | 1798 | Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) 1799 | 1800 | Popover.prototype.constructor = Popover 1801 | 1802 | Popover.prototype.getDefaults = function () { 1803 | return Popover.DEFAULTS 1804 | } 1805 | 1806 | Popover.prototype.setContent = function () { 1807 | var $tip = this.tip() 1808 | var title = this.getTitle() 1809 | var content = this.getContent() 1810 | 1811 | $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) 1812 | $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events 1813 | this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' 1814 | ](content) 1815 | 1816 | $tip.removeClass('fade top bottom left right in') 1817 | 1818 | // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do 1819 | // this manually by checking the contents. 1820 | if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() 1821 | } 1822 | 1823 | Popover.prototype.hasContent = function () { 1824 | return this.getTitle() || this.getContent() 1825 | } 1826 | 1827 | Popover.prototype.getContent = function () { 1828 | var $e = this.$element 1829 | var o = this.options 1830 | 1831 | return $e.attr('data-content') 1832 | || (typeof o.content == 'function' ? 1833 | o.content.call($e[0]) : 1834 | o.content) 1835 | } 1836 | 1837 | Popover.prototype.arrow = function () { 1838 | return (this.$arrow = this.$arrow || this.tip().find('.arrow')) 1839 | } 1840 | 1841 | 1842 | // POPOVER PLUGIN DEFINITION 1843 | // ========================= 1844 | 1845 | function Plugin(option) { 1846 | return this.each(function () { 1847 | var $this = $(this) 1848 | var data = $this.data('bs.popover') 1849 | var options = typeof option == 'object' && option 1850 | 1851 | if (!data && /destroy|hide/.test(option)) return 1852 | if (!data) $this.data('bs.popover', (data = new Popover(this, options))) 1853 | if (typeof option == 'string') data[option]() 1854 | }) 1855 | } 1856 | 1857 | var old = $.fn.popover 1858 | 1859 | $.fn.popover = Plugin 1860 | $.fn.popover.Constructor = Popover 1861 | 1862 | 1863 | // POPOVER NO CONFLICT 1864 | // =================== 1865 | 1866 | $.fn.popover.noConflict = function () { 1867 | $.fn.popover = old 1868 | return this 1869 | } 1870 | 1871 | }(jQuery); 1872 | 1873 | /* ======================================================================== 1874 | * Bootstrap: scrollspy.js v3.3.5 1875 | * http://getbootstrap.com/javascript/#scrollspy 1876 | * ======================================================================== 1877 | * Copyright 2011-2015 Twitter, Inc. 1878 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 1879 | * ======================================================================== */ 1880 | 1881 | 1882 | +function ($) { 1883 | 'use strict'; 1884 | 1885 | // SCROLLSPY CLASS DEFINITION 1886 | // ========================== 1887 | 1888 | function ScrollSpy(element, options) { 1889 | this.$body = $(document.body) 1890 | this.$scrollElement = $(element).is(document.body) ? $(window) : $(element) 1891 | this.options = $.extend({}, ScrollSpy.DEFAULTS, options) 1892 | this.selector = (this.options.target || '') + ' .nav li > a' 1893 | this.offsets = [] 1894 | this.targets = [] 1895 | this.activeTarget = null 1896 | this.scrollHeight = 0 1897 | 1898 | this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this)) 1899 | this.refresh() 1900 | this.process() 1901 | } 1902 | 1903 | ScrollSpy.VERSION = '3.3.5' 1904 | 1905 | ScrollSpy.DEFAULTS = { 1906 | offset: 10 1907 | } 1908 | 1909 | ScrollSpy.prototype.getScrollHeight = function () { 1910 | return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) 1911 | } 1912 | 1913 | ScrollSpy.prototype.refresh = function () { 1914 | var that = this 1915 | var offsetMethod = 'offset' 1916 | var offsetBase = 0 1917 | 1918 | this.offsets = [] 1919 | this.targets = [] 1920 | this.scrollHeight = this.getScrollHeight() 1921 | 1922 | if (!$.isWindow(this.$scrollElement[0])) { 1923 | offsetMethod = 'position' 1924 | offsetBase = this.$scrollElement.scrollTop() 1925 | } 1926 | 1927 | this.$body 1928 | .find(this.selector) 1929 | .map(function () { 1930 | var $el = $(this) 1931 | var href = $el.data('target') || $el.attr('href') 1932 | var $href = /^#./.test(href) && $(href) 1933 | 1934 | return ($href 1935 | && $href.length 1936 | && $href.is(':visible') 1937 | && [[$href[offsetMethod]().top + offsetBase, href]]) || null 1938 | }) 1939 | .sort(function (a, b) { return a[0] - b[0] }) 1940 | .each(function () { 1941 | that.offsets.push(this[0]) 1942 | that.targets.push(this[1]) 1943 | }) 1944 | } 1945 | 1946 | ScrollSpy.prototype.process = function () { 1947 | var scrollTop = this.$scrollElement.scrollTop() + this.options.offset 1948 | var scrollHeight = this.getScrollHeight() 1949 | var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() 1950 | var offsets = this.offsets 1951 | var targets = this.targets 1952 | var activeTarget = this.activeTarget 1953 | var i 1954 | 1955 | if (this.scrollHeight != scrollHeight) { 1956 | this.refresh() 1957 | } 1958 | 1959 | if (scrollTop >= maxScroll) { 1960 | return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) 1961 | } 1962 | 1963 | if (activeTarget && scrollTop < offsets[0]) { 1964 | this.activeTarget = null 1965 | return this.clear() 1966 | } 1967 | 1968 | for (i = offsets.length; i--;) { 1969 | activeTarget != targets[i] 1970 | && scrollTop >= offsets[i] 1971 | && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1]) 1972 | && this.activate(targets[i]) 1973 | } 1974 | } 1975 | 1976 | ScrollSpy.prototype.activate = function (target) { 1977 | this.activeTarget = target 1978 | 1979 | this.clear() 1980 | 1981 | var selector = this.selector + 1982 | '[data-target="' + target + '"],' + 1983 | this.selector + '[href="' + target + '"]' 1984 | 1985 | var active = $(selector) 1986 | .parents('li') 1987 | .addClass('active') 1988 | 1989 | if (active.parent('.dropdown-menu').length) { 1990 | active = active 1991 | .closest('li.dropdown') 1992 | .addClass('active') 1993 | } 1994 | 1995 | active.trigger('activate.bs.scrollspy') 1996 | } 1997 | 1998 | ScrollSpy.prototype.clear = function () { 1999 | $(this.selector) 2000 | .parentsUntil(this.options.target, '.active') 2001 | .removeClass('active') 2002 | } 2003 | 2004 | 2005 | // SCROLLSPY PLUGIN DEFINITION 2006 | // =========================== 2007 | 2008 | function Plugin(option) { 2009 | return this.each(function () { 2010 | var $this = $(this) 2011 | var data = $this.data('bs.scrollspy') 2012 | var options = typeof option == 'object' && option 2013 | 2014 | if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) 2015 | if (typeof option == 'string') data[option]() 2016 | }) 2017 | } 2018 | 2019 | var old = $.fn.scrollspy 2020 | 2021 | $.fn.scrollspy = Plugin 2022 | $.fn.scrollspy.Constructor = ScrollSpy 2023 | 2024 | 2025 | // SCROLLSPY NO CONFLICT 2026 | // ===================== 2027 | 2028 | $.fn.scrollspy.noConflict = function () { 2029 | $.fn.scrollspy = old 2030 | return this 2031 | } 2032 | 2033 | 2034 | // SCROLLSPY DATA-API 2035 | // ================== 2036 | 2037 | $(window).on('load.bs.scrollspy.data-api', function () { 2038 | $('[data-spy="scroll"]').each(function () { 2039 | var $spy = $(this) 2040 | Plugin.call($spy, $spy.data()) 2041 | }) 2042 | }) 2043 | 2044 | }(jQuery); 2045 | 2046 | /* ======================================================================== 2047 | * Bootstrap: tab.js v3.3.5 2048 | * http://getbootstrap.com/javascript/#tabs 2049 | * ======================================================================== 2050 | * Copyright 2011-2015 Twitter, Inc. 2051 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 2052 | * ======================================================================== */ 2053 | 2054 | 2055 | +function ($) { 2056 | 'use strict'; 2057 | 2058 | // TAB CLASS DEFINITION 2059 | // ==================== 2060 | 2061 | var Tab = function (element) { 2062 | // jscs:disable requireDollarBeforejQueryAssignment 2063 | this.element = $(element) 2064 | // jscs:enable requireDollarBeforejQueryAssignment 2065 | } 2066 | 2067 | Tab.VERSION = '3.3.5' 2068 | 2069 | Tab.TRANSITION_DURATION = 150 2070 | 2071 | Tab.prototype.show = function () { 2072 | var $this = this.element 2073 | var $ul = $this.closest('ul:not(.dropdown-menu)') 2074 | var selector = $this.data('target') 2075 | 2076 | if (!selector) { 2077 | selector = $this.attr('href') 2078 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 2079 | } 2080 | 2081 | if ($this.parent('li').hasClass('active')) return 2082 | 2083 | var $previous = $ul.find('.active:last a') 2084 | var hideEvent = $.Event('hide.bs.tab', { 2085 | relatedTarget: $this[0] 2086 | }) 2087 | var showEvent = $.Event('show.bs.tab', { 2088 | relatedTarget: $previous[0] 2089 | }) 2090 | 2091 | $previous.trigger(hideEvent) 2092 | $this.trigger(showEvent) 2093 | 2094 | if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return 2095 | 2096 | var $target = $(selector) 2097 | 2098 | this.activate($this.closest('li'), $ul) 2099 | this.activate($target, $target.parent(), function () { 2100 | $previous.trigger({ 2101 | type: 'hidden.bs.tab', 2102 | relatedTarget: $this[0] 2103 | }) 2104 | $this.trigger({ 2105 | type: 'shown.bs.tab', 2106 | relatedTarget: $previous[0] 2107 | }) 2108 | }) 2109 | } 2110 | 2111 | Tab.prototype.activate = function (element, container, callback) { 2112 | var $active = container.find('> .active') 2113 | var transition = callback 2114 | && $.support.transition 2115 | && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length) 2116 | 2117 | function next() { 2118 | $active 2119 | .removeClass('active') 2120 | .find('> .dropdown-menu > .active') 2121 | .removeClass('active') 2122 | .end() 2123 | .find('[data-toggle="tab"]') 2124 | .attr('aria-expanded', false) 2125 | 2126 | element 2127 | .addClass('active') 2128 | .find('[data-toggle="tab"]') 2129 | .attr('aria-expanded', true) 2130 | 2131 | if (transition) { 2132 | element[0].offsetWidth // reflow for transition 2133 | element.addClass('in') 2134 | } else { 2135 | element.removeClass('fade') 2136 | } 2137 | 2138 | if (element.parent('.dropdown-menu').length) { 2139 | element 2140 | .closest('li.dropdown') 2141 | .addClass('active') 2142 | .end() 2143 | .find('[data-toggle="tab"]') 2144 | .attr('aria-expanded', true) 2145 | } 2146 | 2147 | callback && callback() 2148 | } 2149 | 2150 | $active.length && transition ? 2151 | $active 2152 | .one('bsTransitionEnd', next) 2153 | .emulateTransitionEnd(Tab.TRANSITION_DURATION) : 2154 | next() 2155 | 2156 | $active.removeClass('in') 2157 | } 2158 | 2159 | 2160 | // TAB PLUGIN DEFINITION 2161 | // ===================== 2162 | 2163 | function Plugin(option) { 2164 | return this.each(function () { 2165 | var $this = $(this) 2166 | var data = $this.data('bs.tab') 2167 | 2168 | if (!data) $this.data('bs.tab', (data = new Tab(this))) 2169 | if (typeof option == 'string') data[option]() 2170 | }) 2171 | } 2172 | 2173 | var old = $.fn.tab 2174 | 2175 | $.fn.tab = Plugin 2176 | $.fn.tab.Constructor = Tab 2177 | 2178 | 2179 | // TAB NO CONFLICT 2180 | // =============== 2181 | 2182 | $.fn.tab.noConflict = function () { 2183 | $.fn.tab = old 2184 | return this 2185 | } 2186 | 2187 | 2188 | // TAB DATA-API 2189 | // ============ 2190 | 2191 | var clickHandler = function (e) { 2192 | e.preventDefault() 2193 | Plugin.call($(this), 'show') 2194 | } 2195 | 2196 | $(document) 2197 | .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) 2198 | .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) 2199 | 2200 | }(jQuery); 2201 | 2202 | /* ======================================================================== 2203 | * Bootstrap: affix.js v3.3.5 2204 | * http://getbootstrap.com/javascript/#affix 2205 | * ======================================================================== 2206 | * Copyright 2011-2015 Twitter, Inc. 2207 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 2208 | * ======================================================================== */ 2209 | 2210 | 2211 | +function ($) { 2212 | 'use strict'; 2213 | 2214 | // AFFIX CLASS DEFINITION 2215 | // ====================== 2216 | 2217 | var Affix = function (element, options) { 2218 | this.options = $.extend({}, Affix.DEFAULTS, options) 2219 | 2220 | this.$target = $(this.options.target) 2221 | .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) 2222 | .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) 2223 | 2224 | this.$element = $(element) 2225 | this.affixed = null 2226 | this.unpin = null 2227 | this.pinnedOffset = null 2228 | 2229 | this.checkPosition() 2230 | } 2231 | 2232 | Affix.VERSION = '3.3.5' 2233 | 2234 | Affix.RESET = 'affix affix-top affix-bottom' 2235 | 2236 | Affix.DEFAULTS = { 2237 | offset: 0, 2238 | target: window 2239 | } 2240 | 2241 | Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) { 2242 | var scrollTop = this.$target.scrollTop() 2243 | var position = this.$element.offset() 2244 | var targetHeight = this.$target.height() 2245 | 2246 | if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false 2247 | 2248 | if (this.affixed == 'bottom') { 2249 | if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom' 2250 | return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom' 2251 | } 2252 | 2253 | var initializing = this.affixed == null 2254 | var colliderTop = initializing ? scrollTop : position.top 2255 | var colliderHeight = initializing ? targetHeight : height 2256 | 2257 | if (offsetTop != null && scrollTop <= offsetTop) return 'top' 2258 | if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom' 2259 | 2260 | return false 2261 | } 2262 | 2263 | Affix.prototype.getPinnedOffset = function () { 2264 | if (this.pinnedOffset) return this.pinnedOffset 2265 | this.$element.removeClass(Affix.RESET).addClass('affix') 2266 | var scrollTop = this.$target.scrollTop() 2267 | var position = this.$element.offset() 2268 | return (this.pinnedOffset = position.top - scrollTop) 2269 | } 2270 | 2271 | Affix.prototype.checkPositionWithEventLoop = function () { 2272 | setTimeout($.proxy(this.checkPosition, this), 1) 2273 | } 2274 | 2275 | Affix.prototype.checkPosition = function () { 2276 | if (!this.$element.is(':visible')) return 2277 | 2278 | var height = this.$element.height() 2279 | var offset = this.options.offset 2280 | var offsetTop = offset.top 2281 | var offsetBottom = offset.bottom 2282 | var scrollHeight = Math.max($(document).height(), $(document.body).height()) 2283 | 2284 | if (typeof offset != 'object') offsetBottom = offsetTop = offset 2285 | if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) 2286 | if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) 2287 | 2288 | var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom) 2289 | 2290 | if (this.affixed != affix) { 2291 | if (this.unpin != null) this.$element.css('top', '') 2292 | 2293 | var affixType = 'affix' + (affix ? '-' + affix : '') 2294 | var e = $.Event(affixType + '.bs.affix') 2295 | 2296 | this.$element.trigger(e) 2297 | 2298 | if (e.isDefaultPrevented()) return 2299 | 2300 | this.affixed = affix 2301 | this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null 2302 | 2303 | this.$element 2304 | .removeClass(Affix.RESET) 2305 | .addClass(affixType) 2306 | .trigger(affixType.replace('affix', 'affixed') + '.bs.affix') 2307 | } 2308 | 2309 | if (affix == 'bottom') { 2310 | this.$element.offset({ 2311 | top: scrollHeight - height - offsetBottom 2312 | }) 2313 | } 2314 | } 2315 | 2316 | 2317 | // AFFIX PLUGIN DEFINITION 2318 | // ======================= 2319 | 2320 | function Plugin(option) { 2321 | return this.each(function () { 2322 | var $this = $(this) 2323 | var data = $this.data('bs.affix') 2324 | var options = typeof option == 'object' && option 2325 | 2326 | if (!data) $this.data('bs.affix', (data = new Affix(this, options))) 2327 | if (typeof option == 'string') data[option]() 2328 | }) 2329 | } 2330 | 2331 | var old = $.fn.affix 2332 | 2333 | $.fn.affix = Plugin 2334 | $.fn.affix.Constructor = Affix 2335 | 2336 | 2337 | // AFFIX NO CONFLICT 2338 | // ================= 2339 | 2340 | $.fn.affix.noConflict = function () { 2341 | $.fn.affix = old 2342 | return this 2343 | } 2344 | 2345 | 2346 | // AFFIX DATA-API 2347 | // ============== 2348 | 2349 | $(window).on('load', function () { 2350 | $('[data-spy="affix"]').each(function () { 2351 | var $spy = $(this) 2352 | var data = $spy.data() 2353 | 2354 | data.offset = data.offset || {} 2355 | 2356 | if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom 2357 | if (data.offsetTop != null) data.offset.top = data.offsetTop 2358 | 2359 | Plugin.call($spy, data) 2360 | }) 2361 | }) 2362 | 2363 | }(jQuery); 2364 | -------------------------------------------------------------------------------- /ccr/static/ccr/js/editor.js: -------------------------------------------------------------------------------- 1 | function getfilename() 2 | { 3 | file_name = document.getElementById('file_name').value; 4 | if(file_name!="") 5 | { 6 | savefile(); 7 | if(file_name=="template") 8 | { 9 | $('#status').html("Status : Ready"); 10 | document.getElementById('file_name').value = ""; 11 | $('#file_save').show(); 12 | } 13 | } 14 | else 15 | $('#file_save').show(); 16 | } 17 | 18 | function savefile() 19 | { 20 | $("#status").html("Status : Saving File.."); 21 | var editor = ace.edit("editor"); 22 | //Make an ajax call with these parameters 23 | write_code = editor.getSession().getValue(); //Code 24 | test_case = document.getElementById('input').value; //Input 25 | file_name = document.getElementById('file_name').value; 26 | token = document.getElementsByName('csrfmiddlewaretoken')[0].value; //Token 27 | if(file_name=="") 28 | { 29 | alert("Please enter a file name."); 30 | return false; 31 | } 32 | $.post 33 | ( 34 | "/ccr/save/", 35 | { 36 | csrfmiddlewaretoken:token, 37 | code:write_code, 38 | input:test_case, 39 | file:file_name 40 | }, 41 | function(data,status) 42 | { 43 | $('#status').html(data); 44 | } 45 | ); 46 | $('#file_save').hide(); 47 | name = "File : saved/" + file_name + ".cpp"; 48 | $('#file_name_label').html(name) 49 | return false; 50 | } 51 | 52 | function loadeditor(language) 53 | { 54 | $("#file_save").hide(); 55 | $("#sharing").hide(); 56 | if(language=="python") 57 | $('#editor').html("#Write your code here\n"); 58 | else 59 | $('#editor').html("//Write your code here\n"); 60 | var editor = ace.edit("editor"); 61 | var mode="ace/mode/"+language; 62 | editor.getSession().setMode(mode); 63 | token = document.getElementsByName('csrfmiddlewaretoken')[0].value; //Token 64 | $('#editor').focus(); 65 | $.post 66 | ( 67 | "/ccr/template/", 68 | { 69 | csrfmiddlewaretoken:token, 70 | }, 71 | function(data,status) 72 | { 73 | if(data!="") 74 | editor.setValue(data); 75 | } 76 | ) 77 | $('#editor').focus(); 78 | } 79 | 80 | function doCompile() 81 | { 82 | $('#status').html("Status : Compiling.."); 83 | var editor = ace.edit("editor"); 84 | 85 | //Make an ajax call with these parameters 86 | write_code = editor.getSession().getValue(); //Code 87 | test_case = document.getElementById('input').value; //Input 88 | token = document.getElementsByName('csrfmiddlewaretoken')[0].value; //Token 89 | utoken = document.getElementById('uniquetoken').value; //To distinguish different tabs 90 | 91 | $.post 92 | ( 93 | "/ccr/compile/", 94 | { 95 | csrfmiddlewaretoken:token, 96 | uniquetoken:utoken, 97 | code:write_code, 98 | input:test_case 99 | }, 100 | function(data,status) 101 | { 102 | $('#response').html(data); 103 | } 104 | ); 105 | } 106 | 107 | function doRun() 108 | { 109 | $('#status').html("Status : Executing.."); 110 | var editor = ace.edit("editor"); 111 | 112 | //Make an ajax call with these parameters 113 | write_code = editor.getSession().getValue(); 114 | test_case = document.getElementById('input').value; 115 | token = document.getElementsByName('csrfmiddlewaretoken')[0].value; 116 | utoken = document.getElementById('uniquetoken').value; 117 | 118 | $.post 119 | ( 120 | "/ccr/run/", 121 | { 122 | csrfmiddlewaretoken : token, 123 | uniquetoken:utoken, 124 | code:write_code, 125 | input:test_case 126 | }, 127 | function(data,status) 128 | { 129 | $('#response').html(data); 130 | } 131 | ); 132 | } -------------------------------------------------------------------------------- /ccr/static/ccr/js/mode-c_cpp.js: -------------------------------------------------------------------------------- 1 | define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { 2 | "use strict"; 3 | 4 | var oop = require("../lib/oop"); 5 | var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; 6 | 7 | var DocCommentHighlightRules = function() { 8 | this.$rules = { 9 | "start" : [ { 10 | token : "comment.doc.tag", 11 | regex : "@[\\w\\d_]+" // TODO: fix email addresses 12 | }, 13 | DocCommentHighlightRules.getTagRule(), 14 | { 15 | defaultToken : "comment.doc", 16 | caseInsensitive: true 17 | }] 18 | }; 19 | }; 20 | 21 | oop.inherits(DocCommentHighlightRules, TextHighlightRules); 22 | 23 | DocCommentHighlightRules.getTagRule = function(start) { 24 | return { 25 | token : "comment.doc.tag.storage.type", 26 | regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b" 27 | }; 28 | } 29 | 30 | DocCommentHighlightRules.getStartRule = function(start) { 31 | return { 32 | token : "comment.doc", // doc comment 33 | regex : "\\/\\*(?=\\*)", 34 | next : start 35 | }; 36 | }; 37 | 38 | DocCommentHighlightRules.getEndRule = function (start) { 39 | return { 40 | token : "comment.doc", // closing comment 41 | regex : "\\*\\/", 42 | next : start 43 | }; 44 | }; 45 | 46 | 47 | exports.DocCommentHighlightRules = DocCommentHighlightRules; 48 | 49 | }); 50 | 51 | define("ace/mode/c_cpp_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) { 52 | "use strict"; 53 | 54 | var oop = require("../lib/oop"); 55 | var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; 56 | var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; 57 | var cFunctions = exports.cFunctions = "\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\b" 58 | 59 | var c_cppHighlightRules = function() { 60 | 61 | var keywordControls = ( 62 | "break|case|continue|default|do|else|for|goto|if|_Pragma|" + 63 | "return|switch|while|catch|operator|try|throw|using" 64 | ); 65 | 66 | var storageType = ( 67 | "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + 68 | "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + 69 | "class|wchar_t|template|char16_t|char32_t" 70 | ); 71 | 72 | var storageModifiers = ( 73 | "const|extern|register|restrict|static|volatile|inline|private|" + 74 | "protected|public|friend|explicit|virtual|export|mutable|typename|" + 75 | "constexpr|new|delete|alignas|alignof|decltype|noexcept|thread_local" 76 | ); 77 | 78 | var keywordOperators = ( 79 | "and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" + 80 | "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace" 81 | ); 82 | 83 | var builtinConstants = ( 84 | "NULL|true|false|TRUE|FALSE|nullptr" 85 | ); 86 | 87 | var keywordMapper = this.$keywords = this.createKeywordMapper({ 88 | "keyword.control" : keywordControls, 89 | "storage.type" : storageType, 90 | "storage.modifier" : storageModifiers, 91 | "keyword.operator" : keywordOperators, 92 | "variable.language": "this", 93 | "constant.language": builtinConstants 94 | }, "identifier"); 95 | 96 | var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b"; 97 | 98 | this.$rules = { 99 | "start" : [ 100 | { 101 | token : "comment", 102 | regex : "//$", 103 | next : "start" 104 | }, { 105 | token : "comment", 106 | regex : "//", 107 | next : "singleLineComment" 108 | }, 109 | DocCommentHighlightRules.getStartRule("doc-start"), 110 | { 111 | token : "comment", // multi line comment 112 | regex : "\\/\\*", 113 | next : "comment" 114 | }, { 115 | token : "string", // single line 116 | regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' 117 | }, { 118 | token : "string", // multi line string start 119 | regex : '["].*\\\\$', 120 | next : "qqstring" 121 | }, { 122 | token : "string", // single line 123 | regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" 124 | }, { 125 | token : "string", // multi line string start 126 | regex : "['].*\\\\$", 127 | next : "qstring" 128 | }, { 129 | token : "constant.numeric", // hex 130 | regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" 131 | }, { 132 | token : "constant.numeric", // float 133 | regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" 134 | }, { 135 | token : "keyword", // pre-compiler directives 136 | regex : "#\\s*(?:include|import|pragma|line|define|undef)\\b", 137 | next : "directive" 138 | }, { 139 | token : "keyword", // special case pre-compiler directive 140 | regex : "#\\s*(?:endif|if|ifdef|else|elif|ifndef)\\b" 141 | }, { 142 | token : "support.function.C99.c", 143 | regex : cFunctions 144 | }, { 145 | token : keywordMapper, 146 | regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" 147 | }, { 148 | token : "keyword.operator", 149 | regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)" 150 | }, { 151 | token : "punctuation.operator", 152 | regex : "\\?|\\:|\\,|\\;|\\." 153 | }, { 154 | token : "paren.lparen", 155 | regex : "[[({]" 156 | }, { 157 | token : "paren.rparen", 158 | regex : "[\\])}]" 159 | }, { 160 | token : "text", 161 | regex : "\\s+" 162 | } 163 | ], 164 | "comment" : [ 165 | { 166 | token : "comment", // closing comment 167 | regex : ".*?\\*\\/", 168 | next : "start" 169 | }, { 170 | token : "comment", // comment spanning whole line 171 | regex : ".+" 172 | } 173 | ], 174 | "singleLineComment" : [ 175 | { 176 | token : "comment", 177 | regex : /\\$/, 178 | next : "singleLineComment" 179 | }, { 180 | token : "comment", 181 | regex : /$/, 182 | next : "start" 183 | }, { 184 | defaultToken: "comment" 185 | } 186 | ], 187 | "qqstring" : [ 188 | { 189 | token : "string", 190 | regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', 191 | next : "start" 192 | }, { 193 | defaultToken : "string" 194 | } 195 | ], 196 | "qstring" : [ 197 | { 198 | token : "string", 199 | regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", 200 | next : "start" 201 | }, { 202 | defaultToken : "string" 203 | } 204 | ], 205 | "directive" : [ 206 | { 207 | token : "constant.other.multiline", 208 | regex : /\\/ 209 | }, 210 | { 211 | token : "constant.other.multiline", 212 | regex : /.*\\/ 213 | }, 214 | { 215 | token : "constant.other", 216 | regex : "\\s*<.+?>", 217 | next : "start" 218 | }, 219 | { 220 | token : "constant.other", // single line 221 | regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]', 222 | next : "start" 223 | }, 224 | { 225 | token : "constant.other", // single line 226 | regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']", 227 | next : "start" 228 | }, 229 | { 230 | token : "constant.other", 231 | regex : /[^\\\/]+/, 232 | next : "start" 233 | } 234 | ] 235 | }; 236 | 237 | this.embedRules(DocCommentHighlightRules, "doc-", 238 | [ DocCommentHighlightRules.getEndRule("start") ]); 239 | }; 240 | 241 | oop.inherits(c_cppHighlightRules, TextHighlightRules); 242 | 243 | exports.c_cppHighlightRules = c_cppHighlightRules; 244 | }); 245 | 246 | define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) { 247 | "use strict"; 248 | 249 | var Range = require("../range").Range; 250 | 251 | var MatchingBraceOutdent = function() {}; 252 | 253 | (function() { 254 | 255 | this.checkOutdent = function(line, input) { 256 | if (! /^\s+$/.test(line)) 257 | return false; 258 | 259 | return /^\s*\}/.test(input); 260 | }; 261 | 262 | this.autoOutdent = function(doc, row) { 263 | var line = doc.getLine(row); 264 | var match = line.match(/^(\s*\})/); 265 | 266 | if (!match) return 0; 267 | 268 | var column = match[1].length; 269 | var openBracePos = doc.findMatchingBracket({row: row, column: column}); 270 | 271 | if (!openBracePos || openBracePos.row == row) return 0; 272 | 273 | var indent = this.$getIndent(doc.getLine(openBracePos.row)); 274 | doc.replace(new Range(row, 0, row, column-1), indent); 275 | }; 276 | 277 | this.$getIndent = function(line) { 278 | return line.match(/^\s*/)[0]; 279 | }; 280 | 281 | }).call(MatchingBraceOutdent.prototype); 282 | 283 | exports.MatchingBraceOutdent = MatchingBraceOutdent; 284 | }); 285 | 286 | define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) { 287 | "use strict"; 288 | 289 | var oop = require("../../lib/oop"); 290 | var Behaviour = require("../behaviour").Behaviour; 291 | var TokenIterator = require("../../token_iterator").TokenIterator; 292 | var lang = require("../../lib/lang"); 293 | 294 | var SAFE_INSERT_IN_TOKENS = 295 | ["text", "paren.rparen", "punctuation.operator"]; 296 | var SAFE_INSERT_BEFORE_TOKENS = 297 | ["text", "paren.rparen", "punctuation.operator", "comment"]; 298 | 299 | var context; 300 | var contextCache = {}; 301 | var initContext = function(editor) { 302 | var id = -1; 303 | if (editor.multiSelect) { 304 | id = editor.selection.index; 305 | if (contextCache.rangeCount != editor.multiSelect.rangeCount) 306 | contextCache = {rangeCount: editor.multiSelect.rangeCount}; 307 | } 308 | if (contextCache[id]) 309 | return context = contextCache[id]; 310 | context = contextCache[id] = { 311 | autoInsertedBrackets: 0, 312 | autoInsertedRow: -1, 313 | autoInsertedLineEnd: "", 314 | maybeInsertedBrackets: 0, 315 | maybeInsertedRow: -1, 316 | maybeInsertedLineStart: "", 317 | maybeInsertedLineEnd: "" 318 | }; 319 | }; 320 | 321 | var getWrapped = function(selection, selected, opening, closing) { 322 | var rowDiff = selection.end.row - selection.start.row; 323 | return { 324 | text: opening + selected + closing, 325 | selection: [ 326 | 0, 327 | selection.start.column + 1, 328 | rowDiff, 329 | selection.end.column + (rowDiff ? 0 : 1) 330 | ] 331 | }; 332 | }; 333 | 334 | var CstyleBehaviour = function() { 335 | this.add("braces", "insertion", function(state, action, editor, session, text) { 336 | var cursor = editor.getCursorPosition(); 337 | var line = session.doc.getLine(cursor.row); 338 | if (text == '{') { 339 | initContext(editor); 340 | var selection = editor.getSelectionRange(); 341 | var selected = session.doc.getTextRange(selection); 342 | if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { 343 | return getWrapped(selection, selected, '{', '}'); 344 | } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { 345 | if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) { 346 | CstyleBehaviour.recordAutoInsert(editor, session, "}"); 347 | return { 348 | text: '{}', 349 | selection: [1, 1] 350 | }; 351 | } else { 352 | CstyleBehaviour.recordMaybeInsert(editor, session, "{"); 353 | return { 354 | text: '{', 355 | selection: [1, 1] 356 | }; 357 | } 358 | } 359 | } else if (text == '}') { 360 | initContext(editor); 361 | var rightChar = line.substring(cursor.column, cursor.column + 1); 362 | if (rightChar == '}') { 363 | var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row}); 364 | if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { 365 | CstyleBehaviour.popAutoInsertedClosing(); 366 | return { 367 | text: '', 368 | selection: [1, 1] 369 | }; 370 | } 371 | } 372 | } else if (text == "\n" || text == "\r\n") { 373 | initContext(editor); 374 | var closing = ""; 375 | if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { 376 | closing = lang.stringRepeat("}", context.maybeInsertedBrackets); 377 | CstyleBehaviour.clearMaybeInsertedClosing(); 378 | } 379 | var rightChar = line.substring(cursor.column, cursor.column + 1); 380 | if (rightChar === '}') { 381 | var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}'); 382 | if (!openBracePos) 383 | return null; 384 | var next_indent = this.$getIndent(session.getLine(openBracePos.row)); 385 | } else if (closing) { 386 | var next_indent = this.$getIndent(line); 387 | } else { 388 | CstyleBehaviour.clearMaybeInsertedClosing(); 389 | return; 390 | } 391 | var indent = next_indent + session.getTabString(); 392 | 393 | return { 394 | text: '\n' + indent + '\n' + next_indent + closing, 395 | selection: [1, indent.length, 1, indent.length] 396 | }; 397 | } else { 398 | CstyleBehaviour.clearMaybeInsertedClosing(); 399 | } 400 | }); 401 | 402 | this.add("braces", "deletion", function(state, action, editor, session, range) { 403 | var selected = session.doc.getTextRange(range); 404 | if (!range.isMultiLine() && selected == '{') { 405 | initContext(editor); 406 | var line = session.doc.getLine(range.start.row); 407 | var rightChar = line.substring(range.end.column, range.end.column + 1); 408 | if (rightChar == '}') { 409 | range.end.column++; 410 | return range; 411 | } else { 412 | context.maybeInsertedBrackets--; 413 | } 414 | } 415 | }); 416 | 417 | this.add("parens", "insertion", function(state, action, editor, session, text) { 418 | if (text == '(') { 419 | initContext(editor); 420 | var selection = editor.getSelectionRange(); 421 | var selected = session.doc.getTextRange(selection); 422 | if (selected !== "" && editor.getWrapBehavioursEnabled()) { 423 | return getWrapped(selection, selected, '(', ')'); 424 | } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { 425 | CstyleBehaviour.recordAutoInsert(editor, session, ")"); 426 | return { 427 | text: '()', 428 | selection: [1, 1] 429 | }; 430 | } 431 | } else if (text == ')') { 432 | initContext(editor); 433 | var cursor = editor.getCursorPosition(); 434 | var line = session.doc.getLine(cursor.row); 435 | var rightChar = line.substring(cursor.column, cursor.column + 1); 436 | if (rightChar == ')') { 437 | var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row}); 438 | if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { 439 | CstyleBehaviour.popAutoInsertedClosing(); 440 | return { 441 | text: '', 442 | selection: [1, 1] 443 | }; 444 | } 445 | } 446 | } 447 | }); 448 | 449 | this.add("parens", "deletion", function(state, action, editor, session, range) { 450 | var selected = session.doc.getTextRange(range); 451 | if (!range.isMultiLine() && selected == '(') { 452 | initContext(editor); 453 | var line = session.doc.getLine(range.start.row); 454 | var rightChar = line.substring(range.start.column + 1, range.start.column + 2); 455 | if (rightChar == ')') { 456 | range.end.column++; 457 | return range; 458 | } 459 | } 460 | }); 461 | 462 | this.add("brackets", "insertion", function(state, action, editor, session, text) { 463 | if (text == '[') { 464 | initContext(editor); 465 | var selection = editor.getSelectionRange(); 466 | var selected = session.doc.getTextRange(selection); 467 | if (selected !== "" && editor.getWrapBehavioursEnabled()) { 468 | return getWrapped(selection, selected, '[', ']'); 469 | } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { 470 | CstyleBehaviour.recordAutoInsert(editor, session, "]"); 471 | return { 472 | text: '[]', 473 | selection: [1, 1] 474 | }; 475 | } 476 | } else if (text == ']') { 477 | initContext(editor); 478 | var cursor = editor.getCursorPosition(); 479 | var line = session.doc.getLine(cursor.row); 480 | var rightChar = line.substring(cursor.column, cursor.column + 1); 481 | if (rightChar == ']') { 482 | var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row}); 483 | if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { 484 | CstyleBehaviour.popAutoInsertedClosing(); 485 | return { 486 | text: '', 487 | selection: [1, 1] 488 | }; 489 | } 490 | } 491 | } 492 | }); 493 | 494 | this.add("brackets", "deletion", function(state, action, editor, session, range) { 495 | var selected = session.doc.getTextRange(range); 496 | if (!range.isMultiLine() && selected == '[') { 497 | initContext(editor); 498 | var line = session.doc.getLine(range.start.row); 499 | var rightChar = line.substring(range.start.column + 1, range.start.column + 2); 500 | if (rightChar == ']') { 501 | range.end.column++; 502 | return range; 503 | } 504 | } 505 | }); 506 | 507 | this.add("string_dquotes", "insertion", function(state, action, editor, session, text) { 508 | if (text == '"' || text == "'") { 509 | initContext(editor); 510 | var quote = text; 511 | var selection = editor.getSelectionRange(); 512 | var selected = session.doc.getTextRange(selection); 513 | if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { 514 | return getWrapped(selection, selected, quote, quote); 515 | } else if (!selected) { 516 | var cursor = editor.getCursorPosition(); 517 | var line = session.doc.getLine(cursor.row); 518 | var leftChar = line.substring(cursor.column-1, cursor.column); 519 | var rightChar = line.substring(cursor.column, cursor.column + 1); 520 | 521 | var token = session.getTokenAt(cursor.row, cursor.column); 522 | var rightToken = session.getTokenAt(cursor.row, cursor.column + 1); 523 | if (leftChar == "\\" && token && /escape/.test(token.type)) 524 | return null; 525 | 526 | var stringBefore = token && /string|escape/.test(token.type); 527 | var stringAfter = !rightToken || /string|escape/.test(rightToken.type); 528 | 529 | var pair; 530 | if (rightChar == quote) { 531 | pair = stringBefore !== stringAfter; 532 | } else { 533 | if (stringBefore && !stringAfter) 534 | return null; // wrap string with different quote 535 | if (stringBefore && stringAfter) 536 | return null; // do not pair quotes inside strings 537 | var wordRe = session.$mode.tokenRe; 538 | wordRe.lastIndex = 0; 539 | var isWordBefore = wordRe.test(leftChar); 540 | wordRe.lastIndex = 0; 541 | var isWordAfter = wordRe.test(leftChar); 542 | if (isWordBefore || isWordAfter) 543 | return null; // before or after alphanumeric 544 | if (rightChar && !/[\s;,.})\]\\]/.test(rightChar)) 545 | return null; // there is rightChar and it isn't closing 546 | pair = true; 547 | } 548 | return { 549 | text: pair ? quote + quote : "", 550 | selection: [1,1] 551 | }; 552 | } 553 | } 554 | }); 555 | 556 | this.add("string_dquotes", "deletion", function(state, action, editor, session, range) { 557 | var selected = session.doc.getTextRange(range); 558 | if (!range.isMultiLine() && (selected == '"' || selected == "'")) { 559 | initContext(editor); 560 | var line = session.doc.getLine(range.start.row); 561 | var rightChar = line.substring(range.start.column + 1, range.start.column + 2); 562 | if (rightChar == selected) { 563 | range.end.column++; 564 | return range; 565 | } 566 | } 567 | }); 568 | 569 | }; 570 | 571 | 572 | CstyleBehaviour.isSaneInsertion = function(editor, session) { 573 | var cursor = editor.getCursorPosition(); 574 | var iterator = new TokenIterator(session, cursor.row, cursor.column); 575 | if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { 576 | var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); 577 | if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) 578 | return false; 579 | } 580 | iterator.stepForward(); 581 | return iterator.getCurrentTokenRow() !== cursor.row || 582 | this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); 583 | }; 584 | 585 | CstyleBehaviour.$matchTokenType = function(token, types) { 586 | return types.indexOf(token.type || token) > -1; 587 | }; 588 | 589 | CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { 590 | var cursor = editor.getCursorPosition(); 591 | var line = session.doc.getLine(cursor.row); 592 | if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0])) 593 | context.autoInsertedBrackets = 0; 594 | context.autoInsertedRow = cursor.row; 595 | context.autoInsertedLineEnd = bracket + line.substr(cursor.column); 596 | context.autoInsertedBrackets++; 597 | }; 598 | 599 | CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { 600 | var cursor = editor.getCursorPosition(); 601 | var line = session.doc.getLine(cursor.row); 602 | if (!this.isMaybeInsertedClosing(cursor, line)) 603 | context.maybeInsertedBrackets = 0; 604 | context.maybeInsertedRow = cursor.row; 605 | context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; 606 | context.maybeInsertedLineEnd = line.substr(cursor.column); 607 | context.maybeInsertedBrackets++; 608 | }; 609 | 610 | CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { 611 | return context.autoInsertedBrackets > 0 && 612 | cursor.row === context.autoInsertedRow && 613 | bracket === context.autoInsertedLineEnd[0] && 614 | line.substr(cursor.column) === context.autoInsertedLineEnd; 615 | }; 616 | 617 | CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { 618 | return context.maybeInsertedBrackets > 0 && 619 | cursor.row === context.maybeInsertedRow && 620 | line.substr(cursor.column) === context.maybeInsertedLineEnd && 621 | line.substr(0, cursor.column) == context.maybeInsertedLineStart; 622 | }; 623 | 624 | CstyleBehaviour.popAutoInsertedClosing = function() { 625 | context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1); 626 | context.autoInsertedBrackets--; 627 | }; 628 | 629 | CstyleBehaviour.clearMaybeInsertedClosing = function() { 630 | if (context) { 631 | context.maybeInsertedBrackets = 0; 632 | context.maybeInsertedRow = -1; 633 | } 634 | }; 635 | 636 | 637 | 638 | oop.inherits(CstyleBehaviour, Behaviour); 639 | 640 | exports.CstyleBehaviour = CstyleBehaviour; 641 | }); 642 | 643 | define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { 644 | "use strict"; 645 | 646 | var oop = require("../../lib/oop"); 647 | var Range = require("../../range").Range; 648 | var BaseFoldMode = require("./fold_mode").FoldMode; 649 | 650 | var FoldMode = exports.FoldMode = function(commentRegex) { 651 | if (commentRegex) { 652 | this.foldingStartMarker = new RegExp( 653 | this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) 654 | ); 655 | this.foldingStopMarker = new RegExp( 656 | this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) 657 | ); 658 | } 659 | }; 660 | oop.inherits(FoldMode, BaseFoldMode); 661 | 662 | (function() { 663 | 664 | this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/; 665 | this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/; 666 | this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; 667 | this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; 668 | this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; 669 | this._getFoldWidgetBase = this.getFoldWidget; 670 | this.getFoldWidget = function(session, foldStyle, row) { 671 | var line = session.getLine(row); 672 | 673 | if (this.singleLineBlockCommentRe.test(line)) { 674 | if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) 675 | return ""; 676 | } 677 | 678 | var fw = this._getFoldWidgetBase(session, foldStyle, row); 679 | 680 | if (!fw && this.startRegionRe.test(line)) 681 | return "start"; // lineCommentRegionStart 682 | 683 | return fw; 684 | }; 685 | 686 | this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { 687 | var line = session.getLine(row); 688 | 689 | if (this.startRegionRe.test(line)) 690 | return this.getCommentRegionBlock(session, line, row); 691 | 692 | var match = line.match(this.foldingStartMarker); 693 | if (match) { 694 | var i = match.index; 695 | 696 | if (match[1]) 697 | return this.openingBracketBlock(session, match[1], row, i); 698 | 699 | var range = session.getCommentFoldRange(row, i + match[0].length, 1); 700 | 701 | if (range && !range.isMultiLine()) { 702 | if (forceMultiline) { 703 | range = this.getSectionRange(session, row); 704 | } else if (foldStyle != "all") 705 | range = null; 706 | } 707 | 708 | return range; 709 | } 710 | 711 | if (foldStyle === "markbegin") 712 | return; 713 | 714 | var match = line.match(this.foldingStopMarker); 715 | if (match) { 716 | var i = match.index + match[0].length; 717 | 718 | if (match[1]) 719 | return this.closingBracketBlock(session, match[1], row, i); 720 | 721 | return session.getCommentFoldRange(row, i, -1); 722 | } 723 | }; 724 | 725 | this.getSectionRange = function(session, row) { 726 | var line = session.getLine(row); 727 | var startIndent = line.search(/\S/); 728 | var startRow = row; 729 | var startColumn = line.length; 730 | row = row + 1; 731 | var endRow = row; 732 | var maxRow = session.getLength(); 733 | while (++row < maxRow) { 734 | line = session.getLine(row); 735 | var indent = line.search(/\S/); 736 | if (indent === -1) 737 | continue; 738 | if (startIndent > indent) 739 | break; 740 | var subRange = this.getFoldWidgetRange(session, "all", row); 741 | 742 | if (subRange) { 743 | if (subRange.start.row <= startRow) { 744 | break; 745 | } else if (subRange.isMultiLine()) { 746 | row = subRange.end.row; 747 | } else if (startIndent == indent) { 748 | break; 749 | } 750 | } 751 | endRow = row; 752 | } 753 | 754 | return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); 755 | }; 756 | this.getCommentRegionBlock = function(session, line, row) { 757 | var startColumn = line.search(/\s*$/); 758 | var maxRow = session.getLength(); 759 | var startRow = row; 760 | 761 | var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; 762 | var depth = 1; 763 | while (++row < maxRow) { 764 | line = session.getLine(row); 765 | var m = re.exec(line); 766 | if (!m) continue; 767 | if (m[1]) depth--; 768 | else depth++; 769 | 770 | if (!depth) break; 771 | } 772 | 773 | var endRow = row; 774 | if (endRow > startRow) { 775 | return new Range(startRow, startColumn, endRow, line.length); 776 | } 777 | }; 778 | 779 | }).call(FoldMode.prototype); 780 | 781 | }); 782 | 783 | define("ace/mode/c_cpp",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/c_cpp_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) { 784 | "use strict"; 785 | 786 | var oop = require("../lib/oop"); 787 | var TextMode = require("./text").Mode; 788 | var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; 789 | var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; 790 | var Range = require("../range").Range; 791 | var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; 792 | var CStyleFoldMode = require("./folding/cstyle").FoldMode; 793 | 794 | var Mode = function() { 795 | this.HighlightRules = c_cppHighlightRules; 796 | 797 | this.$outdent = new MatchingBraceOutdent(); 798 | this.$behaviour = new CstyleBehaviour(); 799 | 800 | this.foldingRules = new CStyleFoldMode(); 801 | }; 802 | oop.inherits(Mode, TextMode); 803 | 804 | (function() { 805 | 806 | this.lineCommentStart = "//"; 807 | this.blockComment = {start: "/*", end: "*/"}; 808 | 809 | this.getNextLineIndent = function(state, line, tab) { 810 | var indent = this.$getIndent(line); 811 | 812 | var tokenizedLine = this.getTokenizer().getLineTokens(line, state); 813 | var tokens = tokenizedLine.tokens; 814 | var endState = tokenizedLine.state; 815 | 816 | if (tokens.length && tokens[tokens.length-1].type == "comment") { 817 | return indent; 818 | } 819 | 820 | if (state == "start") { 821 | var match = line.match(/^.*[\{\(\[]\s*$/); 822 | if (match) { 823 | indent += tab; 824 | } 825 | } else if (state == "doc-start") { 826 | if (endState == "start") { 827 | return ""; 828 | } 829 | var match = line.match(/^\s*(\/?)\*/); 830 | if (match) { 831 | if (match[1]) { 832 | indent += " "; 833 | } 834 | indent += "* "; 835 | } 836 | } 837 | 838 | return indent; 839 | }; 840 | 841 | this.checkOutdent = function(state, line, input) { 842 | return this.$outdent.checkOutdent(line, input); 843 | }; 844 | 845 | this.autoOutdent = function(state, doc, row) { 846 | this.$outdent.autoOutdent(doc, row); 847 | }; 848 | 849 | this.$id = "ace/mode/c_cpp"; 850 | }).call(Mode.prototype); 851 | 852 | exports.Mode = Mode; 853 | }); -------------------------------------------------------------------------------- /ccr/static/ccr/js/mode-python.js: -------------------------------------------------------------------------------- 1 | define("ace/mode/python_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { 2 | "use strict"; 3 | 4 | var oop = require("../lib/oop"); 5 | var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; 6 | 7 | var PythonHighlightRules = function() { 8 | 9 | var keywords = ( 10 | "and|as|assert|break|class|continue|def|del|elif|else|except|exec|" + 11 | "finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|" + 12 | "raise|return|try|while|with|yield" 13 | ); 14 | 15 | var builtinConstants = ( 16 | "True|False|None|NotImplemented|Ellipsis|__debug__" 17 | ); 18 | 19 | var builtinFunctions = ( 20 | "abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|" + 21 | "eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|" + 22 | "binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|" + 23 | "float|list|raw_input|unichr|callable|format|locals|reduce|unicode|" + 24 | "chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|" + 25 | "cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|" + 26 | "__import__|complex|hash|min|set|apply|delattr|help|next|setattr|" + 27 | "buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern" 28 | ); 29 | var keywordMapper = this.createKeywordMapper({ 30 | "invalid.deprecated": "debugger", 31 | "support.function": builtinFunctions, 32 | "constant.language": builtinConstants, 33 | "keyword": keywords 34 | }, "identifier"); 35 | 36 | var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?"; 37 | 38 | var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))"; 39 | var octInteger = "(?:0[oO]?[0-7]+)"; 40 | var hexInteger = "(?:0[xX][\\dA-Fa-f]+)"; 41 | var binInteger = "(?:0[bB][01]+)"; 42 | var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")"; 43 | 44 | var exponent = "(?:[eE][+-]?\\d+)"; 45 | var fraction = "(?:\\.\\d+)"; 46 | var intPart = "(?:\\d+)"; 47 | var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))"; 48 | var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")"; 49 | var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")"; 50 | 51 | var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})"; 52 | 53 | this.$rules = { 54 | "start" : [ { 55 | token : "comment", 56 | regex : "#.*$" 57 | }, { 58 | token : "string", // multi line """ string start 59 | regex : strPre + '"{3}', 60 | next : "qqstring3" 61 | }, { 62 | token : "string", // " string 63 | regex : strPre + '"(?=.)', 64 | next : "qqstring" 65 | }, { 66 | token : "string", // multi line ''' string start 67 | regex : strPre + "'{3}", 68 | next : "qstring3" 69 | }, { 70 | token : "string", // ' string 71 | regex : strPre + "'(?=.)", 72 | next : "qstring" 73 | }, { 74 | token : "constant.numeric", // imaginary 75 | regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b" 76 | }, { 77 | token : "constant.numeric", // float 78 | regex : floatNumber 79 | }, { 80 | token : "constant.numeric", // long integer 81 | regex : integer + "[lL]\\b" 82 | }, { 83 | token : "constant.numeric", // integer 84 | regex : integer + "\\b" 85 | }, { 86 | token : keywordMapper, 87 | regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" 88 | }, { 89 | token : "keyword.operator", 90 | regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|=" 91 | }, { 92 | token : "paren.lparen", 93 | regex : "[\\[\\(\\{]" 94 | }, { 95 | token : "paren.rparen", 96 | regex : "[\\]\\)\\}]" 97 | }, { 98 | token : "text", 99 | regex : "\\s+" 100 | } ], 101 | "qqstring3" : [ { 102 | token : "constant.language.escape", 103 | regex : stringEscape 104 | }, { 105 | token : "string", // multi line """ string end 106 | regex : '"{3}', 107 | next : "start" 108 | }, { 109 | defaultToken : "string" 110 | } ], 111 | "qstring3" : [ { 112 | token : "constant.language.escape", 113 | regex : stringEscape 114 | }, { 115 | token : "string", // multi line ''' string end 116 | regex : "'{3}", 117 | next : "start" 118 | }, { 119 | defaultToken : "string" 120 | } ], 121 | "qqstring" : [{ 122 | token : "constant.language.escape", 123 | regex : stringEscape 124 | }, { 125 | token : "string", 126 | regex : "\\\\$", 127 | next : "qqstring" 128 | }, { 129 | token : "string", 130 | regex : '"|$', 131 | next : "start" 132 | }, { 133 | defaultToken: "string" 134 | }], 135 | "qstring" : [{ 136 | token : "constant.language.escape", 137 | regex : stringEscape 138 | }, { 139 | token : "string", 140 | regex : "\\\\$", 141 | next : "qstring" 142 | }, { 143 | token : "string", 144 | regex : "'|$", 145 | next : "start" 146 | }, { 147 | defaultToken: "string" 148 | }] 149 | }; 150 | }; 151 | 152 | oop.inherits(PythonHighlightRules, TextHighlightRules); 153 | 154 | exports.PythonHighlightRules = PythonHighlightRules; 155 | }); 156 | 157 | define("ace/mode/folding/pythonic",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) { 158 | "use strict"; 159 | 160 | var oop = require("../../lib/oop"); 161 | var BaseFoldMode = require("./fold_mode").FoldMode; 162 | 163 | var FoldMode = exports.FoldMode = function(markers) { 164 | this.foldingStartMarker = new RegExp("([\\[{])(?:\\s*)$|(" + markers + ")(?:\\s*)(?:#.*)?$"); 165 | }; 166 | oop.inherits(FoldMode, BaseFoldMode); 167 | 168 | (function() { 169 | 170 | this.getFoldWidgetRange = function(session, foldStyle, row) { 171 | var line = session.getLine(row); 172 | var match = line.match(this.foldingStartMarker); 173 | if (match) { 174 | if (match[1]) 175 | return this.openingBracketBlock(session, match[1], row, match.index); 176 | if (match[2]) 177 | return this.indentationBlock(session, row, match.index + match[2].length); 178 | return this.indentationBlock(session, row); 179 | } 180 | } 181 | 182 | }).call(FoldMode.prototype); 183 | 184 | }); 185 | 186 | define("ace/mode/python",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/python_highlight_rules","ace/mode/folding/pythonic","ace/range"], function(require, exports, module) { 187 | "use strict"; 188 | 189 | var oop = require("../lib/oop"); 190 | var TextMode = require("./text").Mode; 191 | var PythonHighlightRules = require("./python_highlight_rules").PythonHighlightRules; 192 | var PythonFoldMode = require("./folding/pythonic").FoldMode; 193 | var Range = require("../range").Range; 194 | 195 | var Mode = function() { 196 | this.HighlightRules = PythonHighlightRules; 197 | this.foldingRules = new PythonFoldMode("\\:"); 198 | }; 199 | oop.inherits(Mode, TextMode); 200 | 201 | (function() { 202 | 203 | this.lineCommentStart = "#"; 204 | 205 | this.getNextLineIndent = function(state, line, tab) { 206 | var indent = this.$getIndent(line); 207 | 208 | var tokenizedLine = this.getTokenizer().getLineTokens(line, state); 209 | var tokens = tokenizedLine.tokens; 210 | 211 | if (tokens.length && tokens[tokens.length-1].type == "comment") { 212 | return indent; 213 | } 214 | 215 | if (state == "start") { 216 | var match = line.match(/^.*[\{\(\[\:]\s*$/); 217 | if (match) { 218 | indent += tab; 219 | } 220 | } 221 | 222 | return indent; 223 | }; 224 | 225 | var outdents = { 226 | "pass": 1, 227 | "return": 1, 228 | "raise": 1, 229 | "break": 1, 230 | "continue": 1 231 | }; 232 | 233 | this.checkOutdent = function(state, line, input) { 234 | if (input !== "\r\n" && input !== "\r" && input !== "\n") 235 | return false; 236 | 237 | var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens; 238 | 239 | if (!tokens) 240 | return false; 241 | do { 242 | var last = tokens.pop(); 243 | } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/)))); 244 | 245 | if (!last) 246 | return false; 247 | 248 | return (last.type == "keyword" && outdents[last.value]); 249 | }; 250 | 251 | this.autoOutdent = function(state, doc, row) { 252 | 253 | row += 1; 254 | var indent = this.$getIndent(doc.getLine(row)); 255 | var tab = doc.getTabString(); 256 | if (indent.slice(-tab.length) == tab) 257 | doc.remove(new Range(row, indent.length-tab.length, row, indent.length)); 258 | }; 259 | 260 | this.$id = "ace/mode/python"; 261 | }).call(Mode.prototype); 262 | 263 | exports.Mode = Mode; 264 | }); -------------------------------------------------------------------------------- /ccr/static/ccr/js/theme-monokai.js: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Distributed under the BSD license: 3 | * 4 | * Copyright (c) 2010, Ajax.org B.V. 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of Ajax.org B.V. nor the 15 | * names of its contributors may be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * ***** END LICENSE BLOCK ***** */ 30 | 31 | define(function(require, exports, module) { 32 | 33 | exports.isDark = true; 34 | exports.cssClass = "ace-monokai"; 35 | exports.cssText = require("../requirejs/text!./monokai.css"); 36 | 37 | var dom = require("../lib/dom"); 38 | dom.importCssString(exports.cssText, exports.cssClass); 39 | }); -------------------------------------------------------------------------------- /ccr/templates/ccr/main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code,Compile & Run @ Nikhil Sheoran 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 |
23 | {} Code,Compile & Run {} 24 |
25 |
26 | 27 |
28 | 29 | {% csrf_token %} 30 |

31 |

32 | 33 |
34 | 35 | 36 | 37 | 38 | 39 |
40 | .cpp 41 | 42 |
43 |

44 | 45 |
46 | {% include 'ccr/status.html' %} 47 |
48 |
49 | 50 | 53 | 54 |
55 | 56 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /ccr/templates/ccr/status.html: -------------------------------------------------------------------------------- 1 | 4 |
5 |
6 |
7 | 8 | 9 |
-------------------------------------------------------------------------------- /ccr/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /ccr/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import patterns,url 2 | from ccr import views 3 | 4 | urlpatterns=patterns( 5 | '', 6 | url(r'^$',views.main), 7 | url(r'^save/',views.save), 8 | url(r'^template/',views.template), 9 | url(r'^compile/',views.compile), 10 | url(r'^run/',views.run), 11 | ) -------------------------------------------------------------------------------- /ccr/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render,get_object_or_404,render_to_response 2 | from django.template import RequestContext 3 | from django.template.loader import render_to_string 4 | from django.http import HttpResponseRedirect,Http404,HttpResponse 5 | from django.contrib import messages 6 | from django.contrib.auth.models import User 7 | from django.contrib.auth import authenticate,login,logout 8 | 9 | import subprocess 10 | import re 11 | import os 12 | import datetime 13 | import hashlib 14 | # Create your views here. 15 | 16 | def main(request): 17 | time = datetime.datetime.now() 18 | token = hashlib.sha224(str(time)).hexdigest() 19 | token = token[0:4] #Token length is 4 20 | return render(request,'ccr/main.html',{'token':token}) 21 | 22 | def template(request): 23 | try: 24 | f = open('./codes/saved/template.cpp','r') 25 | template = f.read() 26 | except: 27 | template = "" 28 | return HttpResponse(template) 29 | 30 | def save(request): 31 | if request.method=="POST": 32 | filename = request.POST['file'] 33 | code = request.POST['code'] 34 | inp = request.POST['input'] 35 | try: 36 | url = './codes/saved/'+filename+'.cpp' 37 | f = open(url,'w') 38 | f.seek(0) 39 | f.truncate() 40 | f.write(code) 41 | f.close() 42 | except: 43 | result = "Status : Sorry, can't save files at the moment" 44 | return HttpResponse(result) 45 | try: 46 | url = './codes/saved/'+filename+'.txt' 47 | f = open(url,'w') 48 | f.seek(0) 49 | f.truncate() 50 | f.write(inp) 51 | f.close() 52 | result = "Status : File Saved" 53 | except: 54 | result = "Status : Sorry, can't save files at the moment" 55 | return HttpResponse(result) 56 | else: 57 | return HttpResponseRedirect('/ccr/') 58 | 59 | def compile(request): 60 | if request.method=="POST": 61 | code = request.POST['code'] 62 | inp = request.POST['input'] 63 | token = request.POST['uniquetoken'] 64 | #inp = inp + '\n' 65 | 66 | #Writing Code into the file 67 | f=open('./codes/tmp/'+token+'.cpp','w') 68 | f.seek(0) 69 | f.truncate() 70 | f.write(code) 71 | f.close() 72 | 73 | #Writing Input into the file 74 | test = open('./codes/tmp/'+token+'.txt','w') 75 | test.seek(0) 76 | test.truncate() 77 | test.write(inp) 78 | test.close() 79 | 80 | try: 81 | output = subprocess.check_output(["g++","./codes/tmp/"+token+".cpp"],stderr = subprocess.STDOUT) 82 | subprocess.call(["g++","./codes/tmp/"+token+".cpp"]) 83 | result = "Compilation Successful" 84 | except subprocess.CalledProcessError,e: 85 | output = e.output 86 | output = output.decode('utf-8').replace("./codes/tmp/"+token+".cpp:",""); 87 | has = re.match(r'\/usr.*',output) 88 | if(has): 89 | output = re.sub(r'\/usr.*','',output) 90 | output = re.sub(r'\s+',' ',output) 91 | result = "Compilation Error" 92 | return render_to_response('ccr/status.html',{'result':result,'input':inp,'output':output},context_instance=RequestContext(request)) 93 | else: 94 | return HttpResponseRedirect('/ccr/') 95 | 96 | def run(request): 97 | if request.method=="POST": 98 | code = request.POST['code'] 99 | inp = request.POST['input'] 100 | token = request.POST['uniquetoken'] 101 | 102 | #Writing Code into the file 103 | f=open('./codes/tmp/'+token+'.cpp','w') 104 | f.seek(0) 105 | f.truncate() 106 | f.write(code) 107 | f.close() 108 | 109 | #Writing testcase into file 110 | f = open('./codes/tmp/'+token+'.txt','w') 111 | f.seek(0) 112 | f.truncate() 113 | f.write(inp) 114 | f.close() 115 | 116 | try: #Compilation 117 | output = subprocess.check_output(["g++","./codes/tmp/"+token+".cpp"],stderr = subprocess.STDOUT) 118 | subprocess.call(["g++","./codes/tmp/"+token+".cpp"]) 119 | result = "Compilation Successful" 120 | except subprocess.CalledProcessError,e: 121 | output = e.output 122 | output = output.replace("./codes/tmp/"+token+".cpp:",""); 123 | has = re.match(r'\/usr.*',output) 124 | if(has): 125 | output = re.sub(r'\/usr.*','',output) 126 | output = re.sub(r'\s+',' ',output) 127 | result = "Compilation Error" 128 | return render_to_response('ccr/status.html',{'result':result,'input':inp,'output':output},context_instance=RequestContext(request)) 129 | 130 | #Compilation Successful 131 | #ipdb.set_trace() 132 | try: #running 133 | command = "./a.out < ./codes/tmp/"+token + ".txt > ./codes/tmp/out"+token+".txt" 134 | os.system(command) 135 | f = open('./codes/tmp/out'+token+'.txt') 136 | output = f.read() 137 | f.close() 138 | result = "Execution Successful" 139 | except subprocess.CalledProcessError,er: #error while running 140 | output = er.output 141 | result = "Execution Failed" 142 | 143 | #ipdb.set_trace() 144 | html = render_to_string('ccr/status.html',{'result':result,'input':inp,'output':output}) 145 | return HttpResponse(html) 146 | else: 147 | return HttpResponseRedirect('/ccr/editor') -------------------------------------------------------------------------------- /codes/.gitignore: -------------------------------------------------------------------------------- 1 | 46cba143d0ff7956c0fd0afa9a991d7633f9472dc159a4fd5147b190.txt 2 | d50baf2add4766001a674319955f9755816a3edcae7441975072bb15.txt 3 | out46cba143d0ff7956c0fd0afa9a991d7633f9472dc159a4fd5147b190.txt 4 | outd50baf2add4766001a674319955f9755816a3edcae7441975072bb15.txt 5 | 46cba143d0ff7956c0fd0afa9a991d7633f9472dc159a4fd5147b190.cpp 6 | d50baf2add4766001a674319955f9755816a3edcae7441975072bb15.cpp 7 | -------------------------------------------------------------------------------- /codes/saved/.gitignore: -------------------------------------------------------------------------------- 1 | ./nikl.txt 2 | ./nikl.cpp 3 | -------------------------------------------------------------------------------- /codes/saved/.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikhil96sher/coding_companion/bb5d9596dff74e342ca07b6d95c37fb491877224/codes/saved/.txt -------------------------------------------------------------------------------- /codes/tmp/.gitignore: -------------------------------------------------------------------------------- 1 | *.cpp 2 | *.txt 3 | -------------------------------------------------------------------------------- /coding_companion/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikhil96sher/coding_companion/bb5d9596dff74e342ca07b6d95c37fb491877224/coding_companion/__init__.py -------------------------------------------------------------------------------- /coding_companion/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for coding_companion project. 3 | 4 | For more information on this file, see 5 | https://docs.djangoproject.com/en/1.7/topics/settings/ 6 | 7 | For the full list of settings and their values, see 8 | https://docs.djangoproject.com/en/1.7/ref/settings/ 9 | """ 10 | 11 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 12 | import os 13 | BASE_DIR = os.path.dirname(os.path.dirname(__file__)) 14 | 15 | 16 | # Quick-start development settings - unsuitable for production 17 | # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ 18 | 19 | # SECURITY WARNING: keep the secret key used in production secret! 20 | SECRET_KEY = 'dcwy)@th7g2=+0((8v=t$m2xuc0g6#ma0l3c5li6z1svxkq3@q' 21 | 22 | # SECURITY WARNING: don't run with debug turned on in production! 23 | DEBUG = True 24 | 25 | ALLOWED_HOSTS = [] 26 | 27 | 28 | # Application definition 29 | 30 | INSTALLED_APPS = ( 31 | 'django.contrib.admin', 32 | 'django.contrib.auth', 33 | 'django.contrib.contenttypes', 34 | 'django.contrib.sessions', 35 | 'django.contrib.messages', 36 | 'django.contrib.staticfiles', 37 | 'ccr', 38 | ) 39 | 40 | MIDDLEWARE_CLASSES = ( 41 | 'django.contrib.sessions.middleware.SessionMiddleware', 42 | 'django.middleware.common.CommonMiddleware', 43 | 'django.middleware.csrf.CsrfViewMiddleware', 44 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 45 | 'django.contrib.messages.middleware.MessageMiddleware', 46 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 47 | ) 48 | 49 | ROOT_URLCONF = 'coding_companion.urls' 50 | 51 | WSGI_APPLICATION = 'coding_companion.wsgi.application' 52 | 53 | #Templates 54 | TEMPLATES = [ 55 | { 56 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 57 | 'DIRS': [], 58 | 'APP_DIRS': True, 59 | 'OPTIONS': { 60 | 'context_processors': [ 61 | 'django.template.context_processors.debug', 62 | 'django.template.context_processors.request', 63 | 'django.contrib.auth.context_processors.auth', 64 | 'django.contrib.messages.context_processors.messages', 65 | ], 66 | }, 67 | }, 68 | ] 69 | 70 | # Database 71 | # https://docs.djangoproject.com/en/1.7/ref/settings/#databases 72 | 73 | DATABASES = { 74 | 'default': { 75 | 'ENGINE': 'django.db.backends.sqlite3', 76 | 'NAME': os.path.join(BASE_DIR,'db.sqlite3'), 77 | } 78 | } 79 | 80 | # Internationalization 81 | # https://docs.djangoproject.com/en/1.7/topics/i18n/ 82 | 83 | LANGUAGE_CODE = 'en-us' 84 | 85 | TIME_ZONE = 'UTC' 86 | 87 | USE_I18N = True 88 | 89 | USE_L10N = True 90 | 91 | USE_TZ = True 92 | 93 | 94 | # Static files (CSS, JavaScript, Images) 95 | # https://docs.djangoproject.com/en/1.7/howto/static-files/ 96 | 97 | STATIC_URL = '/static/' 98 | -------------------------------------------------------------------------------- /coding_companion/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import patterns, include, url 2 | from django.contrib import admin 3 | from ccr import urls as ccr_urls 4 | urlpatterns = patterns('', 5 | # Examples: 6 | # url(r'^$', 'coding_companion.views.home', name='home'), 7 | # url(r'^blog/', include('blog.urls')), 8 | url(r'^ccr/',include(ccr_urls)), 9 | url(r'^admin/', include(admin.site.urls)), 10 | ) 11 | -------------------------------------------------------------------------------- /coding_companion/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for coding_companion project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "coding_companion.settings") 12 | 13 | from django.core.wsgi import get_wsgi_application 14 | application = get_wsgi_application() 15 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | echo "INSTALLING PYTHON" 2 | sudo apt-get install python 3 | echo "INSTALLING g++" 4 | sudo apt-get install g++ 5 | echo "INSTALLING python-pip" 6 | sudo apt-get install python-pip 7 | echo "INSTALLING Django" 8 | sudo pip install Django==1.8.1 9 | python manage.py makemigrations 10 | python manage.py migrate 11 | echo "Successfully Installed coding_companion." -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "coding_companion.settings") 7 | 8 | from django.core.management import execute_from_command_line 9 | 10 | execute_from_command_line(sys.argv) 11 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | python manage.py runserver 60001 -------------------------------------------------------------------------------- /screenshots/run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nikhil96sher/coding_companion/bb5d9596dff74e342ca07b6d95c37fb491877224/screenshots/run.png --------------------------------------------------------------------------------