esphinx-rails-ui 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +21 -0
- data/bin/rails +12 -0
- data/config/environments/production.rb +1 -0
- data/config/environments/staging.rb +1 -0
- data/config/initializers/assets.rb +2 -0
- data/esphinx_ui.gemspec +23 -0
- data/lib/assets/javascripts/esphinx/ui/handlers/tabs.js +228 -0
- data/lib/assets/javascripts/esphinx/ui/handlers/tooltip.js +90 -0
- data/lib/assets/javascripts/esphinx/ui/index.js +4 -0
- data/lib/assets/javascripts/esphinx/ui/main.js +17 -0
- data/lib/assets/javascripts/esphinx/ui/panels/autocomplete.js +270 -0
- data/lib/assets/javascripts/esphinx/ui/panels/modal.js +451 -0
- data/lib/assets/javascripts/esphinx/ui/selectors/select.js +238 -0
- data/lib/assets/stylesheets/esphinx/ui/class.sass +13 -0
- data/lib/assets/stylesheets/esphinx/ui/index.sass +1 -0
- data/lib/assets/stylesheets/esphinx/ui/mixins.sass +1 -0
- data/lib/assets/stylesheets/esphinx/ui/modal.sass +61 -0
- data/lib/assets/stylesheets/esphinx/ui/selects.sass +69 -0
- data/lib/assets/stylesheets/esphinx/ui/tabs.sass +14 -0
- data/lib/assets/stylesheets/esphinx/ui/tooltips.sass +17 -0
- data/lib/esphinx-rails-ui.rb +1 -0
- data/lib/esphinx/rails/ui/engine.rb +9 -0
- data/lib/esphinx/rails/ui/version.rb +7 -0
- metadata +97 -0
@@ -0,0 +1,270 @@
|
|
1
|
+
var
|
2
|
+
esPhinx;
|
3
|
+
|
4
|
+
|
5
|
+
(function($, $module) {
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
var
|
9
|
+
CSS_CLASS = "esphinx ui",
|
10
|
+
CSS_CLASS_QUERY = "." + CSS_CLASS.replace(/ +/g, ".");
|
11
|
+
|
12
|
+
$module.extend({
|
13
|
+
panels: {autocomplete: {}}
|
14
|
+
});
|
15
|
+
|
16
|
+
$.Extender.extend($module.panels.autocomplete, true, {
|
17
|
+
// new: function(searchTextBox, originalList, options = {}, callback) {
|
18
|
+
new: function(searchTextBox, originalList, options, callback) {
|
19
|
+
var
|
20
|
+
nodeListFound,
|
21
|
+
referenceElement,
|
22
|
+
spanizedSliceFound,
|
23
|
+
mapped,
|
24
|
+
ConstructorReference = $module.panels.autocomplete.new,
|
25
|
+
self = this,
|
26
|
+
created = false,
|
27
|
+
|
28
|
+
iteratorblock = function(i) {
|
29
|
+
spanizedSliceFound = $(mapped[i].span());
|
30
|
+
spanizedSliceFound.addClass(CSS_CLASS + " slice-found");
|
31
|
+
|
32
|
+
mapped[i] = spanizedSliceFound;
|
33
|
+
},
|
34
|
+
|
35
|
+
spanize = function(map) {
|
36
|
+
mapped = map;
|
37
|
+
|
38
|
+
Object.keys(map).forEach(iteratorblock);
|
39
|
+
|
40
|
+
return map;
|
41
|
+
},
|
42
|
+
|
43
|
+
composeMatch = function(mapped, nodeText, nodeTextAsArr) {
|
44
|
+
var
|
45
|
+
leftUnitName,
|
46
|
+
rightUnitName,
|
47
|
+
searchIndex,
|
48
|
+
sliceFound,
|
49
|
+
span,
|
50
|
+
composedArr = [],
|
51
|
+
|
52
|
+
iteratorblock = function(value, i) {
|
53
|
+
if (mapped.hasOwnProperty(i)) {
|
54
|
+
span = mapped[i];
|
55
|
+
sliceFound = span.text();
|
56
|
+
searchIndex = value.search(sliceFound);
|
57
|
+
leftUnitName = value.slice(0, searchIndex);
|
58
|
+
rightUnitName = value
|
59
|
+
.slice(searchIndex + sliceFound.length,
|
60
|
+
value.length);
|
61
|
+
|
62
|
+
if (!leftUnitName.isEmpty()) {
|
63
|
+
composedArr.push(window.document
|
64
|
+
.createTextNode(leftUnitName));
|
65
|
+
} else {
|
66
|
+
span.text(span.text());
|
67
|
+
}
|
68
|
+
|
69
|
+
composedArr.push(span.asNode());
|
70
|
+
|
71
|
+
if (!rightUnitName.isEmpty()) {
|
72
|
+
composedArr.push(window.document
|
73
|
+
.createTextNode(rightUnitName));
|
74
|
+
}
|
75
|
+
} else {
|
76
|
+
composedArr.push(window.document
|
77
|
+
.createTextNode(value));
|
78
|
+
}
|
79
|
+
|
80
|
+
};
|
81
|
+
|
82
|
+
nodeTextAsArr.spaceOut().forEach(iteratorblock);
|
83
|
+
|
84
|
+
return composedArr;
|
85
|
+
},
|
86
|
+
|
87
|
+
resolveResponse = function(found, maps) {
|
88
|
+
var
|
89
|
+
composed,
|
90
|
+
nodeText,
|
91
|
+
nodeTextAsArr,
|
92
|
+
mapped,
|
93
|
+
resolved = $(),
|
94
|
+
|
95
|
+
callback = function(node, i) {
|
96
|
+
nodeText = $(node).text().trim();
|
97
|
+
nodeTextAsArr = nodeText.split(" ");
|
98
|
+
mapped = spanize(maps[i]);
|
99
|
+
composed = composeMatch(mapped, nodeText,
|
100
|
+
nodeTextAsArr);
|
101
|
+
resolved.concat(true, composeName(composed, node));
|
102
|
+
};
|
103
|
+
|
104
|
+
found.each(callback);
|
105
|
+
|
106
|
+
return resolved;
|
107
|
+
},
|
108
|
+
|
109
|
+
composeName = function(composedArr, node) {
|
110
|
+
var
|
111
|
+
copy = $(node).clone(),
|
112
|
+
|
113
|
+
iteratorblock = function(v) {
|
114
|
+
copy.append(v);
|
115
|
+
};
|
116
|
+
|
117
|
+
composedArr.forEach(iteratorblock);
|
118
|
+
|
119
|
+
return copy;
|
120
|
+
},
|
121
|
+
|
122
|
+
create = function(referenceElement) {
|
123
|
+
var
|
124
|
+
nodeListFound = $("<ol></ol>")
|
125
|
+
.addClass(CSS_CLASS + " list-built-found"),
|
126
|
+
width,
|
127
|
+
borderBottom,
|
128
|
+
border,
|
129
|
+
marginBottom,
|
130
|
+
|
131
|
+
hitTarget = function(target) {
|
132
|
+
return target.is(nodeListFound.childElements()) ||
|
133
|
+
target.is(referenceElement);
|
134
|
+
};
|
135
|
+
|
136
|
+
if (referenceElement.isA(window.HTMLInputElement)) {
|
137
|
+
|
138
|
+
referenceElement.on("focus", function() {
|
139
|
+
if (nodeListFound.childElements().some()) {
|
140
|
+
nodeListFound.show();
|
141
|
+
}
|
142
|
+
});
|
143
|
+
|
144
|
+
referenceElement.on("blur", function(e) {
|
145
|
+
if (e.relatedTarget) {
|
146
|
+
if (!$(e.relatedTarget).is(nodeListFound)) {
|
147
|
+
self.hide();
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
});
|
152
|
+
|
153
|
+
// clicking outside the panel
|
154
|
+
$(window.document).on("mouseup", function(e) {
|
155
|
+
var
|
156
|
+
target = $(e.target);
|
157
|
+
|
158
|
+
// debugger
|
159
|
+
if (!target.isA(window.HTMLInputElement) &&
|
160
|
+
!target.isA(window.HTMLLIElement)) {
|
161
|
+
target = target.parent("ol" + CSS_CLASS_QUERY +
|
162
|
+
".list-built-found li");
|
163
|
+
}
|
164
|
+
|
165
|
+
if (!hitTarget(target)) {
|
166
|
+
self.hide();
|
167
|
+
} else if (target
|
168
|
+
.isA(window.HTMLLIElement)) {
|
169
|
+
if (target.hasClass("selected")) {
|
170
|
+
target.removeClass("selected");
|
171
|
+
} else {
|
172
|
+
target.addClass("selected");
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
});
|
177
|
+
|
178
|
+
marginBottom = referenceElement.css("margin-bottom");
|
179
|
+
width = referenceElement.width();
|
180
|
+
borderBottom = referenceElement.css("border-bottom");
|
181
|
+
border = referenceElement.css("border");
|
182
|
+
|
183
|
+
nodeListFound.css("margin-top", -marginBottom + "px");
|
184
|
+
|
185
|
+
// only after set width, otherwise doesn't can get your border
|
186
|
+
nodeListFound.insertAfter(referenceElement);
|
187
|
+
if (width) {
|
188
|
+
nodeListFound.css("position", "absolute");
|
189
|
+
// nodeListFound.width(width);
|
190
|
+
nodeListFound.css("min-width", width);
|
191
|
+
}
|
192
|
+
|
193
|
+
nodeListFound.show();
|
194
|
+
} else {
|
195
|
+
nodeListFound.insertAfter(referenceElement);
|
196
|
+
}
|
197
|
+
|
198
|
+
return nodeListFound;
|
199
|
+
},
|
200
|
+
|
201
|
+
show = function(autocompletedList) {
|
202
|
+
var
|
203
|
+
callback = function(li) {
|
204
|
+
nodeListFound.append(li);
|
205
|
+
};
|
206
|
+
|
207
|
+
$(nodeListFound).clean();
|
208
|
+
|
209
|
+
if (searchTextBox.value()) {
|
210
|
+
if (originalList instanceof $) {
|
211
|
+
originalList.hide();
|
212
|
+
}
|
213
|
+
|
214
|
+
autocompletedList.each(callback);
|
215
|
+
|
216
|
+
if (nodeListFound.childElements().some()) {
|
217
|
+
nodeListFound.show();
|
218
|
+
} else {
|
219
|
+
nodeListFound.hide();
|
220
|
+
}
|
221
|
+
} else {
|
222
|
+
if (originalList instanceof $) {
|
223
|
+
originalList.show();
|
224
|
+
}
|
225
|
+
self.hide();
|
226
|
+
}
|
227
|
+
|
228
|
+
return nodeListFound.childElements();
|
229
|
+
};
|
230
|
+
|
231
|
+
if (!(this instanceof ConstructorReference)) {
|
232
|
+
return new ConstructorReference(searchTextBox, originalList,
|
233
|
+
options, callback);
|
234
|
+
}
|
235
|
+
|
236
|
+
if (Object.areFromClass(originalList, Object)) {
|
237
|
+
referenceElement = searchTextBox;
|
238
|
+
callback = options;
|
239
|
+
options = originalList;
|
240
|
+
} else {
|
241
|
+
referenceElement = originalList;
|
242
|
+
}
|
243
|
+
|
244
|
+
searchTextBox.autocomplete(originalList, options,
|
245
|
+
function(found, mapped) {
|
246
|
+
var
|
247
|
+
resolvedResponse;
|
248
|
+
|
249
|
+
if (!created) {
|
250
|
+
created = true;
|
251
|
+
|
252
|
+
nodeListFound = create(referenceElement);
|
253
|
+
}
|
254
|
+
|
255
|
+
if (typeof callback == "function") {
|
256
|
+
callback = function() {};
|
257
|
+
}
|
258
|
+
|
259
|
+
resolvedResponse = resolveResponse(found, mapped);
|
260
|
+
callback.call(self, show(resolvedResponse));
|
261
|
+
});
|
262
|
+
|
263
|
+
this.hide = function() {
|
264
|
+
nodeListFound.hide();
|
265
|
+
};
|
266
|
+
|
267
|
+
}
|
268
|
+
});
|
269
|
+
|
270
|
+
})(esPhinx, esPhinx.ui);
|
@@ -0,0 +1,451 @@
|
|
1
|
+
var
|
2
|
+
esPhinx,
|
3
|
+
Flyweight;
|
4
|
+
|
5
|
+
|
6
|
+
(function($, $module) {
|
7
|
+
"use strict";
|
8
|
+
|
9
|
+
|
10
|
+
var
|
11
|
+
visible,
|
12
|
+
minimized = [];
|
13
|
+
|
14
|
+
$module.extend({
|
15
|
+
panels: {modal: {}}
|
16
|
+
});
|
17
|
+
|
18
|
+
$.Extender.extend($module.panels.modal, true, {
|
19
|
+
hide: function(animation) {
|
20
|
+
visible.hide(animation);
|
21
|
+
},
|
22
|
+
|
23
|
+
close: function() {
|
24
|
+
visible.close();
|
25
|
+
},
|
26
|
+
|
27
|
+
// functions are constructors in js
|
28
|
+
new: function(options) {
|
29
|
+
var
|
30
|
+
_windowController,
|
31
|
+
progress,
|
32
|
+
modal,
|
33
|
+
mask,
|
34
|
+
section,
|
35
|
+
loadingContainer,
|
36
|
+
main,
|
37
|
+
closeButton,
|
38
|
+
hideButton,
|
39
|
+
headers,
|
40
|
+
URLParameters,
|
41
|
+
instance,
|
42
|
+
timesUp,
|
43
|
+
calledback,
|
44
|
+
ready,
|
45
|
+
readyToShow,
|
46
|
+
instanceShowWasCalled,
|
47
|
+
self = this,
|
48
|
+
ConstructorReference = $module.panels.modal.new,
|
49
|
+
body = $("body"),
|
50
|
+
_classes = options.class || options.classes,
|
51
|
+
|
52
|
+
isMinimized = function() {
|
53
|
+
var
|
54
|
+
index = minimized.indexOfEquivalence(this);
|
55
|
+
|
56
|
+
if (index) {
|
57
|
+
return index;
|
58
|
+
}
|
59
|
+
|
60
|
+
return false;
|
61
|
+
},
|
62
|
+
|
63
|
+
addToMinimized = function() {
|
64
|
+
if (!isMinimized.call(this)) {
|
65
|
+
minimized.push(this);
|
66
|
+
}
|
67
|
+
},
|
68
|
+
|
69
|
+
removeFromMinimized = function() {
|
70
|
+
var
|
71
|
+
index = isMinimized.call(this);
|
72
|
+
|
73
|
+
if (index) {
|
74
|
+
minimized.delete(index);
|
75
|
+
}
|
76
|
+
},
|
77
|
+
|
78
|
+
maskTransitionDuration = function(mask) {
|
79
|
+
return parseFloat(mask
|
80
|
+
.css("transition-duration")) * 1000;
|
81
|
+
},
|
82
|
+
|
83
|
+
restartTransition = function(mask) {
|
84
|
+
mask.css("transition", "opacity 0s");
|
85
|
+
},
|
86
|
+
|
87
|
+
resolveArguments = function() {
|
88
|
+
options = options || {};
|
89
|
+
|
90
|
+
if (typeof options.windowController != "boolean") {
|
91
|
+
_windowController = true;
|
92
|
+
} else {
|
93
|
+
_windowController = options.windowController;
|
94
|
+
}
|
95
|
+
|
96
|
+
if (typeof options.closeButton != "boolean") {
|
97
|
+
options.closeButton = true;
|
98
|
+
}
|
99
|
+
|
100
|
+
if (options.content) {
|
101
|
+
options.url = false;
|
102
|
+
}
|
103
|
+
},
|
104
|
+
|
105
|
+
create = function() {
|
106
|
+
modal = $("<div></div>")
|
107
|
+
.addClass("esphinx ui modal");
|
108
|
+
|
109
|
+
if (_classes) {
|
110
|
+
modal.addClass(_classes);
|
111
|
+
}
|
112
|
+
|
113
|
+
section = $("<section></section>").addClass("hidden");
|
114
|
+
mask = $("<div></div>").addClass("fixed transparent mask");
|
115
|
+
main = $("<div></div>").addClass("main");
|
116
|
+
loadingContainer = $("<div></div>")
|
117
|
+
.addClass("main loading");
|
118
|
+
|
119
|
+
section.append(loadingContainer);
|
120
|
+
|
121
|
+
modal.append(mask).append(section);
|
122
|
+
|
123
|
+
body.append(modal);
|
124
|
+
|
125
|
+
if (options.timeout) {
|
126
|
+
window.setTimeout(function() {
|
127
|
+
if (options.timesUp &&
|
128
|
+
typeof options.timesUp == "function" &&
|
129
|
+
!ready) {
|
130
|
+
timesUp = true;
|
131
|
+
options.timesUp.call(self);
|
132
|
+
}
|
133
|
+
}, options.timeout * 1000);
|
134
|
+
}
|
135
|
+
|
136
|
+
observers(section, options);
|
137
|
+
|
138
|
+
if (options.url) {
|
139
|
+
headers = options.header || options.headers || null;
|
140
|
+
URLParameters = options.param ||
|
141
|
+
options.URLParameters || null;
|
142
|
+
|
143
|
+
$.Ajax.new(options.url).get({
|
144
|
+
URLParameters: URLParameters,
|
145
|
+
headers: headers,
|
146
|
+
progress: function() {
|
147
|
+
if (options.loading) {
|
148
|
+
if (!calledback) {
|
149
|
+
calledback = true;
|
150
|
+
options.loading
|
151
|
+
.call(self);
|
152
|
+
}
|
153
|
+
}
|
154
|
+
},
|
155
|
+
success: function(r) {
|
156
|
+
hide.call(self, false);
|
157
|
+
main.html(r);
|
158
|
+
}
|
159
|
+
});
|
160
|
+
|
161
|
+
} else {
|
162
|
+
if (options.loading) {
|
163
|
+
options.loading.call(self);
|
164
|
+
}
|
165
|
+
|
166
|
+
hide.call(self, false);
|
167
|
+
main.html(options.content);
|
168
|
+
}
|
169
|
+
},
|
170
|
+
|
171
|
+
|
172
|
+
bindHeaderEventListeners = function() {
|
173
|
+
if (closeButton) {
|
174
|
+
closeButton.on("click", function() {
|
175
|
+
close.call(self);
|
176
|
+
});
|
177
|
+
}
|
178
|
+
|
179
|
+
hideButton.on("click", function() {
|
180
|
+
hide.call(self);
|
181
|
+
});
|
182
|
+
},
|
183
|
+
|
184
|
+
prependHeaderActions = function(section, options) {
|
185
|
+
var
|
186
|
+
header = section.find("header"),
|
187
|
+
actions;
|
188
|
+
|
189
|
+
if ((_windowController || timesUp) &&
|
190
|
+
!header.count()) {
|
191
|
+
header = $("<header></header>");
|
192
|
+
actions = $("<div></div>").addClass("actions");
|
193
|
+
hideButton = $('<a href="#"></a>')
|
194
|
+
.addClass("hide-button");
|
195
|
+
|
196
|
+
header.append(actions);
|
197
|
+
|
198
|
+
if (options.closeButton || timesUp) {
|
199
|
+
closeButton = $('<a href="#"></a>')
|
200
|
+
.addClass("close-button");
|
201
|
+
actions.append(closeButton);
|
202
|
+
}
|
203
|
+
|
204
|
+
if (!timesUp) {
|
205
|
+
actions.append(hideButton);
|
206
|
+
}
|
207
|
+
|
208
|
+
section.prepend(header)
|
209
|
+
.css({
|
210
|
+
"max-height": $(window.document).height(),
|
211
|
+
"max-width": $(window.document).width()
|
212
|
+
});
|
213
|
+
|
214
|
+
bindHeaderEventListeners();
|
215
|
+
}
|
216
|
+
},
|
217
|
+
|
218
|
+
show = function() {
|
219
|
+
$.Promise.new({
|
220
|
+
onAccomplish: function() {
|
221
|
+
modal.css("z-index", 0);
|
222
|
+
|
223
|
+
if (options.fadeIn) {
|
224
|
+
restartTransition(mask);
|
225
|
+
mask.css("transition", "opacity " +
|
226
|
+
options.fadeIn);
|
227
|
+
}
|
228
|
+
|
229
|
+
mask.removeClass("transparent");
|
230
|
+
section.show();
|
231
|
+
|
232
|
+
visible = self;
|
233
|
+
|
234
|
+
removeFromMinimized.call(this);
|
235
|
+
}
|
236
|
+
}, function(_accomplish) {
|
237
|
+
if (readyToShow) {
|
238
|
+
_accomplish();
|
239
|
+
}
|
240
|
+
});
|
241
|
+
},
|
242
|
+
|
243
|
+
// hide = function(animation = true) {
|
244
|
+
hide = function(animation) {
|
245
|
+
if (typeof animation != "boolean") {
|
246
|
+
animation = true;
|
247
|
+
}
|
248
|
+
|
249
|
+
section.hide();
|
250
|
+
|
251
|
+
restartTransition(mask);
|
252
|
+
if (animation) {
|
253
|
+
if (options.fadeOut) {
|
254
|
+
mask.css("transition", "opacity " +
|
255
|
+
options.fadeOut);
|
256
|
+
|
257
|
+
modal.css("z-index", -1,
|
258
|
+
maskTransitionDuration(mask));
|
259
|
+
}
|
260
|
+
}
|
261
|
+
mask.addClass("transparent");
|
262
|
+
addToMinimized.call(this);
|
263
|
+
},
|
264
|
+
|
265
|
+
close = function() {
|
266
|
+
section.hide();
|
267
|
+
|
268
|
+
restartTransition(mask);
|
269
|
+
if (options.fadeOut) {
|
270
|
+
mask.css("transition", "opacity " + options.fadeOut);
|
271
|
+
}
|
272
|
+
|
273
|
+
mask.addClass("transparent");
|
274
|
+
modal.remove(maskTransitionDuration(mask));
|
275
|
+
self.deleteSingleton();
|
276
|
+
},
|
277
|
+
|
278
|
+
observers = function(section, options) {
|
279
|
+
var
|
280
|
+
loadingContainerObserver,
|
281
|
+
count = 0,
|
282
|
+
|
283
|
+
callback = function(img) {
|
284
|
+
$(img).on("load", function() {
|
285
|
+
count += 1;
|
286
|
+
});
|
287
|
+
},
|
288
|
+
|
289
|
+
sectionObserveBlock = function() {
|
290
|
+
var
|
291
|
+
imgs = section.find("img");
|
292
|
+
|
293
|
+
if (imgs.some()) {
|
294
|
+
imgs.each(callback);
|
295
|
+
|
296
|
+
$.Promise.new({
|
297
|
+
onAccomplish: function() {
|
298
|
+
section.centralizeAt(window.document);
|
299
|
+
if (progress ||
|
300
|
+
progress === undefined) {
|
301
|
+
readyToShow = true;
|
302
|
+
show.call(self);
|
303
|
+
}
|
304
|
+
}
|
305
|
+
}, function(_accomplish) {
|
306
|
+
if (count == imgs.length || timesUp) {
|
307
|
+
_accomplish();
|
308
|
+
}
|
309
|
+
});
|
310
|
+
} else {
|
311
|
+
prependHeaderActions(section, options);
|
312
|
+
section.centralizeAt(window.document);
|
313
|
+
readyToShow = true;
|
314
|
+
if (options.complete && !progress) {
|
315
|
+
options.complete.call(self);
|
316
|
+
}
|
317
|
+
}
|
318
|
+
},
|
319
|
+
|
320
|
+
mainObserveBlock = function() {
|
321
|
+
var
|
322
|
+
imgs,
|
323
|
+
count = 0,
|
324
|
+
|
325
|
+
callback = function(img) {
|
326
|
+
$(img).on("load", function() {
|
327
|
+
count += 1;
|
328
|
+
});
|
329
|
+
};
|
330
|
+
|
331
|
+
loadingContainerObserver = this;
|
332
|
+
imgs = main.find("img");
|
333
|
+
|
334
|
+
if (imgs.some()) {
|
335
|
+
|
336
|
+
imgs.each(callback);
|
337
|
+
|
338
|
+
$.Promise.new({
|
339
|
+
onAccomplish: function() {
|
340
|
+
progress = false;
|
341
|
+
hide.call(self, false);
|
342
|
+
if (!timesUp) {
|
343
|
+
section.html(main);
|
344
|
+
}
|
345
|
+
prependHeaderActions(section, options);
|
346
|
+
section.centralizeAt(window.document);
|
347
|
+
ready = true;
|
348
|
+
readyToShow = true;
|
349
|
+
if (instanceShowWasCalled) {
|
350
|
+
show.call(self);
|
351
|
+
}
|
352
|
+
|
353
|
+
if (options.complete) {
|
354
|
+
options.complete.call(self);
|
355
|
+
}
|
356
|
+
}
|
357
|
+
},
|
358
|
+
function(_accomplish) {
|
359
|
+
progress = true;
|
360
|
+
if (count == imgs.length || timesUp) {
|
361
|
+
_accomplish();
|
362
|
+
}
|
363
|
+
});
|
364
|
+
// doesn't have imgs
|
365
|
+
} else {
|
366
|
+
progress = false;
|
367
|
+
hide.call(self, false);
|
368
|
+
if (!timesUp) {
|
369
|
+
section.html(main);
|
370
|
+
}
|
371
|
+
prependHeaderActions(section, options);
|
372
|
+
section.centralizeAt(window.document);
|
373
|
+
ready = true;
|
374
|
+
readyToShow = true;
|
375
|
+
}
|
376
|
+
|
377
|
+
this.disconnect();
|
378
|
+
};
|
379
|
+
|
380
|
+
section.observe(sectionObserveBlock);
|
381
|
+
|
382
|
+
main.observe(mainObserveBlock);
|
383
|
+
};
|
384
|
+
|
385
|
+
resolveArguments();
|
386
|
+
|
387
|
+
if (!(this instanceof ConstructorReference)) {
|
388
|
+
// debugger
|
389
|
+
// if (!ConstructorReference.instance) {
|
390
|
+
// return ConstructorReference.functionalSingleton(arguments);
|
391
|
+
// } else if (isMinimized.call(ConstructorReference.instance)) {
|
392
|
+
// ConstructorReference.instance.show();
|
393
|
+
// }
|
394
|
+
|
395
|
+
instance = Flyweight.Factory.exists(ConstructorReference,
|
396
|
+
arguments);
|
397
|
+
if (!instance) {
|
398
|
+
return Flyweight.Factory.new(ConstructorReference,
|
399
|
+
arguments);
|
400
|
+
} else if (isMinimized.call(instance)) {
|
401
|
+
self = instance;
|
402
|
+
show.call(self);
|
403
|
+
}
|
404
|
+
|
405
|
+
} else {
|
406
|
+
// global scope (public)
|
407
|
+
|
408
|
+
// this.hide = function(animation = true) {
|
409
|
+
this.hide = function(animation) {
|
410
|
+
if (typeof animation != "boolean") {
|
411
|
+
animation = true;
|
412
|
+
}
|
413
|
+
|
414
|
+
hide.call(self, animation);
|
415
|
+
|
416
|
+
return self;
|
417
|
+
};
|
418
|
+
|
419
|
+
this.show = function() {
|
420
|
+
show.call(self);
|
421
|
+
instanceShowWasCalled = true;
|
422
|
+
|
423
|
+
return self;
|
424
|
+
};
|
425
|
+
|
426
|
+
this.close = function() {
|
427
|
+
close.call(self);
|
428
|
+
return self;
|
429
|
+
};
|
430
|
+
|
431
|
+
this.content = function(content) {
|
432
|
+
var
|
433
|
+
node = $(content);
|
434
|
+
|
435
|
+
if (!node.some()) {
|
436
|
+
node = window.document.createTextNode(content);
|
437
|
+
}
|
438
|
+
|
439
|
+
hide.call(self, false);
|
440
|
+
loadingContainer.html(node);
|
441
|
+
return self;
|
442
|
+
};
|
443
|
+
|
444
|
+
create();
|
445
|
+
}
|
446
|
+
|
447
|
+
return self;
|
448
|
+
}
|
449
|
+
});
|
450
|
+
|
451
|
+
}(esPhinx, esPhinx.ui));
|