Commit 0b818d7e6e8dd5ff9a558c282a3b298101bfc0b0
1 parent
7b2d40bf
Selection controllet bigs fix
Showing
10 changed files
with
3105 additions
and
38 deletions
controllets/data-sevc-controllet/data-sevc-controllet.html
... | ... | @@ -22,7 +22,8 @@ |
22 | 22 | |
23 | 23 | <dom-module id="data-sevc-controllet"> |
24 | 24 | <template> |
25 | - <link rel="stylesheet" href="../shared_js/malihu-custom-scrollbar-plugin-3.0.9/jquery.mCustomScrollbar.css"> | |
25 | + <!--<link rel="stylesheet" href="../shared_js/malihu-custom-scrollbar-plugin-3.0.9/jquery.mCustomScrollbar.css">--> | |
26 | + <link rel="stylesheet" href="../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css"> | |
26 | 27 | <style is="custom-style"> |
27 | 28 | body { |
28 | 29 | font-family: RobotoDraft, 'Helvetica Neue', Helvetica, Arial; |
... | ... | @@ -146,7 +147,6 @@ |
146 | 147 | overflow: auto; |
147 | 148 | position: relative; |
148 | 149 | float: left; |
149 | - overflow: auto; | |
150 | 150 | } |
151 | 151 | |
152 | 152 | .horizontal-section-container .vertical-section { |
... | ... | @@ -243,6 +243,7 @@ |
243 | 243 | #fields_placeholder{ |
244 | 244 | width: 40%; |
245 | 245 | height: 50vh; |
246 | + position: relative; | |
246 | 247 | float: left; |
247 | 248 | overflow: auto; |
248 | 249 | } |
... | ... | @@ -252,6 +253,7 @@ |
252 | 253 | width: 55%; |
253 | 254 | /*max-width: 100vw; |
254 | 255 | max-height: 50vh;*/ |
256 | + position: relative; | |
255 | 257 | float: left; |
256 | 258 | overflow: auto; |
257 | 259 | } |
... | ... | @@ -345,8 +347,8 @@ |
345 | 347 | </div> |
346 | 348 | |
347 | 349 | </div> |
348 | - <div>Under costruction</div> | |
349 | - <div>Under costruction</div> | |
350 | + <div><img src="static/images/UnderConstruction.png" style="position: relative;top: 60%;left: 25%;"></div> | |
351 | + <div><img src="static/images/UnderConstruction.png" style="position: relative;top: 60%;left: 25%;"></div> | |
350 | 352 | </iron-pages> |
351 | 353 | </div> |
352 | 354 | |
... | ... | @@ -357,10 +359,10 @@ |
357 | 359 | <div class="fancy"> |
358 | 360 | <div class="fancy-content"> |
359 | 361 | |
360 | - <div id="fields_placeholder" class="area_container mCustomScrollBox" data-mcs-theme="minimal-dark"> | |
362 | + <div id="fields_placeholder" class="area_container"> | |
361 | 363 | <treeview-controllet id="fields_treeview"></treeview-controllet> |
362 | 364 | </div> |
363 | - <div id="table_fields_container" class="area_container mCustomScrollBox" data-mcs-theme="minimal-dark"> | |
365 | + <div id="table_fields_container" class="area_container"> | |
364 | 366 | <div id="table_component_place_holder"></div> |
365 | 367 | </div> |
366 | 368 | </div> |
... | ... | @@ -380,18 +382,18 @@ |
380 | 382 | |
381 | 383 | <div id="fields_mapping_area" class="area_container"> |
382 | 384 | |
383 | - <div class="field-mapping-card mCustomScrollBox" data-mcs-theme="minimal-dark"> | |
385 | + <div id="selected_fields_main_container" class="field-mapping-card"> | |
384 | 386 | <div class="title"> |
385 | 387 | <div class="medium">Selected fields</div> |
386 | 388 | </div> |
387 | - <div id="selected_fields_container" class="area_container mCustomScrollBox" data-mcs-theme="minimal-dark"></div> | |
389 | + <div id="selected_fields_container" class="area_container"></div> | |
388 | 390 | </div> |
389 | 391 | |
390 | - <div class="field-mapping-card mCustomScrollBox" data-mcs-theme="minimal-dark"> | |
392 | + <div id="idm_fields_main_container" class="field-mapping-card"> | |
391 | 393 | <div class="title"> |
392 | 394 | <div class="medium">Datalet fields</div> |
393 | 395 | </div> |
394 | - <div id="datalet_idm_fields_container" class="area_container mCustomScrollBox" data-mcs-theme="minimal-dark"></div> | |
396 | + <div id="datalet_idm_fields_container" class="area_container"></div> | |
395 | 397 | </div> |
396 | 398 | </div> |
397 | 399 | |
... | ... | @@ -421,7 +423,8 @@ |
421 | 423 | </content> |
422 | 424 | </template> |
423 | 425 | <script src="../shared_js/bootstrap-3.3.4-dist/js/bootstrap.min.js"></script> |
424 | - <script src="../shared_js/malihu-custom-scrollbar-plugin-3.0.9/jquery.mCustomScrollbar.js"></script> | |
426 | + <!--<script src="../shared_js/malihu-custom-scrollbar-plugin-3.0.9/jquery.mCustomScrollbar.js"></script>--> | |
427 | + <script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script> | |
425 | 428 | <script src="../../../DEEPCLIENT/js/deepClient.js"></script> |
426 | 429 | |
427 | 430 | <script> |
... | ... | @@ -572,25 +575,11 @@ |
572 | 575 | |
573 | 576 | ready : function(){ |
574 | 577 | |
575 | - var scrollbar_options = { | |
576 | - autoHideScrollbar:true, | |
577 | - theme:"rounded" | |
578 | - }; | |
579 | - | |
580 | - $(this.$.fields_placeholder).mCustomScrollbar(scrollbar_options); | |
581 | - $(".field-mapping-card").mCustomScrollbar(scrollbar_options); | |
582 | - | |
583 | - /*$(this.$.table_fields_container).mCustomScrollbar({ | |
584 | - autoHideScrollbar:true, | |
585 | - theme:"rounded", | |
586 | - advanced:{autoExpandHorizontalScroll:true}, | |
587 | - axis:"yx" | |
588 | - });*/ | |
589 | - }, | |
578 | + $(this.$.fields_placeholder).perfectScrollbar(); | |
579 | + $(this.$.selected_fields_main_container).perfectScrollbar(); | |
580 | + $(this.$.idm_fields_main_container).perfectScrollbar(); | |
581 | + $(this.$.table_fields_container).perfectScrollbar(); | |
590 | 582 | |
591 | - detached : function(){ | |
592 | - $(this.$.fields_placeholder).mCustomScrollbar("destroy"); | |
593 | - $(".field-mapping-card").mCustomScrollbar("destroy"); | |
594 | 583 | }, |
595 | 584 | |
596 | 585 | /** |
... | ... | @@ -630,12 +619,12 @@ |
630 | 619 | this.datalets_list.push(datalet_info); |
631 | 620 | } |
632 | 621 | |
633 | - var w = $(this.$.visualization_slider_area).width(); | |
622 | + /*var w = $(this.$.visualization_slider_area).width(); | |
634 | 623 | var pages = 2; |
635 | - var numItemsPerPage = 3; | |
624 | + var numItemsPerPage = 3;*/ | |
636 | 625 | |
637 | 626 | this.$.visualization_slider_area.innerHTML = '<items-slider-controllet items=\'' + JSON.stringify(this.datalets_list) + '\'' + |
638 | - '\'></items-slider-controllet>' | |
627 | + '\'></items-slider-controllet>'; | |
639 | 628 | }, |
640 | 629 | |
641 | 630 | handleSelectedDatalet : function(e){ |
... | ... | @@ -670,12 +659,10 @@ |
670 | 659 | case 1: |
671 | 660 | this.$.toolbar_title.innerHTML = "Data fields selection"; |
672 | 661 | this.$.toolbar_description.innerHTML = "Select the fields you want to visualize"; |
673 | - $(this.$.fields_placeholder).mCustomScrollbar("update"); | |
674 | 662 | break; |
675 | 663 | case 2: |
676 | 664 | this.$.toolbar_title.innerHTML = "Data mapping"; |
677 | 665 | this.$.toolbar_description.innerHTML = "Select the visualization from the slider, drag and drop the selected fields in visualization parameter area, customize the visualization if you need"; |
678 | - $(".field-mapping-card").mCustomScrollbar("update"); | |
679 | 666 | break; |
680 | 667 | case 3: |
681 | 668 | this.$.toolbar_title.innerHTML = "Finish"; | ... | ... |
controllets/data-sevc-controllet/static/images/UnderConstruction.png
0 โ 100644
97.5 KB
controllets/items-slider-controllet/items-slider-controllet.html
... | ... | @@ -28,11 +28,17 @@ |
28 | 28 | position: relative; |
29 | 29 | float: left; |
30 | 30 | margin : .5em; |
31 | - height: 16.5vh; | |
31 | + | |
32 | + /* height: 16.5vh; | |
32 | 33 | min-height: 134px; |
33 | 34 | min-width: 115px; |
34 | 35 | max-width: 115px; |
35 | - width: 7vw; | |
36 | + width: 7vw;*/ | |
37 | + | |
38 | + height: 9em; | |
39 | + min-width: 80px; | |
40 | + max-width: 115px; | |
41 | + width: 9em; | |
36 | 42 | background: #fff; |
37 | 43 | border-radius: 0.125rem; |
38 | 44 | box-shadow: 0 0.625em 0.5125em 0 rgba(0, 0, 0, 0.25); |
... | ... | @@ -44,11 +50,17 @@ |
44 | 50 | float: left; |
45 | 51 | top : .5em; |
46 | 52 | margin : .5em; |
47 | - height: 16.5vh; | |
53 | + | |
54 | + /* height: 16.5vh; | |
48 | 55 | width: 7vw; |
49 | 56 | min-height: 134px; |
50 | 57 | min-width: 115px; |
58 | + max-width: 115px;*/ | |
59 | + height: 9em; | |
60 | + min-width: 80px; | |
51 | 61 | max-width: 115px; |
62 | + width: 8em; | |
63 | + | |
52 | 64 | background: #fff; |
53 | 65 | border-style: solid; |
54 | 66 | border-width: 0.03em; |
... | ... | @@ -72,7 +84,7 @@ |
72 | 84 | .title .big { |
73 | 85 | /*font-size: 1.1em;*/ |
74 | 86 | widht: 100%; |
75 | - font-size: 0.8vw; | |
87 | + font-size: 0.9em; | |
76 | 88 | color: var(--google-grey-500); |
77 | 89 | } |
78 | 90 | |
... | ... | @@ -194,6 +206,8 @@ |
194 | 206 | var mod = this.items.length % this.numItemsPerPage; |
195 | 207 | if(mod > 0) pages += 1; |
196 | 208 | |
209 | + this.itemsPages = new Array(); | |
210 | + this.itemsPerPage = new Array(); | |
197 | 211 | |
198 | 212 | for(var i = 0; i < pages; i++){ |
199 | 213 | this.itemsPages.push(i); | ... | ... |
controllets/shared_js/perfect-scrollbar/css/perfect-scrollbar.css
0 โ 100644
1 | +/* perfect-scrollbar v0.6.5 */ | |
2 | +.ps-container { | |
3 | + -ms-touch-action: none; | |
4 | + overflow: hidden !important; } | |
5 | + .ps-container.ps-active-x > .ps-scrollbar-x-rail, .ps-container.ps-active-y > .ps-scrollbar-y-rail { | |
6 | + display: block; } | |
7 | + .ps-container.ps-in-scrolling { | |
8 | + pointer-events: none; } | |
9 | + .ps-container.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail { | |
10 | + background-color: #eee; | |
11 | + opacity: 0.9; } | |
12 | + .ps-container.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail > .ps-scrollbar-x { | |
13 | + background-color: #999; } | |
14 | + .ps-container.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail { | |
15 | + background-color: #eee; | |
16 | + opacity: 0.9; } | |
17 | + .ps-container.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail > .ps-scrollbar-y { | |
18 | + background-color: #999; } | |
19 | + .ps-container > .ps-scrollbar-x-rail { | |
20 | + display: none; | |
21 | + position: absolute; | |
22 | + /* please don't change 'position' */ | |
23 | + -webkit-border-radius: 4px; | |
24 | + -moz-border-radius: 4px; | |
25 | + -ms-border-radius: 4px; | |
26 | + border-radius: 4px; | |
27 | + opacity: 0; | |
28 | + -webkit-transition: background-color .2s linear, opacity .2s linear; | |
29 | + -moz-transition: background-color .2s linear, opacity .2s linear; | |
30 | + -o-transition: background-color .2s linear, opacity .2s linear; | |
31 | + transition: background-color .2s linear, opacity .2s linear; | |
32 | + bottom: 3px; | |
33 | + /* there must be 'bottom' for ps-scrollbar-x-rail */ | |
34 | + height: 8px; } | |
35 | + .ps-container > .ps-scrollbar-x-rail > .ps-scrollbar-x { | |
36 | + position: absolute; | |
37 | + /* please don't change 'position' */ | |
38 | + background-color: #aaa; | |
39 | + -webkit-border-radius: 4px; | |
40 | + -moz-border-radius: 4px; | |
41 | + -ms-border-radius: 4px; | |
42 | + border-radius: 4px; | |
43 | + -webkit-transition: background-color .2s linear; | |
44 | + -moz-transition: background-color .2s linear; | |
45 | + -o-transition: background-color .2s linear; | |
46 | + transition: background-color .2s linear; | |
47 | + bottom: 0; | |
48 | + /* there must be 'bottom' for ps-scrollbar-x */ | |
49 | + height: 8px; } | |
50 | + .ps-container > .ps-scrollbar-y-rail { | |
51 | + display: none; | |
52 | + position: absolute; | |
53 | + /* please don't change 'position' */ | |
54 | + -webkit-border-radius: 4px; | |
55 | + -moz-border-radius: 4px; | |
56 | + -ms-border-radius: 4px; | |
57 | + border-radius: 4px; | |
58 | + opacity: 0; | |
59 | + -webkit-transition: background-color .2s linear, opacity .2s linear; | |
60 | + -moz-transition: background-color .2s linear, opacity .2s linear; | |
61 | + -o-transition: background-color .2s linear, opacity .2s linear; | |
62 | + transition: background-color .2s linear, opacity .2s linear; | |
63 | + right: 3px; | |
64 | + /* there must be 'right' for ps-scrollbar-y-rail */ | |
65 | + width: 8px; } | |
66 | + .ps-container > .ps-scrollbar-y-rail > .ps-scrollbar-y { | |
67 | + position: absolute; | |
68 | + /* please don't change 'position' */ | |
69 | + background-color: #aaa; | |
70 | + -webkit-border-radius: 4px; | |
71 | + -moz-border-radius: 4px; | |
72 | + -ms-border-radius: 4px; | |
73 | + border-radius: 4px; | |
74 | + -webkit-transition: background-color .2s linear; | |
75 | + -moz-transition: background-color .2s linear; | |
76 | + -o-transition: background-color .2s linear; | |
77 | + transition: background-color .2s linear; | |
78 | + right: 0; | |
79 | + /* there must be 'right' for ps-scrollbar-y */ | |
80 | + width: 8px; } | |
81 | + .ps-container:hover.ps-in-scrolling { | |
82 | + pointer-events: none; } | |
83 | + .ps-container:hover.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail { | |
84 | + background-color: #eee; | |
85 | + opacity: 0.9; } | |
86 | + .ps-container:hover.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail > .ps-scrollbar-x { | |
87 | + background-color: #999; } | |
88 | + .ps-container:hover.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail { | |
89 | + background-color: #eee; | |
90 | + opacity: 0.9; } | |
91 | + .ps-container:hover.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail > .ps-scrollbar-y { | |
92 | + background-color: #999; } | |
93 | + .ps-container:hover > .ps-scrollbar-x-rail, .ps-container:hover > .ps-scrollbar-y-rail { | |
94 | + opacity: 0.6; } | |
95 | + .ps-container:hover > .ps-scrollbar-x-rail:hover { | |
96 | + background-color: #eee; | |
97 | + opacity: 0.9; } | |
98 | + .ps-container:hover > .ps-scrollbar-x-rail:hover > .ps-scrollbar-x { | |
99 | + background-color: #999; } | |
100 | + .ps-container:hover > .ps-scrollbar-y-rail:hover { | |
101 | + background-color: #eee; | |
102 | + opacity: 0.9; } | |
103 | + .ps-container:hover > .ps-scrollbar-y-rail:hover > .ps-scrollbar-y { | |
104 | + background-color: #999; } | ... | ... |
controllets/shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css
0 โ 100644
1 | +/* perfect-scrollbar v0.6.5 */ | |
2 | +.ps-container{-ms-touch-action:none;overflow:hidden !important}.ps-container.ps-active-x>.ps-scrollbar-x-rail,.ps-container.ps-active-y>.ps-scrollbar-y-rail{display:block}.ps-container.ps-in-scrolling{pointer-events:none}.ps-container.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail{background-color:#eee;opacity:0.9}.ps-container.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail>.ps-scrollbar-x{background-color:#999}.ps-container.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail{background-color:#eee;opacity:0.9}.ps-container.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail>.ps-scrollbar-y{background-color:#999}.ps-container>.ps-scrollbar-x-rail{display:none;position:absolute;-webkit-border-radius:4px;-moz-border-radius:4px;-ms-border-radius:4px;border-radius:4px;opacity:0;-webkit-transition:background-color .2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;-o-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear;bottom:3px;height:8px}.ps-container>.ps-scrollbar-x-rail>.ps-scrollbar-x{position:absolute;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;-ms-border-radius:4px;border-radius:4px;-webkit-transition:background-color .2s linear;-moz-transition:background-color .2s linear;-o-transition:background-color .2s linear;transition:background-color .2s linear;bottom:0;height:8px}.ps-container>.ps-scrollbar-y-rail{display:none;position:absolute;-webkit-border-radius:4px;-moz-border-radius:4px;-ms-border-radius:4px;border-radius:4px;opacity:0;-webkit-transition:background-color .2s linear,opacity .2s linear;-moz-transition:background-color .2s linear,opacity .2s linear;-o-transition:background-color .2s linear,opacity .2s linear;transition:background-color .2s linear,opacity .2s linear;right:3px;width:8px}.ps-container>.ps-scrollbar-y-rail>.ps-scrollbar-y{position:absolute;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;-ms-border-radius:4px;border-radius:4px;-webkit-transition:background-color .2s linear;-moz-transition:background-color .2s linear;-o-transition:background-color .2s linear;transition:background-color .2s linear;right:0;width:8px}.ps-container:hover.ps-in-scrolling{pointer-events:none}.ps-container:hover.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail{background-color:#eee;opacity:0.9}.ps-container:hover.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail>.ps-scrollbar-x{background-color:#999}.ps-container:hover.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail{background-color:#eee;opacity:0.9}.ps-container:hover.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail>.ps-scrollbar-y{background-color:#999}.ps-container:hover>.ps-scrollbar-x-rail,.ps-container:hover>.ps-scrollbar-y-rail{opacity:0.6}.ps-container:hover>.ps-scrollbar-x-rail:hover{background-color:#eee;opacity:0.9}.ps-container:hover>.ps-scrollbar-x-rail:hover>.ps-scrollbar-x{background-color:#999}.ps-container:hover>.ps-scrollbar-y-rail:hover{background-color:#eee;opacity:0.9}.ps-container:hover>.ps-scrollbar-y-rail:hover>.ps-scrollbar-y{background-color:#999} | |
0 | 3 | \ No newline at end of file | ... | ... |
controllets/shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js
0 โ 100644
1 | +/* perfect-scrollbar v0.6.5 */ | |
2 | +!function t(e,n,r){function o(l,s){if(!n[l]){if(!e[l]){var a="function"==typeof require&&require;if(!s&&a)return a(l,!0);if(i)return i(l,!0);var c=new Error("Cannot find module '"+l+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[l]={exports:{}};e[l][0].call(u.exports,function(t){var n=e[l][1][t];return o(n?n:t)},u,u.exports,t,e,n,r)}return n[l].exports}for(var i="function"==typeof require&&require,l=0;l<r.length;l++)o(r[l]);return o}({1:[function(t,e,n){"use strict";function r(t){t.fn.perfectScrollbar=function(e){return this.each(function(){if("object"==typeof e||"undefined"==typeof e){var n=e;i.get(this)||o.initialize(this,n)}else{var r=e;"update"===r?o.update(this):"destroy"===r&&o.destroy(this)}return t(this)})}}var o=t("../main"),i=t("../plugin/instances");if("function"==typeof define&&define.amd)define(["jquery"],r);else{var l=window.jQuery?window.jQuery:window.$;"undefined"!=typeof l&&r(l)}e.exports=r},{"../main":7,"../plugin/instances":18}],2:[function(t,e,n){"use strict";function r(t,e){var n=t.className.split(" ");n.indexOf(e)<0&&n.push(e),t.className=n.join(" ")}function o(t,e){var n=t.className.split(" "),r=n.indexOf(e);r>=0&&n.splice(r,1),t.className=n.join(" ")}n.add=function(t,e){t.classList?t.classList.add(e):r(t,e)},n.remove=function(t,e){t.classList?t.classList.remove(e):o(t,e)},n.list=function(t){return t.classList?t.classList:t.className.split(" ")}},{}],3:[function(t,e,n){"use strict";function r(t,e){return window.getComputedStyle(t)[e]}function o(t,e,n){return"number"==typeof n&&(n=n.toString()+"px"),t.style[e]=n,t}function i(t,e){for(var n in e){var r=e[n];"number"==typeof r&&(r=r.toString()+"px"),t.style[n]=r}return t}var l={};l.e=function(t,e){var n=document.createElement(t);return n.className=e,n},l.appendTo=function(t,e){return e.appendChild(t),t},l.css=function(t,e,n){return"object"==typeof e?i(t,e):"undefined"==typeof n?r(t,e):o(t,e,n)},l.matches=function(t,e){return"undefined"!=typeof t.matches?t.matches(e):"undefined"!=typeof t.matchesSelector?t.matchesSelector(e):"undefined"!=typeof t.webkitMatchesSelector?t.webkitMatchesSelector(e):"undefined"!=typeof t.mozMatchesSelector?t.mozMatchesSelector(e):"undefined"!=typeof t.msMatchesSelector?t.msMatchesSelector(e):void 0},l.remove=function(t){"undefined"!=typeof t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t)},l.queryChildren=function(t,e){return Array.prototype.filter.call(t.childNodes,function(t){return l.matches(t,e)})},e.exports=l},{}],4:[function(t,e,n){"use strict";var r=function(t){this.element=t,this.events={}};r.prototype.bind=function(t,e){"undefined"==typeof this.events[t]&&(this.events[t]=[]),this.events[t].push(e),this.element.addEventListener(t,e,!1)},r.prototype.unbind=function(t,e){var n="undefined"!=typeof e;this.events[t]=this.events[t].filter(function(r){return n&&r!==e?!0:(this.element.removeEventListener(t,r,!1),!1)},this)},r.prototype.unbindAll=function(){for(var t in this.events)this.unbind(t)};var o=function(){this.eventElements=[]};o.prototype.eventElement=function(t){var e=this.eventElements.filter(function(e){return e.element===t})[0];return"undefined"==typeof e&&(e=new r(t),this.eventElements.push(e)),e},o.prototype.bind=function(t,e,n){this.eventElement(t).bind(e,n)},o.prototype.unbind=function(t,e,n){this.eventElement(t).unbind(e,n)},o.prototype.unbindAll=function(){for(var t=0;t<this.eventElements.length;t++)this.eventElements[t].unbindAll()},o.prototype.once=function(t,e,n){var r=this.eventElement(t),o=function(t){r.unbind(e,o),n(t)};r.bind(e,o)},e.exports=o},{}],5:[function(t,e,n){"use strict";e.exports=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return function(){return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}}()},{}],6:[function(t,e,n){"use strict";var r=t("./class"),o=t("./dom");n.toInt=function(t){return parseInt(t,10)||0},n.clone=function(t){if(null===t)return null;if("object"==typeof t){var e={};for(var n in t)e[n]=this.clone(t[n]);return e}return t},n.extend=function(t,e){var n=this.clone(t);for(var r in e)n[r]=this.clone(e[r]);return n},n.isEditable=function(t){return o.matches(t,"input,[contenteditable]")||o.matches(t,"select,[contenteditable]")||o.matches(t,"textarea,[contenteditable]")||o.matches(t,"button,[contenteditable]")},n.removePsClasses=function(t){for(var e=r.list(t),n=0;n<e.length;n++){var o=e[n];0===o.indexOf("ps-")&&r.remove(t,o)}},n.outerWidth=function(t){return this.toInt(o.css(t,"width"))+this.toInt(o.css(t,"paddingLeft"))+this.toInt(o.css(t,"paddingRight"))+this.toInt(o.css(t,"borderLeftWidth"))+this.toInt(o.css(t,"borderRightWidth"))},n.startScrolling=function(t,e){r.add(t,"ps-in-scrolling"),"undefined"!=typeof e?r.add(t,"ps-"+e):(r.add(t,"ps-x"),r.add(t,"ps-y"))},n.stopScrolling=function(t,e){r.remove(t,"ps-in-scrolling"),"undefined"!=typeof e?r.remove(t,"ps-"+e):(r.remove(t,"ps-x"),r.remove(t,"ps-y"))},n.env={isWebKit:"WebkitAppearance"in document.documentElement.style,supportsTouch:"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,supportsIePointer:null!==window.navigator.msMaxTouchPoints}},{"./class":2,"./dom":3}],7:[function(t,e,n){"use strict";var r=t("./plugin/destroy"),o=t("./plugin/initialize"),i=t("./plugin/update");e.exports={initialize:o,update:i,destroy:r}},{"./plugin/destroy":9,"./plugin/initialize":17,"./plugin/update":20}],8:[function(t,e,n){"use strict";e.exports={wheelSpeed:1,wheelPropagation:!1,swipePropagation:!0,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,stopPropagationOnClick:!0}},{}],9:[function(t,e,n){"use strict";var r=t("../lib/dom"),o=t("../lib/helper"),i=t("./instances");e.exports=function(t){var e=i.get(t);e&&(e.event.unbindAll(),r.remove(e.scrollbarX),r.remove(e.scrollbarY),r.remove(e.scrollbarXRail),r.remove(e.scrollbarYRail),o.removePsClasses(t),i.remove(t))}},{"../lib/dom":3,"../lib/helper":6,"./instances":18}],10:[function(t,e,n){"use strict";function r(t,e){function n(t){return t.getBoundingClientRect()}var r=window.Event.prototype.stopPropagation.bind;e.settings.stopPropagationOnClick&&e.event.bind(e.scrollbarY,"click",r),e.event.bind(e.scrollbarYRail,"click",function(r){var i=o.toInt(e.scrollbarYHeight/2),s=e.railYRatio*(r.pageY-window.scrollY-n(e.scrollbarYRail).top-i),a=e.railYRatio*(e.railYHeight-e.scrollbarYHeight),c=s/a;0>c?c=0:c>1&&(c=1),t.scrollTop=(e.contentHeight-e.containerHeight)*c,l(t),r.stopPropagation()}),e.settings.stopPropagationOnClick&&e.event.bind(e.scrollbarX,"click",r),e.event.bind(e.scrollbarXRail,"click",function(r){var i=o.toInt(e.scrollbarXWidth/2),s=e.railXRatio*(r.pageX-window.scrollX-n(e.scrollbarXRail).left-i),a=e.railXRatio*(e.railXWidth-e.scrollbarXWidth),c=s/a;0>c?c=0:c>1&&(c=1),t.scrollLeft=(e.contentWidth-e.containerWidth)*c-e.negativeScrollAdjustment,l(t),r.stopPropagation()})}var o=t("../../lib/helper"),i=t("../instances"),l=t("../update-geometry");e.exports=function(t){var e=i.get(t);r(t,e)}},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],11:[function(t,e,n){"use strict";function r(t,e){function n(n){var o=r+n*e.railXRatio,i=e.scrollbarXRail.getBoundingClientRect().left+e.railXRatio*(e.railXWidth-e.scrollbarXWidth);e.scrollbarXLeft=0>o?0:o>i?i:o;var s=l.toInt(e.scrollbarXLeft*(e.contentWidth-e.containerWidth)/(e.containerWidth-e.railXRatio*e.scrollbarXWidth))-e.negativeScrollAdjustment;t.scrollLeft=s}var r=null,o=null,s=function(e){n(e.pageX-o),a(t),e.stopPropagation(),e.preventDefault()},c=function(){l.stopScrolling(t,"x"),e.event.unbind(e.ownerDocument,"mousemove",s)};e.event.bind(e.scrollbarX,"mousedown",function(n){o=n.pageX,r=l.toInt(i.css(e.scrollbarX,"left"))*e.railXRatio,l.startScrolling(t,"x"),e.event.bind(e.ownerDocument,"mousemove",s),e.event.once(e.ownerDocument,"mouseup",c),n.stopPropagation(),n.preventDefault()})}function o(t,e){function n(n){var o=r+n*e.railYRatio,i=e.scrollbarYRail.getBoundingClientRect().top+e.railYRatio*(e.railYHeight-e.scrollbarYHeight);e.scrollbarYTop=0>o?0:o>i?i:o;var s=l.toInt(e.scrollbarYTop*(e.contentHeight-e.containerHeight)/(e.containerHeight-e.railYRatio*e.scrollbarYHeight));t.scrollTop=s}var r=null,o=null,s=function(e){n(e.pageY-o),a(t),e.stopPropagation(),e.preventDefault()},c=function(){l.stopScrolling(t,"y"),e.event.unbind(e.ownerDocument,"mousemove",s)};e.event.bind(e.scrollbarY,"mousedown",function(n){o=n.pageY,r=l.toInt(i.css(e.scrollbarY,"top"))*e.railYRatio,l.startScrolling(t,"y"),e.event.bind(e.ownerDocument,"mousemove",s),e.event.once(e.ownerDocument,"mouseup",c),n.stopPropagation(),n.preventDefault()})}var i=t("../../lib/dom"),l=t("../../lib/helper"),s=t("../instances"),a=t("../update-geometry");e.exports=function(t){var e=s.get(t);r(t,e),o(t,e)}},{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19}],12:[function(t,e,n){"use strict";function r(t,e){function n(n,r){var o=t.scrollTop;if(0===n){if(!e.scrollbarYActive)return!1;if(0===o&&r>0||o>=e.contentHeight-e.containerHeight&&0>r)return!e.settings.wheelPropagation}var i=t.scrollLeft;if(0===r){if(!e.scrollbarXActive)return!1;if(0===i&&0>n||i>=e.contentWidth-e.containerWidth&&n>0)return!e.settings.wheelPropagation}return!0}var r=!1;e.event.bind(t,"mouseenter",function(){r=!0}),e.event.bind(t,"mouseleave",function(){r=!1});var i=!1;e.event.bind(e.ownerDocument,"keydown",function(s){if((!s.isDefaultPrevented||!s.isDefaultPrevented())&&r){var a=document.activeElement?document.activeElement:e.ownerDocument.activeElement;if(a){for(;a.shadowRoot;)a=a.shadowRoot.activeElement;if(o.isEditable(a))return}var c=0,u=0;switch(s.which){case 37:c=-30;break;case 38:u=30;break;case 39:c=30;break;case 40:u=-30;break;case 33:u=90;break;case 32:u=s.shiftKey?90:-90;break;case 34:u=-90;break;case 35:u=s.ctrlKey?-e.contentHeight:-e.containerHeight;break;case 36:u=s.ctrlKey?t.scrollTop:e.containerHeight;break;default:return}t.scrollTop=t.scrollTop-u,t.scrollLeft=t.scrollLeft+c,l(t),i=n(c,u),i&&s.preventDefault()}})}var o=t("../../lib/helper"),i=t("../instances"),l=t("../update-geometry");e.exports=function(t){var e=i.get(t);r(t,e)}},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],13:[function(t,e,n){"use strict";function r(t,e){function n(n,r){var o=t.scrollTop;if(0===n){if(!e.scrollbarYActive)return!1;if(0===o&&r>0||o>=e.contentHeight-e.containerHeight&&0>r)return!e.settings.wheelPropagation}var i=t.scrollLeft;if(0===r){if(!e.scrollbarXActive)return!1;if(0===i&&0>n||i>=e.contentWidth-e.containerWidth&&n>0)return!e.settings.wheelPropagation}return!0}function r(t){var e=t.deltaX,n=-1*t.deltaY;return("undefined"==typeof e||"undefined"==typeof n)&&(e=-1*t.wheelDeltaX/6,n=t.wheelDeltaY/6),t.deltaMode&&1===t.deltaMode&&(e*=10,n*=10),e!==e&&n!==n&&(e=0,n=t.wheelDelta),[e,n]}function i(e,n){var r=t.querySelector("textarea:hover");if(r){var o=r.scrollHeight-r.clientHeight;if(o>0&&!(0===r.scrollTop&&n>0||r.scrollTop===o&&0>n))return!0;var i=r.scrollLeft-r.clientWidth;if(i>0&&!(0===r.scrollLeft&&0>e||r.scrollLeft===i&&e>0))return!0}return!1}function s(s){if(o.env.isWebKit||!t.querySelector("select:focus")){var c=r(s),u=c[0],d=c[1];i(u,d)||(a=!1,e.settings.useBothWheelAxes?e.scrollbarYActive&&!e.scrollbarXActive?(t.scrollTop=d?t.scrollTop-d*e.settings.wheelSpeed:t.scrollTop+u*e.settings.wheelSpeed,a=!0):e.scrollbarXActive&&!e.scrollbarYActive&&(t.scrollLeft=u?t.scrollLeft+u*e.settings.wheelSpeed:t.scrollLeft-d*e.settings.wheelSpeed,a=!0):(t.scrollTop=t.scrollTop-d*e.settings.wheelSpeed,t.scrollLeft=t.scrollLeft+u*e.settings.wheelSpeed),l(t),a=a||n(u,d),a&&(s.stopPropagation(),s.preventDefault()))}}var a=!1;"undefined"!=typeof window.onwheel?e.event.bind(t,"wheel",s):"undefined"!=typeof window.onmousewheel&&e.event.bind(t,"mousewheel",s)}var o=t("../../lib/helper"),i=t("../instances"),l=t("../update-geometry");e.exports=function(t){var e=i.get(t);r(t,e)}},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],14:[function(t,e,n){"use strict";function r(t,e){e.event.bind(t,"scroll",function(){i(t)})}var o=t("../instances"),i=t("../update-geometry");e.exports=function(t){var e=o.get(t);r(t,e)}},{"../instances":18,"../update-geometry":19}],15:[function(t,e,n){"use strict";function r(t,e){function n(){var t=window.getSelection?window.getSelection():document.getSelection?document.getSelection():"";return 0===t.toString().length?null:t.getRangeAt(0).commonAncestorContainer}function r(){a||(a=setInterval(function(){return i.get(t)?(t.scrollTop=t.scrollTop+c.top,t.scrollLeft=t.scrollLeft+c.left,void l(t)):void clearInterval(a)},50))}function s(){a&&(clearInterval(a),a=null),o.stopScrolling(t)}var a=null,c={top:0,left:0},u=!1;e.event.bind(e.ownerDocument,"selectionchange",function(){t.contains(n())?u=!0:(u=!1,s())}),e.event.bind(window,"mouseup",function(){u&&(u=!1,s())}),e.event.bind(window,"mousemove",function(e){if(u){var n={x:e.pageX,y:e.pageY},i={left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,top:t.offsetTop,bottom:t.offsetTop+t.offsetHeight};n.x<i.left+3?(c.left=-5,o.startScrolling(t,"x")):n.x>i.right-3?(c.left=5,o.startScrolling(t,"x")):c.left=0,n.y<i.top+3?(c.top=i.top+3-n.y<5?-5:-20,o.startScrolling(t,"y")):n.y>i.bottom-3?(c.top=n.y-i.bottom+3<5?5:20,o.startScrolling(t,"y")):c.top=0,0===c.top&&0===c.left?s():r()}})}var o=t("../../lib/helper"),i=t("../instances"),l=t("../update-geometry");e.exports=function(t){var e=i.get(t);r(t,e)}},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],16:[function(t,e,n){"use strict";function r(t,e,n,r){function l(n,r){var o=t.scrollTop,i=t.scrollLeft,l=Math.abs(n),s=Math.abs(r);if(s>l){if(0>r&&o===e.contentHeight-e.containerHeight||r>0&&0===o)return!e.settings.swipePropagation}else if(l>s&&(0>n&&i===e.contentWidth-e.containerWidth||n>0&&0===i))return!e.settings.swipePropagation;return!0}function s(e,n){t.scrollTop=t.scrollTop-n,t.scrollLeft=t.scrollLeft-e,i(t)}function a(){y=!0}function c(){y=!1}function u(t){return t.targetTouches?t.targetTouches[0]:t}function d(t){return t.targetTouches&&1===t.targetTouches.length?!0:t.pointerType&&"mouse"!==t.pointerType&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE?!0:!1}function p(t){if(d(t)){Y=!0;var e=u(t);b.pageX=e.pageX,b.pageY=e.pageY,g=(new Date).getTime(),null!==m&&clearInterval(m),t.stopPropagation()}}function f(t){if(!y&&Y&&d(t)){var e=u(t),n={pageX:e.pageX,pageY:e.pageY},r=n.pageX-b.pageX,o=n.pageY-b.pageY;s(r,o),b=n;var i=(new Date).getTime(),a=i-g;a>0&&(v.x=r/a,v.y=o/a,g=i),l(r,o)&&(t.stopPropagation(),t.preventDefault())}}function h(){!y&&Y&&(Y=!1,clearInterval(m),m=setInterval(function(){return o.get(t)?Math.abs(v.x)<.01&&Math.abs(v.y)<.01?void clearInterval(m):(s(30*v.x,30*v.y),v.x*=.8,void(v.y*=.8)):void clearInterval(m)},10))}var b={},g=0,v={},m=null,y=!1,Y=!1;n&&(e.event.bind(window,"touchstart",a),e.event.bind(window,"touchend",c),e.event.bind(t,"touchstart",p),e.event.bind(t,"touchmove",f),e.event.bind(t,"touchend",h)),r&&(window.PointerEvent?(e.event.bind(window,"pointerdown",a),e.event.bind(window,"pointerup",c),e.event.bind(t,"pointerdown",p),e.event.bind(t,"pointermove",f),e.event.bind(t,"pointerup",h)):window.MSPointerEvent&&(e.event.bind(window,"MSPointerDown",a),e.event.bind(window,"MSPointerUp",c),e.event.bind(t,"MSPointerDown",p),e.event.bind(t,"MSPointerMove",f),e.event.bind(t,"MSPointerUp",h)))}var o=t("../instances"),i=t("../update-geometry");e.exports=function(t,e,n){var i=o.get(t);r(t,i,e,n)}},{"../instances":18,"../update-geometry":19}],17:[function(t,e,n){"use strict";var r=t("../lib/class"),o=t("../lib/helper"),i=t("./instances"),l=t("./update-geometry"),s=t("./handler/click-rail"),a=t("./handler/drag-scrollbar"),c=t("./handler/keyboard"),u=t("./handler/mouse-wheel"),d=t("./handler/native-scroll"),p=t("./handler/selection"),f=t("./handler/touch");e.exports=function(t,e){e="object"==typeof e?e:{},r.add(t,"ps-container");var n=i.add(t);n.settings=o.extend(n.settings,e),s(t),a(t),u(t),d(t),p(t),(o.env.supportsTouch||o.env.supportsIePointer)&&f(t,o.env.supportsTouch,o.env.supportsIePointer),n.settings.useKeyboard&&c(t),l(t)}},{"../lib/class":2,"../lib/helper":6,"./handler/click-rail":10,"./handler/drag-scrollbar":11,"./handler/keyboard":12,"./handler/mouse-wheel":13,"./handler/native-scroll":14,"./handler/selection":15,"./handler/touch":16,"./instances":18,"./update-geometry":19}],18:[function(t,e,n){"use strict";function r(t){var e=this;e.settings=d.clone(a),e.containerWidth=null,e.containerHeight=null,e.contentWidth=null,e.contentHeight=null,e.isRtl="rtl"===s.css(t,"direction"),e.isNegativeScroll=function(){var e=t.scrollLeft,n=null;return t.scrollLeft=-1,n=t.scrollLeft<0,t.scrollLeft=e,n}(),e.negativeScrollAdjustment=e.isNegativeScroll?t.scrollWidth-t.clientWidth:0,e.event=new c,e.ownerDocument=t.ownerDocument||document,e.scrollbarXRail=s.appendTo(s.e("div","ps-scrollbar-x-rail"),t),e.scrollbarX=s.appendTo(s.e("div","ps-scrollbar-x"),e.scrollbarXRail),e.scrollbarXActive=null,e.scrollbarXWidth=null,e.scrollbarXLeft=null,e.scrollbarXBottom=d.toInt(s.css(e.scrollbarXRail,"bottom")),e.isScrollbarXUsingBottom=e.scrollbarXBottom===e.scrollbarXBottom,e.scrollbarXTop=e.isScrollbarXUsingBottom?null:d.toInt(s.css(e.scrollbarXRail,"top")),e.railBorderXWidth=d.toInt(s.css(e.scrollbarXRail,"borderLeftWidth"))+d.toInt(s.css(e.scrollbarXRail,"borderRightWidth")),s.css(e.scrollbarXRail,"display","block"),e.railXMarginWidth=d.toInt(s.css(e.scrollbarXRail,"marginLeft"))+d.toInt(s.css(e.scrollbarXRail,"marginRight")),s.css(e.scrollbarXRail,"display",""),e.railXWidth=null,e.railXRatio=null,e.scrollbarYRail=s.appendTo(s.e("div","ps-scrollbar-y-rail"),t),e.scrollbarY=s.appendTo(s.e("div","ps-scrollbar-y"),e.scrollbarYRail),e.scrollbarYActive=null,e.scrollbarYHeight=null,e.scrollbarYTop=null,e.scrollbarYRight=d.toInt(s.css(e.scrollbarYRail,"right")),e.isScrollbarYUsingRight=e.scrollbarYRight===e.scrollbarYRight,e.scrollbarYLeft=e.isScrollbarYUsingRight?null:d.toInt(s.css(e.scrollbarYRail,"left")),e.scrollbarYOuterWidth=e.isRtl?d.outerWidth(e.scrollbarY):null,e.railBorderYWidth=d.toInt(s.css(e.scrollbarYRail,"borderTopWidth"))+d.toInt(s.css(e.scrollbarYRail,"borderBottomWidth")),s.css(e.scrollbarYRail,"display","block"),e.railYMarginHeight=d.toInt(s.css(e.scrollbarYRail,"marginTop"))+d.toInt(s.css(e.scrollbarYRail,"marginBottom")),s.css(e.scrollbarYRail,"display",""),e.railYHeight=null,e.railYRatio=null}function o(t){return"undefined"==typeof t.dataset?t.getAttribute("data-ps-id"):t.dataset.psId}function i(t,e){"undefined"==typeof t.dataset?t.setAttribute("data-ps-id",e):t.dataset.psId=e}function l(t){"undefined"==typeof t.dataset?t.removeAttribute("data-ps-id"):delete t.dataset.psId}var s=t("../lib/dom"),a=t("./default-setting"),c=t("../lib/event-manager"),u=t("../lib/guid"),d=t("../lib/helper"),p={};n.add=function(t){var e=u();return i(t,e),p[e]=new r(t),p[e]},n.remove=function(t){delete p[o(t)],l(t)},n.get=function(t){return p[o(t)]}},{"../lib/dom":3,"../lib/event-manager":4,"../lib/guid":5,"../lib/helper":6,"./default-setting":8}],19:[function(t,e,n){"use strict";function r(t,e){return t.settings.minScrollbarLength&&(e=Math.max(e,t.settings.minScrollbarLength)),t.settings.maxScrollbarLength&&(e=Math.min(e,t.settings.maxScrollbarLength)),e}function o(t,e){var n={width:e.railXWidth};n.left=e.isRtl?e.negativeScrollAdjustment+t.scrollLeft+e.containerWidth-e.contentWidth:t.scrollLeft,e.isScrollbarXUsingBottom?n.bottom=e.scrollbarXBottom-t.scrollTop:n.top=e.scrollbarXTop+t.scrollTop,l.css(e.scrollbarXRail,n);var r={top:t.scrollTop,height:e.railYHeight};e.isScrollbarYUsingRight?r.right=e.isRtl?e.contentWidth-(e.negativeScrollAdjustment+t.scrollLeft)-e.scrollbarYRight-e.scrollbarYOuterWidth:e.scrollbarYRight-t.scrollLeft:r.left=e.isRtl?e.negativeScrollAdjustment+t.scrollLeft+2*e.containerWidth-e.contentWidth-e.scrollbarYLeft-e.scrollbarYOuterWidth:e.scrollbarYLeft+t.scrollLeft,l.css(e.scrollbarYRail,r),l.css(e.scrollbarX,{left:e.scrollbarXLeft,width:e.scrollbarXWidth-e.railBorderXWidth}),l.css(e.scrollbarY,{top:e.scrollbarYTop,height:e.scrollbarYHeight-e.railBorderYWidth})}var i=t("../lib/class"),l=t("../lib/dom"),s=t("../lib/helper"),a=t("./instances");e.exports=function(t){var e=a.get(t);e.containerWidth=t.clientWidth,e.containerHeight=t.clientHeight,e.contentWidth=t.scrollWidth,e.contentHeight=t.scrollHeight;var n;t.contains(e.scrollbarXRail)||(n=l.queryChildren(t,".ps-scrollbar-x-rail"),n.length>0&&n.forEach(function(t){l.remove(t)}),l.appendTo(e.scrollbarXRail,t)),t.contains(e.scrollbarYRail)||(n=l.queryChildren(t,".ps-scrollbar-y-rail"),n.length>0&&n.forEach(function(t){l.remove(t)}),l.appendTo(e.scrollbarYRail,t)),!e.settings.suppressScrollX&&e.containerWidth+e.settings.scrollXMarginOffset<e.contentWidth?(e.scrollbarXActive=!0,e.railXWidth=e.containerWidth-e.railXMarginWidth,e.railXRatio=e.containerWidth/e.railXWidth,e.scrollbarXWidth=r(e,s.toInt(e.railXWidth*e.containerWidth/e.contentWidth)),e.scrollbarXLeft=s.toInt((e.negativeScrollAdjustment+t.scrollLeft)*(e.railXWidth-e.scrollbarXWidth)/(e.contentWidth-e.containerWidth))):(e.scrollbarXActive=!1,e.scrollbarXWidth=0,e.scrollbarXLeft=0,t.scrollLeft=0),!e.settings.suppressScrollY&&e.containerHeight+e.settings.scrollYMarginOffset<e.contentHeight?(e.scrollbarYActive=!0,e.railYHeight=e.containerHeight-e.railYMarginHeight,e.railYRatio=e.containerHeight/e.railYHeight,e.scrollbarYHeight=r(e,s.toInt(e.railYHeight*e.containerHeight/e.contentHeight)),e.scrollbarYTop=s.toInt(t.scrollTop*(e.railYHeight-e.scrollbarYHeight)/(e.contentHeight-e.containerHeight))):(e.scrollbarYActive=!1,e.scrollbarYHeight=0,e.scrollbarYTop=0,t.scrollTop=0),e.scrollbarXLeft>=e.railXWidth-e.scrollbarXWidth&&(e.scrollbarXLeft=e.railXWidth-e.scrollbarXWidth),e.scrollbarYTop>=e.railYHeight-e.scrollbarYHeight&&(e.scrollbarYTop=e.railYHeight-e.scrollbarYHeight),o(t,e),i[e.scrollbarXActive?"add":"remove"](t,"ps-active-x"),i[e.scrollbarYActive?"add":"remove"](t,"ps-active-y")}},{"../lib/class":2,"../lib/dom":3,"../lib/helper":6,"./instances":18}],20:[function(t,e,n){"use strict";var r=t("../lib/dom"),o=t("../lib/helper"),i=t("./instances"),l=t("./update-geometry");e.exports=function(t){var e=i.get(t);e&&(e.negativeScrollAdjustment=e.isNegativeScroll?t.scrollWidth-t.clientWidth:0,r.css(e.scrollbarXRail,"display","block"),r.css(e.scrollbarYRail,"display","block"),e.railXMarginWidth=o.toInt(r.css(e.scrollbarXRail,"marginLeft"))+o.toInt(r.css(e.scrollbarXRail,"marginRight")),e.railYMarginHeight=o.toInt(r.css(e.scrollbarYRail,"marginTop"))+o.toInt(r.css(e.scrollbarYRail,"marginBottom")),r.css(e.scrollbarXRail,"display","none"),r.css(e.scrollbarYRail,"display","none"),l(t),r.css(e.scrollbarXRail,"display",""),r.css(e.scrollbarYRail,"display",""))}},{"../lib/dom":3,"../lib/helper":6,"./instances":18,"./update-geometry":19}]},{},[1]); | |
0 | 3 | \ No newline at end of file | ... | ... |
controllets/shared_js/perfect-scrollbar/js/min/perfect-scrollbar.min.js
0 โ 100644
1 | +/* perfect-scrollbar v0.6.5 */ | |
2 | +!function t(e,n,r){function o(l,s){if(!n[l]){if(!e[l]){var a="function"==typeof require&&require;if(!s&&a)return a(l,!0);if(i)return i(l,!0);var c=new Error("Cannot find module '"+l+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[l]={exports:{}};e[l][0].call(u.exports,function(t){var n=e[l][1][t];return o(n?n:t)},u,u.exports,t,e,n,r)}return n[l].exports}for(var i="function"==typeof require&&require,l=0;l<r.length;l++)o(r[l]);return o}({1:[function(t,e,n){"use strict";var r=t("../main");"function"==typeof define&&define.amd?define(r):(window.PerfectScrollbar=r,"undefined"==typeof window.Ps&&(window.Ps=r))},{"../main":7}],2:[function(t,e,n){"use strict";function r(t,e){var n=t.className.split(" ");n.indexOf(e)<0&&n.push(e),t.className=n.join(" ")}function o(t,e){var n=t.className.split(" "),r=n.indexOf(e);r>=0&&n.splice(r,1),t.className=n.join(" ")}n.add=function(t,e){t.classList?t.classList.add(e):r(t,e)},n.remove=function(t,e){t.classList?t.classList.remove(e):o(t,e)},n.list=function(t){return t.classList?t.classList:t.className.split(" ")}},{}],3:[function(t,e,n){"use strict";function r(t,e){return window.getComputedStyle(t)[e]}function o(t,e,n){return"number"==typeof n&&(n=n.toString()+"px"),t.style[e]=n,t}function i(t,e){for(var n in e){var r=e[n];"number"==typeof r&&(r=r.toString()+"px"),t.style[n]=r}return t}var l={};l.e=function(t,e){var n=document.createElement(t);return n.className=e,n},l.appendTo=function(t,e){return e.appendChild(t),t},l.css=function(t,e,n){return"object"==typeof e?i(t,e):"undefined"==typeof n?r(t,e):o(t,e,n)},l.matches=function(t,e){return"undefined"!=typeof t.matches?t.matches(e):"undefined"!=typeof t.matchesSelector?t.matchesSelector(e):"undefined"!=typeof t.webkitMatchesSelector?t.webkitMatchesSelector(e):"undefined"!=typeof t.mozMatchesSelector?t.mozMatchesSelector(e):"undefined"!=typeof t.msMatchesSelector?t.msMatchesSelector(e):void 0},l.remove=function(t){"undefined"!=typeof t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t)},l.queryChildren=function(t,e){return Array.prototype.filter.call(t.childNodes,function(t){return l.matches(t,e)})},e.exports=l},{}],4:[function(t,e,n){"use strict";var r=function(t){this.element=t,this.events={}};r.prototype.bind=function(t,e){"undefined"==typeof this.events[t]&&(this.events[t]=[]),this.events[t].push(e),this.element.addEventListener(t,e,!1)},r.prototype.unbind=function(t,e){var n="undefined"!=typeof e;this.events[t]=this.events[t].filter(function(r){return n&&r!==e?!0:(this.element.removeEventListener(t,r,!1),!1)},this)},r.prototype.unbindAll=function(){for(var t in this.events)this.unbind(t)};var o=function(){this.eventElements=[]};o.prototype.eventElement=function(t){var e=this.eventElements.filter(function(e){return e.element===t})[0];return"undefined"==typeof e&&(e=new r(t),this.eventElements.push(e)),e},o.prototype.bind=function(t,e,n){this.eventElement(t).bind(e,n)},o.prototype.unbind=function(t,e,n){this.eventElement(t).unbind(e,n)},o.prototype.unbindAll=function(){for(var t=0;t<this.eventElements.length;t++)this.eventElements[t].unbindAll()},o.prototype.once=function(t,e,n){var r=this.eventElement(t),o=function(t){r.unbind(e,o),n(t)};r.bind(e,o)},e.exports=o},{}],5:[function(t,e,n){"use strict";e.exports=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return function(){return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}}()},{}],6:[function(t,e,n){"use strict";var r=t("./class"),o=t("./dom");n.toInt=function(t){return parseInt(t,10)||0},n.clone=function(t){if(null===t)return null;if("object"==typeof t){var e={};for(var n in t)e[n]=this.clone(t[n]);return e}return t},n.extend=function(t,e){var n=this.clone(t);for(var r in e)n[r]=this.clone(e[r]);return n},n.isEditable=function(t){return o.matches(t,"input,[contenteditable]")||o.matches(t,"select,[contenteditable]")||o.matches(t,"textarea,[contenteditable]")||o.matches(t,"button,[contenteditable]")},n.removePsClasses=function(t){for(var e=r.list(t),n=0;n<e.length;n++){var o=e[n];0===o.indexOf("ps-")&&r.remove(t,o)}},n.outerWidth=function(t){return this.toInt(o.css(t,"width"))+this.toInt(o.css(t,"paddingLeft"))+this.toInt(o.css(t,"paddingRight"))+this.toInt(o.css(t,"borderLeftWidth"))+this.toInt(o.css(t,"borderRightWidth"))},n.startScrolling=function(t,e){r.add(t,"ps-in-scrolling"),"undefined"!=typeof e?r.add(t,"ps-"+e):(r.add(t,"ps-x"),r.add(t,"ps-y"))},n.stopScrolling=function(t,e){r.remove(t,"ps-in-scrolling"),"undefined"!=typeof e?r.remove(t,"ps-"+e):(r.remove(t,"ps-x"),r.remove(t,"ps-y"))},n.env={isWebKit:"WebkitAppearance"in document.documentElement.style,supportsTouch:"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,supportsIePointer:null!==window.navigator.msMaxTouchPoints}},{"./class":2,"./dom":3}],7:[function(t,e,n){"use strict";var r=t("./plugin/destroy"),o=t("./plugin/initialize"),i=t("./plugin/update");e.exports={initialize:o,update:i,destroy:r}},{"./plugin/destroy":9,"./plugin/initialize":17,"./plugin/update":20}],8:[function(t,e,n){"use strict";e.exports={wheelSpeed:1,wheelPropagation:!1,swipePropagation:!0,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,stopPropagationOnClick:!0}},{}],9:[function(t,e,n){"use strict";var r=t("../lib/dom"),o=t("../lib/helper"),i=t("./instances");e.exports=function(t){var e=i.get(t);e&&(e.event.unbindAll(),r.remove(e.scrollbarX),r.remove(e.scrollbarY),r.remove(e.scrollbarXRail),r.remove(e.scrollbarYRail),o.removePsClasses(t),i.remove(t))}},{"../lib/dom":3,"../lib/helper":6,"./instances":18}],10:[function(t,e,n){"use strict";function r(t,e){function n(t){return t.getBoundingClientRect()}var r=window.Event.prototype.stopPropagation.bind;e.settings.stopPropagationOnClick&&e.event.bind(e.scrollbarY,"click",r),e.event.bind(e.scrollbarYRail,"click",function(r){var i=o.toInt(e.scrollbarYHeight/2),s=e.railYRatio*(r.pageY-window.scrollY-n(e.scrollbarYRail).top-i),a=e.railYRatio*(e.railYHeight-e.scrollbarYHeight),c=s/a;0>c?c=0:c>1&&(c=1),t.scrollTop=(e.contentHeight-e.containerHeight)*c,l(t),r.stopPropagation()}),e.settings.stopPropagationOnClick&&e.event.bind(e.scrollbarX,"click",r),e.event.bind(e.scrollbarXRail,"click",function(r){var i=o.toInt(e.scrollbarXWidth/2),s=e.railXRatio*(r.pageX-window.scrollX-n(e.scrollbarXRail).left-i),a=e.railXRatio*(e.railXWidth-e.scrollbarXWidth),c=s/a;0>c?c=0:c>1&&(c=1),t.scrollLeft=(e.contentWidth-e.containerWidth)*c-e.negativeScrollAdjustment,l(t),r.stopPropagation()})}var o=t("../../lib/helper"),i=t("../instances"),l=t("../update-geometry");e.exports=function(t){var e=i.get(t);r(t,e)}},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],11:[function(t,e,n){"use strict";function r(t,e){function n(n){var o=r+n*e.railXRatio,i=e.scrollbarXRail.getBoundingClientRect().left+e.railXRatio*(e.railXWidth-e.scrollbarXWidth);e.scrollbarXLeft=0>o?0:o>i?i:o;var s=l.toInt(e.scrollbarXLeft*(e.contentWidth-e.containerWidth)/(e.containerWidth-e.railXRatio*e.scrollbarXWidth))-e.negativeScrollAdjustment;t.scrollLeft=s}var r=null,o=null,s=function(e){n(e.pageX-o),a(t),e.stopPropagation(),e.preventDefault()},c=function(){l.stopScrolling(t,"x"),e.event.unbind(e.ownerDocument,"mousemove",s)};e.event.bind(e.scrollbarX,"mousedown",function(n){o=n.pageX,r=l.toInt(i.css(e.scrollbarX,"left"))*e.railXRatio,l.startScrolling(t,"x"),e.event.bind(e.ownerDocument,"mousemove",s),e.event.once(e.ownerDocument,"mouseup",c),n.stopPropagation(),n.preventDefault()})}function o(t,e){function n(n){var o=r+n*e.railYRatio,i=e.scrollbarYRail.getBoundingClientRect().top+e.railYRatio*(e.railYHeight-e.scrollbarYHeight);e.scrollbarYTop=0>o?0:o>i?i:o;var s=l.toInt(e.scrollbarYTop*(e.contentHeight-e.containerHeight)/(e.containerHeight-e.railYRatio*e.scrollbarYHeight));t.scrollTop=s}var r=null,o=null,s=function(e){n(e.pageY-o),a(t),e.stopPropagation(),e.preventDefault()},c=function(){l.stopScrolling(t,"y"),e.event.unbind(e.ownerDocument,"mousemove",s)};e.event.bind(e.scrollbarY,"mousedown",function(n){o=n.pageY,r=l.toInt(i.css(e.scrollbarY,"top"))*e.railYRatio,l.startScrolling(t,"y"),e.event.bind(e.ownerDocument,"mousemove",s),e.event.once(e.ownerDocument,"mouseup",c),n.stopPropagation(),n.preventDefault()})}var i=t("../../lib/dom"),l=t("../../lib/helper"),s=t("../instances"),a=t("../update-geometry");e.exports=function(t){var e=s.get(t);r(t,e),o(t,e)}},{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19}],12:[function(t,e,n){"use strict";function r(t,e){function n(n,r){var o=t.scrollTop;if(0===n){if(!e.scrollbarYActive)return!1;if(0===o&&r>0||o>=e.contentHeight-e.containerHeight&&0>r)return!e.settings.wheelPropagation}var i=t.scrollLeft;if(0===r){if(!e.scrollbarXActive)return!1;if(0===i&&0>n||i>=e.contentWidth-e.containerWidth&&n>0)return!e.settings.wheelPropagation}return!0}var r=!1;e.event.bind(t,"mouseenter",function(){r=!0}),e.event.bind(t,"mouseleave",function(){r=!1});var i=!1;e.event.bind(e.ownerDocument,"keydown",function(s){if((!s.isDefaultPrevented||!s.isDefaultPrevented())&&r){var a=document.activeElement?document.activeElement:e.ownerDocument.activeElement;if(a){for(;a.shadowRoot;)a=a.shadowRoot.activeElement;if(o.isEditable(a))return}var c=0,u=0;switch(s.which){case 37:c=-30;break;case 38:u=30;break;case 39:c=30;break;case 40:u=-30;break;case 33:u=90;break;case 32:u=s.shiftKey?90:-90;break;case 34:u=-90;break;case 35:u=s.ctrlKey?-e.contentHeight:-e.containerHeight;break;case 36:u=s.ctrlKey?t.scrollTop:e.containerHeight;break;default:return}t.scrollTop=t.scrollTop-u,t.scrollLeft=t.scrollLeft+c,l(t),i=n(c,u),i&&s.preventDefault()}})}var o=t("../../lib/helper"),i=t("../instances"),l=t("../update-geometry");e.exports=function(t){var e=i.get(t);r(t,e)}},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],13:[function(t,e,n){"use strict";function r(t,e){function n(n,r){var o=t.scrollTop;if(0===n){if(!e.scrollbarYActive)return!1;if(0===o&&r>0||o>=e.contentHeight-e.containerHeight&&0>r)return!e.settings.wheelPropagation}var i=t.scrollLeft;if(0===r){if(!e.scrollbarXActive)return!1;if(0===i&&0>n||i>=e.contentWidth-e.containerWidth&&n>0)return!e.settings.wheelPropagation}return!0}function r(t){var e=t.deltaX,n=-1*t.deltaY;return("undefined"==typeof e||"undefined"==typeof n)&&(e=-1*t.wheelDeltaX/6,n=t.wheelDeltaY/6),t.deltaMode&&1===t.deltaMode&&(e*=10,n*=10),e!==e&&n!==n&&(e=0,n=t.wheelDelta),[e,n]}function i(e,n){var r=t.querySelector("textarea:hover");if(r){var o=r.scrollHeight-r.clientHeight;if(o>0&&!(0===r.scrollTop&&n>0||r.scrollTop===o&&0>n))return!0;var i=r.scrollLeft-r.clientWidth;if(i>0&&!(0===r.scrollLeft&&0>e||r.scrollLeft===i&&e>0))return!0}return!1}function s(s){if(o.env.isWebKit||!t.querySelector("select:focus")){var c=r(s),u=c[0],d=c[1];i(u,d)||(a=!1,e.settings.useBothWheelAxes?e.scrollbarYActive&&!e.scrollbarXActive?(t.scrollTop=d?t.scrollTop-d*e.settings.wheelSpeed:t.scrollTop+u*e.settings.wheelSpeed,a=!0):e.scrollbarXActive&&!e.scrollbarYActive&&(t.scrollLeft=u?t.scrollLeft+u*e.settings.wheelSpeed:t.scrollLeft-d*e.settings.wheelSpeed,a=!0):(t.scrollTop=t.scrollTop-d*e.settings.wheelSpeed,t.scrollLeft=t.scrollLeft+u*e.settings.wheelSpeed),l(t),a=a||n(u,d),a&&(s.stopPropagation(),s.preventDefault()))}}var a=!1;"undefined"!=typeof window.onwheel?e.event.bind(t,"wheel",s):"undefined"!=typeof window.onmousewheel&&e.event.bind(t,"mousewheel",s)}var o=t("../../lib/helper"),i=t("../instances"),l=t("../update-geometry");e.exports=function(t){var e=i.get(t);r(t,e)}},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],14:[function(t,e,n){"use strict";function r(t,e){e.event.bind(t,"scroll",function(){i(t)})}var o=t("../instances"),i=t("../update-geometry");e.exports=function(t){var e=o.get(t);r(t,e)}},{"../instances":18,"../update-geometry":19}],15:[function(t,e,n){"use strict";function r(t,e){function n(){var t=window.getSelection?window.getSelection():document.getSelection?document.getSelection():"";return 0===t.toString().length?null:t.getRangeAt(0).commonAncestorContainer}function r(){a||(a=setInterval(function(){return i.get(t)?(t.scrollTop=t.scrollTop+c.top,t.scrollLeft=t.scrollLeft+c.left,void l(t)):void clearInterval(a)},50))}function s(){a&&(clearInterval(a),a=null),o.stopScrolling(t)}var a=null,c={top:0,left:0},u=!1;e.event.bind(e.ownerDocument,"selectionchange",function(){t.contains(n())?u=!0:(u=!1,s())}),e.event.bind(window,"mouseup",function(){u&&(u=!1,s())}),e.event.bind(window,"mousemove",function(e){if(u){var n={x:e.pageX,y:e.pageY},i={left:t.offsetLeft,right:t.offsetLeft+t.offsetWidth,top:t.offsetTop,bottom:t.offsetTop+t.offsetHeight};n.x<i.left+3?(c.left=-5,o.startScrolling(t,"x")):n.x>i.right-3?(c.left=5,o.startScrolling(t,"x")):c.left=0,n.y<i.top+3?(c.top=i.top+3-n.y<5?-5:-20,o.startScrolling(t,"y")):n.y>i.bottom-3?(c.top=n.y-i.bottom+3<5?5:20,o.startScrolling(t,"y")):c.top=0,0===c.top&&0===c.left?s():r()}})}var o=t("../../lib/helper"),i=t("../instances"),l=t("../update-geometry");e.exports=function(t){var e=i.get(t);r(t,e)}},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],16:[function(t,e,n){"use strict";function r(t,e,n,r){function l(n,r){var o=t.scrollTop,i=t.scrollLeft,l=Math.abs(n),s=Math.abs(r);if(s>l){if(0>r&&o===e.contentHeight-e.containerHeight||r>0&&0===o)return!e.settings.swipePropagation}else if(l>s&&(0>n&&i===e.contentWidth-e.containerWidth||n>0&&0===i))return!e.settings.swipePropagation;return!0}function s(e,n){t.scrollTop=t.scrollTop-n,t.scrollLeft=t.scrollLeft-e,i(t)}function a(){Y=!0}function c(){Y=!1}function u(t){return t.targetTouches?t.targetTouches[0]:t}function d(t){return t.targetTouches&&1===t.targetTouches.length?!0:t.pointerType&&"mouse"!==t.pointerType&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE?!0:!1}function p(t){if(d(t)){y=!0;var e=u(t);b.pageX=e.pageX,b.pageY=e.pageY,g=(new Date).getTime(),null!==m&&clearInterval(m),t.stopPropagation()}}function f(t){if(!Y&&y&&d(t)){var e=u(t),n={pageX:e.pageX,pageY:e.pageY},r=n.pageX-b.pageX,o=n.pageY-b.pageY;s(r,o),b=n;var i=(new Date).getTime(),a=i-g;a>0&&(v.x=r/a,v.y=o/a,g=i),l(r,o)&&(t.stopPropagation(),t.preventDefault())}}function h(){!Y&&y&&(y=!1,clearInterval(m),m=setInterval(function(){return o.get(t)?Math.abs(v.x)<.01&&Math.abs(v.y)<.01?void clearInterval(m):(s(30*v.x,30*v.y),v.x*=.8,void(v.y*=.8)):void clearInterval(m)},10))}var b={},g=0,v={},m=null,Y=!1,y=!1;n&&(e.event.bind(window,"touchstart",a),e.event.bind(window,"touchend",c),e.event.bind(t,"touchstart",p),e.event.bind(t,"touchmove",f),e.event.bind(t,"touchend",h)),r&&(window.PointerEvent?(e.event.bind(window,"pointerdown",a),e.event.bind(window,"pointerup",c),e.event.bind(t,"pointerdown",p),e.event.bind(t,"pointermove",f),e.event.bind(t,"pointerup",h)):window.MSPointerEvent&&(e.event.bind(window,"MSPointerDown",a),e.event.bind(window,"MSPointerUp",c),e.event.bind(t,"MSPointerDown",p),e.event.bind(t,"MSPointerMove",f),e.event.bind(t,"MSPointerUp",h)))}var o=t("../instances"),i=t("../update-geometry");e.exports=function(t,e,n){var i=o.get(t);r(t,i,e,n)}},{"../instances":18,"../update-geometry":19}],17:[function(t,e,n){"use strict";var r=t("../lib/class"),o=t("../lib/helper"),i=t("./instances"),l=t("./update-geometry"),s=t("./handler/click-rail"),a=t("./handler/drag-scrollbar"),c=t("./handler/keyboard"),u=t("./handler/mouse-wheel"),d=t("./handler/native-scroll"),p=t("./handler/selection"),f=t("./handler/touch");e.exports=function(t,e){e="object"==typeof e?e:{},r.add(t,"ps-container");var n=i.add(t);n.settings=o.extend(n.settings,e),s(t),a(t),u(t),d(t),p(t),(o.env.supportsTouch||o.env.supportsIePointer)&&f(t,o.env.supportsTouch,o.env.supportsIePointer),n.settings.useKeyboard&&c(t),l(t)}},{"../lib/class":2,"../lib/helper":6,"./handler/click-rail":10,"./handler/drag-scrollbar":11,"./handler/keyboard":12,"./handler/mouse-wheel":13,"./handler/native-scroll":14,"./handler/selection":15,"./handler/touch":16,"./instances":18,"./update-geometry":19}],18:[function(t,e,n){"use strict";function r(t){var e=this;e.settings=d.clone(a),e.containerWidth=null,e.containerHeight=null,e.contentWidth=null,e.contentHeight=null,e.isRtl="rtl"===s.css(t,"direction"),e.isNegativeScroll=function(){var e=t.scrollLeft,n=null;return t.scrollLeft=-1,n=t.scrollLeft<0,t.scrollLeft=e,n}(),e.negativeScrollAdjustment=e.isNegativeScroll?t.scrollWidth-t.clientWidth:0,e.event=new c,e.ownerDocument=t.ownerDocument||document,e.scrollbarXRail=s.appendTo(s.e("div","ps-scrollbar-x-rail"),t),e.scrollbarX=s.appendTo(s.e("div","ps-scrollbar-x"),e.scrollbarXRail),e.scrollbarXActive=null,e.scrollbarXWidth=null,e.scrollbarXLeft=null,e.scrollbarXBottom=d.toInt(s.css(e.scrollbarXRail,"bottom")),e.isScrollbarXUsingBottom=e.scrollbarXBottom===e.scrollbarXBottom,e.scrollbarXTop=e.isScrollbarXUsingBottom?null:d.toInt(s.css(e.scrollbarXRail,"top")),e.railBorderXWidth=d.toInt(s.css(e.scrollbarXRail,"borderLeftWidth"))+d.toInt(s.css(e.scrollbarXRail,"borderRightWidth")),s.css(e.scrollbarXRail,"display","block"),e.railXMarginWidth=d.toInt(s.css(e.scrollbarXRail,"marginLeft"))+d.toInt(s.css(e.scrollbarXRail,"marginRight")),s.css(e.scrollbarXRail,"display",""),e.railXWidth=null,e.railXRatio=null,e.scrollbarYRail=s.appendTo(s.e("div","ps-scrollbar-y-rail"),t),e.scrollbarY=s.appendTo(s.e("div","ps-scrollbar-y"),e.scrollbarYRail),e.scrollbarYActive=null,e.scrollbarYHeight=null,e.scrollbarYTop=null,e.scrollbarYRight=d.toInt(s.css(e.scrollbarYRail,"right")),e.isScrollbarYUsingRight=e.scrollbarYRight===e.scrollbarYRight,e.scrollbarYLeft=e.isScrollbarYUsingRight?null:d.toInt(s.css(e.scrollbarYRail,"left")),e.scrollbarYOuterWidth=e.isRtl?d.outerWidth(e.scrollbarY):null,e.railBorderYWidth=d.toInt(s.css(e.scrollbarYRail,"borderTopWidth"))+d.toInt(s.css(e.scrollbarYRail,"borderBottomWidth")),s.css(e.scrollbarYRail,"display","block"),e.railYMarginHeight=d.toInt(s.css(e.scrollbarYRail,"marginTop"))+d.toInt(s.css(e.scrollbarYRail,"marginBottom")),s.css(e.scrollbarYRail,"display",""),e.railYHeight=null,e.railYRatio=null}function o(t){return"undefined"==typeof t.dataset?t.getAttribute("data-ps-id"):t.dataset.psId}function i(t,e){"undefined"==typeof t.dataset?t.setAttribute("data-ps-id",e):t.dataset.psId=e}function l(t){"undefined"==typeof t.dataset?t.removeAttribute("data-ps-id"):delete t.dataset.psId}var s=t("../lib/dom"),a=t("./default-setting"),c=t("../lib/event-manager"),u=t("../lib/guid"),d=t("../lib/helper"),p={};n.add=function(t){var e=u();return i(t,e),p[e]=new r(t),p[e]},n.remove=function(t){delete p[o(t)],l(t)},n.get=function(t){return p[o(t)]}},{"../lib/dom":3,"../lib/event-manager":4,"../lib/guid":5,"../lib/helper":6,"./default-setting":8}],19:[function(t,e,n){"use strict";function r(t,e){return t.settings.minScrollbarLength&&(e=Math.max(e,t.settings.minScrollbarLength)),t.settings.maxScrollbarLength&&(e=Math.min(e,t.settings.maxScrollbarLength)),e}function o(t,e){var n={width:e.railXWidth};n.left=e.isRtl?e.negativeScrollAdjustment+t.scrollLeft+e.containerWidth-e.contentWidth:t.scrollLeft,e.isScrollbarXUsingBottom?n.bottom=e.scrollbarXBottom-t.scrollTop:n.top=e.scrollbarXTop+t.scrollTop,l.css(e.scrollbarXRail,n);var r={top:t.scrollTop,height:e.railYHeight};e.isScrollbarYUsingRight?r.right=e.isRtl?e.contentWidth-(e.negativeScrollAdjustment+t.scrollLeft)-e.scrollbarYRight-e.scrollbarYOuterWidth:e.scrollbarYRight-t.scrollLeft:r.left=e.isRtl?e.negativeScrollAdjustment+t.scrollLeft+2*e.containerWidth-e.contentWidth-e.scrollbarYLeft-e.scrollbarYOuterWidth:e.scrollbarYLeft+t.scrollLeft,l.css(e.scrollbarYRail,r),l.css(e.scrollbarX,{left:e.scrollbarXLeft,width:e.scrollbarXWidth-e.railBorderXWidth}),l.css(e.scrollbarY,{top:e.scrollbarYTop,height:e.scrollbarYHeight-e.railBorderYWidth})}var i=t("../lib/class"),l=t("../lib/dom"),s=t("../lib/helper"),a=t("./instances");e.exports=function(t){var e=a.get(t);e.containerWidth=t.clientWidth,e.containerHeight=t.clientHeight,e.contentWidth=t.scrollWidth,e.contentHeight=t.scrollHeight;var n;t.contains(e.scrollbarXRail)||(n=l.queryChildren(t,".ps-scrollbar-x-rail"),n.length>0&&n.forEach(function(t){l.remove(t)}),l.appendTo(e.scrollbarXRail,t)),t.contains(e.scrollbarYRail)||(n=l.queryChildren(t,".ps-scrollbar-y-rail"),n.length>0&&n.forEach(function(t){l.remove(t)}),l.appendTo(e.scrollbarYRail,t)),!e.settings.suppressScrollX&&e.containerWidth+e.settings.scrollXMarginOffset<e.contentWidth?(e.scrollbarXActive=!0,e.railXWidth=e.containerWidth-e.railXMarginWidth,e.railXRatio=e.containerWidth/e.railXWidth,e.scrollbarXWidth=r(e,s.toInt(e.railXWidth*e.containerWidth/e.contentWidth)),e.scrollbarXLeft=s.toInt((e.negativeScrollAdjustment+t.scrollLeft)*(e.railXWidth-e.scrollbarXWidth)/(e.contentWidth-e.containerWidth))):(e.scrollbarXActive=!1,e.scrollbarXWidth=0,e.scrollbarXLeft=0,t.scrollLeft=0),!e.settings.suppressScrollY&&e.containerHeight+e.settings.scrollYMarginOffset<e.contentHeight?(e.scrollbarYActive=!0,e.railYHeight=e.containerHeight-e.railYMarginHeight,e.railYRatio=e.containerHeight/e.railYHeight,e.scrollbarYHeight=r(e,s.toInt(e.railYHeight*e.containerHeight/e.contentHeight)),e.scrollbarYTop=s.toInt(t.scrollTop*(e.railYHeight-e.scrollbarYHeight)/(e.contentHeight-e.containerHeight))):(e.scrollbarYActive=!1,e.scrollbarYHeight=0,e.scrollbarYTop=0,t.scrollTop=0),e.scrollbarXLeft>=e.railXWidth-e.scrollbarXWidth&&(e.scrollbarXLeft=e.railXWidth-e.scrollbarXWidth),e.scrollbarYTop>=e.railYHeight-e.scrollbarYHeight&&(e.scrollbarYTop=e.railYHeight-e.scrollbarYHeight),o(t,e),i[e.scrollbarXActive?"add":"remove"](t,"ps-active-x"),i[e.scrollbarYActive?"add":"remove"](t,"ps-active-y")}},{"../lib/class":2,"../lib/dom":3,"../lib/helper":6,"./instances":18}],20:[function(t,e,n){"use strict";var r=t("../lib/dom"),o=t("../lib/helper"),i=t("./instances"),l=t("./update-geometry");e.exports=function(t){var e=i.get(t);e&&(e.negativeScrollAdjustment=e.isNegativeScroll?t.scrollWidth-t.clientWidth:0,r.css(e.scrollbarXRail,"display","block"),r.css(e.scrollbarYRail,"display","block"),e.railXMarginWidth=o.toInt(r.css(e.scrollbarXRail,"marginLeft"))+o.toInt(r.css(e.scrollbarXRail,"marginRight")),e.railYMarginHeight=o.toInt(r.css(e.scrollbarYRail,"marginTop"))+o.toInt(r.css(e.scrollbarYRail,"marginBottom")),r.css(e.scrollbarXRail,"display","none"),r.css(e.scrollbarYRail,"display","none"),l(t),r.css(e.scrollbarXRail,"display",""),r.css(e.scrollbarYRail,"display",""))}},{"../lib/dom":3,"../lib/helper":6,"./instances":18,"./update-geometry":19}]},{},[1]); | |
0 | 3 | \ No newline at end of file | ... | ... |
controllets/shared_js/perfect-scrollbar/js/perfect-scrollbar.jquery.js
0 โ 100644
1 | +/* perfect-scrollbar v0.6.5 */ | |
2 | +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | |
3 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
4 | + * Licensed under the MIT License | |
5 | + */ | |
6 | +'use strict'; | |
7 | + | |
8 | +var ps = require('../main') | |
9 | + , psInstances = require('../plugin/instances'); | |
10 | + | |
11 | +function mountJQuery(jQuery) { | |
12 | + jQuery.fn.perfectScrollbar = function (settingOrCommand) { | |
13 | + return this.each(function () { | |
14 | + if (typeof settingOrCommand === 'object' || | |
15 | + typeof settingOrCommand === 'undefined') { | |
16 | + // If it's an object or none, initialize. | |
17 | + var settings = settingOrCommand; | |
18 | + | |
19 | + if (!psInstances.get(this)) { | |
20 | + ps.initialize(this, settings); | |
21 | + } | |
22 | + } else { | |
23 | + // Unless, it may be a command. | |
24 | + var command = settingOrCommand; | |
25 | + | |
26 | + if (command === 'update') { | |
27 | + ps.update(this); | |
28 | + } else if (command === 'destroy') { | |
29 | + ps.destroy(this); | |
30 | + } | |
31 | + } | |
32 | + | |
33 | + return jQuery(this); | |
34 | + }); | |
35 | + }; | |
36 | +} | |
37 | + | |
38 | +if (typeof define === 'function' && define.amd) { | |
39 | + // AMD. Register as an anonymous module. | |
40 | + define(['jquery'], mountJQuery); | |
41 | +} else { | |
42 | + var jq = window.jQuery ? window.jQuery : window.$; | |
43 | + if (typeof jq !== 'undefined') { | |
44 | + mountJQuery(jq); | |
45 | + } | |
46 | +} | |
47 | + | |
48 | +module.exports = mountJQuery; | |
49 | + | |
50 | +},{"../main":7,"../plugin/instances":18}],2:[function(require,module,exports){ | |
51 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
52 | + * Licensed under the MIT License | |
53 | + */ | |
54 | +'use strict'; | |
55 | + | |
56 | +function oldAdd(element, className) { | |
57 | + var classes = element.className.split(' '); | |
58 | + if (classes.indexOf(className) < 0) { | |
59 | + classes.push(className); | |
60 | + } | |
61 | + element.className = classes.join(' '); | |
62 | +} | |
63 | + | |
64 | +function oldRemove(element, className) { | |
65 | + var classes = element.className.split(' '); | |
66 | + var idx = classes.indexOf(className); | |
67 | + if (idx >= 0) { | |
68 | + classes.splice(idx, 1); | |
69 | + } | |
70 | + element.className = classes.join(' '); | |
71 | +} | |
72 | + | |
73 | +exports.add = function (element, className) { | |
74 | + if (element.classList) { | |
75 | + element.classList.add(className); | |
76 | + } else { | |
77 | + oldAdd(element, className); | |
78 | + } | |
79 | +}; | |
80 | + | |
81 | +exports.remove = function (element, className) { | |
82 | + if (element.classList) { | |
83 | + element.classList.remove(className); | |
84 | + } else { | |
85 | + oldRemove(element, className); | |
86 | + } | |
87 | +}; | |
88 | + | |
89 | +exports.list = function (element) { | |
90 | + if (element.classList) { | |
91 | + return element.classList; | |
92 | + } else { | |
93 | + return element.className.split(' '); | |
94 | + } | |
95 | +}; | |
96 | + | |
97 | +},{}],3:[function(require,module,exports){ | |
98 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
99 | + * Licensed under the MIT License | |
100 | + */ | |
101 | +'use strict'; | |
102 | + | |
103 | +var DOM = {}; | |
104 | + | |
105 | +DOM.e = function (tagName, className) { | |
106 | + var element = document.createElement(tagName); | |
107 | + element.className = className; | |
108 | + return element; | |
109 | +}; | |
110 | + | |
111 | +DOM.appendTo = function (child, parent) { | |
112 | + parent.appendChild(child); | |
113 | + return child; | |
114 | +}; | |
115 | + | |
116 | +function cssGet(element, styleName) { | |
117 | + return window.getComputedStyle(element)[styleName]; | |
118 | +} | |
119 | + | |
120 | +function cssSet(element, styleName, styleValue) { | |
121 | + if (typeof styleValue === 'number') { | |
122 | + styleValue = styleValue.toString() + 'px'; | |
123 | + } | |
124 | + element.style[styleName] = styleValue; | |
125 | + return element; | |
126 | +} | |
127 | + | |
128 | +function cssMultiSet(element, obj) { | |
129 | + for (var key in obj) { | |
130 | + var val = obj[key]; | |
131 | + if (typeof val === 'number') { | |
132 | + val = val.toString() + 'px'; | |
133 | + } | |
134 | + element.style[key] = val; | |
135 | + } | |
136 | + return element; | |
137 | +} | |
138 | + | |
139 | +DOM.css = function (element, styleNameOrObject, styleValue) { | |
140 | + if (typeof styleNameOrObject === 'object') { | |
141 | + // multiple set with object | |
142 | + return cssMultiSet(element, styleNameOrObject); | |
143 | + } else { | |
144 | + if (typeof styleValue === 'undefined') { | |
145 | + return cssGet(element, styleNameOrObject); | |
146 | + } else { | |
147 | + return cssSet(element, styleNameOrObject, styleValue); | |
148 | + } | |
149 | + } | |
150 | +}; | |
151 | + | |
152 | +DOM.matches = function (element, query) { | |
153 | + if (typeof element.matches !== 'undefined') { | |
154 | + return element.matches(query); | |
155 | + } else { | |
156 | + if (typeof element.matchesSelector !== 'undefined') { | |
157 | + return element.matchesSelector(query); | |
158 | + } else if (typeof element.webkitMatchesSelector !== 'undefined') { | |
159 | + return element.webkitMatchesSelector(query); | |
160 | + } else if (typeof element.mozMatchesSelector !== 'undefined') { | |
161 | + return element.mozMatchesSelector(query); | |
162 | + } else if (typeof element.msMatchesSelector !== 'undefined') { | |
163 | + return element.msMatchesSelector(query); | |
164 | + } | |
165 | + } | |
166 | +}; | |
167 | + | |
168 | +DOM.remove = function (element) { | |
169 | + if (typeof element.remove !== 'undefined') { | |
170 | + element.remove(); | |
171 | + } else { | |
172 | + if (element.parentNode) { | |
173 | + element.parentNode.removeChild(element); | |
174 | + } | |
175 | + } | |
176 | +}; | |
177 | + | |
178 | +DOM.queryChildren = function (element, selector) { | |
179 | + return Array.prototype.filter.call(element.childNodes, function (child) { | |
180 | + return DOM.matches(child, selector); | |
181 | + }); | |
182 | +}; | |
183 | + | |
184 | +module.exports = DOM; | |
185 | + | |
186 | +},{}],4:[function(require,module,exports){ | |
187 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
188 | + * Licensed under the MIT License | |
189 | + */ | |
190 | +'use strict'; | |
191 | + | |
192 | +var EventElement = function (element) { | |
193 | + this.element = element; | |
194 | + this.events = {}; | |
195 | +}; | |
196 | + | |
197 | +EventElement.prototype.bind = function (eventName, handler) { | |
198 | + if (typeof this.events[eventName] === 'undefined') { | |
199 | + this.events[eventName] = []; | |
200 | + } | |
201 | + this.events[eventName].push(handler); | |
202 | + this.element.addEventListener(eventName, handler, false); | |
203 | +}; | |
204 | + | |
205 | +EventElement.prototype.unbind = function (eventName, handler) { | |
206 | + var isHandlerProvided = (typeof handler !== 'undefined'); | |
207 | + this.events[eventName] = this.events[eventName].filter(function (hdlr) { | |
208 | + if (isHandlerProvided && hdlr !== handler) { | |
209 | + return true; | |
210 | + } | |
211 | + this.element.removeEventListener(eventName, hdlr, false); | |
212 | + return false; | |
213 | + }, this); | |
214 | +}; | |
215 | + | |
216 | +EventElement.prototype.unbindAll = function () { | |
217 | + for (var name in this.events) { | |
218 | + this.unbind(name); | |
219 | + } | |
220 | +}; | |
221 | + | |
222 | +var EventManager = function () { | |
223 | + this.eventElements = []; | |
224 | +}; | |
225 | + | |
226 | +EventManager.prototype.eventElement = function (element) { | |
227 | + var ee = this.eventElements.filter(function (eventElement) { | |
228 | + return eventElement.element === element; | |
229 | + })[0]; | |
230 | + if (typeof ee === 'undefined') { | |
231 | + ee = new EventElement(element); | |
232 | + this.eventElements.push(ee); | |
233 | + } | |
234 | + return ee; | |
235 | +}; | |
236 | + | |
237 | +EventManager.prototype.bind = function (element, eventName, handler) { | |
238 | + this.eventElement(element).bind(eventName, handler); | |
239 | +}; | |
240 | + | |
241 | +EventManager.prototype.unbind = function (element, eventName, handler) { | |
242 | + this.eventElement(element).unbind(eventName, handler); | |
243 | +}; | |
244 | + | |
245 | +EventManager.prototype.unbindAll = function () { | |
246 | + for (var i = 0; i < this.eventElements.length; i++) { | |
247 | + this.eventElements[i].unbindAll(); | |
248 | + } | |
249 | +}; | |
250 | + | |
251 | +EventManager.prototype.once = function (element, eventName, handler) { | |
252 | + var ee = this.eventElement(element); | |
253 | + var onceHandler = function (e) { | |
254 | + ee.unbind(eventName, onceHandler); | |
255 | + handler(e); | |
256 | + }; | |
257 | + ee.bind(eventName, onceHandler); | |
258 | +}; | |
259 | + | |
260 | +module.exports = EventManager; | |
261 | + | |
262 | +},{}],5:[function(require,module,exports){ | |
263 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
264 | + * Licensed under the MIT License | |
265 | + */ | |
266 | +'use strict'; | |
267 | + | |
268 | +module.exports = (function () { | |
269 | + function s4() { | |
270 | + return Math.floor((1 + Math.random()) * 0x10000) | |
271 | + .toString(16) | |
272 | + .substring(1); | |
273 | + } | |
274 | + return function () { | |
275 | + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + | |
276 | + s4() + '-' + s4() + s4() + s4(); | |
277 | + }; | |
278 | +})(); | |
279 | + | |
280 | +},{}],6:[function(require,module,exports){ | |
281 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
282 | + * Licensed under the MIT License | |
283 | + */ | |
284 | +'use strict'; | |
285 | + | |
286 | +var cls = require('./class') | |
287 | + , d = require('./dom'); | |
288 | + | |
289 | +exports.toInt = function (x) { | |
290 | + return parseInt(x, 10) || 0; | |
291 | +}; | |
292 | + | |
293 | +exports.clone = function (obj) { | |
294 | + if (obj === null) { | |
295 | + return null; | |
296 | + } else if (typeof obj === 'object') { | |
297 | + var result = {}; | |
298 | + for (var key in obj) { | |
299 | + result[key] = this.clone(obj[key]); | |
300 | + } | |
301 | + return result; | |
302 | + } else { | |
303 | + return obj; | |
304 | + } | |
305 | +}; | |
306 | + | |
307 | +exports.extend = function (original, source) { | |
308 | + var result = this.clone(original); | |
309 | + for (var key in source) { | |
310 | + result[key] = this.clone(source[key]); | |
311 | + } | |
312 | + return result; | |
313 | +}; | |
314 | + | |
315 | +exports.isEditable = function (el) { | |
316 | + return d.matches(el, "input,[contenteditable]") || | |
317 | + d.matches(el, "select,[contenteditable]") || | |
318 | + d.matches(el, "textarea,[contenteditable]") || | |
319 | + d.matches(el, "button,[contenteditable]"); | |
320 | +}; | |
321 | + | |
322 | +exports.removePsClasses = function (element) { | |
323 | + var clsList = cls.list(element); | |
324 | + for (var i = 0; i < clsList.length; i++) { | |
325 | + var className = clsList[i]; | |
326 | + if (className.indexOf('ps-') === 0) { | |
327 | + cls.remove(element, className); | |
328 | + } | |
329 | + } | |
330 | +}; | |
331 | + | |
332 | +exports.outerWidth = function (element) { | |
333 | + return this.toInt(d.css(element, 'width')) + | |
334 | + this.toInt(d.css(element, 'paddingLeft')) + | |
335 | + this.toInt(d.css(element, 'paddingRight')) + | |
336 | + this.toInt(d.css(element, 'borderLeftWidth')) + | |
337 | + this.toInt(d.css(element, 'borderRightWidth')); | |
338 | +}; | |
339 | + | |
340 | +exports.startScrolling = function (element, axis) { | |
341 | + cls.add(element, 'ps-in-scrolling'); | |
342 | + if (typeof axis !== 'undefined') { | |
343 | + cls.add(element, 'ps-' + axis); | |
344 | + } else { | |
345 | + cls.add(element, 'ps-x'); | |
346 | + cls.add(element, 'ps-y'); | |
347 | + } | |
348 | +}; | |
349 | + | |
350 | +exports.stopScrolling = function (element, axis) { | |
351 | + cls.remove(element, 'ps-in-scrolling'); | |
352 | + if (typeof axis !== 'undefined') { | |
353 | + cls.remove(element, 'ps-' + axis); | |
354 | + } else { | |
355 | + cls.remove(element, 'ps-x'); | |
356 | + cls.remove(element, 'ps-y'); | |
357 | + } | |
358 | +}; | |
359 | + | |
360 | +exports.env = { | |
361 | + isWebKit: 'WebkitAppearance' in document.documentElement.style, | |
362 | + supportsTouch: (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch), | |
363 | + supportsIePointer: window.navigator.msMaxTouchPoints !== null | |
364 | +}; | |
365 | + | |
366 | +},{"./class":2,"./dom":3}],7:[function(require,module,exports){ | |
367 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
368 | + * Licensed under the MIT License | |
369 | + */ | |
370 | +'use strict'; | |
371 | + | |
372 | +var destroy = require('./plugin/destroy') | |
373 | + , initialize = require('./plugin/initialize') | |
374 | + , update = require('./plugin/update'); | |
375 | + | |
376 | +module.exports = { | |
377 | + initialize: initialize, | |
378 | + update: update, | |
379 | + destroy: destroy | |
380 | +}; | |
381 | + | |
382 | +},{"./plugin/destroy":9,"./plugin/initialize":17,"./plugin/update":20}],8:[function(require,module,exports){ | |
383 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
384 | + * Licensed under the MIT License | |
385 | + */ | |
386 | +'use strict'; | |
387 | + | |
388 | +module.exports = { | |
389 | + wheelSpeed: 1, | |
390 | + wheelPropagation: false, | |
391 | + swipePropagation: true, | |
392 | + minScrollbarLength: null, | |
393 | + maxScrollbarLength: null, | |
394 | + useBothWheelAxes: false, | |
395 | + useKeyboard: true, | |
396 | + suppressScrollX: false, | |
397 | + suppressScrollY: false, | |
398 | + scrollXMarginOffset: 0, | |
399 | + scrollYMarginOffset: 0, | |
400 | + stopPropagationOnClick: true | |
401 | +}; | |
402 | + | |
403 | +},{}],9:[function(require,module,exports){ | |
404 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
405 | + * Licensed under the MIT License | |
406 | + */ | |
407 | +'use strict'; | |
408 | + | |
409 | +var d = require('../lib/dom') | |
410 | + , h = require('../lib/helper') | |
411 | + , instances = require('./instances'); | |
412 | + | |
413 | +module.exports = function (element) { | |
414 | + var i = instances.get(element); | |
415 | + | |
416 | + if (!i) { | |
417 | + return; | |
418 | + } | |
419 | + | |
420 | + i.event.unbindAll(); | |
421 | + d.remove(i.scrollbarX); | |
422 | + d.remove(i.scrollbarY); | |
423 | + d.remove(i.scrollbarXRail); | |
424 | + d.remove(i.scrollbarYRail); | |
425 | + h.removePsClasses(element); | |
426 | + | |
427 | + instances.remove(element); | |
428 | +}; | |
429 | + | |
430 | +},{"../lib/dom":3,"../lib/helper":6,"./instances":18}],10:[function(require,module,exports){ | |
431 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
432 | + * Licensed under the MIT License | |
433 | + */ | |
434 | +'use strict'; | |
435 | + | |
436 | +var h = require('../../lib/helper') | |
437 | + , instances = require('../instances') | |
438 | + , updateGeometry = require('../update-geometry'); | |
439 | + | |
440 | +function bindClickRailHandler(element, i) { | |
441 | + function pageOffset(el) { | |
442 | + return el.getBoundingClientRect(); | |
443 | + } | |
444 | + var stopPropagation = window.Event.prototype.stopPropagation.bind; | |
445 | + | |
446 | + if (i.settings.stopPropagationOnClick) { | |
447 | + i.event.bind(i.scrollbarY, 'click', stopPropagation); | |
448 | + } | |
449 | + i.event.bind(i.scrollbarYRail, 'click', function (e) { | |
450 | + var halfOfScrollbarLength = h.toInt(i.scrollbarYHeight / 2); | |
451 | + var positionTop = i.railYRatio * (e.pageY - window.scrollY - pageOffset(i.scrollbarYRail).top - halfOfScrollbarLength); | |
452 | + var maxPositionTop = i.railYRatio * (i.railYHeight - i.scrollbarYHeight); | |
453 | + var positionRatio = positionTop / maxPositionTop; | |
454 | + | |
455 | + if (positionRatio < 0) { | |
456 | + positionRatio = 0; | |
457 | + } else if (positionRatio > 1) { | |
458 | + positionRatio = 1; | |
459 | + } | |
460 | + | |
461 | + element.scrollTop = (i.contentHeight - i.containerHeight) * positionRatio; | |
462 | + updateGeometry(element); | |
463 | + | |
464 | + e.stopPropagation(); | |
465 | + }); | |
466 | + | |
467 | + if (i.settings.stopPropagationOnClick) { | |
468 | + i.event.bind(i.scrollbarX, 'click', stopPropagation); | |
469 | + } | |
470 | + i.event.bind(i.scrollbarXRail, 'click', function (e) { | |
471 | + var halfOfScrollbarLength = h.toInt(i.scrollbarXWidth / 2); | |
472 | + var positionLeft = i.railXRatio * (e.pageX - window.scrollX - pageOffset(i.scrollbarXRail).left - halfOfScrollbarLength); | |
473 | + var maxPositionLeft = i.railXRatio * (i.railXWidth - i.scrollbarXWidth); | |
474 | + var positionRatio = positionLeft / maxPositionLeft; | |
475 | + | |
476 | + if (positionRatio < 0) { | |
477 | + positionRatio = 0; | |
478 | + } else if (positionRatio > 1) { | |
479 | + positionRatio = 1; | |
480 | + } | |
481 | + | |
482 | + element.scrollLeft = ((i.contentWidth - i.containerWidth) * positionRatio) - i.negativeScrollAdjustment; | |
483 | + updateGeometry(element); | |
484 | + | |
485 | + e.stopPropagation(); | |
486 | + }); | |
487 | +} | |
488 | + | |
489 | +module.exports = function (element) { | |
490 | + var i = instances.get(element); | |
491 | + bindClickRailHandler(element, i); | |
492 | +}; | |
493 | + | |
494 | +},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],11:[function(require,module,exports){ | |
495 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
496 | + * Licensed under the MIT License | |
497 | + */ | |
498 | +'use strict'; | |
499 | + | |
500 | +var d = require('../../lib/dom') | |
501 | + , h = require('../../lib/helper') | |
502 | + , instances = require('../instances') | |
503 | + , updateGeometry = require('../update-geometry'); | |
504 | + | |
505 | +function bindMouseScrollXHandler(element, i) { | |
506 | + var currentLeft = null; | |
507 | + var currentPageX = null; | |
508 | + | |
509 | + function updateScrollLeft(deltaX) { | |
510 | + var newLeft = currentLeft + (deltaX * i.railXRatio); | |
511 | + var maxLeft = i.scrollbarXRail.getBoundingClientRect().left + (i.railXRatio * (i.railXWidth - i.scrollbarXWidth)); | |
512 | + | |
513 | + if (newLeft < 0) { | |
514 | + i.scrollbarXLeft = 0; | |
515 | + } else if (newLeft > maxLeft) { | |
516 | + i.scrollbarXLeft = maxLeft; | |
517 | + } else { | |
518 | + i.scrollbarXLeft = newLeft; | |
519 | + } | |
520 | + | |
521 | + var scrollLeft = h.toInt(i.scrollbarXLeft * (i.contentWidth - i.containerWidth) / (i.containerWidth - (i.railXRatio * i.scrollbarXWidth))) - i.negativeScrollAdjustment; | |
522 | + element.scrollLeft = scrollLeft; | |
523 | + } | |
524 | + | |
525 | + var mouseMoveHandler = function (e) { | |
526 | + updateScrollLeft(e.pageX - currentPageX); | |
527 | + updateGeometry(element); | |
528 | + e.stopPropagation(); | |
529 | + e.preventDefault(); | |
530 | + }; | |
531 | + | |
532 | + var mouseUpHandler = function () { | |
533 | + h.stopScrolling(element, 'x'); | |
534 | + i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler); | |
535 | + }; | |
536 | + | |
537 | + i.event.bind(i.scrollbarX, 'mousedown', function (e) { | |
538 | + currentPageX = e.pageX; | |
539 | + currentLeft = h.toInt(d.css(i.scrollbarX, 'left')) * i.railXRatio; | |
540 | + h.startScrolling(element, 'x'); | |
541 | + | |
542 | + i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler); | |
543 | + i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler); | |
544 | + | |
545 | + e.stopPropagation(); | |
546 | + e.preventDefault(); | |
547 | + }); | |
548 | +} | |
549 | + | |
550 | +function bindMouseScrollYHandler(element, i) { | |
551 | + var currentTop = null; | |
552 | + var currentPageY = null; | |
553 | + | |
554 | + function updateScrollTop(deltaY) { | |
555 | + var newTop = currentTop + (deltaY * i.railYRatio); | |
556 | + var maxTop = i.scrollbarYRail.getBoundingClientRect().top + (i.railYRatio * (i.railYHeight - i.scrollbarYHeight)); | |
557 | + | |
558 | + if (newTop < 0) { | |
559 | + i.scrollbarYTop = 0; | |
560 | + } else if (newTop > maxTop) { | |
561 | + i.scrollbarYTop = maxTop; | |
562 | + } else { | |
563 | + i.scrollbarYTop = newTop; | |
564 | + } | |
565 | + | |
566 | + var scrollTop = h.toInt(i.scrollbarYTop * (i.contentHeight - i.containerHeight) / (i.containerHeight - (i.railYRatio * i.scrollbarYHeight))); | |
567 | + element.scrollTop = scrollTop; | |
568 | + } | |
569 | + | |
570 | + var mouseMoveHandler = function (e) { | |
571 | + updateScrollTop(e.pageY - currentPageY); | |
572 | + updateGeometry(element); | |
573 | + e.stopPropagation(); | |
574 | + e.preventDefault(); | |
575 | + }; | |
576 | + | |
577 | + var mouseUpHandler = function () { | |
578 | + h.stopScrolling(element, 'y'); | |
579 | + i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler); | |
580 | + }; | |
581 | + | |
582 | + i.event.bind(i.scrollbarY, 'mousedown', function (e) { | |
583 | + currentPageY = e.pageY; | |
584 | + currentTop = h.toInt(d.css(i.scrollbarY, 'top')) * i.railYRatio; | |
585 | + h.startScrolling(element, 'y'); | |
586 | + | |
587 | + i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler); | |
588 | + i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler); | |
589 | + | |
590 | + e.stopPropagation(); | |
591 | + e.preventDefault(); | |
592 | + }); | |
593 | +} | |
594 | + | |
595 | +module.exports = function (element) { | |
596 | + var i = instances.get(element); | |
597 | + bindMouseScrollXHandler(element, i); | |
598 | + bindMouseScrollYHandler(element, i); | |
599 | +}; | |
600 | + | |
601 | +},{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19}],12:[function(require,module,exports){ | |
602 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
603 | + * Licensed under the MIT License | |
604 | + */ | |
605 | +'use strict'; | |
606 | + | |
607 | +var h = require('../../lib/helper') | |
608 | + , instances = require('../instances') | |
609 | + , updateGeometry = require('../update-geometry'); | |
610 | + | |
611 | +function bindKeyboardHandler(element, i) { | |
612 | + var hovered = false; | |
613 | + i.event.bind(element, 'mouseenter', function () { | |
614 | + hovered = true; | |
615 | + }); | |
616 | + i.event.bind(element, 'mouseleave', function () { | |
617 | + hovered = false; | |
618 | + }); | |
619 | + | |
620 | + var shouldPrevent = false; | |
621 | + function shouldPreventDefault(deltaX, deltaY) { | |
622 | + var scrollTop = element.scrollTop; | |
623 | + if (deltaX === 0) { | |
624 | + if (!i.scrollbarYActive) { | |
625 | + return false; | |
626 | + } | |
627 | + if ((scrollTop === 0 && deltaY > 0) || (scrollTop >= i.contentHeight - i.containerHeight && deltaY < 0)) { | |
628 | + return !i.settings.wheelPropagation; | |
629 | + } | |
630 | + } | |
631 | + | |
632 | + var scrollLeft = element.scrollLeft; | |
633 | + if (deltaY === 0) { | |
634 | + if (!i.scrollbarXActive) { | |
635 | + return false; | |
636 | + } | |
637 | + if ((scrollLeft === 0 && deltaX < 0) || (scrollLeft >= i.contentWidth - i.containerWidth && deltaX > 0)) { | |
638 | + return !i.settings.wheelPropagation; | |
639 | + } | |
640 | + } | |
641 | + return true; | |
642 | + } | |
643 | + | |
644 | + i.event.bind(i.ownerDocument, 'keydown', function (e) { | |
645 | + if (e.isDefaultPrevented && e.isDefaultPrevented()) { | |
646 | + return; | |
647 | + } | |
648 | + | |
649 | + if (!hovered) { | |
650 | + return; | |
651 | + } | |
652 | + | |
653 | + var activeElement = document.activeElement ? document.activeElement : i.ownerDocument.activeElement; | |
654 | + if (activeElement) { | |
655 | + // go deeper if element is a webcomponent | |
656 | + while (activeElement.shadowRoot) { | |
657 | + activeElement = activeElement.shadowRoot.activeElement; | |
658 | + } | |
659 | + if (h.isEditable(activeElement)) { | |
660 | + return; | |
661 | + } | |
662 | + } | |
663 | + | |
664 | + var deltaX = 0; | |
665 | + var deltaY = 0; | |
666 | + | |
667 | + switch (e.which) { | |
668 | + case 37: // left | |
669 | + deltaX = -30; | |
670 | + break; | |
671 | + case 38: // up | |
672 | + deltaY = 30; | |
673 | + break; | |
674 | + case 39: // right | |
675 | + deltaX = 30; | |
676 | + break; | |
677 | + case 40: // down | |
678 | + deltaY = -30; | |
679 | + break; | |
680 | + case 33: // page up | |
681 | + deltaY = 90; | |
682 | + break; | |
683 | + case 32: // space bar | |
684 | + if (e.shiftKey) { | |
685 | + deltaY = 90; | |
686 | + } else { | |
687 | + deltaY = -90; | |
688 | + } | |
689 | + break; | |
690 | + case 34: // page down | |
691 | + deltaY = -90; | |
692 | + break; | |
693 | + case 35: // end | |
694 | + if (e.ctrlKey) { | |
695 | + deltaY = -i.contentHeight; | |
696 | + } else { | |
697 | + deltaY = -i.containerHeight; | |
698 | + } | |
699 | + break; | |
700 | + case 36: // home | |
701 | + if (e.ctrlKey) { | |
702 | + deltaY = element.scrollTop; | |
703 | + } else { | |
704 | + deltaY = i.containerHeight; | |
705 | + } | |
706 | + break; | |
707 | + default: | |
708 | + return; | |
709 | + } | |
710 | + | |
711 | + element.scrollTop = element.scrollTop - deltaY; | |
712 | + element.scrollLeft = element.scrollLeft + deltaX; | |
713 | + updateGeometry(element); | |
714 | + | |
715 | + shouldPrevent = shouldPreventDefault(deltaX, deltaY); | |
716 | + if (shouldPrevent) { | |
717 | + e.preventDefault(); | |
718 | + } | |
719 | + }); | |
720 | +} | |
721 | + | |
722 | +module.exports = function (element) { | |
723 | + var i = instances.get(element); | |
724 | + bindKeyboardHandler(element, i); | |
725 | +}; | |
726 | + | |
727 | +},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],13:[function(require,module,exports){ | |
728 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
729 | + * Licensed under the MIT License | |
730 | + */ | |
731 | +'use strict'; | |
732 | + | |
733 | +var h = require('../../lib/helper') | |
734 | + , instances = require('../instances') | |
735 | + , updateGeometry = require('../update-geometry'); | |
736 | + | |
737 | +function bindMouseWheelHandler(element, i) { | |
738 | + var shouldPrevent = false; | |
739 | + | |
740 | + function shouldPreventDefault(deltaX, deltaY) { | |
741 | + var scrollTop = element.scrollTop; | |
742 | + if (deltaX === 0) { | |
743 | + if (!i.scrollbarYActive) { | |
744 | + return false; | |
745 | + } | |
746 | + if ((scrollTop === 0 && deltaY > 0) || (scrollTop >= i.contentHeight - i.containerHeight && deltaY < 0)) { | |
747 | + return !i.settings.wheelPropagation; | |
748 | + } | |
749 | + } | |
750 | + | |
751 | + var scrollLeft = element.scrollLeft; | |
752 | + if (deltaY === 0) { | |
753 | + if (!i.scrollbarXActive) { | |
754 | + return false; | |
755 | + } | |
756 | + if ((scrollLeft === 0 && deltaX < 0) || (scrollLeft >= i.contentWidth - i.containerWidth && deltaX > 0)) { | |
757 | + return !i.settings.wheelPropagation; | |
758 | + } | |
759 | + } | |
760 | + return true; | |
761 | + } | |
762 | + | |
763 | + function getDeltaFromEvent(e) { | |
764 | + var deltaX = e.deltaX; | |
765 | + var deltaY = -1 * e.deltaY; | |
766 | + | |
767 | + if (typeof deltaX === "undefined" || typeof deltaY === "undefined") { | |
768 | + // OS X Safari | |
769 | + deltaX = -1 * e.wheelDeltaX / 6; | |
770 | + deltaY = e.wheelDeltaY / 6; | |
771 | + } | |
772 | + | |
773 | + if (e.deltaMode && e.deltaMode === 1) { | |
774 | + // Firefox in deltaMode 1: Line scrolling | |
775 | + deltaX *= 10; | |
776 | + deltaY *= 10; | |
777 | + } | |
778 | + | |
779 | + if (deltaX !== deltaX && deltaY !== deltaY/* NaN checks */) { | |
780 | + // IE in some mouse drivers | |
781 | + deltaX = 0; | |
782 | + deltaY = e.wheelDelta; | |
783 | + } | |
784 | + | |
785 | + return [deltaX, deltaY]; | |
786 | + } | |
787 | + | |
788 | + function shouldBeConsumedByTextarea(deltaX, deltaY) { | |
789 | + var hoveredTextarea = element.querySelector('textarea:hover'); | |
790 | + if (hoveredTextarea) { | |
791 | + var maxScrollTop = hoveredTextarea.scrollHeight - hoveredTextarea.clientHeight; | |
792 | + if (maxScrollTop > 0) { | |
793 | + if (!(hoveredTextarea.scrollTop === 0 && deltaY > 0) && | |
794 | + !(hoveredTextarea.scrollTop === maxScrollTop && deltaY < 0)) { | |
795 | + return true; | |
796 | + } | |
797 | + } | |
798 | + var maxScrollLeft = hoveredTextarea.scrollLeft - hoveredTextarea.clientWidth; | |
799 | + if (maxScrollLeft > 0) { | |
800 | + if (!(hoveredTextarea.scrollLeft === 0 && deltaX < 0) && | |
801 | + !(hoveredTextarea.scrollLeft === maxScrollLeft && deltaX > 0)) { | |
802 | + return true; | |
803 | + } | |
804 | + } | |
805 | + } | |
806 | + return false; | |
807 | + } | |
808 | + | |
809 | + function mousewheelHandler(e) { | |
810 | + // FIXME: this is a quick fix for the select problem in FF and IE. | |
811 | + // If there comes an effective way to deal with the problem, | |
812 | + // this lines should be removed. | |
813 | + if (!h.env.isWebKit && element.querySelector('select:focus')) { | |
814 | + return; | |
815 | + } | |
816 | + | |
817 | + var delta = getDeltaFromEvent(e); | |
818 | + | |
819 | + var deltaX = delta[0]; | |
820 | + var deltaY = delta[1]; | |
821 | + | |
822 | + if (shouldBeConsumedByTextarea(deltaX, deltaY)) { | |
823 | + return; | |
824 | + } | |
825 | + | |
826 | + shouldPrevent = false; | |
827 | + if (!i.settings.useBothWheelAxes) { | |
828 | + // deltaX will only be used for horizontal scrolling and deltaY will | |
829 | + // only be used for vertical scrolling - this is the default | |
830 | + element.scrollTop = element.scrollTop - (deltaY * i.settings.wheelSpeed); | |
831 | + element.scrollLeft = element.scrollLeft + (deltaX * i.settings.wheelSpeed); | |
832 | + } else if (i.scrollbarYActive && !i.scrollbarXActive) { | |
833 | + // only vertical scrollbar is active and useBothWheelAxes option is | |
834 | + // active, so let's scroll vertical bar using both mouse wheel axes | |
835 | + if (deltaY) { | |
836 | + element.scrollTop = element.scrollTop - (deltaY * i.settings.wheelSpeed); | |
837 | + } else { | |
838 | + element.scrollTop = element.scrollTop + (deltaX * i.settings.wheelSpeed); | |
839 | + } | |
840 | + shouldPrevent = true; | |
841 | + } else if (i.scrollbarXActive && !i.scrollbarYActive) { | |
842 | + // useBothWheelAxes and only horizontal bar is active, so use both | |
843 | + // wheel axes for horizontal bar | |
844 | + if (deltaX) { | |
845 | + element.scrollLeft = element.scrollLeft + (deltaX * i.settings.wheelSpeed); | |
846 | + } else { | |
847 | + element.scrollLeft = element.scrollLeft - (deltaY * i.settings.wheelSpeed); | |
848 | + } | |
849 | + shouldPrevent = true; | |
850 | + } | |
851 | + | |
852 | + updateGeometry(element); | |
853 | + | |
854 | + shouldPrevent = (shouldPrevent || shouldPreventDefault(deltaX, deltaY)); | |
855 | + if (shouldPrevent) { | |
856 | + e.stopPropagation(); | |
857 | + e.preventDefault(); | |
858 | + } | |
859 | + } | |
860 | + | |
861 | + if (typeof window.onwheel !== "undefined") { | |
862 | + i.event.bind(element, 'wheel', mousewheelHandler); | |
863 | + } else if (typeof window.onmousewheel !== "undefined") { | |
864 | + i.event.bind(element, 'mousewheel', mousewheelHandler); | |
865 | + } | |
866 | +} | |
867 | + | |
868 | +module.exports = function (element) { | |
869 | + var i = instances.get(element); | |
870 | + bindMouseWheelHandler(element, i); | |
871 | +}; | |
872 | + | |
873 | +},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],14:[function(require,module,exports){ | |
874 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
875 | + * Licensed under the MIT License | |
876 | + */ | |
877 | +'use strict'; | |
878 | + | |
879 | +var instances = require('../instances') | |
880 | + , updateGeometry = require('../update-geometry'); | |
881 | + | |
882 | +function bindNativeScrollHandler(element, i) { | |
883 | + i.event.bind(element, 'scroll', function () { | |
884 | + updateGeometry(element); | |
885 | + }); | |
886 | +} | |
887 | + | |
888 | +module.exports = function (element) { | |
889 | + var i = instances.get(element); | |
890 | + bindNativeScrollHandler(element, i); | |
891 | +}; | |
892 | + | |
893 | +},{"../instances":18,"../update-geometry":19}],15:[function(require,module,exports){ | |
894 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
895 | + * Licensed under the MIT License | |
896 | + */ | |
897 | +'use strict'; | |
898 | + | |
899 | +var h = require('../../lib/helper') | |
900 | + , instances = require('../instances') | |
901 | + , updateGeometry = require('../update-geometry'); | |
902 | + | |
903 | +function bindSelectionHandler(element, i) { | |
904 | + function getRangeNode() { | |
905 | + var selection = window.getSelection ? window.getSelection() : | |
906 | + document.getSelection ? document.getSelection() : ''; | |
907 | + if (selection.toString().length === 0) { | |
908 | + return null; | |
909 | + } else { | |
910 | + return selection.getRangeAt(0).commonAncestorContainer; | |
911 | + } | |
912 | + } | |
913 | + | |
914 | + var scrollingLoop = null; | |
915 | + var scrollDiff = {top: 0, left: 0}; | |
916 | + function startScrolling() { | |
917 | + if (!scrollingLoop) { | |
918 | + scrollingLoop = setInterval(function () { | |
919 | + if (!instances.get(element)) { | |
920 | + clearInterval(scrollingLoop); | |
921 | + return; | |
922 | + } | |
923 | + | |
924 | + element.scrollTop = element.scrollTop + scrollDiff.top; | |
925 | + element.scrollLeft = element.scrollLeft + scrollDiff.left; | |
926 | + updateGeometry(element); | |
927 | + }, 50); // every .1 sec | |
928 | + } | |
929 | + } | |
930 | + function stopScrolling() { | |
931 | + if (scrollingLoop) { | |
932 | + clearInterval(scrollingLoop); | |
933 | + scrollingLoop = null; | |
934 | + } | |
935 | + h.stopScrolling(element); | |
936 | + } | |
937 | + | |
938 | + var isSelected = false; | |
939 | + i.event.bind(i.ownerDocument, 'selectionchange', function () { | |
940 | + if (element.contains(getRangeNode())) { | |
941 | + isSelected = true; | |
942 | + } else { | |
943 | + isSelected = false; | |
944 | + stopScrolling(); | |
945 | + } | |
946 | + }); | |
947 | + i.event.bind(window, 'mouseup', function () { | |
948 | + if (isSelected) { | |
949 | + isSelected = false; | |
950 | + stopScrolling(); | |
951 | + } | |
952 | + }); | |
953 | + | |
954 | + i.event.bind(window, 'mousemove', function (e) { | |
955 | + if (isSelected) { | |
956 | + var mousePosition = {x: e.pageX, y: e.pageY}; | |
957 | + var containerGeometry = { | |
958 | + left: element.offsetLeft, | |
959 | + right: element.offsetLeft + element.offsetWidth, | |
960 | + top: element.offsetTop, | |
961 | + bottom: element.offsetTop + element.offsetHeight | |
962 | + }; | |
963 | + | |
964 | + if (mousePosition.x < containerGeometry.left + 3) { | |
965 | + scrollDiff.left = -5; | |
966 | + h.startScrolling(element, 'x'); | |
967 | + } else if (mousePosition.x > containerGeometry.right - 3) { | |
968 | + scrollDiff.left = 5; | |
969 | + h.startScrolling(element, 'x'); | |
970 | + } else { | |
971 | + scrollDiff.left = 0; | |
972 | + } | |
973 | + | |
974 | + if (mousePosition.y < containerGeometry.top + 3) { | |
975 | + if (containerGeometry.top + 3 - mousePosition.y < 5) { | |
976 | + scrollDiff.top = -5; | |
977 | + } else { | |
978 | + scrollDiff.top = -20; | |
979 | + } | |
980 | + h.startScrolling(element, 'y'); | |
981 | + } else if (mousePosition.y > containerGeometry.bottom - 3) { | |
982 | + if (mousePosition.y - containerGeometry.bottom + 3 < 5) { | |
983 | + scrollDiff.top = 5; | |
984 | + } else { | |
985 | + scrollDiff.top = 20; | |
986 | + } | |
987 | + h.startScrolling(element, 'y'); | |
988 | + } else { | |
989 | + scrollDiff.top = 0; | |
990 | + } | |
991 | + | |
992 | + if (scrollDiff.top === 0 && scrollDiff.left === 0) { | |
993 | + stopScrolling(); | |
994 | + } else { | |
995 | + startScrolling(); | |
996 | + } | |
997 | + } | |
998 | + }); | |
999 | +} | |
1000 | + | |
1001 | +module.exports = function (element) { | |
1002 | + var i = instances.get(element); | |
1003 | + bindSelectionHandler(element, i); | |
1004 | +}; | |
1005 | + | |
1006 | +},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],16:[function(require,module,exports){ | |
1007 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
1008 | + * Licensed under the MIT License | |
1009 | + */ | |
1010 | +'use strict'; | |
1011 | + | |
1012 | +var instances = require('../instances') | |
1013 | + , updateGeometry = require('../update-geometry'); | |
1014 | + | |
1015 | +function bindTouchHandler(element, i, supportsTouch, supportsIePointer) { | |
1016 | + function shouldPreventDefault(deltaX, deltaY) { | |
1017 | + var scrollTop = element.scrollTop; | |
1018 | + var scrollLeft = element.scrollLeft; | |
1019 | + var magnitudeX = Math.abs(deltaX); | |
1020 | + var magnitudeY = Math.abs(deltaY); | |
1021 | + | |
1022 | + if (magnitudeY > magnitudeX) { | |
1023 | + // user is perhaps trying to swipe up/down the page | |
1024 | + | |
1025 | + if (((deltaY < 0) && (scrollTop === i.contentHeight - i.containerHeight)) || | |
1026 | + ((deltaY > 0) && (scrollTop === 0))) { | |
1027 | + return !i.settings.swipePropagation; | |
1028 | + } | |
1029 | + } else if (magnitudeX > magnitudeY) { | |
1030 | + // user is perhaps trying to swipe left/right across the page | |
1031 | + | |
1032 | + if (((deltaX < 0) && (scrollLeft === i.contentWidth - i.containerWidth)) || | |
1033 | + ((deltaX > 0) && (scrollLeft === 0))) { | |
1034 | + return !i.settings.swipePropagation; | |
1035 | + } | |
1036 | + } | |
1037 | + | |
1038 | + return true; | |
1039 | + } | |
1040 | + | |
1041 | + function applyTouchMove(differenceX, differenceY) { | |
1042 | + element.scrollTop = element.scrollTop - differenceY; | |
1043 | + element.scrollLeft = element.scrollLeft - differenceX; | |
1044 | + | |
1045 | + updateGeometry(element); | |
1046 | + } | |
1047 | + | |
1048 | + var startOffset = {}; | |
1049 | + var startTime = 0; | |
1050 | + var speed = {}; | |
1051 | + var easingLoop = null; | |
1052 | + var inGlobalTouch = false; | |
1053 | + var inLocalTouch = false; | |
1054 | + | |
1055 | + function globalTouchStart() { | |
1056 | + inGlobalTouch = true; | |
1057 | + } | |
1058 | + function globalTouchEnd() { | |
1059 | + inGlobalTouch = false; | |
1060 | + } | |
1061 | + | |
1062 | + function getTouch(e) { | |
1063 | + if (e.targetTouches) { | |
1064 | + return e.targetTouches[0]; | |
1065 | + } else { | |
1066 | + // Maybe IE pointer | |
1067 | + return e; | |
1068 | + } | |
1069 | + } | |
1070 | + function shouldHandle(e) { | |
1071 | + if (e.targetTouches && e.targetTouches.length === 1) { | |
1072 | + return true; | |
1073 | + } | |
1074 | + if (e.pointerType && e.pointerType !== 'mouse' && e.pointerType !== e.MSPOINTER_TYPE_MOUSE) { | |
1075 | + return true; | |
1076 | + } | |
1077 | + return false; | |
1078 | + } | |
1079 | + function touchStart(e) { | |
1080 | + if (shouldHandle(e)) { | |
1081 | + inLocalTouch = true; | |
1082 | + | |
1083 | + var touch = getTouch(e); | |
1084 | + | |
1085 | + startOffset.pageX = touch.pageX; | |
1086 | + startOffset.pageY = touch.pageY; | |
1087 | + | |
1088 | + startTime = (new Date()).getTime(); | |
1089 | + | |
1090 | + if (easingLoop !== null) { | |
1091 | + clearInterval(easingLoop); | |
1092 | + } | |
1093 | + | |
1094 | + e.stopPropagation(); | |
1095 | + } | |
1096 | + } | |
1097 | + function touchMove(e) { | |
1098 | + if (!inGlobalTouch && inLocalTouch && shouldHandle(e)) { | |
1099 | + var touch = getTouch(e); | |
1100 | + | |
1101 | + var currentOffset = {pageX: touch.pageX, pageY: touch.pageY}; | |
1102 | + | |
1103 | + var differenceX = currentOffset.pageX - startOffset.pageX; | |
1104 | + var differenceY = currentOffset.pageY - startOffset.pageY; | |
1105 | + | |
1106 | + applyTouchMove(differenceX, differenceY); | |
1107 | + startOffset = currentOffset; | |
1108 | + | |
1109 | + var currentTime = (new Date()).getTime(); | |
1110 | + | |
1111 | + var timeGap = currentTime - startTime; | |
1112 | + if (timeGap > 0) { | |
1113 | + speed.x = differenceX / timeGap; | |
1114 | + speed.y = differenceY / timeGap; | |
1115 | + startTime = currentTime; | |
1116 | + } | |
1117 | + | |
1118 | + if (shouldPreventDefault(differenceX, differenceY)) { | |
1119 | + e.stopPropagation(); | |
1120 | + e.preventDefault(); | |
1121 | + } | |
1122 | + } | |
1123 | + } | |
1124 | + function touchEnd() { | |
1125 | + if (!inGlobalTouch && inLocalTouch) { | |
1126 | + inLocalTouch = false; | |
1127 | + | |
1128 | + clearInterval(easingLoop); | |
1129 | + easingLoop = setInterval(function () { | |
1130 | + if (!instances.get(element)) { | |
1131 | + clearInterval(easingLoop); | |
1132 | + return; | |
1133 | + } | |
1134 | + | |
1135 | + if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) { | |
1136 | + clearInterval(easingLoop); | |
1137 | + return; | |
1138 | + } | |
1139 | + | |
1140 | + applyTouchMove(speed.x * 30, speed.y * 30); | |
1141 | + | |
1142 | + speed.x *= 0.8; | |
1143 | + speed.y *= 0.8; | |
1144 | + }, 10); | |
1145 | + } | |
1146 | + } | |
1147 | + | |
1148 | + if (supportsTouch) { | |
1149 | + i.event.bind(window, 'touchstart', globalTouchStart); | |
1150 | + i.event.bind(window, 'touchend', globalTouchEnd); | |
1151 | + i.event.bind(element, 'touchstart', touchStart); | |
1152 | + i.event.bind(element, 'touchmove', touchMove); | |
1153 | + i.event.bind(element, 'touchend', touchEnd); | |
1154 | + } | |
1155 | + | |
1156 | + if (supportsIePointer) { | |
1157 | + if (window.PointerEvent) { | |
1158 | + i.event.bind(window, 'pointerdown', globalTouchStart); | |
1159 | + i.event.bind(window, 'pointerup', globalTouchEnd); | |
1160 | + i.event.bind(element, 'pointerdown', touchStart); | |
1161 | + i.event.bind(element, 'pointermove', touchMove); | |
1162 | + i.event.bind(element, 'pointerup', touchEnd); | |
1163 | + } else if (window.MSPointerEvent) { | |
1164 | + i.event.bind(window, 'MSPointerDown', globalTouchStart); | |
1165 | + i.event.bind(window, 'MSPointerUp', globalTouchEnd); | |
1166 | + i.event.bind(element, 'MSPointerDown', touchStart); | |
1167 | + i.event.bind(element, 'MSPointerMove', touchMove); | |
1168 | + i.event.bind(element, 'MSPointerUp', touchEnd); | |
1169 | + } | |
1170 | + } | |
1171 | +} | |
1172 | + | |
1173 | +module.exports = function (element, supportsTouch, supportsIePointer) { | |
1174 | + var i = instances.get(element); | |
1175 | + bindTouchHandler(element, i, supportsTouch, supportsIePointer); | |
1176 | +}; | |
1177 | + | |
1178 | +},{"../instances":18,"../update-geometry":19}],17:[function(require,module,exports){ | |
1179 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
1180 | + * Licensed under the MIT License | |
1181 | + */ | |
1182 | +'use strict'; | |
1183 | + | |
1184 | +var cls = require('../lib/class') | |
1185 | + , h = require('../lib/helper') | |
1186 | + , instances = require('./instances') | |
1187 | + , updateGeometry = require('./update-geometry'); | |
1188 | + | |
1189 | +// Handlers | |
1190 | +var clickRailHandler = require('./handler/click-rail') | |
1191 | + , dragScrollbarHandler = require('./handler/drag-scrollbar') | |
1192 | + , keyboardHandler = require('./handler/keyboard') | |
1193 | + , mouseWheelHandler = require('./handler/mouse-wheel') | |
1194 | + , nativeScrollHandler = require('./handler/native-scroll') | |
1195 | + , selectionHandler = require('./handler/selection') | |
1196 | + , touchHandler = require('./handler/touch'); | |
1197 | + | |
1198 | +module.exports = function (element, userSettings) { | |
1199 | + userSettings = typeof userSettings === 'object' ? userSettings : {}; | |
1200 | + | |
1201 | + cls.add(element, 'ps-container'); | |
1202 | + | |
1203 | + // Create a plugin instance. | |
1204 | + var i = instances.add(element); | |
1205 | + | |
1206 | + i.settings = h.extend(i.settings, userSettings); | |
1207 | + | |
1208 | + clickRailHandler(element); | |
1209 | + dragScrollbarHandler(element); | |
1210 | + mouseWheelHandler(element); | |
1211 | + nativeScrollHandler(element); | |
1212 | + selectionHandler(element); | |
1213 | + | |
1214 | + if (h.env.supportsTouch || h.env.supportsIePointer) { | |
1215 | + touchHandler(element, h.env.supportsTouch, h.env.supportsIePointer); | |
1216 | + } | |
1217 | + if (i.settings.useKeyboard) { | |
1218 | + keyboardHandler(element); | |
1219 | + } | |
1220 | + | |
1221 | + updateGeometry(element); | |
1222 | +}; | |
1223 | + | |
1224 | +},{"../lib/class":2,"../lib/helper":6,"./handler/click-rail":10,"./handler/drag-scrollbar":11,"./handler/keyboard":12,"./handler/mouse-wheel":13,"./handler/native-scroll":14,"./handler/selection":15,"./handler/touch":16,"./instances":18,"./update-geometry":19}],18:[function(require,module,exports){ | |
1225 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
1226 | + * Licensed under the MIT License | |
1227 | + */ | |
1228 | +'use strict'; | |
1229 | + | |
1230 | +var d = require('../lib/dom') | |
1231 | + , defaultSettings = require('./default-setting') | |
1232 | + , EventManager = require('../lib/event-manager') | |
1233 | + , guid = require('../lib/guid') | |
1234 | + , h = require('../lib/helper'); | |
1235 | + | |
1236 | +var instances = {}; | |
1237 | + | |
1238 | +function Instance(element) { | |
1239 | + var i = this; | |
1240 | + | |
1241 | + i.settings = h.clone(defaultSettings); | |
1242 | + i.containerWidth = null; | |
1243 | + i.containerHeight = null; | |
1244 | + i.contentWidth = null; | |
1245 | + i.contentHeight = null; | |
1246 | + | |
1247 | + i.isRtl = d.css(element, 'direction') === "rtl"; | |
1248 | + i.isNegativeScroll = (function () { | |
1249 | + var originalScrollLeft = element.scrollLeft; | |
1250 | + var result = null; | |
1251 | + element.scrollLeft = -1; | |
1252 | + result = element.scrollLeft < 0; | |
1253 | + element.scrollLeft = originalScrollLeft; | |
1254 | + return result; | |
1255 | + })(); | |
1256 | + i.negativeScrollAdjustment = i.isNegativeScroll ? element.scrollWidth - element.clientWidth : 0; | |
1257 | + i.event = new EventManager(); | |
1258 | + i.ownerDocument = element.ownerDocument || document; | |
1259 | + | |
1260 | + i.scrollbarXRail = d.appendTo(d.e('div', 'ps-scrollbar-x-rail'), element); | |
1261 | + i.scrollbarX = d.appendTo(d.e('div', 'ps-scrollbar-x'), i.scrollbarXRail); | |
1262 | + i.scrollbarXActive = null; | |
1263 | + i.scrollbarXWidth = null; | |
1264 | + i.scrollbarXLeft = null; | |
1265 | + i.scrollbarXBottom = h.toInt(d.css(i.scrollbarXRail, 'bottom')); | |
1266 | + i.isScrollbarXUsingBottom = i.scrollbarXBottom === i.scrollbarXBottom; // !isNaN | |
1267 | + i.scrollbarXTop = i.isScrollbarXUsingBottom ? null : h.toInt(d.css(i.scrollbarXRail, 'top')); | |
1268 | + i.railBorderXWidth = h.toInt(d.css(i.scrollbarXRail, 'borderLeftWidth')) + h.toInt(d.css(i.scrollbarXRail, 'borderRightWidth')); | |
1269 | + // Set rail to display:block to calculate margins | |
1270 | + d.css(i.scrollbarXRail, 'display', 'block'); | |
1271 | + i.railXMarginWidth = h.toInt(d.css(i.scrollbarXRail, 'marginLeft')) + h.toInt(d.css(i.scrollbarXRail, 'marginRight')); | |
1272 | + d.css(i.scrollbarXRail, 'display', ''); | |
1273 | + i.railXWidth = null; | |
1274 | + i.railXRatio = null; | |
1275 | + | |
1276 | + i.scrollbarYRail = d.appendTo(d.e('div', 'ps-scrollbar-y-rail'), element); | |
1277 | + i.scrollbarY = d.appendTo(d.e('div', 'ps-scrollbar-y'), i.scrollbarYRail); | |
1278 | + i.scrollbarYActive = null; | |
1279 | + i.scrollbarYHeight = null; | |
1280 | + i.scrollbarYTop = null; | |
1281 | + i.scrollbarYRight = h.toInt(d.css(i.scrollbarYRail, 'right')); | |
1282 | + i.isScrollbarYUsingRight = i.scrollbarYRight === i.scrollbarYRight; // !isNaN | |
1283 | + i.scrollbarYLeft = i.isScrollbarYUsingRight ? null : h.toInt(d.css(i.scrollbarYRail, 'left')); | |
1284 | + i.scrollbarYOuterWidth = i.isRtl ? h.outerWidth(i.scrollbarY) : null; | |
1285 | + i.railBorderYWidth = h.toInt(d.css(i.scrollbarYRail, 'borderTopWidth')) + h.toInt(d.css(i.scrollbarYRail, 'borderBottomWidth')); | |
1286 | + d.css(i.scrollbarYRail, 'display', 'block'); | |
1287 | + i.railYMarginHeight = h.toInt(d.css(i.scrollbarYRail, 'marginTop')) + h.toInt(d.css(i.scrollbarYRail, 'marginBottom')); | |
1288 | + d.css(i.scrollbarYRail, 'display', ''); | |
1289 | + i.railYHeight = null; | |
1290 | + i.railYRatio = null; | |
1291 | +} | |
1292 | + | |
1293 | +function getId(element) { | |
1294 | + if (typeof element.dataset === 'undefined') { | |
1295 | + return element.getAttribute('data-ps-id'); | |
1296 | + } else { | |
1297 | + return element.dataset.psId; | |
1298 | + } | |
1299 | +} | |
1300 | + | |
1301 | +function setId(element, id) { | |
1302 | + if (typeof element.dataset === 'undefined') { | |
1303 | + element.setAttribute('data-ps-id', id); | |
1304 | + } else { | |
1305 | + element.dataset.psId = id; | |
1306 | + } | |
1307 | +} | |
1308 | + | |
1309 | +function removeId(element) { | |
1310 | + if (typeof element.dataset === 'undefined') { | |
1311 | + element.removeAttribute('data-ps-id'); | |
1312 | + } else { | |
1313 | + delete element.dataset.psId; | |
1314 | + } | |
1315 | +} | |
1316 | + | |
1317 | +exports.add = function (element) { | |
1318 | + var newId = guid(); | |
1319 | + setId(element, newId); | |
1320 | + instances[newId] = new Instance(element); | |
1321 | + return instances[newId]; | |
1322 | +}; | |
1323 | + | |
1324 | +exports.remove = function (element) { | |
1325 | + delete instances[getId(element)]; | |
1326 | + removeId(element); | |
1327 | +}; | |
1328 | + | |
1329 | +exports.get = function (element) { | |
1330 | + return instances[getId(element)]; | |
1331 | +}; | |
1332 | + | |
1333 | +},{"../lib/dom":3,"../lib/event-manager":4,"../lib/guid":5,"../lib/helper":6,"./default-setting":8}],19:[function(require,module,exports){ | |
1334 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
1335 | + * Licensed under the MIT License | |
1336 | + */ | |
1337 | +'use strict'; | |
1338 | + | |
1339 | +var cls = require('../lib/class') | |
1340 | + , d = require('../lib/dom') | |
1341 | + , h = require('../lib/helper') | |
1342 | + , instances = require('./instances'); | |
1343 | + | |
1344 | +function getThumbSize(i, thumbSize) { | |
1345 | + if (i.settings.minScrollbarLength) { | |
1346 | + thumbSize = Math.max(thumbSize, i.settings.minScrollbarLength); | |
1347 | + } | |
1348 | + if (i.settings.maxScrollbarLength) { | |
1349 | + thumbSize = Math.min(thumbSize, i.settings.maxScrollbarLength); | |
1350 | + } | |
1351 | + return thumbSize; | |
1352 | +} | |
1353 | + | |
1354 | +function updateCss(element, i) { | |
1355 | + var xRailOffset = {width: i.railXWidth}; | |
1356 | + if (i.isRtl) { | |
1357 | + xRailOffset.left = i.negativeScrollAdjustment + element.scrollLeft + i.containerWidth - i.contentWidth; | |
1358 | + } else { | |
1359 | + xRailOffset.left = element.scrollLeft; | |
1360 | + } | |
1361 | + if (i.isScrollbarXUsingBottom) { | |
1362 | + xRailOffset.bottom = i.scrollbarXBottom - element.scrollTop; | |
1363 | + } else { | |
1364 | + xRailOffset.top = i.scrollbarXTop + element.scrollTop; | |
1365 | + } | |
1366 | + d.css(i.scrollbarXRail, xRailOffset); | |
1367 | + | |
1368 | + var yRailOffset = {top: element.scrollTop, height: i.railYHeight}; | |
1369 | + if (i.isScrollbarYUsingRight) { | |
1370 | + if (i.isRtl) { | |
1371 | + yRailOffset.right = i.contentWidth - (i.negativeScrollAdjustment + element.scrollLeft) - i.scrollbarYRight - i.scrollbarYOuterWidth; | |
1372 | + } else { | |
1373 | + yRailOffset.right = i.scrollbarYRight - element.scrollLeft; | |
1374 | + } | |
1375 | + } else { | |
1376 | + if (i.isRtl) { | |
1377 | + yRailOffset.left = i.negativeScrollAdjustment + element.scrollLeft + i.containerWidth * 2 - i.contentWidth - i.scrollbarYLeft - i.scrollbarYOuterWidth; | |
1378 | + } else { | |
1379 | + yRailOffset.left = i.scrollbarYLeft + element.scrollLeft; | |
1380 | + } | |
1381 | + } | |
1382 | + d.css(i.scrollbarYRail, yRailOffset); | |
1383 | + | |
1384 | + d.css(i.scrollbarX, {left: i.scrollbarXLeft, width: i.scrollbarXWidth - i.railBorderXWidth}); | |
1385 | + d.css(i.scrollbarY, {top: i.scrollbarYTop, height: i.scrollbarYHeight - i.railBorderYWidth}); | |
1386 | +} | |
1387 | + | |
1388 | +module.exports = function (element) { | |
1389 | + var i = instances.get(element); | |
1390 | + | |
1391 | + i.containerWidth = element.clientWidth; | |
1392 | + i.containerHeight = element.clientHeight; | |
1393 | + i.contentWidth = element.scrollWidth; | |
1394 | + i.contentHeight = element.scrollHeight; | |
1395 | + | |
1396 | + var existingRails; | |
1397 | + if (!element.contains(i.scrollbarXRail)) { | |
1398 | + existingRails = d.queryChildren(element, '.ps-scrollbar-x-rail'); | |
1399 | + if (existingRails.length > 0) { | |
1400 | + existingRails.forEach(function (rail) { | |
1401 | + d.remove(rail); | |
1402 | + }); | |
1403 | + } | |
1404 | + d.appendTo(i.scrollbarXRail, element); | |
1405 | + } | |
1406 | + if (!element.contains(i.scrollbarYRail)) { | |
1407 | + existingRails = d.queryChildren(element, '.ps-scrollbar-y-rail'); | |
1408 | + if (existingRails.length > 0) { | |
1409 | + existingRails.forEach(function (rail) { | |
1410 | + d.remove(rail); | |
1411 | + }); | |
1412 | + } | |
1413 | + d.appendTo(i.scrollbarYRail, element); | |
1414 | + } | |
1415 | + | |
1416 | + if (!i.settings.suppressScrollX && i.containerWidth + i.settings.scrollXMarginOffset < i.contentWidth) { | |
1417 | + i.scrollbarXActive = true; | |
1418 | + i.railXWidth = i.containerWidth - i.railXMarginWidth; | |
1419 | + i.railXRatio = i.containerWidth / i.railXWidth; | |
1420 | + i.scrollbarXWidth = getThumbSize(i, h.toInt(i.railXWidth * i.containerWidth / i.contentWidth)); | |
1421 | + i.scrollbarXLeft = h.toInt((i.negativeScrollAdjustment + element.scrollLeft) * (i.railXWidth - i.scrollbarXWidth) / (i.contentWidth - i.containerWidth)); | |
1422 | + } else { | |
1423 | + i.scrollbarXActive = false; | |
1424 | + i.scrollbarXWidth = 0; | |
1425 | + i.scrollbarXLeft = 0; | |
1426 | + element.scrollLeft = 0; | |
1427 | + } | |
1428 | + | |
1429 | + if (!i.settings.suppressScrollY && i.containerHeight + i.settings.scrollYMarginOffset < i.contentHeight) { | |
1430 | + i.scrollbarYActive = true; | |
1431 | + i.railYHeight = i.containerHeight - i.railYMarginHeight; | |
1432 | + i.railYRatio = i.containerHeight / i.railYHeight; | |
1433 | + i.scrollbarYHeight = getThumbSize(i, h.toInt(i.railYHeight * i.containerHeight / i.contentHeight)); | |
1434 | + i.scrollbarYTop = h.toInt(element.scrollTop * (i.railYHeight - i.scrollbarYHeight) / (i.contentHeight - i.containerHeight)); | |
1435 | + } else { | |
1436 | + i.scrollbarYActive = false; | |
1437 | + i.scrollbarYHeight = 0; | |
1438 | + i.scrollbarYTop = 0; | |
1439 | + element.scrollTop = 0; | |
1440 | + } | |
1441 | + | |
1442 | + if (i.scrollbarXLeft >= i.railXWidth - i.scrollbarXWidth) { | |
1443 | + i.scrollbarXLeft = i.railXWidth - i.scrollbarXWidth; | |
1444 | + } | |
1445 | + if (i.scrollbarYTop >= i.railYHeight - i.scrollbarYHeight) { | |
1446 | + i.scrollbarYTop = i.railYHeight - i.scrollbarYHeight; | |
1447 | + } | |
1448 | + | |
1449 | + updateCss(element, i); | |
1450 | + | |
1451 | + cls[i.scrollbarXActive ? 'add' : 'remove'](element, 'ps-active-x'); | |
1452 | + cls[i.scrollbarYActive ? 'add' : 'remove'](element, 'ps-active-y'); | |
1453 | +}; | |
1454 | + | |
1455 | +},{"../lib/class":2,"../lib/dom":3,"../lib/helper":6,"./instances":18}],20:[function(require,module,exports){ | |
1456 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
1457 | + * Licensed under the MIT License | |
1458 | + */ | |
1459 | +'use strict'; | |
1460 | + | |
1461 | +var d = require('../lib/dom') | |
1462 | + , h = require('../lib/helper') | |
1463 | + , instances = require('./instances') | |
1464 | + , updateGeometry = require('./update-geometry'); | |
1465 | + | |
1466 | +module.exports = function (element) { | |
1467 | + var i = instances.get(element); | |
1468 | + | |
1469 | + if (!i) { | |
1470 | + return; | |
1471 | + } | |
1472 | + | |
1473 | + // Recalcuate negative scrollLeft adjustment | |
1474 | + i.negativeScrollAdjustment = i.isNegativeScroll ? element.scrollWidth - element.clientWidth : 0; | |
1475 | + | |
1476 | + // Recalculate rail margins | |
1477 | + d.css(i.scrollbarXRail, 'display', 'block'); | |
1478 | + d.css(i.scrollbarYRail, 'display', 'block'); | |
1479 | + i.railXMarginWidth = h.toInt(d.css(i.scrollbarXRail, 'marginLeft')) + h.toInt(d.css(i.scrollbarXRail, 'marginRight')); | |
1480 | + i.railYMarginHeight = h.toInt(d.css(i.scrollbarYRail, 'marginTop')) + h.toInt(d.css(i.scrollbarYRail, 'marginBottom')); | |
1481 | + | |
1482 | + // Hide scrollbars not to affect scrollWidth and scrollHeight | |
1483 | + d.css(i.scrollbarXRail, 'display', 'none'); | |
1484 | + d.css(i.scrollbarYRail, 'display', 'none'); | |
1485 | + | |
1486 | + updateGeometry(element); | |
1487 | + | |
1488 | + d.css(i.scrollbarXRail, 'display', ''); | |
1489 | + d.css(i.scrollbarYRail, 'display', ''); | |
1490 | +}; | |
1491 | + | |
1492 | +},{"../lib/dom":3,"../lib/helper":6,"./instances":18,"./update-geometry":19}]},{},[1]); | ... | ... |
controllets/shared_js/perfect-scrollbar/js/perfect-scrollbar.js
0 โ 100644
1 | +/* perfect-scrollbar v0.6.5 */ | |
2 | +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | |
3 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
4 | + * Licensed under the MIT License | |
5 | + */ | |
6 | +'use strict'; | |
7 | + | |
8 | +var ps = require('../main'); | |
9 | + | |
10 | +if (typeof define === 'function' && define.amd) { | |
11 | + // AMD | |
12 | + define(ps); | |
13 | +} else { | |
14 | + // Add to a global object. | |
15 | + window.PerfectScrollbar = ps; | |
16 | + if (typeof window.Ps === 'undefined') { | |
17 | + window.Ps = ps; | |
18 | + } | |
19 | +} | |
20 | + | |
21 | +},{"../main":7}],2:[function(require,module,exports){ | |
22 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
23 | + * Licensed under the MIT License | |
24 | + */ | |
25 | +'use strict'; | |
26 | + | |
27 | +function oldAdd(element, className) { | |
28 | + var classes = element.className.split(' '); | |
29 | + if (classes.indexOf(className) < 0) { | |
30 | + classes.push(className); | |
31 | + } | |
32 | + element.className = classes.join(' '); | |
33 | +} | |
34 | + | |
35 | +function oldRemove(element, className) { | |
36 | + var classes = element.className.split(' '); | |
37 | + var idx = classes.indexOf(className); | |
38 | + if (idx >= 0) { | |
39 | + classes.splice(idx, 1); | |
40 | + } | |
41 | + element.className = classes.join(' '); | |
42 | +} | |
43 | + | |
44 | +exports.add = function (element, className) { | |
45 | + if (element.classList) { | |
46 | + element.classList.add(className); | |
47 | + } else { | |
48 | + oldAdd(element, className); | |
49 | + } | |
50 | +}; | |
51 | + | |
52 | +exports.remove = function (element, className) { | |
53 | + if (element.classList) { | |
54 | + element.classList.remove(className); | |
55 | + } else { | |
56 | + oldRemove(element, className); | |
57 | + } | |
58 | +}; | |
59 | + | |
60 | +exports.list = function (element) { | |
61 | + if (element.classList) { | |
62 | + return element.classList; | |
63 | + } else { | |
64 | + return element.className.split(' '); | |
65 | + } | |
66 | +}; | |
67 | + | |
68 | +},{}],3:[function(require,module,exports){ | |
69 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
70 | + * Licensed under the MIT License | |
71 | + */ | |
72 | +'use strict'; | |
73 | + | |
74 | +var DOM = {}; | |
75 | + | |
76 | +DOM.e = function (tagName, className) { | |
77 | + var element = document.createElement(tagName); | |
78 | + element.className = className; | |
79 | + return element; | |
80 | +}; | |
81 | + | |
82 | +DOM.appendTo = function (child, parent) { | |
83 | + parent.appendChild(child); | |
84 | + return child; | |
85 | +}; | |
86 | + | |
87 | +function cssGet(element, styleName) { | |
88 | + return window.getComputedStyle(element)[styleName]; | |
89 | +} | |
90 | + | |
91 | +function cssSet(element, styleName, styleValue) { | |
92 | + if (typeof styleValue === 'number') { | |
93 | + styleValue = styleValue.toString() + 'px'; | |
94 | + } | |
95 | + element.style[styleName] = styleValue; | |
96 | + return element; | |
97 | +} | |
98 | + | |
99 | +function cssMultiSet(element, obj) { | |
100 | + for (var key in obj) { | |
101 | + var val = obj[key]; | |
102 | + if (typeof val === 'number') { | |
103 | + val = val.toString() + 'px'; | |
104 | + } | |
105 | + element.style[key] = val; | |
106 | + } | |
107 | + return element; | |
108 | +} | |
109 | + | |
110 | +DOM.css = function (element, styleNameOrObject, styleValue) { | |
111 | + if (typeof styleNameOrObject === 'object') { | |
112 | + // multiple set with object | |
113 | + return cssMultiSet(element, styleNameOrObject); | |
114 | + } else { | |
115 | + if (typeof styleValue === 'undefined') { | |
116 | + return cssGet(element, styleNameOrObject); | |
117 | + } else { | |
118 | + return cssSet(element, styleNameOrObject, styleValue); | |
119 | + } | |
120 | + } | |
121 | +}; | |
122 | + | |
123 | +DOM.matches = function (element, query) { | |
124 | + if (typeof element.matches !== 'undefined') { | |
125 | + return element.matches(query); | |
126 | + } else { | |
127 | + if (typeof element.matchesSelector !== 'undefined') { | |
128 | + return element.matchesSelector(query); | |
129 | + } else if (typeof element.webkitMatchesSelector !== 'undefined') { | |
130 | + return element.webkitMatchesSelector(query); | |
131 | + } else if (typeof element.mozMatchesSelector !== 'undefined') { | |
132 | + return element.mozMatchesSelector(query); | |
133 | + } else if (typeof element.msMatchesSelector !== 'undefined') { | |
134 | + return element.msMatchesSelector(query); | |
135 | + } | |
136 | + } | |
137 | +}; | |
138 | + | |
139 | +DOM.remove = function (element) { | |
140 | + if (typeof element.remove !== 'undefined') { | |
141 | + element.remove(); | |
142 | + } else { | |
143 | + if (element.parentNode) { | |
144 | + element.parentNode.removeChild(element); | |
145 | + } | |
146 | + } | |
147 | +}; | |
148 | + | |
149 | +DOM.queryChildren = function (element, selector) { | |
150 | + return Array.prototype.filter.call(element.childNodes, function (child) { | |
151 | + return DOM.matches(child, selector); | |
152 | + }); | |
153 | +}; | |
154 | + | |
155 | +module.exports = DOM; | |
156 | + | |
157 | +},{}],4:[function(require,module,exports){ | |
158 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
159 | + * Licensed under the MIT License | |
160 | + */ | |
161 | +'use strict'; | |
162 | + | |
163 | +var EventElement = function (element) { | |
164 | + this.element = element; | |
165 | + this.events = {}; | |
166 | +}; | |
167 | + | |
168 | +EventElement.prototype.bind = function (eventName, handler) { | |
169 | + if (typeof this.events[eventName] === 'undefined') { | |
170 | + this.events[eventName] = []; | |
171 | + } | |
172 | + this.events[eventName].push(handler); | |
173 | + this.element.addEventListener(eventName, handler, false); | |
174 | +}; | |
175 | + | |
176 | +EventElement.prototype.unbind = function (eventName, handler) { | |
177 | + var isHandlerProvided = (typeof handler !== 'undefined'); | |
178 | + this.events[eventName] = this.events[eventName].filter(function (hdlr) { | |
179 | + if (isHandlerProvided && hdlr !== handler) { | |
180 | + return true; | |
181 | + } | |
182 | + this.element.removeEventListener(eventName, hdlr, false); | |
183 | + return false; | |
184 | + }, this); | |
185 | +}; | |
186 | + | |
187 | +EventElement.prototype.unbindAll = function () { | |
188 | + for (var name in this.events) { | |
189 | + this.unbind(name); | |
190 | + } | |
191 | +}; | |
192 | + | |
193 | +var EventManager = function () { | |
194 | + this.eventElements = []; | |
195 | +}; | |
196 | + | |
197 | +EventManager.prototype.eventElement = function (element) { | |
198 | + var ee = this.eventElements.filter(function (eventElement) { | |
199 | + return eventElement.element === element; | |
200 | + })[0]; | |
201 | + if (typeof ee === 'undefined') { | |
202 | + ee = new EventElement(element); | |
203 | + this.eventElements.push(ee); | |
204 | + } | |
205 | + return ee; | |
206 | +}; | |
207 | + | |
208 | +EventManager.prototype.bind = function (element, eventName, handler) { | |
209 | + this.eventElement(element).bind(eventName, handler); | |
210 | +}; | |
211 | + | |
212 | +EventManager.prototype.unbind = function (element, eventName, handler) { | |
213 | + this.eventElement(element).unbind(eventName, handler); | |
214 | +}; | |
215 | + | |
216 | +EventManager.prototype.unbindAll = function () { | |
217 | + for (var i = 0; i < this.eventElements.length; i++) { | |
218 | + this.eventElements[i].unbindAll(); | |
219 | + } | |
220 | +}; | |
221 | + | |
222 | +EventManager.prototype.once = function (element, eventName, handler) { | |
223 | + var ee = this.eventElement(element); | |
224 | + var onceHandler = function (e) { | |
225 | + ee.unbind(eventName, onceHandler); | |
226 | + handler(e); | |
227 | + }; | |
228 | + ee.bind(eventName, onceHandler); | |
229 | +}; | |
230 | + | |
231 | +module.exports = EventManager; | |
232 | + | |
233 | +},{}],5:[function(require,module,exports){ | |
234 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
235 | + * Licensed under the MIT License | |
236 | + */ | |
237 | +'use strict'; | |
238 | + | |
239 | +module.exports = (function () { | |
240 | + function s4() { | |
241 | + return Math.floor((1 + Math.random()) * 0x10000) | |
242 | + .toString(16) | |
243 | + .substring(1); | |
244 | + } | |
245 | + return function () { | |
246 | + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + | |
247 | + s4() + '-' + s4() + s4() + s4(); | |
248 | + }; | |
249 | +})(); | |
250 | + | |
251 | +},{}],6:[function(require,module,exports){ | |
252 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
253 | + * Licensed under the MIT License | |
254 | + */ | |
255 | +'use strict'; | |
256 | + | |
257 | +var cls = require('./class') | |
258 | + , d = require('./dom'); | |
259 | + | |
260 | +exports.toInt = function (x) { | |
261 | + return parseInt(x, 10) || 0; | |
262 | +}; | |
263 | + | |
264 | +exports.clone = function (obj) { | |
265 | + if (obj === null) { | |
266 | + return null; | |
267 | + } else if (typeof obj === 'object') { | |
268 | + var result = {}; | |
269 | + for (var key in obj) { | |
270 | + result[key] = this.clone(obj[key]); | |
271 | + } | |
272 | + return result; | |
273 | + } else { | |
274 | + return obj; | |
275 | + } | |
276 | +}; | |
277 | + | |
278 | +exports.extend = function (original, source) { | |
279 | + var result = this.clone(original); | |
280 | + for (var key in source) { | |
281 | + result[key] = this.clone(source[key]); | |
282 | + } | |
283 | + return result; | |
284 | +}; | |
285 | + | |
286 | +exports.isEditable = function (el) { | |
287 | + return d.matches(el, "input,[contenteditable]") || | |
288 | + d.matches(el, "select,[contenteditable]") || | |
289 | + d.matches(el, "textarea,[contenteditable]") || | |
290 | + d.matches(el, "button,[contenteditable]"); | |
291 | +}; | |
292 | + | |
293 | +exports.removePsClasses = function (element) { | |
294 | + var clsList = cls.list(element); | |
295 | + for (var i = 0; i < clsList.length; i++) { | |
296 | + var className = clsList[i]; | |
297 | + if (className.indexOf('ps-') === 0) { | |
298 | + cls.remove(element, className); | |
299 | + } | |
300 | + } | |
301 | +}; | |
302 | + | |
303 | +exports.outerWidth = function (element) { | |
304 | + return this.toInt(d.css(element, 'width')) + | |
305 | + this.toInt(d.css(element, 'paddingLeft')) + | |
306 | + this.toInt(d.css(element, 'paddingRight')) + | |
307 | + this.toInt(d.css(element, 'borderLeftWidth')) + | |
308 | + this.toInt(d.css(element, 'borderRightWidth')); | |
309 | +}; | |
310 | + | |
311 | +exports.startScrolling = function (element, axis) { | |
312 | + cls.add(element, 'ps-in-scrolling'); | |
313 | + if (typeof axis !== 'undefined') { | |
314 | + cls.add(element, 'ps-' + axis); | |
315 | + } else { | |
316 | + cls.add(element, 'ps-x'); | |
317 | + cls.add(element, 'ps-y'); | |
318 | + } | |
319 | +}; | |
320 | + | |
321 | +exports.stopScrolling = function (element, axis) { | |
322 | + cls.remove(element, 'ps-in-scrolling'); | |
323 | + if (typeof axis !== 'undefined') { | |
324 | + cls.remove(element, 'ps-' + axis); | |
325 | + } else { | |
326 | + cls.remove(element, 'ps-x'); | |
327 | + cls.remove(element, 'ps-y'); | |
328 | + } | |
329 | +}; | |
330 | + | |
331 | +exports.env = { | |
332 | + isWebKit: 'WebkitAppearance' in document.documentElement.style, | |
333 | + supportsTouch: (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch), | |
334 | + supportsIePointer: window.navigator.msMaxTouchPoints !== null | |
335 | +}; | |
336 | + | |
337 | +},{"./class":2,"./dom":3}],7:[function(require,module,exports){ | |
338 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
339 | + * Licensed under the MIT License | |
340 | + */ | |
341 | +'use strict'; | |
342 | + | |
343 | +var destroy = require('./plugin/destroy') | |
344 | + , initialize = require('./plugin/initialize') | |
345 | + , update = require('./plugin/update'); | |
346 | + | |
347 | +module.exports = { | |
348 | + initialize: initialize, | |
349 | + update: update, | |
350 | + destroy: destroy | |
351 | +}; | |
352 | + | |
353 | +},{"./plugin/destroy":9,"./plugin/initialize":17,"./plugin/update":20}],8:[function(require,module,exports){ | |
354 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
355 | + * Licensed under the MIT License | |
356 | + */ | |
357 | +'use strict'; | |
358 | + | |
359 | +module.exports = { | |
360 | + wheelSpeed: 1, | |
361 | + wheelPropagation: false, | |
362 | + swipePropagation: true, | |
363 | + minScrollbarLength: null, | |
364 | + maxScrollbarLength: null, | |
365 | + useBothWheelAxes: false, | |
366 | + useKeyboard: true, | |
367 | + suppressScrollX: false, | |
368 | + suppressScrollY: false, | |
369 | + scrollXMarginOffset: 0, | |
370 | + scrollYMarginOffset: 0, | |
371 | + stopPropagationOnClick: true | |
372 | +}; | |
373 | + | |
374 | +},{}],9:[function(require,module,exports){ | |
375 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
376 | + * Licensed under the MIT License | |
377 | + */ | |
378 | +'use strict'; | |
379 | + | |
380 | +var d = require('../lib/dom') | |
381 | + , h = require('../lib/helper') | |
382 | + , instances = require('./instances'); | |
383 | + | |
384 | +module.exports = function (element) { | |
385 | + var i = instances.get(element); | |
386 | + | |
387 | + if (!i) { | |
388 | + return; | |
389 | + } | |
390 | + | |
391 | + i.event.unbindAll(); | |
392 | + d.remove(i.scrollbarX); | |
393 | + d.remove(i.scrollbarY); | |
394 | + d.remove(i.scrollbarXRail); | |
395 | + d.remove(i.scrollbarYRail); | |
396 | + h.removePsClasses(element); | |
397 | + | |
398 | + instances.remove(element); | |
399 | +}; | |
400 | + | |
401 | +},{"../lib/dom":3,"../lib/helper":6,"./instances":18}],10:[function(require,module,exports){ | |
402 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
403 | + * Licensed under the MIT License | |
404 | + */ | |
405 | +'use strict'; | |
406 | + | |
407 | +var h = require('../../lib/helper') | |
408 | + , instances = require('../instances') | |
409 | + , updateGeometry = require('../update-geometry'); | |
410 | + | |
411 | +function bindClickRailHandler(element, i) { | |
412 | + function pageOffset(el) { | |
413 | + return el.getBoundingClientRect(); | |
414 | + } | |
415 | + var stopPropagation = window.Event.prototype.stopPropagation.bind; | |
416 | + | |
417 | + if (i.settings.stopPropagationOnClick) { | |
418 | + i.event.bind(i.scrollbarY, 'click', stopPropagation); | |
419 | + } | |
420 | + i.event.bind(i.scrollbarYRail, 'click', function (e) { | |
421 | + var halfOfScrollbarLength = h.toInt(i.scrollbarYHeight / 2); | |
422 | + var positionTop = i.railYRatio * (e.pageY - window.scrollY - pageOffset(i.scrollbarYRail).top - halfOfScrollbarLength); | |
423 | + var maxPositionTop = i.railYRatio * (i.railYHeight - i.scrollbarYHeight); | |
424 | + var positionRatio = positionTop / maxPositionTop; | |
425 | + | |
426 | + if (positionRatio < 0) { | |
427 | + positionRatio = 0; | |
428 | + } else if (positionRatio > 1) { | |
429 | + positionRatio = 1; | |
430 | + } | |
431 | + | |
432 | + element.scrollTop = (i.contentHeight - i.containerHeight) * positionRatio; | |
433 | + updateGeometry(element); | |
434 | + | |
435 | + e.stopPropagation(); | |
436 | + }); | |
437 | + | |
438 | + if (i.settings.stopPropagationOnClick) { | |
439 | + i.event.bind(i.scrollbarX, 'click', stopPropagation); | |
440 | + } | |
441 | + i.event.bind(i.scrollbarXRail, 'click', function (e) { | |
442 | + var halfOfScrollbarLength = h.toInt(i.scrollbarXWidth / 2); | |
443 | + var positionLeft = i.railXRatio * (e.pageX - window.scrollX - pageOffset(i.scrollbarXRail).left - halfOfScrollbarLength); | |
444 | + var maxPositionLeft = i.railXRatio * (i.railXWidth - i.scrollbarXWidth); | |
445 | + var positionRatio = positionLeft / maxPositionLeft; | |
446 | + | |
447 | + if (positionRatio < 0) { | |
448 | + positionRatio = 0; | |
449 | + } else if (positionRatio > 1) { | |
450 | + positionRatio = 1; | |
451 | + } | |
452 | + | |
453 | + element.scrollLeft = ((i.contentWidth - i.containerWidth) * positionRatio) - i.negativeScrollAdjustment; | |
454 | + updateGeometry(element); | |
455 | + | |
456 | + e.stopPropagation(); | |
457 | + }); | |
458 | +} | |
459 | + | |
460 | +module.exports = function (element) { | |
461 | + var i = instances.get(element); | |
462 | + bindClickRailHandler(element, i); | |
463 | +}; | |
464 | + | |
465 | +},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],11:[function(require,module,exports){ | |
466 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
467 | + * Licensed under the MIT License | |
468 | + */ | |
469 | +'use strict'; | |
470 | + | |
471 | +var d = require('../../lib/dom') | |
472 | + , h = require('../../lib/helper') | |
473 | + , instances = require('../instances') | |
474 | + , updateGeometry = require('../update-geometry'); | |
475 | + | |
476 | +function bindMouseScrollXHandler(element, i) { | |
477 | + var currentLeft = null; | |
478 | + var currentPageX = null; | |
479 | + | |
480 | + function updateScrollLeft(deltaX) { | |
481 | + var newLeft = currentLeft + (deltaX * i.railXRatio); | |
482 | + var maxLeft = i.scrollbarXRail.getBoundingClientRect().left + (i.railXRatio * (i.railXWidth - i.scrollbarXWidth)); | |
483 | + | |
484 | + if (newLeft < 0) { | |
485 | + i.scrollbarXLeft = 0; | |
486 | + } else if (newLeft > maxLeft) { | |
487 | + i.scrollbarXLeft = maxLeft; | |
488 | + } else { | |
489 | + i.scrollbarXLeft = newLeft; | |
490 | + } | |
491 | + | |
492 | + var scrollLeft = h.toInt(i.scrollbarXLeft * (i.contentWidth - i.containerWidth) / (i.containerWidth - (i.railXRatio * i.scrollbarXWidth))) - i.negativeScrollAdjustment; | |
493 | + element.scrollLeft = scrollLeft; | |
494 | + } | |
495 | + | |
496 | + var mouseMoveHandler = function (e) { | |
497 | + updateScrollLeft(e.pageX - currentPageX); | |
498 | + updateGeometry(element); | |
499 | + e.stopPropagation(); | |
500 | + e.preventDefault(); | |
501 | + }; | |
502 | + | |
503 | + var mouseUpHandler = function () { | |
504 | + h.stopScrolling(element, 'x'); | |
505 | + i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler); | |
506 | + }; | |
507 | + | |
508 | + i.event.bind(i.scrollbarX, 'mousedown', function (e) { | |
509 | + currentPageX = e.pageX; | |
510 | + currentLeft = h.toInt(d.css(i.scrollbarX, 'left')) * i.railXRatio; | |
511 | + h.startScrolling(element, 'x'); | |
512 | + | |
513 | + i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler); | |
514 | + i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler); | |
515 | + | |
516 | + e.stopPropagation(); | |
517 | + e.preventDefault(); | |
518 | + }); | |
519 | +} | |
520 | + | |
521 | +function bindMouseScrollYHandler(element, i) { | |
522 | + var currentTop = null; | |
523 | + var currentPageY = null; | |
524 | + | |
525 | + function updateScrollTop(deltaY) { | |
526 | + var newTop = currentTop + (deltaY * i.railYRatio); | |
527 | + var maxTop = i.scrollbarYRail.getBoundingClientRect().top + (i.railYRatio * (i.railYHeight - i.scrollbarYHeight)); | |
528 | + | |
529 | + if (newTop < 0) { | |
530 | + i.scrollbarYTop = 0; | |
531 | + } else if (newTop > maxTop) { | |
532 | + i.scrollbarYTop = maxTop; | |
533 | + } else { | |
534 | + i.scrollbarYTop = newTop; | |
535 | + } | |
536 | + | |
537 | + var scrollTop = h.toInt(i.scrollbarYTop * (i.contentHeight - i.containerHeight) / (i.containerHeight - (i.railYRatio * i.scrollbarYHeight))); | |
538 | + element.scrollTop = scrollTop; | |
539 | + } | |
540 | + | |
541 | + var mouseMoveHandler = function (e) { | |
542 | + updateScrollTop(e.pageY - currentPageY); | |
543 | + updateGeometry(element); | |
544 | + e.stopPropagation(); | |
545 | + e.preventDefault(); | |
546 | + }; | |
547 | + | |
548 | + var mouseUpHandler = function () { | |
549 | + h.stopScrolling(element, 'y'); | |
550 | + i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler); | |
551 | + }; | |
552 | + | |
553 | + i.event.bind(i.scrollbarY, 'mousedown', function (e) { | |
554 | + currentPageY = e.pageY; | |
555 | + currentTop = h.toInt(d.css(i.scrollbarY, 'top')) * i.railYRatio; | |
556 | + h.startScrolling(element, 'y'); | |
557 | + | |
558 | + i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler); | |
559 | + i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler); | |
560 | + | |
561 | + e.stopPropagation(); | |
562 | + e.preventDefault(); | |
563 | + }); | |
564 | +} | |
565 | + | |
566 | +module.exports = function (element) { | |
567 | + var i = instances.get(element); | |
568 | + bindMouseScrollXHandler(element, i); | |
569 | + bindMouseScrollYHandler(element, i); | |
570 | +}; | |
571 | + | |
572 | +},{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19}],12:[function(require,module,exports){ | |
573 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
574 | + * Licensed under the MIT License | |
575 | + */ | |
576 | +'use strict'; | |
577 | + | |
578 | +var h = require('../../lib/helper') | |
579 | + , instances = require('../instances') | |
580 | + , updateGeometry = require('../update-geometry'); | |
581 | + | |
582 | +function bindKeyboardHandler(element, i) { | |
583 | + var hovered = false; | |
584 | + i.event.bind(element, 'mouseenter', function () { | |
585 | + hovered = true; | |
586 | + }); | |
587 | + i.event.bind(element, 'mouseleave', function () { | |
588 | + hovered = false; | |
589 | + }); | |
590 | + | |
591 | + var shouldPrevent = false; | |
592 | + function shouldPreventDefault(deltaX, deltaY) { | |
593 | + var scrollTop = element.scrollTop; | |
594 | + if (deltaX === 0) { | |
595 | + if (!i.scrollbarYActive) { | |
596 | + return false; | |
597 | + } | |
598 | + if ((scrollTop === 0 && deltaY > 0) || (scrollTop >= i.contentHeight - i.containerHeight && deltaY < 0)) { | |
599 | + return !i.settings.wheelPropagation; | |
600 | + } | |
601 | + } | |
602 | + | |
603 | + var scrollLeft = element.scrollLeft; | |
604 | + if (deltaY === 0) { | |
605 | + if (!i.scrollbarXActive) { | |
606 | + return false; | |
607 | + } | |
608 | + if ((scrollLeft === 0 && deltaX < 0) || (scrollLeft >= i.contentWidth - i.containerWidth && deltaX > 0)) { | |
609 | + return !i.settings.wheelPropagation; | |
610 | + } | |
611 | + } | |
612 | + return true; | |
613 | + } | |
614 | + | |
615 | + i.event.bind(i.ownerDocument, 'keydown', function (e) { | |
616 | + if (e.isDefaultPrevented && e.isDefaultPrevented()) { | |
617 | + return; | |
618 | + } | |
619 | + | |
620 | + if (!hovered) { | |
621 | + return; | |
622 | + } | |
623 | + | |
624 | + var activeElement = document.activeElement ? document.activeElement : i.ownerDocument.activeElement; | |
625 | + if (activeElement) { | |
626 | + // go deeper if element is a webcomponent | |
627 | + while (activeElement.shadowRoot) { | |
628 | + activeElement = activeElement.shadowRoot.activeElement; | |
629 | + } | |
630 | + if (h.isEditable(activeElement)) { | |
631 | + return; | |
632 | + } | |
633 | + } | |
634 | + | |
635 | + var deltaX = 0; | |
636 | + var deltaY = 0; | |
637 | + | |
638 | + switch (e.which) { | |
639 | + case 37: // left | |
640 | + deltaX = -30; | |
641 | + break; | |
642 | + case 38: // up | |
643 | + deltaY = 30; | |
644 | + break; | |
645 | + case 39: // right | |
646 | + deltaX = 30; | |
647 | + break; | |
648 | + case 40: // down | |
649 | + deltaY = -30; | |
650 | + break; | |
651 | + case 33: // page up | |
652 | + deltaY = 90; | |
653 | + break; | |
654 | + case 32: // space bar | |
655 | + if (e.shiftKey) { | |
656 | + deltaY = 90; | |
657 | + } else { | |
658 | + deltaY = -90; | |
659 | + } | |
660 | + break; | |
661 | + case 34: // page down | |
662 | + deltaY = -90; | |
663 | + break; | |
664 | + case 35: // end | |
665 | + if (e.ctrlKey) { | |
666 | + deltaY = -i.contentHeight; | |
667 | + } else { | |
668 | + deltaY = -i.containerHeight; | |
669 | + } | |
670 | + break; | |
671 | + case 36: // home | |
672 | + if (e.ctrlKey) { | |
673 | + deltaY = element.scrollTop; | |
674 | + } else { | |
675 | + deltaY = i.containerHeight; | |
676 | + } | |
677 | + break; | |
678 | + default: | |
679 | + return; | |
680 | + } | |
681 | + | |
682 | + element.scrollTop = element.scrollTop - deltaY; | |
683 | + element.scrollLeft = element.scrollLeft + deltaX; | |
684 | + updateGeometry(element); | |
685 | + | |
686 | + shouldPrevent = shouldPreventDefault(deltaX, deltaY); | |
687 | + if (shouldPrevent) { | |
688 | + e.preventDefault(); | |
689 | + } | |
690 | + }); | |
691 | +} | |
692 | + | |
693 | +module.exports = function (element) { | |
694 | + var i = instances.get(element); | |
695 | + bindKeyboardHandler(element, i); | |
696 | +}; | |
697 | + | |
698 | +},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],13:[function(require,module,exports){ | |
699 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
700 | + * Licensed under the MIT License | |
701 | + */ | |
702 | +'use strict'; | |
703 | + | |
704 | +var h = require('../../lib/helper') | |
705 | + , instances = require('../instances') | |
706 | + , updateGeometry = require('../update-geometry'); | |
707 | + | |
708 | +function bindMouseWheelHandler(element, i) { | |
709 | + var shouldPrevent = false; | |
710 | + | |
711 | + function shouldPreventDefault(deltaX, deltaY) { | |
712 | + var scrollTop = element.scrollTop; | |
713 | + if (deltaX === 0) { | |
714 | + if (!i.scrollbarYActive) { | |
715 | + return false; | |
716 | + } | |
717 | + if ((scrollTop === 0 && deltaY > 0) || (scrollTop >= i.contentHeight - i.containerHeight && deltaY < 0)) { | |
718 | + return !i.settings.wheelPropagation; | |
719 | + } | |
720 | + } | |
721 | + | |
722 | + var scrollLeft = element.scrollLeft; | |
723 | + if (deltaY === 0) { | |
724 | + if (!i.scrollbarXActive) { | |
725 | + return false; | |
726 | + } | |
727 | + if ((scrollLeft === 0 && deltaX < 0) || (scrollLeft >= i.contentWidth - i.containerWidth && deltaX > 0)) { | |
728 | + return !i.settings.wheelPropagation; | |
729 | + } | |
730 | + } | |
731 | + return true; | |
732 | + } | |
733 | + | |
734 | + function getDeltaFromEvent(e) { | |
735 | + var deltaX = e.deltaX; | |
736 | + var deltaY = -1 * e.deltaY; | |
737 | + | |
738 | + if (typeof deltaX === "undefined" || typeof deltaY === "undefined") { | |
739 | + // OS X Safari | |
740 | + deltaX = -1 * e.wheelDeltaX / 6; | |
741 | + deltaY = e.wheelDeltaY / 6; | |
742 | + } | |
743 | + | |
744 | + if (e.deltaMode && e.deltaMode === 1) { | |
745 | + // Firefox in deltaMode 1: Line scrolling | |
746 | + deltaX *= 10; | |
747 | + deltaY *= 10; | |
748 | + } | |
749 | + | |
750 | + if (deltaX !== deltaX && deltaY !== deltaY/* NaN checks */) { | |
751 | + // IE in some mouse drivers | |
752 | + deltaX = 0; | |
753 | + deltaY = e.wheelDelta; | |
754 | + } | |
755 | + | |
756 | + return [deltaX, deltaY]; | |
757 | + } | |
758 | + | |
759 | + function shouldBeConsumedByTextarea(deltaX, deltaY) { | |
760 | + var hoveredTextarea = element.querySelector('textarea:hover'); | |
761 | + if (hoveredTextarea) { | |
762 | + var maxScrollTop = hoveredTextarea.scrollHeight - hoveredTextarea.clientHeight; | |
763 | + if (maxScrollTop > 0) { | |
764 | + if (!(hoveredTextarea.scrollTop === 0 && deltaY > 0) && | |
765 | + !(hoveredTextarea.scrollTop === maxScrollTop && deltaY < 0)) { | |
766 | + return true; | |
767 | + } | |
768 | + } | |
769 | + var maxScrollLeft = hoveredTextarea.scrollLeft - hoveredTextarea.clientWidth; | |
770 | + if (maxScrollLeft > 0) { | |
771 | + if (!(hoveredTextarea.scrollLeft === 0 && deltaX < 0) && | |
772 | + !(hoveredTextarea.scrollLeft === maxScrollLeft && deltaX > 0)) { | |
773 | + return true; | |
774 | + } | |
775 | + } | |
776 | + } | |
777 | + return false; | |
778 | + } | |
779 | + | |
780 | + function mousewheelHandler(e) { | |
781 | + // FIXME: this is a quick fix for the select problem in FF and IE. | |
782 | + // If there comes an effective way to deal with the problem, | |
783 | + // this lines should be removed. | |
784 | + if (!h.env.isWebKit && element.querySelector('select:focus')) { | |
785 | + return; | |
786 | + } | |
787 | + | |
788 | + var delta = getDeltaFromEvent(e); | |
789 | + | |
790 | + var deltaX = delta[0]; | |
791 | + var deltaY = delta[1]; | |
792 | + | |
793 | + if (shouldBeConsumedByTextarea(deltaX, deltaY)) { | |
794 | + return; | |
795 | + } | |
796 | + | |
797 | + shouldPrevent = false; | |
798 | + if (!i.settings.useBothWheelAxes) { | |
799 | + // deltaX will only be used for horizontal scrolling and deltaY will | |
800 | + // only be used for vertical scrolling - this is the default | |
801 | + element.scrollTop = element.scrollTop - (deltaY * i.settings.wheelSpeed); | |
802 | + element.scrollLeft = element.scrollLeft + (deltaX * i.settings.wheelSpeed); | |
803 | + } else if (i.scrollbarYActive && !i.scrollbarXActive) { | |
804 | + // only vertical scrollbar is active and useBothWheelAxes option is | |
805 | + // active, so let's scroll vertical bar using both mouse wheel axes | |
806 | + if (deltaY) { | |
807 | + element.scrollTop = element.scrollTop - (deltaY * i.settings.wheelSpeed); | |
808 | + } else { | |
809 | + element.scrollTop = element.scrollTop + (deltaX * i.settings.wheelSpeed); | |
810 | + } | |
811 | + shouldPrevent = true; | |
812 | + } else if (i.scrollbarXActive && !i.scrollbarYActive) { | |
813 | + // useBothWheelAxes and only horizontal bar is active, so use both | |
814 | + // wheel axes for horizontal bar | |
815 | + if (deltaX) { | |
816 | + element.scrollLeft = element.scrollLeft + (deltaX * i.settings.wheelSpeed); | |
817 | + } else { | |
818 | + element.scrollLeft = element.scrollLeft - (deltaY * i.settings.wheelSpeed); | |
819 | + } | |
820 | + shouldPrevent = true; | |
821 | + } | |
822 | + | |
823 | + updateGeometry(element); | |
824 | + | |
825 | + shouldPrevent = (shouldPrevent || shouldPreventDefault(deltaX, deltaY)); | |
826 | + if (shouldPrevent) { | |
827 | + e.stopPropagation(); | |
828 | + e.preventDefault(); | |
829 | + } | |
830 | + } | |
831 | + | |
832 | + if (typeof window.onwheel !== "undefined") { | |
833 | + i.event.bind(element, 'wheel', mousewheelHandler); | |
834 | + } else if (typeof window.onmousewheel !== "undefined") { | |
835 | + i.event.bind(element, 'mousewheel', mousewheelHandler); | |
836 | + } | |
837 | +} | |
838 | + | |
839 | +module.exports = function (element) { | |
840 | + var i = instances.get(element); | |
841 | + bindMouseWheelHandler(element, i); | |
842 | +}; | |
843 | + | |
844 | +},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],14:[function(require,module,exports){ | |
845 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
846 | + * Licensed under the MIT License | |
847 | + */ | |
848 | +'use strict'; | |
849 | + | |
850 | +var instances = require('../instances') | |
851 | + , updateGeometry = require('../update-geometry'); | |
852 | + | |
853 | +function bindNativeScrollHandler(element, i) { | |
854 | + i.event.bind(element, 'scroll', function () { | |
855 | + updateGeometry(element); | |
856 | + }); | |
857 | +} | |
858 | + | |
859 | +module.exports = function (element) { | |
860 | + var i = instances.get(element); | |
861 | + bindNativeScrollHandler(element, i); | |
862 | +}; | |
863 | + | |
864 | +},{"../instances":18,"../update-geometry":19}],15:[function(require,module,exports){ | |
865 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
866 | + * Licensed under the MIT License | |
867 | + */ | |
868 | +'use strict'; | |
869 | + | |
870 | +var h = require('../../lib/helper') | |
871 | + , instances = require('../instances') | |
872 | + , updateGeometry = require('../update-geometry'); | |
873 | + | |
874 | +function bindSelectionHandler(element, i) { | |
875 | + function getRangeNode() { | |
876 | + var selection = window.getSelection ? window.getSelection() : | |
877 | + document.getSelection ? document.getSelection() : ''; | |
878 | + if (selection.toString().length === 0) { | |
879 | + return null; | |
880 | + } else { | |
881 | + return selection.getRangeAt(0).commonAncestorContainer; | |
882 | + } | |
883 | + } | |
884 | + | |
885 | + var scrollingLoop = null; | |
886 | + var scrollDiff = {top: 0, left: 0}; | |
887 | + function startScrolling() { | |
888 | + if (!scrollingLoop) { | |
889 | + scrollingLoop = setInterval(function () { | |
890 | + if (!instances.get(element)) { | |
891 | + clearInterval(scrollingLoop); | |
892 | + return; | |
893 | + } | |
894 | + | |
895 | + element.scrollTop = element.scrollTop + scrollDiff.top; | |
896 | + element.scrollLeft = element.scrollLeft + scrollDiff.left; | |
897 | + updateGeometry(element); | |
898 | + }, 50); // every .1 sec | |
899 | + } | |
900 | + } | |
901 | + function stopScrolling() { | |
902 | + if (scrollingLoop) { | |
903 | + clearInterval(scrollingLoop); | |
904 | + scrollingLoop = null; | |
905 | + } | |
906 | + h.stopScrolling(element); | |
907 | + } | |
908 | + | |
909 | + var isSelected = false; | |
910 | + i.event.bind(i.ownerDocument, 'selectionchange', function () { | |
911 | + if (element.contains(getRangeNode())) { | |
912 | + isSelected = true; | |
913 | + } else { | |
914 | + isSelected = false; | |
915 | + stopScrolling(); | |
916 | + } | |
917 | + }); | |
918 | + i.event.bind(window, 'mouseup', function () { | |
919 | + if (isSelected) { | |
920 | + isSelected = false; | |
921 | + stopScrolling(); | |
922 | + } | |
923 | + }); | |
924 | + | |
925 | + i.event.bind(window, 'mousemove', function (e) { | |
926 | + if (isSelected) { | |
927 | + var mousePosition = {x: e.pageX, y: e.pageY}; | |
928 | + var containerGeometry = { | |
929 | + left: element.offsetLeft, | |
930 | + right: element.offsetLeft + element.offsetWidth, | |
931 | + top: element.offsetTop, | |
932 | + bottom: element.offsetTop + element.offsetHeight | |
933 | + }; | |
934 | + | |
935 | + if (mousePosition.x < containerGeometry.left + 3) { | |
936 | + scrollDiff.left = -5; | |
937 | + h.startScrolling(element, 'x'); | |
938 | + } else if (mousePosition.x > containerGeometry.right - 3) { | |
939 | + scrollDiff.left = 5; | |
940 | + h.startScrolling(element, 'x'); | |
941 | + } else { | |
942 | + scrollDiff.left = 0; | |
943 | + } | |
944 | + | |
945 | + if (mousePosition.y < containerGeometry.top + 3) { | |
946 | + if (containerGeometry.top + 3 - mousePosition.y < 5) { | |
947 | + scrollDiff.top = -5; | |
948 | + } else { | |
949 | + scrollDiff.top = -20; | |
950 | + } | |
951 | + h.startScrolling(element, 'y'); | |
952 | + } else if (mousePosition.y > containerGeometry.bottom - 3) { | |
953 | + if (mousePosition.y - containerGeometry.bottom + 3 < 5) { | |
954 | + scrollDiff.top = 5; | |
955 | + } else { | |
956 | + scrollDiff.top = 20; | |
957 | + } | |
958 | + h.startScrolling(element, 'y'); | |
959 | + } else { | |
960 | + scrollDiff.top = 0; | |
961 | + } | |
962 | + | |
963 | + if (scrollDiff.top === 0 && scrollDiff.left === 0) { | |
964 | + stopScrolling(); | |
965 | + } else { | |
966 | + startScrolling(); | |
967 | + } | |
968 | + } | |
969 | + }); | |
970 | +} | |
971 | + | |
972 | +module.exports = function (element) { | |
973 | + var i = instances.get(element); | |
974 | + bindSelectionHandler(element, i); | |
975 | +}; | |
976 | + | |
977 | +},{"../../lib/helper":6,"../instances":18,"../update-geometry":19}],16:[function(require,module,exports){ | |
978 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
979 | + * Licensed under the MIT License | |
980 | + */ | |
981 | +'use strict'; | |
982 | + | |
983 | +var instances = require('../instances') | |
984 | + , updateGeometry = require('../update-geometry'); | |
985 | + | |
986 | +function bindTouchHandler(element, i, supportsTouch, supportsIePointer) { | |
987 | + function shouldPreventDefault(deltaX, deltaY) { | |
988 | + var scrollTop = element.scrollTop; | |
989 | + var scrollLeft = element.scrollLeft; | |
990 | + var magnitudeX = Math.abs(deltaX); | |
991 | + var magnitudeY = Math.abs(deltaY); | |
992 | + | |
993 | + if (magnitudeY > magnitudeX) { | |
994 | + // user is perhaps trying to swipe up/down the page | |
995 | + | |
996 | + if (((deltaY < 0) && (scrollTop === i.contentHeight - i.containerHeight)) || | |
997 | + ((deltaY > 0) && (scrollTop === 0))) { | |
998 | + return !i.settings.swipePropagation; | |
999 | + } | |
1000 | + } else if (magnitudeX > magnitudeY) { | |
1001 | + // user is perhaps trying to swipe left/right across the page | |
1002 | + | |
1003 | + if (((deltaX < 0) && (scrollLeft === i.contentWidth - i.containerWidth)) || | |
1004 | + ((deltaX > 0) && (scrollLeft === 0))) { | |
1005 | + return !i.settings.swipePropagation; | |
1006 | + } | |
1007 | + } | |
1008 | + | |
1009 | + return true; | |
1010 | + } | |
1011 | + | |
1012 | + function applyTouchMove(differenceX, differenceY) { | |
1013 | + element.scrollTop = element.scrollTop - differenceY; | |
1014 | + element.scrollLeft = element.scrollLeft - differenceX; | |
1015 | + | |
1016 | + updateGeometry(element); | |
1017 | + } | |
1018 | + | |
1019 | + var startOffset = {}; | |
1020 | + var startTime = 0; | |
1021 | + var speed = {}; | |
1022 | + var easingLoop = null; | |
1023 | + var inGlobalTouch = false; | |
1024 | + var inLocalTouch = false; | |
1025 | + | |
1026 | + function globalTouchStart() { | |
1027 | + inGlobalTouch = true; | |
1028 | + } | |
1029 | + function globalTouchEnd() { | |
1030 | + inGlobalTouch = false; | |
1031 | + } | |
1032 | + | |
1033 | + function getTouch(e) { | |
1034 | + if (e.targetTouches) { | |
1035 | + return e.targetTouches[0]; | |
1036 | + } else { | |
1037 | + // Maybe IE pointer | |
1038 | + return e; | |
1039 | + } | |
1040 | + } | |
1041 | + function shouldHandle(e) { | |
1042 | + if (e.targetTouches && e.targetTouches.length === 1) { | |
1043 | + return true; | |
1044 | + } | |
1045 | + if (e.pointerType && e.pointerType !== 'mouse' && e.pointerType !== e.MSPOINTER_TYPE_MOUSE) { | |
1046 | + return true; | |
1047 | + } | |
1048 | + return false; | |
1049 | + } | |
1050 | + function touchStart(e) { | |
1051 | + if (shouldHandle(e)) { | |
1052 | + inLocalTouch = true; | |
1053 | + | |
1054 | + var touch = getTouch(e); | |
1055 | + | |
1056 | + startOffset.pageX = touch.pageX; | |
1057 | + startOffset.pageY = touch.pageY; | |
1058 | + | |
1059 | + startTime = (new Date()).getTime(); | |
1060 | + | |
1061 | + if (easingLoop !== null) { | |
1062 | + clearInterval(easingLoop); | |
1063 | + } | |
1064 | + | |
1065 | + e.stopPropagation(); | |
1066 | + } | |
1067 | + } | |
1068 | + function touchMove(e) { | |
1069 | + if (!inGlobalTouch && inLocalTouch && shouldHandle(e)) { | |
1070 | + var touch = getTouch(e); | |
1071 | + | |
1072 | + var currentOffset = {pageX: touch.pageX, pageY: touch.pageY}; | |
1073 | + | |
1074 | + var differenceX = currentOffset.pageX - startOffset.pageX; | |
1075 | + var differenceY = currentOffset.pageY - startOffset.pageY; | |
1076 | + | |
1077 | + applyTouchMove(differenceX, differenceY); | |
1078 | + startOffset = currentOffset; | |
1079 | + | |
1080 | + var currentTime = (new Date()).getTime(); | |
1081 | + | |
1082 | + var timeGap = currentTime - startTime; | |
1083 | + if (timeGap > 0) { | |
1084 | + speed.x = differenceX / timeGap; | |
1085 | + speed.y = differenceY / timeGap; | |
1086 | + startTime = currentTime; | |
1087 | + } | |
1088 | + | |
1089 | + if (shouldPreventDefault(differenceX, differenceY)) { | |
1090 | + e.stopPropagation(); | |
1091 | + e.preventDefault(); | |
1092 | + } | |
1093 | + } | |
1094 | + } | |
1095 | + function touchEnd() { | |
1096 | + if (!inGlobalTouch && inLocalTouch) { | |
1097 | + inLocalTouch = false; | |
1098 | + | |
1099 | + clearInterval(easingLoop); | |
1100 | + easingLoop = setInterval(function () { | |
1101 | + if (!instances.get(element)) { | |
1102 | + clearInterval(easingLoop); | |
1103 | + return; | |
1104 | + } | |
1105 | + | |
1106 | + if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) { | |
1107 | + clearInterval(easingLoop); | |
1108 | + return; | |
1109 | + } | |
1110 | + | |
1111 | + applyTouchMove(speed.x * 30, speed.y * 30); | |
1112 | + | |
1113 | + speed.x *= 0.8; | |
1114 | + speed.y *= 0.8; | |
1115 | + }, 10); | |
1116 | + } | |
1117 | + } | |
1118 | + | |
1119 | + if (supportsTouch) { | |
1120 | + i.event.bind(window, 'touchstart', globalTouchStart); | |
1121 | + i.event.bind(window, 'touchend', globalTouchEnd); | |
1122 | + i.event.bind(element, 'touchstart', touchStart); | |
1123 | + i.event.bind(element, 'touchmove', touchMove); | |
1124 | + i.event.bind(element, 'touchend', touchEnd); | |
1125 | + } | |
1126 | + | |
1127 | + if (supportsIePointer) { | |
1128 | + if (window.PointerEvent) { | |
1129 | + i.event.bind(window, 'pointerdown', globalTouchStart); | |
1130 | + i.event.bind(window, 'pointerup', globalTouchEnd); | |
1131 | + i.event.bind(element, 'pointerdown', touchStart); | |
1132 | + i.event.bind(element, 'pointermove', touchMove); | |
1133 | + i.event.bind(element, 'pointerup', touchEnd); | |
1134 | + } else if (window.MSPointerEvent) { | |
1135 | + i.event.bind(window, 'MSPointerDown', globalTouchStart); | |
1136 | + i.event.bind(window, 'MSPointerUp', globalTouchEnd); | |
1137 | + i.event.bind(element, 'MSPointerDown', touchStart); | |
1138 | + i.event.bind(element, 'MSPointerMove', touchMove); | |
1139 | + i.event.bind(element, 'MSPointerUp', touchEnd); | |
1140 | + } | |
1141 | + } | |
1142 | +} | |
1143 | + | |
1144 | +module.exports = function (element, supportsTouch, supportsIePointer) { | |
1145 | + var i = instances.get(element); | |
1146 | + bindTouchHandler(element, i, supportsTouch, supportsIePointer); | |
1147 | +}; | |
1148 | + | |
1149 | +},{"../instances":18,"../update-geometry":19}],17:[function(require,module,exports){ | |
1150 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
1151 | + * Licensed under the MIT License | |
1152 | + */ | |
1153 | +'use strict'; | |
1154 | + | |
1155 | +var cls = require('../lib/class') | |
1156 | + , h = require('../lib/helper') | |
1157 | + , instances = require('./instances') | |
1158 | + , updateGeometry = require('./update-geometry'); | |
1159 | + | |
1160 | +// Handlers | |
1161 | +var clickRailHandler = require('./handler/click-rail') | |
1162 | + , dragScrollbarHandler = require('./handler/drag-scrollbar') | |
1163 | + , keyboardHandler = require('./handler/keyboard') | |
1164 | + , mouseWheelHandler = require('./handler/mouse-wheel') | |
1165 | + , nativeScrollHandler = require('./handler/native-scroll') | |
1166 | + , selectionHandler = require('./handler/selection') | |
1167 | + , touchHandler = require('./handler/touch'); | |
1168 | + | |
1169 | +module.exports = function (element, userSettings) { | |
1170 | + userSettings = typeof userSettings === 'object' ? userSettings : {}; | |
1171 | + | |
1172 | + cls.add(element, 'ps-container'); | |
1173 | + | |
1174 | + // Create a plugin instance. | |
1175 | + var i = instances.add(element); | |
1176 | + | |
1177 | + i.settings = h.extend(i.settings, userSettings); | |
1178 | + | |
1179 | + clickRailHandler(element); | |
1180 | + dragScrollbarHandler(element); | |
1181 | + mouseWheelHandler(element); | |
1182 | + nativeScrollHandler(element); | |
1183 | + selectionHandler(element); | |
1184 | + | |
1185 | + if (h.env.supportsTouch || h.env.supportsIePointer) { | |
1186 | + touchHandler(element, h.env.supportsTouch, h.env.supportsIePointer); | |
1187 | + } | |
1188 | + if (i.settings.useKeyboard) { | |
1189 | + keyboardHandler(element); | |
1190 | + } | |
1191 | + | |
1192 | + updateGeometry(element); | |
1193 | +}; | |
1194 | + | |
1195 | +},{"../lib/class":2,"../lib/helper":6,"./handler/click-rail":10,"./handler/drag-scrollbar":11,"./handler/keyboard":12,"./handler/mouse-wheel":13,"./handler/native-scroll":14,"./handler/selection":15,"./handler/touch":16,"./instances":18,"./update-geometry":19}],18:[function(require,module,exports){ | |
1196 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
1197 | + * Licensed under the MIT License | |
1198 | + */ | |
1199 | +'use strict'; | |
1200 | + | |
1201 | +var d = require('../lib/dom') | |
1202 | + , defaultSettings = require('./default-setting') | |
1203 | + , EventManager = require('../lib/event-manager') | |
1204 | + , guid = require('../lib/guid') | |
1205 | + , h = require('../lib/helper'); | |
1206 | + | |
1207 | +var instances = {}; | |
1208 | + | |
1209 | +function Instance(element) { | |
1210 | + var i = this; | |
1211 | + | |
1212 | + i.settings = h.clone(defaultSettings); | |
1213 | + i.containerWidth = null; | |
1214 | + i.containerHeight = null; | |
1215 | + i.contentWidth = null; | |
1216 | + i.contentHeight = null; | |
1217 | + | |
1218 | + i.isRtl = d.css(element, 'direction') === "rtl"; | |
1219 | + i.isNegativeScroll = (function () { | |
1220 | + var originalScrollLeft = element.scrollLeft; | |
1221 | + var result = null; | |
1222 | + element.scrollLeft = -1; | |
1223 | + result = element.scrollLeft < 0; | |
1224 | + element.scrollLeft = originalScrollLeft; | |
1225 | + return result; | |
1226 | + })(); | |
1227 | + i.negativeScrollAdjustment = i.isNegativeScroll ? element.scrollWidth - element.clientWidth : 0; | |
1228 | + i.event = new EventManager(); | |
1229 | + i.ownerDocument = element.ownerDocument || document; | |
1230 | + | |
1231 | + i.scrollbarXRail = d.appendTo(d.e('div', 'ps-scrollbar-x-rail'), element); | |
1232 | + i.scrollbarX = d.appendTo(d.e('div', 'ps-scrollbar-x'), i.scrollbarXRail); | |
1233 | + i.scrollbarXActive = null; | |
1234 | + i.scrollbarXWidth = null; | |
1235 | + i.scrollbarXLeft = null; | |
1236 | + i.scrollbarXBottom = h.toInt(d.css(i.scrollbarXRail, 'bottom')); | |
1237 | + i.isScrollbarXUsingBottom = i.scrollbarXBottom === i.scrollbarXBottom; // !isNaN | |
1238 | + i.scrollbarXTop = i.isScrollbarXUsingBottom ? null : h.toInt(d.css(i.scrollbarXRail, 'top')); | |
1239 | + i.railBorderXWidth = h.toInt(d.css(i.scrollbarXRail, 'borderLeftWidth')) + h.toInt(d.css(i.scrollbarXRail, 'borderRightWidth')); | |
1240 | + // Set rail to display:block to calculate margins | |
1241 | + d.css(i.scrollbarXRail, 'display', 'block'); | |
1242 | + i.railXMarginWidth = h.toInt(d.css(i.scrollbarXRail, 'marginLeft')) + h.toInt(d.css(i.scrollbarXRail, 'marginRight')); | |
1243 | + d.css(i.scrollbarXRail, 'display', ''); | |
1244 | + i.railXWidth = null; | |
1245 | + i.railXRatio = null; | |
1246 | + | |
1247 | + i.scrollbarYRail = d.appendTo(d.e('div', 'ps-scrollbar-y-rail'), element); | |
1248 | + i.scrollbarY = d.appendTo(d.e('div', 'ps-scrollbar-y'), i.scrollbarYRail); | |
1249 | + i.scrollbarYActive = null; | |
1250 | + i.scrollbarYHeight = null; | |
1251 | + i.scrollbarYTop = null; | |
1252 | + i.scrollbarYRight = h.toInt(d.css(i.scrollbarYRail, 'right')); | |
1253 | + i.isScrollbarYUsingRight = i.scrollbarYRight === i.scrollbarYRight; // !isNaN | |
1254 | + i.scrollbarYLeft = i.isScrollbarYUsingRight ? null : h.toInt(d.css(i.scrollbarYRail, 'left')); | |
1255 | + i.scrollbarYOuterWidth = i.isRtl ? h.outerWidth(i.scrollbarY) : null; | |
1256 | + i.railBorderYWidth = h.toInt(d.css(i.scrollbarYRail, 'borderTopWidth')) + h.toInt(d.css(i.scrollbarYRail, 'borderBottomWidth')); | |
1257 | + d.css(i.scrollbarYRail, 'display', 'block'); | |
1258 | + i.railYMarginHeight = h.toInt(d.css(i.scrollbarYRail, 'marginTop')) + h.toInt(d.css(i.scrollbarYRail, 'marginBottom')); | |
1259 | + d.css(i.scrollbarYRail, 'display', ''); | |
1260 | + i.railYHeight = null; | |
1261 | + i.railYRatio = null; | |
1262 | +} | |
1263 | + | |
1264 | +function getId(element) { | |
1265 | + if (typeof element.dataset === 'undefined') { | |
1266 | + return element.getAttribute('data-ps-id'); | |
1267 | + } else { | |
1268 | + return element.dataset.psId; | |
1269 | + } | |
1270 | +} | |
1271 | + | |
1272 | +function setId(element, id) { | |
1273 | + if (typeof element.dataset === 'undefined') { | |
1274 | + element.setAttribute('data-ps-id', id); | |
1275 | + } else { | |
1276 | + element.dataset.psId = id; | |
1277 | + } | |
1278 | +} | |
1279 | + | |
1280 | +function removeId(element) { | |
1281 | + if (typeof element.dataset === 'undefined') { | |
1282 | + element.removeAttribute('data-ps-id'); | |
1283 | + } else { | |
1284 | + delete element.dataset.psId; | |
1285 | + } | |
1286 | +} | |
1287 | + | |
1288 | +exports.add = function (element) { | |
1289 | + var newId = guid(); | |
1290 | + setId(element, newId); | |
1291 | + instances[newId] = new Instance(element); | |
1292 | + return instances[newId]; | |
1293 | +}; | |
1294 | + | |
1295 | +exports.remove = function (element) { | |
1296 | + delete instances[getId(element)]; | |
1297 | + removeId(element); | |
1298 | +}; | |
1299 | + | |
1300 | +exports.get = function (element) { | |
1301 | + return instances[getId(element)]; | |
1302 | +}; | |
1303 | + | |
1304 | +},{"../lib/dom":3,"../lib/event-manager":4,"../lib/guid":5,"../lib/helper":6,"./default-setting":8}],19:[function(require,module,exports){ | |
1305 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
1306 | + * Licensed under the MIT License | |
1307 | + */ | |
1308 | +'use strict'; | |
1309 | + | |
1310 | +var cls = require('../lib/class') | |
1311 | + , d = require('../lib/dom') | |
1312 | + , h = require('../lib/helper') | |
1313 | + , instances = require('./instances'); | |
1314 | + | |
1315 | +function getThumbSize(i, thumbSize) { | |
1316 | + if (i.settings.minScrollbarLength) { | |
1317 | + thumbSize = Math.max(thumbSize, i.settings.minScrollbarLength); | |
1318 | + } | |
1319 | + if (i.settings.maxScrollbarLength) { | |
1320 | + thumbSize = Math.min(thumbSize, i.settings.maxScrollbarLength); | |
1321 | + } | |
1322 | + return thumbSize; | |
1323 | +} | |
1324 | + | |
1325 | +function updateCss(element, i) { | |
1326 | + var xRailOffset = {width: i.railXWidth}; | |
1327 | + if (i.isRtl) { | |
1328 | + xRailOffset.left = i.negativeScrollAdjustment + element.scrollLeft + i.containerWidth - i.contentWidth; | |
1329 | + } else { | |
1330 | + xRailOffset.left = element.scrollLeft; | |
1331 | + } | |
1332 | + if (i.isScrollbarXUsingBottom) { | |
1333 | + xRailOffset.bottom = i.scrollbarXBottom - element.scrollTop; | |
1334 | + } else { | |
1335 | + xRailOffset.top = i.scrollbarXTop + element.scrollTop; | |
1336 | + } | |
1337 | + d.css(i.scrollbarXRail, xRailOffset); | |
1338 | + | |
1339 | + var yRailOffset = {top: element.scrollTop, height: i.railYHeight}; | |
1340 | + if (i.isScrollbarYUsingRight) { | |
1341 | + if (i.isRtl) { | |
1342 | + yRailOffset.right = i.contentWidth - (i.negativeScrollAdjustment + element.scrollLeft) - i.scrollbarYRight - i.scrollbarYOuterWidth; | |
1343 | + } else { | |
1344 | + yRailOffset.right = i.scrollbarYRight - element.scrollLeft; | |
1345 | + } | |
1346 | + } else { | |
1347 | + if (i.isRtl) { | |
1348 | + yRailOffset.left = i.negativeScrollAdjustment + element.scrollLeft + i.containerWidth * 2 - i.contentWidth - i.scrollbarYLeft - i.scrollbarYOuterWidth; | |
1349 | + } else { | |
1350 | + yRailOffset.left = i.scrollbarYLeft + element.scrollLeft; | |
1351 | + } | |
1352 | + } | |
1353 | + d.css(i.scrollbarYRail, yRailOffset); | |
1354 | + | |
1355 | + d.css(i.scrollbarX, {left: i.scrollbarXLeft, width: i.scrollbarXWidth - i.railBorderXWidth}); | |
1356 | + d.css(i.scrollbarY, {top: i.scrollbarYTop, height: i.scrollbarYHeight - i.railBorderYWidth}); | |
1357 | +} | |
1358 | + | |
1359 | +module.exports = function (element) { | |
1360 | + var i = instances.get(element); | |
1361 | + | |
1362 | + i.containerWidth = element.clientWidth; | |
1363 | + i.containerHeight = element.clientHeight; | |
1364 | + i.contentWidth = element.scrollWidth; | |
1365 | + i.contentHeight = element.scrollHeight; | |
1366 | + | |
1367 | + var existingRails; | |
1368 | + if (!element.contains(i.scrollbarXRail)) { | |
1369 | + existingRails = d.queryChildren(element, '.ps-scrollbar-x-rail'); | |
1370 | + if (existingRails.length > 0) { | |
1371 | + existingRails.forEach(function (rail) { | |
1372 | + d.remove(rail); | |
1373 | + }); | |
1374 | + } | |
1375 | + d.appendTo(i.scrollbarXRail, element); | |
1376 | + } | |
1377 | + if (!element.contains(i.scrollbarYRail)) { | |
1378 | + existingRails = d.queryChildren(element, '.ps-scrollbar-y-rail'); | |
1379 | + if (existingRails.length > 0) { | |
1380 | + existingRails.forEach(function (rail) { | |
1381 | + d.remove(rail); | |
1382 | + }); | |
1383 | + } | |
1384 | + d.appendTo(i.scrollbarYRail, element); | |
1385 | + } | |
1386 | + | |
1387 | + if (!i.settings.suppressScrollX && i.containerWidth + i.settings.scrollXMarginOffset < i.contentWidth) { | |
1388 | + i.scrollbarXActive = true; | |
1389 | + i.railXWidth = i.containerWidth - i.railXMarginWidth; | |
1390 | + i.railXRatio = i.containerWidth / i.railXWidth; | |
1391 | + i.scrollbarXWidth = getThumbSize(i, h.toInt(i.railXWidth * i.containerWidth / i.contentWidth)); | |
1392 | + i.scrollbarXLeft = h.toInt((i.negativeScrollAdjustment + element.scrollLeft) * (i.railXWidth - i.scrollbarXWidth) / (i.contentWidth - i.containerWidth)); | |
1393 | + } else { | |
1394 | + i.scrollbarXActive = false; | |
1395 | + i.scrollbarXWidth = 0; | |
1396 | + i.scrollbarXLeft = 0; | |
1397 | + element.scrollLeft = 0; | |
1398 | + } | |
1399 | + | |
1400 | + if (!i.settings.suppressScrollY && i.containerHeight + i.settings.scrollYMarginOffset < i.contentHeight) { | |
1401 | + i.scrollbarYActive = true; | |
1402 | + i.railYHeight = i.containerHeight - i.railYMarginHeight; | |
1403 | + i.railYRatio = i.containerHeight / i.railYHeight; | |
1404 | + i.scrollbarYHeight = getThumbSize(i, h.toInt(i.railYHeight * i.containerHeight / i.contentHeight)); | |
1405 | + i.scrollbarYTop = h.toInt(element.scrollTop * (i.railYHeight - i.scrollbarYHeight) / (i.contentHeight - i.containerHeight)); | |
1406 | + } else { | |
1407 | + i.scrollbarYActive = false; | |
1408 | + i.scrollbarYHeight = 0; | |
1409 | + i.scrollbarYTop = 0; | |
1410 | + element.scrollTop = 0; | |
1411 | + } | |
1412 | + | |
1413 | + if (i.scrollbarXLeft >= i.railXWidth - i.scrollbarXWidth) { | |
1414 | + i.scrollbarXLeft = i.railXWidth - i.scrollbarXWidth; | |
1415 | + } | |
1416 | + if (i.scrollbarYTop >= i.railYHeight - i.scrollbarYHeight) { | |
1417 | + i.scrollbarYTop = i.railYHeight - i.scrollbarYHeight; | |
1418 | + } | |
1419 | + | |
1420 | + updateCss(element, i); | |
1421 | + | |
1422 | + cls[i.scrollbarXActive ? 'add' : 'remove'](element, 'ps-active-x'); | |
1423 | + cls[i.scrollbarYActive ? 'add' : 'remove'](element, 'ps-active-y'); | |
1424 | +}; | |
1425 | + | |
1426 | +},{"../lib/class":2,"../lib/dom":3,"../lib/helper":6,"./instances":18}],20:[function(require,module,exports){ | |
1427 | +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors | |
1428 | + * Licensed under the MIT License | |
1429 | + */ | |
1430 | +'use strict'; | |
1431 | + | |
1432 | +var d = require('../lib/dom') | |
1433 | + , h = require('../lib/helper') | |
1434 | + , instances = require('./instances') | |
1435 | + , updateGeometry = require('./update-geometry'); | |
1436 | + | |
1437 | +module.exports = function (element) { | |
1438 | + var i = instances.get(element); | |
1439 | + | |
1440 | + if (!i) { | |
1441 | + return; | |
1442 | + } | |
1443 | + | |
1444 | + // Recalcuate negative scrollLeft adjustment | |
1445 | + i.negativeScrollAdjustment = i.isNegativeScroll ? element.scrollWidth - element.clientWidth : 0; | |
1446 | + | |
1447 | + // Recalculate rail margins | |
1448 | + d.css(i.scrollbarXRail, 'display', 'block'); | |
1449 | + d.css(i.scrollbarYRail, 'display', 'block'); | |
1450 | + i.railXMarginWidth = h.toInt(d.css(i.scrollbarXRail, 'marginLeft')) + h.toInt(d.css(i.scrollbarXRail, 'marginRight')); | |
1451 | + i.railYMarginHeight = h.toInt(d.css(i.scrollbarYRail, 'marginTop')) + h.toInt(d.css(i.scrollbarYRail, 'marginBottom')); | |
1452 | + | |
1453 | + // Hide scrollbars not to affect scrollWidth and scrollHeight | |
1454 | + d.css(i.scrollbarXRail, 'display', 'none'); | |
1455 | + d.css(i.scrollbarYRail, 'display', 'none'); | |
1456 | + | |
1457 | + updateGeometry(element); | |
1458 | + | |
1459 | + d.css(i.scrollbarXRail, 'display', ''); | |
1460 | + d.css(i.scrollbarYRail, 'display', ''); | |
1461 | +}; | |
1462 | + | |
1463 | +},{"../lib/dom":3,"../lib/helper":6,"./instances":18,"./update-geometry":19}]},{},[1]); | ... | ... |
controllets/treeview-controllet/treeview-controllet.html