pushpop-rails 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +42 -0
- data/Rakefile +29 -0
- data/lib/generators/pushpop/install/install_generator.rb +17 -0
- data/lib/pushpop-rails.rb +4 -0
- data/lib/pushpop/rails.rb +8 -0
- data/lib/pushpop/rails/engine.rb +7 -0
- data/lib/pushpop/rails/version.rb +5 -0
- data/vendor/assets/Pushpop/background.png +0 -0
- data/vendor/assets/Pushpop/background@2x.png +0 -0
- data/vendor/assets/Pushpop/externals/scrollkit/background.png +0 -0
- data/vendor/assets/Pushpop/externals/scrollkit/scrollkit.css +202 -0
- data/vendor/assets/Pushpop/externals/scrollkit/scrollkit.js +924 -0
- data/vendor/assets/Pushpop/font/pushpop-glyphs-webfont.eot +0 -0
- data/vendor/assets/Pushpop/font/pushpop-glyphs-webfont.svg +57 -0
- data/vendor/assets/Pushpop/font/pushpop-glyphs-webfont.ttf +0 -0
- data/vendor/assets/Pushpop/font/pushpop-glyphs-webfont.woff +0 -0
- data/vendor/assets/Pushpop/pushpop-modal-view-stack/pushpop-modal-view-stack.css +148 -0
- data/vendor/assets/Pushpop/pushpop-modal-view-stack/pushpop-modal-view-stack.js +306 -0
- data/vendor/assets/Pushpop/pushpop-popover-view-stack/pushpop-popover-view-stack.css +170 -0
- data/vendor/assets/Pushpop/pushpop-popover-view-stack/pushpop-popover-view-stack.js +278 -0
- data/vendor/assets/Pushpop/pushpop-split-view/pushpop-split-view.css +38 -0
- data/vendor/assets/Pushpop/pushpop-split-view/pushpop-split-view.js +33 -0
- data/vendor/assets/Pushpop/pushpop-tab-view/pushpop-tab-view.css +130 -0
- data/vendor/assets/Pushpop/pushpop-tab-view/pushpop-tab-view.js +298 -0
- data/vendor/assets/Pushpop/pushpop-table-view/pushpop-table-view.css +1273 -0
- data/vendor/assets/Pushpop/pushpop-table-view/pushpop-table-view.js +2275 -0
- data/vendor/assets/Pushpop/pushpop.css +2243 -0
- data/vendor/assets/Pushpop/pushpop.js +1554 -0
- data/vendor/assets/javascripts/pushpop_rails.js +7 -0
- data/vendor/assets/stylesheets/pushpop_rails.css +9 -0
- metadata +92 -0
@@ -0,0 +1,170 @@
|
|
1
|
+
.pp-popover-view-stack-container {
|
2
|
+
background: rgb(12,25,52);
|
3
|
+
background: -moz-linear-gradient(top, rgba(93,101,120,1) 0%, rgba(31,43,67,0.9) 22px, rgba(9,22,49,0.9) 23px, rgba(12,25,52,0.9) 100%);
|
4
|
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(93,101,120,1)), color-stop(23px,rgba(31,43,67,0.9)), color-stop(51%,rgba(9,22,49,0.9)), color-stop(100%,rgba(12,25,52,0.9)));
|
5
|
+
background: -webkit-linear-gradient(top, rgba(93,101,120,1) 0%,rgba(31,43,67,0.9) 22px,rgba(9,22,49,0.9) 23px,rgba(12,25,52,0.9) 100%);
|
6
|
+
background: -o-linear-gradient(top, rgba(93,101,120,1) 0%,rgba(31,43,67,0.9) 22px,rgba(9,22,49,0.9) 23px,rgba(12,25,52,0.9) 100%);
|
7
|
+
background: -ms-linear-gradient(top, rgba(93,101,120,1) 0%,rgba(31,43,67,0.9) 22px,rgba(9,22,49,0.9) 23px,rgba(12,25,52,0.9) 100%);
|
8
|
+
background: linear-gradient(to bottom, rgba(93,101,120,1) 0%,rgba(31,43,67,0.9) 22px,rgba(9,22,49,0.9) 23px,rgba(12,25,52,0.9) 100%);
|
9
|
+
border: 1px solid rgba(0, 0, 0, 0.5);
|
10
|
+
position: absolute;
|
11
|
+
margin: 20px 10px 10px;
|
12
|
+
padding: 0 6px 6px;
|
13
|
+
visibility: hidden;
|
14
|
+
opacity: 0;
|
15
|
+
pointer-events: none;
|
16
|
+
z-index: 99999;
|
17
|
+
-webkit-border-radius: 6px;
|
18
|
+
-moz-border-radius: 6px;
|
19
|
+
border-radius: 6px;
|
20
|
+
-webkit-box-shadow: 0 4px 20px 2px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(224, 224, 224, 0.1), inset 0 1px 0 0 rgba(255, 255, 255, 0.6);
|
21
|
+
-moz-box-shadow: 0 4px 20px 2px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(224, 224, 224, 0.1), inset 0 1px 0 0 rgba(255, 255, 255, 0.6);
|
22
|
+
box-shadow: 0 4px 20px 2px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(224, 224, 224, 0.1), inset 0 1px 0 0 rgba(255, 255, 255, 0.6);
|
23
|
+
-webkit-backface-visibility: hidden;
|
24
|
+
-moz-backface-visibility: hidden;
|
25
|
+
-ms-backface-visibility: hidden;
|
26
|
+
-o-backface-visibility: hidden;
|
27
|
+
backface-visibility: hidden;
|
28
|
+
-webkit-transform: translate3d(0, 0, 0);
|
29
|
+
-moz-transform: translate(0, 0);
|
30
|
+
-ms-transform: translate(0, 0);
|
31
|
+
-o-transform: translate(0, 0);
|
32
|
+
transform: translate(0, 0);
|
33
|
+
-webkit-transition: visibility 0s linear 0.4s, opacity 0.3s ease 0s;
|
34
|
+
-moz-transition: visibility 0s linear 0.4s, opacity 0.3s ease 0s;
|
35
|
+
-ms-transition: visibility 0s linear 0.4s, opacity 0.3s ease 0s;
|
36
|
+
-o-transition: visibility 0s linear 0.4s, opacity 0.3s ease 0s;
|
37
|
+
transition: visibility 0s linear 0.4s, opacity 0.3s ease 0s;
|
38
|
+
}
|
39
|
+
|
40
|
+
.pp-popover-view-stack-container.pp-popover-view-stack-container-style-black {
|
41
|
+
background: rgb(24,24,24);
|
42
|
+
background: -moz-linear-gradient(top, rgba(101,101,101,1) 0%, rgba(42,42,42,0.9) 22px, rgba(21,21,21,0.9) 23px, rgba(24,24,24,0.9) 100%);
|
43
|
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(101,101,101,1)), color-stop(23px,rgba(42,42,42,0.9)), color-stop(51%,rgba(21,21,21,0.9)), color-stop(100%,rgba(24,24,24,0.9)));
|
44
|
+
background: -webkit-linear-gradient(top, rgba(101,101,101,1) 0%,rgba(42,42,42,0.9) 22px,rgba(21,21,21,0.9) 23px,rgba(24,24,24,0.9) 100%);
|
45
|
+
background: -o-linear-gradient(top, rgba(101,101,101,1) 0%,rgba(42,42,42,0.9) 22px,rgba(21,21,21,0.9) 23px,rgba(24,24,24,0.9) 100%);
|
46
|
+
background: -ms-linear-gradient(top, rgba(101,101,101,1) 0%,rgba(42,42,42,0.9) 22px,rgba(21,21,21,0.9) 23px,rgba(24,24,24,0.9) 100%);
|
47
|
+
background: linear-gradient(to bottom, rgba(101,101,101,1) 0%,rgba(42,42,42,0.9) 22px,rgba(21,21,21,0.9) 23px,rgba(24,24,24,0.9) 100%);
|
48
|
+
}
|
49
|
+
|
50
|
+
.pp-popover-view-stack-arrow {
|
51
|
+
background-repeat: none;
|
52
|
+
display: block;
|
53
|
+
position: absolute;
|
54
|
+
z-index: -1;
|
55
|
+
}
|
56
|
+
|
57
|
+
.pp-popover-view-stack-arrow-top {
|
58
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAATCAYAAAAao7T0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAr1JREFUeNrE1NtOE0EYwPGZ7fZASylGaSsg6oXxAYyGLkYUQ6GlLQ0iIiCixFfQ+BomJiZiUNMICSgppRUWS61S8ELjhV6ZGEIUak9b0cphe/icbVyNUQP0gP/LTebbX2YmgwEA5VNra+uUTCYz8jzPOp3OpnxmUfksttvt8/v3HzBevXYdampqjAQ2+18w5Mdz1dX7ai9e6odkCqC3rx+qqqrryPfnuc7EuRzTD4hBAKyvbUCGzKAoCsnlNB68cxsHg8vPxsfH64uOIZAA2QGmu7cPVld5yGQyv7ZZAMlofP/uAA6HQz4CaigaxmazZSGdXb2QWF3/DSImkVBIIaWxwzGII+HwjMvlOl1wjNVqDVRWVjFnO3sgkViD9F8gYrREghQKGg857uFoNMJOTEw0FQxDIHN6/V5De0c3rHz9Bul0ZtM1NE1A5A6NDDtwLBZ97Ha7zXljLBZLFtLWfh64zwkCSW/5WKVSGikJaHT0AeZiMbfH47HkjBEgOp3eYLOfgyj3ZVsQMZlUipQlNHaODeN4PO4kIPu2MS0tLQGtTs+YLW0Qia1AKpXO+TGTy2VIRUBu10Mc57hHk5OTZ7aMMZvNAbIjTKPJDqFwPC+ImEIhRyoljVnPGOY4boRl2Y5NMQJEq9Uxpxqt8CnMQTKZQoVKWaJAapUUP5lyEVBsaHp6uuufGJPJlIWcaDDDUjBaUIiYSlmSBT31egSQw+v1XvgD09zcTCB6pq6+CT4sRQgkiYpVaakSlRHQrJ8V3qFBn893+SdGgFRUaJna40ZY/BgCni8eRKxMrUIaFY3nAzM4EgkP+P3+K9hoNBKIjjlqaICFxSBs7ABETKNRo3I1Tb184UehUOgm7urugSPHTsL7hWUC4dFOt6u8DGlKaer1qwDCN245Mm/evoP1jZ2HiO3ZXY4OHzqIvwswAE7BY9veYNe4AAAAAElFTkSuQmCC);
|
59
|
+
margin: 0 6px;
|
60
|
+
top: -18px;
|
61
|
+
left: 0;
|
62
|
+
width: 35px;
|
63
|
+
height: 19px;
|
64
|
+
}
|
65
|
+
|
66
|
+
.pp-popover-view-stack-container.pp-popover-view-stack-container-style-black .pp-popover-view-stack-arrow-top {
|
67
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAATCAYAAAAao7T0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAmZJREFUeNrE1klrWlEUB/CjcdZXS4xD1WrponTTlSAIEUEwOMYIIkEQ9FP4aQIuFAIuJA7BRCQIWWTjqm5KCaWitc5JDMYp2nsvfYFOJHHqf/NW974f55x732PMZjNYJG63u8XhcCSj0ah9dHS0tchezEUW7+3t9bRarSQcDoNGo5Eg2PV/waAX36jValEoFILJZALBYBBUKtWLRUCMedr0E0JhwGAwgOl0CkwmE7hcLhwcHECtVrtOJpMvV47BEFQBKhAIwN3dHYE8lBmB0PxAJBKBRqPRRaDNlWF2d3cJxO/3Q7/f/wXyOygajRJQKpXaXDrG5XLdKJVKan9/H25vb/8KobOxsUFaFovFoNVqtdPp9NbSMBiiUCgon88HvV4P7u/vH13DYrEI6PDwENrtdjOTycgWxjidTgLxer1wdXX1JAgdNpsNPB4P4vE4BjWOj4/lc2MwRC6XUx6PB2/2LAgdPD8YlEgkoNvtfkegV8/GOBwOAkEgAsF3ybzB7eLz+YCGGTqdzrdsNqt6MsZutxOIzWbDJ2IhCB1cHYFAAKgyGFQ5PT19/SgGQ2QyGWWxWAhkPB7DsoKrIxQK4eTkBIO+5nK5N//EoEoQiNlsxrfoUiF0cHUwKJ/PY9AX9Hz7B8ZqtRKIyWSCarW6EggdkUhEQIVCAd9Dn8/Ozt49YDBEKpVS29vbUKlUAP0OwKpDURRBnZ+fQ7PZ/IRg7xk7OzsEYjAYoFwuw3A4hHVFLBYT1MXFBdTr9Y8sDNHr9XB5eblWCA5qETmpOp0OisXiB5bRaIRSqbR2CB3UIvKdQ6cYfggwABzaSUlhnklfAAAAAElFTkSuQmCC);
|
68
|
+
}
|
69
|
+
|
70
|
+
.pp-popover-view-stack-container.pp-active {
|
71
|
+
visibility: visible;
|
72
|
+
opacity: 1;
|
73
|
+
pointer-events: auto;
|
74
|
+
-webkit-transition-delay: 0s;
|
75
|
+
-moz-transition-delay: 0s;
|
76
|
+
-ms-transition-delay: 0s;
|
77
|
+
-o-transition-delay: 0s;
|
78
|
+
transition-delay: 0s;
|
79
|
+
}
|
80
|
+
|
81
|
+
.pp-popover-view-stack {
|
82
|
+
background: none;
|
83
|
+
position: relative;
|
84
|
+
overflow: hidden;
|
85
|
+
margin: 0;
|
86
|
+
padding: 0;
|
87
|
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
88
|
+
font-size: 13px;
|
89
|
+
line-height: 1.25em;
|
90
|
+
width: 320px;
|
91
|
+
min-height: 440px;
|
92
|
+
-webkit-text-size-adjust: 100%;
|
93
|
+
-moz-text-size-adjust: 100%;
|
94
|
+
-ms-text-size-adjust: 100%;
|
95
|
+
-o-text-size-adjust: 100%;
|
96
|
+
text-size-adjust: 100%;
|
97
|
+
}
|
98
|
+
|
99
|
+
.pp-popover-view-stack::before {
|
100
|
+
background: #333 url('../background.png');
|
101
|
+
background-size: 320px 460px;
|
102
|
+
content: '';
|
103
|
+
display: block;
|
104
|
+
position: absolute;
|
105
|
+
top: 44px;
|
106
|
+
right: 0;
|
107
|
+
bottom: 0;
|
108
|
+
left: 0;
|
109
|
+
width: auto;
|
110
|
+
height: auto;
|
111
|
+
}
|
112
|
+
|
113
|
+
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
|
114
|
+
.pp-popover-view-stack::before {
|
115
|
+
background: #333 url('../background@2x.png');
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
.pp-popover-view-stack::after {
|
120
|
+
content: '';
|
121
|
+
display: block;
|
122
|
+
position: absolute;
|
123
|
+
top: 44px;
|
124
|
+
right: 0;
|
125
|
+
bottom: 0;
|
126
|
+
left: 0;
|
127
|
+
width: auto;
|
128
|
+
height: auto;
|
129
|
+
pointer-events: none;
|
130
|
+
-webkit-box-shadow: inset 0 1px 3px 0 rgba(0, 0, 0, 0.8);
|
131
|
+
-moz-box-shadow: inset 0 1px 3px 0 rgba(0, 0, 0, 0.8);
|
132
|
+
box-shadow: inset 0 1px 3px 0 rgba(0, 0, 0, 0.8);
|
133
|
+
-webkit-backface-visibility: hidden;
|
134
|
+
-moz-backface-visibility: hidden;
|
135
|
+
-ms-backface-visibility: hidden;
|
136
|
+
-o-backface-visibility: hidden;
|
137
|
+
backface-visibility: hidden;
|
138
|
+
-webkit-transform: translate3d(0, 0, 0);
|
139
|
+
-moz-transform: translate(0, 0);
|
140
|
+
-ms-transform: translate(0, 0);
|
141
|
+
-o-transform: translate(0, 0);
|
142
|
+
transform: translate(0, 0);
|
143
|
+
}
|
144
|
+
|
145
|
+
.pp-popover-view-stack > .pp-navigation-bar {
|
146
|
+
background: none;
|
147
|
+
border-top: none;
|
148
|
+
margin-top: 1px;
|
149
|
+
left: -6px;
|
150
|
+
right: -6px;
|
151
|
+
}
|
152
|
+
|
153
|
+
.pp-popover-view-stack-backdrop {
|
154
|
+
position: absolute;
|
155
|
+
top: 0;
|
156
|
+
right: 0;
|
157
|
+
bottom: 0;
|
158
|
+
left: 0;
|
159
|
+
margin: 0;
|
160
|
+
width: auto;
|
161
|
+
height: auto;
|
162
|
+
z-index: 99998;
|
163
|
+
visibility: hidden;
|
164
|
+
pointer-events: none;
|
165
|
+
}
|
166
|
+
|
167
|
+
.pp-popover-view-stack-container.pp-active + .pp-popover-view-stack-backdrop {
|
168
|
+
visibility: visible;
|
169
|
+
pointer-events: auto;
|
170
|
+
}
|
@@ -0,0 +1,278 @@
|
|
1
|
+
;'use strict';
|
2
|
+
|
3
|
+
// The base Pushpop object.
|
4
|
+
var Pushpop = window.Pushpop || {};
|
5
|
+
|
6
|
+
/**
|
7
|
+
Creates a new PopoverViewStack.
|
8
|
+
@param {HTMLDivElement} element The DIV element to initialize as a new PopoverViewStack.
|
9
|
+
@constructor
|
10
|
+
@extends Pushpop.ViewStack
|
11
|
+
*/
|
12
|
+
Pushpop.PopoverViewStack = function PopoverViewStack(element) {
|
13
|
+
|
14
|
+
// Call the "super" constructor.
|
15
|
+
Pushpop.ViewStack.prototype.constructor.apply(this, arguments);
|
16
|
+
|
17
|
+
var self = this;
|
18
|
+
|
19
|
+
var $element = this.$element;
|
20
|
+
|
21
|
+
// Insert the backdrop element after the popover view stack element.
|
22
|
+
var $backdrop = $('<div class="pp-popover-view-stack-backdrop"/>').insertAfter($element);
|
23
|
+
|
24
|
+
// Wrap the popover view stack element in a container.
|
25
|
+
var popoverStyle = $element.data('popoverStyle');
|
26
|
+
var $container = this.$container = $('<div class="pp-popover-view-stack-container' + (popoverStyle ? ' pp-popover-view-stack-container-style-' + popoverStyle : '') + '"/>').insertAfter($element).append($element);
|
27
|
+
|
28
|
+
// Insert an arrow element in the container.
|
29
|
+
var $arrow = this.$arrow = $('<div class="pp-popover-view-stack-arrow pp-popover-view-stack-arrow-top"/>').appendTo($container);
|
30
|
+
|
31
|
+
// Make the popover view stack visible if it is initialized with the .pp-active CSS class.
|
32
|
+
this.setHidden(!$element.hasClass('pp-active'));
|
33
|
+
$element.removeClass('pp-active');
|
34
|
+
|
35
|
+
// Dismiss the popover view stack if the backdrop element is tapped/clicked.
|
36
|
+
$backdrop.bind(!!('ontouchstart' in window) ? 'touchstart' : 'mousedown', function(evt) {
|
37
|
+
self.dismiss();
|
38
|
+
});
|
39
|
+
};
|
40
|
+
|
41
|
+
Pushpop.PopoverViewStack.POPOVER_CONTAINER_MARGIN = 10;
|
42
|
+
|
43
|
+
// Create the prototype for the Pushpop.PopoverViewStack as a "sub-class" of Pushpop.ViewStack.
|
44
|
+
Pushpop.PopoverViewStack.prototype = new Pushpop.ViewStack();
|
45
|
+
Pushpop.PopoverViewStack.prototype.constructor = Pushpop.PopoverViewStack;
|
46
|
+
|
47
|
+
Pushpop.PopoverViewStack.prototype.$container = null;
|
48
|
+
Pushpop.PopoverViewStack.prototype.$arrow = null;
|
49
|
+
|
50
|
+
Pushpop.PopoverViewStack.prototype._hidden = true;
|
51
|
+
|
52
|
+
/**
|
53
|
+
Returns a flag indicating if this popover view stack is hidden.
|
54
|
+
@type Boolean
|
55
|
+
*/
|
56
|
+
Pushpop.PopoverViewStack.prototype.getHidden = function() { return this._hidden; };
|
57
|
+
|
58
|
+
/**
|
59
|
+
Sets a flag indicating if this popover view stack should be hidden.
|
60
|
+
@param {Boolean} hidden A flag indicating if this popover view stack should be hidden.
|
61
|
+
*/
|
62
|
+
Pushpop.PopoverViewStack.prototype.setHidden = function(hidden) { if (hidden) this.dismiss(); else this.present(); };
|
63
|
+
|
64
|
+
Pushpop.PopoverViewStack.prototype._targetElement = null;
|
65
|
+
|
66
|
+
/**
|
67
|
+
Returns the current target element for this popover view stack.
|
68
|
+
@type HTMLElement
|
69
|
+
*/
|
70
|
+
Pushpop.PopoverViewStack.prototype.getTargetElement = function() { return this._targetElement; };
|
71
|
+
|
72
|
+
/**
|
73
|
+
Sets the current target element for this popover view stack.
|
74
|
+
@param {HTMLElement} targetElement The target element this popover view stack should point to.
|
75
|
+
*/
|
76
|
+
Pushpop.PopoverViewStack.prototype.setTargetElement = function(targetElement) {
|
77
|
+
this._targetElement = targetElement;
|
78
|
+
|
79
|
+
var $targetElement = $(targetElement);
|
80
|
+
var $window = $(window);
|
81
|
+
var $container = this.$container;
|
82
|
+
var $arrow = this.$arrow;
|
83
|
+
|
84
|
+
var targetSize = {
|
85
|
+
width: $targetElement.outerWidth(),
|
86
|
+
height: $targetElement.outerHeight()
|
87
|
+
};
|
88
|
+
var windowSize = {
|
89
|
+
width: $window.width(),
|
90
|
+
height: $window.height()
|
91
|
+
};
|
92
|
+
var containerOuterSize = {
|
93
|
+
width: $container.outerWidth(),
|
94
|
+
height: $container.outerHeight()
|
95
|
+
};
|
96
|
+
var containerInnerSize = {
|
97
|
+
width: $container.width(),
|
98
|
+
height: $container.height()
|
99
|
+
};
|
100
|
+
var arrowSize = {
|
101
|
+
width: $arrow.width(),
|
102
|
+
height: $arrow.height()
|
103
|
+
};
|
104
|
+
|
105
|
+
var targetPosition = $targetElement.offset();
|
106
|
+
targetPosition = {
|
107
|
+
x: targetPosition.left + (targetSize.width / 2),
|
108
|
+
y: targetPosition.top + targetSize.height
|
109
|
+
};
|
110
|
+
|
111
|
+
var containerPosition = {
|
112
|
+
x: targetPosition.x - (containerOuterSize.width / 2) - Pushpop.PopoverViewStack.POPOVER_CONTAINER_MARGIN,
|
113
|
+
y: targetPosition.y
|
114
|
+
};
|
115
|
+
|
116
|
+
var minimumContainerPosition = {
|
117
|
+
x: -Pushpop.PopoverViewStack.POPOVER_CONTAINER_MARGIN,
|
118
|
+
y: -Pushpop.PopoverViewStack.POPOVER_CONTAINER_MARGIN
|
119
|
+
};
|
120
|
+
|
121
|
+
var maximumContainerPosition = {
|
122
|
+
x: windowSize.width - containerOuterSize.width - Pushpop.PopoverViewStack.POPOVER_CONTAINER_MARGIN,
|
123
|
+
y: windowSize.height - containerOuterSize.height - Pushpop.PopoverViewStack.POPOVER_CONTAINER_MARGIN
|
124
|
+
};
|
125
|
+
|
126
|
+
var adjustedContainerPosition = {
|
127
|
+
x: Math.min(Math.max(containerPosition.x, minimumContainerPosition.x), maximumContainerPosition.x),
|
128
|
+
y: containerPosition.y
|
129
|
+
};
|
130
|
+
|
131
|
+
var adjustmentOffset = {
|
132
|
+
x: containerPosition.x - adjustedContainerPosition.x,
|
133
|
+
y: containerPosition.y - adjustedContainerPosition.y
|
134
|
+
};
|
135
|
+
|
136
|
+
var arrowPosition = {
|
137
|
+
x: (containerInnerSize.width / 2) - (arrowSize.width / 2) + adjustmentOffset.x,
|
138
|
+
y: 1 - arrowSize.height
|
139
|
+
};
|
140
|
+
|
141
|
+
this.$container.css({ left: adjustedContainerPosition.x + 'px', top: adjustedContainerPosition.y + 'px' });
|
142
|
+
this.$arrow.css({ left: arrowPosition.x + 'px', top: arrowPosition.y + 'px' });
|
143
|
+
};
|
144
|
+
|
145
|
+
/**
|
146
|
+
Presents this popover view stack and transitions it to a visible state.
|
147
|
+
@param {Pushpop.View} [view] Optional view to set as the active view before presenting.
|
148
|
+
*/
|
149
|
+
Pushpop.PopoverViewStack.prototype.present = function(view, targetElement) {
|
150
|
+
if (!this.getHidden()) return;
|
151
|
+
|
152
|
+
this._hidden = false;
|
153
|
+
|
154
|
+
var oldActiveView = this.getActiveView();
|
155
|
+
if (view && oldActiveView !== view) {
|
156
|
+
oldActiveView.$element.removeClass('pp-active');
|
157
|
+
view.$element.addClass('pp-active');
|
158
|
+
|
159
|
+
this.views.length = 0;
|
160
|
+
this.views.push(view);
|
161
|
+
} else {
|
162
|
+
this.views.length = 0;
|
163
|
+
this.views.push(oldActiveView);
|
164
|
+
}
|
165
|
+
|
166
|
+
var activeView = this.getActiveView();
|
167
|
+
activeView.$trigger($.Event(Pushpop.EventType.WillPresentView, {
|
168
|
+
view: activeView,
|
169
|
+
action: 'popover-present'
|
170
|
+
}));
|
171
|
+
|
172
|
+
if (targetElement) this.setTargetElement(targetElement);
|
173
|
+
|
174
|
+
this.$container.addClass('pp-active');
|
175
|
+
|
176
|
+
activeView.$trigger($.Event(Pushpop.EventType.DidPresentView, {
|
177
|
+
view: activeView,
|
178
|
+
action: 'popover-present'
|
179
|
+
}));
|
180
|
+
};
|
181
|
+
|
182
|
+
/**
|
183
|
+
Dismisses this popover view stack and transitions it to a hidden state.
|
184
|
+
*/
|
185
|
+
Pushpop.PopoverViewStack.prototype.dismiss = function() {
|
186
|
+
if (this.getHidden()) return;
|
187
|
+
|
188
|
+
this._hidden = true;
|
189
|
+
|
190
|
+
var activeView = this.getActiveView();
|
191
|
+
activeView.$trigger($.Event(Pushpop.EventType.WillDismissView, {
|
192
|
+
view: activeView,
|
193
|
+
action: 'popover-dismiss'
|
194
|
+
}));
|
195
|
+
|
196
|
+
var self = this;
|
197
|
+
window.setTimeout(function() {
|
198
|
+
self.$container.removeClass('pp-active');
|
199
|
+
|
200
|
+
activeView.$trigger($.Event(Pushpop.EventType.DidDismissView, {
|
201
|
+
view: activeView,
|
202
|
+
action: 'popover-dismiss'
|
203
|
+
}));
|
204
|
+
}, 50);
|
205
|
+
};
|
206
|
+
|
207
|
+
$(function() {
|
208
|
+
var $window = $(window['addEventListener'] ? window : document.body);
|
209
|
+
|
210
|
+
// Handle actions for buttons set up to automatically present/dismiss popovers.
|
211
|
+
$window.delegate('.pp-button.pp-present-popover, .pp-button.pp-dismiss-popover', Pushpop.Button.EventType.DidTriggerAction, function(evt) {
|
212
|
+
var button = evt.button;
|
213
|
+
var $element = button.$element;
|
214
|
+
var href = $element.attr('href');
|
215
|
+
var $viewElement, view, viewStack;
|
216
|
+
|
217
|
+
if ($element.hasClass('pp-present-popover')) {
|
218
|
+
$viewElement = $(href);
|
219
|
+
if ($viewElement.length === 0) return;
|
220
|
+
|
221
|
+
view = $viewElement[0].view || new Pushpop.View($viewElement);
|
222
|
+
|
223
|
+
viewStack = view.getViewStack();
|
224
|
+
if (viewStack) viewStack.present(view, button.element);
|
225
|
+
}
|
226
|
+
|
227
|
+
else if ($element.hasClass('pp-dismiss-popover')) {
|
228
|
+
if (href === '#') {
|
229
|
+
viewStack = button.getViewStack();
|
230
|
+
if (viewStack) viewStack.dismiss();
|
231
|
+
} else {
|
232
|
+
$viewElement = $(href);
|
233
|
+
if ($viewElement.length === 0) return;
|
234
|
+
|
235
|
+
view = $viewElement[0].view || new Pushpop.View($viewElement);
|
236
|
+
|
237
|
+
viewStack = view.getViewStack();
|
238
|
+
if (viewStack) viewStack.dismiss();
|
239
|
+
}
|
240
|
+
}
|
241
|
+
});
|
242
|
+
|
243
|
+
// Handle clicks for anchor links set up to automatically present/dismiss popovers.
|
244
|
+
$window.delegate('a.pp-present-popover, a.pp-dismiss-popover', 'click', function(evt) {
|
245
|
+
var $element = $(this);
|
246
|
+
if ($element.hasClass('pp-button')) return;
|
247
|
+
|
248
|
+
evt.preventDefault();
|
249
|
+
|
250
|
+
var href = $element.attr('href');
|
251
|
+
var $viewElement, view, viewStack;
|
252
|
+
|
253
|
+
if ($element.hasClass('pp-present-popover')) {
|
254
|
+
$viewElement = $(href);
|
255
|
+
if ($viewElement.length === 0) return;
|
256
|
+
|
257
|
+
view = $viewElement[0].view || new Pushpop.View($viewElement);
|
258
|
+
|
259
|
+
viewStack = view.getViewStack();
|
260
|
+
if (viewStack) viewStack.present(view, this);
|
261
|
+
}
|
262
|
+
|
263
|
+
else if ($element.hasClass('pp-dismiss-popover')) {
|
264
|
+
if (href === '#') {
|
265
|
+
viewStack = Pushpop.getViewStackForElement($element);
|
266
|
+
if (viewStack) viewStack.dismiss();
|
267
|
+
} else {
|
268
|
+
$viewElement = $(href);
|
269
|
+
if ($viewElement.length === 0) return;
|
270
|
+
|
271
|
+
view = $viewElement[0].view || new Pushpop.View($viewElement);
|
272
|
+
|
273
|
+
viewStack = view.getViewStack();
|
274
|
+
if (viewStack) viewStack.dismiss();
|
275
|
+
}
|
276
|
+
}
|
277
|
+
});
|
278
|
+
});
|
@@ -0,0 +1,38 @@
|
|
1
|
+
.pp-split-view {
|
2
|
+
display: none;
|
3
|
+
position: absolute;
|
4
|
+
width: auto;
|
5
|
+
height: auto;
|
6
|
+
top: 0;
|
7
|
+
right: 0;
|
8
|
+
bottom: 0;
|
9
|
+
left: 0;
|
10
|
+
}
|
11
|
+
|
12
|
+
.pp-split-view > .pp-split-view-stack-master {
|
13
|
+
border-right: 1px solid #000;
|
14
|
+
position: absolute;
|
15
|
+
top: 0;
|
16
|
+
left: 0;
|
17
|
+
width: 320px;
|
18
|
+
height: 100%;
|
19
|
+
-webkit-perspective: none;
|
20
|
+
-moz-perspective: none;
|
21
|
+
-ms-perspective: none;
|
22
|
+
-o-perspective: none;
|
23
|
+
perspective: none;
|
24
|
+
}
|
25
|
+
|
26
|
+
.pp-split-view > .pp-split-view-stack-detail {
|
27
|
+
position: absolute;
|
28
|
+
top: 0;
|
29
|
+
right: 0;
|
30
|
+
left: 321px;
|
31
|
+
width: auto;
|
32
|
+
height: 100%;
|
33
|
+
-webkit-perspective: none;
|
34
|
+
-moz-perspective: none;
|
35
|
+
-ms-perspective: none;
|
36
|
+
-o-perspective: none;
|
37
|
+
perspective: none;
|
38
|
+
}
|