Commit f065c1eef3eabd8dd80b1a182f69de8061f321e4
1 parent
e4c87765
Exists in
master
and in
6 other branches
Inclusão da biblioteca bootstrap-tour em pacotes
Showing
13 changed files
with
6347 additions
and
0 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | +EditorConfig helps developers define and maintain consistent | |
| 2 | +# coding styles between different editors and IDEs | |
| 3 | +# editorconfig.org | |
| 4 | + | |
| 5 | +root = true | |
| 6 | + | |
| 7 | + | |
| 8 | +[*] | |
| 9 | + | |
| 10 | +# Change these settings to your own preference | |
| 11 | +indent_style = space | |
| 12 | +indent_size = 2 | |
| 13 | + | |
| 14 | +# We recommend you to keep these unchanged | |
| 15 | +end_of_line = lf | |
| 16 | +charset = utf-8 | |
| 17 | +trim_trailing_whitespace = true | |
| 18 | +insert_final_newline = true | |
| 19 | + | |
| 20 | +[*.md] | |
| 21 | +trim_trailing_whitespace = false | ... | ... |
| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | +dist: trusty | |
| 2 | +sudo: required | |
| 3 | +language: node_js | |
| 4 | +node_js: | |
| 5 | + - 8 | |
| 6 | +addons: | |
| 7 | + chrome: stable | |
| 8 | +before_install: | |
| 9 | + - "export CHROME_BIN=chromium-browser" | |
| 10 | + - "export DISPLAY=:99.0" | |
| 11 | + - "sh -e /etc/init.d/xvfb start" | |
| 12 | +before_script: | |
| 13 | + - "yarn global add gulp-cli" | |
| 14 | + - "npm rebuild node-sass" | ... | ... |
| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | +Copyright (c) 2013-2015 The Bootstrap Tour community | |
| 2 | + | |
| 3 | +Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 4 | +of this software and associated documentation files (the "Software"), to deal | |
| 5 | +in the Software without restriction, including without limitation the rights | |
| 6 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 7 | +copies of the Software, and to permit persons to whom the Software is | |
| 8 | +furnished to do so, subject to the following conditions: | |
| 9 | + | |
| 10 | +The above copyright notice and this permission notice shall be included in | |
| 11 | +all copies or substantial portions of the Software. | |
| 12 | + | |
| 13 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 14 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 15 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 16 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 17 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 18 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
| 19 | +THE SOFTWARE. | ... | ... |
| ... | ... | @@ -0,0 +1,74 @@ |
| 1 | +# Bootstrap Tour | |
| 2 | +[](https://travis-ci.org/sorich87/bootstrap-tour) | |
| 3 | +[](https://david-dm.org/sorich87/bootstrap-tour) | |
| 4 | +[](https://david-dm.org/sorich87/bootstrap-tour#info=devDependencies) | |
| 5 | +[](https://www.npmjs.org/) | |
| 6 | + | |
| 7 | +Quick and easy way to build your product tours with Bootstrap Popovers. | |
| 8 | + | |
| 9 | +*Compatible with Bootstrap >= 2.3.0* | |
| 10 | + | |
| 11 | +## Demo and Documentation | |
| 12 | +[http://bootstraptour.com](http://bootstraptour.com) | |
| 13 | + | |
| 14 | +## Contributing | |
| 15 | +In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Gulp](http://gulpjs.com/). | |
| 16 | + | |
| 17 | +Feel free to contribute with pull requests, bug reports or enhancement suggestions. | |
| 18 | + | |
| 19 | +We use [Gulp](http://gulpjs.com/) and [Jasmine](http://jasmine.github.io/). Both make your life easier ;) | |
| 20 | + | |
| 21 | +### Develop | |
| 22 | + | |
| 23 | +Files to be developed are located under `./src/`. | |
| 24 | +Compiled sources are then automatically put under `./build/`, `./test/` and `./docs/`. | |
| 25 | + | |
| 26 | +#### Requirements | |
| 27 | + | |
| 28 | +To begin, you need a few standard dependencies installed. These commands will install ruby, gem, node, yarn, and gulp's command line runner: | |
| 29 | + | |
| 30 | +##### Debian/Ubuntu Linux | |
| 31 | + | |
| 32 | +```bash | |
| 33 | +$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | |
| 34 | +$ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list | |
| 35 | +$ sudo apt-get update && sudo apt-get install ruby-full yarn | |
| 36 | +``` | |
| 37 | + | |
| 38 | +##### Mac OS X | |
| 39 | + | |
| 40 | +```bash | |
| 41 | +$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
| 42 | +$ brew install ruby yarn | |
| 43 | +``` | |
| 44 | + | |
| 45 | +##### Development requirements | |
| 46 | + | |
| 47 | +```bash | |
| 48 | +$ yarn global add gulp-cli | |
| 49 | +$ yarn | |
| 50 | +$ gem install jekyll | |
| 51 | +``` | |
| 52 | + | |
| 53 | +For Mac OS X Mavericks (10.9) users: You will need to [jump through all these hoops](http://dean.io/setting-up-a-ruby-on-rails-development-environment-on-mavericks/) before you can install Jekyll. | |
| 54 | + | |
| 55 | +#### Gulp usage | |
| 56 | + | |
| 57 | +Run gulp and start to develop with ease: | |
| 58 | + | |
| 59 | +```bash | |
| 60 | +$ gulp | |
| 61 | +$ gulp dist | |
| 62 | +$ gulp test | |
| 63 | +$ gulp docs | |
| 64 | +$ gulp clean | |
| 65 | +$ gulp server | |
| 66 | +$ gulp bump --type minor (major.minor.patch) | |
| 67 | +``` | |
| 68 | + | |
| 69 | +Check `gulpfile.coffee` to know more. | |
| 70 | + | |
| 71 | +## License | |
| 72 | + | |
| 73 | +Code licensed under the [MIT license](https://opensource.org/licenses/MIT). | |
| 74 | +Documentation licensed under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0/). | ... | ... |
pacotes/bootstrap-tour/build/css/bootstrap-tour-standalone.css
0 → 100644
| ... | ... | @@ -0,0 +1,709 @@ |
| 1 | +/* ======================================================================== | |
| 2 | + * bootstrap-tour - v0.12.0 | |
| 3 | + * http://bootstraptour.com | |
| 4 | + * ======================================================================== | |
| 5 | + * Copyright 2012-2017 Ulrich Sossou | |
| 6 | + * | |
| 7 | + * ======================================================================== | |
| 8 | + * Licensed under the MIT License (the "License"); | |
| 9 | + * you may not use this file except in compliance with the License. | |
| 10 | + * You may obtain a copy of the License at | |
| 11 | + * | |
| 12 | + * https://opensource.org/licenses/MIT | |
| 13 | + * | |
| 14 | + * Unless required by applicable law or agreed to in writing, software | |
| 15 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 16 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 17 | + * See the License for the specific language governing permissions and | |
| 18 | + * limitations under the License. | |
| 19 | + * ======================================================================== | |
| 20 | + */ | |
| 21 | + | |
| 22 | +.btn { | |
| 23 | + display: inline-block; | |
| 24 | + font-weight: normal; | |
| 25 | + text-align: center; | |
| 26 | + white-space: nowrap; | |
| 27 | + vertical-align: middle; | |
| 28 | + user-select: none; | |
| 29 | + border: 1px solid transparent; | |
| 30 | + padding: 0.5rem 0.75rem; | |
| 31 | + font-size: 1rem; | |
| 32 | + line-height: 1.25; | |
| 33 | + border-radius: 0.25rem; | |
| 34 | + transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; } | |
| 35 | + .btn:focus, .btn:hover { | |
| 36 | + text-decoration: none; } | |
| 37 | + .btn:focus, .btn.focus { | |
| 38 | + outline: 0; | |
| 39 | + box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25); } | |
| 40 | + .btn.disabled, .btn:disabled { | |
| 41 | + opacity: .65; } | |
| 42 | + .btn:active, .btn.active { | |
| 43 | + background-image: none; } | |
| 44 | + | |
| 45 | +a.btn.disabled, | |
| 46 | +fieldset[disabled] a.btn { | |
| 47 | + pointer-events: none; } | |
| 48 | + | |
| 49 | +.btn-primary { | |
| 50 | + color: #fff; | |
| 51 | + background-color: #007bff; | |
| 52 | + border-color: #007bff; } | |
| 53 | + .btn-primary:hover { | |
| 54 | + color: #fff; | |
| 55 | + background-color: #0069d9; | |
| 56 | + border-color: #0062cc; } | |
| 57 | + .btn-primary:focus, .btn-primary.focus { | |
| 58 | + box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5); } | |
| 59 | + .btn-primary.disabled, .btn-primary:disabled { | |
| 60 | + background-color: #007bff; | |
| 61 | + border-color: #007bff; } | |
| 62 | + .btn-primary:active, .btn-primary.active, | |
| 63 | + .show > .btn-primary.dropdown-toggle { | |
| 64 | + background-color: #0069d9; | |
| 65 | + background-image: none; | |
| 66 | + border-color: #0062cc; } | |
| 67 | + | |
| 68 | +.btn-secondary { | |
| 69 | + color: #fff; | |
| 70 | + background-color: #868e96; | |
| 71 | + border-color: #868e96; } | |
| 72 | + .btn-secondary:hover { | |
| 73 | + color: #fff; | |
| 74 | + background-color: #727b84; | |
| 75 | + border-color: #6c757d; } | |
| 76 | + .btn-secondary:focus, .btn-secondary.focus { | |
| 77 | + box-shadow: 0 0 0 3px rgba(134, 142, 150, 0.5); } | |
| 78 | + .btn-secondary.disabled, .btn-secondary:disabled { | |
| 79 | + background-color: #868e96; | |
| 80 | + border-color: #868e96; } | |
| 81 | + .btn-secondary:active, .btn-secondary.active, | |
| 82 | + .show > .btn-secondary.dropdown-toggle { | |
| 83 | + background-color: #727b84; | |
| 84 | + background-image: none; | |
| 85 | + border-color: #6c757d; } | |
| 86 | + | |
| 87 | +.btn-success { | |
| 88 | + color: #fff; | |
| 89 | + background-color: #28a745; | |
| 90 | + border-color: #28a745; } | |
| 91 | + .btn-success:hover { | |
| 92 | + color: #fff; | |
| 93 | + background-color: #218838; | |
| 94 | + border-color: #1e7e34; } | |
| 95 | + .btn-success:focus, .btn-success.focus { | |
| 96 | + box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.5); } | |
| 97 | + .btn-success.disabled, .btn-success:disabled { | |
| 98 | + background-color: #28a745; | |
| 99 | + border-color: #28a745; } | |
| 100 | + .btn-success:active, .btn-success.active, | |
| 101 | + .show > .btn-success.dropdown-toggle { | |
| 102 | + background-color: #218838; | |
| 103 | + background-image: none; | |
| 104 | + border-color: #1e7e34; } | |
| 105 | + | |
| 106 | +.btn-info { | |
| 107 | + color: #fff; | |
| 108 | + background-color: #17a2b8; | |
| 109 | + border-color: #17a2b8; } | |
| 110 | + .btn-info:hover { | |
| 111 | + color: #fff; | |
| 112 | + background-color: #138496; | |
| 113 | + border-color: #117a8b; } | |
| 114 | + .btn-info:focus, .btn-info.focus { | |
| 115 | + box-shadow: 0 0 0 3px rgba(23, 162, 184, 0.5); } | |
| 116 | + .btn-info.disabled, .btn-info:disabled { | |
| 117 | + background-color: #17a2b8; | |
| 118 | + border-color: #17a2b8; } | |
| 119 | + .btn-info:active, .btn-info.active, | |
| 120 | + .show > .btn-info.dropdown-toggle { | |
| 121 | + background-color: #138496; | |
| 122 | + background-image: none; | |
| 123 | + border-color: #117a8b; } | |
| 124 | + | |
| 125 | +.btn-warning { | |
| 126 | + color: #111; | |
| 127 | + background-color: #ffc107; | |
| 128 | + border-color: #ffc107; } | |
| 129 | + .btn-warning:hover { | |
| 130 | + color: #111; | |
| 131 | + background-color: #e0a800; | |
| 132 | + border-color: #d39e00; } | |
| 133 | + .btn-warning:focus, .btn-warning.focus { | |
| 134 | + box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.5); } | |
| 135 | + .btn-warning.disabled, .btn-warning:disabled { | |
| 136 | + background-color: #ffc107; | |
| 137 | + border-color: #ffc107; } | |
| 138 | + .btn-warning:active, .btn-warning.active, | |
| 139 | + .show > .btn-warning.dropdown-toggle { | |
| 140 | + background-color: #e0a800; | |
| 141 | + background-image: none; | |
| 142 | + border-color: #d39e00; } | |
| 143 | + | |
| 144 | +.btn-danger { | |
| 145 | + color: #fff; | |
| 146 | + background-color: #dc3545; | |
| 147 | + border-color: #dc3545; } | |
| 148 | + .btn-danger:hover { | |
| 149 | + color: #fff; | |
| 150 | + background-color: #c82333; | |
| 151 | + border-color: #bd2130; } | |
| 152 | + .btn-danger:focus, .btn-danger.focus { | |
| 153 | + box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.5); } | |
| 154 | + .btn-danger.disabled, .btn-danger:disabled { | |
| 155 | + background-color: #dc3545; | |
| 156 | + border-color: #dc3545; } | |
| 157 | + .btn-danger:active, .btn-danger.active, | |
| 158 | + .show > .btn-danger.dropdown-toggle { | |
| 159 | + background-color: #c82333; | |
| 160 | + background-image: none; | |
| 161 | + border-color: #bd2130; } | |
| 162 | + | |
| 163 | +.btn-light { | |
| 164 | + color: #111; | |
| 165 | + background-color: #f8f9fa; | |
| 166 | + border-color: #f8f9fa; } | |
| 167 | + .btn-light:hover { | |
| 168 | + color: #111; | |
| 169 | + background-color: #e2e6ea; | |
| 170 | + border-color: #dae0e5; } | |
| 171 | + .btn-light:focus, .btn-light.focus { | |
| 172 | + box-shadow: 0 0 0 3px rgba(248, 249, 250, 0.5); } | |
| 173 | + .btn-light.disabled, .btn-light:disabled { | |
| 174 | + background-color: #f8f9fa; | |
| 175 | + border-color: #f8f9fa; } | |
| 176 | + .btn-light:active, .btn-light.active, | |
| 177 | + .show > .btn-light.dropdown-toggle { | |
| 178 | + background-color: #e2e6ea; | |
| 179 | + background-image: none; | |
| 180 | + border-color: #dae0e5; } | |
| 181 | + | |
| 182 | +.btn-dark { | |
| 183 | + color: #fff; | |
| 184 | + background-color: #343a40; | |
| 185 | + border-color: #343a40; } | |
| 186 | + .btn-dark:hover { | |
| 187 | + color: #fff; | |
| 188 | + background-color: #23272b; | |
| 189 | + border-color: #1d2124; } | |
| 190 | + .btn-dark:focus, .btn-dark.focus { | |
| 191 | + box-shadow: 0 0 0 3px rgba(52, 58, 64, 0.5); } | |
| 192 | + .btn-dark.disabled, .btn-dark:disabled { | |
| 193 | + background-color: #343a40; | |
| 194 | + border-color: #343a40; } | |
| 195 | + .btn-dark:active, .btn-dark.active, | |
| 196 | + .show > .btn-dark.dropdown-toggle { | |
| 197 | + background-color: #23272b; | |
| 198 | + background-image: none; | |
| 199 | + border-color: #1d2124; } | |
| 200 | + | |
| 201 | +.btn-outline-primary { | |
| 202 | + color: #007bff; | |
| 203 | + background-color: transparent; | |
| 204 | + background-image: none; | |
| 205 | + border-color: #007bff; } | |
| 206 | + .btn-outline-primary:hover { | |
| 207 | + color: #fff; | |
| 208 | + background-color: #007bff; | |
| 209 | + border-color: #007bff; } | |
| 210 | + .btn-outline-primary:focus, .btn-outline-primary.focus { | |
| 211 | + box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5); } | |
| 212 | + .btn-outline-primary.disabled, .btn-outline-primary:disabled { | |
| 213 | + color: #007bff; | |
| 214 | + background-color: transparent; } | |
| 215 | + .btn-outline-primary:active, .btn-outline-primary.active, | |
| 216 | + .show > .btn-outline-primary.dropdown-toggle { | |
| 217 | + color: #fff; | |
| 218 | + background-color: #007bff; | |
| 219 | + border-color: #007bff; } | |
| 220 | + | |
| 221 | +.btn-outline-secondary { | |
| 222 | + color: #868e96; | |
| 223 | + background-color: transparent; | |
| 224 | + background-image: none; | |
| 225 | + border-color: #868e96; } | |
| 226 | + .btn-outline-secondary:hover { | |
| 227 | + color: #fff; | |
| 228 | + background-color: #868e96; | |
| 229 | + border-color: #868e96; } | |
| 230 | + .btn-outline-secondary:focus, .btn-outline-secondary.focus { | |
| 231 | + box-shadow: 0 0 0 3px rgba(134, 142, 150, 0.5); } | |
| 232 | + .btn-outline-secondary.disabled, .btn-outline-secondary:disabled { | |
| 233 | + color: #868e96; | |
| 234 | + background-color: transparent; } | |
| 235 | + .btn-outline-secondary:active, .btn-outline-secondary.active, | |
| 236 | + .show > .btn-outline-secondary.dropdown-toggle { | |
| 237 | + color: #fff; | |
| 238 | + background-color: #868e96; | |
| 239 | + border-color: #868e96; } | |
| 240 | + | |
| 241 | +.btn-outline-success { | |
| 242 | + color: #28a745; | |
| 243 | + background-color: transparent; | |
| 244 | + background-image: none; | |
| 245 | + border-color: #28a745; } | |
| 246 | + .btn-outline-success:hover { | |
| 247 | + color: #fff; | |
| 248 | + background-color: #28a745; | |
| 249 | + border-color: #28a745; } | |
| 250 | + .btn-outline-success:focus, .btn-outline-success.focus { | |
| 251 | + box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.5); } | |
| 252 | + .btn-outline-success.disabled, .btn-outline-success:disabled { | |
| 253 | + color: #28a745; | |
| 254 | + background-color: transparent; } | |
| 255 | + .btn-outline-success:active, .btn-outline-success.active, | |
| 256 | + .show > .btn-outline-success.dropdown-toggle { | |
| 257 | + color: #fff; | |
| 258 | + background-color: #28a745; | |
| 259 | + border-color: #28a745; } | |
| 260 | + | |
| 261 | +.btn-outline-info { | |
| 262 | + color: #17a2b8; | |
| 263 | + background-color: transparent; | |
| 264 | + background-image: none; | |
| 265 | + border-color: #17a2b8; } | |
| 266 | + .btn-outline-info:hover { | |
| 267 | + color: #fff; | |
| 268 | + background-color: #17a2b8; | |
| 269 | + border-color: #17a2b8; } | |
| 270 | + .btn-outline-info:focus, .btn-outline-info.focus { | |
| 271 | + box-shadow: 0 0 0 3px rgba(23, 162, 184, 0.5); } | |
| 272 | + .btn-outline-info.disabled, .btn-outline-info:disabled { | |
| 273 | + color: #17a2b8; | |
| 274 | + background-color: transparent; } | |
| 275 | + .btn-outline-info:active, .btn-outline-info.active, | |
| 276 | + .show > .btn-outline-info.dropdown-toggle { | |
| 277 | + color: #fff; | |
| 278 | + background-color: #17a2b8; | |
| 279 | + border-color: #17a2b8; } | |
| 280 | + | |
| 281 | +.btn-outline-warning { | |
| 282 | + color: #ffc107; | |
| 283 | + background-color: transparent; | |
| 284 | + background-image: none; | |
| 285 | + border-color: #ffc107; } | |
| 286 | + .btn-outline-warning:hover { | |
| 287 | + color: #fff; | |
| 288 | + background-color: #ffc107; | |
| 289 | + border-color: #ffc107; } | |
| 290 | + .btn-outline-warning:focus, .btn-outline-warning.focus { | |
| 291 | + box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.5); } | |
| 292 | + .btn-outline-warning.disabled, .btn-outline-warning:disabled { | |
| 293 | + color: #ffc107; | |
| 294 | + background-color: transparent; } | |
| 295 | + .btn-outline-warning:active, .btn-outline-warning.active, | |
| 296 | + .show > .btn-outline-warning.dropdown-toggle { | |
| 297 | + color: #fff; | |
| 298 | + background-color: #ffc107; | |
| 299 | + border-color: #ffc107; } | |
| 300 | + | |
| 301 | +.btn-outline-danger { | |
| 302 | + color: #dc3545; | |
| 303 | + background-color: transparent; | |
| 304 | + background-image: none; | |
| 305 | + border-color: #dc3545; } | |
| 306 | + .btn-outline-danger:hover { | |
| 307 | + color: #fff; | |
| 308 | + background-color: #dc3545; | |
| 309 | + border-color: #dc3545; } | |
| 310 | + .btn-outline-danger:focus, .btn-outline-danger.focus { | |
| 311 | + box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.5); } | |
| 312 | + .btn-outline-danger.disabled, .btn-outline-danger:disabled { | |
| 313 | + color: #dc3545; | |
| 314 | + background-color: transparent; } | |
| 315 | + .btn-outline-danger:active, .btn-outline-danger.active, | |
| 316 | + .show > .btn-outline-danger.dropdown-toggle { | |
| 317 | + color: #fff; | |
| 318 | + background-color: #dc3545; | |
| 319 | + border-color: #dc3545; } | |
| 320 | + | |
| 321 | +.btn-outline-light { | |
| 322 | + color: #f8f9fa; | |
| 323 | + background-color: transparent; | |
| 324 | + background-image: none; | |
| 325 | + border-color: #f8f9fa; } | |
| 326 | + .btn-outline-light:hover { | |
| 327 | + color: #fff; | |
| 328 | + background-color: #f8f9fa; | |
| 329 | + border-color: #f8f9fa; } | |
| 330 | + .btn-outline-light:focus, .btn-outline-light.focus { | |
| 331 | + box-shadow: 0 0 0 3px rgba(248, 249, 250, 0.5); } | |
| 332 | + .btn-outline-light.disabled, .btn-outline-light:disabled { | |
| 333 | + color: #f8f9fa; | |
| 334 | + background-color: transparent; } | |
| 335 | + .btn-outline-light:active, .btn-outline-light.active, | |
| 336 | + .show > .btn-outline-light.dropdown-toggle { | |
| 337 | + color: #fff; | |
| 338 | + background-color: #f8f9fa; | |
| 339 | + border-color: #f8f9fa; } | |
| 340 | + | |
| 341 | +.btn-outline-dark { | |
| 342 | + color: #343a40; | |
| 343 | + background-color: transparent; | |
| 344 | + background-image: none; | |
| 345 | + border-color: #343a40; } | |
| 346 | + .btn-outline-dark:hover { | |
| 347 | + color: #fff; | |
| 348 | + background-color: #343a40; | |
| 349 | + border-color: #343a40; } | |
| 350 | + .btn-outline-dark:focus, .btn-outline-dark.focus { | |
| 351 | + box-shadow: 0 0 0 3px rgba(52, 58, 64, 0.5); } | |
| 352 | + .btn-outline-dark.disabled, .btn-outline-dark:disabled { | |
| 353 | + color: #343a40; | |
| 354 | + background-color: transparent; } | |
| 355 | + .btn-outline-dark:active, .btn-outline-dark.active, | |
| 356 | + .show > .btn-outline-dark.dropdown-toggle { | |
| 357 | + color: #fff; | |
| 358 | + background-color: #343a40; | |
| 359 | + border-color: #343a40; } | |
| 360 | + | |
| 361 | +.btn-link { | |
| 362 | + font-weight: normal; | |
| 363 | + color: #007bff; | |
| 364 | + border-radius: 0; } | |
| 365 | + .btn-link, .btn-link:active, .btn-link.active, .btn-link:disabled { | |
| 366 | + background-color: transparent; } | |
| 367 | + .btn-link, .btn-link:focus, .btn-link:active { | |
| 368 | + border-color: transparent; | |
| 369 | + box-shadow: none; } | |
| 370 | + .btn-link:hover { | |
| 371 | + border-color: transparent; } | |
| 372 | + .btn-link:focus, .btn-link:hover { | |
| 373 | + color: #0056b3; | |
| 374 | + text-decoration: underline; | |
| 375 | + background-color: transparent; } | |
| 376 | + .btn-link:disabled { | |
| 377 | + color: #868e96; } | |
| 378 | + .btn-link:disabled:focus, .btn-link:disabled:hover { | |
| 379 | + text-decoration: none; } | |
| 380 | + | |
| 381 | +.btn-lg, .btn-group-lg > .btn { | |
| 382 | + padding: 0.5rem 1rem; | |
| 383 | + font-size: 1.25rem; | |
| 384 | + line-height: 1.5; | |
| 385 | + border-radius: 0.3rem; } | |
| 386 | + | |
| 387 | +.btn-sm, .btn-group-sm > .btn { | |
| 388 | + padding: 0.25rem 0.5rem; | |
| 389 | + font-size: 0.875rem; | |
| 390 | + line-height: 1.5; | |
| 391 | + border-radius: 0.2rem; } | |
| 392 | + | |
| 393 | +.btn-block { | |
| 394 | + display: block; | |
| 395 | + width: 100%; } | |
| 396 | + | |
| 397 | +.btn-block + .btn-block { | |
| 398 | + margin-top: 0.5rem; } | |
| 399 | + | |
| 400 | +input[type="submit"].btn-block, | |
| 401 | +input[type="reset"].btn-block, | |
| 402 | +input[type="button"].btn-block { | |
| 403 | + width: 100%; } | |
| 404 | + | |
| 405 | +.fade { | |
| 406 | + opacity: 0; | |
| 407 | + transition: opacity 0.15s linear; } | |
| 408 | + .fade.show { | |
| 409 | + opacity: 1; } | |
| 410 | + | |
| 411 | +.collapse { | |
| 412 | + display: none; } | |
| 413 | + .collapse.show { | |
| 414 | + display: block; } | |
| 415 | + | |
| 416 | +tr.collapse.show { | |
| 417 | + display: table-row; } | |
| 418 | + | |
| 419 | +tbody.collapse.show { | |
| 420 | + display: table-row-group; } | |
| 421 | + | |
| 422 | +.collapsing { | |
| 423 | + position: relative; | |
| 424 | + height: 0; | |
| 425 | + overflow: hidden; | |
| 426 | + transition: height 0.35s ease; } | |
| 427 | + | |
| 428 | +.btn-group, | |
| 429 | +.btn-group-vertical { | |
| 430 | + position: relative; | |
| 431 | + display: inline-flex; | |
| 432 | + vertical-align: middle; } | |
| 433 | + .btn-group > .btn, | |
| 434 | + .btn-group-vertical > .btn { | |
| 435 | + position: relative; | |
| 436 | + flex: 0 1 auto; | |
| 437 | + margin-bottom: 0; } | |
| 438 | + .btn-group > .btn:hover, | |
| 439 | + .btn-group-vertical > .btn:hover { | |
| 440 | + z-index: 2; } | |
| 441 | + .btn-group > .btn:focus, .btn-group > .btn:active, .btn-group > .btn.active, | |
| 442 | + .btn-group-vertical > .btn:focus, | |
| 443 | + .btn-group-vertical > .btn:active, | |
| 444 | + .btn-group-vertical > .btn.active { | |
| 445 | + z-index: 2; } | |
| 446 | + .btn-group .btn + .btn, | |
| 447 | + .btn-group .btn + .btn-group, | |
| 448 | + .btn-group .btn-group + .btn, | |
| 449 | + .btn-group .btn-group + .btn-group, | |
| 450 | + .btn-group-vertical .btn + .btn, | |
| 451 | + .btn-group-vertical .btn + .btn-group, | |
| 452 | + .btn-group-vertical .btn-group + .btn, | |
| 453 | + .btn-group-vertical .btn-group + .btn-group { | |
| 454 | + margin-left: -1px; } | |
| 455 | + | |
| 456 | +.btn-toolbar { | |
| 457 | + display: flex; | |
| 458 | + flex-wrap: wrap; | |
| 459 | + justify-content: flex-start; } | |
| 460 | + .btn-toolbar .input-group { | |
| 461 | + width: auto; } | |
| 462 | + | |
| 463 | +.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { | |
| 464 | + border-radius: 0; } | |
| 465 | + | |
| 466 | +.btn-group > .btn:first-child { | |
| 467 | + margin-left: 0; } | |
| 468 | + .btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) { | |
| 469 | + border-top-right-radius: 0; | |
| 470 | + border-bottom-right-radius: 0; } | |
| 471 | + | |
| 472 | +.btn-group > .btn:last-child:not(:first-child), | |
| 473 | +.btn-group > .dropdown-toggle:not(:first-child) { | |
| 474 | + border-top-left-radius: 0; | |
| 475 | + border-bottom-left-radius: 0; } | |
| 476 | + | |
| 477 | +.btn-group > .btn-group { | |
| 478 | + float: left; } | |
| 479 | + | |
| 480 | +.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { | |
| 481 | + border-radius: 0; } | |
| 482 | + | |
| 483 | +.btn-group > .btn-group:first-child:not(:last-child) > .btn:last-child, | |
| 484 | +.btn-group > .btn-group:first-child:not(:last-child) > .dropdown-toggle { | |
| 485 | + border-top-right-radius: 0; | |
| 486 | + border-bottom-right-radius: 0; } | |
| 487 | + | |
| 488 | +.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child { | |
| 489 | + border-top-left-radius: 0; | |
| 490 | + border-bottom-left-radius: 0; } | |
| 491 | + | |
| 492 | +.btn + .dropdown-toggle-split { | |
| 493 | + padding-right: 0.5625rem; | |
| 494 | + padding-left: 0.5625rem; } | |
| 495 | + .btn + .dropdown-toggle-split::after { | |
| 496 | + margin-left: 0; } | |
| 497 | + | |
| 498 | +.btn-sm + .dropdown-toggle-split, .btn-group-sm > .btn + .dropdown-toggle-split { | |
| 499 | + padding-right: 0.375rem; | |
| 500 | + padding-left: 0.375rem; } | |
| 501 | + | |
| 502 | +.btn-lg + .dropdown-toggle-split, .btn-group-lg > .btn + .dropdown-toggle-split { | |
| 503 | + padding-right: 0.75rem; | |
| 504 | + padding-left: 0.75rem; } | |
| 505 | + | |
| 506 | +.btn-group-vertical { | |
| 507 | + display: inline-flex; | |
| 508 | + flex-direction: column; | |
| 509 | + align-items: flex-start; | |
| 510 | + justify-content: center; } | |
| 511 | + .btn-group-vertical .btn, | |
| 512 | + .btn-group-vertical .btn-group { | |
| 513 | + width: 100%; } | |
| 514 | + .btn-group-vertical > .btn + .btn, | |
| 515 | + .btn-group-vertical > .btn + .btn-group, | |
| 516 | + .btn-group-vertical > .btn-group + .btn, | |
| 517 | + .btn-group-vertical > .btn-group + .btn-group { | |
| 518 | + margin-top: -1px; | |
| 519 | + margin-left: 0; } | |
| 520 | + | |
| 521 | +.btn-group-vertical > .btn:not(:first-child):not(:last-child) { | |
| 522 | + border-radius: 0; } | |
| 523 | + | |
| 524 | +.btn-group-vertical > .btn:first-child:not(:last-child) { | |
| 525 | + border-bottom-right-radius: 0; | |
| 526 | + border-bottom-left-radius: 0; } | |
| 527 | + | |
| 528 | +.btn-group-vertical > .btn:last-child:not(:first-child) { | |
| 529 | + border-top-left-radius: 0; | |
| 530 | + border-top-right-radius: 0; } | |
| 531 | + | |
| 532 | +.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn { | |
| 533 | + border-radius: 0; } | |
| 534 | + | |
| 535 | +.btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child, | |
| 536 | +.btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle { | |
| 537 | + border-bottom-right-radius: 0; | |
| 538 | + border-bottom-left-radius: 0; } | |
| 539 | + | |
| 540 | +.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child { | |
| 541 | + border-top-left-radius: 0; | |
| 542 | + border-top-right-radius: 0; } | |
| 543 | + | |
| 544 | +[data-toggle="buttons"] > .btn input[type="radio"], | |
| 545 | +[data-toggle="buttons"] > .btn input[type="checkbox"], | |
| 546 | +[data-toggle="buttons"] > .btn-group > .btn input[type="radio"], | |
| 547 | +[data-toggle="buttons"] > .btn-group > .btn input[type="checkbox"] { | |
| 548 | + position: absolute; | |
| 549 | + clip: rect(0, 0, 0, 0); | |
| 550 | + pointer-events: none; } | |
| 551 | + | |
| 552 | +.popover { | |
| 553 | + position: absolute; | |
| 554 | + top: 0; | |
| 555 | + left: 0; | |
| 556 | + z-index: 1060; | |
| 557 | + display: block; | |
| 558 | + max-width: 276px; | |
| 559 | + padding: 1px; | |
| 560 | + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; | |
| 561 | + font-style: normal; | |
| 562 | + font-weight: normal; | |
| 563 | + line-height: 1.5; | |
| 564 | + text-align: left; | |
| 565 | + text-align: start; | |
| 566 | + text-decoration: none; | |
| 567 | + text-shadow: none; | |
| 568 | + text-transform: none; | |
| 569 | + letter-spacing: normal; | |
| 570 | + word-break: normal; | |
| 571 | + word-spacing: normal; | |
| 572 | + white-space: normal; | |
| 573 | + line-break: auto; | |
| 574 | + font-size: 0.875rem; | |
| 575 | + word-wrap: break-word; | |
| 576 | + background-color: #fff; | |
| 577 | + background-clip: padding-box; | |
| 578 | + border: 1px solid rgba(0, 0, 0, 0.2); | |
| 579 | + border-radius: 0.3rem; } | |
| 580 | + .popover .arrow { | |
| 581 | + position: absolute; | |
| 582 | + display: block; | |
| 583 | + width: 10px; | |
| 584 | + height: 5px; } | |
| 585 | + .popover .arrow::before, | |
| 586 | + .popover .arrow::after { | |
| 587 | + position: absolute; | |
| 588 | + display: block; | |
| 589 | + border-color: transparent; | |
| 590 | + border-style: solid; } | |
| 591 | + .popover .arrow::before { | |
| 592 | + content: ""; | |
| 593 | + border-width: 11px; } | |
| 594 | + .popover .arrow::after { | |
| 595 | + content: ""; | |
| 596 | + border-width: 11px; } | |
| 597 | + .popover.bs-popover-top, .popover.bs-popover-auto[x-placement^="top"] { | |
| 598 | + margin-bottom: 10px; } | |
| 599 | + .popover.bs-popover-top .arrow, .popover.bs-popover-auto[x-placement^="top"] .arrow { | |
| 600 | + bottom: 0; } | |
| 601 | + .popover.bs-popover-top .arrow::before, .popover.bs-popover-auto[x-placement^="top"] .arrow::before, | |
| 602 | + .popover.bs-popover-top .arrow::after, .popover.bs-popover-auto[x-placement^="top"] .arrow::after { | |
| 603 | + border-bottom-width: 0; } | |
| 604 | + .popover.bs-popover-top .arrow::before, .popover.bs-popover-auto[x-placement^="top"] .arrow::before { | |
| 605 | + bottom: -11px; | |
| 606 | + margin-left: -6px; | |
| 607 | + border-top-color: rgba(0, 0, 0, 0.25); } | |
| 608 | + .popover.bs-popover-top .arrow::after, .popover.bs-popover-auto[x-placement^="top"] .arrow::after { | |
| 609 | + bottom: -10px; | |
| 610 | + margin-left: -6px; | |
| 611 | + border-top-color: #fff; } | |
| 612 | + .popover.bs-popover-right, .popover.bs-popover-auto[x-placement^="right"] { | |
| 613 | + margin-left: 10px; } | |
| 614 | + .popover.bs-popover-right .arrow, .popover.bs-popover-auto[x-placement^="right"] .arrow { | |
| 615 | + left: 0; } | |
| 616 | + .popover.bs-popover-right .arrow::before, .popover.bs-popover-auto[x-placement^="right"] .arrow::before, | |
| 617 | + .popover.bs-popover-right .arrow::after, .popover.bs-popover-auto[x-placement^="right"] .arrow::after { | |
| 618 | + margin-top: -8px; | |
| 619 | + border-left-width: 0; } | |
| 620 | + .popover.bs-popover-right .arrow::before, .popover.bs-popover-auto[x-placement^="right"] .arrow::before { | |
| 621 | + left: -11px; | |
| 622 | + border-right-color: rgba(0, 0, 0, 0.25); } | |
| 623 | + .popover.bs-popover-right .arrow::after, .popover.bs-popover-auto[x-placement^="right"] .arrow::after { | |
| 624 | + left: -10px; | |
| 625 | + border-right-color: #fff; } | |
| 626 | + .popover.bs-popover-bottom, .popover.bs-popover-auto[x-placement^="bottom"] { | |
| 627 | + margin-top: 10px; } | |
| 628 | + .popover.bs-popover-bottom .arrow, .popover.bs-popover-auto[x-placement^="bottom"] .arrow { | |
| 629 | + top: 0; } | |
| 630 | + .popover.bs-popover-bottom .arrow::before, .popover.bs-popover-auto[x-placement^="bottom"] .arrow::before, | |
| 631 | + .popover.bs-popover-bottom .arrow::after, .popover.bs-popover-auto[x-placement^="bottom"] .arrow::after { | |
| 632 | + margin-left: -7px; | |
| 633 | + border-top-width: 0; } | |
| 634 | + .popover.bs-popover-bottom .arrow::before, .popover.bs-popover-auto[x-placement^="bottom"] .arrow::before { | |
| 635 | + top: -11px; | |
| 636 | + border-bottom-color: rgba(0, 0, 0, 0.25); } | |
| 637 | + .popover.bs-popover-bottom .arrow::after, .popover.bs-popover-auto[x-placement^="bottom"] .arrow::after { | |
| 638 | + top: -10px; | |
| 639 | + border-bottom-color: #fff; } | |
| 640 | + .popover.bs-popover-bottom .popover-header::before, .popover.bs-popover-auto[x-placement^="bottom"] .popover-header::before { | |
| 641 | + position: absolute; | |
| 642 | + top: 0; | |
| 643 | + left: 50%; | |
| 644 | + display: block; | |
| 645 | + width: 20px; | |
| 646 | + margin-left: -10px; | |
| 647 | + content: ""; | |
| 648 | + border-bottom: 1px solid #f7f7f7; } | |
| 649 | + .popover.bs-popover-left, .popover.bs-popover-auto[x-placement^="left"] { | |
| 650 | + margin-right: 10px; } | |
| 651 | + .popover.bs-popover-left .arrow, .popover.bs-popover-auto[x-placement^="left"] .arrow { | |
| 652 | + right: 0; } | |
| 653 | + .popover.bs-popover-left .arrow::before, .popover.bs-popover-auto[x-placement^="left"] .arrow::before, | |
| 654 | + .popover.bs-popover-left .arrow::after, .popover.bs-popover-auto[x-placement^="left"] .arrow::after { | |
| 655 | + margin-top: -8px; | |
| 656 | + border-right-width: 0; } | |
| 657 | + .popover.bs-popover-left .arrow::before, .popover.bs-popover-auto[x-placement^="left"] .arrow::before { | |
| 658 | + right: -11px; | |
| 659 | + border-left-color: rgba(0, 0, 0, 0.25); } | |
| 660 | + .popover.bs-popover-left .arrow::after, .popover.bs-popover-auto[x-placement^="left"] .arrow::after { | |
| 661 | + right: -10px; | |
| 662 | + border-left-color: #fff; } | |
| 663 | + | |
| 664 | +.popover-header { | |
| 665 | + padding: 8px 14px; | |
| 666 | + margin-bottom: 0; | |
| 667 | + font-size: 1rem; | |
| 668 | + color: inherit; | |
| 669 | + background-color: #f7f7f7; | |
| 670 | + border-bottom: 1px solid #ebebeb; | |
| 671 | + border-top-left-radius: calc(0.3rem - 1px); | |
| 672 | + border-top-right-radius: calc(0.3rem - 1px); } | |
| 673 | + .popover-header:empty { | |
| 674 | + display: none; } | |
| 675 | + | |
| 676 | +.popover-body { | |
| 677 | + padding: 9px 14px; | |
| 678 | + color: #212529; } | |
| 679 | + | |
| 680 | +.tour-backdrop { | |
| 681 | + background-color: #000; | |
| 682 | + filter: alpha(opacity=80); | |
| 683 | + opacity: .8; | |
| 684 | + position: absolute; | |
| 685 | + z-index: 1100; } | |
| 686 | + | |
| 687 | +.popover[class*="tour-"] { | |
| 688 | + z-index: 1102; } | |
| 689 | + .popover[class*="tour-"] .popover-navigation { | |
| 690 | + overflow: hidden; | |
| 691 | + padding: 9px 14px; } | |
| 692 | + .popover[class*="tour-"] .popover-navigation *[data-role="end"] { | |
| 693 | + float: right; } | |
| 694 | + .popover[class*="tour-"] .popover-navigation *[data-role="prev"], | |
| 695 | + .popover[class*="tour-"] .popover-navigation *[data-role="next"], | |
| 696 | + .popover[class*="tour-"] .popover-navigation *[data-role="end"] { | |
| 697 | + cursor: pointer; } | |
| 698 | + .popover[class*="tour-"] .popover-navigation *[data-role="prev"].disabled, | |
| 699 | + .popover[class*="tour-"] .popover-navigation *[data-role="next"].disabled, | |
| 700 | + .popover[class*="tour-"] .popover-navigation *[data-role="end"].disabled { | |
| 701 | + cursor: default; } | |
| 702 | + .popover[class*="tour-"].orphan { | |
| 703 | + left: 50%; | |
| 704 | + margin-top: 0; | |
| 705 | + position: fixed; | |
| 706 | + top: 50%; | |
| 707 | + transform: translate(-50%, -50%); } | |
| 708 | + .popover[class*="tour-"].orphan .arrow { | |
| 709 | + display: none; } | ... | ... |
pacotes/bootstrap-tour/build/css/bootstrap-tour-standalone.min.css
0 → 100644
| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | +/* ======================================================================== | |
| 2 | + * bootstrap-tour - v0.12.0 | |
| 3 | + * http://bootstraptour.com | |
| 4 | + * ======================================================================== | |
| 5 | + * Copyright 2012-2017 Ulrich Sossou | |
| 6 | + * | |
| 7 | + * ======================================================================== | |
| 8 | + * Licensed under the MIT License (the "License"); | |
| 9 | + * you may not use this file except in compliance with the License. | |
| 10 | + * You may obtain a copy of the License at | |
| 11 | + * | |
| 12 | + * https://opensource.org/licenses/MIT | |
| 13 | + * | |
| 14 | + * Unless required by applicable law or agreed to in writing, software | |
| 15 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 16 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 17 | + * See the License for the specific language governing permissions and | |
| 18 | + * limitations under the License. | |
| 19 | + * ======================================================================== | |
| 20 | + */ | |
| 21 | + | |
| 22 | +.btn{display:inline-block;font-weight:normal;text-align:center;white-space:nowrap;vertical-align:middle;user-select:none;border:1px solid transparent;padding:0.5rem 0.75rem;font-size:1rem;line-height:1.25;border-radius:0.25rem;transition:background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out}.btn:focus,.btn:hover{text-decoration:none}.btn:focus,.btn.focus{outline:0;box-shadow:0 0 0 3px rgba(0,123,255,0.25)}.btn.disabled,.btn:disabled{opacity:.65}.btn:active,.btn.active{background-image:none}a.btn.disabled,fieldset[disabled] a.btn{pointer-events:none}.btn-primary{color:#fff;background-color:#007bff;border-color:#007bff}.btn-primary:hover{color:#fff;background-color:#0069d9;border-color:#0062cc}.btn-primary:focus,.btn-primary.focus{box-shadow:0 0 0 3px rgba(0,123,255,0.5)}.btn-primary.disabled,.btn-primary:disabled{background-color:#007bff;border-color:#007bff}.btn-primary:active,.btn-primary.active,.show>.btn-primary.dropdown-toggle{background-color:#0069d9;background-image:none;border-color:#0062cc}.btn-secondary{color:#fff;background-color:#868e96;border-color:#868e96}.btn-secondary:hover{color:#fff;background-color:#727b84;border-color:#6c757d}.btn-secondary:focus,.btn-secondary.focus{box-shadow:0 0 0 3px rgba(134,142,150,0.5)}.btn-secondary.disabled,.btn-secondary:disabled{background-color:#868e96;border-color:#868e96}.btn-secondary:active,.btn-secondary.active,.show>.btn-secondary.dropdown-toggle{background-color:#727b84;background-image:none;border-color:#6c757d}.btn-success{color:#fff;background-color:#28a745;border-color:#28a745}.btn-success:hover{color:#fff;background-color:#218838;border-color:#1e7e34}.btn-success:focus,.btn-success.focus{box-shadow:0 0 0 3px rgba(40,167,69,0.5)}.btn-success.disabled,.btn-success:disabled{background-color:#28a745;border-color:#28a745}.btn-success:active,.btn-success.active,.show>.btn-success.dropdown-toggle{background-color:#218838;background-image:none;border-color:#1e7e34}.btn-info{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-info:hover{color:#fff;background-color:#138496;border-color:#117a8b}.btn-info:focus,.btn-info.focus{box-shadow:0 0 0 3px rgba(23,162,184,0.5)}.btn-info.disabled,.btn-info:disabled{background-color:#17a2b8;border-color:#17a2b8}.btn-info:active,.btn-info.active,.show>.btn-info.dropdown-toggle{background-color:#138496;background-image:none;border-color:#117a8b}.btn-warning{color:#111;background-color:#ffc107;border-color:#ffc107}.btn-warning:hover{color:#111;background-color:#e0a800;border-color:#d39e00}.btn-warning:focus,.btn-warning.focus{box-shadow:0 0 0 3px rgba(255,193,7,0.5)}.btn-warning.disabled,.btn-warning:disabled{background-color:#ffc107;border-color:#ffc107}.btn-warning:active,.btn-warning.active,.show>.btn-warning.dropdown-toggle{background-color:#e0a800;background-image:none;border-color:#d39e00}.btn-danger{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-danger:hover{color:#fff;background-color:#c82333;border-color:#bd2130}.btn-danger:focus,.btn-danger.focus{box-shadow:0 0 0 3px rgba(220,53,69,0.5)}.btn-danger.disabled,.btn-danger:disabled{background-color:#dc3545;border-color:#dc3545}.btn-danger:active,.btn-danger.active,.show>.btn-danger.dropdown-toggle{background-color:#c82333;background-image:none;border-color:#bd2130}.btn-light{color:#111;background-color:#f8f9fa;border-color:#f8f9fa}.btn-light:hover{color:#111;background-color:#e2e6ea;border-color:#dae0e5}.btn-light:focus,.btn-light.focus{box-shadow:0 0 0 3px rgba(248,249,250,0.5)}.btn-light.disabled,.btn-light:disabled{background-color:#f8f9fa;border-color:#f8f9fa}.btn-light:active,.btn-light.active,.show>.btn-light.dropdown-toggle{background-color:#e2e6ea;background-image:none;border-color:#dae0e5}.btn-dark{color:#fff;background-color:#343a40;border-color:#343a40}.btn-dark:hover{color:#fff;background-color:#23272b;border-color:#1d2124}.btn-dark:focus,.btn-dark.focus{box-shadow:0 0 0 3px rgba(52,58,64,0.5)}.btn-dark.disabled,.btn-dark:disabled{background-color:#343a40;border-color:#343a40}.btn-dark:active,.btn-dark.active,.show>.btn-dark.dropdown-toggle{background-color:#23272b;background-image:none;border-color:#1d2124}.btn-outline-primary{color:#007bff;background-color:transparent;background-image:none;border-color:#007bff}.btn-outline-primary:hover{color:#fff;background-color:#007bff;border-color:#007bff}.btn-outline-primary:focus,.btn-outline-primary.focus{box-shadow:0 0 0 3px rgba(0,123,255,0.5)}.btn-outline-primary.disabled,.btn-outline-primary:disabled{color:#007bff;background-color:transparent}.btn-outline-primary:active,.btn-outline-primary.active,.show>.btn-outline-primary.dropdown-toggle{color:#fff;background-color:#007bff;border-color:#007bff}.btn-outline-secondary{color:#868e96;background-color:transparent;background-image:none;border-color:#868e96}.btn-outline-secondary:hover{color:#fff;background-color:#868e96;border-color:#868e96}.btn-outline-secondary:focus,.btn-outline-secondary.focus{box-shadow:0 0 0 3px rgba(134,142,150,0.5)}.btn-outline-secondary.disabled,.btn-outline-secondary:disabled{color:#868e96;background-color:transparent}.btn-outline-secondary:active,.btn-outline-secondary.active,.show>.btn-outline-secondary.dropdown-toggle{color:#fff;background-color:#868e96;border-color:#868e96}.btn-outline-success{color:#28a745;background-color:transparent;background-image:none;border-color:#28a745}.btn-outline-success:hover{color:#fff;background-color:#28a745;border-color:#28a745}.btn-outline-success:focus,.btn-outline-success.focus{box-shadow:0 0 0 3px rgba(40,167,69,0.5)}.btn-outline-success.disabled,.btn-outline-success:disabled{color:#28a745;background-color:transparent}.btn-outline-success:active,.btn-outline-success.active,.show>.btn-outline-success.dropdown-toggle{color:#fff;background-color:#28a745;border-color:#28a745}.btn-outline-info{color:#17a2b8;background-color:transparent;background-image:none;border-color:#17a2b8}.btn-outline-info:hover{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-outline-info:focus,.btn-outline-info.focus{box-shadow:0 0 0 3px rgba(23,162,184,0.5)}.btn-outline-info.disabled,.btn-outline-info:disabled{color:#17a2b8;background-color:transparent}.btn-outline-info:active,.btn-outline-info.active,.show>.btn-outline-info.dropdown-toggle{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-outline-warning{color:#ffc107;background-color:transparent;background-image:none;border-color:#ffc107}.btn-outline-warning:hover{color:#fff;background-color:#ffc107;border-color:#ffc107}.btn-outline-warning:focus,.btn-outline-warning.focus{box-shadow:0 0 0 3px rgba(255,193,7,0.5)}.btn-outline-warning.disabled,.btn-outline-warning:disabled{color:#ffc107;background-color:transparent}.btn-outline-warning:active,.btn-outline-warning.active,.show>.btn-outline-warning.dropdown-toggle{color:#fff;background-color:#ffc107;border-color:#ffc107}.btn-outline-danger{color:#dc3545;background-color:transparent;background-image:none;border-color:#dc3545}.btn-outline-danger:hover{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-outline-danger:focus,.btn-outline-danger.focus{box-shadow:0 0 0 3px rgba(220,53,69,0.5)}.btn-outline-danger.disabled,.btn-outline-danger:disabled{color:#dc3545;background-color:transparent}.btn-outline-danger:active,.btn-outline-danger.active,.show>.btn-outline-danger.dropdown-toggle{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-outline-light{color:#f8f9fa;background-color:transparent;background-image:none;border-color:#f8f9fa}.btn-outline-light:hover{color:#fff;background-color:#f8f9fa;border-color:#f8f9fa}.btn-outline-light:focus,.btn-outline-light.focus{box-shadow:0 0 0 3px rgba(248,249,250,0.5)}.btn-outline-light.disabled,.btn-outline-light:disabled{color:#f8f9fa;background-color:transparent}.btn-outline-light:active,.btn-outline-light.active,.show>.btn-outline-light.dropdown-toggle{color:#fff;background-color:#f8f9fa;border-color:#f8f9fa}.btn-outline-dark{color:#343a40;background-color:transparent;background-image:none;border-color:#343a40}.btn-outline-dark:hover{color:#fff;background-color:#343a40;border-color:#343a40}.btn-outline-dark:focus,.btn-outline-dark.focus{box-shadow:0 0 0 3px rgba(52,58,64,0.5)}.btn-outline-dark.disabled,.btn-outline-dark:disabled{color:#343a40;background-color:transparent}.btn-outline-dark:active,.btn-outline-dark.active,.show>.btn-outline-dark.dropdown-toggle{color:#fff;background-color:#343a40;border-color:#343a40}.btn-link{font-weight:normal;color:#007bff;border-radius:0}.btn-link,.btn-link:active,.btn-link.active,.btn-link:disabled{background-color:transparent}.btn-link,.btn-link:focus,.btn-link:active{border-color:transparent;box-shadow:none}.btn-link:hover{border-color:transparent}.btn-link:focus,.btn-link:hover{color:#0056b3;text-decoration:underline;background-color:transparent}.btn-link:disabled{color:#868e96}.btn-link:disabled:focus,.btn-link:disabled:hover{text-decoration:none}.btn-lg,.btn-group-lg>.btn{padding:0.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:0.3rem}.btn-sm,.btn-group-sm>.btn{padding:0.25rem 0.5rem;font-size:0.875rem;line-height:1.5;border-radius:0.2rem}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:0.5rem}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.fade{opacity:0;transition:opacity 0.15s linear}.fade.show{opacity:1}.collapse{display:none}.collapse.show{display:block}tr.collapse.show{display:table-row}tbody.collapse.show{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;transition:height 0.35s ease}.btn-group,.btn-group-vertical{position:relative;display:inline-flex;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;flex:0 1 auto;margin-bottom:0}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover{z-index:2}.btn-group>.btn:focus,.btn-group>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn.active{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group,.btn-group-vertical .btn+.btn,.btn-group-vertical .btn+.btn-group,.btn-group-vertical .btn-group+.btn,.btn-group-vertical .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{display:flex;flex-wrap:wrap;justify-content:flex-start}.btn-toolbar .input-group{width:auto}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn+.dropdown-toggle-split{padding-right:0.5625rem;padding-left:0.5625rem}.btn+.dropdown-toggle-split::after{margin-left:0}.btn-sm+.dropdown-toggle-split,.btn-group-sm>.btn+.dropdown-toggle-split{padding-right:0.375rem;padding-left:0.375rem}.btn-lg+.dropdown-toggle-split,.btn-group-lg>.btn+.dropdown-toggle-split{padding-right:0.75rem;padding-left:0.75rem}.btn-group-vertical{display:inline-flex;flex-direction:column;align-items:flex-start;justify-content:center}.btn-group-vertical .btn,.btn-group-vertical .btn-group{width:100%}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}[data-toggle="buttons"]>.btn input[type="radio"],[data-toggle="buttons"]>.btn input[type="checkbox"],[data-toggle="buttons"]>.btn-group>.btn input[type="radio"],[data-toggle="buttons"]>.btn-group>.btn input[type="checkbox"]{position:absolute;clip:rect(0, 0, 0, 0);pointer-events:none}.popover{position:absolute;top:0;left:0;z-index:1060;display:block;max-width:276px;padding:1px;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";font-style:normal;font-weight:normal;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;white-space:normal;line-break:auto;font-size:0.875rem;word-wrap:break-word;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,0.2);border-radius:0.3rem}.popover .arrow{position:absolute;display:block;width:10px;height:5px}.popover .arrow::before,.popover .arrow::after{position:absolute;display:block;border-color:transparent;border-style:solid}.popover .arrow::before{content:"";border-width:11px}.popover .arrow::after{content:"";border-width:11px}.popover.bs-popover-top,.popover.bs-popover-auto[x-placement^="top"]{margin-bottom:10px}.popover.bs-popover-top .arrow,.popover.bs-popover-auto[x-placement^="top"] .arrow{bottom:0}.popover.bs-popover-top .arrow::before,.popover.bs-popover-auto[x-placement^="top"] .arrow::before,.popover.bs-popover-top .arrow::after,.popover.bs-popover-auto[x-placement^="top"] .arrow::after{border-bottom-width:0}.popover.bs-popover-top .arrow::before,.popover.bs-popover-auto[x-placement^="top"] .arrow::before{bottom:-11px;margin-left:-6px;border-top-color:rgba(0,0,0,0.25)}.popover.bs-popover-top .arrow::after,.popover.bs-popover-auto[x-placement^="top"] .arrow::after{bottom:-10px;margin-left:-6px;border-top-color:#fff}.popover.bs-popover-right,.popover.bs-popover-auto[x-placement^="right"]{margin-left:10px}.popover.bs-popover-right .arrow,.popover.bs-popover-auto[x-placement^="right"] .arrow{left:0}.popover.bs-popover-right .arrow::before,.popover.bs-popover-auto[x-placement^="right"] .arrow::before,.popover.bs-popover-right .arrow::after,.popover.bs-popover-auto[x-placement^="right"] .arrow::after{margin-top:-8px;border-left-width:0}.popover.bs-popover-right .arrow::before,.popover.bs-popover-auto[x-placement^="right"] .arrow::before{left:-11px;border-right-color:rgba(0,0,0,0.25)}.popover.bs-popover-right .arrow::after,.popover.bs-popover-auto[x-placement^="right"] .arrow::after{left:-10px;border-right-color:#fff}.popover.bs-popover-bottom,.popover.bs-popover-auto[x-placement^="bottom"]{margin-top:10px}.popover.bs-popover-bottom .arrow,.popover.bs-popover-auto[x-placement^="bottom"] .arrow{top:0}.popover.bs-popover-bottom .arrow::before,.popover.bs-popover-auto[x-placement^="bottom"] .arrow::before,.popover.bs-popover-bottom .arrow::after,.popover.bs-popover-auto[x-placement^="bottom"] .arrow::after{margin-left:-7px;border-top-width:0}.popover.bs-popover-bottom .arrow::before,.popover.bs-popover-auto[x-placement^="bottom"] .arrow::before{top:-11px;border-bottom-color:rgba(0,0,0,0.25)}.popover.bs-popover-bottom .arrow::after,.popover.bs-popover-auto[x-placement^="bottom"] .arrow::after{top:-10px;border-bottom-color:#fff}.popover.bs-popover-bottom .popover-header::before,.popover.bs-popover-auto[x-placement^="bottom"] .popover-header::before{position:absolute;top:0;left:50%;display:block;width:20px;margin-left:-10px;content:"";border-bottom:1px solid #f7f7f7}.popover.bs-popover-left,.popover.bs-popover-auto[x-placement^="left"]{margin-right:10px}.popover.bs-popover-left .arrow,.popover.bs-popover-auto[x-placement^="left"] .arrow{right:0}.popover.bs-popover-left .arrow::before,.popover.bs-popover-auto[x-placement^="left"] .arrow::before,.popover.bs-popover-left .arrow::after,.popover.bs-popover-auto[x-placement^="left"] .arrow::after{margin-top:-8px;border-right-width:0}.popover.bs-popover-left .arrow::before,.popover.bs-popover-auto[x-placement^="left"] .arrow::before{right:-11px;border-left-color:rgba(0,0,0,0.25)}.popover.bs-popover-left .arrow::after,.popover.bs-popover-auto[x-placement^="left"] .arrow::after{right:-10px;border-left-color:#fff}.popover-header{padding:8px 14px;margin-bottom:0;font-size:1rem;color:inherit;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-top-left-radius:calc(0.3rem - 1px);border-top-right-radius:calc(0.3rem - 1px)}.popover-header:empty{display:none}.popover-body{padding:9px 14px;color:#212529}.tour-backdrop{background-color:#000;filter:alpha(opacity=80);opacity:.8;position:absolute;z-index:1100}.popover[class*="tour-"]{z-index:1102}.popover[class*="tour-"] .popover-navigation{overflow:hidden;padding:9px 14px}.popover[class*="tour-"] .popover-navigation *[data-role="end"]{float:right}.popover[class*="tour-"] .popover-navigation *[data-role="prev"],.popover[class*="tour-"] .popover-navigation *[data-role="next"],.popover[class*="tour-"] .popover-navigation *[data-role="end"]{cursor:pointer}.popover[class*="tour-"] .popover-navigation *[data-role="prev"].disabled,.popover[class*="tour-"] .popover-navigation *[data-role="next"].disabled,.popover[class*="tour-"] .popover-navigation *[data-role="end"].disabled{cursor:default}.popover[class*="tour-"].orphan{left:50%;margin-top:0;position:fixed;top:50%;transform:translate(-50%, -50%)}.popover[class*="tour-"].orphan .arrow{display:none} | ... | ... |
| ... | ... | @@ -0,0 +1,51 @@ |
| 1 | +/* ======================================================================== | |
| 2 | + * bootstrap-tour - v0.12.0 | |
| 3 | + * http://bootstraptour.com | |
| 4 | + * ======================================================================== | |
| 5 | + * Copyright 2012-2017 Ulrich Sossou | |
| 6 | + * | |
| 7 | + * ======================================================================== | |
| 8 | + * Licensed under the MIT License (the "License"); | |
| 9 | + * you may not use this file except in compliance with the License. | |
| 10 | + * You may obtain a copy of the License at | |
| 11 | + * | |
| 12 | + * https://opensource.org/licenses/MIT | |
| 13 | + * | |
| 14 | + * Unless required by applicable law or agreed to in writing, software | |
| 15 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 16 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 17 | + * See the License for the specific language governing permissions and | |
| 18 | + * limitations under the License. | |
| 19 | + * ======================================================================== | |
| 20 | + */ | |
| 21 | + | |
| 22 | +.tour-backdrop { | |
| 23 | + background-color: #000; | |
| 24 | + filter: alpha(opacity=80); | |
| 25 | + opacity: .8; | |
| 26 | + position: absolute; | |
| 27 | + z-index: 1100; } | |
| 28 | + | |
| 29 | +.popover[class*="tour-"] { | |
| 30 | + z-index: 1102; } | |
| 31 | + .popover[class*="tour-"] .popover-navigation { | |
| 32 | + overflow: hidden; | |
| 33 | + padding: 9px 14px; } | |
| 34 | + .popover[class*="tour-"] .popover-navigation *[data-role="end"] { | |
| 35 | + float: right; } | |
| 36 | + .popover[class*="tour-"] .popover-navigation *[data-role="prev"], | |
| 37 | + .popover[class*="tour-"] .popover-navigation *[data-role="next"], | |
| 38 | + .popover[class*="tour-"] .popover-navigation *[data-role="end"] { | |
| 39 | + cursor: pointer; } | |
| 40 | + .popover[class*="tour-"] .popover-navigation *[data-role="prev"].disabled, | |
| 41 | + .popover[class*="tour-"] .popover-navigation *[data-role="next"].disabled, | |
| 42 | + .popover[class*="tour-"] .popover-navigation *[data-role="end"].disabled { | |
| 43 | + cursor: default; } | |
| 44 | + .popover[class*="tour-"].orphan { | |
| 45 | + left: 50%; | |
| 46 | + margin-top: 0; | |
| 47 | + position: fixed; | |
| 48 | + top: 50%; | |
| 49 | + transform: translate(-50%, -50%); } | |
| 50 | + .popover[class*="tour-"].orphan .arrow { | |
| 51 | + display: none; } | ... | ... |
| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | +/* ======================================================================== | |
| 2 | + * bootstrap-tour - v0.12.0 | |
| 3 | + * http://bootstraptour.com | |
| 4 | + * ======================================================================== | |
| 5 | + * Copyright 2012-2017 Ulrich Sossou | |
| 6 | + * | |
| 7 | + * ======================================================================== | |
| 8 | + * Licensed under the MIT License (the "License"); | |
| 9 | + * you may not use this file except in compliance with the License. | |
| 10 | + * You may obtain a copy of the License at | |
| 11 | + * | |
| 12 | + * https://opensource.org/licenses/MIT | |
| 13 | + * | |
| 14 | + * Unless required by applicable law or agreed to in writing, software | |
| 15 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 16 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 17 | + * See the License for the specific language governing permissions and | |
| 18 | + * limitations under the License. | |
| 19 | + * ======================================================================== | |
| 20 | + */ | |
| 21 | + | |
| 22 | +.tour-backdrop{background-color:#000;filter:alpha(opacity=80);opacity:.8;position:absolute;z-index:1100}.popover[class*="tour-"]{z-index:1102}.popover[class*="tour-"] .popover-navigation{overflow:hidden;padding:9px 14px}.popover[class*="tour-"] .popover-navigation *[data-role="end"]{float:right}.popover[class*="tour-"] .popover-navigation *[data-role="prev"],.popover[class*="tour-"] .popover-navigation *[data-role="next"],.popover[class*="tour-"] .popover-navigation *[data-role="end"]{cursor:pointer}.popover[class*="tour-"] .popover-navigation *[data-role="prev"].disabled,.popover[class*="tour-"] .popover-navigation *[data-role="next"].disabled,.popover[class*="tour-"] .popover-navigation *[data-role="end"].disabled{cursor:default}.popover[class*="tour-"].orphan{left:50%;margin-top:0;position:fixed;top:50%;transform:translate(-50%, -50%)}.popover[class*="tour-"].orphan .arrow{display:none} | ... | ... |
pacotes/bootstrap-tour/build/js/bootstrap-tour-standalone.js
0 → 100644
| ... | ... | @@ -0,0 +1,4423 @@ |
| 1 | +/* ======================================================================== | |
| 2 | + * bootstrap-tour - v0.12.0 | |
| 3 | + * http://bootstraptour.com | |
| 4 | + * ======================================================================== | |
| 5 | + * Copyright 2012-2017 Ulrich Sossou | |
| 6 | + * | |
| 7 | + * ======================================================================== | |
| 8 | + * Licensed under the MIT License (the "License"); | |
| 9 | + * you may not use this file except in compliance with the License. | |
| 10 | + * You may obtain a copy of the License at | |
| 11 | + * | |
| 12 | + * https://opensource.org/licenses/MIT | |
| 13 | + * | |
| 14 | + * Unless required by applicable law or agreed to in writing, software | |
| 15 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 16 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 17 | + * See the License for the specific language governing permissions and | |
| 18 | + * limitations under the License. | |
| 19 | + * ======================================================================== | |
| 20 | + */ | |
| 21 | + | |
| 22 | +/**! | |
| 23 | + * @fileOverview Kickass library to create and place poppers near their reference elements. | |
| 24 | + * @version 1.12.5 | |
| 25 | + * @license | |
| 26 | + * Copyright (c) 2016 Federico Zivolo and contributors | |
| 27 | + * | |
| 28 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 29 | + * of this software and associated documentation files (the "Software"), to deal | |
| 30 | + * in the Software without restriction, including without limitation the rights | |
| 31 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 32 | + * copies of the Software, and to permit persons to whom the Software is | |
| 33 | + * furnished to do so, subject to the following conditions: | |
| 34 | + * | |
| 35 | + * The above copyright notice and this permission notice shall be included in all | |
| 36 | + * copies or substantial portions of the Software. | |
| 37 | + * | |
| 38 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 39 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 40 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 41 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 42 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 43 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
| 44 | + * SOFTWARE. | |
| 45 | + */ | |
| 46 | +(function (global, factory) { | |
| 47 | + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | |
| 48 | + typeof define === 'function' && define.amd ? define(factory) : | |
| 49 | + (global.Popper = factory()); | |
| 50 | +}(this, (function () { 'use strict'; | |
| 51 | + | |
| 52 | +var nativeHints = ['native code', '[object MutationObserverConstructor]']; | |
| 53 | + | |
| 54 | +/** | |
| 55 | + * Determine if a function is implemented natively (as opposed to a polyfill). | |
| 56 | + * @method | |
| 57 | + * @memberof Popper.Utils | |
| 58 | + * @argument {Function | undefined} fn the function to check | |
| 59 | + * @returns {Boolean} | |
| 60 | + */ | |
| 61 | +var isNative = (function (fn) { | |
| 62 | + return nativeHints.some(function (hint) { | |
| 63 | + return (fn || '').toString().indexOf(hint) > -1; | |
| 64 | + }); | |
| 65 | +}); | |
| 66 | + | |
| 67 | +var isBrowser = typeof window !== 'undefined'; | |
| 68 | +var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; | |
| 69 | +var timeoutDuration = 0; | |
| 70 | +for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { | |
| 71 | + if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { | |
| 72 | + timeoutDuration = 1; | |
| 73 | + break; | |
| 74 | + } | |
| 75 | +} | |
| 76 | + | |
| 77 | +function microtaskDebounce(fn) { | |
| 78 | + var scheduled = false; | |
| 79 | + var i = 0; | |
| 80 | + var elem = document.createElement('span'); | |
| 81 | + | |
| 82 | + // MutationObserver provides a mechanism for scheduling microtasks, which | |
| 83 | + // are scheduled *before* the next task. This gives us a way to debounce | |
| 84 | + // a function but ensure it's called *before* the next paint. | |
| 85 | + var observer = new MutationObserver(function () { | |
| 86 | + fn(); | |
| 87 | + scheduled = false; | |
| 88 | + }); | |
| 89 | + | |
| 90 | + observer.observe(elem, { attributes: true }); | |
| 91 | + | |
| 92 | + return function () { | |
| 93 | + if (!scheduled) { | |
| 94 | + scheduled = true; | |
| 95 | + elem.setAttribute('x-index', i); | |
| 96 | + i = i + 1; // don't use compund (+=) because it doesn't get optimized in V8 | |
| 97 | + } | |
| 98 | + }; | |
| 99 | +} | |
| 100 | + | |
| 101 | +function taskDebounce(fn) { | |
| 102 | + var scheduled = false; | |
| 103 | + return function () { | |
| 104 | + if (!scheduled) { | |
| 105 | + scheduled = true; | |
| 106 | + setTimeout(function () { | |
| 107 | + scheduled = false; | |
| 108 | + fn(); | |
| 109 | + }, timeoutDuration); | |
| 110 | + } | |
| 111 | + }; | |
| 112 | +} | |
| 113 | + | |
| 114 | +// It's common for MutationObserver polyfills to be seen in the wild, however | |
| 115 | +// these rely on Mutation Events which only occur when an element is connected | |
| 116 | +// to the DOM. The algorithm used in this module does not use a connected element, | |
| 117 | +// and so we must ensure that a *native* MutationObserver is available. | |
| 118 | +var supportsNativeMutationObserver = isBrowser && isNative(window.MutationObserver); | |
| 119 | + | |
| 120 | +/** | |
| 121 | +* Create a debounced version of a method, that's asynchronously deferred | |
| 122 | +* but called in the minimum time possible. | |
| 123 | +* | |
| 124 | +* @method | |
| 125 | +* @memberof Popper.Utils | |
| 126 | +* @argument {Function} fn | |
| 127 | +* @returns {Function} | |
| 128 | +*/ | |
| 129 | +var debounce = supportsNativeMutationObserver ? microtaskDebounce : taskDebounce; | |
| 130 | + | |
| 131 | +/** | |
| 132 | + * Check if the given variable is a function | |
| 133 | + * @method | |
| 134 | + * @memberof Popper.Utils | |
| 135 | + * @argument {Any} functionToCheck - variable to check | |
| 136 | + * @returns {Boolean} answer to: is a function? | |
| 137 | + */ | |
| 138 | +function isFunction(functionToCheck) { | |
| 139 | + var getType = {}; | |
| 140 | + return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; | |
| 141 | +} | |
| 142 | + | |
| 143 | +/** | |
| 144 | + * Get CSS computed property of the given element | |
| 145 | + * @method | |
| 146 | + * @memberof Popper.Utils | |
| 147 | + * @argument {Eement} element | |
| 148 | + * @argument {String} property | |
| 149 | + */ | |
| 150 | +function getStyleComputedProperty(element, property) { | |
| 151 | + if (element.nodeType !== 1) { | |
| 152 | + return []; | |
| 153 | + } | |
| 154 | + // NOTE: 1 DOM access here | |
| 155 | + var css = window.getComputedStyle(element, null); | |
| 156 | + return property ? css[property] : css; | |
| 157 | +} | |
| 158 | + | |
| 159 | +/** | |
| 160 | + * Returns the parentNode or the host of the element | |
| 161 | + * @method | |
| 162 | + * @memberof Popper.Utils | |
| 163 | + * @argument {Element} element | |
| 164 | + * @returns {Element} parent | |
| 165 | + */ | |
| 166 | +function getParentNode(element) { | |
| 167 | + if (element.nodeName === 'HTML') { | |
| 168 | + return element; | |
| 169 | + } | |
| 170 | + return element.parentNode || element.host; | |
| 171 | +} | |
| 172 | + | |
| 173 | +/** | |
| 174 | + * Returns the scrolling parent of the given element | |
| 175 | + * @method | |
| 176 | + * @memberof Popper.Utils | |
| 177 | + * @argument {Element} element | |
| 178 | + * @returns {Element} scroll parent | |
| 179 | + */ | |
| 180 | +function getScrollParent(element) { | |
| 181 | + // Return body, `getScroll` will take care to get the correct `scrollTop` from it | |
| 182 | + if (!element || ['HTML', 'BODY', '#document'].indexOf(element.nodeName) !== -1) { | |
| 183 | + return window.document.body; | |
| 184 | + } | |
| 185 | + | |
| 186 | + // Firefox want us to check `-x` and `-y` variations as well | |
| 187 | + | |
| 188 | + var _getStyleComputedProp = getStyleComputedProperty(element), | |
| 189 | + overflow = _getStyleComputedProp.overflow, | |
| 190 | + overflowX = _getStyleComputedProp.overflowX, | |
| 191 | + overflowY = _getStyleComputedProp.overflowY; | |
| 192 | + | |
| 193 | + if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) { | |
| 194 | + return element; | |
| 195 | + } | |
| 196 | + | |
| 197 | + return getScrollParent(getParentNode(element)); | |
| 198 | +} | |
| 199 | + | |
| 200 | +/** | |
| 201 | + * Returns the offset parent of the given element | |
| 202 | + * @method | |
| 203 | + * @memberof Popper.Utils | |
| 204 | + * @argument {Element} element | |
| 205 | + * @returns {Element} offset parent | |
| 206 | + */ | |
| 207 | +function getOffsetParent(element) { | |
| 208 | + // NOTE: 1 DOM access here | |
| 209 | + var offsetParent = element && element.offsetParent; | |
| 210 | + var nodeName = offsetParent && offsetParent.nodeName; | |
| 211 | + | |
| 212 | + if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { | |
| 213 | + return window.document.documentElement; | |
| 214 | + } | |
| 215 | + | |
| 216 | + // .offsetParent will return the closest TD or TABLE in case | |
| 217 | + // no offsetParent is present, I hate this job... | |
| 218 | + if (['TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { | |
| 219 | + return getOffsetParent(offsetParent); | |
| 220 | + } | |
| 221 | + | |
| 222 | + return offsetParent; | |
| 223 | +} | |
| 224 | + | |
| 225 | +function isOffsetContainer(element) { | |
| 226 | + var nodeName = element.nodeName; | |
| 227 | + | |
| 228 | + if (nodeName === 'BODY') { | |
| 229 | + return false; | |
| 230 | + } | |
| 231 | + return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; | |
| 232 | +} | |
| 233 | + | |
| 234 | +/** | |
| 235 | + * Finds the root node (document, shadowDOM root) of the given element | |
| 236 | + * @method | |
| 237 | + * @memberof Popper.Utils | |
| 238 | + * @argument {Element} node | |
| 239 | + * @returns {Element} root node | |
| 240 | + */ | |
| 241 | +function getRoot(node) { | |
| 242 | + if (node.parentNode !== null) { | |
| 243 | + return getRoot(node.parentNode); | |
| 244 | + } | |
| 245 | + | |
| 246 | + return node; | |
| 247 | +} | |
| 248 | + | |
| 249 | +/** | |
| 250 | + * Finds the offset parent common to the two provided nodes | |
| 251 | + * @method | |
| 252 | + * @memberof Popper.Utils | |
| 253 | + * @argument {Element} element1 | |
| 254 | + * @argument {Element} element2 | |
| 255 | + * @returns {Element} common offset parent | |
| 256 | + */ | |
| 257 | +function findCommonOffsetParent(element1, element2) { | |
| 258 | + // This check is needed to avoid errors in case one of the elements isn't defined for any reason | |
| 259 | + if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { | |
| 260 | + return window.document.documentElement; | |
| 261 | + } | |
| 262 | + | |
| 263 | + // Here we make sure to give as "start" the element that comes first in the DOM | |
| 264 | + var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; | |
| 265 | + var start = order ? element1 : element2; | |
| 266 | + var end = order ? element2 : element1; | |
| 267 | + | |
| 268 | + // Get common ancestor container | |
| 269 | + var range = document.createRange(); | |
| 270 | + range.setStart(start, 0); | |
| 271 | + range.setEnd(end, 0); | |
| 272 | + var commonAncestorContainer = range.commonAncestorContainer; | |
| 273 | + | |
| 274 | + // Both nodes are inside #document | |
| 275 | + | |
| 276 | + if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { | |
| 277 | + if (isOffsetContainer(commonAncestorContainer)) { | |
| 278 | + return commonAncestorContainer; | |
| 279 | + } | |
| 280 | + | |
| 281 | + return getOffsetParent(commonAncestorContainer); | |
| 282 | + } | |
| 283 | + | |
| 284 | + // one of the nodes is inside shadowDOM, find which one | |
| 285 | + var element1root = getRoot(element1); | |
| 286 | + if (element1root.host) { | |
| 287 | + return findCommonOffsetParent(element1root.host, element2); | |
| 288 | + } else { | |
| 289 | + return findCommonOffsetParent(element1, getRoot(element2).host); | |
| 290 | + } | |
| 291 | +} | |
| 292 | + | |
| 293 | +/** | |
| 294 | + * Gets the scroll value of the given element in the given side (top and left) | |
| 295 | + * @method | |
| 296 | + * @memberof Popper.Utils | |
| 297 | + * @argument {Element} element | |
| 298 | + * @argument {String} side `top` or `left` | |
| 299 | + * @returns {number} amount of scrolled pixels | |
| 300 | + */ | |
| 301 | +function getScroll(element) { | |
| 302 | + var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; | |
| 303 | + | |
| 304 | + var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; | |
| 305 | + var nodeName = element.nodeName; | |
| 306 | + | |
| 307 | + if (nodeName === 'BODY' || nodeName === 'HTML') { | |
| 308 | + var html = window.document.documentElement; | |
| 309 | + var scrollingElement = window.document.scrollingElement || html; | |
| 310 | + return scrollingElement[upperSide]; | |
| 311 | + } | |
| 312 | + | |
| 313 | + return element[upperSide]; | |
| 314 | +} | |
| 315 | + | |
| 316 | +/* | |
| 317 | + * Sum or subtract the element scroll values (left and top) from a given rect object | |
| 318 | + * @method | |
| 319 | + * @memberof Popper.Utils | |
| 320 | + * @param {Object} rect - Rect object you want to change | |
| 321 | + * @param {HTMLElement} element - The element from the function reads the scroll values | |
| 322 | + * @param {Boolean} subtract - set to true if you want to subtract the scroll values | |
| 323 | + * @return {Object} rect - The modifier rect object | |
| 324 | + */ | |
| 325 | +function includeScroll(rect, element) { | |
| 326 | + var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | |
| 327 | + | |
| 328 | + var scrollTop = getScroll(element, 'top'); | |
| 329 | + var scrollLeft = getScroll(element, 'left'); | |
| 330 | + var modifier = subtract ? -1 : 1; | |
| 331 | + rect.top += scrollTop * modifier; | |
| 332 | + rect.bottom += scrollTop * modifier; | |
| 333 | + rect.left += scrollLeft * modifier; | |
| 334 | + rect.right += scrollLeft * modifier; | |
| 335 | + return rect; | |
| 336 | +} | |
| 337 | + | |
| 338 | +/* | |
| 339 | + * Helper to detect borders of a given element | |
| 340 | + * @method | |
| 341 | + * @memberof Popper.Utils | |
| 342 | + * @param {CSSStyleDeclaration} styles | |
| 343 | + * Result of `getStyleComputedProperty` on the given element | |
| 344 | + * @param {String} axis - `x` or `y` | |
| 345 | + * @return {number} borders - The borders size of the given axis | |
| 346 | + */ | |
| 347 | + | |
| 348 | +function getBordersSize(styles, axis) { | |
| 349 | + var sideA = axis === 'x' ? 'Left' : 'Top'; | |
| 350 | + var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; | |
| 351 | + | |
| 352 | + return +styles['border' + sideA + 'Width'].split('px')[0] + +styles['border' + sideB + 'Width'].split('px')[0]; | |
| 353 | +} | |
| 354 | + | |
| 355 | +/** | |
| 356 | + * Tells if you are running Internet Explorer 10 | |
| 357 | + * @method | |
| 358 | + * @memberof Popper.Utils | |
| 359 | + * @returns {Boolean} isIE10 | |
| 360 | + */ | |
| 361 | +var isIE10 = undefined; | |
| 362 | + | |
| 363 | +var isIE10$1 = function () { | |
| 364 | + if (isIE10 === undefined) { | |
| 365 | + isIE10 = navigator.appVersion.indexOf('MSIE 10') !== -1; | |
| 366 | + } | |
| 367 | + return isIE10; | |
| 368 | +}; | |
| 369 | + | |
| 370 | +function getSize(axis, body, html, computedStyle) { | |
| 371 | + return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE10$1() ? html['offset' + axis] + computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')] + computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')] : 0); | |
| 372 | +} | |
| 373 | + | |
| 374 | +function getWindowSizes() { | |
| 375 | + var body = window.document.body; | |
| 376 | + var html = window.document.documentElement; | |
| 377 | + var computedStyle = isIE10$1() && window.getComputedStyle(html); | |
| 378 | + | |
| 379 | + return { | |
| 380 | + height: getSize('Height', body, html, computedStyle), | |
| 381 | + width: getSize('Width', body, html, computedStyle) | |
| 382 | + }; | |
| 383 | +} | |
| 384 | + | |
| 385 | +var classCallCheck = function (instance, Constructor) { | |
| 386 | + if (!(instance instanceof Constructor)) { | |
| 387 | + throw new TypeError("Cannot call a class as a function"); | |
| 388 | + } | |
| 389 | +}; | |
| 390 | + | |
| 391 | +var createClass = function () { | |
| 392 | + function defineProperties(target, props) { | |
| 393 | + for (var i = 0; i < props.length; i++) { | |
| 394 | + var descriptor = props[i]; | |
| 395 | + descriptor.enumerable = descriptor.enumerable || false; | |
| 396 | + descriptor.configurable = true; | |
| 397 | + if ("value" in descriptor) descriptor.writable = true; | |
| 398 | + Object.defineProperty(target, descriptor.key, descriptor); | |
| 399 | + } | |
| 400 | + } | |
| 401 | + | |
| 402 | + return function (Constructor, protoProps, staticProps) { | |
| 403 | + if (protoProps) defineProperties(Constructor.prototype, protoProps); | |
| 404 | + if (staticProps) defineProperties(Constructor, staticProps); | |
| 405 | + return Constructor; | |
| 406 | + }; | |
| 407 | +}(); | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | +var defineProperty = function (obj, key, value) { | |
| 414 | + if (key in obj) { | |
| 415 | + Object.defineProperty(obj, key, { | |
| 416 | + value: value, | |
| 417 | + enumerable: true, | |
| 418 | + configurable: true, | |
| 419 | + writable: true | |
| 420 | + }); | |
| 421 | + } else { | |
| 422 | + obj[key] = value; | |
| 423 | + } | |
| 424 | + | |
| 425 | + return obj; | |
| 426 | +}; | |
| 427 | + | |
| 428 | +var _extends = Object.assign || function (target) { | |
| 429 | + for (var i = 1; i < arguments.length; i++) { | |
| 430 | + var source = arguments[i]; | |
| 431 | + | |
| 432 | + for (var key in source) { | |
| 433 | + if (Object.prototype.hasOwnProperty.call(source, key)) { | |
| 434 | + target[key] = source[key]; | |
| 435 | + } | |
| 436 | + } | |
| 437 | + } | |
| 438 | + | |
| 439 | + return target; | |
| 440 | +}; | |
| 441 | + | |
| 442 | +/** | |
| 443 | + * Given element offsets, generate an output similar to getBoundingClientRect | |
| 444 | + * @method | |
| 445 | + * @memberof Popper.Utils | |
| 446 | + * @argument {Object} offsets | |
| 447 | + * @returns {Object} ClientRect like output | |
| 448 | + */ | |
| 449 | +function getClientRect(offsets) { | |
| 450 | + return _extends({}, offsets, { | |
| 451 | + right: offsets.left + offsets.width, | |
| 452 | + bottom: offsets.top + offsets.height | |
| 453 | + }); | |
| 454 | +} | |
| 455 | + | |
| 456 | +/** | |
| 457 | + * Get bounding client rect of given element | |
| 458 | + * @method | |
| 459 | + * @memberof Popper.Utils | |
| 460 | + * @param {HTMLElement} element | |
| 461 | + * @return {Object} client rect | |
| 462 | + */ | |
| 463 | +function getBoundingClientRect(element) { | |
| 464 | + var rect = {}; | |
| 465 | + | |
| 466 | + // IE10 10 FIX: Please, don't ask, the element isn't | |
| 467 | + // considered in DOM in some circumstances... | |
| 468 | + // This isn't reproducible in IE10 compatibility mode of IE11 | |
| 469 | + if (isIE10$1()) { | |
| 470 | + try { | |
| 471 | + rect = element.getBoundingClientRect(); | |
| 472 | + var scrollTop = getScroll(element, 'top'); | |
| 473 | + var scrollLeft = getScroll(element, 'left'); | |
| 474 | + rect.top += scrollTop; | |
| 475 | + rect.left += scrollLeft; | |
| 476 | + rect.bottom += scrollTop; | |
| 477 | + rect.right += scrollLeft; | |
| 478 | + } catch (err) {} | |
| 479 | + } else { | |
| 480 | + rect = element.getBoundingClientRect(); | |
| 481 | + } | |
| 482 | + | |
| 483 | + var result = { | |
| 484 | + left: rect.left, | |
| 485 | + top: rect.top, | |
| 486 | + width: rect.right - rect.left, | |
| 487 | + height: rect.bottom - rect.top | |
| 488 | + }; | |
| 489 | + | |
| 490 | + // subtract scrollbar size from sizes | |
| 491 | + var sizes = element.nodeName === 'HTML' ? getWindowSizes() : {}; | |
| 492 | + var width = sizes.width || element.clientWidth || result.right - result.left; | |
| 493 | + var height = sizes.height || element.clientHeight || result.bottom - result.top; | |
| 494 | + | |
| 495 | + var horizScrollbar = element.offsetWidth - width; | |
| 496 | + var vertScrollbar = element.offsetHeight - height; | |
| 497 | + | |
| 498 | + // if an hypothetical scrollbar is detected, we must be sure it's not a `border` | |
| 499 | + // we make this check conditional for performance reasons | |
| 500 | + if (horizScrollbar || vertScrollbar) { | |
| 501 | + var styles = getStyleComputedProperty(element); | |
| 502 | + horizScrollbar -= getBordersSize(styles, 'x'); | |
| 503 | + vertScrollbar -= getBordersSize(styles, 'y'); | |
| 504 | + | |
| 505 | + result.width -= horizScrollbar; | |
| 506 | + result.height -= vertScrollbar; | |
| 507 | + } | |
| 508 | + | |
| 509 | + return getClientRect(result); | |
| 510 | +} | |
| 511 | + | |
| 512 | +function getOffsetRectRelativeToArbitraryNode(children, parent) { | |
| 513 | + var isIE10 = isIE10$1(); | |
| 514 | + var isHTML = parent.nodeName === 'HTML'; | |
| 515 | + var childrenRect = getBoundingClientRect(children); | |
| 516 | + var parentRect = getBoundingClientRect(parent); | |
| 517 | + var scrollParent = getScrollParent(children); | |
| 518 | + | |
| 519 | + var styles = getStyleComputedProperty(parent); | |
| 520 | + var borderTopWidth = +styles.borderTopWidth.split('px')[0]; | |
| 521 | + var borderLeftWidth = +styles.borderLeftWidth.split('px')[0]; | |
| 522 | + | |
| 523 | + var offsets = getClientRect({ | |
| 524 | + top: childrenRect.top - parentRect.top - borderTopWidth, | |
| 525 | + left: childrenRect.left - parentRect.left - borderLeftWidth, | |
| 526 | + width: childrenRect.width, | |
| 527 | + height: childrenRect.height | |
| 528 | + }); | |
| 529 | + offsets.marginTop = 0; | |
| 530 | + offsets.marginLeft = 0; | |
| 531 | + | |
| 532 | + // Subtract margins of documentElement in case it's being used as parent | |
| 533 | + // we do this only on HTML because it's the only element that behaves | |
| 534 | + // differently when margins are applied to it. The margins are included in | |
| 535 | + // the box of the documentElement, in the other cases not. | |
| 536 | + if (!isIE10 && isHTML) { | |
| 537 | + var marginTop = +styles.marginTop.split('px')[0]; | |
| 538 | + var marginLeft = +styles.marginLeft.split('px')[0]; | |
| 539 | + | |
| 540 | + offsets.top -= borderTopWidth - marginTop; | |
| 541 | + offsets.bottom -= borderTopWidth - marginTop; | |
| 542 | + offsets.left -= borderLeftWidth - marginLeft; | |
| 543 | + offsets.right -= borderLeftWidth - marginLeft; | |
| 544 | + | |
| 545 | + // Attach marginTop and marginLeft because in some circumstances we may need them | |
| 546 | + offsets.marginTop = marginTop; | |
| 547 | + offsets.marginLeft = marginLeft; | |
| 548 | + } | |
| 549 | + | |
| 550 | + if (isIE10 ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { | |
| 551 | + offsets = includeScroll(offsets, parent); | |
| 552 | + } | |
| 553 | + | |
| 554 | + return offsets; | |
| 555 | +} | |
| 556 | + | |
| 557 | +function getViewportOffsetRectRelativeToArtbitraryNode(element) { | |
| 558 | + var html = window.document.documentElement; | |
| 559 | + var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); | |
| 560 | + var width = Math.max(html.clientWidth, window.innerWidth || 0); | |
| 561 | + var height = Math.max(html.clientHeight, window.innerHeight || 0); | |
| 562 | + | |
| 563 | + var scrollTop = getScroll(html); | |
| 564 | + var scrollLeft = getScroll(html, 'left'); | |
| 565 | + | |
| 566 | + var offset = { | |
| 567 | + top: scrollTop - relativeOffset.top + relativeOffset.marginTop, | |
| 568 | + left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, | |
| 569 | + width: width, | |
| 570 | + height: height | |
| 571 | + }; | |
| 572 | + | |
| 573 | + return getClientRect(offset); | |
| 574 | +} | |
| 575 | + | |
| 576 | +/** | |
| 577 | + * Check if the given element is fixed or is inside a fixed parent | |
| 578 | + * @method | |
| 579 | + * @memberof Popper.Utils | |
| 580 | + * @argument {Element} element | |
| 581 | + * @argument {Element} customContainer | |
| 582 | + * @returns {Boolean} answer to "isFixed?" | |
| 583 | + */ | |
| 584 | +function isFixed(element) { | |
| 585 | + var nodeName = element.nodeName; | |
| 586 | + if (nodeName === 'BODY' || nodeName === 'HTML') { | |
| 587 | + return false; | |
| 588 | + } | |
| 589 | + if (getStyleComputedProperty(element, 'position') === 'fixed') { | |
| 590 | + return true; | |
| 591 | + } | |
| 592 | + return isFixed(getParentNode(element)); | |
| 593 | +} | |
| 594 | + | |
| 595 | +/** | |
| 596 | + * Computed the boundaries limits and return them | |
| 597 | + * @method | |
| 598 | + * @memberof Popper.Utils | |
| 599 | + * @param {HTMLElement} popper | |
| 600 | + * @param {HTMLElement} reference | |
| 601 | + * @param {number} padding | |
| 602 | + * @param {HTMLElement} boundariesElement - Element used to define the boundaries | |
| 603 | + * @returns {Object} Coordinates of the boundaries | |
| 604 | + */ | |
| 605 | +function getBoundaries(popper, reference, padding, boundariesElement) { | |
| 606 | + // NOTE: 1 DOM access here | |
| 607 | + var boundaries = { top: 0, left: 0 }; | |
| 608 | + var offsetParent = findCommonOffsetParent(popper, reference); | |
| 609 | + | |
| 610 | + // Handle viewport case | |
| 611 | + if (boundariesElement === 'viewport') { | |
| 612 | + boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent); | |
| 613 | + } else { | |
| 614 | + // Handle other cases based on DOM element used as boundaries | |
| 615 | + var boundariesNode = void 0; | |
| 616 | + if (boundariesElement === 'scrollParent') { | |
| 617 | + boundariesNode = getScrollParent(getParentNode(popper)); | |
| 618 | + if (boundariesNode.nodeName === 'BODY') { | |
| 619 | + boundariesNode = window.document.documentElement; | |
| 620 | + } | |
| 621 | + } else if (boundariesElement === 'window') { | |
| 622 | + boundariesNode = window.document.documentElement; | |
| 623 | + } else { | |
| 624 | + boundariesNode = boundariesElement; | |
| 625 | + } | |
| 626 | + | |
| 627 | + var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent); | |
| 628 | + | |
| 629 | + // In case of HTML, we need a different computation | |
| 630 | + if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { | |
| 631 | + var _getWindowSizes = getWindowSizes(), | |
| 632 | + height = _getWindowSizes.height, | |
| 633 | + width = _getWindowSizes.width; | |
| 634 | + | |
| 635 | + boundaries.top += offsets.top - offsets.marginTop; | |
| 636 | + boundaries.bottom = height + offsets.top; | |
| 637 | + boundaries.left += offsets.left - offsets.marginLeft; | |
| 638 | + boundaries.right = width + offsets.left; | |
| 639 | + } else { | |
| 640 | + // for all the other DOM elements, this one is good | |
| 641 | + boundaries = offsets; | |
| 642 | + } | |
| 643 | + } | |
| 644 | + | |
| 645 | + // Add paddings | |
| 646 | + boundaries.left += padding; | |
| 647 | + boundaries.top += padding; | |
| 648 | + boundaries.right -= padding; | |
| 649 | + boundaries.bottom -= padding; | |
| 650 | + | |
| 651 | + return boundaries; | |
| 652 | +} | |
| 653 | + | |
| 654 | +function getArea(_ref) { | |
| 655 | + var width = _ref.width, | |
| 656 | + height = _ref.height; | |
| 657 | + | |
| 658 | + return width * height; | |
| 659 | +} | |
| 660 | + | |
| 661 | +/** | |
| 662 | + * Utility used to transform the `auto` placement to the placement with more | |
| 663 | + * available space. | |
| 664 | + * @method | |
| 665 | + * @memberof Popper.Utils | |
| 666 | + * @argument {Object} data - The data object generated by update method | |
| 667 | + * @argument {Object} options - Modifiers configuration and options | |
| 668 | + * @returns {Object} The data object, properly modified | |
| 669 | + */ | |
| 670 | +function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { | |
| 671 | + var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; | |
| 672 | + | |
| 673 | + if (placement.indexOf('auto') === -1) { | |
| 674 | + return placement; | |
| 675 | + } | |
| 676 | + | |
| 677 | + var boundaries = getBoundaries(popper, reference, padding, boundariesElement); | |
| 678 | + | |
| 679 | + var rects = { | |
| 680 | + top: { | |
| 681 | + width: boundaries.width, | |
| 682 | + height: refRect.top - boundaries.top | |
| 683 | + }, | |
| 684 | + right: { | |
| 685 | + width: boundaries.right - refRect.right, | |
| 686 | + height: boundaries.height | |
| 687 | + }, | |
| 688 | + bottom: { | |
| 689 | + width: boundaries.width, | |
| 690 | + height: boundaries.bottom - refRect.bottom | |
| 691 | + }, | |
| 692 | + left: { | |
| 693 | + width: refRect.left - boundaries.left, | |
| 694 | + height: boundaries.height | |
| 695 | + } | |
| 696 | + }; | |
| 697 | + | |
| 698 | + var sortedAreas = Object.keys(rects).map(function (key) { | |
| 699 | + return _extends({ | |
| 700 | + key: key | |
| 701 | + }, rects[key], { | |
| 702 | + area: getArea(rects[key]) | |
| 703 | + }); | |
| 704 | + }).sort(function (a, b) { | |
| 705 | + return b.area - a.area; | |
| 706 | + }); | |
| 707 | + | |
| 708 | + var filteredAreas = sortedAreas.filter(function (_ref2) { | |
| 709 | + var width = _ref2.width, | |
| 710 | + height = _ref2.height; | |
| 711 | + return width >= popper.clientWidth && height >= popper.clientHeight; | |
| 712 | + }); | |
| 713 | + | |
| 714 | + var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; | |
| 715 | + | |
| 716 | + var variation = placement.split('-')[1]; | |
| 717 | + | |
| 718 | + return computedPlacement + (variation ? '-' + variation : ''); | |
| 719 | +} | |
| 720 | + | |
| 721 | +/** | |
| 722 | + * Get offsets to the reference element | |
| 723 | + * @method | |
| 724 | + * @memberof Popper.Utils | |
| 725 | + * @param {Object} state | |
| 726 | + * @param {Element} popper - the popper element | |
| 727 | + * @param {Element} reference - the reference element (the popper will be relative to this) | |
| 728 | + * @returns {Object} An object containing the offsets which will be applied to the popper | |
| 729 | + */ | |
| 730 | +function getReferenceOffsets(state, popper, reference) { | |
| 731 | + var commonOffsetParent = findCommonOffsetParent(popper, reference); | |
| 732 | + return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent); | |
| 733 | +} | |
| 734 | + | |
| 735 | +/** | |
| 736 | + * Get the outer sizes of the given element (offset size + margins) | |
| 737 | + * @method | |
| 738 | + * @memberof Popper.Utils | |
| 739 | + * @argument {Element} element | |
| 740 | + * @returns {Object} object containing width and height properties | |
| 741 | + */ | |
| 742 | +function getOuterSizes(element) { | |
| 743 | + var styles = window.getComputedStyle(element); | |
| 744 | + var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom); | |
| 745 | + var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight); | |
| 746 | + var result = { | |
| 747 | + width: element.offsetWidth + y, | |
| 748 | + height: element.offsetHeight + x | |
| 749 | + }; | |
| 750 | + return result; | |
| 751 | +} | |
| 752 | + | |
| 753 | +/** | |
| 754 | + * Get the opposite placement of the given one | |
| 755 | + * @method | |
| 756 | + * @memberof Popper.Utils | |
| 757 | + * @argument {String} placement | |
| 758 | + * @returns {String} flipped placement | |
| 759 | + */ | |
| 760 | +function getOppositePlacement(placement) { | |
| 761 | + var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; | |
| 762 | + return placement.replace(/left|right|bottom|top/g, function (matched) { | |
| 763 | + return hash[matched]; | |
| 764 | + }); | |
| 765 | +} | |
| 766 | + | |
| 767 | +/** | |
| 768 | + * Get offsets to the popper | |
| 769 | + * @method | |
| 770 | + * @memberof Popper.Utils | |
| 771 | + * @param {Object} position - CSS position the Popper will get applied | |
| 772 | + * @param {HTMLElement} popper - the popper element | |
| 773 | + * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) | |
| 774 | + * @param {String} placement - one of the valid placement options | |
| 775 | + * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper | |
| 776 | + */ | |
| 777 | +function getPopperOffsets(popper, referenceOffsets, placement) { | |
| 778 | + placement = placement.split('-')[0]; | |
| 779 | + | |
| 780 | + // Get popper node sizes | |
| 781 | + var popperRect = getOuterSizes(popper); | |
| 782 | + | |
| 783 | + // Add position, width and height to our offsets object | |
| 784 | + var popperOffsets = { | |
| 785 | + width: popperRect.width, | |
| 786 | + height: popperRect.height | |
| 787 | + }; | |
| 788 | + | |
| 789 | + // depending by the popper placement we have to compute its offsets slightly differently | |
| 790 | + var isHoriz = ['right', 'left'].indexOf(placement) !== -1; | |
| 791 | + var mainSide = isHoriz ? 'top' : 'left'; | |
| 792 | + var secondarySide = isHoriz ? 'left' : 'top'; | |
| 793 | + var measurement = isHoriz ? 'height' : 'width'; | |
| 794 | + var secondaryMeasurement = !isHoriz ? 'height' : 'width'; | |
| 795 | + | |
| 796 | + popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; | |
| 797 | + if (placement === secondarySide) { | |
| 798 | + popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; | |
| 799 | + } else { | |
| 800 | + popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; | |
| 801 | + } | |
| 802 | + | |
| 803 | + return popperOffsets; | |
| 804 | +} | |
| 805 | + | |
| 806 | +/** | |
| 807 | + * Mimics the `find` method of Array | |
| 808 | + * @method | |
| 809 | + * @memberof Popper.Utils | |
| 810 | + * @argument {Array} arr | |
| 811 | + * @argument prop | |
| 812 | + * @argument value | |
| 813 | + * @returns index or -1 | |
| 814 | + */ | |
| 815 | +function find(arr, check) { | |
| 816 | + // use native find if supported | |
| 817 | + if (Array.prototype.find) { | |
| 818 | + return arr.find(check); | |
| 819 | + } | |
| 820 | + | |
| 821 | + // use `filter` to obtain the same behavior of `find` | |
| 822 | + return arr.filter(check)[0]; | |
| 823 | +} | |
| 824 | + | |
| 825 | +/** | |
| 826 | + * Return the index of the matching object | |
| 827 | + * @method | |
| 828 | + * @memberof Popper.Utils | |
| 829 | + * @argument {Array} arr | |
| 830 | + * @argument prop | |
| 831 | + * @argument value | |
| 832 | + * @returns index or -1 | |
| 833 | + */ | |
| 834 | +function findIndex(arr, prop, value) { | |
| 835 | + // use native findIndex if supported | |
| 836 | + if (Array.prototype.findIndex) { | |
| 837 | + return arr.findIndex(function (cur) { | |
| 838 | + return cur[prop] === value; | |
| 839 | + }); | |
| 840 | + } | |
| 841 | + | |
| 842 | + // use `find` + `indexOf` if `findIndex` isn't supported | |
| 843 | + var match = find(arr, function (obj) { | |
| 844 | + return obj[prop] === value; | |
| 845 | + }); | |
| 846 | + return arr.indexOf(match); | |
| 847 | +} | |
| 848 | + | |
| 849 | +/** | |
| 850 | + * Loop trough the list of modifiers and run them in order, | |
| 851 | + * each of them will then edit the data object. | |
| 852 | + * @method | |
| 853 | + * @memberof Popper.Utils | |
| 854 | + * @param {dataObject} data | |
| 855 | + * @param {Array} modifiers | |
| 856 | + * @param {String} ends - Optional modifier name used as stopper | |
| 857 | + * @returns {dataObject} | |
| 858 | + */ | |
| 859 | +function runModifiers(modifiers, data, ends) { | |
| 860 | + var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); | |
| 861 | + | |
| 862 | + modifiersToRun.forEach(function (modifier) { | |
| 863 | + if (modifier.function) { | |
| 864 | + console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); | |
| 865 | + } | |
| 866 | + var fn = modifier.function || modifier.fn; | |
| 867 | + if (modifier.enabled && isFunction(fn)) { | |
| 868 | + // Add properties to offsets to make them a complete clientRect object | |
| 869 | + // we do this before each modifier to make sure the previous one doesn't | |
| 870 | + // mess with these values | |
| 871 | + data.offsets.popper = getClientRect(data.offsets.popper); | |
| 872 | + data.offsets.reference = getClientRect(data.offsets.reference); | |
| 873 | + | |
| 874 | + data = fn(data, modifier); | |
| 875 | + } | |
| 876 | + }); | |
| 877 | + | |
| 878 | + return data; | |
| 879 | +} | |
| 880 | + | |
| 881 | +/** | |
| 882 | + * Updates the position of the popper, computing the new offsets and applying | |
| 883 | + * the new style.<br /> | |
| 884 | + * Prefer `scheduleUpdate` over `update` because of performance reasons. | |
| 885 | + * @method | |
| 886 | + * @memberof Popper | |
| 887 | + */ | |
| 888 | +function update() { | |
| 889 | + // if popper is destroyed, don't perform any further update | |
| 890 | + if (this.state.isDestroyed) { | |
| 891 | + return; | |
| 892 | + } | |
| 893 | + | |
| 894 | + var data = { | |
| 895 | + instance: this, | |
| 896 | + styles: {}, | |
| 897 | + arrowStyles: {}, | |
| 898 | + attributes: {}, | |
| 899 | + flipped: false, | |
| 900 | + offsets: {} | |
| 901 | + }; | |
| 902 | + | |
| 903 | + // compute reference element offsets | |
| 904 | + data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference); | |
| 905 | + | |
| 906 | + // compute auto placement, store placement inside the data object, | |
| 907 | + // modifiers will be able to edit `placement` if needed | |
| 908 | + // and refer to originalPlacement to know the original value | |
| 909 | + data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); | |
| 910 | + | |
| 911 | + // store the computed placement inside `originalPlacement` | |
| 912 | + data.originalPlacement = data.placement; | |
| 913 | + | |
| 914 | + // compute the popper offsets | |
| 915 | + data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); | |
| 916 | + data.offsets.popper.position = 'absolute'; | |
| 917 | + | |
| 918 | + // run the modifiers | |
| 919 | + data = runModifiers(this.modifiers, data); | |
| 920 | + | |
| 921 | + // the first `update` will call `onCreate` callback | |
| 922 | + // the other ones will call `onUpdate` callback | |
| 923 | + if (!this.state.isCreated) { | |
| 924 | + this.state.isCreated = true; | |
| 925 | + this.options.onCreate(data); | |
| 926 | + } else { | |
| 927 | + this.options.onUpdate(data); | |
| 928 | + } | |
| 929 | +} | |
| 930 | + | |
| 931 | +/** | |
| 932 | + * Helper used to know if the given modifier is enabled. | |
| 933 | + * @method | |
| 934 | + * @memberof Popper.Utils | |
| 935 | + * @returns {Boolean} | |
| 936 | + */ | |
| 937 | +function isModifierEnabled(modifiers, modifierName) { | |
| 938 | + return modifiers.some(function (_ref) { | |
| 939 | + var name = _ref.name, | |
| 940 | + enabled = _ref.enabled; | |
| 941 | + return enabled && name === modifierName; | |
| 942 | + }); | |
| 943 | +} | |
| 944 | + | |
| 945 | +/** | |
| 946 | + * Get the prefixed supported property name | |
| 947 | + * @method | |
| 948 | + * @memberof Popper.Utils | |
| 949 | + * @argument {String} property (camelCase) | |
| 950 | + * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) | |
| 951 | + */ | |
| 952 | +function getSupportedPropertyName(property) { | |
| 953 | + var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; | |
| 954 | + var upperProp = property.charAt(0).toUpperCase() + property.slice(1); | |
| 955 | + | |
| 956 | + for (var i = 0; i < prefixes.length - 1; i++) { | |
| 957 | + var prefix = prefixes[i]; | |
| 958 | + var toCheck = prefix ? '' + prefix + upperProp : property; | |
| 959 | + if (typeof window.document.body.style[toCheck] !== 'undefined') { | |
| 960 | + return toCheck; | |
| 961 | + } | |
| 962 | + } | |
| 963 | + return null; | |
| 964 | +} | |
| 965 | + | |
| 966 | +/** | |
| 967 | + * Destroy the popper | |
| 968 | + * @method | |
| 969 | + * @memberof Popper | |
| 970 | + */ | |
| 971 | +function destroy() { | |
| 972 | + this.state.isDestroyed = true; | |
| 973 | + | |
| 974 | + // touch DOM only if `applyStyle` modifier is enabled | |
| 975 | + if (isModifierEnabled(this.modifiers, 'applyStyle')) { | |
| 976 | + this.popper.removeAttribute('x-placement'); | |
| 977 | + this.popper.style.left = ''; | |
| 978 | + this.popper.style.position = ''; | |
| 979 | + this.popper.style.top = ''; | |
| 980 | + this.popper.style[getSupportedPropertyName('transform')] = ''; | |
| 981 | + } | |
| 982 | + | |
| 983 | + this.disableEventListeners(); | |
| 984 | + | |
| 985 | + // remove the popper if user explicity asked for the deletion on destroy | |
| 986 | + // do not use `remove` because IE11 doesn't support it | |
| 987 | + if (this.options.removeOnDestroy) { | |
| 988 | + this.popper.parentNode.removeChild(this.popper); | |
| 989 | + } | |
| 990 | + return this; | |
| 991 | +} | |
| 992 | + | |
| 993 | +function attachToScrollParents(scrollParent, event, callback, scrollParents) { | |
| 994 | + var isBody = scrollParent.nodeName === 'BODY'; | |
| 995 | + var target = isBody ? window : scrollParent; | |
| 996 | + target.addEventListener(event, callback, { passive: true }); | |
| 997 | + | |
| 998 | + if (!isBody) { | |
| 999 | + attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); | |
| 1000 | + } | |
| 1001 | + scrollParents.push(target); | |
| 1002 | +} | |
| 1003 | + | |
| 1004 | +/** | |
| 1005 | + * Setup needed event listeners used to update the popper position | |
| 1006 | + * @method | |
| 1007 | + * @memberof Popper.Utils | |
| 1008 | + * @private | |
| 1009 | + */ | |
| 1010 | +function setupEventListeners(reference, options, state, updateBound) { | |
| 1011 | + // Resize event listener on window | |
| 1012 | + state.updateBound = updateBound; | |
| 1013 | + window.addEventListener('resize', state.updateBound, { passive: true }); | |
| 1014 | + | |
| 1015 | + // Scroll event listener on scroll parents | |
| 1016 | + var scrollElement = getScrollParent(reference); | |
| 1017 | + attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); | |
| 1018 | + state.scrollElement = scrollElement; | |
| 1019 | + state.eventsEnabled = true; | |
| 1020 | + | |
| 1021 | + return state; | |
| 1022 | +} | |
| 1023 | + | |
| 1024 | +/** | |
| 1025 | + * It will add resize/scroll events and start recalculating | |
| 1026 | + * position of the popper element when they are triggered. | |
| 1027 | + * @method | |
| 1028 | + * @memberof Popper | |
| 1029 | + */ | |
| 1030 | +function enableEventListeners() { | |
| 1031 | + if (!this.state.eventsEnabled) { | |
| 1032 | + this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); | |
| 1033 | + } | |
| 1034 | +} | |
| 1035 | + | |
| 1036 | +/** | |
| 1037 | + * Remove event listeners used to update the popper position | |
| 1038 | + * @method | |
| 1039 | + * @memberof Popper.Utils | |
| 1040 | + * @private | |
| 1041 | + */ | |
| 1042 | +function removeEventListeners(reference, state) { | |
| 1043 | + // Remove resize event listener on window | |
| 1044 | + window.removeEventListener('resize', state.updateBound); | |
| 1045 | + | |
| 1046 | + // Remove scroll event listener on scroll parents | |
| 1047 | + state.scrollParents.forEach(function (target) { | |
| 1048 | + target.removeEventListener('scroll', state.updateBound); | |
| 1049 | + }); | |
| 1050 | + | |
| 1051 | + // Reset state | |
| 1052 | + state.updateBound = null; | |
| 1053 | + state.scrollParents = []; | |
| 1054 | + state.scrollElement = null; | |
| 1055 | + state.eventsEnabled = false; | |
| 1056 | + return state; | |
| 1057 | +} | |
| 1058 | + | |
| 1059 | +/** | |
| 1060 | + * It will remove resize/scroll events and won't recalculate popper position | |
| 1061 | + * when they are triggered. It also won't trigger onUpdate callback anymore, | |
| 1062 | + * unless you call `update` method manually. | |
| 1063 | + * @method | |
| 1064 | + * @memberof Popper | |
| 1065 | + */ | |
| 1066 | +function disableEventListeners() { | |
| 1067 | + if (this.state.eventsEnabled) { | |
| 1068 | + window.cancelAnimationFrame(this.scheduleUpdate); | |
| 1069 | + this.state = removeEventListeners(this.reference, this.state); | |
| 1070 | + } | |
| 1071 | +} | |
| 1072 | + | |
| 1073 | +/** | |
| 1074 | + * Tells if a given input is a number | |
| 1075 | + * @method | |
| 1076 | + * @memberof Popper.Utils | |
| 1077 | + * @param {*} input to check | |
| 1078 | + * @return {Boolean} | |
| 1079 | + */ | |
| 1080 | +function isNumeric(n) { | |
| 1081 | + return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); | |
| 1082 | +} | |
| 1083 | + | |
| 1084 | +/** | |
| 1085 | + * Set the style to the given popper | |
| 1086 | + * @method | |
| 1087 | + * @memberof Popper.Utils | |
| 1088 | + * @argument {Element} element - Element to apply the style to | |
| 1089 | + * @argument {Object} styles | |
| 1090 | + * Object with a list of properties and values which will be applied to the element | |
| 1091 | + */ | |
| 1092 | +function setStyles(element, styles) { | |
| 1093 | + Object.keys(styles).forEach(function (prop) { | |
| 1094 | + var unit = ''; | |
| 1095 | + // add unit if the value is numeric and is one of the following | |
| 1096 | + if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { | |
| 1097 | + unit = 'px'; | |
| 1098 | + } | |
| 1099 | + element.style[prop] = styles[prop] + unit; | |
| 1100 | + }); | |
| 1101 | +} | |
| 1102 | + | |
| 1103 | +/** | |
| 1104 | + * Set the attributes to the given popper | |
| 1105 | + * @method | |
| 1106 | + * @memberof Popper.Utils | |
| 1107 | + * @argument {Element} element - Element to apply the attributes to | |
| 1108 | + * @argument {Object} styles | |
| 1109 | + * Object with a list of properties and values which will be applied to the element | |
| 1110 | + */ | |
| 1111 | +function setAttributes(element, attributes) { | |
| 1112 | + Object.keys(attributes).forEach(function (prop) { | |
| 1113 | + var value = attributes[prop]; | |
| 1114 | + if (value !== false) { | |
| 1115 | + element.setAttribute(prop, attributes[prop]); | |
| 1116 | + } else { | |
| 1117 | + element.removeAttribute(prop); | |
| 1118 | + } | |
| 1119 | + }); | |
| 1120 | +} | |
| 1121 | + | |
| 1122 | +/** | |
| 1123 | + * @function | |
| 1124 | + * @memberof Modifiers | |
| 1125 | + * @argument {Object} data - The data object generated by `update` method | |
| 1126 | + * @argument {Object} data.styles - List of style properties - values to apply to popper element | |
| 1127 | + * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element | |
| 1128 | + * @argument {Object} options - Modifiers configuration and options | |
| 1129 | + * @returns {Object} The same data object | |
| 1130 | + */ | |
| 1131 | +function applyStyle(data) { | |
| 1132 | + // any property present in `data.styles` will be applied to the popper, | |
| 1133 | + // in this way we can make the 3rd party modifiers add custom styles to it | |
| 1134 | + // Be aware, modifiers could override the properties defined in the previous | |
| 1135 | + // lines of this modifier! | |
| 1136 | + setStyles(data.instance.popper, data.styles); | |
| 1137 | + | |
| 1138 | + // any property present in `data.attributes` will be applied to the popper, | |
| 1139 | + // they will be set as HTML attributes of the element | |
| 1140 | + setAttributes(data.instance.popper, data.attributes); | |
| 1141 | + | |
| 1142 | + // if arrowElement is defined and arrowStyles has some properties | |
| 1143 | + if (data.arrowElement && Object.keys(data.arrowStyles).length) { | |
| 1144 | + setStyles(data.arrowElement, data.arrowStyles); | |
| 1145 | + } | |
| 1146 | + | |
| 1147 | + return data; | |
| 1148 | +} | |
| 1149 | + | |
| 1150 | +/** | |
| 1151 | + * Set the x-placement attribute before everything else because it could be used | |
| 1152 | + * to add margins to the popper margins needs to be calculated to get the | |
| 1153 | + * correct popper offsets. | |
| 1154 | + * @method | |
| 1155 | + * @memberof Popper.modifiers | |
| 1156 | + * @param {HTMLElement} reference - The reference element used to position the popper | |
| 1157 | + * @param {HTMLElement} popper - The HTML element used as popper. | |
| 1158 | + * @param {Object} options - Popper.js options | |
| 1159 | + */ | |
| 1160 | +function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { | |
| 1161 | + // compute reference element offsets | |
| 1162 | + var referenceOffsets = getReferenceOffsets(state, popper, reference); | |
| 1163 | + | |
| 1164 | + // compute auto placement, store placement inside the data object, | |
| 1165 | + // modifiers will be able to edit `placement` if needed | |
| 1166 | + // and refer to originalPlacement to know the original value | |
| 1167 | + var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); | |
| 1168 | + | |
| 1169 | + popper.setAttribute('x-placement', placement); | |
| 1170 | + | |
| 1171 | + // Apply `position` to popper before anything else because | |
| 1172 | + // without the position applied we can't guarantee correct computations | |
| 1173 | + setStyles(popper, { position: 'absolute' }); | |
| 1174 | + | |
| 1175 | + return options; | |
| 1176 | +} | |
| 1177 | + | |
| 1178 | +/** | |
| 1179 | + * @function | |
| 1180 | + * @memberof Modifiers | |
| 1181 | + * @argument {Object} data - The data object generated by `update` method | |
| 1182 | + * @argument {Object} options - Modifiers configuration and options | |
| 1183 | + * @returns {Object} The data object, properly modified | |
| 1184 | + */ | |
| 1185 | +function computeStyle(data, options) { | |
| 1186 | + var x = options.x, | |
| 1187 | + y = options.y; | |
| 1188 | + var popper = data.offsets.popper; | |
| 1189 | + | |
| 1190 | + // Remove this legacy support in Popper.js v2 | |
| 1191 | + | |
| 1192 | + var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { | |
| 1193 | + return modifier.name === 'applyStyle'; | |
| 1194 | + }).gpuAcceleration; | |
| 1195 | + if (legacyGpuAccelerationOption !== undefined) { | |
| 1196 | + console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); | |
| 1197 | + } | |
| 1198 | + var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; | |
| 1199 | + | |
| 1200 | + var offsetParent = getOffsetParent(data.instance.popper); | |
| 1201 | + var offsetParentRect = getBoundingClientRect(offsetParent); | |
| 1202 | + | |
| 1203 | + // Styles | |
| 1204 | + var styles = { | |
| 1205 | + position: popper.position | |
| 1206 | + }; | |
| 1207 | + | |
| 1208 | + // floor sides to avoid blurry text | |
| 1209 | + var offsets = { | |
| 1210 | + left: Math.floor(popper.left), | |
| 1211 | + top: Math.floor(popper.top), | |
| 1212 | + bottom: Math.floor(popper.bottom), | |
| 1213 | + right: Math.floor(popper.right) | |
| 1214 | + }; | |
| 1215 | + | |
| 1216 | + var sideA = x === 'bottom' ? 'top' : 'bottom'; | |
| 1217 | + var sideB = y === 'right' ? 'left' : 'right'; | |
| 1218 | + | |
| 1219 | + // if gpuAcceleration is set to `true` and transform is supported, | |
| 1220 | + // we use `translate3d` to apply the position to the popper we | |
| 1221 | + // automatically use the supported prefixed version if needed | |
| 1222 | + var prefixedProperty = getSupportedPropertyName('transform'); | |
| 1223 | + | |
| 1224 | + // now, let's make a step back and look at this code closely (wtf?) | |
| 1225 | + // If the content of the popper grows once it's been positioned, it | |
| 1226 | + // may happen that the popper gets misplaced because of the new content | |
| 1227 | + // overflowing its reference element | |
| 1228 | + // To avoid this problem, we provide two options (x and y), which allow | |
| 1229 | + // the consumer to define the offset origin. | |
| 1230 | + // If we position a popper on top of a reference element, we can set | |
| 1231 | + // `x` to `top` to make the popper grow towards its top instead of | |
| 1232 | + // its bottom. | |
| 1233 | + var left = void 0, | |
| 1234 | + top = void 0; | |
| 1235 | + if (sideA === 'bottom') { | |
| 1236 | + top = -offsetParentRect.height + offsets.bottom; | |
| 1237 | + } else { | |
| 1238 | + top = offsets.top; | |
| 1239 | + } | |
| 1240 | + if (sideB === 'right') { | |
| 1241 | + left = -offsetParentRect.width + offsets.right; | |
| 1242 | + } else { | |
| 1243 | + left = offsets.left; | |
| 1244 | + } | |
| 1245 | + if (gpuAcceleration && prefixedProperty) { | |
| 1246 | + styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; | |
| 1247 | + styles[sideA] = 0; | |
| 1248 | + styles[sideB] = 0; | |
| 1249 | + styles.willChange = 'transform'; | |
| 1250 | + } else { | |
| 1251 | + // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties | |
| 1252 | + var invertTop = sideA === 'bottom' ? -1 : 1; | |
| 1253 | + var invertLeft = sideB === 'right' ? -1 : 1; | |
| 1254 | + styles[sideA] = top * invertTop; | |
| 1255 | + styles[sideB] = left * invertLeft; | |
| 1256 | + styles.willChange = sideA + ', ' + sideB; | |
| 1257 | + } | |
| 1258 | + | |
| 1259 | + // Attributes | |
| 1260 | + var attributes = { | |
| 1261 | + 'x-placement': data.placement | |
| 1262 | + }; | |
| 1263 | + | |
| 1264 | + // Update `data` attributes, styles and arrowStyles | |
| 1265 | + data.attributes = _extends({}, attributes, data.attributes); | |
| 1266 | + data.styles = _extends({}, styles, data.styles); | |
| 1267 | + data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); | |
| 1268 | + | |
| 1269 | + return data; | |
| 1270 | +} | |
| 1271 | + | |
| 1272 | +/** | |
| 1273 | + * Helper used to know if the given modifier depends from another one.<br /> | |
| 1274 | + * It checks if the needed modifier is listed and enabled. | |
| 1275 | + * @method | |
| 1276 | + * @memberof Popper.Utils | |
| 1277 | + * @param {Array} modifiers - list of modifiers | |
| 1278 | + * @param {String} requestingName - name of requesting modifier | |
| 1279 | + * @param {String} requestedName - name of requested modifier | |
| 1280 | + * @returns {Boolean} | |
| 1281 | + */ | |
| 1282 | +function isModifierRequired(modifiers, requestingName, requestedName) { | |
| 1283 | + var requesting = find(modifiers, function (_ref) { | |
| 1284 | + var name = _ref.name; | |
| 1285 | + return name === requestingName; | |
| 1286 | + }); | |
| 1287 | + | |
| 1288 | + var isRequired = !!requesting && modifiers.some(function (modifier) { | |
| 1289 | + return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; | |
| 1290 | + }); | |
| 1291 | + | |
| 1292 | + if (!isRequired) { | |
| 1293 | + var _requesting = '`' + requestingName + '`'; | |
| 1294 | + var requested = '`' + requestedName + '`'; | |
| 1295 | + console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); | |
| 1296 | + } | |
| 1297 | + return isRequired; | |
| 1298 | +} | |
| 1299 | + | |
| 1300 | +/** | |
| 1301 | + * @function | |
| 1302 | + * @memberof Modifiers | |
| 1303 | + * @argument {Object} data - The data object generated by update method | |
| 1304 | + * @argument {Object} options - Modifiers configuration and options | |
| 1305 | + * @returns {Object} The data object, properly modified | |
| 1306 | + */ | |
| 1307 | +function arrow(data, options) { | |
| 1308 | + // arrow depends on keepTogether in order to work | |
| 1309 | + if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { | |
| 1310 | + return data; | |
| 1311 | + } | |
| 1312 | + | |
| 1313 | + var arrowElement = options.element; | |
| 1314 | + | |
| 1315 | + // if arrowElement is a string, suppose it's a CSS selector | |
| 1316 | + if (typeof arrowElement === 'string') { | |
| 1317 | + arrowElement = data.instance.popper.querySelector(arrowElement); | |
| 1318 | + | |
| 1319 | + // if arrowElement is not found, don't run the modifier | |
| 1320 | + if (!arrowElement) { | |
| 1321 | + return data; | |
| 1322 | + } | |
| 1323 | + } else { | |
| 1324 | + // if the arrowElement isn't a query selector we must check that the | |
| 1325 | + // provided DOM node is child of its popper node | |
| 1326 | + if (!data.instance.popper.contains(arrowElement)) { | |
| 1327 | + console.warn('WARNING: `arrow.element` must be child of its popper element!'); | |
| 1328 | + return data; | |
| 1329 | + } | |
| 1330 | + } | |
| 1331 | + | |
| 1332 | + var placement = data.placement.split('-')[0]; | |
| 1333 | + var _data$offsets = data.offsets, | |
| 1334 | + popper = _data$offsets.popper, | |
| 1335 | + reference = _data$offsets.reference; | |
| 1336 | + | |
| 1337 | + var isVertical = ['left', 'right'].indexOf(placement) !== -1; | |
| 1338 | + | |
| 1339 | + var len = isVertical ? 'height' : 'width'; | |
| 1340 | + var sideCapitalized = isVertical ? 'Top' : 'Left'; | |
| 1341 | + var side = sideCapitalized.toLowerCase(); | |
| 1342 | + var altSide = isVertical ? 'left' : 'top'; | |
| 1343 | + var opSide = isVertical ? 'bottom' : 'right'; | |
| 1344 | + var arrowElementSize = getOuterSizes(arrowElement)[len]; | |
| 1345 | + | |
| 1346 | + // | |
| 1347 | + // extends keepTogether behavior making sure the popper and its | |
| 1348 | + // reference have enough pixels in conjuction | |
| 1349 | + // | |
| 1350 | + | |
| 1351 | + // top/left side | |
| 1352 | + if (reference[opSide] - arrowElementSize < popper[side]) { | |
| 1353 | + data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); | |
| 1354 | + } | |
| 1355 | + // bottom/right side | |
| 1356 | + if (reference[side] + arrowElementSize > popper[opSide]) { | |
| 1357 | + data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; | |
| 1358 | + } | |
| 1359 | + | |
| 1360 | + // compute center of the popper | |
| 1361 | + var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; | |
| 1362 | + | |
| 1363 | + // Compute the sideValue using the updated popper offsets | |
| 1364 | + // take popper margin in account because we don't have this info available | |
| 1365 | + var popperMarginSide = getStyleComputedProperty(data.instance.popper, 'margin' + sideCapitalized).replace('px', ''); | |
| 1366 | + var sideValue = center - getClientRect(data.offsets.popper)[side] - popperMarginSide; | |
| 1367 | + | |
| 1368 | + // prevent arrowElement from being placed not contiguously to its popper | |
| 1369 | + sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); | |
| 1370 | + | |
| 1371 | + data.arrowElement = arrowElement; | |
| 1372 | + data.offsets.arrow = {}; | |
| 1373 | + data.offsets.arrow[side] = Math.round(sideValue); | |
| 1374 | + data.offsets.arrow[altSide] = ''; // make sure to unset any eventual altSide value from the DOM node | |
| 1375 | + | |
| 1376 | + return data; | |
| 1377 | +} | |
| 1378 | + | |
| 1379 | +/** | |
| 1380 | + * Get the opposite placement variation of the given one | |
| 1381 | + * @method | |
| 1382 | + * @memberof Popper.Utils | |
| 1383 | + * @argument {String} placement variation | |
| 1384 | + * @returns {String} flipped placement variation | |
| 1385 | + */ | |
| 1386 | +function getOppositeVariation(variation) { | |
| 1387 | + if (variation === 'end') { | |
| 1388 | + return 'start'; | |
| 1389 | + } else if (variation === 'start') { | |
| 1390 | + return 'end'; | |
| 1391 | + } | |
| 1392 | + return variation; | |
| 1393 | +} | |
| 1394 | + | |
| 1395 | +/** | |
| 1396 | + * List of accepted placements to use as values of the `placement` option.<br /> | |
| 1397 | + * Valid placements are: | |
| 1398 | + * - `auto` | |
| 1399 | + * - `top` | |
| 1400 | + * - `right` | |
| 1401 | + * - `bottom` | |
| 1402 | + * - `left` | |
| 1403 | + * | |
| 1404 | + * Each placement can have a variation from this list: | |
| 1405 | + * - `-start` | |
| 1406 | + * - `-end` | |
| 1407 | + * | |
| 1408 | + * Variations are interpreted easily if you think of them as the left to right | |
| 1409 | + * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` | |
| 1410 | + * is right.<br /> | |
| 1411 | + * Vertically (`left` and `right`), `start` is top and `end` is bottom. | |
| 1412 | + * | |
| 1413 | + * Some valid examples are: | |
| 1414 | + * - `top-end` (on top of reference, right aligned) | |
| 1415 | + * - `right-start` (on right of reference, top aligned) | |
| 1416 | + * - `bottom` (on bottom, centered) | |
| 1417 | + * - `auto-right` (on the side with more space available, alignment depends by placement) | |
| 1418 | + * | |
| 1419 | + * @static | |
| 1420 | + * @type {Array} | |
| 1421 | + * @enum {String} | |
| 1422 | + * @readonly | |
| 1423 | + * @method placements | |
| 1424 | + * @memberof Popper | |
| 1425 | + */ | |
| 1426 | +var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']; | |
| 1427 | + | |
| 1428 | +// Get rid of `auto` `auto-start` and `auto-end` | |
| 1429 | +var validPlacements = placements.slice(3); | |
| 1430 | + | |
| 1431 | +/** | |
| 1432 | + * Given an initial placement, returns all the subsequent placements | |
| 1433 | + * clockwise (or counter-clockwise). | |
| 1434 | + * | |
| 1435 | + * @method | |
| 1436 | + * @memberof Popper.Utils | |
| 1437 | + * @argument {String} placement - A valid placement (it accepts variations) | |
| 1438 | + * @argument {Boolean} counter - Set to true to walk the placements counterclockwise | |
| 1439 | + * @returns {Array} placements including their variations | |
| 1440 | + */ | |
| 1441 | +function clockwise(placement) { | |
| 1442 | + var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | |
| 1443 | + | |
| 1444 | + var index = validPlacements.indexOf(placement); | |
| 1445 | + var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); | |
| 1446 | + return counter ? arr.reverse() : arr; | |
| 1447 | +} | |
| 1448 | + | |
| 1449 | +var BEHAVIORS = { | |
| 1450 | + FLIP: 'flip', | |
| 1451 | + CLOCKWISE: 'clockwise', | |
| 1452 | + COUNTERCLOCKWISE: 'counterclockwise' | |
| 1453 | +}; | |
| 1454 | + | |
| 1455 | +/** | |
| 1456 | + * @function | |
| 1457 | + * @memberof Modifiers | |
| 1458 | + * @argument {Object} data - The data object generated by update method | |
| 1459 | + * @argument {Object} options - Modifiers configuration and options | |
| 1460 | + * @returns {Object} The data object, properly modified | |
| 1461 | + */ | |
| 1462 | +function flip(data, options) { | |
| 1463 | + // if `inner` modifier is enabled, we can't use the `flip` modifier | |
| 1464 | + if (isModifierEnabled(data.instance.modifiers, 'inner')) { | |
| 1465 | + return data; | |
| 1466 | + } | |
| 1467 | + | |
| 1468 | + if (data.flipped && data.placement === data.originalPlacement) { | |
| 1469 | + // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides | |
| 1470 | + return data; | |
| 1471 | + } | |
| 1472 | + | |
| 1473 | + var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement); | |
| 1474 | + | |
| 1475 | + var placement = data.placement.split('-')[0]; | |
| 1476 | + var placementOpposite = getOppositePlacement(placement); | |
| 1477 | + var variation = data.placement.split('-')[1] || ''; | |
| 1478 | + | |
| 1479 | + var flipOrder = []; | |
| 1480 | + | |
| 1481 | + switch (options.behavior) { | |
| 1482 | + case BEHAVIORS.FLIP: | |
| 1483 | + flipOrder = [placement, placementOpposite]; | |
| 1484 | + break; | |
| 1485 | + case BEHAVIORS.CLOCKWISE: | |
| 1486 | + flipOrder = clockwise(placement); | |
| 1487 | + break; | |
| 1488 | + case BEHAVIORS.COUNTERCLOCKWISE: | |
| 1489 | + flipOrder = clockwise(placement, true); | |
| 1490 | + break; | |
| 1491 | + default: | |
| 1492 | + flipOrder = options.behavior; | |
| 1493 | + } | |
| 1494 | + | |
| 1495 | + flipOrder.forEach(function (step, index) { | |
| 1496 | + if (placement !== step || flipOrder.length === index + 1) { | |
| 1497 | + return data; | |
| 1498 | + } | |
| 1499 | + | |
| 1500 | + placement = data.placement.split('-')[0]; | |
| 1501 | + placementOpposite = getOppositePlacement(placement); | |
| 1502 | + | |
| 1503 | + var popperOffsets = data.offsets.popper; | |
| 1504 | + var refOffsets = data.offsets.reference; | |
| 1505 | + | |
| 1506 | + // using floor because the reference offsets may contain decimals we are not going to consider here | |
| 1507 | + var floor = Math.floor; | |
| 1508 | + var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom); | |
| 1509 | + | |
| 1510 | + var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); | |
| 1511 | + var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); | |
| 1512 | + var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); | |
| 1513 | + var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); | |
| 1514 | + | |
| 1515 | + var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; | |
| 1516 | + | |
| 1517 | + // flip the variation if required | |
| 1518 | + var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; | |
| 1519 | + var flippedVariation = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); | |
| 1520 | + | |
| 1521 | + if (overlapsRef || overflowsBoundaries || flippedVariation) { | |
| 1522 | + // this boolean to detect any flip loop | |
| 1523 | + data.flipped = true; | |
| 1524 | + | |
| 1525 | + if (overlapsRef || overflowsBoundaries) { | |
| 1526 | + placement = flipOrder[index + 1]; | |
| 1527 | + } | |
| 1528 | + | |
| 1529 | + if (flippedVariation) { | |
| 1530 | + variation = getOppositeVariation(variation); | |
| 1531 | + } | |
| 1532 | + | |
| 1533 | + data.placement = placement + (variation ? '-' + variation : ''); | |
| 1534 | + | |
| 1535 | + // this object contains `position`, we want to preserve it along with | |
| 1536 | + // any additional property we may add in the future | |
| 1537 | + data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); | |
| 1538 | + | |
| 1539 | + data = runModifiers(data.instance.modifiers, data, 'flip'); | |
| 1540 | + } | |
| 1541 | + }); | |
| 1542 | + return data; | |
| 1543 | +} | |
| 1544 | + | |
| 1545 | +/** | |
| 1546 | + * @function | |
| 1547 | + * @memberof Modifiers | |
| 1548 | + * @argument {Object} data - The data object generated by update method | |
| 1549 | + * @argument {Object} options - Modifiers configuration and options | |
| 1550 | + * @returns {Object} The data object, properly modified | |
| 1551 | + */ | |
| 1552 | +function keepTogether(data) { | |
| 1553 | + var _data$offsets = data.offsets, | |
| 1554 | + popper = _data$offsets.popper, | |
| 1555 | + reference = _data$offsets.reference; | |
| 1556 | + | |
| 1557 | + var placement = data.placement.split('-')[0]; | |
| 1558 | + var floor = Math.floor; | |
| 1559 | + var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; | |
| 1560 | + var side = isVertical ? 'right' : 'bottom'; | |
| 1561 | + var opSide = isVertical ? 'left' : 'top'; | |
| 1562 | + var measurement = isVertical ? 'width' : 'height'; | |
| 1563 | + | |
| 1564 | + if (popper[side] < floor(reference[opSide])) { | |
| 1565 | + data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; | |
| 1566 | + } | |
| 1567 | + if (popper[opSide] > floor(reference[side])) { | |
| 1568 | + data.offsets.popper[opSide] = floor(reference[side]); | |
| 1569 | + } | |
| 1570 | + | |
| 1571 | + return data; | |
| 1572 | +} | |
| 1573 | + | |
| 1574 | +/** | |
| 1575 | + * Converts a string containing value + unit into a px value number | |
| 1576 | + * @function | |
| 1577 | + * @memberof {modifiers~offset} | |
| 1578 | + * @private | |
| 1579 | + * @argument {String} str - Value + unit string | |
| 1580 | + * @argument {String} measurement - `height` or `width` | |
| 1581 | + * @argument {Object} popperOffsets | |
| 1582 | + * @argument {Object} referenceOffsets | |
| 1583 | + * @returns {Number|String} | |
| 1584 | + * Value in pixels, or original string if no values were extracted | |
| 1585 | + */ | |
| 1586 | +function toValue(str, measurement, popperOffsets, referenceOffsets) { | |
| 1587 | + // separate value from unit | |
| 1588 | + var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); | |
| 1589 | + var value = +split[1]; | |
| 1590 | + var unit = split[2]; | |
| 1591 | + | |
| 1592 | + // If it's not a number it's an operator, I guess | |
| 1593 | + if (!value) { | |
| 1594 | + return str; | |
| 1595 | + } | |
| 1596 | + | |
| 1597 | + if (unit.indexOf('%') === 0) { | |
| 1598 | + var element = void 0; | |
| 1599 | + switch (unit) { | |
| 1600 | + case '%p': | |
| 1601 | + element = popperOffsets; | |
| 1602 | + break; | |
| 1603 | + case '%': | |
| 1604 | + case '%r': | |
| 1605 | + default: | |
| 1606 | + element = referenceOffsets; | |
| 1607 | + } | |
| 1608 | + | |
| 1609 | + var rect = getClientRect(element); | |
| 1610 | + return rect[measurement] / 100 * value; | |
| 1611 | + } else if (unit === 'vh' || unit === 'vw') { | |
| 1612 | + // if is a vh or vw, we calculate the size based on the viewport | |
| 1613 | + var size = void 0; | |
| 1614 | + if (unit === 'vh') { | |
| 1615 | + size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); | |
| 1616 | + } else { | |
| 1617 | + size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); | |
| 1618 | + } | |
| 1619 | + return size / 100 * value; | |
| 1620 | + } else { | |
| 1621 | + // if is an explicit pixel unit, we get rid of the unit and keep the value | |
| 1622 | + // if is an implicit unit, it's px, and we return just the value | |
| 1623 | + return value; | |
| 1624 | + } | |
| 1625 | +} | |
| 1626 | + | |
| 1627 | +/** | |
| 1628 | + * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. | |
| 1629 | + * @function | |
| 1630 | + * @memberof {modifiers~offset} | |
| 1631 | + * @private | |
| 1632 | + * @argument {String} offset | |
| 1633 | + * @argument {Object} popperOffsets | |
| 1634 | + * @argument {Object} referenceOffsets | |
| 1635 | + * @argument {String} basePlacement | |
| 1636 | + * @returns {Array} a two cells array with x and y offsets in numbers | |
| 1637 | + */ | |
| 1638 | +function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { | |
| 1639 | + var offsets = [0, 0]; | |
| 1640 | + | |
| 1641 | + // Use height if placement is left or right and index is 0 otherwise use width | |
| 1642 | + // in this way the first offset will use an axis and the second one | |
| 1643 | + // will use the other one | |
| 1644 | + var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; | |
| 1645 | + | |
| 1646 | + // Split the offset string to obtain a list of values and operands | |
| 1647 | + // The regex addresses values with the plus or minus sign in front (+10, -20, etc) | |
| 1648 | + var fragments = offset.split(/(\+|\-)/).map(function (frag) { | |
| 1649 | + return frag.trim(); | |
| 1650 | + }); | |
| 1651 | + | |
| 1652 | + // Detect if the offset string contains a pair of values or a single one | |
| 1653 | + // they could be separated by comma or space | |
| 1654 | + var divider = fragments.indexOf(find(fragments, function (frag) { | |
| 1655 | + return frag.search(/,|\s/) !== -1; | |
| 1656 | + })); | |
| 1657 | + | |
| 1658 | + if (fragments[divider] && fragments[divider].indexOf(',') === -1) { | |
| 1659 | + console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); | |
| 1660 | + } | |
| 1661 | + | |
| 1662 | + // If divider is found, we divide the list of values and operands to divide | |
| 1663 | + // them by ofset X and Y. | |
| 1664 | + var splitRegex = /\s*,\s*|\s+/; | |
| 1665 | + var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments]; | |
| 1666 | + | |
| 1667 | + // Convert the values with units to absolute pixels to allow our computations | |
| 1668 | + ops = ops.map(function (op, index) { | |
| 1669 | + // Most of the units rely on the orientation of the popper | |
| 1670 | + var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; | |
| 1671 | + var mergeWithPrevious = false; | |
| 1672 | + return op | |
| 1673 | + // This aggregates any `+` or `-` sign that aren't considered operators | |
| 1674 | + // e.g.: 10 + +5 => [10, +, +5] | |
| 1675 | + .reduce(function (a, b) { | |
| 1676 | + if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { | |
| 1677 | + a[a.length - 1] = b; | |
| 1678 | + mergeWithPrevious = true; | |
| 1679 | + return a; | |
| 1680 | + } else if (mergeWithPrevious) { | |
| 1681 | + a[a.length - 1] += b; | |
| 1682 | + mergeWithPrevious = false; | |
| 1683 | + return a; | |
| 1684 | + } else { | |
| 1685 | + return a.concat(b); | |
| 1686 | + } | |
| 1687 | + }, []) | |
| 1688 | + // Here we convert the string values into number values (in px) | |
| 1689 | + .map(function (str) { | |
| 1690 | + return toValue(str, measurement, popperOffsets, referenceOffsets); | |
| 1691 | + }); | |
| 1692 | + }); | |
| 1693 | + | |
| 1694 | + // Loop trough the offsets arrays and execute the operations | |
| 1695 | + ops.forEach(function (op, index) { | |
| 1696 | + op.forEach(function (frag, index2) { | |
| 1697 | + if (isNumeric(frag)) { | |
| 1698 | + offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); | |
| 1699 | + } | |
| 1700 | + }); | |
| 1701 | + }); | |
| 1702 | + return offsets; | |
| 1703 | +} | |
| 1704 | + | |
| 1705 | +/** | |
| 1706 | + * @function | |
| 1707 | + * @memberof Modifiers | |
| 1708 | + * @argument {Object} data - The data object generated by update method | |
| 1709 | + * @argument {Object} options - Modifiers configuration and options | |
| 1710 | + * @argument {Number|String} options.offset=0 | |
| 1711 | + * The offset value as described in the modifier description | |
| 1712 | + * @returns {Object} The data object, properly modified | |
| 1713 | + */ | |
| 1714 | +function offset(data, _ref) { | |
| 1715 | + var offset = _ref.offset; | |
| 1716 | + var placement = data.placement, | |
| 1717 | + _data$offsets = data.offsets, | |
| 1718 | + popper = _data$offsets.popper, | |
| 1719 | + reference = _data$offsets.reference; | |
| 1720 | + | |
| 1721 | + var basePlacement = placement.split('-')[0]; | |
| 1722 | + | |
| 1723 | + var offsets = void 0; | |
| 1724 | + if (isNumeric(+offset)) { | |
| 1725 | + offsets = [+offset, 0]; | |
| 1726 | + } else { | |
| 1727 | + offsets = parseOffset(offset, popper, reference, basePlacement); | |
| 1728 | + } | |
| 1729 | + | |
| 1730 | + if (basePlacement === 'left') { | |
| 1731 | + popper.top += offsets[0]; | |
| 1732 | + popper.left -= offsets[1]; | |
| 1733 | + } else if (basePlacement === 'right') { | |
| 1734 | + popper.top += offsets[0]; | |
| 1735 | + popper.left += offsets[1]; | |
| 1736 | + } else if (basePlacement === 'top') { | |
| 1737 | + popper.left += offsets[0]; | |
| 1738 | + popper.top -= offsets[1]; | |
| 1739 | + } else if (basePlacement === 'bottom') { | |
| 1740 | + popper.left += offsets[0]; | |
| 1741 | + popper.top += offsets[1]; | |
| 1742 | + } | |
| 1743 | + | |
| 1744 | + data.popper = popper; | |
| 1745 | + return data; | |
| 1746 | +} | |
| 1747 | + | |
| 1748 | +/** | |
| 1749 | + * @function | |
| 1750 | + * @memberof Modifiers | |
| 1751 | + * @argument {Object} data - The data object generated by `update` method | |
| 1752 | + * @argument {Object} options - Modifiers configuration and options | |
| 1753 | + * @returns {Object} The data object, properly modified | |
| 1754 | + */ | |
| 1755 | +function preventOverflow(data, options) { | |
| 1756 | + var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); | |
| 1757 | + | |
| 1758 | + // If offsetParent is the reference element, we really want to | |
| 1759 | + // go one step up and use the next offsetParent as reference to | |
| 1760 | + // avoid to make this modifier completely useless and look like broken | |
| 1761 | + if (data.instance.reference === boundariesElement) { | |
| 1762 | + boundariesElement = getOffsetParent(boundariesElement); | |
| 1763 | + } | |
| 1764 | + | |
| 1765 | + var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement); | |
| 1766 | + options.boundaries = boundaries; | |
| 1767 | + | |
| 1768 | + var order = options.priority; | |
| 1769 | + var popper = data.offsets.popper; | |
| 1770 | + | |
| 1771 | + var check = { | |
| 1772 | + primary: function primary(placement) { | |
| 1773 | + var value = popper[placement]; | |
| 1774 | + if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { | |
| 1775 | + value = Math.max(popper[placement], boundaries[placement]); | |
| 1776 | + } | |
| 1777 | + return defineProperty({}, placement, value); | |
| 1778 | + }, | |
| 1779 | + secondary: function secondary(placement) { | |
| 1780 | + var mainSide = placement === 'right' ? 'left' : 'top'; | |
| 1781 | + var value = popper[mainSide]; | |
| 1782 | + if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { | |
| 1783 | + value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); | |
| 1784 | + } | |
| 1785 | + return defineProperty({}, mainSide, value); | |
| 1786 | + } | |
| 1787 | + }; | |
| 1788 | + | |
| 1789 | + order.forEach(function (placement) { | |
| 1790 | + var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; | |
| 1791 | + popper = _extends({}, popper, check[side](placement)); | |
| 1792 | + }); | |
| 1793 | + | |
| 1794 | + data.offsets.popper = popper; | |
| 1795 | + | |
| 1796 | + return data; | |
| 1797 | +} | |
| 1798 | + | |
| 1799 | +/** | |
| 1800 | + * @function | |
| 1801 | + * @memberof Modifiers | |
| 1802 | + * @argument {Object} data - The data object generated by `update` method | |
| 1803 | + * @argument {Object} options - Modifiers configuration and options | |
| 1804 | + * @returns {Object} The data object, properly modified | |
| 1805 | + */ | |
| 1806 | +function shift(data) { | |
| 1807 | + var placement = data.placement; | |
| 1808 | + var basePlacement = placement.split('-')[0]; | |
| 1809 | + var shiftvariation = placement.split('-')[1]; | |
| 1810 | + | |
| 1811 | + // if shift shiftvariation is specified, run the modifier | |
| 1812 | + if (shiftvariation) { | |
| 1813 | + var _data$offsets = data.offsets, | |
| 1814 | + reference = _data$offsets.reference, | |
| 1815 | + popper = _data$offsets.popper; | |
| 1816 | + | |
| 1817 | + var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; | |
| 1818 | + var side = isVertical ? 'left' : 'top'; | |
| 1819 | + var measurement = isVertical ? 'width' : 'height'; | |
| 1820 | + | |
| 1821 | + var shiftOffsets = { | |
| 1822 | + start: defineProperty({}, side, reference[side]), | |
| 1823 | + end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) | |
| 1824 | + }; | |
| 1825 | + | |
| 1826 | + data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); | |
| 1827 | + } | |
| 1828 | + | |
| 1829 | + return data; | |
| 1830 | +} | |
| 1831 | + | |
| 1832 | +/** | |
| 1833 | + * @function | |
| 1834 | + * @memberof Modifiers | |
| 1835 | + * @argument {Object} data - The data object generated by update method | |
| 1836 | + * @argument {Object} options - Modifiers configuration and options | |
| 1837 | + * @returns {Object} The data object, properly modified | |
| 1838 | + */ | |
| 1839 | +function hide(data) { | |
| 1840 | + if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { | |
| 1841 | + return data; | |
| 1842 | + } | |
| 1843 | + | |
| 1844 | + var refRect = data.offsets.reference; | |
| 1845 | + var bound = find(data.instance.modifiers, function (modifier) { | |
| 1846 | + return modifier.name === 'preventOverflow'; | |
| 1847 | + }).boundaries; | |
| 1848 | + | |
| 1849 | + if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { | |
| 1850 | + // Avoid unnecessary DOM access if visibility hasn't changed | |
| 1851 | + if (data.hide === true) { | |
| 1852 | + return data; | |
| 1853 | + } | |
| 1854 | + | |
| 1855 | + data.hide = true; | |
| 1856 | + data.attributes['x-out-of-boundaries'] = ''; | |
| 1857 | + } else { | |
| 1858 | + // Avoid unnecessary DOM access if visibility hasn't changed | |
| 1859 | + if (data.hide === false) { | |
| 1860 | + return data; | |
| 1861 | + } | |
| 1862 | + | |
| 1863 | + data.hide = false; | |
| 1864 | + data.attributes['x-out-of-boundaries'] = false; | |
| 1865 | + } | |
| 1866 | + | |
| 1867 | + return data; | |
| 1868 | +} | |
| 1869 | + | |
| 1870 | +/** | |
| 1871 | + * @function | |
| 1872 | + * @memberof Modifiers | |
| 1873 | + * @argument {Object} data - The data object generated by `update` method | |
| 1874 | + * @argument {Object} options - Modifiers configuration and options | |
| 1875 | + * @returns {Object} The data object, properly modified | |
| 1876 | + */ | |
| 1877 | +function inner(data) { | |
| 1878 | + var placement = data.placement; | |
| 1879 | + var basePlacement = placement.split('-')[0]; | |
| 1880 | + var _data$offsets = data.offsets, | |
| 1881 | + popper = _data$offsets.popper, | |
| 1882 | + reference = _data$offsets.reference; | |
| 1883 | + | |
| 1884 | + var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; | |
| 1885 | + | |
| 1886 | + var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; | |
| 1887 | + | |
| 1888 | + popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); | |
| 1889 | + | |
| 1890 | + data.placement = getOppositePlacement(placement); | |
| 1891 | + data.offsets.popper = getClientRect(popper); | |
| 1892 | + | |
| 1893 | + return data; | |
| 1894 | +} | |
| 1895 | + | |
| 1896 | +/** | |
| 1897 | + * Modifier function, each modifier can have a function of this type assigned | |
| 1898 | + * to its `fn` property.<br /> | |
| 1899 | + * These functions will be called on each update, this means that you must | |
| 1900 | + * make sure they are performant enough to avoid performance bottlenecks. | |
| 1901 | + * | |
| 1902 | + * @function ModifierFn | |
| 1903 | + * @argument {dataObject} data - The data object generated by `update` method | |
| 1904 | + * @argument {Object} options - Modifiers configuration and options | |
| 1905 | + * @returns {dataObject} The data object, properly modified | |
| 1906 | + */ | |
| 1907 | + | |
| 1908 | +/** | |
| 1909 | + * Modifiers are plugins used to alter the behavior of your poppers.<br /> | |
| 1910 | + * Popper.js uses a set of 9 modifiers to provide all the basic functionalities | |
| 1911 | + * needed by the library. | |
| 1912 | + * | |
| 1913 | + * Usually you don't want to override the `order`, `fn` and `onLoad` props. | |
| 1914 | + * All the other properties are configurations that could be tweaked. | |
| 1915 | + * @namespace modifiers | |
| 1916 | + */ | |
| 1917 | +var modifiers = { | |
| 1918 | + /** | |
| 1919 | + * Modifier used to shift the popper on the start or end of its reference | |
| 1920 | + * element.<br /> | |
| 1921 | + * It will read the variation of the `placement` property.<br /> | |
| 1922 | + * It can be one either `-end` or `-start`. | |
| 1923 | + * @memberof modifiers | |
| 1924 | + * @inner | |
| 1925 | + */ | |
| 1926 | + shift: { | |
| 1927 | + /** @prop {number} order=100 - Index used to define the order of execution */ | |
| 1928 | + order: 100, | |
| 1929 | + /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ | |
| 1930 | + enabled: true, | |
| 1931 | + /** @prop {ModifierFn} */ | |
| 1932 | + fn: shift | |
| 1933 | + }, | |
| 1934 | + | |
| 1935 | + /** | |
| 1936 | + * The `offset` modifier can shift your popper on both its axis. | |
| 1937 | + * | |
| 1938 | + * It accepts the following units: | |
| 1939 | + * - `px` or unitless, interpreted as pixels | |
| 1940 | + * - `%` or `%r`, percentage relative to the length of the reference element | |
| 1941 | + * - `%p`, percentage relative to the length of the popper element | |
| 1942 | + * - `vw`, CSS viewport width unit | |
| 1943 | + * - `vh`, CSS viewport height unit | |
| 1944 | + * | |
| 1945 | + * For length is intended the main axis relative to the placement of the popper.<br /> | |
| 1946 | + * This means that if the placement is `top` or `bottom`, the length will be the | |
| 1947 | + * `width`. In case of `left` or `right`, it will be the height. | |
| 1948 | + * | |
| 1949 | + * You can provide a single value (as `Number` or `String`), or a pair of values | |
| 1950 | + * as `String` divided by a comma or one (or more) white spaces.<br /> | |
| 1951 | + * The latter is a deprecated method because it leads to confusion and will be | |
| 1952 | + * removed in v2.<br /> | |
| 1953 | + * Additionally, it accepts additions and subtractions between different units. | |
| 1954 | + * Note that multiplications and divisions aren't supported. | |
| 1955 | + * | |
| 1956 | + * Valid examples are: | |
| 1957 | + * ``` | |
| 1958 | + * 10 | |
| 1959 | + * '10%' | |
| 1960 | + * '10, 10' | |
| 1961 | + * '10%, 10' | |
| 1962 | + * '10 + 10%' | |
| 1963 | + * '10 - 5vh + 3%' | |
| 1964 | + * '-10px + 5vh, 5px - 6%' | |
| 1965 | + * ``` | |
| 1966 | + * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap | |
| 1967 | + * > with their reference element, unfortunately, you will have to disable the `flip` modifier. | |
| 1968 | + * > More on this [reading this issue](https://github.com/FezVrasta/popper.js/issues/373) | |
| 1969 | + * | |
| 1970 | + * @memberof modifiers | |
| 1971 | + * @inner | |
| 1972 | + */ | |
| 1973 | + offset: { | |
| 1974 | + /** @prop {number} order=200 - Index used to define the order of execution */ | |
| 1975 | + order: 200, | |
| 1976 | + /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ | |
| 1977 | + enabled: true, | |
| 1978 | + /** @prop {ModifierFn} */ | |
| 1979 | + fn: offset, | |
| 1980 | + /** @prop {Number|String} offset=0 | |
| 1981 | + * The offset value as described in the modifier description | |
| 1982 | + */ | |
| 1983 | + offset: 0 | |
| 1984 | + }, | |
| 1985 | + | |
| 1986 | + /** | |
| 1987 | + * Modifier used to prevent the popper from being positioned outside the boundary. | |
| 1988 | + * | |
| 1989 | + * An scenario exists where the reference itself is not within the boundaries.<br /> | |
| 1990 | + * We can say it has "escaped the boundaries" — or just "escaped".<br /> | |
| 1991 | + * In this case we need to decide whether the popper should either: | |
| 1992 | + * | |
| 1993 | + * - detach from the reference and remain "trapped" in the boundaries, or | |
| 1994 | + * - if it should ignore the boundary and "escape with its reference" | |
| 1995 | + * | |
| 1996 | + * When `escapeWithReference` is set to`true` and reference is completely | |
| 1997 | + * outside its boundaries, the popper will overflow (or completely leave) | |
| 1998 | + * the boundaries in order to remain attached to the edge of the reference. | |
| 1999 | + * | |
| 2000 | + * @memberof modifiers | |
| 2001 | + * @inner | |
| 2002 | + */ | |
| 2003 | + preventOverflow: { | |
| 2004 | + /** @prop {number} order=300 - Index used to define the order of execution */ | |
| 2005 | + order: 300, | |
| 2006 | + /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ | |
| 2007 | + enabled: true, | |
| 2008 | + /** @prop {ModifierFn} */ | |
| 2009 | + fn: preventOverflow, | |
| 2010 | + /** | |
| 2011 | + * @prop {Array} [priority=['left','right','top','bottom']] | |
| 2012 | + * Popper will try to prevent overflow following these priorities by default, | |
| 2013 | + * then, it could overflow on the left and on top of the `boundariesElement` | |
| 2014 | + */ | |
| 2015 | + priority: ['left', 'right', 'top', 'bottom'], | |
| 2016 | + /** | |
| 2017 | + * @prop {number} padding=5 | |
| 2018 | + * Amount of pixel used to define a minimum distance between the boundaries | |
| 2019 | + * and the popper this makes sure the popper has always a little padding | |
| 2020 | + * between the edges of its container | |
| 2021 | + */ | |
| 2022 | + padding: 5, | |
| 2023 | + /** | |
| 2024 | + * @prop {String|HTMLElement} boundariesElement='scrollParent' | |
| 2025 | + * Boundaries used by the modifier, can be `scrollParent`, `window`, | |
| 2026 | + * `viewport` or any DOM element. | |
| 2027 | + */ | |
| 2028 | + boundariesElement: 'scrollParent' | |
| 2029 | + }, | |
| 2030 | + | |
| 2031 | + /** | |
| 2032 | + * Modifier used to make sure the reference and its popper stay near eachothers | |
| 2033 | + * without leaving any gap between the two. Expecially useful when the arrow is | |
| 2034 | + * enabled and you want to assure it to point to its reference element. | |
| 2035 | + * It cares only about the first axis, you can still have poppers with margin | |
| 2036 | + * between the popper and its reference element. | |
| 2037 | + * @memberof modifiers | |
| 2038 | + * @inner | |
| 2039 | + */ | |
| 2040 | + keepTogether: { | |
| 2041 | + /** @prop {number} order=400 - Index used to define the order of execution */ | |
| 2042 | + order: 400, | |
| 2043 | + /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ | |
| 2044 | + enabled: true, | |
| 2045 | + /** @prop {ModifierFn} */ | |
| 2046 | + fn: keepTogether | |
| 2047 | + }, | |
| 2048 | + | |
| 2049 | + /** | |
| 2050 | + * This modifier is used to move the `arrowElement` of the popper to make | |
| 2051 | + * sure it is positioned between the reference element and its popper element. | |
| 2052 | + * It will read the outer size of the `arrowElement` node to detect how many | |
| 2053 | + * pixels of conjuction are needed. | |
| 2054 | + * | |
| 2055 | + * It has no effect if no `arrowElement` is provided. | |
| 2056 | + * @memberof modifiers | |
| 2057 | + * @inner | |
| 2058 | + */ | |
| 2059 | + arrow: { | |
| 2060 | + /** @prop {number} order=500 - Index used to define the order of execution */ | |
| 2061 | + order: 500, | |
| 2062 | + /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ | |
| 2063 | + enabled: true, | |
| 2064 | + /** @prop {ModifierFn} */ | |
| 2065 | + fn: arrow, | |
| 2066 | + /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ | |
| 2067 | + element: '[x-arrow]' | |
| 2068 | + }, | |
| 2069 | + | |
| 2070 | + /** | |
| 2071 | + * Modifier used to flip the popper's placement when it starts to overlap its | |
| 2072 | + * reference element. | |
| 2073 | + * | |
| 2074 | + * Requires the `preventOverflow` modifier before it in order to work. | |
| 2075 | + * | |
| 2076 | + * **NOTE:** this modifier will interrupt the current update cycle and will | |
| 2077 | + * restart it if it detects the need to flip the placement. | |
| 2078 | + * @memberof modifiers | |
| 2079 | + * @inner | |
| 2080 | + */ | |
| 2081 | + flip: { | |
| 2082 | + /** @prop {number} order=600 - Index used to define the order of execution */ | |
| 2083 | + order: 600, | |
| 2084 | + /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ | |
| 2085 | + enabled: true, | |
| 2086 | + /** @prop {ModifierFn} */ | |
| 2087 | + fn: flip, | |
| 2088 | + /** | |
| 2089 | + * @prop {String|Array} behavior='flip' | |
| 2090 | + * The behavior used to change the popper's placement. It can be one of | |
| 2091 | + * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid | |
| 2092 | + * placements (with optional variations). | |
| 2093 | + */ | |
| 2094 | + behavior: 'flip', | |
| 2095 | + /** | |
| 2096 | + * @prop {number} padding=5 | |
| 2097 | + * The popper will flip if it hits the edges of the `boundariesElement` | |
| 2098 | + */ | |
| 2099 | + padding: 5, | |
| 2100 | + /** | |
| 2101 | + * @prop {String|HTMLElement} boundariesElement='viewport' | |
| 2102 | + * The element which will define the boundaries of the popper position, | |
| 2103 | + * the popper will never be placed outside of the defined boundaries | |
| 2104 | + * (except if keepTogether is enabled) | |
| 2105 | + */ | |
| 2106 | + boundariesElement: 'viewport' | |
| 2107 | + }, | |
| 2108 | + | |
| 2109 | + /** | |
| 2110 | + * Modifier used to make the popper flow toward the inner of the reference element. | |
| 2111 | + * By default, when this modifier is disabled, the popper will be placed outside | |
| 2112 | + * the reference element. | |
| 2113 | + * @memberof modifiers | |
| 2114 | + * @inner | |
| 2115 | + */ | |
| 2116 | + inner: { | |
| 2117 | + /** @prop {number} order=700 - Index used to define the order of execution */ | |
| 2118 | + order: 700, | |
| 2119 | + /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ | |
| 2120 | + enabled: false, | |
| 2121 | + /** @prop {ModifierFn} */ | |
| 2122 | + fn: inner | |
| 2123 | + }, | |
| 2124 | + | |
| 2125 | + /** | |
| 2126 | + * Modifier used to hide the popper when its reference element is outside of the | |
| 2127 | + * popper boundaries. It will set a `x-out-of-boundaries` attribute which can | |
| 2128 | + * be used to hide with a CSS selector the popper when its reference is | |
| 2129 | + * out of boundaries. | |
| 2130 | + * | |
| 2131 | + * Requires the `preventOverflow` modifier before it in order to work. | |
| 2132 | + * @memberof modifiers | |
| 2133 | + * @inner | |
| 2134 | + */ | |
| 2135 | + hide: { | |
| 2136 | + /** @prop {number} order=800 - Index used to define the order of execution */ | |
| 2137 | + order: 800, | |
| 2138 | + /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ | |
| 2139 | + enabled: true, | |
| 2140 | + /** @prop {ModifierFn} */ | |
| 2141 | + fn: hide | |
| 2142 | + }, | |
| 2143 | + | |
| 2144 | + /** | |
| 2145 | + * Computes the style that will be applied to the popper element to gets | |
| 2146 | + * properly positioned. | |
| 2147 | + * | |
| 2148 | + * Note that this modifier will not touch the DOM, it just prepares the styles | |
| 2149 | + * so that `applyStyle` modifier can apply it. This separation is useful | |
| 2150 | + * in case you need to replace `applyStyle` with a custom implementation. | |
| 2151 | + * | |
| 2152 | + * This modifier has `850` as `order` value to maintain backward compatibility | |
| 2153 | + * with previous versions of Popper.js. Expect the modifiers ordering method | |
| 2154 | + * to change in future major versions of the library. | |
| 2155 | + * | |
| 2156 | + * @memberof modifiers | |
| 2157 | + * @inner | |
| 2158 | + */ | |
| 2159 | + computeStyle: { | |
| 2160 | + /** @prop {number} order=850 - Index used to define the order of execution */ | |
| 2161 | + order: 850, | |
| 2162 | + /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ | |
| 2163 | + enabled: true, | |
| 2164 | + /** @prop {ModifierFn} */ | |
| 2165 | + fn: computeStyle, | |
| 2166 | + /** | |
| 2167 | + * @prop {Boolean} gpuAcceleration=true | |
| 2168 | + * If true, it uses the CSS 3d transformation to position the popper. | |
| 2169 | + * Otherwise, it will use the `top` and `left` properties. | |
| 2170 | + */ | |
| 2171 | + gpuAcceleration: true, | |
| 2172 | + /** | |
| 2173 | + * @prop {string} [x='bottom'] | |
| 2174 | + * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. | |
| 2175 | + * Change this if your popper should grow in a direction different from `bottom` | |
| 2176 | + */ | |
| 2177 | + x: 'bottom', | |
| 2178 | + /** | |
| 2179 | + * @prop {string} [x='left'] | |
| 2180 | + * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. | |
| 2181 | + * Change this if your popper should grow in a direction different from `right` | |
| 2182 | + */ | |
| 2183 | + y: 'right' | |
| 2184 | + }, | |
| 2185 | + | |
| 2186 | + /** | |
| 2187 | + * Applies the computed styles to the popper element. | |
| 2188 | + * | |
| 2189 | + * All the DOM manipulations are limited to this modifier. This is useful in case | |
| 2190 | + * you want to integrate Popper.js inside a framework or view library and you | |
| 2191 | + * want to delegate all the DOM manipulations to it. | |
| 2192 | + * | |
| 2193 | + * Note that if you disable this modifier, you must make sure the popper element | |
| 2194 | + * has its position set to `absolute` before Popper.js can do its work! | |
| 2195 | + * | |
| 2196 | + * Just disable this modifier and define you own to achieve the desired effect. | |
| 2197 | + * | |
| 2198 | + * @memberof modifiers | |
| 2199 | + * @inner | |
| 2200 | + */ | |
| 2201 | + applyStyle: { | |
| 2202 | + /** @prop {number} order=900 - Index used to define the order of execution */ | |
| 2203 | + order: 900, | |
| 2204 | + /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ | |
| 2205 | + enabled: true, | |
| 2206 | + /** @prop {ModifierFn} */ | |
| 2207 | + fn: applyStyle, | |
| 2208 | + /** @prop {Function} */ | |
| 2209 | + onLoad: applyStyleOnLoad, | |
| 2210 | + /** | |
| 2211 | + * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier | |
| 2212 | + * @prop {Boolean} gpuAcceleration=true | |
| 2213 | + * If true, it uses the CSS 3d transformation to position the popper. | |
| 2214 | + * Otherwise, it will use the `top` and `left` properties. | |
| 2215 | + */ | |
| 2216 | + gpuAcceleration: undefined | |
| 2217 | + } | |
| 2218 | +}; | |
| 2219 | + | |
| 2220 | +/** | |
| 2221 | + * The `dataObject` is an object containing all the informations used by Popper.js | |
| 2222 | + * this object get passed to modifiers and to the `onCreate` and `onUpdate` callbacks. | |
| 2223 | + * @name dataObject | |
| 2224 | + * @property {Object} data.instance The Popper.js instance | |
| 2225 | + * @property {String} data.placement Placement applied to popper | |
| 2226 | + * @property {String} data.originalPlacement Placement originally defined on init | |
| 2227 | + * @property {Boolean} data.flipped True if popper has been flipped by flip modifier | |
| 2228 | + * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper. | |
| 2229 | + * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier | |
| 2230 | + * @property {Object} data.styles Any CSS property defined here will be applied to the popper, it expects the JavaScript nomenclature (eg. `marginBottom`) | |
| 2231 | + * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow, it expects the JavaScript nomenclature (eg. `marginBottom`) | |
| 2232 | + * @property {Object} data.boundaries Offsets of the popper boundaries | |
| 2233 | + * @property {Object} data.offsets The measurements of popper, reference and arrow elements. | |
| 2234 | + * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values | |
| 2235 | + * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values | |
| 2236 | + * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 | |
| 2237 | + */ | |
| 2238 | + | |
| 2239 | +/** | |
| 2240 | + * Default options provided to Popper.js constructor.<br /> | |
| 2241 | + * These can be overriden using the `options` argument of Popper.js.<br /> | |
| 2242 | + * To override an option, simply pass as 3rd argument an object with the same | |
| 2243 | + * structure of this object, example: | |
| 2244 | + * ``` | |
| 2245 | + * new Popper(ref, pop, { | |
| 2246 | + * modifiers: { | |
| 2247 | + * preventOverflow: { enabled: false } | |
| 2248 | + * } | |
| 2249 | + * }) | |
| 2250 | + * ``` | |
| 2251 | + * @type {Object} | |
| 2252 | + * @static | |
| 2253 | + * @memberof Popper | |
| 2254 | + */ | |
| 2255 | +var Defaults = { | |
| 2256 | + /** | |
| 2257 | + * Popper's placement | |
| 2258 | + * @prop {Popper.placements} placement='bottom' | |
| 2259 | + */ | |
| 2260 | + placement: 'bottom', | |
| 2261 | + | |
| 2262 | + /** | |
| 2263 | + * Whether events (resize, scroll) are initially enabled | |
| 2264 | + * @prop {Boolean} eventsEnabled=true | |
| 2265 | + */ | |
| 2266 | + eventsEnabled: true, | |
| 2267 | + | |
| 2268 | + /** | |
| 2269 | + * Set to true if you want to automatically remove the popper when | |
| 2270 | + * you call the `destroy` method. | |
| 2271 | + * @prop {Boolean} removeOnDestroy=false | |
| 2272 | + */ | |
| 2273 | + removeOnDestroy: false, | |
| 2274 | + | |
| 2275 | + /** | |
| 2276 | + * Callback called when the popper is created.<br /> | |
| 2277 | + * By default, is set to no-op.<br /> | |
| 2278 | + * Access Popper.js instance with `data.instance`. | |
| 2279 | + * @prop {onCreate} | |
| 2280 | + */ | |
| 2281 | + onCreate: function onCreate() {}, | |
| 2282 | + | |
| 2283 | + /** | |
| 2284 | + * Callback called when the popper is updated, this callback is not called | |
| 2285 | + * on the initialization/creation of the popper, but only on subsequent | |
| 2286 | + * updates.<br /> | |
| 2287 | + * By default, is set to no-op.<br /> | |
| 2288 | + * Access Popper.js instance with `data.instance`. | |
| 2289 | + * @prop {onUpdate} | |
| 2290 | + */ | |
| 2291 | + onUpdate: function onUpdate() {}, | |
| 2292 | + | |
| 2293 | + /** | |
| 2294 | + * List of modifiers used to modify the offsets before they are applied to the popper. | |
| 2295 | + * They provide most of the functionalities of Popper.js | |
| 2296 | + * @prop {modifiers} | |
| 2297 | + */ | |
| 2298 | + modifiers: modifiers | |
| 2299 | +}; | |
| 2300 | + | |
| 2301 | +/** | |
| 2302 | + * @callback onCreate | |
| 2303 | + * @param {dataObject} data | |
| 2304 | + */ | |
| 2305 | + | |
| 2306 | +/** | |
| 2307 | + * @callback onUpdate | |
| 2308 | + * @param {dataObject} data | |
| 2309 | + */ | |
| 2310 | + | |
| 2311 | +// Utils | |
| 2312 | +// Methods | |
| 2313 | +var Popper = function () { | |
| 2314 | + /** | |
| 2315 | + * Create a new Popper.js instance | |
| 2316 | + * @class Popper | |
| 2317 | + * @param {HTMLElement|referenceObject} reference - The reference element used to position the popper | |
| 2318 | + * @param {HTMLElement} popper - The HTML element used as popper. | |
| 2319 | + * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) | |
| 2320 | + * @return {Object} instance - The generated Popper.js instance | |
| 2321 | + */ | |
| 2322 | + function Popper(reference, popper) { | |
| 2323 | + var _this = this; | |
| 2324 | + | |
| 2325 | + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | |
| 2326 | + classCallCheck(this, Popper); | |
| 2327 | + | |
| 2328 | + this.scheduleUpdate = function () { | |
| 2329 | + return requestAnimationFrame(_this.update); | |
| 2330 | + }; | |
| 2331 | + | |
| 2332 | + // make update() debounced, so that it only runs at most once-per-tick | |
| 2333 | + this.update = debounce(this.update.bind(this)); | |
| 2334 | + | |
| 2335 | + // with {} we create a new object with the options inside it | |
| 2336 | + this.options = _extends({}, Popper.Defaults, options); | |
| 2337 | + | |
| 2338 | + // init state | |
| 2339 | + this.state = { | |
| 2340 | + isDestroyed: false, | |
| 2341 | + isCreated: false, | |
| 2342 | + scrollParents: [] | |
| 2343 | + }; | |
| 2344 | + | |
| 2345 | + // get reference and popper elements (allow jQuery wrappers) | |
| 2346 | + this.reference = reference.jquery ? reference[0] : reference; | |
| 2347 | + this.popper = popper.jquery ? popper[0] : popper; | |
| 2348 | + | |
| 2349 | + // Deep merge modifiers options | |
| 2350 | + this.options.modifiers = {}; | |
| 2351 | + Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { | |
| 2352 | + _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); | |
| 2353 | + }); | |
| 2354 | + | |
| 2355 | + // Refactoring modifiers' list (Object => Array) | |
| 2356 | + this.modifiers = Object.keys(this.options.modifiers).map(function (name) { | |
| 2357 | + return _extends({ | |
| 2358 | + name: name | |
| 2359 | + }, _this.options.modifiers[name]); | |
| 2360 | + }) | |
| 2361 | + // sort the modifiers by order | |
| 2362 | + .sort(function (a, b) { | |
| 2363 | + return a.order - b.order; | |
| 2364 | + }); | |
| 2365 | + | |
| 2366 | + // modifiers have the ability to execute arbitrary code when Popper.js get inited | |
| 2367 | + // such code is executed in the same order of its modifier | |
| 2368 | + // they could add new properties to their options configuration | |
| 2369 | + // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! | |
| 2370 | + this.modifiers.forEach(function (modifierOptions) { | |
| 2371 | + if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { | |
| 2372 | + modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); | |
| 2373 | + } | |
| 2374 | + }); | |
| 2375 | + | |
| 2376 | + // fire the first update to position the popper in the right place | |
| 2377 | + this.update(); | |
| 2378 | + | |
| 2379 | + var eventsEnabled = this.options.eventsEnabled; | |
| 2380 | + if (eventsEnabled) { | |
| 2381 | + // setup event listeners, they will take care of update the position in specific situations | |
| 2382 | + this.enableEventListeners(); | |
| 2383 | + } | |
| 2384 | + | |
| 2385 | + this.state.eventsEnabled = eventsEnabled; | |
| 2386 | + } | |
| 2387 | + | |
| 2388 | + // We can't use class properties because they don't get listed in the | |
| 2389 | + // class prototype and break stuff like Sinon stubs | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + createClass(Popper, [{ | |
| 2393 | + key: 'update', | |
| 2394 | + value: function update$$1() { | |
| 2395 | + return update.call(this); | |
| 2396 | + } | |
| 2397 | + }, { | |
| 2398 | + key: 'destroy', | |
| 2399 | + value: function destroy$$1() { | |
| 2400 | + return destroy.call(this); | |
| 2401 | + } | |
| 2402 | + }, { | |
| 2403 | + key: 'enableEventListeners', | |
| 2404 | + value: function enableEventListeners$$1() { | |
| 2405 | + return enableEventListeners.call(this); | |
| 2406 | + } | |
| 2407 | + }, { | |
| 2408 | + key: 'disableEventListeners', | |
| 2409 | + value: function disableEventListeners$$1() { | |
| 2410 | + return disableEventListeners.call(this); | |
| 2411 | + } | |
| 2412 | + | |
| 2413 | + /** | |
| 2414 | + * Schedule an update, it will run on the next UI update available | |
| 2415 | + * @method scheduleUpdate | |
| 2416 | + * @memberof Popper | |
| 2417 | + */ | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + /** | |
| 2421 | + * Collection of utilities useful when writing custom modifiers. | |
| 2422 | + * Starting from version 1.7, this method is available only if you | |
| 2423 | + * include `popper-utils.js` before `popper.js`. | |
| 2424 | + * | |
| 2425 | + * **DEPRECATION**: This way to access PopperUtils is deprecated | |
| 2426 | + * and will be removed in v2! Use the PopperUtils module directly instead. | |
| 2427 | + * Due to the high instability of the methods contained in Utils, we can't | |
| 2428 | + * guarantee them to follow semver. Use them at your own risk! | |
| 2429 | + * @static | |
| 2430 | + * @private | |
| 2431 | + * @type {Object} | |
| 2432 | + * @deprecated since version 1.8 | |
| 2433 | + * @member Utils | |
| 2434 | + * @memberof Popper | |
| 2435 | + */ | |
| 2436 | + | |
| 2437 | + }]); | |
| 2438 | + return Popper; | |
| 2439 | +}(); | |
| 2440 | + | |
| 2441 | +/** | |
| 2442 | + * The `referenceObject` is an object that provides an interface compatible with Popper.js | |
| 2443 | + * and lets you use it as replacement of a real DOM node.<br /> | |
| 2444 | + * You can use this method to position a popper relatively to a set of coordinates | |
| 2445 | + * in case you don't have a DOM node to use as reference. | |
| 2446 | + * | |
| 2447 | + * ``` | |
| 2448 | + * new Popper(referenceObject, popperNode); | |
| 2449 | + * ``` | |
| 2450 | + * | |
| 2451 | + * NB: This feature isn't supported in Internet Explorer 10 | |
| 2452 | + * @name referenceObject | |
| 2453 | + * @property {Function} data.getBoundingClientRect | |
| 2454 | + * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. | |
| 2455 | + * @property {number} data.clientWidth | |
| 2456 | + * An ES6 getter that will return the width of the virtual reference element. | |
| 2457 | + * @property {number} data.clientHeight | |
| 2458 | + * An ES6 getter that will return the height of the virtual reference element. | |
| 2459 | + */ | |
| 2460 | + | |
| 2461 | + | |
| 2462 | +Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; | |
| 2463 | +Popper.placements = placements; | |
| 2464 | +Popper.Defaults = Defaults; | |
| 2465 | + | |
| 2466 | +return Popper; | |
| 2467 | + | |
| 2468 | +}))); | |
| 2469 | +//# sourceMappingURL=popper.js.map | |
| 2470 | + | |
| 2471 | +/** | |
| 2472 | + * -------------------------------------------------------------------------- | |
| 2473 | + * Bootstrap (v4.0.0-beta): util.js | |
| 2474 | + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) | |
| 2475 | + * -------------------------------------------------------------------------- | |
| 2476 | + */ | |
| 2477 | + | |
| 2478 | +var Util = function ($) { | |
| 2479 | + | |
| 2480 | + /** | |
| 2481 | + * ------------------------------------------------------------------------ | |
| 2482 | + * Private TransitionEnd Helpers | |
| 2483 | + * ------------------------------------------------------------------------ | |
| 2484 | + */ | |
| 2485 | + | |
| 2486 | + var transition = false; | |
| 2487 | + | |
| 2488 | + var MAX_UID = 1000000; | |
| 2489 | + | |
| 2490 | + var TransitionEndEvent = { | |
| 2491 | + WebkitTransition: 'webkitTransitionEnd', | |
| 2492 | + MozTransition: 'transitionend', | |
| 2493 | + OTransition: 'oTransitionEnd otransitionend', | |
| 2494 | + transition: 'transitionend' | |
| 2495 | + | |
| 2496 | + // shoutout AngusCroll (https://goo.gl/pxwQGp) | |
| 2497 | + };function toType(obj) { | |
| 2498 | + return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase(); | |
| 2499 | + } | |
| 2500 | + | |
| 2501 | + function isElement(obj) { | |
| 2502 | + return (obj[0] || obj).nodeType; | |
| 2503 | + } | |
| 2504 | + | |
| 2505 | + function getSpecialTransitionEndEvent() { | |
| 2506 | + return { | |
| 2507 | + bindType: transition.end, | |
| 2508 | + delegateType: transition.end, | |
| 2509 | + handle: function handle(event) { | |
| 2510 | + if ($(event.target).is(this)) { | |
| 2511 | + return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params | |
| 2512 | + } | |
| 2513 | + return undefined; | |
| 2514 | + } | |
| 2515 | + }; | |
| 2516 | + } | |
| 2517 | + | |
| 2518 | + function transitionEndTest() { | |
| 2519 | + if (window.QUnit) { | |
| 2520 | + return false; | |
| 2521 | + } | |
| 2522 | + | |
| 2523 | + var el = document.createElement('bootstrap'); | |
| 2524 | + | |
| 2525 | + for (var name in TransitionEndEvent) { | |
| 2526 | + if (el.style[name] !== undefined) { | |
| 2527 | + return { | |
| 2528 | + end: TransitionEndEvent[name] | |
| 2529 | + }; | |
| 2530 | + } | |
| 2531 | + } | |
| 2532 | + | |
| 2533 | + return false; | |
| 2534 | + } | |
| 2535 | + | |
| 2536 | + function transitionEndEmulator(duration) { | |
| 2537 | + var _this = this; | |
| 2538 | + | |
| 2539 | + var called = false; | |
| 2540 | + | |
| 2541 | + $(this).one(Util.TRANSITION_END, function () { | |
| 2542 | + called = true; | |
| 2543 | + }); | |
| 2544 | + | |
| 2545 | + setTimeout(function () { | |
| 2546 | + if (!called) { | |
| 2547 | + Util.triggerTransitionEnd(_this); | |
| 2548 | + } | |
| 2549 | + }, duration); | |
| 2550 | + | |
| 2551 | + return this; | |
| 2552 | + } | |
| 2553 | + | |
| 2554 | + function setTransitionEndSupport() { | |
| 2555 | + transition = transitionEndTest(); | |
| 2556 | + | |
| 2557 | + $.fn.emulateTransitionEnd = transitionEndEmulator; | |
| 2558 | + | |
| 2559 | + if (Util.supportsTransitionEnd()) { | |
| 2560 | + $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); | |
| 2561 | + } | |
| 2562 | + } | |
| 2563 | + | |
| 2564 | + /** | |
| 2565 | + * -------------------------------------------------------------------------- | |
| 2566 | + * Public Util Api | |
| 2567 | + * -------------------------------------------------------------------------- | |
| 2568 | + */ | |
| 2569 | + | |
| 2570 | + var Util = { | |
| 2571 | + | |
| 2572 | + TRANSITION_END: 'bsTransitionEnd', | |
| 2573 | + | |
| 2574 | + getUID: function getUID(prefix) { | |
| 2575 | + do { | |
| 2576 | + // eslint-disable-next-line no-bitwise | |
| 2577 | + prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here | |
| 2578 | + } while (document.getElementById(prefix)); | |
| 2579 | + return prefix; | |
| 2580 | + }, | |
| 2581 | + getSelectorFromElement: function getSelectorFromElement(element) { | |
| 2582 | + var selector = element.getAttribute('data-target'); | |
| 2583 | + if (!selector || selector === '#') { | |
| 2584 | + selector = element.getAttribute('href') || ''; | |
| 2585 | + } | |
| 2586 | + | |
| 2587 | + try { | |
| 2588 | + var $selector = $(selector); | |
| 2589 | + return $selector.length > 0 ? selector : null; | |
| 2590 | + } catch (error) { | |
| 2591 | + return null; | |
| 2592 | + } | |
| 2593 | + }, | |
| 2594 | + reflow: function reflow(element) { | |
| 2595 | + return element.offsetHeight; | |
| 2596 | + }, | |
| 2597 | + triggerTransitionEnd: function triggerTransitionEnd(element) { | |
| 2598 | + $(element).trigger(transition.end); | |
| 2599 | + }, | |
| 2600 | + supportsTransitionEnd: function supportsTransitionEnd() { | |
| 2601 | + return Boolean(transition); | |
| 2602 | + }, | |
| 2603 | + typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { | |
| 2604 | + for (var property in configTypes) { | |
| 2605 | + if (configTypes.hasOwnProperty(property)) { | |
| 2606 | + var expectedTypes = configTypes[property]; | |
| 2607 | + var value = config[property]; | |
| 2608 | + var valueType = value && isElement(value) ? 'element' : toType(value); | |
| 2609 | + | |
| 2610 | + if (!new RegExp(expectedTypes).test(valueType)) { | |
| 2611 | + throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".')); | |
| 2612 | + } | |
| 2613 | + } | |
| 2614 | + } | |
| 2615 | + } | |
| 2616 | + }; | |
| 2617 | + | |
| 2618 | + setTransitionEndSupport(); | |
| 2619 | + | |
| 2620 | + return Util; | |
| 2621 | +}(jQuery); | |
| 2622 | +//# sourceMappingURL=util.js.map | |
| 2623 | +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
| 2624 | + | |
| 2625 | +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | |
| 2626 | + | |
| 2627 | +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
| 2628 | + | |
| 2629 | +/** | |
| 2630 | + * -------------------------------------------------------------------------- | |
| 2631 | + * Bootstrap (v4.0.0-beta): tooltip.js | |
| 2632 | + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) | |
| 2633 | + * -------------------------------------------------------------------------- | |
| 2634 | + */ | |
| 2635 | + | |
| 2636 | +var Tooltip = function ($) { | |
| 2637 | + | |
| 2638 | + /** | |
| 2639 | + * Check for Popper dependency | |
| 2640 | + * Popper - https://popper.js.org | |
| 2641 | + */ | |
| 2642 | + if (typeof Popper === 'undefined') { | |
| 2643 | + throw new Error('Bootstrap tooltips require Popper.js (https://popper.js.org)'); | |
| 2644 | + } | |
| 2645 | + | |
| 2646 | + /** | |
| 2647 | + * ------------------------------------------------------------------------ | |
| 2648 | + * Constants | |
| 2649 | + * ------------------------------------------------------------------------ | |
| 2650 | + */ | |
| 2651 | + | |
| 2652 | + var NAME = 'tooltip'; | |
| 2653 | + var VERSION = '4.0.0-beta'; | |
| 2654 | + var DATA_KEY = 'bs.tooltip'; | |
| 2655 | + var EVENT_KEY = '.' + DATA_KEY; | |
| 2656 | + var JQUERY_NO_CONFLICT = $.fn[NAME]; | |
| 2657 | + var TRANSITION_DURATION = 150; | |
| 2658 | + var CLASS_PREFIX = 'bs-tooltip'; | |
| 2659 | + var BSCLS_PREFIX_REGEX = new RegExp('(^|\\s)' + CLASS_PREFIX + '\\S+', 'g'); | |
| 2660 | + | |
| 2661 | + var DefaultType = { | |
| 2662 | + animation: 'boolean', | |
| 2663 | + template: 'string', | |
| 2664 | + title: '(string|element|function)', | |
| 2665 | + trigger: 'string', | |
| 2666 | + delay: '(number|object)', | |
| 2667 | + html: 'boolean', | |
| 2668 | + selector: '(string|boolean)', | |
| 2669 | + placement: '(string|function)', | |
| 2670 | + offset: '(number|string)', | |
| 2671 | + container: '(string|element|boolean)', | |
| 2672 | + fallbackPlacement: '(string|array)' | |
| 2673 | + }; | |
| 2674 | + | |
| 2675 | + var AttachmentMap = { | |
| 2676 | + AUTO: 'auto', | |
| 2677 | + TOP: 'top', | |
| 2678 | + RIGHT: 'right', | |
| 2679 | + BOTTOM: 'bottom', | |
| 2680 | + LEFT: 'left' | |
| 2681 | + }; | |
| 2682 | + | |
| 2683 | + var Default = { | |
| 2684 | + animation: true, | |
| 2685 | + template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', | |
| 2686 | + trigger: 'hover focus', | |
| 2687 | + title: '', | |
| 2688 | + delay: 0, | |
| 2689 | + html: false, | |
| 2690 | + selector: false, | |
| 2691 | + placement: 'top', | |
| 2692 | + offset: 0, | |
| 2693 | + container: false, | |
| 2694 | + fallbackPlacement: 'flip' | |
| 2695 | + }; | |
| 2696 | + | |
| 2697 | + var HoverState = { | |
| 2698 | + SHOW: 'show', | |
| 2699 | + OUT: 'out' | |
| 2700 | + }; | |
| 2701 | + | |
| 2702 | + var Event = { | |
| 2703 | + HIDE: 'hide' + EVENT_KEY, | |
| 2704 | + HIDDEN: 'hidden' + EVENT_KEY, | |
| 2705 | + SHOW: 'show' + EVENT_KEY, | |
| 2706 | + SHOWN: 'shown' + EVENT_KEY, | |
| 2707 | + INSERTED: 'inserted' + EVENT_KEY, | |
| 2708 | + CLICK: 'click' + EVENT_KEY, | |
| 2709 | + FOCUSIN: 'focusin' + EVENT_KEY, | |
| 2710 | + FOCUSOUT: 'focusout' + EVENT_KEY, | |
| 2711 | + MOUSEENTER: 'mouseenter' + EVENT_KEY, | |
| 2712 | + MOUSELEAVE: 'mouseleave' + EVENT_KEY | |
| 2713 | + }; | |
| 2714 | + | |
| 2715 | + var ClassName = { | |
| 2716 | + FADE: 'fade', | |
| 2717 | + SHOW: 'show' | |
| 2718 | + }; | |
| 2719 | + | |
| 2720 | + var Selector = { | |
| 2721 | + TOOLTIP: '.tooltip', | |
| 2722 | + TOOLTIP_INNER: '.tooltip-inner', | |
| 2723 | + ARROW: '.arrow' | |
| 2724 | + }; | |
| 2725 | + | |
| 2726 | + var Trigger = { | |
| 2727 | + HOVER: 'hover', | |
| 2728 | + FOCUS: 'focus', | |
| 2729 | + CLICK: 'click', | |
| 2730 | + MANUAL: 'manual' | |
| 2731 | + | |
| 2732 | + /** | |
| 2733 | + * ------------------------------------------------------------------------ | |
| 2734 | + * Class Definition | |
| 2735 | + * ------------------------------------------------------------------------ | |
| 2736 | + */ | |
| 2737 | + | |
| 2738 | + }; | |
| 2739 | + var Tooltip = function () { | |
| 2740 | + function Tooltip(element, config) { | |
| 2741 | + _classCallCheck(this, Tooltip); | |
| 2742 | + | |
| 2743 | + // private | |
| 2744 | + this._isEnabled = true; | |
| 2745 | + this._timeout = 0; | |
| 2746 | + this._hoverState = ''; | |
| 2747 | + this._activeTrigger = {}; | |
| 2748 | + this._popper = null; | |
| 2749 | + | |
| 2750 | + // protected | |
| 2751 | + this.element = element; | |
| 2752 | + this.config = this._getConfig(config); | |
| 2753 | + this.tip = null; | |
| 2754 | + | |
| 2755 | + this._setListeners(); | |
| 2756 | + } | |
| 2757 | + | |
| 2758 | + // getters | |
| 2759 | + | |
| 2760 | + // public | |
| 2761 | + | |
| 2762 | + Tooltip.prototype.enable = function enable() { | |
| 2763 | + this._isEnabled = true; | |
| 2764 | + }; | |
| 2765 | + | |
| 2766 | + Tooltip.prototype.disable = function disable() { | |
| 2767 | + this._isEnabled = false; | |
| 2768 | + }; | |
| 2769 | + | |
| 2770 | + Tooltip.prototype.toggleEnabled = function toggleEnabled() { | |
| 2771 | + this._isEnabled = !this._isEnabled; | |
| 2772 | + }; | |
| 2773 | + | |
| 2774 | + Tooltip.prototype.toggle = function toggle(event) { | |
| 2775 | + if (event) { | |
| 2776 | + var dataKey = this.constructor.DATA_KEY; | |
| 2777 | + var context = $(event.currentTarget).data(dataKey); | |
| 2778 | + | |
| 2779 | + if (!context) { | |
| 2780 | + context = new this.constructor(event.currentTarget, this._getDelegateConfig()); | |
| 2781 | + $(event.currentTarget).data(dataKey, context); | |
| 2782 | + } | |
| 2783 | + | |
| 2784 | + context._activeTrigger.click = !context._activeTrigger.click; | |
| 2785 | + | |
| 2786 | + if (context._isWithActiveTrigger()) { | |
| 2787 | + context._enter(null, context); | |
| 2788 | + } else { | |
| 2789 | + context._leave(null, context); | |
| 2790 | + } | |
| 2791 | + } else { | |
| 2792 | + | |
| 2793 | + if ($(this.getTipElement()).hasClass(ClassName.SHOW)) { | |
| 2794 | + this._leave(null, this); | |
| 2795 | + return; | |
| 2796 | + } | |
| 2797 | + | |
| 2798 | + this._enter(null, this); | |
| 2799 | + } | |
| 2800 | + }; | |
| 2801 | + | |
| 2802 | + Tooltip.prototype.dispose = function dispose() { | |
| 2803 | + clearTimeout(this._timeout); | |
| 2804 | + | |
| 2805 | + $.removeData(this.element, this.constructor.DATA_KEY); | |
| 2806 | + | |
| 2807 | + $(this.element).off(this.constructor.EVENT_KEY); | |
| 2808 | + $(this.element).closest('.modal').off('hide.bs.modal'); | |
| 2809 | + | |
| 2810 | + if (this.tip) { | |
| 2811 | + $(this.tip).remove(); | |
| 2812 | + } | |
| 2813 | + | |
| 2814 | + this._isEnabled = null; | |
| 2815 | + this._timeout = null; | |
| 2816 | + this._hoverState = null; | |
| 2817 | + this._activeTrigger = null; | |
| 2818 | + if (this._popper !== null) { | |
| 2819 | + this._popper.destroy(); | |
| 2820 | + } | |
| 2821 | + this._popper = null; | |
| 2822 | + | |
| 2823 | + this.element = null; | |
| 2824 | + this.config = null; | |
| 2825 | + this.tip = null; | |
| 2826 | + }; | |
| 2827 | + | |
| 2828 | + Tooltip.prototype.show = function show() { | |
| 2829 | + var _this = this; | |
| 2830 | + | |
| 2831 | + if ($(this.element).css('display') === 'none') { | |
| 2832 | + throw new Error('Please use show on visible elements'); | |
| 2833 | + } | |
| 2834 | + | |
| 2835 | + var showEvent = $.Event(this.constructor.Event.SHOW); | |
| 2836 | + if (this.isWithContent() && this._isEnabled) { | |
| 2837 | + $(this.element).trigger(showEvent); | |
| 2838 | + | |
| 2839 | + var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element); | |
| 2840 | + | |
| 2841 | + if (showEvent.isDefaultPrevented() || !isInTheDom) { | |
| 2842 | + return; | |
| 2843 | + } | |
| 2844 | + | |
| 2845 | + var tip = this.getTipElement(); | |
| 2846 | + var tipId = Util.getUID(this.constructor.NAME); | |
| 2847 | + | |
| 2848 | + tip.setAttribute('id', tipId); | |
| 2849 | + this.element.setAttribute('aria-describedby', tipId); | |
| 2850 | + | |
| 2851 | + this.setContent(); | |
| 2852 | + | |
| 2853 | + if (this.config.animation) { | |
| 2854 | + $(tip).addClass(ClassName.FADE); | |
| 2855 | + } | |
| 2856 | + | |
| 2857 | + var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; | |
| 2858 | + | |
| 2859 | + var attachment = this._getAttachment(placement); | |
| 2860 | + this.addAttachmentClass(attachment); | |
| 2861 | + | |
| 2862 | + var container = this.config.container === false ? document.body : $(this.config.container); | |
| 2863 | + | |
| 2864 | + $(tip).data(this.constructor.DATA_KEY, this); | |
| 2865 | + | |
| 2866 | + if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) { | |
| 2867 | + $(tip).appendTo(container); | |
| 2868 | + } | |
| 2869 | + | |
| 2870 | + $(this.element).trigger(this.constructor.Event.INSERTED); | |
| 2871 | + | |
| 2872 | + this._popper = new Popper(this.element, tip, { | |
| 2873 | + placement: attachment, | |
| 2874 | + modifiers: { | |
| 2875 | + offset: { | |
| 2876 | + offset: this.config.offset | |
| 2877 | + }, | |
| 2878 | + flip: { | |
| 2879 | + behavior: this.config.fallbackPlacement | |
| 2880 | + }, | |
| 2881 | + arrow: { | |
| 2882 | + element: Selector.ARROW | |
| 2883 | + } | |
| 2884 | + }, | |
| 2885 | + onCreate: function onCreate(data) { | |
| 2886 | + if (data.originalPlacement !== data.placement) { | |
| 2887 | + _this._handlePopperPlacementChange(data); | |
| 2888 | + } | |
| 2889 | + }, | |
| 2890 | + onUpdate: function onUpdate(data) { | |
| 2891 | + _this._handlePopperPlacementChange(data); | |
| 2892 | + } | |
| 2893 | + }); | |
| 2894 | + | |
| 2895 | + $(tip).addClass(ClassName.SHOW); | |
| 2896 | + | |
| 2897 | + // if this is a touch-enabled device we add extra | |
| 2898 | + // empty mouseover listeners to the body's immediate children; | |
| 2899 | + // only needed because of broken event delegation on iOS | |
| 2900 | + // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html | |
| 2901 | + if ('ontouchstart' in document.documentElement) { | |
| 2902 | + $('body').children().on('mouseover', null, $.noop); | |
| 2903 | + } | |
| 2904 | + | |
| 2905 | + var complete = function complete() { | |
| 2906 | + if (_this.config.animation) { | |
| 2907 | + _this._fixTransition(); | |
| 2908 | + } | |
| 2909 | + var prevHoverState = _this._hoverState; | |
| 2910 | + _this._hoverState = null; | |
| 2911 | + | |
| 2912 | + $(_this.element).trigger(_this.constructor.Event.SHOWN); | |
| 2913 | + | |
| 2914 | + if (prevHoverState === HoverState.OUT) { | |
| 2915 | + _this._leave(null, _this); | |
| 2916 | + } | |
| 2917 | + }; | |
| 2918 | + | |
| 2919 | + if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) { | |
| 2920 | + $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION); | |
| 2921 | + } else { | |
| 2922 | + complete(); | |
| 2923 | + } | |
| 2924 | + } | |
| 2925 | + }; | |
| 2926 | + | |
| 2927 | + Tooltip.prototype.hide = function hide(callback) { | |
| 2928 | + var _this2 = this; | |
| 2929 | + | |
| 2930 | + var tip = this.getTipElement(); | |
| 2931 | + var hideEvent = $.Event(this.constructor.Event.HIDE); | |
| 2932 | + var complete = function complete() { | |
| 2933 | + if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) { | |
| 2934 | + tip.parentNode.removeChild(tip); | |
| 2935 | + } | |
| 2936 | + | |
| 2937 | + _this2._cleanTipClass(); | |
| 2938 | + _this2.element.removeAttribute('aria-describedby'); | |
| 2939 | + $(_this2.element).trigger(_this2.constructor.Event.HIDDEN); | |
| 2940 | + if (_this2._popper !== null) { | |
| 2941 | + _this2._popper.destroy(); | |
| 2942 | + } | |
| 2943 | + | |
| 2944 | + if (callback) { | |
| 2945 | + callback(); | |
| 2946 | + } | |
| 2947 | + }; | |
| 2948 | + | |
| 2949 | + $(this.element).trigger(hideEvent); | |
| 2950 | + | |
| 2951 | + if (hideEvent.isDefaultPrevented()) { | |
| 2952 | + return; | |
| 2953 | + } | |
| 2954 | + | |
| 2955 | + $(tip).removeClass(ClassName.SHOW); | |
| 2956 | + | |
| 2957 | + // if this is a touch-enabled device we remove the extra | |
| 2958 | + // empty mouseover listeners we added for iOS support | |
| 2959 | + if ('ontouchstart' in document.documentElement) { | |
| 2960 | + $('body').children().off('mouseover', null, $.noop); | |
| 2961 | + } | |
| 2962 | + | |
| 2963 | + this._activeTrigger[Trigger.CLICK] = false; | |
| 2964 | + this._activeTrigger[Trigger.FOCUS] = false; | |
| 2965 | + this._activeTrigger[Trigger.HOVER] = false; | |
| 2966 | + | |
| 2967 | + if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) { | |
| 2968 | + | |
| 2969 | + $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); | |
| 2970 | + } else { | |
| 2971 | + complete(); | |
| 2972 | + } | |
| 2973 | + | |
| 2974 | + this._hoverState = ''; | |
| 2975 | + }; | |
| 2976 | + | |
| 2977 | + Tooltip.prototype.update = function update() { | |
| 2978 | + if (this._popper !== null) { | |
| 2979 | + this._popper.scheduleUpdate(); | |
| 2980 | + } | |
| 2981 | + }; | |
| 2982 | + | |
| 2983 | + // protected | |
| 2984 | + | |
| 2985 | + Tooltip.prototype.isWithContent = function isWithContent() { | |
| 2986 | + return Boolean(this.getTitle()); | |
| 2987 | + }; | |
| 2988 | + | |
| 2989 | + Tooltip.prototype.addAttachmentClass = function addAttachmentClass(attachment) { | |
| 2990 | + $(this.getTipElement()).addClass(CLASS_PREFIX + '-' + attachment); | |
| 2991 | + }; | |
| 2992 | + | |
| 2993 | + Tooltip.prototype.getTipElement = function getTipElement() { | |
| 2994 | + return this.tip = this.tip || $(this.config.template)[0]; | |
| 2995 | + }; | |
| 2996 | + | |
| 2997 | + Tooltip.prototype.setContent = function setContent() { | |
| 2998 | + var $tip = $(this.getTipElement()); | |
| 2999 | + this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle()); | |
| 3000 | + $tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW); | |
| 3001 | + }; | |
| 3002 | + | |
| 3003 | + Tooltip.prototype.setElementContent = function setElementContent($element, content) { | |
| 3004 | + var html = this.config.html; | |
| 3005 | + if ((typeof content === 'undefined' ? 'undefined' : _typeof(content)) === 'object' && (content.nodeType || content.jquery)) { | |
| 3006 | + // content is a DOM node or a jQuery | |
| 3007 | + if (html) { | |
| 3008 | + if (!$(content).parent().is($element)) { | |
| 3009 | + $element.empty().append(content); | |
| 3010 | + } | |
| 3011 | + } else { | |
| 3012 | + $element.text($(content).text()); | |
| 3013 | + } | |
| 3014 | + } else { | |
| 3015 | + $element[html ? 'html' : 'text'](content); | |
| 3016 | + } | |
| 3017 | + }; | |
| 3018 | + | |
| 3019 | + Tooltip.prototype.getTitle = function getTitle() { | |
| 3020 | + var title = this.element.getAttribute('data-original-title'); | |
| 3021 | + | |
| 3022 | + if (!title) { | |
| 3023 | + title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; | |
| 3024 | + } | |
| 3025 | + | |
| 3026 | + return title; | |
| 3027 | + }; | |
| 3028 | + | |
| 3029 | + // private | |
| 3030 | + | |
| 3031 | + Tooltip.prototype._getAttachment = function _getAttachment(placement) { | |
| 3032 | + return AttachmentMap[placement.toUpperCase()]; | |
| 3033 | + }; | |
| 3034 | + | |
| 3035 | + Tooltip.prototype._setListeners = function _setListeners() { | |
| 3036 | + var _this3 = this; | |
| 3037 | + | |
| 3038 | + var triggers = this.config.trigger.split(' '); | |
| 3039 | + | |
| 3040 | + triggers.forEach(function (trigger) { | |
| 3041 | + if (trigger === 'click') { | |
| 3042 | + $(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, function (event) { | |
| 3043 | + return _this3.toggle(event); | |
| 3044 | + }); | |
| 3045 | + } else if (trigger !== Trigger.MANUAL) { | |
| 3046 | + var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN; | |
| 3047 | + var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT; | |
| 3048 | + | |
| 3049 | + $(_this3.element).on(eventIn, _this3.config.selector, function (event) { | |
| 3050 | + return _this3._enter(event); | |
| 3051 | + }).on(eventOut, _this3.config.selector, function (event) { | |
| 3052 | + return _this3._leave(event); | |
| 3053 | + }); | |
| 3054 | + } | |
| 3055 | + | |
| 3056 | + $(_this3.element).closest('.modal').on('hide.bs.modal', function () { | |
| 3057 | + return _this3.hide(); | |
| 3058 | + }); | |
| 3059 | + }); | |
| 3060 | + | |
| 3061 | + if (this.config.selector) { | |
| 3062 | + this.config = $.extend({}, this.config, { | |
| 3063 | + trigger: 'manual', | |
| 3064 | + selector: '' | |
| 3065 | + }); | |
| 3066 | + } else { | |
| 3067 | + this._fixTitle(); | |
| 3068 | + } | |
| 3069 | + }; | |
| 3070 | + | |
| 3071 | + Tooltip.prototype._fixTitle = function _fixTitle() { | |
| 3072 | + var titleType = _typeof(this.element.getAttribute('data-original-title')); | |
| 3073 | + if (this.element.getAttribute('title') || titleType !== 'string') { | |
| 3074 | + this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); | |
| 3075 | + this.element.setAttribute('title', ''); | |
| 3076 | + } | |
| 3077 | + }; | |
| 3078 | + | |
| 3079 | + Tooltip.prototype._enter = function _enter(event, context) { | |
| 3080 | + var dataKey = this.constructor.DATA_KEY; | |
| 3081 | + | |
| 3082 | + context = context || $(event.currentTarget).data(dataKey); | |
| 3083 | + | |
| 3084 | + if (!context) { | |
| 3085 | + context = new this.constructor(event.currentTarget, this._getDelegateConfig()); | |
| 3086 | + $(event.currentTarget).data(dataKey, context); | |
| 3087 | + } | |
| 3088 | + | |
| 3089 | + if (event) { | |
| 3090 | + context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; | |
| 3091 | + } | |
| 3092 | + | |
| 3093 | + if ($(context.getTipElement()).hasClass(ClassName.SHOW) || context._hoverState === HoverState.SHOW) { | |
| 3094 | + context._hoverState = HoverState.SHOW; | |
| 3095 | + return; | |
| 3096 | + } | |
| 3097 | + | |
| 3098 | + clearTimeout(context._timeout); | |
| 3099 | + | |
| 3100 | + context._hoverState = HoverState.SHOW; | |
| 3101 | + | |
| 3102 | + if (!context.config.delay || !context.config.delay.show) { | |
| 3103 | + context.show(); | |
| 3104 | + return; | |
| 3105 | + } | |
| 3106 | + | |
| 3107 | + context._timeout = setTimeout(function () { | |
| 3108 | + if (context._hoverState === HoverState.SHOW) { | |
| 3109 | + context.show(); | |
| 3110 | + } | |
| 3111 | + }, context.config.delay.show); | |
| 3112 | + }; | |
| 3113 | + | |
| 3114 | + Tooltip.prototype._leave = function _leave(event, context) { | |
| 3115 | + var dataKey = this.constructor.DATA_KEY; | |
| 3116 | + | |
| 3117 | + context = context || $(event.currentTarget).data(dataKey); | |
| 3118 | + | |
| 3119 | + if (!context) { | |
| 3120 | + context = new this.constructor(event.currentTarget, this._getDelegateConfig()); | |
| 3121 | + $(event.currentTarget).data(dataKey, context); | |
| 3122 | + } | |
| 3123 | + | |
| 3124 | + if (event) { | |
| 3125 | + context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false; | |
| 3126 | + } | |
| 3127 | + | |
| 3128 | + if (context._isWithActiveTrigger()) { | |
| 3129 | + return; | |
| 3130 | + } | |
| 3131 | + | |
| 3132 | + clearTimeout(context._timeout); | |
| 3133 | + | |
| 3134 | + context._hoverState = HoverState.OUT; | |
| 3135 | + | |
| 3136 | + if (!context.config.delay || !context.config.delay.hide) { | |
| 3137 | + context.hide(); | |
| 3138 | + return; | |
| 3139 | + } | |
| 3140 | + | |
| 3141 | + context._timeout = setTimeout(function () { | |
| 3142 | + if (context._hoverState === HoverState.OUT) { | |
| 3143 | + context.hide(); | |
| 3144 | + } | |
| 3145 | + }, context.config.delay.hide); | |
| 3146 | + }; | |
| 3147 | + | |
| 3148 | + Tooltip.prototype._isWithActiveTrigger = function _isWithActiveTrigger() { | |
| 3149 | + for (var trigger in this._activeTrigger) { | |
| 3150 | + if (this._activeTrigger[trigger]) { | |
| 3151 | + return true; | |
| 3152 | + } | |
| 3153 | + } | |
| 3154 | + | |
| 3155 | + return false; | |
| 3156 | + }; | |
| 3157 | + | |
| 3158 | + Tooltip.prototype._getConfig = function _getConfig(config) { | |
| 3159 | + config = $.extend({}, this.constructor.Default, $(this.element).data(), config); | |
| 3160 | + | |
| 3161 | + if (config.delay && typeof config.delay === 'number') { | |
| 3162 | + config.delay = { | |
| 3163 | + show: config.delay, | |
| 3164 | + hide: config.delay | |
| 3165 | + }; | |
| 3166 | + } | |
| 3167 | + | |
| 3168 | + if (config.title && typeof config.title === 'number') { | |
| 3169 | + config.title = config.title.toString(); | |
| 3170 | + } | |
| 3171 | + | |
| 3172 | + if (config.content && typeof config.content === 'number') { | |
| 3173 | + config.content = config.content.toString(); | |
| 3174 | + } | |
| 3175 | + | |
| 3176 | + Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); | |
| 3177 | + | |
| 3178 | + return config; | |
| 3179 | + }; | |
| 3180 | + | |
| 3181 | + Tooltip.prototype._getDelegateConfig = function _getDelegateConfig() { | |
| 3182 | + var config = {}; | |
| 3183 | + | |
| 3184 | + if (this.config) { | |
| 3185 | + for (var key in this.config) { | |
| 3186 | + if (this.constructor.Default[key] !== this.config[key]) { | |
| 3187 | + config[key] = this.config[key]; | |
| 3188 | + } | |
| 3189 | + } | |
| 3190 | + } | |
| 3191 | + | |
| 3192 | + return config; | |
| 3193 | + }; | |
| 3194 | + | |
| 3195 | + Tooltip.prototype._cleanTipClass = function _cleanTipClass() { | |
| 3196 | + var $tip = $(this.getTipElement()); | |
| 3197 | + var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); | |
| 3198 | + if (tabClass !== null && tabClass.length > 0) { | |
| 3199 | + $tip.removeClass(tabClass.join('')); | |
| 3200 | + } | |
| 3201 | + }; | |
| 3202 | + | |
| 3203 | + Tooltip.prototype._handlePopperPlacementChange = function _handlePopperPlacementChange(data) { | |
| 3204 | + this._cleanTipClass(); | |
| 3205 | + this.addAttachmentClass(this._getAttachment(data.placement)); | |
| 3206 | + }; | |
| 3207 | + | |
| 3208 | + Tooltip.prototype._fixTransition = function _fixTransition() { | |
| 3209 | + var tip = this.getTipElement(); | |
| 3210 | + var initConfigAnimation = this.config.animation; | |
| 3211 | + if (tip.getAttribute('x-placement') !== null) { | |
| 3212 | + return; | |
| 3213 | + } | |
| 3214 | + $(tip).removeClass(ClassName.FADE); | |
| 3215 | + this.config.animation = false; | |
| 3216 | + this.hide(); | |
| 3217 | + this.show(); | |
| 3218 | + this.config.animation = initConfigAnimation; | |
| 3219 | + }; | |
| 3220 | + | |
| 3221 | + // static | |
| 3222 | + | |
| 3223 | + Tooltip._jQueryInterface = function _jQueryInterface(config) { | |
| 3224 | + return this.each(function () { | |
| 3225 | + var data = $(this).data(DATA_KEY); | |
| 3226 | + var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config; | |
| 3227 | + | |
| 3228 | + if (!data && /dispose|hide/.test(config)) { | |
| 3229 | + return; | |
| 3230 | + } | |
| 3231 | + | |
| 3232 | + if (!data) { | |
| 3233 | + data = new Tooltip(this, _config); | |
| 3234 | + $(this).data(DATA_KEY, data); | |
| 3235 | + } | |
| 3236 | + | |
| 3237 | + if (typeof config === 'string') { | |
| 3238 | + if (data[config] === undefined) { | |
| 3239 | + throw new Error('No method named "' + config + '"'); | |
| 3240 | + } | |
| 3241 | + data[config](); | |
| 3242 | + } | |
| 3243 | + }); | |
| 3244 | + }; | |
| 3245 | + | |
| 3246 | + _createClass(Tooltip, null, [{ | |
| 3247 | + key: 'VERSION', | |
| 3248 | + get: function get() { | |
| 3249 | + return VERSION; | |
| 3250 | + } | |
| 3251 | + }, { | |
| 3252 | + key: 'Default', | |
| 3253 | + get: function get() { | |
| 3254 | + return Default; | |
| 3255 | + } | |
| 3256 | + }, { | |
| 3257 | + key: 'NAME', | |
| 3258 | + get: function get() { | |
| 3259 | + return NAME; | |
| 3260 | + } | |
| 3261 | + }, { | |
| 3262 | + key: 'DATA_KEY', | |
| 3263 | + get: function get() { | |
| 3264 | + return DATA_KEY; | |
| 3265 | + } | |
| 3266 | + }, { | |
| 3267 | + key: 'Event', | |
| 3268 | + get: function get() { | |
| 3269 | + return Event; | |
| 3270 | + } | |
| 3271 | + }, { | |
| 3272 | + key: 'EVENT_KEY', | |
| 3273 | + get: function get() { | |
| 3274 | + return EVENT_KEY; | |
| 3275 | + } | |
| 3276 | + }, { | |
| 3277 | + key: 'DefaultType', | |
| 3278 | + get: function get() { | |
| 3279 | + return DefaultType; | |
| 3280 | + } | |
| 3281 | + }]); | |
| 3282 | + | |
| 3283 | + return Tooltip; | |
| 3284 | + }(); | |
| 3285 | + | |
| 3286 | + /** | |
| 3287 | + * ------------------------------------------------------------------------ | |
| 3288 | + * jQuery | |
| 3289 | + * ------------------------------------------------------------------------ | |
| 3290 | + */ | |
| 3291 | + | |
| 3292 | + $.fn[NAME] = Tooltip._jQueryInterface; | |
| 3293 | + $.fn[NAME].Constructor = Tooltip; | |
| 3294 | + $.fn[NAME].noConflict = function () { | |
| 3295 | + $.fn[NAME] = JQUERY_NO_CONFLICT; | |
| 3296 | + return Tooltip._jQueryInterface; | |
| 3297 | + }; | |
| 3298 | + | |
| 3299 | + return Tooltip; | |
| 3300 | +}(jQuery); /* global Popper */ | |
| 3301 | +//# sourceMappingURL=tooltip.js.map | |
| 3302 | +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
| 3303 | + | |
| 3304 | +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | |
| 3305 | + | |
| 3306 | +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
| 3307 | + | |
| 3308 | +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | |
| 3309 | + | |
| 3310 | +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | |
| 3311 | + | |
| 3312 | +/** | |
| 3313 | + * -------------------------------------------------------------------------- | |
| 3314 | + * Bootstrap (v4.0.0-beta): popover.js | |
| 3315 | + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) | |
| 3316 | + * -------------------------------------------------------------------------- | |
| 3317 | + */ | |
| 3318 | + | |
| 3319 | +var Popover = function ($) { | |
| 3320 | + | |
| 3321 | + /** | |
| 3322 | + * ------------------------------------------------------------------------ | |
| 3323 | + * Constants | |
| 3324 | + * ------------------------------------------------------------------------ | |
| 3325 | + */ | |
| 3326 | + | |
| 3327 | + var NAME = 'popover'; | |
| 3328 | + var VERSION = '4.0.0-beta'; | |
| 3329 | + var DATA_KEY = 'bs.popover'; | |
| 3330 | + var EVENT_KEY = '.' + DATA_KEY; | |
| 3331 | + var JQUERY_NO_CONFLICT = $.fn[NAME]; | |
| 3332 | + var CLASS_PREFIX = 'bs-popover'; | |
| 3333 | + var BSCLS_PREFIX_REGEX = new RegExp('(^|\\s)' + CLASS_PREFIX + '\\S+', 'g'); | |
| 3334 | + | |
| 3335 | + var Default = $.extend({}, Tooltip.Default, { | |
| 3336 | + placement: 'right', | |
| 3337 | + trigger: 'click', | |
| 3338 | + content: '', | |
| 3339 | + template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' | |
| 3340 | + }); | |
| 3341 | + | |
| 3342 | + var DefaultType = $.extend({}, Tooltip.DefaultType, { | |
| 3343 | + content: '(string|element|function)' | |
| 3344 | + }); | |
| 3345 | + | |
| 3346 | + var ClassName = { | |
| 3347 | + FADE: 'fade', | |
| 3348 | + SHOW: 'show' | |
| 3349 | + }; | |
| 3350 | + | |
| 3351 | + var Selector = { | |
| 3352 | + TITLE: '.popover-header', | |
| 3353 | + CONTENT: '.popover-body' | |
| 3354 | + }; | |
| 3355 | + | |
| 3356 | + var Event = { | |
| 3357 | + HIDE: 'hide' + EVENT_KEY, | |
| 3358 | + HIDDEN: 'hidden' + EVENT_KEY, | |
| 3359 | + SHOW: 'show' + EVENT_KEY, | |
| 3360 | + SHOWN: 'shown' + EVENT_KEY, | |
| 3361 | + INSERTED: 'inserted' + EVENT_KEY, | |
| 3362 | + CLICK: 'click' + EVENT_KEY, | |
| 3363 | + FOCUSIN: 'focusin' + EVENT_KEY, | |
| 3364 | + FOCUSOUT: 'focusout' + EVENT_KEY, | |
| 3365 | + MOUSEENTER: 'mouseenter' + EVENT_KEY, | |
| 3366 | + MOUSELEAVE: 'mouseleave' + EVENT_KEY | |
| 3367 | + | |
| 3368 | + /** | |
| 3369 | + * ------------------------------------------------------------------------ | |
| 3370 | + * Class Definition | |
| 3371 | + * ------------------------------------------------------------------------ | |
| 3372 | + */ | |
| 3373 | + | |
| 3374 | + }; | |
| 3375 | + var Popover = function (_Tooltip) { | |
| 3376 | + _inherits(Popover, _Tooltip); | |
| 3377 | + | |
| 3378 | + function Popover() { | |
| 3379 | + _classCallCheck(this, Popover); | |
| 3380 | + | |
| 3381 | + return _possibleConstructorReturn(this, _Tooltip.apply(this, arguments)); | |
| 3382 | + } | |
| 3383 | + | |
| 3384 | + // overrides | |
| 3385 | + | |
| 3386 | + Popover.prototype.isWithContent = function isWithContent() { | |
| 3387 | + return this.getTitle() || this._getContent(); | |
| 3388 | + }; | |
| 3389 | + | |
| 3390 | + Popover.prototype.addAttachmentClass = function addAttachmentClass(attachment) { | |
| 3391 | + $(this.getTipElement()).addClass(CLASS_PREFIX + '-' + attachment); | |
| 3392 | + }; | |
| 3393 | + | |
| 3394 | + Popover.prototype.getTipElement = function getTipElement() { | |
| 3395 | + return this.tip = this.tip || $(this.config.template)[0]; | |
| 3396 | + }; | |
| 3397 | + | |
| 3398 | + Popover.prototype.setContent = function setContent() { | |
| 3399 | + var $tip = $(this.getTipElement()); | |
| 3400 | + | |
| 3401 | + // we use append for html objects to maintain js events | |
| 3402 | + this.setElementContent($tip.find(Selector.TITLE), this.getTitle()); | |
| 3403 | + this.setElementContent($tip.find(Selector.CONTENT), this._getContent()); | |
| 3404 | + | |
| 3405 | + $tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW); | |
| 3406 | + }; | |
| 3407 | + | |
| 3408 | + // private | |
| 3409 | + | |
| 3410 | + Popover.prototype._getContent = function _getContent() { | |
| 3411 | + return this.element.getAttribute('data-content') || (typeof this.config.content === 'function' ? this.config.content.call(this.element) : this.config.content); | |
| 3412 | + }; | |
| 3413 | + | |
| 3414 | + Popover.prototype._cleanTipClass = function _cleanTipClass() { | |
| 3415 | + var $tip = $(this.getTipElement()); | |
| 3416 | + var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); | |
| 3417 | + if (tabClass !== null && tabClass.length > 0) { | |
| 3418 | + $tip.removeClass(tabClass.join('')); | |
| 3419 | + } | |
| 3420 | + }; | |
| 3421 | + | |
| 3422 | + // static | |
| 3423 | + | |
| 3424 | + Popover._jQueryInterface = function _jQueryInterface(config) { | |
| 3425 | + return this.each(function () { | |
| 3426 | + var data = $(this).data(DATA_KEY); | |
| 3427 | + var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null; | |
| 3428 | + | |
| 3429 | + if (!data && /destroy|hide/.test(config)) { | |
| 3430 | + return; | |
| 3431 | + } | |
| 3432 | + | |
| 3433 | + if (!data) { | |
| 3434 | + data = new Popover(this, _config); | |
| 3435 | + $(this).data(DATA_KEY, data); | |
| 3436 | + } | |
| 3437 | + | |
| 3438 | + if (typeof config === 'string') { | |
| 3439 | + if (data[config] === undefined) { | |
| 3440 | + throw new Error('No method named "' + config + '"'); | |
| 3441 | + } | |
| 3442 | + data[config](); | |
| 3443 | + } | |
| 3444 | + }); | |
| 3445 | + }; | |
| 3446 | + | |
| 3447 | + _createClass(Popover, null, [{ | |
| 3448 | + key: 'VERSION', | |
| 3449 | + | |
| 3450 | + | |
| 3451 | + // getters | |
| 3452 | + | |
| 3453 | + get: function get() { | |
| 3454 | + return VERSION; | |
| 3455 | + } | |
| 3456 | + }, { | |
| 3457 | + key: 'Default', | |
| 3458 | + get: function get() { | |
| 3459 | + return Default; | |
| 3460 | + } | |
| 3461 | + }, { | |
| 3462 | + key: 'NAME', | |
| 3463 | + get: function get() { | |
| 3464 | + return NAME; | |
| 3465 | + } | |
| 3466 | + }, { | |
| 3467 | + key: 'DATA_KEY', | |
| 3468 | + get: function get() { | |
| 3469 | + return DATA_KEY; | |
| 3470 | + } | |
| 3471 | + }, { | |
| 3472 | + key: 'Event', | |
| 3473 | + get: function get() { | |
| 3474 | + return Event; | |
| 3475 | + } | |
| 3476 | + }, { | |
| 3477 | + key: 'EVENT_KEY', | |
| 3478 | + get: function get() { | |
| 3479 | + return EVENT_KEY; | |
| 3480 | + } | |
| 3481 | + }, { | |
| 3482 | + key: 'DefaultType', | |
| 3483 | + get: function get() { | |
| 3484 | + return DefaultType; | |
| 3485 | + } | |
| 3486 | + }]); | |
| 3487 | + | |
| 3488 | + return Popover; | |
| 3489 | + }(Tooltip); | |
| 3490 | + | |
| 3491 | + /** | |
| 3492 | + * ------------------------------------------------------------------------ | |
| 3493 | + * jQuery | |
| 3494 | + * ------------------------------------------------------------------------ | |
| 3495 | + */ | |
| 3496 | + | |
| 3497 | + $.fn[NAME] = Popover._jQueryInterface; | |
| 3498 | + $.fn[NAME].Constructor = Popover; | |
| 3499 | + $.fn[NAME].noConflict = function () { | |
| 3500 | + $.fn[NAME] = JQUERY_NO_CONFLICT; | |
| 3501 | + return Popover._jQueryInterface; | |
| 3502 | + }; | |
| 3503 | + | |
| 3504 | + return Popover; | |
| 3505 | +}(jQuery); | |
| 3506 | +//# sourceMappingURL=popover.js.map | |
| 3507 | +var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; | |
| 3508 | + | |
| 3509 | +(function(window, factory) { | |
| 3510 | + if (typeof define === 'function' && define.amd) { | |
| 3511 | + return define(['jquery'], function(jQuery) { | |
| 3512 | + return window.Tour = factory(jQuery); | |
| 3513 | + }); | |
| 3514 | + } else if (typeof exports === 'object') { | |
| 3515 | + return module.exports = factory(require('jquery')); | |
| 3516 | + } else { | |
| 3517 | + return window.Tour = factory(window.jQuery); | |
| 3518 | + } | |
| 3519 | +})(window, function($) { | |
| 3520 | + var Tour, document; | |
| 3521 | + document = window.document; | |
| 3522 | + Tour = (function() { | |
| 3523 | + function Tour(options) { | |
| 3524 | + this._showPopoverAndOverlay = bind(this._showPopoverAndOverlay, this); | |
| 3525 | + var storage; | |
| 3526 | + try { | |
| 3527 | + storage = window.localStorage; | |
| 3528 | + } catch (error) { | |
| 3529 | + storage = false; | |
| 3530 | + } | |
| 3531 | + this._options = $.extend({ | |
| 3532 | + name: 'tour', | |
| 3533 | + steps: [], | |
| 3534 | + container: 'body', | |
| 3535 | + autoscroll: true, | |
| 3536 | + keyboard: true, | |
| 3537 | + storage: storage, | |
| 3538 | + debug: false, | |
| 3539 | + backdrop: false, | |
| 3540 | + backdropContainer: 'body', | |
| 3541 | + backdropPadding: 0, | |
| 3542 | + redirect: true, | |
| 3543 | + orphan: false, | |
| 3544 | + duration: false, | |
| 3545 | + delay: false, | |
| 3546 | + basePath: '', | |
| 3547 | + template: '<div class="popover" role="tooltip"> <div class="arrow"></div> <h3 class="popover-header"></h3> <div class="popover-body"></div> <div class="popover-navigation"> <div class="btn-group"> <button class="btn btn-sm btn-secondary" data-role="prev">« Prev</button> <button class="btn btn-sm btn-secondary" data-role="next">Next »</button> <button class="btn btn-sm btn-secondary" data-role="pause-resume" data-pause-text="Pause" data-resume-text="Resume">Pause</button> </div> <button class="btn btn-sm btn-secondary" data-role="end">End tour</button> </div> </div>', | |
| 3548 | + afterSetState: function(key, value) {}, | |
| 3549 | + afterGetState: function(key, value) {}, | |
| 3550 | + afterRemoveState: function(key) {}, | |
| 3551 | + onStart: function(tour) {}, | |
| 3552 | + onEnd: function(tour) {}, | |
| 3553 | + onShow: function(tour) {}, | |
| 3554 | + onShown: function(tour) {}, | |
| 3555 | + onHide: function(tour) {}, | |
| 3556 | + onHidden: function(tour) {}, | |
| 3557 | + onNext: function(tour) {}, | |
| 3558 | + onPrev: function(tour) {}, | |
| 3559 | + onPause: function(tour, duration) {}, | |
| 3560 | + onResume: function(tour, duration) {}, | |
| 3561 | + onRedirectError: function(tour) {} | |
| 3562 | + }, options); | |
| 3563 | + this._force = false; | |
| 3564 | + this._inited = false; | |
| 3565 | + this._current = null; | |
| 3566 | + this.backdrops = []; | |
| 3567 | + this; | |
| 3568 | + } | |
| 3569 | + | |
| 3570 | + Tour.prototype.addSteps = function(steps) { | |
| 3571 | + var j, len, step; | |
| 3572 | + for (j = 0, len = steps.length; j < len; j++) { | |
| 3573 | + step = steps[j]; | |
| 3574 | + this.addStep(step); | |
| 3575 | + } | |
| 3576 | + return this; | |
| 3577 | + }; | |
| 3578 | + | |
| 3579 | + Tour.prototype.addStep = function(step) { | |
| 3580 | + this._options.steps.push(step); | |
| 3581 | + return this; | |
| 3582 | + }; | |
| 3583 | + | |
| 3584 | + Tour.prototype.getStep = function(i) { | |
| 3585 | + if (this._options.steps[i] != null) { | |
| 3586 | + return $.extend({ | |
| 3587 | + id: "step-" + i, | |
| 3588 | + path: '', | |
| 3589 | + host: '', | |
| 3590 | + placement: 'right', | |
| 3591 | + title: '', | |
| 3592 | + content: '<p></p>', | |
| 3593 | + next: i === this._options.steps.length - 1 ? -1 : i + 1, | |
| 3594 | + prev: i - 1, | |
| 3595 | + animation: true, | |
| 3596 | + container: this._options.container, | |
| 3597 | + autoscroll: this._options.autoscroll, | |
| 3598 | + backdrop: this._options.backdrop, | |
| 3599 | + backdropContainer: this._options.backdropContainer, | |
| 3600 | + backdropPadding: this._options.backdropPadding, | |
| 3601 | + redirect: this._options.redirect, | |
| 3602 | + reflexElement: this._options.steps[i].element, | |
| 3603 | + backdropElement: this._options.steps[i].element, | |
| 3604 | + orphan: this._options.orphan, | |
| 3605 | + duration: this._options.duration, | |
| 3606 | + delay: this._options.delay, | |
| 3607 | + template: this._options.template, | |
| 3608 | + onShow: this._options.onShow, | |
| 3609 | + onShown: this._options.onShown, | |
| 3610 | + onHide: this._options.onHide, | |
| 3611 | + onHidden: this._options.onHidden, | |
| 3612 | + onNext: this._options.onNext, | |
| 3613 | + onPrev: this._options.onPrev, | |
| 3614 | + onPause: this._options.onPause, | |
| 3615 | + onResume: this._options.onResume, | |
| 3616 | + onRedirectError: this._options.onRedirectError | |
| 3617 | + }, this._options.steps[i]); | |
| 3618 | + } | |
| 3619 | + }; | |
| 3620 | + | |
| 3621 | + Tour.prototype.init = function(force) { | |
| 3622 | + this._force = force; | |
| 3623 | + if (this.ended()) { | |
| 3624 | + this._debug('Tour ended, init prevented.'); | |
| 3625 | + return this; | |
| 3626 | + } | |
| 3627 | + this.setCurrentStep(); | |
| 3628 | + this._initMouseNavigation(); | |
| 3629 | + this._initKeyboardNavigation(); | |
| 3630 | + if (this._current !== null) { | |
| 3631 | + this.showStep(this._current); | |
| 3632 | + } | |
| 3633 | + this._inited = true; | |
| 3634 | + return this; | |
| 3635 | + }; | |
| 3636 | + | |
| 3637 | + Tour.prototype.start = function(force) { | |
| 3638 | + var promise; | |
| 3639 | + if (force == null) { | |
| 3640 | + force = false; | |
| 3641 | + } | |
| 3642 | + if (!this._inited) { | |
| 3643 | + this.init(force); | |
| 3644 | + } | |
| 3645 | + if (this._current === null) { | |
| 3646 | + promise = this._makePromise(this._options.onStart != null ? this._options.onStart(this) : void 0); | |
| 3647 | + this._callOnPromiseDone(promise, this.showStep, 0); | |
| 3648 | + } | |
| 3649 | + return this; | |
| 3650 | + }; | |
| 3651 | + | |
| 3652 | + Tour.prototype.next = function() { | |
| 3653 | + var promise; | |
| 3654 | + promise = this.hideStep(this._current, this._current + 1); | |
| 3655 | + return this._callOnPromiseDone(promise, this._showNextStep); | |
| 3656 | + }; | |
| 3657 | + | |
| 3658 | + Tour.prototype.prev = function() { | |
| 3659 | + var promise; | |
| 3660 | + promise = this.hideStep(this._current, this._current - 1); | |
| 3661 | + return this._callOnPromiseDone(promise, this._showPrevStep); | |
| 3662 | + }; | |
| 3663 | + | |
| 3664 | + Tour.prototype.goTo = function(i) { | |
| 3665 | + var promise; | |
| 3666 | + promise = this.hideStep(this._current, i); | |
| 3667 | + return this._callOnPromiseDone(promise, this.showStep, i); | |
| 3668 | + }; | |
| 3669 | + | |
| 3670 | + Tour.prototype.end = function() { | |
| 3671 | + var endHelper, promise; | |
| 3672 | + endHelper = (function(_this) { | |
| 3673 | + return function(e) { | |
| 3674 | + $(document).off("click.tour-" + _this._options.name); | |
| 3675 | + $(document).off("keyup.tour-" + _this._options.name); | |
| 3676 | + _this._setState('end', 'yes'); | |
| 3677 | + _this._inited = false; | |
| 3678 | + _this._force = false; | |
| 3679 | + _this._clearTimer(); | |
| 3680 | + if (_this._options.onEnd != null) { | |
| 3681 | + return _this._options.onEnd(_this); | |
| 3682 | + } | |
| 3683 | + }; | |
| 3684 | + })(this); | |
| 3685 | + promise = this.hideStep(this._current); | |
| 3686 | + return this._callOnPromiseDone(promise, endHelper); | |
| 3687 | + }; | |
| 3688 | + | |
| 3689 | + Tour.prototype.ended = function() { | |
| 3690 | + return !this._force && !!this._getState('end'); | |
| 3691 | + }; | |
| 3692 | + | |
| 3693 | + Tour.prototype.restart = function() { | |
| 3694 | + this._removeState('current_step'); | |
| 3695 | + this._removeState('end'); | |
| 3696 | + this._removeState('redirect_to'); | |
| 3697 | + return this.start(); | |
| 3698 | + }; | |
| 3699 | + | |
| 3700 | + Tour.prototype.pause = function() { | |
| 3701 | + var step; | |
| 3702 | + step = this.getStep(this._current); | |
| 3703 | + if (!(step && step.duration)) { | |
| 3704 | + return this; | |
| 3705 | + } | |
| 3706 | + this._paused = true; | |
| 3707 | + this._duration -= new Date().getTime() - this._start; | |
| 3708 | + window.clearTimeout(this._timer); | |
| 3709 | + this._debug("Paused/Stopped step " + (this._current + 1) + " timer (" + this._duration + " remaining)."); | |
| 3710 | + if (step.onPause != null) { | |
| 3711 | + return step.onPause(this, this._duration); | |
| 3712 | + } | |
| 3713 | + }; | |
| 3714 | + | |
| 3715 | + Tour.prototype.resume = function() { | |
| 3716 | + var step; | |
| 3717 | + step = this.getStep(this._current); | |
| 3718 | + if (!(step && step.duration)) { | |
| 3719 | + return this; | |
| 3720 | + } | |
| 3721 | + this._paused = false; | |
| 3722 | + this._start = new Date().getTime(); | |
| 3723 | + this._duration = this._duration || step.duration; | |
| 3724 | + this._timer = window.setTimeout((function(_this) { | |
| 3725 | + return function() { | |
| 3726 | + if (_this._isLast()) { | |
| 3727 | + return _this.next(); | |
| 3728 | + } else { | |
| 3729 | + return _this.end(); | |
| 3730 | + } | |
| 3731 | + }; | |
| 3732 | + })(this), this._duration); | |
| 3733 | + this._debug("Started step " + (this._current + 1) + " timer with duration " + this._duration); | |
| 3734 | + if ((step.onResume != null) && this._duration !== step.duration) { | |
| 3735 | + return step.onResume(this, this._duration); | |
| 3736 | + } | |
| 3737 | + }; | |
| 3738 | + | |
| 3739 | + Tour.prototype.hideStep = function(i, iNext) { | |
| 3740 | + var hideDelay, hideStepHelper, promise, step; | |
| 3741 | + step = this.getStep(i); | |
| 3742 | + if (!step) { | |
| 3743 | + return; | |
| 3744 | + } | |
| 3745 | + this._clearTimer(); | |
| 3746 | + promise = this._makePromise(step.onHide != null ? step.onHide(this, i) : void 0); | |
| 3747 | + hideStepHelper = (function(_this) { | |
| 3748 | + return function(e) { | |
| 3749 | + var $element, next_step; | |
| 3750 | + $element = $(step.element); | |
| 3751 | + if (!$element.data('bs.popover')) { | |
| 3752 | + $element = $('body'); | |
| 3753 | + } | |
| 3754 | + $element.popover('dispose').removeClass("tour-" + _this._options.name + "-element tour-" + _this._options.name + "-" + i + "-element").removeData('bs.popover'); | |
| 3755 | + if (step.reflex) { | |
| 3756 | + $(step.reflexElement).removeClass('tour-step-element-reflex').off((_this._reflexEvent(step.reflex)) + ".tour-" + _this._options.name); | |
| 3757 | + } | |
| 3758 | + if (step.backdrop) { | |
| 3759 | + next_step = (iNext != null) && _this.getStep(iNext); | |
| 3760 | + if (!next_step || !next_step.backdrop || next_step.backdropElement !== step.backdropElement) { | |
| 3761 | + _this._hideOverlayElement(step); | |
| 3762 | + } | |
| 3763 | + } | |
| 3764 | + if (step.onHidden != null) { | |
| 3765 | + return step.onHidden(_this); | |
| 3766 | + } | |
| 3767 | + }; | |
| 3768 | + })(this); | |
| 3769 | + hideDelay = step.delay.hide || step.delay; | |
| 3770 | + if ({}.toString.call(hideDelay) === '[object Number]' && hideDelay > 0) { | |
| 3771 | + this._debug("Wait " + hideDelay + " milliseconds to hide the step " + (this._current + 1)); | |
| 3772 | + window.setTimeout((function(_this) { | |
| 3773 | + return function() { | |
| 3774 | + return _this._callOnPromiseDone(promise, hideStepHelper); | |
| 3775 | + }; | |
| 3776 | + })(this), hideDelay); | |
| 3777 | + } else { | |
| 3778 | + this._callOnPromiseDone(promise, hideStepHelper); | |
| 3779 | + } | |
| 3780 | + return promise; | |
| 3781 | + }; | |
| 3782 | + | |
| 3783 | + Tour.prototype.showStep = function(i) { | |
| 3784 | + var path, promise, showDelay, showStepHelper, skipToPrevious, step; | |
| 3785 | + if (this.ended()) { | |
| 3786 | + this._debug('Tour ended, showStep prevented.'); | |
| 3787 | + return this; | |
| 3788 | + } | |
| 3789 | + step = this.getStep(i); | |
| 3790 | + if (!step) { | |
| 3791 | + return; | |
| 3792 | + } | |
| 3793 | + skipToPrevious = i < this._current; | |
| 3794 | + promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0); | |
| 3795 | + this.setCurrentStep(i); | |
| 3796 | + path = (function() { | |
| 3797 | + switch ({}.toString.call(step.path)) { | |
| 3798 | + case '[object Function]': | |
| 3799 | + return step.path(); | |
| 3800 | + case '[object String]': | |
| 3801 | + return this._options.basePath + step.path; | |
| 3802 | + default: | |
| 3803 | + return step.path; | |
| 3804 | + } | |
| 3805 | + }).call(this); | |
| 3806 | + if (step.redirect && this._isRedirect(step.host, path, document.location)) { | |
| 3807 | + this._redirect(step, i, path); | |
| 3808 | + if (!this._isJustPathHashDifferent(step.host, path, document.location)) { | |
| 3809 | + return; | |
| 3810 | + } | |
| 3811 | + } | |
| 3812 | + showStepHelper = (function(_this) { | |
| 3813 | + return function(e) { | |
| 3814 | + if (_this._isOrphan(step)) { | |
| 3815 | + if (step.orphan === false) { | |
| 3816 | + _this._debug("Skip the orphan step " + (_this._current + 1) + ".\nOrphan option is false and the element does not exist or is hidden."); | |
| 3817 | + if (skipToPrevious) { | |
| 3818 | + _this._showPrevStep(); | |
| 3819 | + } else { | |
| 3820 | + _this._showNextStep(); | |
| 3821 | + } | |
| 3822 | + return; | |
| 3823 | + } | |
| 3824 | + _this._debug("Show the orphan step " + (_this._current + 1) + ". Orphans option is true."); | |
| 3825 | + } | |
| 3826 | + if (step.autoscroll) { | |
| 3827 | + _this._scrollIntoView(i); | |
| 3828 | + } else { | |
| 3829 | + _this._showPopoverAndOverlay(i); | |
| 3830 | + } | |
| 3831 | + if (step.duration) { | |
| 3832 | + return _this.resume(); | |
| 3833 | + } | |
| 3834 | + }; | |
| 3835 | + })(this); | |
| 3836 | + showDelay = step.delay.show || step.delay; | |
| 3837 | + if ({}.toString.call(showDelay) === '[object Number]' && showDelay > 0) { | |
| 3838 | + this._debug("Wait " + showDelay + " milliseconds to show the step " + (this._current + 1)); | |
| 3839 | + window.setTimeout((function(_this) { | |
| 3840 | + return function() { | |
| 3841 | + return _this._callOnPromiseDone(promise, showStepHelper); | |
| 3842 | + }; | |
| 3843 | + })(this), showDelay); | |
| 3844 | + } else { | |
| 3845 | + this._callOnPromiseDone(promise, showStepHelper); | |
| 3846 | + } | |
| 3847 | + return promise; | |
| 3848 | + }; | |
| 3849 | + | |
| 3850 | + Tour.prototype.getCurrentStep = function() { | |
| 3851 | + return this._current; | |
| 3852 | + }; | |
| 3853 | + | |
| 3854 | + Tour.prototype.setCurrentStep = function(value) { | |
| 3855 | + if (value != null) { | |
| 3856 | + this._current = value; | |
| 3857 | + this._setState('current_step', value); | |
| 3858 | + } else { | |
| 3859 | + this._current = this._getState('current_step'); | |
| 3860 | + this._current = this._current === null ? null : parseInt(this._current, 10); | |
| 3861 | + } | |
| 3862 | + return this; | |
| 3863 | + }; | |
| 3864 | + | |
| 3865 | + Tour.prototype.redraw = function() { | |
| 3866 | + return this._showOverlayElement(this.getStep(this.getCurrentStep())); | |
| 3867 | + }; | |
| 3868 | + | |
| 3869 | + Tour.prototype._setState = function(key, value) { | |
| 3870 | + var e, keyName; | |
| 3871 | + if (this._options.storage) { | |
| 3872 | + keyName = this._options.name + "_" + key; | |
| 3873 | + try { | |
| 3874 | + this._options.storage.setItem(keyName, value); | |
| 3875 | + } catch (error) { | |
| 3876 | + e = error; | |
| 3877 | + if (e.code === DOMException.QUOTA_EXCEEDED_ERR) { | |
| 3878 | + this._debug('LocalStorage quota exceeded. State storage failed.'); | |
| 3879 | + } | |
| 3880 | + } | |
| 3881 | + return this._options.afterSetState(keyName, value); | |
| 3882 | + } else { | |
| 3883 | + if (this._state == null) { | |
| 3884 | + this._state = {}; | |
| 3885 | + } | |
| 3886 | + return this._state[key] = value; | |
| 3887 | + } | |
| 3888 | + }; | |
| 3889 | + | |
| 3890 | + Tour.prototype._removeState = function(key) { | |
| 3891 | + var keyName; | |
| 3892 | + if (this._options.storage) { | |
| 3893 | + keyName = this._options.name + "_" + key; | |
| 3894 | + this._options.storage.removeItem(keyName); | |
| 3895 | + return this._options.afterRemoveState(keyName); | |
| 3896 | + } else { | |
| 3897 | + if (this._state != null) { | |
| 3898 | + return delete this._state[key]; | |
| 3899 | + } | |
| 3900 | + } | |
| 3901 | + }; | |
| 3902 | + | |
| 3903 | + Tour.prototype._getState = function(key) { | |
| 3904 | + var keyName, value; | |
| 3905 | + if (this._options.storage) { | |
| 3906 | + keyName = this._options.name + "_" + key; | |
| 3907 | + value = this._options.storage.getItem(keyName); | |
| 3908 | + } else { | |
| 3909 | + if (this._state != null) { | |
| 3910 | + value = this._state[key]; | |
| 3911 | + } | |
| 3912 | + } | |
| 3913 | + if (value === void 0 || value === 'null') { | |
| 3914 | + value = null; | |
| 3915 | + } | |
| 3916 | + this._options.afterGetState(key, value); | |
| 3917 | + return value; | |
| 3918 | + }; | |
| 3919 | + | |
| 3920 | + Tour.prototype._showNextStep = function() { | |
| 3921 | + var promise, showNextStepHelper, step; | |
| 3922 | + step = this.getStep(this._current); | |
| 3923 | + showNextStepHelper = (function(_this) { | |
| 3924 | + return function(e) { | |
| 3925 | + return _this.showStep(step.next); | |
| 3926 | + }; | |
| 3927 | + })(this); | |
| 3928 | + promise = this._makePromise(step.onNext != null ? step.onNext(this) : void 0); | |
| 3929 | + return this._callOnPromiseDone(promise, showNextStepHelper); | |
| 3930 | + }; | |
| 3931 | + | |
| 3932 | + Tour.prototype._showPrevStep = function() { | |
| 3933 | + var promise, showPrevStepHelper, step; | |
| 3934 | + step = this.getStep(this._current); | |
| 3935 | + showPrevStepHelper = (function(_this) { | |
| 3936 | + return function(e) { | |
| 3937 | + return _this.showStep(step.prev); | |
| 3938 | + }; | |
| 3939 | + })(this); | |
| 3940 | + promise = this._makePromise(step.onPrev != null ? step.onPrev(this) : void 0); | |
| 3941 | + return this._callOnPromiseDone(promise, showPrevStepHelper); | |
| 3942 | + }; | |
| 3943 | + | |
| 3944 | + Tour.prototype._debug = function(text) { | |
| 3945 | + if (this._options.debug) { | |
| 3946 | + return window.console.log("Bootstrap Tour '" + this._options.name + "' | " + text); | |
| 3947 | + } | |
| 3948 | + }; | |
| 3949 | + | |
| 3950 | + Tour.prototype._isRedirect = function(host, path, location) { | |
| 3951 | + var currentPath; | |
| 3952 | + if ((host != null) && host !== '' && (({}.toString.call(host) === '[object RegExp]' && !host.test(location.origin)) || ({}.toString.call(host) === '[object String]' && this._isHostDifferent(host, location)))) { | |
| 3953 | + return true; | |
| 3954 | + } | |
| 3955 | + currentPath = [location.pathname, location.search, location.hash].join(''); | |
| 3956 | + return (path != null) && path !== '' && (({}.toString.call(path) === '[object RegExp]' && !path.test(currentPath)) || ({}.toString.call(path) === '[object String]' && this._isPathDifferent(path, currentPath))); | |
| 3957 | + }; | |
| 3958 | + | |
| 3959 | + Tour.prototype._isHostDifferent = function(host, location) { | |
| 3960 | + switch ({}.toString.call(host)) { | |
| 3961 | + case '[object RegExp]': | |
| 3962 | + return !host.test(location.origin); | |
| 3963 | + case '[object String]': | |
| 3964 | + return this._getProtocol(host) !== this._getProtocol(location.href) || this._getHost(host) !== this._getHost(location.href); | |
| 3965 | + default: | |
| 3966 | + return true; | |
| 3967 | + } | |
| 3968 | + }; | |
| 3969 | + | |
| 3970 | + Tour.prototype._isPathDifferent = function(path, currentPath) { | |
| 3971 | + return this._getPath(path) !== this._getPath(currentPath) || !this._equal(this._getQuery(path), this._getQuery(currentPath)) || !this._equal(this._getHash(path), this._getHash(currentPath)); | |
| 3972 | + }; | |
| 3973 | + | |
| 3974 | + Tour.prototype._isJustPathHashDifferent = function(host, path, location) { | |
| 3975 | + var currentPath; | |
| 3976 | + if ((host != null) && host !== '') { | |
| 3977 | + if (this._isHostDifferent(host, location)) { | |
| 3978 | + return false; | |
| 3979 | + } | |
| 3980 | + } | |
| 3981 | + currentPath = [location.pathname, location.search, location.hash].join(''); | |
| 3982 | + if ({}.toString.call(path) === '[object String]') { | |
| 3983 | + return this._getPath(path) === this._getPath(currentPath) && this._equal(this._getQuery(path), this._getQuery(currentPath)) && !this._equal(this._getHash(path), this._getHash(currentPath)); | |
| 3984 | + } | |
| 3985 | + return false; | |
| 3986 | + }; | |
| 3987 | + | |
| 3988 | + Tour.prototype._redirect = function(step, i, path) { | |
| 3989 | + var href; | |
| 3990 | + if ($.isFunction(step.redirect)) { | |
| 3991 | + return step.redirect.call(this, path); | |
| 3992 | + } else { | |
| 3993 | + href = {}.toString.call(step.host) === '[object String]' ? "" + step.host + path : path; | |
| 3994 | + this._debug("Redirect to " + href); | |
| 3995 | + if (this._getState('redirect_to') === ("" + i)) { | |
| 3996 | + this._debug("Error redirection loop to " + path); | |
| 3997 | + this._removeState('redirect_to'); | |
| 3998 | + if (step.onRedirectError != null) { | |
| 3999 | + return step.onRedirectError(this); | |
| 4000 | + } | |
| 4001 | + } else { | |
| 4002 | + this._setState('redirect_to', "" + i); | |
| 4003 | + return document.location.href = href; | |
| 4004 | + } | |
| 4005 | + } | |
| 4006 | + }; | |
| 4007 | + | |
| 4008 | + Tour.prototype._isOrphan = function(step) { | |
| 4009 | + return (step.element == null) || !$(step.element).length || $(step.element).is(':hidden') && ($(step.element)[0].namespaceURI !== 'http://www.w3.org/2000/svg'); | |
| 4010 | + }; | |
| 4011 | + | |
| 4012 | + Tour.prototype._isLast = function() { | |
| 4013 | + return this._current < this._options.steps.length - 1; | |
| 4014 | + }; | |
| 4015 | + | |
| 4016 | + Tour.prototype._showPopoverAndOverlay = function(i) { | |
| 4017 | + var step; | |
| 4018 | + if (this.getCurrentStep() !== i || this.ended()) { | |
| 4019 | + return; | |
| 4020 | + } | |
| 4021 | + step = this.getStep(i); | |
| 4022 | + if (step.backdrop) { | |
| 4023 | + this._showOverlayElement(step); | |
| 4024 | + } | |
| 4025 | + this._showPopover(step, i); | |
| 4026 | + if (step.onShown != null) { | |
| 4027 | + step.onShown(this); | |
| 4028 | + } | |
| 4029 | + return this._debug("Step " + (this._current + 1) + " of " + this._options.steps.length); | |
| 4030 | + }; | |
| 4031 | + | |
| 4032 | + Tour.prototype._showPopover = function(step, i) { | |
| 4033 | + var $element, $tip, isOrphan, options; | |
| 4034 | + $(".tour-" + this._options.name).remove(); | |
| 4035 | + options = $.extend({}, this._options); | |
| 4036 | + isOrphan = this._isOrphan(step); | |
| 4037 | + step.template = this._template(step, i); | |
| 4038 | + if (isOrphan) { | |
| 4039 | + step.element = 'body'; | |
| 4040 | + step.placement = 'top'; | |
| 4041 | + } | |
| 4042 | + $element = $(step.element); | |
| 4043 | + $element.addClass("tour-" + this._options.name + "-element tour-" + this._options.name + "-" + i + "-element"); | |
| 4044 | + if (step.options) { | |
| 4045 | + $.extend(options, step.options); | |
| 4046 | + } | |
| 4047 | + if (step.reflex && !isOrphan) { | |
| 4048 | + $(step.reflexElement).addClass('tour-step-element-reflex').off((this._reflexEvent(step.reflex)) + ".tour-" + this._options.name).on((this._reflexEvent(step.reflex)) + ".tour-" + this._options.name, (function(_this) { | |
| 4049 | + return function() { | |
| 4050 | + if (_this._isLast()) { | |
| 4051 | + return _this.next(); | |
| 4052 | + } else { | |
| 4053 | + return _this.end(); | |
| 4054 | + } | |
| 4055 | + }; | |
| 4056 | + })(this)); | |
| 4057 | + } | |
| 4058 | + $element.popover({ | |
| 4059 | + placement: step.placement, | |
| 4060 | + trigger: 'manual', | |
| 4061 | + title: step.title, | |
| 4062 | + content: step.content, | |
| 4063 | + html: true, | |
| 4064 | + animation: step.animation, | |
| 4065 | + container: step.container, | |
| 4066 | + template: step.template, | |
| 4067 | + selector: step.element | |
| 4068 | + }).popover('show'); | |
| 4069 | + $tip = $($element.data('bs.popover').getTipElement()); | |
| 4070 | + return $tip.attr('id', step.id); | |
| 4071 | + }; | |
| 4072 | + | |
| 4073 | + Tour.prototype._template = function(step, i) { | |
| 4074 | + var $navigation, $next, $prev, $resume, $template, template; | |
| 4075 | + template = step.template; | |
| 4076 | + if (this._isOrphan(step) && {}.toString.call(step.orphan) !== '[object Boolean]') { | |
| 4077 | + template = step.orphan; | |
| 4078 | + } | |
| 4079 | + $template = $.isFunction(template) ? $(template(i, step)) : $(template); | |
| 4080 | + $navigation = $template.find('.popover-navigation'); | |
| 4081 | + $prev = $navigation.find('[data-role="prev"]'); | |
| 4082 | + $next = $navigation.find('[data-role="next"]'); | |
| 4083 | + $resume = $navigation.find('[data-role="pause-resume"]'); | |
| 4084 | + if (this._isOrphan(step)) { | |
| 4085 | + $template.addClass('orphan'); | |
| 4086 | + } | |
| 4087 | + $template.addClass("tour-" + this._options.name + " tour-" + this._options.name + "-" + i); | |
| 4088 | + if (step.reflex) { | |
| 4089 | + $template.addClass("tour-" + this._options.name + "-reflex"); | |
| 4090 | + } | |
| 4091 | + if (step.prev < 0) { | |
| 4092 | + $prev.addClass('disabled').prop('disabled', true).prop('tabindex', -1); | |
| 4093 | + } | |
| 4094 | + if (step.next < 0) { | |
| 4095 | + $next.addClass('disabled').prop('disabled', true).prop('tabindex', -1); | |
| 4096 | + } | |
| 4097 | + if (!step.duration) { | |
| 4098 | + $resume.remove(); | |
| 4099 | + } | |
| 4100 | + return $template.clone().wrap('<div>').parent().html(); | |
| 4101 | + }; | |
| 4102 | + | |
| 4103 | + Tour.prototype._reflexEvent = function(reflex) { | |
| 4104 | + if ({}.toString.call(reflex) === '[object Boolean]') { | |
| 4105 | + return 'click'; | |
| 4106 | + } else { | |
| 4107 | + return reflex; | |
| 4108 | + } | |
| 4109 | + }; | |
| 4110 | + | |
| 4111 | + Tour.prototype._scrollIntoView = function(i) { | |
| 4112 | + var $element, $window, counter, height, offsetTop, scrollTop, step, windowHeight; | |
| 4113 | + step = this.getStep(i); | |
| 4114 | + $element = $(step.element); | |
| 4115 | + if (!$element.length) { | |
| 4116 | + return this._showPopoverAndOverlay(i); | |
| 4117 | + } | |
| 4118 | + $window = $(window); | |
| 4119 | + offsetTop = $element.offset().top; | |
| 4120 | + height = $element.outerHeight(); | |
| 4121 | + windowHeight = $window.height(); | |
| 4122 | + scrollTop = 0; | |
| 4123 | + switch (step.placement) { | |
| 4124 | + case 'top': | |
| 4125 | + scrollTop = Math.max(0, offsetTop - (windowHeight / 2)); | |
| 4126 | + break; | |
| 4127 | + case 'left': | |
| 4128 | + case 'right': | |
| 4129 | + scrollTop = Math.max(0, (offsetTop + height / 2) - (windowHeight / 2)); | |
| 4130 | + break; | |
| 4131 | + case 'bottom': | |
| 4132 | + scrollTop = Math.max(0, (offsetTop + height) - (windowHeight / 2)); | |
| 4133 | + } | |
| 4134 | + this._debug("Scroll into view. ScrollTop: " + scrollTop + ". Element offset: " + offsetTop + ". Window height: " + windowHeight + "."); | |
| 4135 | + counter = 0; | |
| 4136 | + return $('body, html').stop(true, true).animate({ | |
| 4137 | + scrollTop: Math.ceil(scrollTop) | |
| 4138 | + }, (function(_this) { | |
| 4139 | + return function() { | |
| 4140 | + if (++counter === 2) { | |
| 4141 | + _this._showPopoverAndOverlay(i); | |
| 4142 | + return _this._debug("Scroll into view.\nAnimation end element offset: " + ($element.offset().top) + ".\nWindow height: " + ($window.height()) + "."); | |
| 4143 | + } | |
| 4144 | + }; | |
| 4145 | + })(this)); | |
| 4146 | + }; | |
| 4147 | + | |
| 4148 | + Tour.prototype._initMouseNavigation = function() { | |
| 4149 | + var _this; | |
| 4150 | + _this = this; | |
| 4151 | + return $(document).off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='prev']").off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='next']").off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='end']").off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='pause-resume']").on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='next']", (function(_this) { | |
| 4152 | + return function(e) { | |
| 4153 | + e.preventDefault(); | |
| 4154 | + return _this.next(); | |
| 4155 | + }; | |
| 4156 | + })(this)).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='prev']", (function(_this) { | |
| 4157 | + return function(e) { | |
| 4158 | + e.preventDefault(); | |
| 4159 | + if (_this._current > 0) { | |
| 4160 | + return _this.prev(); | |
| 4161 | + } | |
| 4162 | + }; | |
| 4163 | + })(this)).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='end']", (function(_this) { | |
| 4164 | + return function(e) { | |
| 4165 | + e.preventDefault(); | |
| 4166 | + return _this.end(); | |
| 4167 | + }; | |
| 4168 | + })(this)).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='pause-resume']", function(e) { | |
| 4169 | + var $this; | |
| 4170 | + e.preventDefault(); | |
| 4171 | + $this = $(this); | |
| 4172 | + $this.text(_this._paused ? $this.data('pause-text') : $this.data('resume-text')); | |
| 4173 | + if (_this._paused) { | |
| 4174 | + return _this.resume(); | |
| 4175 | + } else { | |
| 4176 | + return _this.pause(); | |
| 4177 | + } | |
| 4178 | + }); | |
| 4179 | + }; | |
| 4180 | + | |
| 4181 | + Tour.prototype._initKeyboardNavigation = function() { | |
| 4182 | + if (!this._options.keyboard) { | |
| 4183 | + return; | |
| 4184 | + } | |
| 4185 | + return $(document).on("keyup.tour-" + this._options.name, (function(_this) { | |
| 4186 | + return function(e) { | |
| 4187 | + if (!e.which) { | |
| 4188 | + return; | |
| 4189 | + } | |
| 4190 | + switch (e.which) { | |
| 4191 | + case 39: | |
| 4192 | + e.preventDefault(); | |
| 4193 | + if (_this._isLast()) { | |
| 4194 | + return _this.next(); | |
| 4195 | + } else { | |
| 4196 | + return _this.end(); | |
| 4197 | + } | |
| 4198 | + break; | |
| 4199 | + case 37: | |
| 4200 | + e.preventDefault(); | |
| 4201 | + if (_this._current > 0) { | |
| 4202 | + return _this.prev(); | |
| 4203 | + } | |
| 4204 | + } | |
| 4205 | + }; | |
| 4206 | + })(this)); | |
| 4207 | + }; | |
| 4208 | + | |
| 4209 | + Tour.prototype._makePromise = function(result) { | |
| 4210 | + if (result && $.isFunction(result.then)) { | |
| 4211 | + return result; | |
| 4212 | + } else { | |
| 4213 | + return null; | |
| 4214 | + } | |
| 4215 | + }; | |
| 4216 | + | |
| 4217 | + Tour.prototype._callOnPromiseDone = function(promise, cb, arg) { | |
| 4218 | + if (promise) { | |
| 4219 | + return promise.then((function(_this) { | |
| 4220 | + return function(e) { | |
| 4221 | + return cb.call(_this, arg); | |
| 4222 | + }; | |
| 4223 | + })(this)); | |
| 4224 | + } else { | |
| 4225 | + return cb.call(this, arg); | |
| 4226 | + } | |
| 4227 | + }; | |
| 4228 | + | |
| 4229 | + Tour.prototype._showBackground = function(step, data) { | |
| 4230 | + var $backdrop, base, height, j, len, pos, ref, results, width; | |
| 4231 | + height = $(document).height(); | |
| 4232 | + width = $(document).width(); | |
| 4233 | + ref = ['top', 'bottom', 'left', 'right']; | |
| 4234 | + results = []; | |
| 4235 | + for (j = 0, len = ref.length; j < len; j++) { | |
| 4236 | + pos = ref[j]; | |
| 4237 | + $backdrop = (base = this.backdrops)[pos] != null ? base[pos] : base[pos] = $('<div>', { | |
| 4238 | + "class": "tour-backdrop " + pos | |
| 4239 | + }); | |
| 4240 | + $(step.backdropContainer).append($backdrop); | |
| 4241 | + switch (pos) { | |
| 4242 | + case 'top': | |
| 4243 | + results.push($backdrop.height(data.offset.top > 0 ? data.offset.top : 0).width(width).offset({ | |
| 4244 | + top: 0, | |
| 4245 | + left: 0 | |
| 4246 | + })); | |
| 4247 | + break; | |
| 4248 | + case 'bottom': | |
| 4249 | + results.push($backdrop.offset({ | |
| 4250 | + top: data.offset.top + data.height, | |
| 4251 | + left: 0 | |
| 4252 | + }).height(height - (data.offset.top + data.height)).width(width)); | |
| 4253 | + break; | |
| 4254 | + case 'left': | |
| 4255 | + results.push($backdrop.offset({ | |
| 4256 | + top: data.offset.top, | |
| 4257 | + left: 0 | |
| 4258 | + }).height(data.height).width(data.offset.left > 0 ? data.offset.left : 0)); | |
| 4259 | + break; | |
| 4260 | + case 'right': | |
| 4261 | + results.push($backdrop.offset({ | |
| 4262 | + top: data.offset.top, | |
| 4263 | + left: data.offset.left + data.width | |
| 4264 | + }).height(data.height).width(width - (data.offset.left + data.width))); | |
| 4265 | + break; | |
| 4266 | + default: | |
| 4267 | + results.push(void 0); | |
| 4268 | + } | |
| 4269 | + } | |
| 4270 | + return results; | |
| 4271 | + }; | |
| 4272 | + | |
| 4273 | + Tour.prototype._showOverlayElement = function(step) { | |
| 4274 | + var $backdropElement, elementData; | |
| 4275 | + $backdropElement = $(step.backdropElement); | |
| 4276 | + if ($backdropElement.length === 0) { | |
| 4277 | + elementData = { | |
| 4278 | + width: 0, | |
| 4279 | + height: 0, | |
| 4280 | + offset: { | |
| 4281 | + top: 0, | |
| 4282 | + left: 0 | |
| 4283 | + } | |
| 4284 | + }; | |
| 4285 | + } else { | |
| 4286 | + elementData = { | |
| 4287 | + width: $backdropElement.innerWidth(), | |
| 4288 | + height: $backdropElement.innerHeight(), | |
| 4289 | + offset: $backdropElement.offset() | |
| 4290 | + }; | |
| 4291 | + $backdropElement.addClass('tour-step-backdrop'); | |
| 4292 | + if (step.backdropPadding) { | |
| 4293 | + elementData = this._applyBackdropPadding(step.backdropPadding, elementData); | |
| 4294 | + } | |
| 4295 | + } | |
| 4296 | + return this._showBackground(step, elementData); | |
| 4297 | + }; | |
| 4298 | + | |
| 4299 | + Tour.prototype._hideOverlayElement = function(step) { | |
| 4300 | + var $backdrop, pos, ref; | |
| 4301 | + $(step.backdropElement).removeClass('tour-step-backdrop'); | |
| 4302 | + ref = this.backdrops; | |
| 4303 | + for (pos in ref) { | |
| 4304 | + $backdrop = ref[pos]; | |
| 4305 | + if ($backdrop && $backdrop.remove !== void 0) { | |
| 4306 | + $backdrop.remove(); | |
| 4307 | + } | |
| 4308 | + } | |
| 4309 | + return this.backdrops = []; | |
| 4310 | + }; | |
| 4311 | + | |
| 4312 | + Tour.prototype._applyBackdropPadding = function(padding, data) { | |
| 4313 | + if (typeof padding === 'object') { | |
| 4314 | + if (padding.top == null) { | |
| 4315 | + padding.top = 0; | |
| 4316 | + } | |
| 4317 | + if (padding.right == null) { | |
| 4318 | + padding.right = 0; | |
| 4319 | + } | |
| 4320 | + if (padding.bottom == null) { | |
| 4321 | + padding.bottom = 0; | |
| 4322 | + } | |
| 4323 | + if (padding.left == null) { | |
| 4324 | + padding.left = 0; | |
| 4325 | + } | |
| 4326 | + data.offset.top = data.offset.top - padding.top; | |
| 4327 | + data.offset.left = data.offset.left - padding.left; | |
| 4328 | + data.width = data.width + padding.left + padding.right; | |
| 4329 | + data.height = data.height + padding.top + padding.bottom; | |
| 4330 | + } else { | |
| 4331 | + data.offset.top = data.offset.top - padding; | |
| 4332 | + data.offset.left = data.offset.left - padding; | |
| 4333 | + data.width = data.width + (padding * 2); | |
| 4334 | + data.height = data.height + (padding * 2); | |
| 4335 | + } | |
| 4336 | + return data; | |
| 4337 | + }; | |
| 4338 | + | |
| 4339 | + Tour.prototype._clearTimer = function() { | |
| 4340 | + window.clearTimeout(this._timer); | |
| 4341 | + this._timer = null; | |
| 4342 | + return this._duration = null; | |
| 4343 | + }; | |
| 4344 | + | |
| 4345 | + Tour.prototype._getProtocol = function(url) { | |
| 4346 | + url = url.split('://'); | |
| 4347 | + if (url.length > 1) { | |
| 4348 | + return url[0]; | |
| 4349 | + } else { | |
| 4350 | + return 'http'; | |
| 4351 | + } | |
| 4352 | + }; | |
| 4353 | + | |
| 4354 | + Tour.prototype._getHost = function(url) { | |
| 4355 | + url = url.split('//'); | |
| 4356 | + url = url.length > 1 ? url[1] : url[0]; | |
| 4357 | + return url.split('/')[0]; | |
| 4358 | + }; | |
| 4359 | + | |
| 4360 | + Tour.prototype._getPath = function(path) { | |
| 4361 | + return path.replace(/\/?$/, '').split('?')[0].split('#')[0]; | |
| 4362 | + }; | |
| 4363 | + | |
| 4364 | + Tour.prototype._getQuery = function(path) { | |
| 4365 | + return this._getParams(path, '?'); | |
| 4366 | + }; | |
| 4367 | + | |
| 4368 | + Tour.prototype._getHash = function(path) { | |
| 4369 | + return this._getParams(path, '#'); | |
| 4370 | + }; | |
| 4371 | + | |
| 4372 | + Tour.prototype._getParams = function(path, start) { | |
| 4373 | + var j, len, param, params, paramsObject; | |
| 4374 | + params = path.split(start); | |
| 4375 | + if (params.length === 1) { | |
| 4376 | + return {}; | |
| 4377 | + } | |
| 4378 | + params = params[1].split('&'); | |
| 4379 | + paramsObject = {}; | |
| 4380 | + for (j = 0, len = params.length; j < len; j++) { | |
| 4381 | + param = params[j]; | |
| 4382 | + param = param.split('='); | |
| 4383 | + paramsObject[param[0]] = param[1] || ''; | |
| 4384 | + } | |
| 4385 | + return paramsObject; | |
| 4386 | + }; | |
| 4387 | + | |
| 4388 | + Tour.prototype._equal = function(obj1, obj2) { | |
| 4389 | + var j, k, len, obj1Keys, obj2Keys, v; | |
| 4390 | + if ({}.toString.call(obj1) === '[object Object]' && {}.toString.call(obj2) === '[object Object]') { | |
| 4391 | + obj1Keys = Object.keys(obj1); | |
| 4392 | + obj2Keys = Object.keys(obj2); | |
| 4393 | + if (obj1Keys.length !== obj2Keys.length) { | |
| 4394 | + return false; | |
| 4395 | + } | |
| 4396 | + for (k in obj1) { | |
| 4397 | + v = obj1[k]; | |
| 4398 | + if (!this._equal(obj2[k], v)) { | |
| 4399 | + return false; | |
| 4400 | + } | |
| 4401 | + } | |
| 4402 | + return true; | |
| 4403 | + } else if ({}.toString.call(obj1) === '[object Array]' && {}.toString.call(obj2) === '[object Array]') { | |
| 4404 | + if (obj1.length !== obj2.length) { | |
| 4405 | + return false; | |
| 4406 | + } | |
| 4407 | + for (k = j = 0, len = obj1.length; j < len; k = ++j) { | |
| 4408 | + v = obj1[k]; | |
| 4409 | + if (!this._equal(v, obj2[k])) { | |
| 4410 | + return false; | |
| 4411 | + } | |
| 4412 | + } | |
| 4413 | + return true; | |
| 4414 | + } else { | |
| 4415 | + return obj1 === obj2; | |
| 4416 | + } | |
| 4417 | + }; | |
| 4418 | + | |
| 4419 | + return Tour; | |
| 4420 | + | |
| 4421 | + })(); | |
| 4422 | + return Tour; | |
| 4423 | +}); | ... | ... |
pacotes/bootstrap-tour/build/js/bootstrap-tour-standalone.min.js
0 → 100644
| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | +/* ======================================================================== | |
| 2 | + * bootstrap-tour - v0.12.0 | |
| 3 | + * http://bootstraptour.com | |
| 4 | + * ======================================================================== | |
| 5 | + * Copyright 2012-2017 Ulrich Sossou | |
| 6 | + * | |
| 7 | + * ======================================================================== | |
| 8 | + * Licensed under the MIT License (the "License"); | |
| 9 | + * you may not use this file except in compliance with the License. | |
| 10 | + * You may obtain a copy of the License at | |
| 11 | + * | |
| 12 | + * https://opensource.org/licenses/MIT | |
| 13 | + * | |
| 14 | + * Unless required by applicable law or agreed to in writing, software | |
| 15 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 16 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 17 | + * See the License for the specific language governing permissions and | |
| 18 | + * limitations under the License. | |
| 19 | + * ======================================================================== | |
| 20 | + */ | |
| 21 | + | |
| 22 | +function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Popper=e()}(this,function(){"use strict";function t(t){var e={};return t&&"[object Function]"===e.toString.call(t)}function e(t,e){if(1!==t.nodeType)return[];var n=window.getComputedStyle(t,null);return e?n[e]:n}function n(t){return"HTML"===t.nodeName?t:t.parentNode||t.host}function o(t){if(!t||-1!==["HTML","BODY","#document"].indexOf(t.nodeName))return window.document.body;var i=e(t),r=i.overflow,s=i.overflowX,a=i.overflowY;return/(auto|scroll)/.test(r+a+s)?t:o(n(t))}function i(t){var n=t&&t.offsetParent,o=n&&n.nodeName;return o&&"BODY"!==o&&"HTML"!==o?-1!==["TD","TABLE"].indexOf(n.nodeName)&&"static"===e(n,"position")?i(n):n:window.document.documentElement}function r(t){var e=t.nodeName;return"BODY"!==e&&("HTML"===e||i(t.firstElementChild)===t)}function s(t){return null!==t.parentNode?s(t.parentNode):t}function a(t,e){if(!(t&&t.nodeType&&e&&e.nodeType))return window.document.documentElement;var n=t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING,o=n?t:e,p=n?e:t,u=document.createRange();u.setStart(o,0),u.setEnd(p,0);var l=u.commonAncestorContainer;if(t!==l&&e!==l||o.contains(p))return r(l)?l:i(l);var c=s(t);return c.host?a(c.host,e):a(t,s(e).host)}function p(t){var e="top"===(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top")?"scrollTop":"scrollLeft",n=t.nodeName;if("BODY"===n||"HTML"===n){var o=window.document.documentElement;return(window.document.scrollingElement||o)[e]}return t[e]}function u(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=p(e,"top"),i=p(e,"left"),r=n?-1:1;return t.top+=o*r,t.bottom+=o*r,t.left+=i*r,t.right+=i*r,t}function l(t,e){var n="x"===e?"Left":"Top",o="Left"===n?"Right":"Bottom";return+t["border"+n+"Width"].split("px")[0]+ +t["border"+o+"Width"].split("px")[0]}function c(t,e,n,o){return Math.max(e["offset"+t],e["scroll"+t],n["client"+t],n["offset"+t],n["scroll"+t],Z()?n["offset"+t]+o["margin"+("Height"===t?"Top":"Left")]+o["margin"+("Height"===t?"Bottom":"Right")]:0)}function h(){var t=window.document.body,e=window.document.documentElement,n=Z()&&window.getComputedStyle(e);return{height:c("Height",t,e,n),width:c("Width",t,e,n)}}function f(t){return nt({},t,{right:t.left+t.width,bottom:t.top+t.height})}function d(t){var n={};if(Z())try{n=t.getBoundingClientRect();var o=p(t,"top"),i=p(t,"left");n.top+=o,n.left+=i,n.bottom+=o,n.right+=i}catch(t){}else n=t.getBoundingClientRect();var r={left:n.left,top:n.top,width:n.right-n.left,height:n.bottom-n.top},s="HTML"===t.nodeName?h():{},a=s.width||t.clientWidth||r.right-r.left,u=s.height||t.clientHeight||r.bottom-r.top,c=t.offsetWidth-a,d=t.offsetHeight-u;if(c||d){var m=e(t);c-=l(m,"x"),d-=l(m,"y"),r.width-=c,r.height-=d}return f(r)}function m(t,n){var i=Z(),r="HTML"===n.nodeName,s=d(t),a=d(n),p=o(t),l=e(n),c=+l.borderTopWidth.split("px")[0],h=+l.borderLeftWidth.split("px")[0],m=f({top:s.top-a.top-c,left:s.left-a.left-h,width:s.width,height:s.height});if(m.marginTop=0,m.marginLeft=0,!i&&r){var g=+l.marginTop.split("px")[0],v=+l.marginLeft.split("px")[0];m.top-=c-g,m.bottom-=c-g,m.left-=h-v,m.right-=h-v,m.marginTop=g,m.marginLeft=v}return(i?n.contains(p):n===p&&"BODY"!==p.nodeName)&&(m=u(m,n)),m}function g(t){var e=window.document.documentElement,n=m(t,e),o=Math.max(e.clientWidth,window.innerWidth||0),i=Math.max(e.clientHeight,window.innerHeight||0),r=p(e),s=p(e,"left");return f({top:r-n.top+n.marginTop,left:s-n.left+n.marginLeft,width:o,height:i})}function v(t){var o=t.nodeName;return"BODY"!==o&&"HTML"!==o&&("fixed"===e(t,"position")||v(n(t)))}function _(t,e,i,r){var s={top:0,left:0},p=a(t,e);if("viewport"===r)s=g(p);else{var u=void 0;"scrollParent"===r?"BODY"===(u=o(n(t))).nodeName&&(u=window.document.documentElement):u="window"===r?window.document.documentElement:r;var l=m(u,p);if("HTML"!==u.nodeName||v(p))s=l;else{var c=h(),f=c.height,d=c.width;s.top+=l.top-l.marginTop,s.bottom=f+l.top,s.left+=l.left-l.marginLeft,s.right=d+l.left}}return s.left+=i,s.top+=i,s.right-=i,s.bottom-=i,s}function b(t){return t.width*t.height}function y(t,e,n,o,i){var r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(-1===t.indexOf("auto"))return t;var s=_(n,o,r,i),a={top:{width:s.width,height:e.top-s.top},right:{width:s.right-e.right,height:s.height},bottom:{width:s.width,height:s.bottom-e.bottom},left:{width:e.left-s.left,height:s.height}},p=Object.keys(a).map(function(t){return nt({key:t},a[t],{area:b(a[t])})}).sort(function(t,e){return e.area-t.area}),u=p.filter(function(t){var e=t.width,o=t.height;return e>=n.clientWidth&&o>=n.clientHeight}),l=u.length>0?u[0].key:p[0].key,c=t.split("-")[1];return l+(c?"-"+c:"")}function w(t,e,n){return m(n,a(e,n))}function E(t){var e=window.getComputedStyle(t),n=parseFloat(e.marginTop)+parseFloat(e.marginBottom),o=parseFloat(e.marginLeft)+parseFloat(e.marginRight);return{width:t.offsetWidth+o,height:t.offsetHeight+n}}function S(t){var e={left:"right",right:"left",bottom:"top",top:"bottom"};return t.replace(/left|right|bottom|top/g,function(t){return e[t]})}function T(t,e,n){n=n.split("-")[0];var o=E(t),i={width:o.width,height:o.height},r=-1!==["right","left"].indexOf(n),s=r?"top":"left",a=r?"left":"top",p=r?"height":"width",u=r?"width":"height";return i[s]=e[s]+e[p]/2-o[p]/2,i[a]=n===a?e[a]-o[u]:e[S(a)],i}function O(t,e){return Array.prototype.find?t.find(e):t.filter(e)[0]}function C(t,e,n){if(Array.prototype.findIndex)return t.findIndex(function(t){return t[e]===n});var o=O(t,function(t){return t[e]===n});return t.indexOf(o)}function x(e,n,o){return(void 0===o?e:e.slice(0,C(e,"name",o))).forEach(function(e){e.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var o=e.function||e.fn;e.enabled&&t(o)&&(n.offsets.popper=f(n.offsets.popper),n.offsets.reference=f(n.offsets.reference),n=o(n,e))}),n}function k(){if(!this.state.isDestroyed){var t={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};t.offsets.reference=w(this.state,this.popper,this.reference),t.placement=y(this.options.placement,t.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),t.originalPlacement=t.placement,t.offsets.popper=T(this.popper,t.offsets.reference,t.placement),t.offsets.popper.position="absolute",t=x(this.modifiers,t),this.state.isCreated?this.options.onUpdate(t):(this.state.isCreated=!0,this.options.onCreate(t))}}function P(t,e){return t.some(function(t){var n=t.name;return t.enabled&&n===e})}function D(t){for(var e=[!1,"ms","Webkit","Moz","O"],n=t.charAt(0).toUpperCase()+t.slice(1),o=0;o<e.length-1;o++){var i=e[o],r=i?""+i+n:t;if(void 0!==window.document.body.style[r])return r}return null}function N(){return this.state.isDestroyed=!0,P(this.modifiers,"applyStyle")&&(this.popper.removeAttribute("x-placement"),this.popper.style.left="",this.popper.style.position="",this.popper.style.top="",this.popper.style[D("transform")]=""),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}function A(t,e,n,i){var r="BODY"===t.nodeName,s=r?window:t;s.addEventListener(e,n,{passive:!0}),r||A(o(s.parentNode),e,n,i),i.push(s)}function H(t,e,n,i){n.updateBound=i,window.addEventListener("resize",n.updateBound,{passive:!0});var r=o(t);return A(r,"scroll",n.updateBound,n.scrollParents),n.scrollElement=r,n.eventsEnabled=!0,n}function j(){this.state.eventsEnabled||(this.state=H(this.reference,this.options,this.state,this.scheduleUpdate))}function I(t,e){return window.removeEventListener("resize",e.updateBound),e.scrollParents.forEach(function(t){t.removeEventListener("scroll",e.updateBound)}),e.updateBound=null,e.scrollParents=[],e.scrollElement=null,e.eventsEnabled=!1,e}function R(){this.state.eventsEnabled&&(window.cancelAnimationFrame(this.scheduleUpdate),this.state=I(this.reference,this.state))}function L(t){return""!==t&&!isNaN(parseFloat(t))&&isFinite(t)}function W(t,e){Object.keys(e).forEach(function(n){var o="";-1!==["width","height","top","right","bottom","left"].indexOf(n)&&L(e[n])&&(o="px"),t.style[n]=e[n]+o})}function U(t,e){Object.keys(e).forEach(function(n){!1!==e[n]?t.setAttribute(n,e[n]):t.removeAttribute(n)})}function M(t,e,n){var o=O(t,function(t){return t.name===e}),i=!!o&&t.some(function(t){return t.name===n&&t.enabled&&t.order<o.order});if(!i){var r="`"+e+"`",s="`"+n+"`";console.warn(s+" modifier is required by "+r+" modifier in order to work, be sure to include it before "+r+"!")}return i}function F(t){return"end"===t?"start":"start"===t?"end":t}function B(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=it.indexOf(t),o=it.slice(n+1).concat(it.slice(0,n));return e?o.reverse():o}function K(t,e,n,o){var i=t.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),r=+i[1],s=i[2];if(!r)return t;if(0===s.indexOf("%")){var a=void 0;switch(s){case"%p":a=n;break;case"%":case"%r":default:a=o}return f(a)[e]/100*r}if("vh"===s||"vw"===s){return("vh"===s?Math.max(document.documentElement.clientHeight,window.innerHeight||0):Math.max(document.documentElement.clientWidth,window.innerWidth||0))/100*r}return r}function q(t,e,n,o){var i=[0,0],r=-1!==["right","left"].indexOf(o),s=t.split(/(\+|\-)/).map(function(t){return t.trim()}),a=s.indexOf(O(s,function(t){return-1!==t.search(/,|\s/)}));s[a]&&-1===s[a].indexOf(",")&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var p=/\s*,\s*|\s+/,u=-1!==a?[s.slice(0,a).concat([s[a].split(p)[0]]),[s[a].split(p)[1]].concat(s.slice(a+1))]:[s];return(u=u.map(function(t,o){var i=(1===o?!r:r)?"height":"width",s=!1;return t.reduce(function(t,e){return""===t[t.length-1]&&-1!==["+","-"].indexOf(e)?(t[t.length-1]=e,s=!0,t):s?(t[t.length-1]+=e,s=!1,t):t.concat(e)},[]).map(function(t){return K(t,i,e,n)})})).forEach(function(t,e){t.forEach(function(n,o){L(n)&&(i[e]+=n*("-"===t[o-1]?-1:1))})}),i}for(var Y=["native code","[object MutationObserverConstructor]"],V="undefined"!=typeof window,Q=["Edge","Trident","Firefox"],G=0,z=0;z<Q.length;z+=1)if(V&&navigator.userAgent.indexOf(Q[z])>=0){G=1;break}var J=V&&function(t){return Y.some(function(e){return(t||"").toString().indexOf(e)>-1})}(window.MutationObserver)?function(t){var e=!1,n=0,o=document.createElement("span");return new MutationObserver(function(){t(),e=!1}).observe(o,{attributes:!0}),function(){e||(e=!0,o.setAttribute("x-index",n),n+=1)}}:function(t){var e=!1;return function(){e||(e=!0,setTimeout(function(){e=!1,t()},G))}},X=void 0,Z=function(){return void 0===X&&(X=-1!==navigator.appVersion.indexOf("MSIE 10")),X},$=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},tt=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),et=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},nt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},ot=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],it=ot.slice(3),rt={FLIP:"flip",CLOCKWISE:"clockwise",COUNTERCLOCKWISE:"counterclockwise"},st={placement:"bottom",eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(t){var e=t.placement,n=e.split("-")[0],o=e.split("-")[1];if(o){var i=t.offsets,r=i.reference,s=i.popper,a=-1!==["bottom","top"].indexOf(n),p=a?"left":"top",u=a?"width":"height",l={start:et({},p,r[p]),end:et({},p,r[p]+r[u]-s[u])};t.offsets.popper=nt({},s,l[o])}return t}},offset:{order:200,enabled:!0,fn:function(t,e){var n=e.offset,o=t.placement,i=t.offsets,r=i.popper,s=i.reference,a=o.split("-")[0],p=void 0;return p=L(+n)?[+n,0]:q(n,r,s,a),"left"===a?(r.top+=p[0],r.left-=p[1]):"right"===a?(r.top+=p[0],r.left+=p[1]):"top"===a?(r.left+=p[0],r.top-=p[1]):"bottom"===a&&(r.left+=p[0],r.top+=p[1]),t.popper=r,t},offset:0},preventOverflow:{order:300,enabled:!0,fn:function(t,e){var n=e.boundariesElement||i(t.instance.popper);t.instance.reference===n&&(n=i(n));var o=_(t.instance.popper,t.instance.reference,e.padding,n);e.boundaries=o;var r=e.priority,s=t.offsets.popper,a={primary:function(t){var n=s[t];return s[t]<o[t]&&!e.escapeWithReference&&(n=Math.max(s[t],o[t])),et({},t,n)},secondary:function(t){var n="right"===t?"left":"top",i=s[n];return s[t]>o[t]&&!e.escapeWithReference&&(i=Math.min(s[n],o[t]-("right"===t?s.width:s.height))),et({},n,i)}};return r.forEach(function(t){var e=-1!==["left","top"].indexOf(t)?"primary":"secondary";s=nt({},s,a[e](t))}),t.offsets.popper=s,t},priority:["left","right","top","bottom"],padding:5,boundariesElement:"scrollParent"},keepTogether:{order:400,enabled:!0,fn:function(t){var e=t.offsets,n=e.popper,o=e.reference,i=t.placement.split("-")[0],r=Math.floor,s=-1!==["top","bottom"].indexOf(i),a=s?"right":"bottom",p=s?"left":"top",u=s?"width":"height";return n[a]<r(o[p])&&(t.offsets.popper[p]=r(o[p])-n[u]),n[p]>r(o[a])&&(t.offsets.popper[p]=r(o[a])),t}},arrow:{order:500,enabled:!0,fn:function(t,n){if(!M(t.instance.modifiers,"arrow","keepTogether"))return t;var o=n.element;if("string"==typeof o){if(!(o=t.instance.popper.querySelector(o)))return t}else if(!t.instance.popper.contains(o))return console.warn("WARNING: `arrow.element` must be child of its popper element!"),t;var i=t.placement.split("-")[0],r=t.offsets,s=r.popper,a=r.reference,p=-1!==["left","right"].indexOf(i),u=p?"height":"width",l=p?"Top":"Left",c=l.toLowerCase(),h=p?"left":"top",d=p?"bottom":"right",m=E(o)[u];a[d]-m<s[c]&&(t.offsets.popper[c]-=s[c]-(a[d]-m)),a[c]+m>s[d]&&(t.offsets.popper[c]+=a[c]+m-s[d]);var g=a[c]+a[u]/2-m/2,v=e(t.instance.popper,"margin"+l).replace("px",""),_=g-f(t.offsets.popper)[c]-v;return _=Math.max(Math.min(s[u]-m,_),0),t.arrowElement=o,t.offsets.arrow={},t.offsets.arrow[c]=Math.round(_),t.offsets.arrow[h]="",t},element:"[x-arrow]"},flip:{order:600,enabled:!0,fn:function(t,e){if(P(t.instance.modifiers,"inner"))return t;if(t.flipped&&t.placement===t.originalPlacement)return t;var n=_(t.instance.popper,t.instance.reference,e.padding,e.boundariesElement),o=t.placement.split("-")[0],i=S(o),r=t.placement.split("-")[1]||"",s=[];switch(e.behavior){case rt.FLIP:s=[o,i];break;case rt.CLOCKWISE:s=B(o);break;case rt.COUNTERCLOCKWISE:s=B(o,!0);break;default:s=e.behavior}return s.forEach(function(a,p){if(o!==a||s.length===p+1)return t;o=t.placement.split("-")[0],i=S(o);var u=t.offsets.popper,l=t.offsets.reference,c=Math.floor,h="left"===o&&c(u.right)>c(l.left)||"right"===o&&c(u.left)<c(l.right)||"top"===o&&c(u.bottom)>c(l.top)||"bottom"===o&&c(u.top)<c(l.bottom),f=c(u.left)<c(n.left),d=c(u.right)>c(n.right),m=c(u.top)<c(n.top),g=c(u.bottom)>c(n.bottom),v="left"===o&&f||"right"===o&&d||"top"===o&&m||"bottom"===o&&g,_=-1!==["top","bottom"].indexOf(o),b=!!e.flipVariations&&(_&&"start"===r&&f||_&&"end"===r&&d||!_&&"start"===r&&m||!_&&"end"===r&&g);(h||v||b)&&(t.flipped=!0,(h||v)&&(o=s[p+1]),b&&(r=F(r)),t.placement=o+(r?"-"+r:""),t.offsets.popper=nt({},t.offsets.popper,T(t.instance.popper,t.offsets.reference,t.placement)),t=x(t.instance.modifiers,t,"flip"))}),t},behavior:"flip",padding:5,boundariesElement:"viewport"},inner:{order:700,enabled:!1,fn:function(t){var e=t.placement,n=e.split("-")[0],o=t.offsets,i=o.popper,r=o.reference,s=-1!==["left","right"].indexOf(n),a=-1===["top","left"].indexOf(n);return i[s?"left":"top"]=r[n]-(a?i[s?"width":"height"]:0),t.placement=S(e),t.offsets.popper=f(i),t}},hide:{order:800,enabled:!0,fn:function(t){if(!M(t.instance.modifiers,"hide","preventOverflow"))return t;var e=t.offsets.reference,n=O(t.instance.modifiers,function(t){return"preventOverflow"===t.name}).boundaries;if(e.bottom<n.top||e.left>n.right||e.top>n.bottom||e.right<n.left){if(!0===t.hide)return t;t.hide=!0,t.attributes["x-out-of-boundaries"]=""}else{if(!1===t.hide)return t;t.hide=!1,t.attributes["x-out-of-boundaries"]=!1}return t}},computeStyle:{order:850,enabled:!0,fn:function(t,e){var n=e.x,o=e.y,r=t.offsets.popper,s=O(t.instance.modifiers,function(t){return"applyStyle"===t.name}).gpuAcceleration;void 0!==s&&console.warn("WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!");var a=void 0!==s?s:e.gpuAcceleration,p=d(i(t.instance.popper)),u={position:r.position},l={left:Math.floor(r.left),top:Math.floor(r.top),bottom:Math.floor(r.bottom),right:Math.floor(r.right)},c="bottom"===n?"top":"bottom",h="right"===o?"left":"right",f=D("transform"),m=void 0,g=void 0;if(g="bottom"===c?-p.height+l.bottom:l.top,m="right"===h?-p.width+l.right:l.left,a&&f)u[f]="translate3d("+m+"px, "+g+"px, 0)",u[c]=0,u[h]=0,u.willChange="transform";else{var v="bottom"===c?-1:1,_="right"===h?-1:1;u[c]=g*v,u[h]=m*_,u.willChange=c+", "+h}var b={"x-placement":t.placement};return t.attributes=nt({},b,t.attributes),t.styles=nt({},u,t.styles),t.arrowStyles=nt({},t.offsets.arrow,t.arrowStyles),t},gpuAcceleration:!0,x:"bottom",y:"right"},applyStyle:{order:900,enabled:!0,fn:function(t){return W(t.instance.popper,t.styles),U(t.instance.popper,t.attributes),t.arrowElement&&Object.keys(t.arrowStyles).length&&W(t.arrowElement,t.arrowStyles),t},onLoad:function(t,e,n,o,i){var r=w(i,e,t),s=y(n.placement,r,e,t,n.modifiers.flip.boundariesElement,n.modifiers.flip.padding);return e.setAttribute("x-placement",s),W(e,{position:"absolute"}),n},gpuAcceleration:void 0}}},at=function(){function e(n,o){var i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};$(this,e),this.scheduleUpdate=function(){return requestAnimationFrame(i.update)},this.update=J(this.update.bind(this)),this.options=nt({},e.Defaults,r),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=n.jquery?n[0]:n,this.popper=o.jquery?o[0]:o,this.options.modifiers={},Object.keys(nt({},e.Defaults.modifiers,r.modifiers)).forEach(function(t){i.options.modifiers[t]=nt({},e.Defaults.modifiers[t]||{},r.modifiers?r.modifiers[t]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(t){return nt({name:t},i.options.modifiers[t])}).sort(function(t,e){return t.order-e.order}),this.modifiers.forEach(function(e){e.enabled&&t(e.onLoad)&&e.onLoad(i.reference,i.popper,i.options,e,i.state)}),this.update();var s=this.options.eventsEnabled;s&&this.enableEventListeners(),this.state.eventsEnabled=s}return tt(e,[{key:"update",value:function(){return k.call(this)}},{key:"destroy",value:function(){return N.call(this)}},{key:"enableEventListeners",value:function(){return j.call(this)}},{key:"disableEventListeners",value:function(){return R.call(this)}}]),e}();return at.Utils=("undefined"!=typeof window?window:global).PopperUtils,at.placements=ot,at.Defaults=st,at});var Util=function(t){function e(t){return{}.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function n(t){return(t[0]||t).nodeType}function o(){return{bindType:s.end,delegateType:s.end,handle:function(e){if(t(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}}}function i(){if(window.QUnit)return!1;var t=document.createElement("bootstrap");for(var e in a)if(void 0!==t.style[e])return{end:a[e]};return!1}function r(e){var n=this,o=!1;return t(this).one(p.TRANSITION_END,function(){o=!0}),setTimeout(function(){o||p.triggerTransitionEnd(n)},e),this}var s=!1,a={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},p={TRANSITION_END:"bsTransitionEnd",getUID:function(t){do{t+=~~(1e6*Math.random())}while(document.getElementById(t));return t},getSelectorFromElement:function(e){var n=e.getAttribute("data-target");n&&"#"!==n||(n=e.getAttribute("href")||"");try{return t(n).length>0?n:null}catch(t){return null}},reflow:function(t){return t.offsetHeight},triggerTransitionEnd:function(e){t(e).trigger(s.end)},supportsTransitionEnd:function(){return Boolean(s)},typeCheckConfig:function(t,o,i){for(var r in i)if(i.hasOwnProperty(r)){var s=i[r],a=o[r],p=a&&n(a)?"element":e(a);if(!new RegExp(s).test(p))throw new Error(t.toUpperCase()+': Option "'+r+'" provided type "'+p+'" but expected type "'+s+'".')}}};return s=i(),t.fn.emulateTransitionEnd=r,p.supportsTransitionEnd()&&(t.event.special[p.TRANSITION_END]=o()),p}(jQuery),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_createClass=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),Tooltip=function(t){if("undefined"==typeof Popper)throw new Error("Bootstrap tooltips require Popper.js (https://popper.js.org)");var e="tooltip",n=".bs.tooltip",o=t.fn[e],i=new RegExp("(^|\\s)bs-tooltip\\S+","g"),r={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(number|string)",container:"(string|element|boolean)",fallbackPlacement:"(string|array)"},s={AUTO:"auto",TOP:"top",RIGHT:"right",BOTTOM:"bottom",LEFT:"left"},a={animation:!0,template:'<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip"},p={SHOW:"show",OUT:"out"},u={HIDE:"hide"+n,HIDDEN:"hidden"+n,SHOW:"show"+n,SHOWN:"shown"+n,INSERTED:"inserted"+n,CLICK:"click"+n,FOCUSIN:"focusin"+n,FOCUSOUT:"focusout"+n,MOUSEENTER:"mouseenter"+n,MOUSELEAVE:"mouseleave"+n},l={FADE:"fade",SHOW:"show"},c={TOOLTIP:".tooltip",TOOLTIP_INNER:".tooltip-inner",ARROW:".arrow"},h={HOVER:"hover",FOCUS:"focus",CLICK:"click",MANUAL:"manual"},f=function(){function o(t,e){_classCallCheck(this,o),this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=t,this.config=this._getConfig(e),this.tip=null,this._setListeners()}return o.prototype.enable=function(){this._isEnabled=!0},o.prototype.disable=function(){this._isEnabled=!1},o.prototype.toggleEnabled=function(){this._isEnabled=!this._isEnabled},o.prototype.toggle=function(e){if(e){var n=this.constructor.DATA_KEY,o=t(e.currentTarget).data(n);o||(o=new this.constructor(e.currentTarget,this._getDelegateConfig()),t(e.currentTarget).data(n,o)),o._activeTrigger.click=!o._activeTrigger.click,o._isWithActiveTrigger()?o._enter(null,o):o._leave(null,o)}else{if(t(this.getTipElement()).hasClass(l.SHOW))return void this._leave(null,this);this._enter(null,this)}},o.prototype.dispose=function(){clearTimeout(this._timeout),t.removeData(this.element,this.constructor.DATA_KEY),t(this.element).off(this.constructor.EVENT_KEY),t(this.element).closest(".modal").off("hide.bs.modal"),this.tip&&t(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,null!==this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},o.prototype.show=function(){var e=this;if("none"===t(this.element).css("display"))throw new Error("Please use show on visible elements");var n=t.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){t(this.element).trigger(n);var i=t.contains(this.element.ownerDocument.documentElement,this.element);if(n.isDefaultPrevented()||!i)return;var r=this.getTipElement(),s=Util.getUID(this.constructor.NAME);r.setAttribute("id",s),this.element.setAttribute("aria-describedby",s),this.setContent(),this.config.animation&&t(r).addClass(l.FADE);var a="function"==typeof this.config.placement?this.config.placement.call(this,r,this.element):this.config.placement,u=this._getAttachment(a);this.addAttachmentClass(u);var h=!1===this.config.container?document.body:t(this.config.container);t(r).data(this.constructor.DATA_KEY,this),t.contains(this.element.ownerDocument.documentElement,this.tip)||t(r).appendTo(h),t(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new Popper(this.element,r,{placement:u,modifiers:{offset:{offset:this.config.offset},flip:{behavior:this.config.fallbackPlacement},arrow:{element:c.ARROW}},onCreate:function(t){t.originalPlacement!==t.placement&&e._handlePopperPlacementChange(t)},onUpdate:function(t){e._handlePopperPlacementChange(t)}}),t(r).addClass(l.SHOW),"ontouchstart"in document.documentElement&&t("body").children().on("mouseover",null,t.noop);var f=function(){e.config.animation&&e._fixTransition();var n=e._hoverState;e._hoverState=null,t(e.element).trigger(e.constructor.Event.SHOWN),n===p.OUT&&e._leave(null,e)};Util.supportsTransitionEnd()&&t(this.tip).hasClass(l.FADE)?t(this.tip).one(Util.TRANSITION_END,f).emulateTransitionEnd(o._TRANSITION_DURATION):f()}},o.prototype.hide=function(e){var n=this,o=this.getTipElement(),i=t.Event(this.constructor.Event.HIDE),r=function(){n._hoverState!==p.SHOW&&o.parentNode&&o.parentNode.removeChild(o),n._cleanTipClass(),n.element.removeAttribute("aria-describedby"),t(n.element).trigger(n.constructor.Event.HIDDEN),null!==n._popper&&n._popper.destroy(),e&&e()};t(this.element).trigger(i),i.isDefaultPrevented()||(t(o).removeClass(l.SHOW),"ontouchstart"in document.documentElement&&t("body").children().off("mouseover",null,t.noop),this._activeTrigger[h.CLICK]=!1,this._activeTrigger[h.FOCUS]=!1,this._activeTrigger[h.HOVER]=!1,Util.supportsTransitionEnd()&&t(this.tip).hasClass(l.FADE)?t(o).one(Util.TRANSITION_END,r).emulateTransitionEnd(150):r(),this._hoverState="")},o.prototype.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},o.prototype.isWithContent=function(){return Boolean(this.getTitle())},o.prototype.addAttachmentClass=function(e){t(this.getTipElement()).addClass("bs-tooltip-"+e)},o.prototype.getTipElement=function(){return this.tip=this.tip||t(this.config.template)[0]},o.prototype.setContent=function(){var e=t(this.getTipElement());this.setElementContent(e.find(c.TOOLTIP_INNER),this.getTitle()),e.removeClass(l.FADE+" "+l.SHOW)},o.prototype.setElementContent=function(e,n){var o=this.config.html;"object"===(void 0===n?"undefined":_typeof(n))&&(n.nodeType||n.jquery)?o?t(n).parent().is(e)||e.empty().append(n):e.text(t(n).text()):e[o?"html":"text"](n)},o.prototype.getTitle=function(){var t=this.element.getAttribute("data-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),t},o.prototype._getAttachment=function(t){return s[t.toUpperCase()]},o.prototype._setListeners=function(){var e=this;this.config.trigger.split(" ").forEach(function(n){if("click"===n)t(e.element).on(e.constructor.Event.CLICK,e.config.selector,function(t){return e.toggle(t)});else if(n!==h.MANUAL){var o=n===h.HOVER?e.constructor.Event.MOUSEENTER:e.constructor.Event.FOCUSIN,i=n===h.HOVER?e.constructor.Event.MOUSELEAVE:e.constructor.Event.FOCUSOUT;t(e.element).on(o,e.config.selector,function(t){return e._enter(t)}).on(i,e.config.selector,function(t){return e._leave(t)})}t(e.element).closest(".modal").on("hide.bs.modal",function(){return e.hide()})}),this.config.selector?this.config=t.extend({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},o.prototype._fixTitle=function(){var t=_typeof(this.element.getAttribute("data-original-title"));(this.element.getAttribute("title")||"string"!==t)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},o.prototype._enter=function(e,n){var o=this.constructor.DATA_KEY;(n=n||t(e.currentTarget).data(o))||(n=new this.constructor(e.currentTarget,this._getDelegateConfig()),t(e.currentTarget).data(o,n)),e&&(n._activeTrigger["focusin"===e.type?h.FOCUS:h.HOVER]=!0),t(n.getTipElement()).hasClass(l.SHOW)||n._hoverState===p.SHOW?n._hoverState=p.SHOW:(clearTimeout(n._timeout),n._hoverState=p.SHOW,n.config.delay&&n.config.delay.show?n._timeout=setTimeout(function(){n._hoverState===p.SHOW&&n.show()},n.config.delay.show):n.show())},o.prototype._leave=function(e,n){var o=this.constructor.DATA_KEY;(n=n||t(e.currentTarget).data(o))||(n=new this.constructor(e.currentTarget,this._getDelegateConfig()),t(e.currentTarget).data(o,n)),e&&(n._activeTrigger["focusout"===e.type?h.FOCUS:h.HOVER]=!1),n._isWithActiveTrigger()||(clearTimeout(n._timeout),n._hoverState=p.OUT,n.config.delay&&n.config.delay.hide?n._timeout=setTimeout(function(){n._hoverState===p.OUT&&n.hide()},n.config.delay.hide):n.hide())},o.prototype._isWithActiveTrigger=function(){for(var t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1},o.prototype._getConfig=function(n){return(n=t.extend({},this.constructor.Default,t(this.element).data(),n)).delay&&"number"==typeof n.delay&&(n.delay={show:n.delay,hide:n.delay}),n.title&&"number"==typeof n.title&&(n.title=n.title.toString()),n.content&&"number"==typeof n.content&&(n.content=n.content.toString()),Util.typeCheckConfig(e,n,this.constructor.DefaultType),n},o.prototype._getDelegateConfig=function(){var t={};if(this.config)for(var e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t},o.prototype._cleanTipClass=function(){var e=t(this.getTipElement()),n=e.attr("class").match(i);null!==n&&n.length>0&&e.removeClass(n.join(""))},o.prototype._handlePopperPlacementChange=function(t){this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(t.placement))},o.prototype._fixTransition=function(){var e=this.getTipElement(),n=this.config.animation;null===e.getAttribute("x-placement")&&(t(e).removeClass(l.FADE),this.config.animation=!1,this.hide(),this.show(),this.config.animation=n)},o._jQueryInterface=function(e){return this.each(function(){var n=t(this).data("bs.tooltip"),i="object"===(void 0===e?"undefined":_typeof(e))&&e;if((n||!/dispose|hide/.test(e))&&(n||(n=new o(this,i),t(this).data("bs.tooltip",n)),"string"==typeof e)){if(void 0===n[e])throw new Error('No method named "'+e+'"');n[e]()}})},_createClass(o,null,[{key:"VERSION",get:function(){return"4.0.0-beta"}},{key:"Default",get:function(){return a}},{key:"NAME",get:function(){return e}},{key:"DATA_KEY",get:function(){return"bs.tooltip"}},{key:"Event",get:function(){return u}},{key:"EVENT_KEY",get:function(){return n}},{key:"DefaultType",get:function(){return r}}]),o}();return t.fn[e]=f._jQueryInterface,t.fn[e].Constructor=f,t.fn[e].noConflict=function(){return t.fn[e]=o,f._jQueryInterface},f}(jQuery),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_createClass=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),Popover=function(t){var e="popover",n=".bs.popover",o=t.fn[e],i=new RegExp("(^|\\s)bs-popover\\S+","g"),r=t.extend({},Tooltip.Default,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'}),s=t.extend({},Tooltip.DefaultType,{content:"(string|element|function)"}),a={FADE:"fade",SHOW:"show"},p={TITLE:".popover-header",CONTENT:".popover-body"},u={HIDE:"hide"+n,HIDDEN:"hidden"+n,SHOW:"show"+n,SHOWN:"shown"+n,INSERTED:"inserted"+n,CLICK:"click"+n,FOCUSIN:"focusin"+n,FOCUSOUT:"focusout"+n,MOUSEENTER:"mouseenter"+n,MOUSELEAVE:"mouseleave"+n},l=function(o){function l(){return _classCallCheck(this,l),_possibleConstructorReturn(this,o.apply(this,arguments))}return _inherits(l,o),l.prototype.isWithContent=function(){return this.getTitle()||this._getContent()},l.prototype.addAttachmentClass=function(e){t(this.getTipElement()).addClass("bs-popover-"+e)},l.prototype.getTipElement=function(){return this.tip=this.tip||t(this.config.template)[0]},l.prototype.setContent=function(){var e=t(this.getTipElement());this.setElementContent(e.find(p.TITLE),this.getTitle()),this.setElementContent(e.find(p.CONTENT),this._getContent()),e.removeClass(a.FADE+" "+a.SHOW)},l.prototype._getContent=function(){return this.element.getAttribute("data-content")||("function"==typeof this.config.content?this.config.content.call(this.element):this.config.content)},l.prototype._cleanTipClass=function(){var e=t(this.getTipElement()),n=e.attr("class").match(i);null!==n&&n.length>0&&e.removeClass(n.join(""))},l._jQueryInterface=function(e){return this.each(function(){var n=t(this).data("bs.popover"),o="object"===(void 0===e?"undefined":_typeof(e))?e:null;if((n||!/destroy|hide/.test(e))&&(n||(n=new l(this,o),t(this).data("bs.popover",n)),"string"==typeof e)){if(void 0===n[e])throw new Error('No method named "'+e+'"');n[e]()}})},_createClass(l,null,[{key:"VERSION",get:function(){return"4.0.0-beta"}},{key:"Default",get:function(){return r}},{key:"NAME",get:function(){return e}},{key:"DATA_KEY",get:function(){return"bs.popover"}},{key:"Event",get:function(){return u}},{key:"EVENT_KEY",get:function(){return n}},{key:"DefaultType",get:function(){return s}}]),l}(Tooltip);return t.fn[e]=l._jQueryInterface,t.fn[e].Constructor=l,t.fn[e].noConflict=function(){return t.fn[e]=o,l._jQueryInterface},l}(jQuery),bind=function(t,e){return function(){return t.apply(e,arguments)}};!function(t,e){"function"==typeof define&&define.amd?define(["jquery"],function(n){return t.Tour=e(n)}):"object"==typeof exports?module.exports=e(require("jquery")):t.Tour=e(t.jQuery)}(window,function(t){var e;return e=window.document,function(){function n(e){this._showPopoverAndOverlay=bind(this._showPopoverAndOverlay,this);var n;try{n=window.localStorage}catch(t){n=!1}this._options=t.extend({name:"tour",steps:[],container:"body",autoscroll:!0,keyboard:!0,storage:n,debug:!1,backdrop:!1,backdropContainer:"body",backdropPadding:0,redirect:!0,orphan:!1,duration:!1,delay:!1,basePath:"",template:'<div class="popover" role="tooltip"> <div class="arrow"></div> <h3 class="popover-header"></h3> <div class="popover-body"></div> <div class="popover-navigation"> <div class="btn-group"> <button class="btn btn-sm btn-secondary" data-role="prev">« Prev</button> <button class="btn btn-sm btn-secondary" data-role="next">Next »</button> <button class="btn btn-sm btn-secondary" data-role="pause-resume" data-pause-text="Pause" data-resume-text="Resume">Pause</button> </div> <button class="btn btn-sm btn-secondary" data-role="end">End tour</button> </div> </div>',afterSetState:function(t,e){},afterGetState:function(t,e){},afterRemoveState:function(t){},onStart:function(t){},onEnd:function(t){},onShow:function(t){},onShown:function(t){},onHide:function(t){},onHidden:function(t){},onNext:function(t){},onPrev:function(t){},onPause:function(t,e){},onResume:function(t,e){},onRedirectError:function(t){}},e),this._force=!1,this._inited=!1,this._current=null,this.backdrops=[]}return n.prototype.addSteps=function(t){var e,n,o;for(e=0,n=t.length;e<n;e++)o=t[e],this.addStep(o);return this},n.prototype.addStep=function(t){return this._options.steps.push(t),this},n.prototype.getStep=function(e){if(null!=this._options.steps[e])return t.extend({id:"step-"+e,path:"",host:"",placement:"right",title:"",content:"<p></p>",next:e===this._options.steps.length-1?-1:e+1,prev:e-1,animation:!0,container:this._options.container,autoscroll:this._options.autoscroll,backdrop:this._options.backdrop,backdropContainer:this._options.backdropContainer,backdropPadding:this._options.backdropPadding,redirect:this._options.redirect,reflexElement:this._options.steps[e].element,backdropElement:this._options.steps[e].element,orphan:this._options.orphan,duration:this._options.duration,delay:this._options.delay,template:this._options.template,onShow:this._options.onShow,onShown:this._options.onShown,onHide:this._options.onHide,onHidden:this._options.onHidden,onNext:this._options.onNext,onPrev:this._options.onPrev,onPause:this._options.onPause,onResume:this._options.onResume,onRedirectError:this._options.onRedirectError},this._options.steps[e])},n.prototype.init=function(t){return this._force=t,this.ended()?(this._debug("Tour ended, init prevented."),this):(this.setCurrentStep(),this._initMouseNavigation(),this._initKeyboardNavigation(),null!==this._current&&this.showStep(this._current),this._inited=!0,this)},n.prototype.start=function(t){var e;return null==t&&(t=!1),this._inited||this.init(t),null===this._current&&(e=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(e,this.showStep,0)),this},n.prototype.next=function(){var t;return t=this.hideStep(this._current,this._current+1),this._callOnPromiseDone(t,this._showNextStep)},n.prototype.prev=function(){var t;return t=this.hideStep(this._current,this._current-1),this._callOnPromiseDone(t,this._showPrevStep)},n.prototype.goTo=function(t){var e;return e=this.hideStep(this._current,t),this._callOnPromiseDone(e,this.showStep,t)},n.prototype.end=function(){var n,o;return n=function(n){return function(o){if(t(e).off("click.tour-"+n._options.name),t(e).off("keyup.tour-"+n._options.name),n._setState("end","yes"),n._inited=!1,n._force=!1,n._clearTimer(),null!=n._options.onEnd)return n._options.onEnd(n)}}(this),o=this.hideStep(this._current),this._callOnPromiseDone(o,n)},n.prototype.ended=function(){return!this._force&&!!this._getState("end")},n.prototype.restart=function(){return this._removeState("current_step"),this._removeState("end"),this._removeState("redirect_to"),this.start()},n.prototype.pause=function(){var t;return(t=this.getStep(this._current))&&t.duration?(this._paused=!0,this._duration-=(new Date).getTime()-this._start,window.clearTimeout(this._timer),this._debug("Paused/Stopped step "+(this._current+1)+" timer ("+this._duration+" remaining)."),null!=t.onPause?t.onPause(this,this._duration):void 0):this},n.prototype.resume=function(){var t;return(t=this.getStep(this._current))&&t.duration?(this._paused=!1,this._start=(new Date).getTime(),this._duration=this._duration||t.duration,this._timer=window.setTimeout(function(t){return function(){return t._isLast()?t.next():t.end()}}(this),this._duration),this._debug("Started step "+(this._current+1)+" timer with duration "+this._duration),null!=t.onResume&&this._duration!==t.duration?t.onResume(this,this._duration):void 0):this},n.prototype.hideStep=function(e,n){var o,i,r,s;if(s=this.getStep(e))return this._clearTimer(),r=this._makePromise(null!=s.onHide?s.onHide(this,e):void 0),i=function(o){return function(i){var r,a;if((r=t(s.element)).data("bs.popover")||(r=t("body")),r.popover("dispose").removeClass("tour-"+o._options.name+"-element tour-"+o._options.name+"-"+e+"-element").removeData("bs.popover"),s.reflex&&t(s.reflexElement).removeClass("tour-step-element-reflex").off(o._reflexEvent(s.reflex)+".tour-"+o._options.name),s.backdrop&&((a=null!=n&&o.getStep(n))&&a.backdrop&&a.backdropElement===s.backdropElement||o._hideOverlayElement(s)),null!=s.onHidden)return s.onHidden(o)}}(this),o=s.delay.hide||s.delay,"[object Number]"==={}.toString.call(o)&&o>0?(this._debug("Wait "+o+" milliseconds to hide the step "+(this._current+1)),window.setTimeout(function(t){return function(){return t._callOnPromiseDone(r,i)}}(this),o)):this._callOnPromiseDone(r,i),r},n.prototype.showStep=function(t){var n,o,i,r,s,a;return this.ended()?(this._debug("Tour ended, showStep prevented."),this):(a=this.getStep(t))&&(s=t<this._current,o=this._makePromise(null!=a.onShow?a.onShow(this,t):void 0),this.setCurrentStep(t),n=function(){switch({}.toString.call(a.path)){case"[object Function]":return a.path();case"[object String]":return this._options.basePath+a.path;default:return a.path}}.call(this),!a.redirect||!this._isRedirect(a.host,n,e.location)||(this._redirect(a,t,n),this._isJustPathHashDifferent(a.host,n,e.location)))?(r=function(e){return function(n){if(e._isOrphan(a)){if(!1===a.orphan)return e._debug("Skip the orphan step "+(e._current+1)+".\nOrphan option is false and the element does not exist or is hidden."),void(s?e._showPrevStep():e._showNextStep());e._debug("Show the orphan step "+(e._current+1)+". Orphans option is true.")}if(a.autoscroll?e._scrollIntoView(t):e._showPopoverAndOverlay(t),a.duration)return e.resume()}}(this),i=a.delay.show||a.delay,"[object Number]"==={}.toString.call(i)&&i>0?(this._debug("Wait "+i+" milliseconds to show the step "+(this._current+1)),window.setTimeout(function(t){return function(){return t._callOnPromiseDone(o,r)}}(this),i)):this._callOnPromiseDone(o,r),o):void 0},n.prototype.getCurrentStep=function(){return this._current},n.prototype.setCurrentStep=function(t){return null!=t?(this._current=t,this._setState("current_step",t)):(this._current=this._getState("current_step"),this._current=null===this._current?null:parseInt(this._current,10)),this},n.prototype.redraw=function(){return this._showOverlayElement(this.getStep(this.getCurrentStep()))},n.prototype._setState=function(t,e){var n;if(this._options.storage){n=this._options.name+"_"+t;try{this._options.storage.setItem(n,e)}catch(t){t.code===DOMException.QUOTA_EXCEEDED_ERR&&this._debug("LocalStorage quota exceeded. State storage failed.")}return this._options.afterSetState(n,e)}return null==this._state&&(this._state={}),this._state[t]=e},n.prototype._removeState=function(t){var e;return this._options.storage?(e=this._options.name+"_"+t,this._options.storage.removeItem(e),this._options.afterRemoveState(e)):null!=this._state?delete this._state[t]:void 0},n.prototype._getState=function(t){var e,n;return this._options.storage?(e=this._options.name+"_"+t,n=this._options.storage.getItem(e)):null!=this._state&&(n=this._state[t]),void 0!==n&&"null"!==n||(n=null),this._options.afterGetState(t,n),n},n.prototype._showNextStep=function(){var t,e,n;return n=this.getStep(this._current),e=function(t){return function(e){return t.showStep(n.next)}}(this),t=this._makePromise(null!=n.onNext?n.onNext(this):void 0),this._callOnPromiseDone(t,e)},n.prototype._showPrevStep=function(){var t,e,n;return n=this.getStep(this._current),e=function(t){return function(e){return t.showStep(n.prev)}}(this),t=this._makePromise(null!=n.onPrev?n.onPrev(this):void 0),this._callOnPromiseDone(t,e)},n.prototype._debug=function(t){if(this._options.debug)return window.console.log("Bootstrap Tour '"+this._options.name+"' | "+t)},n.prototype._isRedirect=function(t,e,n){var o;return!(null==t||""===t||!("[object RegExp]"==={}.toString.call(t)&&!t.test(n.origin)||"[object String]"==={}.toString.call(t)&&this._isHostDifferent(t,n)))||(o=[n.pathname,n.search,n.hash].join(""),null!=e&&""!==e&&("[object RegExp]"==={}.toString.call(e)&&!e.test(o)||"[object String]"==={}.toString.call(e)&&this._isPathDifferent(e,o)))},n.prototype._isHostDifferent=function(t,e){switch({}.toString.call(t)){case"[object RegExp]":return!t.test(e.origin);case"[object String]":return this._getProtocol(t)!==this._getProtocol(e.href)||this._getHost(t)!==this._getHost(e.href);default:return!0}},n.prototype._isPathDifferent=function(t,e){return this._getPath(t)!==this._getPath(e)||!this._equal(this._getQuery(t),this._getQuery(e))||!this._equal(this._getHash(t),this._getHash(e))},n.prototype._isJustPathHashDifferent=function(t,e,n){var o;return(null==t||""===t||!this._isHostDifferent(t,n))&&(o=[n.pathname,n.search,n.hash].join(""),"[object String]"==={}.toString.call(e)&&(this._getPath(e)===this._getPath(o)&&this._equal(this._getQuery(e),this._getQuery(o))&&!this._equal(this._getHash(e),this._getHash(o))))},n.prototype._redirect=function(n,o,i){var r;return t.isFunction(n.redirect)?n.redirect.call(this,i):(r="[object String]"==={}.toString.call(n.host)?""+n.host+i:i,this._debug("Redirect to "+r),this._getState("redirect_to")!==""+o?(this._setState("redirect_to",""+o),e.location.href=r):(this._debug("Error redirection loop to "+i),this._removeState("redirect_to"),null!=n.onRedirectError?n.onRedirectError(this):void 0))},n.prototype._isOrphan=function(e){return null==e.element||!t(e.element).length||t(e.element).is(":hidden")&&"http://www.w3.org/2000/svg"!==t(e.element)[0].namespaceURI},n.prototype._isLast=function(){return this._current<this._options.steps.length-1},n.prototype._showPopoverAndOverlay=function(t){var e;if(this.getCurrentStep()===t&&!this.ended())return(e=this.getStep(t)).backdrop&&this._showOverlayElement(e),this._showPopover(e,t),null!=e.onShown&&e.onShown(this),this._debug("Step "+(this._current+1)+" of "+this._options.steps.length)},n.prototype._showPopover=function(e,n){var o,i,r;return t(".tour-"+this._options.name).remove(),r=t.extend({},this._options),i=this._isOrphan(e),e.template=this._template(e,n),i&&(e.element="body",e.placement="top"),(o=t(e.element)).addClass("tour-"+this._options.name+"-element tour-"+this._options.name+"-"+n+"-element"),e.options&&t.extend(r,e.options),e.reflex&&!i&&t(e.reflexElement).addClass("tour-step-element-reflex").off(this._reflexEvent(e.reflex)+".tour-"+this._options.name).on(this._reflexEvent(e.reflex)+".tour-"+this._options.name,function(t){return function(){return t._isLast()?t.next():t.end()}}(this)),o.popover({placement:e.placement,trigger:"manual",title:e.title,content:e.content,html:!0,animation:e.animation,container:e.container,template:e.template,selector:e.element}).popover("show"),t(o.data("bs.popover").getTipElement()).attr("id",e.id)},n.prototype._template=function(e,n){var o,i,r,s,a,p;return p=e.template,this._isOrphan(e)&&"[object Boolean]"!=={}.toString.call(e.orphan)&&(p=e.orphan),a=t(t.isFunction(p)?p(n,e):p),o=a.find(".popover-navigation"),r=o.find('[data-role="prev"]'),i=o.find('[data-role="next"]'),s=o.find('[data-role="pause-resume"]'),this._isOrphan(e)&&a.addClass("orphan"),a.addClass("tour-"+this._options.name+" tour-"+this._options.name+"-"+n),e.reflex&&a.addClass("tour-"+this._options.name+"-reflex"),e.prev<0&&r.addClass("disabled").prop("disabled",!0).prop("tabindex",-1),e.next<0&&i.addClass("disabled").prop("disabled",!0).prop("tabindex",-1),e.duration||s.remove(),a.clone().wrap("<div>").parent().html()},n.prototype._reflexEvent=function(t){return"[object Boolean]"==={}.toString.call(t)?"click":t},n.prototype._scrollIntoView=function(e){var n,o,i,r,s,a,p,u;if(p=this.getStep(e),!(n=t(p.element)).length)return this._showPopoverAndOverlay(e);switch(o=t(window),s=n.offset().top,r=n.outerHeight(),u=o.height(),a=0,p.placement){case"top":a=Math.max(0,s-u/2);break;case"left":case"right":a=Math.max(0,s+r/2-u/2);break;case"bottom":a=Math.max(0,s+r-u/2)}return this._debug("Scroll into view. ScrollTop: "+a+". Element offset: "+s+". Window height: "+u+"."),i=0,t("body, html").stop(!0,!0).animate({scrollTop:Math.ceil(a)},function(t){return function(){if(2==++i)return t._showPopoverAndOverlay(e),t._debug("Scroll into view.\nAnimation end element offset: "+n.offset().top+".\nWindow height: "+o.height()+".")}}(this))},n.prototype._initMouseNavigation=function(){var n;return n=this,t(e).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='prev']").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='next']").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='end']").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='pause-resume']").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='next']",function(t){return function(e){return e.preventDefault(),t.next()}}(this)).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='prev']",function(t){return function(e){if(e.preventDefault(),t._current>0)return t.prev()}}(this)).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='end']",function(t){return function(e){return e.preventDefault(),t.end()}}(this)).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='pause-resume']",function(e){var o;return e.preventDefault(),(o=t(this)).text(n._paused?o.data("pause-text"):o.data("resume-text")),n._paused?n.resume():n.pause()})},n.prototype._initKeyboardNavigation=function(){if(this._options.keyboard)return t(e).on("keyup.tour-"+this._options.name,function(t){return function(e){if(e.which)switch(e.which){case 39:return e.preventDefault(),t._isLast()?t.next():t.end();case 37:if(e.preventDefault(),t._current>0)return t.prev()}}}(this))},n.prototype._makePromise=function(e){return e&&t.isFunction(e.then)?e:null},n.prototype._callOnPromiseDone=function(t,e,n){return t?t.then(function(t){return function(o){return e.call(t,n)}}(this)):e.call(this,n)},n.prototype._showBackground=function(n,o){var i,r,s,a,p,u,l,c,h;for(s=t(e).height(),h=t(e).width(),c=[],a=0,p=(l=["top","bottom","left","right"]).length;a<p;a++)switch(u=l[a],i=null!=(r=this.backdrops)[u]?r[u]:r[u]=t("<div>",{class:"tour-backdrop "+u}),t(n.backdropContainer).append(i),u){case"top":c.push(i.height(o.offset.top>0?o.offset.top:0).width(h).offset({top:0,left:0}));break;case"bottom":c.push(i.offset({top:o.offset.top+o.height,left:0}).height(s-(o.offset.top+o.height)).width(h));break;case"left":c.push(i.offset({top:o.offset.top,left:0}).height(o.height).width(o.offset.left>0?o.offset.left:0));break;case"right":c.push(i.offset({top:o.offset.top,left:o.offset.left+o.width}).height(o.height).width(h-(o.offset.left+o.width)));break;default:c.push(void 0)}return c},n.prototype._showOverlayElement=function(e){var n,o;return 0===(n=t(e.backdropElement)).length?o={width:0,height:0,offset:{top:0,left:0}}:(o={width:n.innerWidth(),height:n.innerHeight(),offset:n.offset()},n.addClass("tour-step-backdrop"),e.backdropPadding&&(o=this._applyBackdropPadding(e.backdropPadding,o))),this._showBackground(e,o)},n.prototype._hideOverlayElement=function(e){var n,o,i;t(e.backdropElement).removeClass("tour-step-backdrop"),i=this.backdrops;for(o in i)(n=i[o])&&void 0!==n.remove&&n.remove();return this.backdrops=[]},n.prototype._applyBackdropPadding=function(t,e){return"object"==typeof t?(null==t.top&&(t.top=0),null==t.right&&(t.right=0),null==t.bottom&&(t.bottom=0),null==t.left&&(t.left=0),e.offset.top=e.offset.top-t.top,e.offset.left=e.offset.left-t.left,e.width=e.width+t.left+t.right,e.height=e.height+t.top+t.bottom):(e.offset.top=e.offset.top-t,e.offset.left=e.offset.left-t,e.width=e.width+2*t,e.height=e.height+2*t),e},n.prototype._clearTimer=function(){return window.clearTimeout(this._timer),this._timer=null,this._duration=null},n.prototype._getProtocol=function(t){return(t=t.split("://")).length>1?t[0]:"http"},n.prototype._getHost=function(t){return t=t.split("//"),(t=t.length>1?t[1]:t[0]).split("/")[0]},n.prototype._getPath=function(t){return t.replace(/\/?$/,"").split("?")[0].split("#")[0]},n.prototype._getQuery=function(t){return this._getParams(t,"?")},n.prototype._getHash=function(t){return this._getParams(t,"#")},n.prototype._getParams=function(t,e){var n,o,i,r,s;if(1===(r=t.split(e)).length)return{};for(s={},n=0,o=(r=r[1].split("&")).length;n<o;n++)s[(i=(i=r[n]).split("="))[0]]=i[1]||"";return s},n.prototype._equal=function(t,e){var n,o,i,r,s,a;if("[object Object]"==={}.toString.call(t)&&"[object Object]"==={}.toString.call(e)){if(r=Object.keys(t),s=Object.keys(e),r.length!==s.length)return!1;for(o in t)if(a=t[o],!this._equal(e[o],a))return!1;return!0}if("[object Array]"==={}.toString.call(t)&&"[object Array]"==={}.toString.call(e)){if(t.length!==e.length)return!1;for(o=n=0,i=t.length;n<i;o=++n)if(a=t[o],!this._equal(a,e[o]))return!1;return!0}return t===e},n}()}); | |
| 0 | 23 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,938 @@ |
| 1 | +/* ======================================================================== | |
| 2 | + * bootstrap-tour - v0.12.0 | |
| 3 | + * http://bootstraptour.com | |
| 4 | + * ======================================================================== | |
| 5 | + * Copyright 2012-2017 Ulrich Sossou | |
| 6 | + * | |
| 7 | + * ======================================================================== | |
| 8 | + * Licensed under the MIT License (the "License"); | |
| 9 | + * you may not use this file except in compliance with the License. | |
| 10 | + * You may obtain a copy of the License at | |
| 11 | + * | |
| 12 | + * https://opensource.org/licenses/MIT | |
| 13 | + * | |
| 14 | + * Unless required by applicable law or agreed to in writing, software | |
| 15 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 16 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 17 | + * See the License for the specific language governing permissions and | |
| 18 | + * limitations under the License. | |
| 19 | + * ======================================================================== | |
| 20 | + */ | |
| 21 | + | |
| 22 | +var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; | |
| 23 | + | |
| 24 | +(function(window, factory) { | |
| 25 | + if (typeof define === 'function' && define.amd) { | |
| 26 | + return define(['jquery'], function(jQuery) { | |
| 27 | + return window.Tour = factory(jQuery); | |
| 28 | + }); | |
| 29 | + } else if (typeof exports === 'object') { | |
| 30 | + return module.exports = factory(require('jquery')); | |
| 31 | + } else { | |
| 32 | + return window.Tour = factory(window.jQuery); | |
| 33 | + } | |
| 34 | +})(window, function($) { | |
| 35 | + var Tour, document; | |
| 36 | + document = window.document; | |
| 37 | + Tour = (function() { | |
| 38 | + function Tour(options) { | |
| 39 | + this._showPopoverAndOverlay = bind(this._showPopoverAndOverlay, this); | |
| 40 | + var storage; | |
| 41 | + try { | |
| 42 | + storage = window.localStorage; | |
| 43 | + } catch (error) { | |
| 44 | + storage = false; | |
| 45 | + } | |
| 46 | + this._options = $.extend({ | |
| 47 | + name: 'tour', | |
| 48 | + steps: [], | |
| 49 | + container: 'body', | |
| 50 | + autoscroll: true, | |
| 51 | + keyboard: true, | |
| 52 | + storage: storage, | |
| 53 | + debug: false, | |
| 54 | + backdrop: false, | |
| 55 | + backdropContainer: 'body', | |
| 56 | + backdropPadding: 0, | |
| 57 | + redirect: true, | |
| 58 | + orphan: false, | |
| 59 | + duration: false, | |
| 60 | + delay: false, | |
| 61 | + basePath: '', | |
| 62 | + template: '<div class="popover" role="tooltip"> <div class="arrow"></div> <h3 class="popover-header"></h3> <div class="popover-body"></div> <div class="popover-navigation"> <div class="btn-group"> <button class="btn btn-sm btn-secondary" data-role="prev">« Prev</button> <button class="btn btn-sm btn-secondary" data-role="next">Next »</button> <button class="btn btn-sm btn-secondary" data-role="pause-resume" data-pause-text="Pause" data-resume-text="Resume">Pause</button> </div> <button class="btn btn-sm btn-secondary" data-role="end">End tour</button> </div> </div>', | |
| 63 | + afterSetState: function(key, value) {}, | |
| 64 | + afterGetState: function(key, value) {}, | |
| 65 | + afterRemoveState: function(key) {}, | |
| 66 | + onStart: function(tour) {}, | |
| 67 | + onEnd: function(tour) {}, | |
| 68 | + onShow: function(tour) {}, | |
| 69 | + onShown: function(tour) {}, | |
| 70 | + onHide: function(tour) {}, | |
| 71 | + onHidden: function(tour) {}, | |
| 72 | + onNext: function(tour) {}, | |
| 73 | + onPrev: function(tour) {}, | |
| 74 | + onPause: function(tour, duration) {}, | |
| 75 | + onResume: function(tour, duration) {}, | |
| 76 | + onRedirectError: function(tour) {} | |
| 77 | + }, options); | |
| 78 | + this._force = false; | |
| 79 | + this._inited = false; | |
| 80 | + this._current = null; | |
| 81 | + this.backdrops = []; | |
| 82 | + this; | |
| 83 | + } | |
| 84 | + | |
| 85 | + Tour.prototype.addSteps = function(steps) { | |
| 86 | + var j, len, step; | |
| 87 | + for (j = 0, len = steps.length; j < len; j++) { | |
| 88 | + step = steps[j]; | |
| 89 | + this.addStep(step); | |
| 90 | + } | |
| 91 | + return this; | |
| 92 | + }; | |
| 93 | + | |
| 94 | + Tour.prototype.addStep = function(step) { | |
| 95 | + this._options.steps.push(step); | |
| 96 | + return this; | |
| 97 | + }; | |
| 98 | + | |
| 99 | + Tour.prototype.getStep = function(i) { | |
| 100 | + if (this._options.steps[i] != null) { | |
| 101 | + return $.extend({ | |
| 102 | + id: "step-" + i, | |
| 103 | + path: '', | |
| 104 | + host: '', | |
| 105 | + placement: 'right', | |
| 106 | + title: '', | |
| 107 | + content: '<p></p>', | |
| 108 | + next: i === this._options.steps.length - 1 ? -1 : i + 1, | |
| 109 | + prev: i - 1, | |
| 110 | + animation: true, | |
| 111 | + container: this._options.container, | |
| 112 | + autoscroll: this._options.autoscroll, | |
| 113 | + backdrop: this._options.backdrop, | |
| 114 | + backdropContainer: this._options.backdropContainer, | |
| 115 | + backdropPadding: this._options.backdropPadding, | |
| 116 | + redirect: this._options.redirect, | |
| 117 | + reflexElement: this._options.steps[i].element, | |
| 118 | + backdropElement: this._options.steps[i].element, | |
| 119 | + orphan: this._options.orphan, | |
| 120 | + duration: this._options.duration, | |
| 121 | + delay: this._options.delay, | |
| 122 | + template: this._options.template, | |
| 123 | + onShow: this._options.onShow, | |
| 124 | + onShown: this._options.onShown, | |
| 125 | + onHide: this._options.onHide, | |
| 126 | + onHidden: this._options.onHidden, | |
| 127 | + onNext: this._options.onNext, | |
| 128 | + onPrev: this._options.onPrev, | |
| 129 | + onPause: this._options.onPause, | |
| 130 | + onResume: this._options.onResume, | |
| 131 | + onRedirectError: this._options.onRedirectError | |
| 132 | + }, this._options.steps[i]); | |
| 133 | + } | |
| 134 | + }; | |
| 135 | + | |
| 136 | + Tour.prototype.init = function(force) { | |
| 137 | + this._force = force; | |
| 138 | + if (this.ended()) { | |
| 139 | + this._debug('Tour ended, init prevented.'); | |
| 140 | + return this; | |
| 141 | + } | |
| 142 | + this.setCurrentStep(); | |
| 143 | + this._initMouseNavigation(); | |
| 144 | + this._initKeyboardNavigation(); | |
| 145 | + if (this._current !== null) { | |
| 146 | + this.showStep(this._current); | |
| 147 | + } | |
| 148 | + this._inited = true; | |
| 149 | + return this; | |
| 150 | + }; | |
| 151 | + | |
| 152 | + Tour.prototype.start = function(force) { | |
| 153 | + var promise; | |
| 154 | + if (force == null) { | |
| 155 | + force = false; | |
| 156 | + } | |
| 157 | + if (!this._inited) { | |
| 158 | + this.init(force); | |
| 159 | + } | |
| 160 | + if (this._current === null) { | |
| 161 | + promise = this._makePromise(this._options.onStart != null ? this._options.onStart(this) : void 0); | |
| 162 | + this._callOnPromiseDone(promise, this.showStep, 0); | |
| 163 | + } | |
| 164 | + return this; | |
| 165 | + }; | |
| 166 | + | |
| 167 | + Tour.prototype.next = function() { | |
| 168 | + var promise; | |
| 169 | + promise = this.hideStep(this._current, this._current + 1); | |
| 170 | + return this._callOnPromiseDone(promise, this._showNextStep); | |
| 171 | + }; | |
| 172 | + | |
| 173 | + Tour.prototype.prev = function() { | |
| 174 | + var promise; | |
| 175 | + promise = this.hideStep(this._current, this._current - 1); | |
| 176 | + return this._callOnPromiseDone(promise, this._showPrevStep); | |
| 177 | + }; | |
| 178 | + | |
| 179 | + Tour.prototype.goTo = function(i) { | |
| 180 | + var promise; | |
| 181 | + promise = this.hideStep(this._current, i); | |
| 182 | + return this._callOnPromiseDone(promise, this.showStep, i); | |
| 183 | + }; | |
| 184 | + | |
| 185 | + Tour.prototype.end = function() { | |
| 186 | + var endHelper, promise; | |
| 187 | + endHelper = (function(_this) { | |
| 188 | + return function(e) { | |
| 189 | + $(document).off("click.tour-" + _this._options.name); | |
| 190 | + $(document).off("keyup.tour-" + _this._options.name); | |
| 191 | + _this._setState('end', 'yes'); | |
| 192 | + _this._inited = false; | |
| 193 | + _this._force = false; | |
| 194 | + _this._clearTimer(); | |
| 195 | + if (_this._options.onEnd != null) { | |
| 196 | + return _this._options.onEnd(_this); | |
| 197 | + } | |
| 198 | + }; | |
| 199 | + })(this); | |
| 200 | + promise = this.hideStep(this._current); | |
| 201 | + return this._callOnPromiseDone(promise, endHelper); | |
| 202 | + }; | |
| 203 | + | |
| 204 | + Tour.prototype.ended = function() { | |
| 205 | + return !this._force && !!this._getState('end'); | |
| 206 | + }; | |
| 207 | + | |
| 208 | + Tour.prototype.restart = function() { | |
| 209 | + this._removeState('current_step'); | |
| 210 | + this._removeState('end'); | |
| 211 | + this._removeState('redirect_to'); | |
| 212 | + return this.start(); | |
| 213 | + }; | |
| 214 | + | |
| 215 | + Tour.prototype.pause = function() { | |
| 216 | + var step; | |
| 217 | + step = this.getStep(this._current); | |
| 218 | + if (!(step && step.duration)) { | |
| 219 | + return this; | |
| 220 | + } | |
| 221 | + this._paused = true; | |
| 222 | + this._duration -= new Date().getTime() - this._start; | |
| 223 | + window.clearTimeout(this._timer); | |
| 224 | + this._debug("Paused/Stopped step " + (this._current + 1) + " timer (" + this._duration + " remaining)."); | |
| 225 | + if (step.onPause != null) { | |
| 226 | + return step.onPause(this, this._duration); | |
| 227 | + } | |
| 228 | + }; | |
| 229 | + | |
| 230 | + Tour.prototype.resume = function() { | |
| 231 | + var step; | |
| 232 | + step = this.getStep(this._current); | |
| 233 | + if (!(step && step.duration)) { | |
| 234 | + return this; | |
| 235 | + } | |
| 236 | + this._paused = false; | |
| 237 | + this._start = new Date().getTime(); | |
| 238 | + this._duration = this._duration || step.duration; | |
| 239 | + this._timer = window.setTimeout((function(_this) { | |
| 240 | + return function() { | |
| 241 | + if (_this._isLast()) { | |
| 242 | + return _this.next(); | |
| 243 | + } else { | |
| 244 | + return _this.end(); | |
| 245 | + } | |
| 246 | + }; | |
| 247 | + })(this), this._duration); | |
| 248 | + this._debug("Started step " + (this._current + 1) + " timer with duration " + this._duration); | |
| 249 | + if ((step.onResume != null) && this._duration !== step.duration) { | |
| 250 | + return step.onResume(this, this._duration); | |
| 251 | + } | |
| 252 | + }; | |
| 253 | + | |
| 254 | + Tour.prototype.hideStep = function(i, iNext) { | |
| 255 | + var hideDelay, hideStepHelper, promise, step; | |
| 256 | + step = this.getStep(i); | |
| 257 | + if (!step) { | |
| 258 | + return; | |
| 259 | + } | |
| 260 | + this._clearTimer(); | |
| 261 | + promise = this._makePromise(step.onHide != null ? step.onHide(this, i) : void 0); | |
| 262 | + hideStepHelper = (function(_this) { | |
| 263 | + return function(e) { | |
| 264 | + var $element, next_step; | |
| 265 | + $element = $(step.element); | |
| 266 | + if (!$element.data('bs.popover')) { | |
| 267 | + $element = $('body'); | |
| 268 | + } | |
| 269 | + $element.popover('dispose').removeClass("tour-" + _this._options.name + "-element tour-" + _this._options.name + "-" + i + "-element").removeData('bs.popover'); | |
| 270 | + if (step.reflex) { | |
| 271 | + $(step.reflexElement).removeClass('tour-step-element-reflex').off((_this._reflexEvent(step.reflex)) + ".tour-" + _this._options.name); | |
| 272 | + } | |
| 273 | + if (step.backdrop) { | |
| 274 | + next_step = (iNext != null) && _this.getStep(iNext); | |
| 275 | + if (!next_step || !next_step.backdrop || next_step.backdropElement !== step.backdropElement) { | |
| 276 | + _this._hideOverlayElement(step); | |
| 277 | + } | |
| 278 | + } | |
| 279 | + if (step.onHidden != null) { | |
| 280 | + return step.onHidden(_this); | |
| 281 | + } | |
| 282 | + }; | |
| 283 | + })(this); | |
| 284 | + hideDelay = step.delay.hide || step.delay; | |
| 285 | + if ({}.toString.call(hideDelay) === '[object Number]' && hideDelay > 0) { | |
| 286 | + this._debug("Wait " + hideDelay + " milliseconds to hide the step " + (this._current + 1)); | |
| 287 | + window.setTimeout((function(_this) { | |
| 288 | + return function() { | |
| 289 | + return _this._callOnPromiseDone(promise, hideStepHelper); | |
| 290 | + }; | |
| 291 | + })(this), hideDelay); | |
| 292 | + } else { | |
| 293 | + this._callOnPromiseDone(promise, hideStepHelper); | |
| 294 | + } | |
| 295 | + return promise; | |
| 296 | + }; | |
| 297 | + | |
| 298 | + Tour.prototype.showStep = function(i) { | |
| 299 | + var path, promise, showDelay, showStepHelper, skipToPrevious, step; | |
| 300 | + if (this.ended()) { | |
| 301 | + this._debug('Tour ended, showStep prevented.'); | |
| 302 | + return this; | |
| 303 | + } | |
| 304 | + step = this.getStep(i); | |
| 305 | + if (!step) { | |
| 306 | + return; | |
| 307 | + } | |
| 308 | + skipToPrevious = i < this._current; | |
| 309 | + promise = this._makePromise(step.onShow != null ? step.onShow(this, i) : void 0); | |
| 310 | + this.setCurrentStep(i); | |
| 311 | + path = (function() { | |
| 312 | + switch ({}.toString.call(step.path)) { | |
| 313 | + case '[object Function]': | |
| 314 | + return step.path(); | |
| 315 | + case '[object String]': | |
| 316 | + return this._options.basePath + step.path; | |
| 317 | + default: | |
| 318 | + return step.path; | |
| 319 | + } | |
| 320 | + }).call(this); | |
| 321 | + if (step.redirect && this._isRedirect(step.host, path, document.location)) { | |
| 322 | + this._redirect(step, i, path); | |
| 323 | + if (!this._isJustPathHashDifferent(step.host, path, document.location)) { | |
| 324 | + return; | |
| 325 | + } | |
| 326 | + } | |
| 327 | + showStepHelper = (function(_this) { | |
| 328 | + return function(e) { | |
| 329 | + if (_this._isOrphan(step)) { | |
| 330 | + if (step.orphan === false) { | |
| 331 | + _this._debug("Skip the orphan step " + (_this._current + 1) + ".\nOrphan option is false and the element does not exist or is hidden."); | |
| 332 | + if (skipToPrevious) { | |
| 333 | + _this._showPrevStep(); | |
| 334 | + } else { | |
| 335 | + _this._showNextStep(); | |
| 336 | + } | |
| 337 | + return; | |
| 338 | + } | |
| 339 | + _this._debug("Show the orphan step " + (_this._current + 1) + ". Orphans option is true."); | |
| 340 | + } | |
| 341 | + if (step.autoscroll) { | |
| 342 | + _this._scrollIntoView(i); | |
| 343 | + } else { | |
| 344 | + _this._showPopoverAndOverlay(i); | |
| 345 | + } | |
| 346 | + if (step.duration) { | |
| 347 | + return _this.resume(); | |
| 348 | + } | |
| 349 | + }; | |
| 350 | + })(this); | |
| 351 | + showDelay = step.delay.show || step.delay; | |
| 352 | + if ({}.toString.call(showDelay) === '[object Number]' && showDelay > 0) { | |
| 353 | + this._debug("Wait " + showDelay + " milliseconds to show the step " + (this._current + 1)); | |
| 354 | + window.setTimeout((function(_this) { | |
| 355 | + return function() { | |
| 356 | + return _this._callOnPromiseDone(promise, showStepHelper); | |
| 357 | + }; | |
| 358 | + })(this), showDelay); | |
| 359 | + } else { | |
| 360 | + this._callOnPromiseDone(promise, showStepHelper); | |
| 361 | + } | |
| 362 | + return promise; | |
| 363 | + }; | |
| 364 | + | |
| 365 | + Tour.prototype.getCurrentStep = function() { | |
| 366 | + return this._current; | |
| 367 | + }; | |
| 368 | + | |
| 369 | + Tour.prototype.setCurrentStep = function(value) { | |
| 370 | + if (value != null) { | |
| 371 | + this._current = value; | |
| 372 | + this._setState('current_step', value); | |
| 373 | + } else { | |
| 374 | + this._current = this._getState('current_step'); | |
| 375 | + this._current = this._current === null ? null : parseInt(this._current, 10); | |
| 376 | + } | |
| 377 | + return this; | |
| 378 | + }; | |
| 379 | + | |
| 380 | + Tour.prototype.redraw = function() { | |
| 381 | + return this._showOverlayElement(this.getStep(this.getCurrentStep())); | |
| 382 | + }; | |
| 383 | + | |
| 384 | + Tour.prototype._setState = function(key, value) { | |
| 385 | + var e, keyName; | |
| 386 | + if (this._options.storage) { | |
| 387 | + keyName = this._options.name + "_" + key; | |
| 388 | + try { | |
| 389 | + this._options.storage.setItem(keyName, value); | |
| 390 | + } catch (error) { | |
| 391 | + e = error; | |
| 392 | + if (e.code === DOMException.QUOTA_EXCEEDED_ERR) { | |
| 393 | + this._debug('LocalStorage quota exceeded. State storage failed.'); | |
| 394 | + } | |
| 395 | + } | |
| 396 | + return this._options.afterSetState(keyName, value); | |
| 397 | + } else { | |
| 398 | + if (this._state == null) { | |
| 399 | + this._state = {}; | |
| 400 | + } | |
| 401 | + return this._state[key] = value; | |
| 402 | + } | |
| 403 | + }; | |
| 404 | + | |
| 405 | + Tour.prototype._removeState = function(key) { | |
| 406 | + var keyName; | |
| 407 | + if (this._options.storage) { | |
| 408 | + keyName = this._options.name + "_" + key; | |
| 409 | + this._options.storage.removeItem(keyName); | |
| 410 | + return this._options.afterRemoveState(keyName); | |
| 411 | + } else { | |
| 412 | + if (this._state != null) { | |
| 413 | + return delete this._state[key]; | |
| 414 | + } | |
| 415 | + } | |
| 416 | + }; | |
| 417 | + | |
| 418 | + Tour.prototype._getState = function(key) { | |
| 419 | + var keyName, value; | |
| 420 | + if (this._options.storage) { | |
| 421 | + keyName = this._options.name + "_" + key; | |
| 422 | + value = this._options.storage.getItem(keyName); | |
| 423 | + } else { | |
| 424 | + if (this._state != null) { | |
| 425 | + value = this._state[key]; | |
| 426 | + } | |
| 427 | + } | |
| 428 | + if (value === void 0 || value === 'null') { | |
| 429 | + value = null; | |
| 430 | + } | |
| 431 | + this._options.afterGetState(key, value); | |
| 432 | + return value; | |
| 433 | + }; | |
| 434 | + | |
| 435 | + Tour.prototype._showNextStep = function() { | |
| 436 | + var promise, showNextStepHelper, step; | |
| 437 | + step = this.getStep(this._current); | |
| 438 | + showNextStepHelper = (function(_this) { | |
| 439 | + return function(e) { | |
| 440 | + return _this.showStep(step.next); | |
| 441 | + }; | |
| 442 | + })(this); | |
| 443 | + promise = this._makePromise(step.onNext != null ? step.onNext(this) : void 0); | |
| 444 | + return this._callOnPromiseDone(promise, showNextStepHelper); | |
| 445 | + }; | |
| 446 | + | |
| 447 | + Tour.prototype._showPrevStep = function() { | |
| 448 | + var promise, showPrevStepHelper, step; | |
| 449 | + step = this.getStep(this._current); | |
| 450 | + showPrevStepHelper = (function(_this) { | |
| 451 | + return function(e) { | |
| 452 | + return _this.showStep(step.prev); | |
| 453 | + }; | |
| 454 | + })(this); | |
| 455 | + promise = this._makePromise(step.onPrev != null ? step.onPrev(this) : void 0); | |
| 456 | + return this._callOnPromiseDone(promise, showPrevStepHelper); | |
| 457 | + }; | |
| 458 | + | |
| 459 | + Tour.prototype._debug = function(text) { | |
| 460 | + if (this._options.debug) { | |
| 461 | + return window.console.log("Bootstrap Tour '" + this._options.name + "' | " + text); | |
| 462 | + } | |
| 463 | + }; | |
| 464 | + | |
| 465 | + Tour.prototype._isRedirect = function(host, path, location) { | |
| 466 | + var currentPath; | |
| 467 | + if ((host != null) && host !== '' && (({}.toString.call(host) === '[object RegExp]' && !host.test(location.origin)) || ({}.toString.call(host) === '[object String]' && this._isHostDifferent(host, location)))) { | |
| 468 | + return true; | |
| 469 | + } | |
| 470 | + currentPath = [location.pathname, location.search, location.hash].join(''); | |
| 471 | + return (path != null) && path !== '' && (({}.toString.call(path) === '[object RegExp]' && !path.test(currentPath)) || ({}.toString.call(path) === '[object String]' && this._isPathDifferent(path, currentPath))); | |
| 472 | + }; | |
| 473 | + | |
| 474 | + Tour.prototype._isHostDifferent = function(host, location) { | |
| 475 | + switch ({}.toString.call(host)) { | |
| 476 | + case '[object RegExp]': | |
| 477 | + return !host.test(location.origin); | |
| 478 | + case '[object String]': | |
| 479 | + return this._getProtocol(host) !== this._getProtocol(location.href) || this._getHost(host) !== this._getHost(location.href); | |
| 480 | + default: | |
| 481 | + return true; | |
| 482 | + } | |
| 483 | + }; | |
| 484 | + | |
| 485 | + Tour.prototype._isPathDifferent = function(path, currentPath) { | |
| 486 | + return this._getPath(path) !== this._getPath(currentPath) || !this._equal(this._getQuery(path), this._getQuery(currentPath)) || !this._equal(this._getHash(path), this._getHash(currentPath)); | |
| 487 | + }; | |
| 488 | + | |
| 489 | + Tour.prototype._isJustPathHashDifferent = function(host, path, location) { | |
| 490 | + var currentPath; | |
| 491 | + if ((host != null) && host !== '') { | |
| 492 | + if (this._isHostDifferent(host, location)) { | |
| 493 | + return false; | |
| 494 | + } | |
| 495 | + } | |
| 496 | + currentPath = [location.pathname, location.search, location.hash].join(''); | |
| 497 | + if ({}.toString.call(path) === '[object String]') { | |
| 498 | + return this._getPath(path) === this._getPath(currentPath) && this._equal(this._getQuery(path), this._getQuery(currentPath)) && !this._equal(this._getHash(path), this._getHash(currentPath)); | |
| 499 | + } | |
| 500 | + return false; | |
| 501 | + }; | |
| 502 | + | |
| 503 | + Tour.prototype._redirect = function(step, i, path) { | |
| 504 | + var href; | |
| 505 | + if ($.isFunction(step.redirect)) { | |
| 506 | + return step.redirect.call(this, path); | |
| 507 | + } else { | |
| 508 | + href = {}.toString.call(step.host) === '[object String]' ? "" + step.host + path : path; | |
| 509 | + this._debug("Redirect to " + href); | |
| 510 | + if (this._getState('redirect_to') === ("" + i)) { | |
| 511 | + this._debug("Error redirection loop to " + path); | |
| 512 | + this._removeState('redirect_to'); | |
| 513 | + if (step.onRedirectError != null) { | |
| 514 | + return step.onRedirectError(this); | |
| 515 | + } | |
| 516 | + } else { | |
| 517 | + this._setState('redirect_to', "" + i); | |
| 518 | + return document.location.href = href; | |
| 519 | + } | |
| 520 | + } | |
| 521 | + }; | |
| 522 | + | |
| 523 | + Tour.prototype._isOrphan = function(step) { | |
| 524 | + return (step.element == null) || !$(step.element).length || $(step.element).is(':hidden') && ($(step.element)[0].namespaceURI !== 'http://www.w3.org/2000/svg'); | |
| 525 | + }; | |
| 526 | + | |
| 527 | + Tour.prototype._isLast = function() { | |
| 528 | + return this._current < this._options.steps.length - 1; | |
| 529 | + }; | |
| 530 | + | |
| 531 | + Tour.prototype._showPopoverAndOverlay = function(i) { | |
| 532 | + var step; | |
| 533 | + if (this.getCurrentStep() !== i || this.ended()) { | |
| 534 | + return; | |
| 535 | + } | |
| 536 | + step = this.getStep(i); | |
| 537 | + if (step.backdrop) { | |
| 538 | + this._showOverlayElement(step); | |
| 539 | + } | |
| 540 | + this._showPopover(step, i); | |
| 541 | + if (step.onShown != null) { | |
| 542 | + step.onShown(this); | |
| 543 | + } | |
| 544 | + return this._debug("Step " + (this._current + 1) + " of " + this._options.steps.length); | |
| 545 | + }; | |
| 546 | + | |
| 547 | + Tour.prototype._showPopover = function(step, i) { | |
| 548 | + var $element, $tip, isOrphan, options; | |
| 549 | + $(".tour-" + this._options.name).remove(); | |
| 550 | + options = $.extend({}, this._options); | |
| 551 | + isOrphan = this._isOrphan(step); | |
| 552 | + step.template = this._template(step, i); | |
| 553 | + if (isOrphan) { | |
| 554 | + step.element = 'body'; | |
| 555 | + step.placement = 'top'; | |
| 556 | + } | |
| 557 | + $element = $(step.element); | |
| 558 | + $element.addClass("tour-" + this._options.name + "-element tour-" + this._options.name + "-" + i + "-element"); | |
| 559 | + if (step.options) { | |
| 560 | + $.extend(options, step.options); | |
| 561 | + } | |
| 562 | + if (step.reflex && !isOrphan) { | |
| 563 | + $(step.reflexElement).addClass('tour-step-element-reflex').off((this._reflexEvent(step.reflex)) + ".tour-" + this._options.name).on((this._reflexEvent(step.reflex)) + ".tour-" + this._options.name, (function(_this) { | |
| 564 | + return function() { | |
| 565 | + if (_this._isLast()) { | |
| 566 | + return _this.next(); | |
| 567 | + } else { | |
| 568 | + return _this.end(); | |
| 569 | + } | |
| 570 | + }; | |
| 571 | + })(this)); | |
| 572 | + } | |
| 573 | + $element.popover({ | |
| 574 | + placement: step.placement, | |
| 575 | + trigger: 'manual', | |
| 576 | + title: step.title, | |
| 577 | + content: step.content, | |
| 578 | + html: true, | |
| 579 | + animation: step.animation, | |
| 580 | + container: step.container, | |
| 581 | + template: step.template, | |
| 582 | + selector: step.element | |
| 583 | + }).popover('show'); | |
| 584 | + $tip = $($element.data('bs.popover').getTipElement()); | |
| 585 | + return $tip.attr('id', step.id); | |
| 586 | + }; | |
| 587 | + | |
| 588 | + Tour.prototype._template = function(step, i) { | |
| 589 | + var $navigation, $next, $prev, $resume, $template, template; | |
| 590 | + template = step.template; | |
| 591 | + if (this._isOrphan(step) && {}.toString.call(step.orphan) !== '[object Boolean]') { | |
| 592 | + template = step.orphan; | |
| 593 | + } | |
| 594 | + $template = $.isFunction(template) ? $(template(i, step)) : $(template); | |
| 595 | + $navigation = $template.find('.popover-navigation'); | |
| 596 | + $prev = $navigation.find('[data-role="prev"]'); | |
| 597 | + $next = $navigation.find('[data-role="next"]'); | |
| 598 | + $resume = $navigation.find('[data-role="pause-resume"]'); | |
| 599 | + if (this._isOrphan(step)) { | |
| 600 | + $template.addClass('orphan'); | |
| 601 | + } | |
| 602 | + $template.addClass("tour-" + this._options.name + " tour-" + this._options.name + "-" + i); | |
| 603 | + if (step.reflex) { | |
| 604 | + $template.addClass("tour-" + this._options.name + "-reflex"); | |
| 605 | + } | |
| 606 | + if (step.prev < 0) { | |
| 607 | + $prev.addClass('disabled').prop('disabled', true).prop('tabindex', -1); | |
| 608 | + } | |
| 609 | + if (step.next < 0) { | |
| 610 | + $next.addClass('disabled').prop('disabled', true).prop('tabindex', -1); | |
| 611 | + } | |
| 612 | + if (!step.duration) { | |
| 613 | + $resume.remove(); | |
| 614 | + } | |
| 615 | + return $template.clone().wrap('<div>').parent().html(); | |
| 616 | + }; | |
| 617 | + | |
| 618 | + Tour.prototype._reflexEvent = function(reflex) { | |
| 619 | + if ({}.toString.call(reflex) === '[object Boolean]') { | |
| 620 | + return 'click'; | |
| 621 | + } else { | |
| 622 | + return reflex; | |
| 623 | + } | |
| 624 | + }; | |
| 625 | + | |
| 626 | + Tour.prototype._scrollIntoView = function(i) { | |
| 627 | + var $element, $window, counter, height, offsetTop, scrollTop, step, windowHeight; | |
| 628 | + step = this.getStep(i); | |
| 629 | + $element = $(step.element); | |
| 630 | + if (!$element.length) { | |
| 631 | + return this._showPopoverAndOverlay(i); | |
| 632 | + } | |
| 633 | + $window = $(window); | |
| 634 | + offsetTop = $element.offset().top; | |
| 635 | + height = $element.outerHeight(); | |
| 636 | + windowHeight = $window.height(); | |
| 637 | + scrollTop = 0; | |
| 638 | + switch (step.placement) { | |
| 639 | + case 'top': | |
| 640 | + scrollTop = Math.max(0, offsetTop - (windowHeight / 2)); | |
| 641 | + break; | |
| 642 | + case 'left': | |
| 643 | + case 'right': | |
| 644 | + scrollTop = Math.max(0, (offsetTop + height / 2) - (windowHeight / 2)); | |
| 645 | + break; | |
| 646 | + case 'bottom': | |
| 647 | + scrollTop = Math.max(0, (offsetTop + height) - (windowHeight / 2)); | |
| 648 | + } | |
| 649 | + this._debug("Scroll into view. ScrollTop: " + scrollTop + ". Element offset: " + offsetTop + ". Window height: " + windowHeight + "."); | |
| 650 | + counter = 0; | |
| 651 | + return $('body, html').stop(true, true).animate({ | |
| 652 | + scrollTop: Math.ceil(scrollTop) | |
| 653 | + }, (function(_this) { | |
| 654 | + return function() { | |
| 655 | + if (++counter === 2) { | |
| 656 | + _this._showPopoverAndOverlay(i); | |
| 657 | + return _this._debug("Scroll into view.\nAnimation end element offset: " + ($element.offset().top) + ".\nWindow height: " + ($window.height()) + "."); | |
| 658 | + } | |
| 659 | + }; | |
| 660 | + })(this)); | |
| 661 | + }; | |
| 662 | + | |
| 663 | + Tour.prototype._initMouseNavigation = function() { | |
| 664 | + var _this; | |
| 665 | + _this = this; | |
| 666 | + return $(document).off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='prev']").off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='next']").off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='end']").off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='pause-resume']").on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='next']", (function(_this) { | |
| 667 | + return function(e) { | |
| 668 | + e.preventDefault(); | |
| 669 | + return _this.next(); | |
| 670 | + }; | |
| 671 | + })(this)).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='prev']", (function(_this) { | |
| 672 | + return function(e) { | |
| 673 | + e.preventDefault(); | |
| 674 | + if (_this._current > 0) { | |
| 675 | + return _this.prev(); | |
| 676 | + } | |
| 677 | + }; | |
| 678 | + })(this)).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='end']", (function(_this) { | |
| 679 | + return function(e) { | |
| 680 | + e.preventDefault(); | |
| 681 | + return _this.end(); | |
| 682 | + }; | |
| 683 | + })(this)).on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role='pause-resume']", function(e) { | |
| 684 | + var $this; | |
| 685 | + e.preventDefault(); | |
| 686 | + $this = $(this); | |
| 687 | + $this.text(_this._paused ? $this.data('pause-text') : $this.data('resume-text')); | |
| 688 | + if (_this._paused) { | |
| 689 | + return _this.resume(); | |
| 690 | + } else { | |
| 691 | + return _this.pause(); | |
| 692 | + } | |
| 693 | + }); | |
| 694 | + }; | |
| 695 | + | |
| 696 | + Tour.prototype._initKeyboardNavigation = function() { | |
| 697 | + if (!this._options.keyboard) { | |
| 698 | + return; | |
| 699 | + } | |
| 700 | + return $(document).on("keyup.tour-" + this._options.name, (function(_this) { | |
| 701 | + return function(e) { | |
| 702 | + if (!e.which) { | |
| 703 | + return; | |
| 704 | + } | |
| 705 | + switch (e.which) { | |
| 706 | + case 39: | |
| 707 | + e.preventDefault(); | |
| 708 | + if (_this._isLast()) { | |
| 709 | + return _this.next(); | |
| 710 | + } else { | |
| 711 | + return _this.end(); | |
| 712 | + } | |
| 713 | + break; | |
| 714 | + case 37: | |
| 715 | + e.preventDefault(); | |
| 716 | + if (_this._current > 0) { | |
| 717 | + return _this.prev(); | |
| 718 | + } | |
| 719 | + } | |
| 720 | + }; | |
| 721 | + })(this)); | |
| 722 | + }; | |
| 723 | + | |
| 724 | + Tour.prototype._makePromise = function(result) { | |
| 725 | + if (result && $.isFunction(result.then)) { | |
| 726 | + return result; | |
| 727 | + } else { | |
| 728 | + return null; | |
| 729 | + } | |
| 730 | + }; | |
| 731 | + | |
| 732 | + Tour.prototype._callOnPromiseDone = function(promise, cb, arg) { | |
| 733 | + if (promise) { | |
| 734 | + return promise.then((function(_this) { | |
| 735 | + return function(e) { | |
| 736 | + return cb.call(_this, arg); | |
| 737 | + }; | |
| 738 | + })(this)); | |
| 739 | + } else { | |
| 740 | + return cb.call(this, arg); | |
| 741 | + } | |
| 742 | + }; | |
| 743 | + | |
| 744 | + Tour.prototype._showBackground = function(step, data) { | |
| 745 | + var $backdrop, base, height, j, len, pos, ref, results, width; | |
| 746 | + height = $(document).height(); | |
| 747 | + width = $(document).width(); | |
| 748 | + ref = ['top', 'bottom', 'left', 'right']; | |
| 749 | + results = []; | |
| 750 | + for (j = 0, len = ref.length; j < len; j++) { | |
| 751 | + pos = ref[j]; | |
| 752 | + $backdrop = (base = this.backdrops)[pos] != null ? base[pos] : base[pos] = $('<div>', { | |
| 753 | + "class": "tour-backdrop " + pos | |
| 754 | + }); | |
| 755 | + $(step.backdropContainer).append($backdrop); | |
| 756 | + switch (pos) { | |
| 757 | + case 'top': | |
| 758 | + results.push($backdrop.height(data.offset.top > 0 ? data.offset.top : 0).width(width).offset({ | |
| 759 | + top: 0, | |
| 760 | + left: 0 | |
| 761 | + })); | |
| 762 | + break; | |
| 763 | + case 'bottom': | |
| 764 | + results.push($backdrop.offset({ | |
| 765 | + top: data.offset.top + data.height, | |
| 766 | + left: 0 | |
| 767 | + }).height(height - (data.offset.top + data.height)).width(width)); | |
| 768 | + break; | |
| 769 | + case 'left': | |
| 770 | + results.push($backdrop.offset({ | |
| 771 | + top: data.offset.top, | |
| 772 | + left: 0 | |
| 773 | + }).height(data.height).width(data.offset.left > 0 ? data.offset.left : 0)); | |
| 774 | + break; | |
| 775 | + case 'right': | |
| 776 | + results.push($backdrop.offset({ | |
| 777 | + top: data.offset.top, | |
| 778 | + left: data.offset.left + data.width | |
| 779 | + }).height(data.height).width(width - (data.offset.left + data.width))); | |
| 780 | + break; | |
| 781 | + default: | |
| 782 | + results.push(void 0); | |
| 783 | + } | |
| 784 | + } | |
| 785 | + return results; | |
| 786 | + }; | |
| 787 | + | |
| 788 | + Tour.prototype._showOverlayElement = function(step) { | |
| 789 | + var $backdropElement, elementData; | |
| 790 | + $backdropElement = $(step.backdropElement); | |
| 791 | + if ($backdropElement.length === 0) { | |
| 792 | + elementData = { | |
| 793 | + width: 0, | |
| 794 | + height: 0, | |
| 795 | + offset: { | |
| 796 | + top: 0, | |
| 797 | + left: 0 | |
| 798 | + } | |
| 799 | + }; | |
| 800 | + } else { | |
| 801 | + elementData = { | |
| 802 | + width: $backdropElement.innerWidth(), | |
| 803 | + height: $backdropElement.innerHeight(), | |
| 804 | + offset: $backdropElement.offset() | |
| 805 | + }; | |
| 806 | + $backdropElement.addClass('tour-step-backdrop'); | |
| 807 | + if (step.backdropPadding) { | |
| 808 | + elementData = this._applyBackdropPadding(step.backdropPadding, elementData); | |
| 809 | + } | |
| 810 | + } | |
| 811 | + return this._showBackground(step, elementData); | |
| 812 | + }; | |
| 813 | + | |
| 814 | + Tour.prototype._hideOverlayElement = function(step) { | |
| 815 | + var $backdrop, pos, ref; | |
| 816 | + $(step.backdropElement).removeClass('tour-step-backdrop'); | |
| 817 | + ref = this.backdrops; | |
| 818 | + for (pos in ref) { | |
| 819 | + $backdrop = ref[pos]; | |
| 820 | + if ($backdrop && $backdrop.remove !== void 0) { | |
| 821 | + $backdrop.remove(); | |
| 822 | + } | |
| 823 | + } | |
| 824 | + return this.backdrops = []; | |
| 825 | + }; | |
| 826 | + | |
| 827 | + Tour.prototype._applyBackdropPadding = function(padding, data) { | |
| 828 | + if (typeof padding === 'object') { | |
| 829 | + if (padding.top == null) { | |
| 830 | + padding.top = 0; | |
| 831 | + } | |
| 832 | + if (padding.right == null) { | |
| 833 | + padding.right = 0; | |
| 834 | + } | |
| 835 | + if (padding.bottom == null) { | |
| 836 | + padding.bottom = 0; | |
| 837 | + } | |
| 838 | + if (padding.left == null) { | |
| 839 | + padding.left = 0; | |
| 840 | + } | |
| 841 | + data.offset.top = data.offset.top - padding.top; | |
| 842 | + data.offset.left = data.offset.left - padding.left; | |
| 843 | + data.width = data.width + padding.left + padding.right; | |
| 844 | + data.height = data.height + padding.top + padding.bottom; | |
| 845 | + } else { | |
| 846 | + data.offset.top = data.offset.top - padding; | |
| 847 | + data.offset.left = data.offset.left - padding; | |
| 848 | + data.width = data.width + (padding * 2); | |
| 849 | + data.height = data.height + (padding * 2); | |
| 850 | + } | |
| 851 | + return data; | |
| 852 | + }; | |
| 853 | + | |
| 854 | + Tour.prototype._clearTimer = function() { | |
| 855 | + window.clearTimeout(this._timer); | |
| 856 | + this._timer = null; | |
| 857 | + return this._duration = null; | |
| 858 | + }; | |
| 859 | + | |
| 860 | + Tour.prototype._getProtocol = function(url) { | |
| 861 | + url = url.split('://'); | |
| 862 | + if (url.length > 1) { | |
| 863 | + return url[0]; | |
| 864 | + } else { | |
| 865 | + return 'http'; | |
| 866 | + } | |
| 867 | + }; | |
| 868 | + | |
| 869 | + Tour.prototype._getHost = function(url) { | |
| 870 | + url = url.split('//'); | |
| 871 | + url = url.length > 1 ? url[1] : url[0]; | |
| 872 | + return url.split('/')[0]; | |
| 873 | + }; | |
| 874 | + | |
| 875 | + Tour.prototype._getPath = function(path) { | |
| 876 | + return path.replace(/\/?$/, '').split('?')[0].split('#')[0]; | |
| 877 | + }; | |
| 878 | + | |
| 879 | + Tour.prototype._getQuery = function(path) { | |
| 880 | + return this._getParams(path, '?'); | |
| 881 | + }; | |
| 882 | + | |
| 883 | + Tour.prototype._getHash = function(path) { | |
| 884 | + return this._getParams(path, '#'); | |
| 885 | + }; | |
| 886 | + | |
| 887 | + Tour.prototype._getParams = function(path, start) { | |
| 888 | + var j, len, param, params, paramsObject; | |
| 889 | + params = path.split(start); | |
| 890 | + if (params.length === 1) { | |
| 891 | + return {}; | |
| 892 | + } | |
| 893 | + params = params[1].split('&'); | |
| 894 | + paramsObject = {}; | |
| 895 | + for (j = 0, len = params.length; j < len; j++) { | |
| 896 | + param = params[j]; | |
| 897 | + param = param.split('='); | |
| 898 | + paramsObject[param[0]] = param[1] || ''; | |
| 899 | + } | |
| 900 | + return paramsObject; | |
| 901 | + }; | |
| 902 | + | |
| 903 | + Tour.prototype._equal = function(obj1, obj2) { | |
| 904 | + var j, k, len, obj1Keys, obj2Keys, v; | |
| 905 | + if ({}.toString.call(obj1) === '[object Object]' && {}.toString.call(obj2) === '[object Object]') { | |
| 906 | + obj1Keys = Object.keys(obj1); | |
| 907 | + obj2Keys = Object.keys(obj2); | |
| 908 | + if (obj1Keys.length !== obj2Keys.length) { | |
| 909 | + return false; | |
| 910 | + } | |
| 911 | + for (k in obj1) { | |
| 912 | + v = obj1[k]; | |
| 913 | + if (!this._equal(obj2[k], v)) { | |
| 914 | + return false; | |
| 915 | + } | |
| 916 | + } | |
| 917 | + return true; | |
| 918 | + } else if ({}.toString.call(obj1) === '[object Array]' && {}.toString.call(obj2) === '[object Array]') { | |
| 919 | + if (obj1.length !== obj2.length) { | |
| 920 | + return false; | |
| 921 | + } | |
| 922 | + for (k = j = 0, len = obj1.length; j < len; k = ++j) { | |
| 923 | + v = obj1[k]; | |
| 924 | + if (!this._equal(v, obj2[k])) { | |
| 925 | + return false; | |
| 926 | + } | |
| 927 | + } | |
| 928 | + return true; | |
| 929 | + } else { | |
| 930 | + return obj1 === obj2; | |
| 931 | + } | |
| 932 | + }; | |
| 933 | + | |
| 934 | + return Tour; | |
| 935 | + | |
| 936 | + })(); | |
| 937 | + return Tour; | |
| 938 | +}); | ... | ... |
| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | +/* ======================================================================== | |
| 2 | + * bootstrap-tour - v0.12.0 | |
| 3 | + * http://bootstraptour.com | |
| 4 | + * ======================================================================== | |
| 5 | + * Copyright 2012-2017 Ulrich Sossou | |
| 6 | + * | |
| 7 | + * ======================================================================== | |
| 8 | + * Licensed under the MIT License (the "License"); | |
| 9 | + * you may not use this file except in compliance with the License. | |
| 10 | + * You may obtain a copy of the License at | |
| 11 | + * | |
| 12 | + * https://opensource.org/licenses/MIT | |
| 13 | + * | |
| 14 | + * Unless required by applicable law or agreed to in writing, software | |
| 15 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 16 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 17 | + * See the License for the specific language governing permissions and | |
| 18 | + * limitations under the License. | |
| 19 | + * ======================================================================== | |
| 20 | + */ | |
| 21 | + | |
| 22 | +var bind=function(t,e){return function(){return t.apply(e,arguments)}};!function(t,e){"function"==typeof define&&define.amd?define(["jquery"],function(o){return t.Tour=e(o)}):"object"==typeof exports?module.exports=e(require("jquery")):t.Tour=e(t.jQuery)}(window,function(t){var e;return e=window.document,function(){function o(e){this._showPopoverAndOverlay=bind(this._showPopoverAndOverlay,this);var o;try{o=window.localStorage}catch(t){o=!1}this._options=t.extend({name:"tour",steps:[],container:"body",autoscroll:!0,keyboard:!0,storage:o,debug:!1,backdrop:!1,backdropContainer:"body",backdropPadding:0,redirect:!0,orphan:!1,duration:!1,delay:!1,basePath:"",template:'<div class="popover" role="tooltip"> <div class="arrow"></div> <h3 class="popover-header"></h3> <div class="popover-body"></div> <div class="popover-navigation"> <div class="btn-group"> <button class="btn btn-sm btn-secondary" data-role="prev">« Prev</button> <button class="btn btn-sm btn-secondary" data-role="next">Next »</button> <button class="btn btn-sm btn-secondary" data-role="pause-resume" data-pause-text="Pause" data-resume-text="Resume">Pause</button> </div> <button class="btn btn-sm btn-secondary" data-role="end">End tour</button> </div> </div>',afterSetState:function(t,e){},afterGetState:function(t,e){},afterRemoveState:function(t){},onStart:function(t){},onEnd:function(t){},onShow:function(t){},onShown:function(t){},onHide:function(t){},onHidden:function(t){},onNext:function(t){},onPrev:function(t){},onPause:function(t,e){},onResume:function(t,e){},onRedirectError:function(t){}},e),this._force=!1,this._inited=!1,this._current=null,this.backdrops=[]}return o.prototype.addSteps=function(t){var e,o,n;for(e=0,o=t.length;e<o;e++)n=t[e],this.addStep(n);return this},o.prototype.addStep=function(t){return this._options.steps.push(t),this},o.prototype.getStep=function(e){if(null!=this._options.steps[e])return t.extend({id:"step-"+e,path:"",host:"",placement:"right",title:"",content:"<p></p>",next:e===this._options.steps.length-1?-1:e+1,prev:e-1,animation:!0,container:this._options.container,autoscroll:this._options.autoscroll,backdrop:this._options.backdrop,backdropContainer:this._options.backdropContainer,backdropPadding:this._options.backdropPadding,redirect:this._options.redirect,reflexElement:this._options.steps[e].element,backdropElement:this._options.steps[e].element,orphan:this._options.orphan,duration:this._options.duration,delay:this._options.delay,template:this._options.template,onShow:this._options.onShow,onShown:this._options.onShown,onHide:this._options.onHide,onHidden:this._options.onHidden,onNext:this._options.onNext,onPrev:this._options.onPrev,onPause:this._options.onPause,onResume:this._options.onResume,onRedirectError:this._options.onRedirectError},this._options.steps[e])},o.prototype.init=function(t){return this._force=t,this.ended()?(this._debug("Tour ended, init prevented."),this):(this.setCurrentStep(),this._initMouseNavigation(),this._initKeyboardNavigation(),null!==this._current&&this.showStep(this._current),this._inited=!0,this)},o.prototype.start=function(t){var e;return null==t&&(t=!1),this._inited||this.init(t),null===this._current&&(e=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(e,this.showStep,0)),this},o.prototype.next=function(){var t;return t=this.hideStep(this._current,this._current+1),this._callOnPromiseDone(t,this._showNextStep)},o.prototype.prev=function(){var t;return t=this.hideStep(this._current,this._current-1),this._callOnPromiseDone(t,this._showPrevStep)},o.prototype.goTo=function(t){var e;return e=this.hideStep(this._current,t),this._callOnPromiseDone(e,this.showStep,t)},o.prototype.end=function(){var o,n;return o=function(o){return function(n){if(t(e).off("click.tour-"+o._options.name),t(e).off("keyup.tour-"+o._options.name),o._setState("end","yes"),o._inited=!1,o._force=!1,o._clearTimer(),null!=o._options.onEnd)return o._options.onEnd(o)}}(this),n=this.hideStep(this._current),this._callOnPromiseDone(n,o)},o.prototype.ended=function(){return!this._force&&!!this._getState("end")},o.prototype.restart=function(){return this._removeState("current_step"),this._removeState("end"),this._removeState("redirect_to"),this.start()},o.prototype.pause=function(){var t;return(t=this.getStep(this._current))&&t.duration?(this._paused=!0,this._duration-=(new Date).getTime()-this._start,window.clearTimeout(this._timer),this._debug("Paused/Stopped step "+(this._current+1)+" timer ("+this._duration+" remaining)."),null!=t.onPause?t.onPause(this,this._duration):void 0):this},o.prototype.resume=function(){var t;return(t=this.getStep(this._current))&&t.duration?(this._paused=!1,this._start=(new Date).getTime(),this._duration=this._duration||t.duration,this._timer=window.setTimeout(function(t){return function(){return t._isLast()?t.next():t.end()}}(this),this._duration),this._debug("Started step "+(this._current+1)+" timer with duration "+this._duration),null!=t.onResume&&this._duration!==t.duration?t.onResume(this,this._duration):void 0):this},o.prototype.hideStep=function(e,o){var n,i,r,s;if(s=this.getStep(e))return this._clearTimer(),r=this._makePromise(null!=s.onHide?s.onHide(this,e):void 0),i=function(n){return function(i){var r,a;if((r=t(s.element)).data("bs.popover")||(r=t("body")),r.popover("dispose").removeClass("tour-"+n._options.name+"-element tour-"+n._options.name+"-"+e+"-element").removeData("bs.popover"),s.reflex&&t(s.reflexElement).removeClass("tour-step-element-reflex").off(n._reflexEvent(s.reflex)+".tour-"+n._options.name),s.backdrop&&((a=null!=o&&n.getStep(o))&&a.backdrop&&a.backdropElement===s.backdropElement||n._hideOverlayElement(s)),null!=s.onHidden)return s.onHidden(n)}}(this),n=s.delay.hide||s.delay,"[object Number]"==={}.toString.call(n)&&n>0?(this._debug("Wait "+n+" milliseconds to hide the step "+(this._current+1)),window.setTimeout(function(t){return function(){return t._callOnPromiseDone(r,i)}}(this),n)):this._callOnPromiseDone(r,i),r},o.prototype.showStep=function(t){var o,n,i,r,s,a;return this.ended()?(this._debug("Tour ended, showStep prevented."),this):(a=this.getStep(t))&&(s=t<this._current,n=this._makePromise(null!=a.onShow?a.onShow(this,t):void 0),this.setCurrentStep(t),o=function(){switch({}.toString.call(a.path)){case"[object Function]":return a.path();case"[object String]":return this._options.basePath+a.path;default:return a.path}}.call(this),!a.redirect||!this._isRedirect(a.host,o,e.location)||(this._redirect(a,t,o),this._isJustPathHashDifferent(a.host,o,e.location)))?(r=function(e){return function(o){if(e._isOrphan(a)){if(!1===a.orphan)return e._debug("Skip the orphan step "+(e._current+1)+".\nOrphan option is false and the element does not exist or is hidden."),void(s?e._showPrevStep():e._showNextStep());e._debug("Show the orphan step "+(e._current+1)+". Orphans option is true.")}if(a.autoscroll?e._scrollIntoView(t):e._showPopoverAndOverlay(t),a.duration)return e.resume()}}(this),i=a.delay.show||a.delay,"[object Number]"==={}.toString.call(i)&&i>0?(this._debug("Wait "+i+" milliseconds to show the step "+(this._current+1)),window.setTimeout(function(t){return function(){return t._callOnPromiseDone(n,r)}}(this),i)):this._callOnPromiseDone(n,r),n):void 0},o.prototype.getCurrentStep=function(){return this._current},o.prototype.setCurrentStep=function(t){return null!=t?(this._current=t,this._setState("current_step",t)):(this._current=this._getState("current_step"),this._current=null===this._current?null:parseInt(this._current,10)),this},o.prototype.redraw=function(){return this._showOverlayElement(this.getStep(this.getCurrentStep()))},o.prototype._setState=function(t,e){var o;if(this._options.storage){o=this._options.name+"_"+t;try{this._options.storage.setItem(o,e)}catch(t){t.code===DOMException.QUOTA_EXCEEDED_ERR&&this._debug("LocalStorage quota exceeded. State storage failed.")}return this._options.afterSetState(o,e)}return null==this._state&&(this._state={}),this._state[t]=e},o.prototype._removeState=function(t){var e;return this._options.storage?(e=this._options.name+"_"+t,this._options.storage.removeItem(e),this._options.afterRemoveState(e)):null!=this._state?delete this._state[t]:void 0},o.prototype._getState=function(t){var e,o;return this._options.storage?(e=this._options.name+"_"+t,o=this._options.storage.getItem(e)):null!=this._state&&(o=this._state[t]),void 0!==o&&"null"!==o||(o=null),this._options.afterGetState(t,o),o},o.prototype._showNextStep=function(){var t,e,o;return o=this.getStep(this._current),e=function(t){return function(e){return t.showStep(o.next)}}(this),t=this._makePromise(null!=o.onNext?o.onNext(this):void 0),this._callOnPromiseDone(t,e)},o.prototype._showPrevStep=function(){var t,e,o;return o=this.getStep(this._current),e=function(t){return function(e){return t.showStep(o.prev)}}(this),t=this._makePromise(null!=o.onPrev?o.onPrev(this):void 0),this._callOnPromiseDone(t,e)},o.prototype._debug=function(t){if(this._options.debug)return window.console.log("Bootstrap Tour '"+this._options.name+"' | "+t)},o.prototype._isRedirect=function(t,e,o){var n;return!(null==t||""===t||!("[object RegExp]"==={}.toString.call(t)&&!t.test(o.origin)||"[object String]"==={}.toString.call(t)&&this._isHostDifferent(t,o)))||(n=[o.pathname,o.search,o.hash].join(""),null!=e&&""!==e&&("[object RegExp]"==={}.toString.call(e)&&!e.test(n)||"[object String]"==={}.toString.call(e)&&this._isPathDifferent(e,n)))},o.prototype._isHostDifferent=function(t,e){switch({}.toString.call(t)){case"[object RegExp]":return!t.test(e.origin);case"[object String]":return this._getProtocol(t)!==this._getProtocol(e.href)||this._getHost(t)!==this._getHost(e.href);default:return!0}},o.prototype._isPathDifferent=function(t,e){return this._getPath(t)!==this._getPath(e)||!this._equal(this._getQuery(t),this._getQuery(e))||!this._equal(this._getHash(t),this._getHash(e))},o.prototype._isJustPathHashDifferent=function(t,e,o){var n;return(null==t||""===t||!this._isHostDifferent(t,o))&&(n=[o.pathname,o.search,o.hash].join(""),"[object String]"==={}.toString.call(e)&&(this._getPath(e)===this._getPath(n)&&this._equal(this._getQuery(e),this._getQuery(n))&&!this._equal(this._getHash(e),this._getHash(n))))},o.prototype._redirect=function(o,n,i){var r;return t.isFunction(o.redirect)?o.redirect.call(this,i):(r="[object String]"==={}.toString.call(o.host)?""+o.host+i:i,this._debug("Redirect to "+r),this._getState("redirect_to")!==""+n?(this._setState("redirect_to",""+n),e.location.href=r):(this._debug("Error redirection loop to "+i),this._removeState("redirect_to"),null!=o.onRedirectError?o.onRedirectError(this):void 0))},o.prototype._isOrphan=function(e){return null==e.element||!t(e.element).length||t(e.element).is(":hidden")&&"http://www.w3.org/2000/svg"!==t(e.element)[0].namespaceURI},o.prototype._isLast=function(){return this._current<this._options.steps.length-1},o.prototype._showPopoverAndOverlay=function(t){var e;if(this.getCurrentStep()===t&&!this.ended())return(e=this.getStep(t)).backdrop&&this._showOverlayElement(e),this._showPopover(e,t),null!=e.onShown&&e.onShown(this),this._debug("Step "+(this._current+1)+" of "+this._options.steps.length)},o.prototype._showPopover=function(e,o){var n,i,r;return t(".tour-"+this._options.name).remove(),r=t.extend({},this._options),i=this._isOrphan(e),e.template=this._template(e,o),i&&(e.element="body",e.placement="top"),(n=t(e.element)).addClass("tour-"+this._options.name+"-element tour-"+this._options.name+"-"+o+"-element"),e.options&&t.extend(r,e.options),e.reflex&&!i&&t(e.reflexElement).addClass("tour-step-element-reflex").off(this._reflexEvent(e.reflex)+".tour-"+this._options.name).on(this._reflexEvent(e.reflex)+".tour-"+this._options.name,function(t){return function(){return t._isLast()?t.next():t.end()}}(this)),n.popover({placement:e.placement,trigger:"manual",title:e.title,content:e.content,html:!0,animation:e.animation,container:e.container,template:e.template,selector:e.element}).popover("show"),t(n.data("bs.popover").getTipElement()).attr("id",e.id)},o.prototype._template=function(e,o){var n,i,r,s,a,h;return h=e.template,this._isOrphan(e)&&"[object Boolean]"!=={}.toString.call(e.orphan)&&(h=e.orphan),a=t(t.isFunction(h)?h(o,e):h),n=a.find(".popover-navigation"),r=n.find('[data-role="prev"]'),i=n.find('[data-role="next"]'),s=n.find('[data-role="pause-resume"]'),this._isOrphan(e)&&a.addClass("orphan"),a.addClass("tour-"+this._options.name+" tour-"+this._options.name+"-"+o),e.reflex&&a.addClass("tour-"+this._options.name+"-reflex"),e.prev<0&&r.addClass("disabled").prop("disabled",!0).prop("tabindex",-1),e.next<0&&i.addClass("disabled").prop("disabled",!0).prop("tabindex",-1),e.duration||s.remove(),a.clone().wrap("<div>").parent().html()},o.prototype._reflexEvent=function(t){return"[object Boolean]"==={}.toString.call(t)?"click":t},o.prototype._scrollIntoView=function(e){var o,n,i,r,s,a,h,p;if(h=this.getStep(e),!(o=t(h.element)).length)return this._showPopoverAndOverlay(e);switch(n=t(window),s=o.offset().top,r=o.outerHeight(),p=n.height(),a=0,h.placement){case"top":a=Math.max(0,s-p/2);break;case"left":case"right":a=Math.max(0,s+r/2-p/2);break;case"bottom":a=Math.max(0,s+r-p/2)}return this._debug("Scroll into view. ScrollTop: "+a+". Element offset: "+s+". Window height: "+p+"."),i=0,t("body, html").stop(!0,!0).animate({scrollTop:Math.ceil(a)},function(t){return function(){if(2==++i)return t._showPopoverAndOverlay(e),t._debug("Scroll into view.\nAnimation end element offset: "+o.offset().top+".\nWindow height: "+n.height()+".")}}(this))},o.prototype._initMouseNavigation=function(){var o;return o=this,t(e).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='prev']").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='next']").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='end']").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='pause-resume']").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='next']",function(t){return function(e){return e.preventDefault(),t.next()}}(this)).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='prev']",function(t){return function(e){if(e.preventDefault(),t._current>0)return t.prev()}}(this)).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='end']",function(t){return function(e){return e.preventDefault(),t.end()}}(this)).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='pause-resume']",function(e){var n;return e.preventDefault(),(n=t(this)).text(o._paused?n.data("pause-text"):n.data("resume-text")),o._paused?o.resume():o.pause()})},o.prototype._initKeyboardNavigation=function(){if(this._options.keyboard)return t(e).on("keyup.tour-"+this._options.name,function(t){return function(e){if(e.which)switch(e.which){case 39:return e.preventDefault(),t._isLast()?t.next():t.end();case 37:if(e.preventDefault(),t._current>0)return t.prev()}}}(this))},o.prototype._makePromise=function(e){return e&&t.isFunction(e.then)?e:null},o.prototype._callOnPromiseDone=function(t,e,o){return t?t.then(function(t){return function(n){return e.call(t,o)}}(this)):e.call(this,o)},o.prototype._showBackground=function(o,n){var i,r,s,a,h,p,u,l,c;for(s=t(e).height(),c=t(e).width(),l=[],a=0,h=(u=["top","bottom","left","right"]).length;a<h;a++)switch(p=u[a],i=null!=(r=this.backdrops)[p]?r[p]:r[p]=t("<div>",{class:"tour-backdrop "+p}),t(o.backdropContainer).append(i),p){case"top":l.push(i.height(n.offset.top>0?n.offset.top:0).width(c).offset({top:0,left:0}));break;case"bottom":l.push(i.offset({top:n.offset.top+n.height,left:0}).height(s-(n.offset.top+n.height)).width(c));break;case"left":l.push(i.offset({top:n.offset.top,left:0}).height(n.height).width(n.offset.left>0?n.offset.left:0));break;case"right":l.push(i.offset({top:n.offset.top,left:n.offset.left+n.width}).height(n.height).width(c-(n.offset.left+n.width)));break;default:l.push(void 0)}return l},o.prototype._showOverlayElement=function(e){var o,n;return 0===(o=t(e.backdropElement)).length?n={width:0,height:0,offset:{top:0,left:0}}:(n={width:o.innerWidth(),height:o.innerHeight(),offset:o.offset()},o.addClass("tour-step-backdrop"),e.backdropPadding&&(n=this._applyBackdropPadding(e.backdropPadding,n))),this._showBackground(e,n)},o.prototype._hideOverlayElement=function(e){var o,n,i;t(e.backdropElement).removeClass("tour-step-backdrop"),i=this.backdrops;for(n in i)(o=i[n])&&void 0!==o.remove&&o.remove();return this.backdrops=[]},o.prototype._applyBackdropPadding=function(t,e){return"object"==typeof t?(null==t.top&&(t.top=0),null==t.right&&(t.right=0),null==t.bottom&&(t.bottom=0),null==t.left&&(t.left=0),e.offset.top=e.offset.top-t.top,e.offset.left=e.offset.left-t.left,e.width=e.width+t.left+t.right,e.height=e.height+t.top+t.bottom):(e.offset.top=e.offset.top-t,e.offset.left=e.offset.left-t,e.width=e.width+2*t,e.height=e.height+2*t),e},o.prototype._clearTimer=function(){return window.clearTimeout(this._timer),this._timer=null,this._duration=null},o.prototype._getProtocol=function(t){return(t=t.split("://")).length>1?t[0]:"http"},o.prototype._getHost=function(t){return t=t.split("//"),(t=t.length>1?t[1]:t[0]).split("/")[0]},o.prototype._getPath=function(t){return t.replace(/\/?$/,"").split("?")[0].split("#")[0]},o.prototype._getQuery=function(t){return this._getParams(t,"?")},o.prototype._getHash=function(t){return this._getParams(t,"#")},o.prototype._getParams=function(t,e){var o,n,i,r,s;if(1===(r=t.split(e)).length)return{};for(s={},o=0,n=(r=r[1].split("&")).length;o<n;o++)s[(i=(i=r[o]).split("="))[0]]=i[1]||"";return s},o.prototype._equal=function(t,e){var o,n,i,r,s,a;if("[object Object]"==={}.toString.call(t)&&"[object Object]"==={}.toString.call(e)){if(r=Object.keys(t),s=Object.keys(e),r.length!==s.length)return!1;for(n in t)if(a=t[n],!this._equal(e[n],a))return!1;return!0}if("[object Array]"==={}.toString.call(t)&&"[object Array]"==={}.toString.call(e)){if(t.length!==e.length)return!1;for(n=o=0,i=t.length;o<i;n=++o)if(a=t[n],!this._equal(a,e[n]))return!1;return!0}return t===e},o}()}); | |
| 0 | 23 | \ No newline at end of file | ... | ... |