")
212 | .html(Settings.template);
213 |
214 | var perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0);
215 |
216 | $el.find('[role="bar"]').css({
217 | transition: 'all 0 linear',
218 | transform: 'translate3d('+perc+'%,0,0)'
219 | });
220 |
221 | if (!Settings.showSpinner)
222 | $el.find('[role="spinner"]').remove();
223 |
224 | $el.appendTo(document.body);
225 |
226 | return $el;
227 | };
228 |
229 | /**
230 | * Removes the element. Opposite of render().
231 | */
232 |
233 | NProgress.remove = function() {
234 | $('html').removeClass('nprogress-busy');
235 | $('#nprogress').remove();
236 | };
237 |
238 | /**
239 | * Checks if the progress bar is rendered.
240 | */
241 |
242 | NProgress.isRendered = function() {
243 | return ($("#nprogress").length > 0);
244 | };
245 |
246 | /**
247 | * Determine which positioning CSS rule to use.
248 | */
249 |
250 | NProgress.getPositioningCSS = function() {
251 | // Sniff on document.body.style
252 | var bodyStyle = document.body.style;
253 |
254 | // Sniff prefixes
255 | var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
256 | ('MozTransform' in bodyStyle) ? 'Moz' :
257 | ('msTransform' in bodyStyle) ? 'ms' :
258 | ('OTransform' in bodyStyle) ? 'O' : '';
259 |
260 | if (vendorPrefix + 'Perspective' in bodyStyle) {
261 | // Modern browsers with 3D support, e.g. Webkit, IE10
262 | return 'translate3d';
263 | } else if (vendorPrefix + 'Transform' in bodyStyle) {
264 | // Browsers without 3D support, e.g. IE9
265 | return 'translate';
266 | } else {
267 | // Browsers without translate() support, e.g. IE7-8
268 | return 'margin';
269 | }
270 | };
271 |
272 | /**
273 | * Helpers
274 | */
275 |
276 | function clamp(n, min, max) {
277 | if (n < min) return min;
278 | if (n > max) return max;
279 | return n;
280 | }
281 |
282 | /**
283 | * (Internal) converts a percentage (`0..1`) to a bar translateX
284 | * percentage (`-100%..0%`).
285 | */
286 |
287 | function toBarPerc(n) {
288 | return (-1 + n) * 100;
289 | }
290 |
291 |
292 | /**
293 | * (Internal) returns the correct CSS for changing the bar's
294 | * position given an n percentage, and speed and ease from Settings
295 | */
296 |
297 | function barPositionCSS(n, speed, ease) {
298 | var barCSS;
299 |
300 | if (Settings.positionUsing === 'translate3d') {
301 | barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
302 | } else if (Settings.positionUsing === 'translate') {
303 | barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
304 | } else {
305 | barCSS = { 'margin-left': toBarPerc(n)+'%' };
306 | }
307 |
308 | barCSS.transition = 'all '+speed+'ms '+ease;
309 |
310 | return barCSS;
311 | }
312 |
313 | return NProgress;
314 | });
315 |
316 |
--------------------------------------------------------------------------------
/app/lib/FileSaver.js:
--------------------------------------------------------------------------------
1 | /* FileSaver.js
2 | * A saveAs() FileSaver implementation.
3 | * 2013-01-23
4 | *
5 | * By Eli Grey, http://eligrey.com
6 | * License: X11/MIT
7 | * See LICENSE.md
8 | */
9 |
10 | /*global self */
11 | /*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
12 | plusplus: true */
13 |
14 | /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
15 |
16 | var saveAs = saveAs
17 | || (navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigator))
18 | || (function(view) {
19 | "use strict";
20 | var
21 | doc = view.document
22 | // only get URL when necessary in case BlobBuilder.js hasn't overridden it yet
23 | , get_URL = function() {
24 | return view.URL || view.webkitURL || view;
25 | }
26 | , URL = view.URL || view.webkitURL || view
27 | , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
28 | , can_use_save_link = !view.externalHost && "download" in save_link
29 | , click = function(node) {
30 | var event = doc.createEvent("MouseEvents");
31 | event.initMouseEvent(
32 | "click", true, false, view, 0, 0, 0, 0, 0
33 | , false, false, false, false, 0, null
34 | );
35 | node.dispatchEvent(event);
36 | process_deletion_queue(); //add by @kazaff for free the memory immediately
37 | }
38 | , webkit_req_fs = view.webkitRequestFileSystem
39 | , req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem
40 | , throw_outside = function (ex) {
41 | (view.setImmediate || view.setTimeout)(function() {
42 | throw ex;
43 | }, 0);
44 | }
45 | , force_saveable_type = "application/octet-stream"
46 | , fs_min_size = 0
47 | , deletion_queue = []
48 | , process_deletion_queue = function() {
49 | var i = deletion_queue.length;
50 | while (i--) {
51 | var file = deletion_queue[i];
52 | if (typeof file === "string") { // file is an object URL
53 | //original: URL.revokeObjectURL(file);
54 | //edit by @kazaff: be sure not happen "file not found"
55 | setTimeout((function(file){
56 | return function(){
57 | URL.revokeObjectURL(file);
58 | }
59 | })(file), 0);
60 | } else { // file is a File
61 | file.remove();
62 | }
63 | }
64 | deletion_queue.length = 0; // clear queue
65 | }
66 | , dispatch = function(filesaver, event_types, event) {
67 | event_types = [].concat(event_types);
68 | var i = event_types.length;
69 | while (i--) {
70 | var listener = filesaver["on" + event_types[i]];
71 | if (typeof listener === "function") {
72 | try {
73 | listener.call(filesaver, event || filesaver);
74 | } catch (ex) {
75 | throw_outside(ex);
76 | }
77 | }
78 | }
79 | }
80 | , FileSaver = function(blob, name) {
81 | // First try a.download, then web filesystem, then object URLs
82 | var
83 | filesaver = this
84 | , type = blob.type
85 | , blob_changed = false
86 | , object_url
87 | , target_view
88 | , get_object_url = function() {
89 | var object_url = get_URL().createObjectURL(blob);
90 | deletion_queue.push(object_url);
91 | return object_url;
92 | }
93 | , dispatch_all = function() {
94 | dispatch(filesaver, "writestart progress write writeend".split(" "));
95 | }
96 | // on any filesys errors revert to saving with object URLs
97 | , fs_error = function() {
98 | // don't create more object URLs than needed
99 | if (blob_changed || !object_url) {
100 | object_url = get_object_url(blob);
101 | }
102 | if (target_view) {
103 | target_view.location.href = object_url;
104 | } else {
105 | window.open(object_url, "_blank");
106 | }
107 | filesaver.readyState = filesaver.DONE;
108 | dispatch_all();
109 | }
110 | , abortable = function(func) {
111 | return function() {
112 | if (filesaver.readyState !== filesaver.DONE) {
113 | return func.apply(this, arguments);
114 | }
115 | };
116 | }
117 | , create_if_not_found = {create: true, exclusive: false}
118 | , slice
119 | ;
120 | filesaver.readyState = filesaver.INIT;
121 | if (!name) {
122 | name = "download";
123 | }
124 | if (can_use_save_link) {
125 | object_url = get_object_url(blob);
126 | save_link.href = object_url;
127 | save_link.download = name;
128 | click(save_link);
129 | filesaver.readyState = filesaver.DONE;
130 | dispatch_all();
131 | return;
132 | }
133 | // Object and web filesystem URLs have a problem saving in Google Chrome when
134 | // viewed in a tab, so I force save with application/octet-stream
135 | // http://code.google.com/p/chromium/issues/detail?id=91158
136 | if (view.chrome && type && type !== force_saveable_type) {
137 | slice = blob.slice || blob.webkitSlice;
138 | blob = slice.call(blob, 0, blob.size, force_saveable_type);
139 | blob_changed = true;
140 | }
141 | // Since I can't be sure that the guessed media type will trigger a download
142 | // in WebKit, I append .download to the filename.
143 | // https://bugs.webkit.org/show_bug.cgi?id=65440
144 | if (webkit_req_fs && name !== "download") {
145 | name += ".download";
146 | }
147 | if (type === force_saveable_type || webkit_req_fs) {
148 | target_view = view;
149 | }
150 | if (!req_fs) {
151 | fs_error();
152 | return;
153 | }
154 | fs_min_size += blob.size;
155 | req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) {
156 | fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) {
157 | var save = function() {
158 | dir.getFile(name, create_if_not_found, abortable(function(file) {
159 | file.createWriter(abortable(function(writer) {
160 | writer.onwriteend = function(event) {
161 | target_view.location.href = file.toURL();
162 | deletion_queue.push(file);
163 | filesaver.readyState = filesaver.DONE;
164 | dispatch(filesaver, "writeend", event);
165 | };
166 | writer.onerror = function() {
167 | var error = writer.error;
168 | if (error.code !== error.ABORT_ERR) {
169 | fs_error();
170 | }
171 | };
172 | "writestart progress write abort".split(" ").forEach(function(event) {
173 | writer["on" + event] = filesaver["on" + event];
174 | });
175 | writer.write(blob);
176 | filesaver.abort = function() {
177 | writer.abort();
178 | filesaver.readyState = filesaver.DONE;
179 | };
180 | filesaver.readyState = filesaver.WRITING;
181 | }), fs_error);
182 | }), fs_error);
183 | };
184 | dir.getFile(name, {create: false}, abortable(function(file) {
185 | // delete file if it already exists
186 | file.remove();
187 | save();
188 | }), abortable(function(ex) {
189 | if (ex.code === ex.NOT_FOUND_ERR) {
190 | save();
191 | } else {
192 | fs_error();
193 | }
194 | }));
195 | }), fs_error);
196 | }), fs_error);
197 | }
198 | , FS_proto = FileSaver.prototype
199 | , saveAs = function(blob, name) {
200 | return new FileSaver(blob, name);
201 | }
202 | ;
203 | FS_proto.abort = function() {
204 | var filesaver = this;
205 | filesaver.readyState = filesaver.DONE;
206 | dispatch(filesaver, "abort");
207 | };
208 | FS_proto.readyState = FS_proto.INIT = 0;
209 | FS_proto.WRITING = 1;
210 | FS_proto.DONE = 2;
211 |
212 | FS_proto.error =
213 | FS_proto.onwritestart =
214 | FS_proto.onprogress =
215 | FS_proto.onwrite =
216 | FS_proto.onabort =
217 | FS_proto.onerror =
218 | FS_proto.onwriteend =
219 | null;
220 |
221 | view.addEventListener("unload", process_deletion_queue, false);
222 | return saveAs;
223 | }(self));
224 |
225 | if (typeof module !== 'undefined') module.exports = saveAs;
--------------------------------------------------------------------------------
/app/css/datepicker.css:
--------------------------------------------------------------------------------
1 | /*!
2 | * Datepicker for Bootstrap
3 | *
4 | * Copyright 2012 Stefan Petre
5 | * Improvements by Andrew Rowls
6 | * Licensed under the Apache License v2.0
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | */
10 | .datepicker {
11 | padding: 4px;
12 | -webkit-border-radius: 4px;
13 | -moz-border-radius: 4px;
14 | border-radius: 4px;
15 | direction: ltr;
16 | /*.dow {
17 | border-top: 1px solid #ddd !important;
18 | }*/
19 |
20 | }
21 | .datepicker-inline {
22 | width: 220px;
23 | }
24 | .datepicker.datepicker-rtl {
25 | direction: rtl;
26 | }
27 | .datepicker.datepicker-rtl table tr td span {
28 | float: right;
29 | }
30 | .datepicker-dropdown {
31 | top: 0;
32 | left: 0;
33 | }
34 | .datepicker-dropdown:before {
35 | content: '';
36 | display: inline-block;
37 | border-left: 7px solid transparent;
38 | border-right: 7px solid transparent;
39 | border-bottom: 7px solid #ccc;
40 | border-bottom-color: rgba(0, 0, 0, 0.2);
41 | position: absolute;
42 | top: -7px;
43 | left: 6px;
44 | }
45 | .datepicker-dropdown:after {
46 | content: '';
47 | display: inline-block;
48 | border-left: 6px solid transparent;
49 | border-right: 6px solid transparent;
50 | border-bottom: 6px solid #ffffff;
51 | position: absolute;
52 | top: -6px;
53 | left: 7px;
54 | }
55 | .datepicker > div {
56 | display: none;
57 | }
58 | .datepicker.days div.datepicker-days {
59 | display: block;
60 | }
61 | .datepicker.months div.datepicker-months {
62 | display: block;
63 | }
64 | .datepicker.years div.datepicker-years {
65 | display: block;
66 | }
67 | .datepicker table {
68 | margin: 0;
69 | }
70 | .datepicker td,
71 | .datepicker th {
72 | text-align: center;
73 | width: 20px;
74 | height: 20px;
75 | -webkit-border-radius: 4px;
76 | -moz-border-radius: 4px;
77 | border-radius: 4px;
78 | border: none;
79 | }
80 | .table-striped .datepicker table tr td,
81 | .table-striped .datepicker table tr th {
82 | background-color: transparent;
83 | }
84 | .datepicker table tr td.day:hover {
85 | background: #eeeeee;
86 | cursor: pointer;
87 | }
88 | .datepicker table tr td.old,
89 | .datepicker table tr td.new {
90 | color: #999999;
91 | }
92 | .datepicker table tr td.disabled,
93 | .datepicker table tr td.disabled:hover {
94 | background: none;
95 | color: #999999;
96 | cursor: default;
97 | }
98 | .datepicker table tr td.today,
99 | .datepicker table tr td.today:hover,
100 | .datepicker table tr td.today.disabled,
101 | .datepicker table tr td.today.disabled:hover {
102 | background-color: #fde19a;
103 | background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a);
104 | background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a);
105 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a));
106 | background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a);
107 | background-image: -o-linear-gradient(top, #fdd49a, #fdf59a);
108 | background-image: linear-gradient(top, #fdd49a, #fdf59a);
109 | background-repeat: repeat-x;
110 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0);
111 | border-color: #fdf59a #fdf59a #fbed50;
112 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
113 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
114 | color: #000 !important;
115 | }
116 | .datepicker table tr td.today:hover,
117 | .datepicker table tr td.today:hover:hover,
118 | .datepicker table tr td.today.disabled:hover,
119 | .datepicker table tr td.today.disabled:hover:hover,
120 | .datepicker table tr td.today:active,
121 | .datepicker table tr td.today:hover:active,
122 | .datepicker table tr td.today.disabled:active,
123 | .datepicker table tr td.today.disabled:hover:active,
124 | .datepicker table tr td.today.active,
125 | .datepicker table tr td.today:hover.active,
126 | .datepicker table tr td.today.disabled.active,
127 | .datepicker table tr td.today.disabled:hover.active,
128 | .datepicker table tr td.today.disabled,
129 | .datepicker table tr td.today:hover.disabled,
130 | .datepicker table tr td.today.disabled.disabled,
131 | .datepicker table tr td.today.disabled:hover.disabled,
132 | .datepicker table tr td.today[disabled],
133 | .datepicker table tr td.today:hover[disabled],
134 | .datepicker table tr td.today.disabled[disabled],
135 | .datepicker table tr td.today.disabled:hover[disabled] {
136 | background-color: #fdf59a;
137 | }
138 | .datepicker table tr td.today:active,
139 | .datepicker table tr td.today:hover:active,
140 | .datepicker table tr td.today.disabled:active,
141 | .datepicker table tr td.today.disabled:hover:active,
142 | .datepicker table tr td.today.active,
143 | .datepicker table tr td.today:hover.active,
144 | .datepicker table tr td.today.disabled.active,
145 | .datepicker table tr td.today.disabled:hover.active {
146 | background-color: #fbf069 \9;
147 | }
148 | .datepicker table tr td.active,
149 | .datepicker table tr td.active:hover,
150 | .datepicker table tr td.active.disabled,
151 | .datepicker table tr td.active.disabled:hover {
152 | background-color: #006dcc;
153 | background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
154 | background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
155 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
156 | background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
157 | background-image: -o-linear-gradient(top, #0088cc, #0044cc);
158 | background-image: linear-gradient(top, #0088cc, #0044cc);
159 | background-repeat: repeat-x;
160 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
161 | border-color: #0044cc #0044cc #002a80;
162 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
163 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
164 | color: #fff;
165 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
166 | }
167 | .datepicker table tr td.active:hover,
168 | .datepicker table tr td.active:hover:hover,
169 | .datepicker table tr td.active.disabled:hover,
170 | .datepicker table tr td.active.disabled:hover:hover,
171 | .datepicker table tr td.active:active,
172 | .datepicker table tr td.active:hover:active,
173 | .datepicker table tr td.active.disabled:active,
174 | .datepicker table tr td.active.disabled:hover:active,
175 | .datepicker table tr td.active.active,
176 | .datepicker table tr td.active:hover.active,
177 | .datepicker table tr td.active.disabled.active,
178 | .datepicker table tr td.active.disabled:hover.active,
179 | .datepicker table tr td.active.disabled,
180 | .datepicker table tr td.active:hover.disabled,
181 | .datepicker table tr td.active.disabled.disabled,
182 | .datepicker table tr td.active.disabled:hover.disabled,
183 | .datepicker table tr td.active[disabled],
184 | .datepicker table tr td.active:hover[disabled],
185 | .datepicker table tr td.active.disabled[disabled],
186 | .datepicker table tr td.active.disabled:hover[disabled] {
187 | background-color: #0044cc;
188 | }
189 | .datepicker table tr td.active:active,
190 | .datepicker table tr td.active:hover:active,
191 | .datepicker table tr td.active.disabled:active,
192 | .datepicker table tr td.active.disabled:hover:active,
193 | .datepicker table tr td.active.active,
194 | .datepicker table tr td.active:hover.active,
195 | .datepicker table tr td.active.disabled.active,
196 | .datepicker table tr td.active.disabled:hover.active {
197 | background-color: #003399 \9;
198 | }
199 | .datepicker table tr td span {
200 | display: block;
201 | width: 23%;
202 | height: 54px;
203 | line-height: 54px;
204 | float: left;
205 | margin: 1%;
206 | cursor: pointer;
207 | -webkit-border-radius: 4px;
208 | -moz-border-radius: 4px;
209 | border-radius: 4px;
210 | }
211 | .datepicker table tr td span:hover {
212 | background: #eeeeee;
213 | }
214 | .datepicker table tr td span.disabled,
215 | .datepicker table tr td span.disabled:hover {
216 | background: none;
217 | color: #999999;
218 | cursor: default;
219 | }
220 | .datepicker table tr td span.active,
221 | .datepicker table tr td span.active:hover,
222 | .datepicker table tr td span.active.disabled,
223 | .datepicker table tr td span.active.disabled:hover {
224 | background-color: #006dcc;
225 | background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
226 | background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
227 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
228 | background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
229 | background-image: -o-linear-gradient(top, #0088cc, #0044cc);
230 | background-image: linear-gradient(top, #0088cc, #0044cc);
231 | background-repeat: repeat-x;
232 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
233 | border-color: #0044cc #0044cc #002a80;
234 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
235 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
236 | color: #fff;
237 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
238 | }
239 | .datepicker table tr td span.active:hover,
240 | .datepicker table tr td span.active:hover:hover,
241 | .datepicker table tr td span.active.disabled:hover,
242 | .datepicker table tr td span.active.disabled:hover:hover,
243 | .datepicker table tr td span.active:active,
244 | .datepicker table tr td span.active:hover:active,
245 | .datepicker table tr td span.active.disabled:active,
246 | .datepicker table tr td span.active.disabled:hover:active,
247 | .datepicker table tr td span.active.active,
248 | .datepicker table tr td span.active:hover.active,
249 | .datepicker table tr td span.active.disabled.active,
250 | .datepicker table tr td span.active.disabled:hover.active,
251 | .datepicker table tr td span.active.disabled,
252 | .datepicker table tr td span.active:hover.disabled,
253 | .datepicker table tr td span.active.disabled.disabled,
254 | .datepicker table tr td span.active.disabled:hover.disabled,
255 | .datepicker table tr td span.active[disabled],
256 | .datepicker table tr td span.active:hover[disabled],
257 | .datepicker table tr td span.active.disabled[disabled],
258 | .datepicker table tr td span.active.disabled:hover[disabled] {
259 | background-color: #0044cc;
260 | }
261 | .datepicker table tr td span.active:active,
262 | .datepicker table tr td span.active:hover:active,
263 | .datepicker table tr td span.active.disabled:active,
264 | .datepicker table tr td span.active.disabled:hover:active,
265 | .datepicker table tr td span.active.active,
266 | .datepicker table tr td span.active:hover.active,
267 | .datepicker table tr td span.active.disabled.active,
268 | .datepicker table tr td span.active.disabled:hover.active {
269 | background-color: #003399 \9;
270 | }
271 | .datepicker table tr td span.old {
272 | color: #999999;
273 | }
274 | .datepicker th.switch {
275 | width: 145px;
276 | }
277 | .datepicker thead tr:first-child th,
278 | .datepicker tfoot tr:first-child th {
279 | cursor: pointer;
280 | }
281 | .datepicker thead tr:first-child th:hover,
282 | .datepicker tfoot tr:first-child th:hover {
283 | background: #eeeeee;
284 | }
285 | .datepicker .cw {
286 | font-size: 10px;
287 | width: 12px;
288 | padding: 0 2px 0 5px;
289 | vertical-align: middle;
290 | }
291 | .datepicker thead tr:first-child th.cw {
292 | cursor: default;
293 | background-color: transparent;
294 | }
295 | .input-append.date .add-on i,
296 | .input-prepend.date .add-on i {
297 | display: block;
298 | cursor: pointer;
299 | width: 16px;
300 | height: 16px;
301 | }
302 |
--------------------------------------------------------------------------------
/app/lib/jquery/jquery.gritter.min.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Gritter for jQuery
3 | * http://www.boedesign.com/
4 | *
5 | * Copyright (c) 2012 Jordan Boesch
6 | * Dual licensed under the MIT and GPL licenses.
7 | *
8 | * Date: February 24, 2012
9 | * Version: 1.7.4
10 | */
11 |
12 | (function($){
13 |
14 | /**
15 | * Set it up as an object under the jQuery namespace
16 | */
17 | $.gritter = {};
18 |
19 | /**
20 | * Set up global options that the user can over-ride
21 | */
22 | $.gritter.options = {
23 | position: '',
24 | class_name: '', // could be set to 'gritter-light' to use white notifications
25 | fade_in_speed: 'medium', // how fast notifications fade in
26 | fade_out_speed: 1000, // how fast the notices fade out
27 | time: 6000 // hang on the screen for...
28 | }
29 |
30 | /**
31 | * Add a gritter notification to the screen
32 | * @see Gritter#add();
33 | */
34 | $.gritter.add = function(params){
35 |
36 | try {
37 | return Gritter.add(params || {});
38 | } catch(e) {
39 |
40 | var err = 'Gritter Error: ' + e;
41 | (typeof(console) != 'undefined' && console.error) ?
42 | console.error(err, params) :
43 | alert(err);
44 |
45 | }
46 |
47 | }
48 |
49 | /**
50 | * Remove a gritter notification from the screen
51 | * @see Gritter#removeSpecific();
52 | */
53 | $.gritter.remove = function(id, params){
54 | Gritter.removeSpecific(id, params || {});
55 | }
56 |
57 | /**
58 | * Remove all notifications
59 | * @see Gritter#stop();
60 | */
61 | $.gritter.removeAll = function(params){
62 | Gritter.stop(params || {});
63 | }
64 |
65 | /**
66 | * Big fat Gritter object
67 | * @constructor (not really since its object literal)
68 | */
69 | var Gritter = {
70 |
71 | // Public - options to over-ride with $.gritter.options in "add"
72 | position: '',
73 | fade_in_speed: '',
74 | fade_out_speed: '',
75 | time: '',
76 |
77 | // Private - no touchy the private parts
78 | _custom_timer: 0,
79 | _item_count: 0,
80 | _is_setup: 0,
81 | _tpl_close: '
X',
82 | _tpl_title: '
[[title]]',
83 | _tpl_item: '
',
84 | _tpl_wrap: '
',
85 |
86 | /**
87 | * Add a gritter notification to the screen
88 | * @param {Object} params The object that contains all the options for drawing the notification
89 | * @return {Integer} The specific numeric id to that gritter notification
90 | */
91 | add: function(params){
92 | // Handle straight text
93 | if(typeof(params) == 'string'){
94 | params = {text:params};
95 | }
96 |
97 | // We might have some issues if we don't have a title or text!
98 | if(params.text === null){
99 | throw 'You must supply "text" parameter.';
100 | }
101 |
102 | // Check the options and set them once
103 | if(!this._is_setup){
104 | this._runSetup();
105 | }
106 |
107 | // Basics
108 | var title = params.title,
109 | text = params.text,
110 | image = params.image || '',
111 | sticky = params.sticky || false,
112 | item_class = params.class_name || $.gritter.options.class_name,
113 | position = $.gritter.options.position,
114 | time_alive = params.time || '';
115 |
116 | this._verifyWrapper();
117 |
118 | this._item_count++;
119 | var number = this._item_count,
120 | tmp = this._tpl_item;
121 |
122 | // Assign callbacks
123 | $(['before_open', 'after_open', 'before_close', 'after_close']).each(function(i, val){
124 | Gritter['_' + val + '_' + number] = ($.isFunction(params[val])) ? params[val] : function(){}
125 | });
126 |
127 | // Reset
128 | this._custom_timer = 0;
129 |
130 | // A custom fade time set
131 | if(time_alive){
132 | this._custom_timer = time_alive;
133 | }
134 |
135 | var image_str = (image != '') ? '

' : '',
136 | class_name = (image != '') ? 'gritter-with-image' : 'gritter-without-image';
137 |
138 | // String replacements on the template
139 | if(title){
140 | title = this._str_replace('[[title]]',title,this._tpl_title);
141 | }else{
142 | title = '';
143 | }
144 |
145 | tmp = this._str_replace(
146 | ['[[title]]', '[[text]]', '[[close]]', '[[image]]', '[[number]]', '[[class_name]]', '[[item_class]]'],
147 | [title, text, this._tpl_close, image_str, this._item_count, class_name, item_class], tmp
148 | );
149 |
150 | // If it's false, don't show another gritter message
151 | if(this['_before_open_' + number]() === false){
152 | return false;
153 | }
154 |
155 | $('#gritter-notice-wrapper').addClass(position).append(tmp);
156 |
157 | var item = $('#gritter-item-' + this._item_count);
158 |
159 | item.fadeIn(this.fade_in_speed, function(){
160 | Gritter['_after_open_' + number]($(this));
161 | });
162 |
163 | if(!sticky){
164 | this._setFadeTimer(item, number);
165 | }
166 |
167 | // Bind the hover/unhover states
168 | $(item).bind('mouseenter mouseleave', function(event){
169 | if(event.type == 'mouseenter'){
170 | if(!sticky){
171 | Gritter._restoreItemIfFading($(this), number);
172 | }
173 | }
174 | else {
175 | if(!sticky){
176 | Gritter._setFadeTimer($(this), number);
177 | }
178 | }
179 | Gritter._hoverState($(this), event.type);
180 | });
181 |
182 | // Clicking (X) makes the perdy thing close
183 | $(item).find('.gritter-close').click(function(){
184 | var before_close = ($.isFunction(params.before_close)) ? params.before_close : function(){};
185 | var wrap = $('#gritter-notice-wrapper');
186 | before_close(wrap);
187 |
188 | Gritter.removeSpecific(number, {}, null, true);
189 | return false;
190 | });
191 |
192 | return number;
193 |
194 | },
195 |
196 | /**
197 | * If we don't have any more gritter notifications, get rid of the wrapper using this check
198 | * @private
199 | * @param {Integer} unique_id The ID of the element that was just deleted, use it for a callback
200 | * @param {Object} e The jQuery element that we're going to perform the remove() action on
201 | * @param {Boolean} manual_close Did we close the gritter dialog with the (X) button
202 | */
203 | _countRemoveWrapper: function(unique_id, e, manual_close){
204 |
205 | // Remove it then run the callback function
206 | e.remove();
207 | this['_after_close_' + unique_id](e, manual_close);
208 |
209 | // Check if the wrapper is empty, if it is.. remove the wrapper
210 | if($('.gritter-item-wrapper').length == 0){
211 | $('#gritter-notice-wrapper').remove();
212 | }
213 |
214 | },
215 |
216 | /**
217 | * Fade out an element after it's been on the screen for x amount of time
218 | * @private
219 | * @param {Object} e The jQuery element to get rid of
220 | * @param {Integer} unique_id The id of the element to remove
221 | * @param {Object} params An optional list of params to set fade speeds etc.
222 | * @param {Boolean} unbind_events Unbind the mouseenter/mouseleave events if they click (X)
223 | */
224 | _fade: function(e, unique_id, params, unbind_events){
225 |
226 | var params = params || {},
227 | fade = (typeof(params.fade) != 'undefined') ? params.fade : true,
228 | fade_out_speed = params.speed || this.fade_out_speed,
229 | manual_close = unbind_events;
230 |
231 | //this['_before_close_' + unique_id](e, manual_close);
232 |
233 | // If this is true, then we are coming from clicking the (X)
234 | if(unbind_events){
235 | e.unbind('mouseenter mouseleave');
236 | }
237 |
238 | // Fade it out or remove it
239 | if(fade){
240 |
241 | e.animate({
242 | opacity: 0
243 | }, fade_out_speed, function(){
244 | e.animate({ height: 0 }, 300, function(){
245 | Gritter._countRemoveWrapper(unique_id, e, manual_close);
246 | })
247 | })
248 |
249 | }
250 | else {
251 |
252 | this._countRemoveWrapper(unique_id, e);
253 |
254 | }
255 |
256 | },
257 |
258 | /**
259 | * Perform actions based on the type of bind (mouseenter, mouseleave)
260 | * @private
261 | * @param {Object} e The jQuery element
262 | * @param {String} type The type of action we're performing: mouseenter or mouseleave
263 | */
264 | _hoverState: function(e, type){
265 |
266 | // Change the border styles and add the (X) close button when you hover
267 | if(type == 'mouseenter'){
268 |
269 | e.addClass('hover');
270 |
271 | // Show close button
272 | e.find('.gritter-close').show();
273 |
274 | }
275 | // Remove the border styles and hide (X) close button when you mouse out
276 | else {
277 |
278 | e.removeClass('hover');
279 |
280 | // Hide close button
281 | e.find('.gritter-close').hide();
282 |
283 | }
284 |
285 | },
286 |
287 | /**
288 | * Remove a specific notification based on an ID
289 | * @param {Integer} unique_id The ID used to delete a specific notification
290 | * @param {Object} params A set of options passed in to determine how to get rid of it
291 | * @param {Object} e The jQuery element that we're "fading" then removing
292 | * @param {Boolean} unbind_events If we clicked on the (X) we set this to true to unbind mouseenter/mouseleave
293 | */
294 | removeSpecific: function(unique_id, params, e, unbind_events){
295 |
296 | if(!e){
297 | var e = $('#gritter-item-' + unique_id);
298 | }
299 |
300 | // We set the fourth param to let the _fade function know to
301 | // unbind the "mouseleave" event. Once you click (X) there's no going back!
302 | this._fade(e, unique_id, params || {}, unbind_events);
303 |
304 | },
305 |
306 | /**
307 | * If the item is fading out and we hover over it, restore it!
308 | * @private
309 | * @param {Object} e The HTML element to remove
310 | * @param {Integer} unique_id The ID of the element
311 | */
312 | _restoreItemIfFading: function(e, unique_id){
313 |
314 | clearTimeout(this['_int_id_' + unique_id]);
315 | e.stop().css({ opacity: '', height: '' });
316 |
317 | },
318 |
319 | /**
320 | * Setup the global options - only once
321 | * @private
322 | */
323 | _runSetup: function(){
324 |
325 | for(opt in $.gritter.options){
326 | this[opt] = $.gritter.options[opt];
327 | }
328 | this._is_setup = 1;
329 |
330 | },
331 |
332 | /**
333 | * Set the notification to fade out after a certain amount of time
334 | * @private
335 | * @param {Object} item The HTML element we're dealing with
336 | * @param {Integer} unique_id The ID of the element
337 | */
338 | _setFadeTimer: function(e, unique_id){
339 |
340 | var timer_str = (this._custom_timer) ? this._custom_timer : this.time;
341 | this['_int_id_' + unique_id] = setTimeout(function(){
342 | Gritter._fade(e, unique_id);
343 | }, timer_str);
344 |
345 | },
346 |
347 | /**
348 | * Bring everything to a halt
349 | * @param {Object} params A list of callback functions to pass when all notifications are removed
350 | */
351 | stop: function(params){
352 |
353 | // callbacks (if passed)
354 | //var before_close = ($.isFunction(params.before_close)) ? params.before_close : function(){};
355 | var after_close = ($.isFunction(params.after_close)) ? params.after_close : function(){};
356 |
357 | var wrap = $('#gritter-notice-wrapper');
358 | //before_close(wrap);
359 | wrap.fadeOut(function(){
360 | $(this).remove();
361 | after_close();
362 | });
363 |
364 | },
365 |
366 | /**
367 | * An extremely handy PHP function ported to JS, works well for templating
368 | * @private
369 | * @param {String/Array} search A list of things to search for
370 | * @param {String/Array} replace A list of things to replace the searches with
371 | * @return {String} sa The output
372 | */
373 | _str_replace: function(search, replace, subject, count){
374 |
375 | var i = 0, j = 0, temp = '', repl = '', sl = 0, fl = 0,
376 | f = [].concat(search),
377 | r = [].concat(replace),
378 | s = subject,
379 | ra = r instanceof Array, sa = s instanceof Array;
380 | s = [].concat(s);
381 |
382 | if(count){
383 | this.window[count] = 0;
384 | }
385 |
386 | for(i = 0, sl = s.length; i < sl; i++){
387 |
388 | if(s[i] === ''){
389 | continue;
390 | }
391 |
392 | for (j = 0, fl = f.length; j < fl; j++){
393 |
394 | temp = s[i] + '';
395 | repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0];
396 | s[i] = (temp).split(f[j]).join(repl);
397 |
398 | if(count && s[i] !== temp){
399 | this.window[count] += (temp.length-s[i].length) / f[j].length;
400 | }
401 |
402 | }
403 | }
404 |
405 | return sa ? s : s[0];
406 |
407 | },
408 |
409 | /**
410 | * A check to make sure we have something to wrap our notices with
411 | * @private
412 | */
413 | _verifyWrapper: function(){
414 |
415 | if($('#gritter-notice-wrapper').length == 0){
416 | $('body').append(this._tpl_wrap);
417 | }
418 |
419 | }
420 |
421 | }
422 |
423 | })(jQuery);
424 |
--------------------------------------------------------------------------------
/app/lib/modernizr.js:
--------------------------------------------------------------------------------
1 | /* Modernizr 2.7.1 (Custom Build) | MIT & BSD
2 | * Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-flexboxlegacy-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-shiv-cssclasses-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
3 | */
4 | ;window.Modernizr=function(a,b,c){function B(a){j.cssText=a}function C(a,b){return B(n.join(a+";")+(b||""))}function D(a,b){return typeof a===b}function E(a,b){return!!~(""+a).indexOf(b)}function F(a,b){for(var d in a){var e=a[d];if(!E(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function G(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:D(f,"function")?f.bind(d||b):f}return!1}function H(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+p.join(d+" ")+d).split(" ");return D(b,"string")||D(b,"undefined")?F(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),G(e,b,c))}function I(){e.input=function(c){for(var d=0,e=c.length;d
',a,""].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},y=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=D(e[d],"function"),D(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),z={}.hasOwnProperty,A;!D(z,"undefined")&&!D(z.call,"undefined")?A=function(a,b){return z.call(a,b)}:A=function(a,b){return b in a&&D(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=v.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(v.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(v.call(arguments)))};return e}),r.flexbox=function(){return H("flexWrap")},r.flexboxlegacy=function(){return H("boxDirection")},r.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},r.canvastext=function(){return!!e.canvas&&!!D(b.createElement("canvas").getContext("2d").fillText,"function")},r.postmessage=function(){return!!a.postMessage},r.websqldatabase=function(){return!!a.openDatabase},r.indexedDB=function(){return!!H("indexedDB",a)},r.hashchange=function(){return y("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},r.history=function(){return!!a.history&&!!history.pushState},r.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},r.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},r.rgba=function(){return B("background-color:rgba(150,255,150,.5)"),E(j.backgroundColor,"rgba")},r.hsla=function(){return B("background-color:hsla(120,40%,100%,.5)"),E(j.backgroundColor,"rgba")||E(j.backgroundColor,"hsla")},r.multiplebgs=function(){return B("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},r.backgroundsize=function(){return H("backgroundSize")},r.borderimage=function(){return H("borderImage")},r.borderradius=function(){return H("borderRadius")},r.boxshadow=function(){return H("boxShadow")},r.textshadow=function(){return b.createElement("div").style.textShadow===""},r.opacity=function(){return C("opacity:.55"),/^0.55$/.test(j.opacity)},r.cssanimations=function(){return H("animationName")},r.csscolumns=function(){return H("columnCount")},r.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return B((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),E(j.backgroundImage,"gradient")},r.cssreflections=function(){return H("boxReflect")},r.csstransforms=function(){return!!H("transform")},r.csstransforms3d=function(){var a=!!H("perspective");return a&&"webkitPerspective"in g.style&&x("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},r.csstransitions=function(){return H("transition")},r.fontface=function(){var a;return x('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&g.indexOf(d.split(" ")[0])===0}),a},r.generatedcontent=function(){var a;return x(["#",h,"{font:0/0 a}#",h,':after{content:"',l,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a},r.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},r.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},r.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}},r.sessionstorage=function(){try{return sessionStorage.setItem(h,h),sessionStorage.removeItem(h),!0}catch(a){return!1}},r.webworkers=function(){return!!a.Worker},r.applicationcache=function(){return!!a.applicationCache};for(var J in r)A(r,J)&&(w=J.toLowerCase(),e[w]=r[J](),u.push((e[w]?"":"no-")+w));return e.input||I(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)A(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},B(""),i=k=null,function(a,b){function l(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function m(){var a=s.elements;return typeof a=="string"?a.split(" "):a}function n(a){var b=j[a[h]];return b||(b={},i++,a[h]=i,j[i]=b),b}function o(a,c,d){c||(c=b);if(k)return c.createElement(a);d||(d=n(c));var g;return d.cache[a]?g=d.cache[a].cloneNode():f.test(a)?g=(d.cache[a]=d.createElem(a)).cloneNode():g=d.createElem(a),g.canHaveChildren&&!e.test(a)&&!g.tagUrn?d.frag.appendChild(g):g}function p(a,c){a||(a=b);if(k)return a.createDocumentFragment();c=c||n(a);var d=c.frag.cloneNode(),e=0,f=m(),g=f.length;for(;e",g="hidden"in a,k=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){g=!0,k=!0}})();var s={elements:d.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:c,shivCSS:d.shivCSS!==!1,supportsUnknownElements:k,shivMethods:d.shivMethods!==!1,type:"default",shivDocument:r,createElement:o,createDocumentFragment:p};a.html5=s,r(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.hasEvent=y,e.testProp=function(a){return F([a])},e.testAllProps=H,e.testStyles=x,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+u.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;fthis.depCount&&!this.defined){if(H(m)){if(this.events.error&&this.map.isDefine||j.onError!==aa)try{d=i.execCb(c,m,b,d)}catch(e){a=e}else d=i.execCb(c,m,b,d);this.map.isDefine&&((b=this.module)&&void 0!==b.exports&&b.exports!==
19 | this.exports?d=b.exports:void 0===d&&this.usingExports&&(d=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",v(this.error=a)}else d=m;this.exports=d;if(this.map.isDefine&&!this.ignore&&(r[c]=d,j.onResourceLoad))j.onResourceLoad(i,this.map,this.depMaps);x(c);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=
20 | !0)}}else this.fetch()}},callPlugin:function(){var a=this.map,b=a.id,e=n(a.prefix);this.depMaps.push(e);s(e,"defined",u(this,function(d){var m,e;e=this.map.name;var g=this.map.parentMap?this.map.parentMap.name:null,h=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(d.normalize&&(e=d.normalize(e,function(a){return c(a,g,!0)})||""),d=n(a.prefix+"!"+e,this.map.parentMap),s(d,"defined",u(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),
21 | e=l(p,d.id)){this.depMaps.push(d);if(this.events.error)e.on("error",u(this,function(a){this.emit("error",a)}));e.enable()}}else m=u(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),m.error=u(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];F(p,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&x(a.map.id)});v(a)}),m.fromText=u(this,function(d,c){var e=a.name,g=n(e),B=O;c&&(d=c);B&&(O=!1);q(g);t(k.config,b)&&(k.config[e]=k.config[b]);try{j.exec(d)}catch(ca){return v(A("fromtexteval",
22 | "fromText eval for "+b+" failed: "+ca,ca,[b]))}B&&(O=!0);this.depMaps.push(g);i.completeLoad(e);h([e],m)}),d.load(a.name,h,m,k)}));i.enable(e,this);this.pluginMaps[e.id]=e},enable:function(){T[this.map.id]=this;this.enabling=this.enabled=!0;y(this.depMaps,u(this,function(a,b){var c,d;if("string"===typeof a){a=n(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=l(N,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;s(a,"defined",u(this,function(a){this.defineDep(b,
23 | a);this.check()}));this.errback&&s(a,"error",u(this,this.errback))}c=a.id;d=p[c];!t(N,c)&&(d&&!d.enabled)&&i.enable(a,this)}));F(this.pluginMaps,u(this,function(a){var b=l(p,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){y(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:k,contextName:b,registry:p,defined:r,urlFetched:S,defQueue:G,Module:X,makeModuleMap:n,
24 | nextTick:j.nextTick,onError:v,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=k.pkgs,c=k.shim,d={paths:!0,config:!0,map:!0};F(a,function(a,b){d[b]?"map"===b?(k.map||(k.map={}),Q(k[b],a,!0,!0)):Q(k[b],a,!0):k[b]=a});a.shim&&(F(a.shim,function(a,b){I(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);c[b]=a}),k.shim=c);a.packages&&(y(a.packages,function(a){a="string"===typeof a?{name:a}:a;b[a.name]={name:a.name,
25 | location:a.location||a.name,main:(a.main||"main").replace(ja,"").replace(ea,"")}}),k.pkgs=b);F(p,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=n(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(Z,arguments));return b||a.exports&&ba(a.exports)}},makeRequire:function(a,f){function h(d,c,e){var g,k;f.enableBuildCallback&&(c&&H(c))&&(c.__requireJsBuild=!0);if("string"===typeof d){if(H(c))return v(A("requireargs",
26 | "Invalid require call"),e);if(a&&t(N,d))return N[d](p[a.id]);if(j.get)return j.get(i,d,a,h);g=n(d,a,!1,!0);g=g.id;return!t(r,g)?v(A("notloaded",'Module name "'+g+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):r[g]}K();i.nextTick(function(){K();k=q(n(null,a));k.skipMap=f.skipMap;k.init(d,c,e,{enabled:!0});C()});return h}f=f||{};Q(h,{isBrowser:z,toUrl:function(b){var f,e=b.lastIndexOf("."),g=b.split("/")[0];if(-1!==e&&(!("."===g||".."===g)||1h.attachEvent.toString().indexOf("[native code"))&&!W?(O=!0,h.attachEvent("onreadystatechange",b.onScriptLoad)):(h.addEventListener("load",b.onScriptLoad,!1),h.addEventListener("error",
34 | b.onScriptError,!1)),h.src=e,K=h,C?x.insertBefore(h,C):x.appendChild(h),K=null,h;if(da)try{importScripts(e),b.completeLoad(c)}catch(l){b.onError(A("importscripts","importScripts failed for "+c+" at "+e,l,[c]))}};z&&!s.skipDataMain&&M(document.getElementsByTagName("script"),function(b){x||(x=b.parentNode);if(J=b.getAttribute("data-main"))return q=J,s.baseUrl||(D=q.split("/"),q=D.pop(),fa=D.length?D.join("/")+"/":"./",s.baseUrl=fa),q=q.replace(ea,""),j.jsExtRegExp.test(q)&&(q=J),s.deps=s.deps?s.deps.concat(q):
35 | [q],!0});define=function(b,c,e){var h,j;"string"!==typeof b&&(e=c,c=b,b=null);I(c)||(e=c,c=null);!c&&H(e)&&(c=[],e.length&&(e.toString().replace(la,"").replace(ma,function(b,e){c.push(e)}),c=(1===e.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(h=K))P&&"interactive"===P.readyState||M(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),h=P;h&&(b||(b=h.getAttribute("data-requiremodule")),j=E[h.getAttribute("data-requirecontext")])}(j?
36 | j.defQueue:R).push([b,c,e])};define.amd={jQuery:!0};j.exec=function(b){return eval(b)};j(s)}})(this);
--------------------------------------------------------------------------------
/app/lib/angularJS/angular-strap.js:
--------------------------------------------------------------------------------
1 | /**
2 | * AngularStrap - Twitter Bootstrap directives for AngularJS
3 | * @version v0.7.5 - 2013-07-21
4 | * @link http://mgcrea.github.com/angular-strap
5 | * @author Olivier Louvignes
6 | * @license MIT License, http://www.opensource.org/licenses/MIT
7 | */
8 | angular.module("$strap.config",[]).value("$strapConfig",{}),angular.module("$strap.filters",["$strap.config"]),angular.module("$strap.directives",["$strap.config"]),angular.module("$strap",["$strap.filters","$strap.directives","$strap.config"]),angular.module("$strap.directives").directive("bsAlert",["$parse","$timeout","$compile",function(t,e,n){return{restrict:"A",link:function(a,i,o){var r=t(o.bsAlert),s=(r.assign,r(a)),l=function(t){e(function(){i.alert("close")},1*t)};o.bsAlert?a.$watch(o.bsAlert,function(t,e){s=t,i.html((t.title?""+t.title+" ":"")+t.content||""),t.closed&&i.hide(),n(i.contents())(a),(t.type||e.type)&&(e.type&&i.removeClass("alert-"+e.type),t.type&&i.addClass("alert-"+t.type)),angular.isDefined(t.closeAfter)?l(t.closeAfter):o.closeAfter&&l(o.closeAfter),(angular.isUndefined(o.closeButton)||"0"!==o.closeButton&&"false"!==o.closeButton)&&i.prepend('')},!0):((angular.isUndefined(o.closeButton)||"0"!==o.closeButton&&"false"!==o.closeButton)&&i.prepend(''),o.closeAfter&&l(o.closeAfter)),i.addClass("alert").alert(),i.hasClass("fade")&&(i.removeClass("in"),setTimeout(function(){i.addClass("in")}));var u=o.ngRepeat&&o.ngRepeat.split(" in ").pop();i.on("close",function(t){var e;u?(t.preventDefault(),i.removeClass("in"),e=function(){i.trigger("closed"),a.$parent&&a.$parent.$apply(function(){for(var t=u.split("."),e=a.$parent,n=0;t.length>n;++n)e&&(e=e[t[n]]);e&&e.splice(a.$index,1)})},$.support.transition&&i.hasClass("fade")?i.on($.support.transition.end,e):e()):s&&(t.preventDefault(),i.removeClass("in"),e=function(){i.trigger("closed"),a.$apply(function(){s.closed=!0})},$.support.transition&&i.hasClass("fade")?i.on($.support.transition.end,e):e())})}}}]),angular.module("$strap.directives").directive("bsButton",["$parse","$timeout",function(t){return{restrict:"A",require:"?ngModel",link:function(e,n,a,i){if(i){n.parent('[data-toggle="buttons-checkbox"], [data-toggle="buttons-radio"]').length||n.attr("data-toggle","button");var o=!!e.$eval(a.ngModel);o&&n.addClass("active"),e.$watch(a.ngModel,function(t,e){var a=!!t,i=!!e;a!==i?$.fn.button.Constructor.prototype.toggle.call(r):a&&!o&&n.addClass("active")})}n.hasClass("btn")||n.on("click.button.data-api",function(){n.button("toggle")}),n.button();var r=n.data("button");r.toggle=function(){if(!i)return $.fn.button.Constructor.prototype.toggle.call(this);var a=n.parent('[data-toggle="buttons-radio"]');a.length?(n.siblings("[ng-model]").each(function(n,a){t($(a).attr("ng-model")).assign(e,!1)}),e.$digest(),i.$modelValue||(i.$setViewValue(!i.$modelValue),e.$digest())):e.$apply(function(){i.$setViewValue(!i.$modelValue)})}}}}]).directive("bsButtonsCheckbox",["$parse",function(){return{restrict:"A",require:"?ngModel",compile:function(t){t.attr("data-toggle","buttons-checkbox").find("a, button").each(function(t,e){$(e).attr("bs-button","")})}}}]).directive("bsButtonsRadio",["$timeout",function(t){return{restrict:"A",require:"?ngModel",compile:function(e,n){return e.attr("data-toggle","buttons-radio"),n.ngModel||e.find("a, button").each(function(t,e){$(e).attr("bs-button","")}),function(e,n,a,i){i&&(t(function(){n.find("[value]").button().filter('[value="'+i.$viewValue+'"]').addClass("active")}),n.on("click.button.data-api",function(t){e.$apply(function(){i.$setViewValue($(t.target).closest("button").attr("value"))})}),e.$watch(a.ngModel,function(t,i){if(t!==i){var o=n.find('[value="'+e.$eval(a.ngModel)+'"]');o.length&&o.button("toggle")}}))}}}}]),angular.module("$strap.directives").directive("bsButtonSelect",["$parse","$timeout",function(t){return{restrict:"A",require:"?ngModel",link:function(e,n,a,i){var o=t(a.bsButtonSelect);o.assign,i&&(n.text(e.$eval(a.ngModel)),e.$watch(a.ngModel,function(t){n.text(t)}));var r,s,l,u;n.bind("click",function(){r=o(e),s=i?e.$eval(a.ngModel):n.text(),l=r.indexOf(s),u=l>r.length-2?r[0]:r[l+1],e.$apply(function(){n.text(u),i&&i.$setViewValue(u)})})}}}]),angular.module("$strap.directives").directive("bsDatepicker",["$timeout","$strapConfig",function(t,e){var n=/(iP(a|o)d|iPhone)/g.test(navigator.userAgent),a=function a(t){return t=t||"en",{"/":"[\\/]","-":"[-]",".":"[.]"," ":"[\\s]",dd:"(?:(?:[0-2]?[0-9]{1})|(?:[3][01]{1}))",d:"(?:(?:[0-2]?[0-9]{1})|(?:[3][01]{1}))",mm:"(?:[0]?[1-9]|[1][012])",m:"(?:[0]?[1-9]|[1][012])",DD:"(?:"+$.fn.datepicker.dates[t].days.join("|")+")",D:"(?:"+$.fn.datepicker.dates[t].daysShort.join("|")+")",MM:"(?:"+$.fn.datepicker.dates[t].months.join("|")+")",M:"(?:"+$.fn.datepicker.dates[t].monthsShort.join("|")+")",yyyy:"(?:(?:[1]{1}[0-9]{1}[0-9]{1}[0-9]{1})|(?:[2]{1}[0-9]{3}))(?![[0-9]])",yy:"(?:(?:[0-9]{1}[0-9]{1}))(?![[0-9]])"}},i=function i(t,e){var n,i=t,o=a(e);return n=0,angular.forEach(o,function(t,e){i=i.split(e).join("${"+n+"}"),n++}),n=0,angular.forEach(o,function(t){i=i.split("${"+n+"}").join(t),n++}),RegExp("^"+i+"$",["i"])};return{restrict:"A",require:"?ngModel",link:function(t,a,o,r){var s=angular.extend({autoclose:!0},e.datepicker||{}),l=o.dateType||s.type||"date";angular.forEach(["format","weekStart","calendarWeeks","startDate","endDate","daysOfWeekDisabled","autoclose","startView","minViewMode","todayBtn","todayHighlight","keyboardNavigation","language","forceParse"],function(t){angular.isDefined(o[t])&&(s[t]=o[t])});var u=s.language||"en",c=o.dateFormat||s.format||$.fn.datepicker.dates[u]&&$.fn.datepicker.dates[u].format||"mm/dd/yyyy",d=n?"yyyy-mm-dd":c,p=i(d,u);r&&(r.$formatters.unshift(function(t){return"date"===l&&angular.isString(t)&&t?$.fn.datepicker.DPGlobal.parseDate(t,$.fn.datepicker.DPGlobal.parseFormat(c),u):t}),r.$parsers.unshift(function(t){return t?"date"===l&&angular.isDate(t)?(r.$setValidity("date",!0),t):angular.isString(t)&&p.test(t)?(r.$setValidity("date",!0),n?new Date(t):"string"===l?t:$.fn.datepicker.DPGlobal.parseDate(t,$.fn.datepicker.DPGlobal.parseFormat(d),u)):(r.$setValidity("date",!1),void 0):(r.$setValidity("date",!0),null)}),r.$render=function(){if(n){var t=r.$viewValue?$.fn.datepicker.DPGlobal.formatDate(r.$viewValue,$.fn.datepicker.DPGlobal.parseFormat(d),u):"";return a.val(t),t}return r.$viewValue||a.val(""),a.datepicker("update",r.$viewValue)}),n?a.prop("type","date").css("-webkit-appearance","textfield"):(r&&a.on("changeDate",function(e){t.$apply(function(){r.$setViewValue("string"===l?a.val():e.date)})}),a.datepicker(angular.extend(s,{format:d,language:u})),t.$on("$destroy",function(){var t=a.data("datepicker");t&&(t.picker.remove(),a.data("datepicker",null))}),o.$observe("startDate",function(t){a.datepicker("setStartDate",t)}),o.$observe("endDate",function(t){a.datepicker("setEndDate",t)}));var f=a.siblings('[data-toggle="datepicker"]');f.length&&f.on("click",function(){a.prop("disabled")||a.trigger("focus")})}}}]),angular.module("$strap.directives").directive("bsDropdown",["$parse","$compile","$timeout",function(t,e,n){var a=function(t,e){return e||(e=['"]),angular.forEach(t,function(t,n){if(t.divider)return e.splice(n+1,0,'');var i="",e.splice(n+1,0,i)}),e};return{restrict:"EA",scope:!0,link:function(i,o,r){var s=t(r.bsDropdown),l=s(i);n(function(){!angular.isArray(l);var t=angular.element(a(l).join(""));t.insertAfter(o),e(o.next("ul.dropdown-menu"))(i)}),o.addClass("dropdown-toggle").attr("data-toggle","dropdown")}}}]),angular.module("$strap.directives").factory("$modal",["$rootScope","$compile","$http","$timeout","$q","$templateCache","$strapConfig",function(t,e,n,a,i,o,r){var s=function s(s){function l(s){var l=angular.extend({show:!0},r.modal,s),u=l.scope?l.scope:t.$new(),c=l.template;return i.when(o.get(c)||n.get(c,{cache:!0}).then(function(t){return t.data})).then(function(t){var n=c.replace(".html","").replace(/[\/|\.|:]/g,"-")+"-"+u.$id,i=$('').attr("id",n).addClass("fade").html(t);return l.modalClass&&i.addClass(l.modalClass),$("body").append(i),a(function(){e(i)(u)}),u.$modal=function(t){i.modal(t)},angular.forEach(["show","hide"],function(t){u[t]=function(){i.modal(t)}}),u.dismiss=u.hide,angular.forEach(["show","shown","hide","hidden"],function(t){i.on(t,function(e){u.$emit("modal-"+t,e)})}),i.on("shown",function(){$("input[autofocus], textarea[autofocus]",i).first().trigger("focus")}),i.on("hidden",function(){l.persist||u.$destroy()}),u.$on("$destroy",function(){i.remove()}),i.modal(l),i})}return new l(s)};return s}]).directive("bsModal",["$q","$modal",function(t,e){return{restrict:"A",scope:!0,link:function(n,a,i){var o={template:n.$eval(i.bsModal),persist:!0,show:!1,scope:n};angular.forEach(["modalClass","backdrop","keyboard"],function(t){angular.isDefined(i[t])&&(o[t]=i[t])}),t.when(e(o)).then(function(t){a.attr("data-target","#"+t.attr("id")).attr("data-toggle","modal")})}}}]),angular.module("$strap.directives").directive("bsNavbar",["$location",function(t){return{restrict:"A",link:function(e,n){e.$watch(function(){return t.path()},function(t){$("li[data-match-route]",n).each(function(e,n){var a=angular.element(n),i=a.attr("data-match-route"),o=RegExp("^"+i+"$",["i"]);o.test(t)?a.addClass("active").find(".collapse.in").collapse("hide"):a.removeClass("active")})})}}}]),angular.module("$strap.directives").directive("bsPopover",["$parse","$compile","$http","$timeout","$q","$templateCache",function(t,e,n,a,i,o){return $("body").on("keyup",function(t){27===t.keyCode&&$(".popover.in").each(function(){$(this).popover("hide")})}),{restrict:"A",scope:!0,link:function(r,s,l){var u=t(l.bsPopover),c=(u.assign,u(r)),d={};angular.isObject(c)&&(d=c),i.when(d.content||o.get(c)||n.get(c,{cache:!0})).then(function(t){angular.isObject(t)&&(t=t.data),l.unique&&s.on("show",function(){$(".popover.in").each(function(){var t=$(this),e=t.data("popover");e&&!e.$element.is(s)&&t.popover("hide")})}),l.hide&&r.$watch(l.hide,function(t,e){t?n.hide():t!==e&&n.show()}),l.show&&r.$watch(l.show,function(t,e){t?a(function(){n.show()}):t!==e&&n.hide()}),s.popover(angular.extend({},d,{content:t,html:!0}));var n=s.data("popover");n.hasContent=function(){return this.getTitle()||t},n.getPosition=function(){var t=$.fn.popover.Constructor.prototype.getPosition.apply(this,arguments);return e(this.$tip)(r),r.$digest(),this.$tip.data("popover",this),t},r.$popover=function(t){n(t)},angular.forEach(["show","hide"],function(t){r[t]=function(){n[t]()}}),r.dismiss=r.hide,angular.forEach(["show","shown","hide","hidden"],function(t){s.on(t,function(e){r.$emit("popover-"+t,e)})})})}}}]),angular.module("$strap.directives").directive("bsSelect",["$timeout",function(t){return{restrict:"A",require:"?ngModel",link:function(e,n,a,i){var o=e.$eval(a.bsSelect)||{};t(function(){n.selectpicker(o),n.next().removeClass("ng-scope")}),i&&e.$watch(a.ngModel,function(t,e){angular.equals(t,e)||n.selectpicker("refresh")})}}}]),angular.module("$strap.directives").directive("bsTabs",["$parse","$compile","$timeout",function(t,e,n){var a='';return{restrict:"A",require:"?ngModel",priority:0,scope:!0,template:a,replace:!0,transclude:!0,compile:function(){return function(e,a,i,o){var r=t(i.bsTabs);r.assign,r(e),e.panes=[];var s,l,u,c=a.find("ul.nav-tabs"),d=a.find("div.tab-content"),p=0;n(function(){d.find("[data-title], [data-tab]").each(function(t){var n=angular.element(this);s="tab-"+e.$id+"-"+t,l=n.data("title")||n.data("tab"),u=!u&&n.hasClass("active"),n.attr("id",s).addClass("tab-pane"),i.fade&&n.addClass("fade"),e.panes.push({id:s,title:l,content:this.innerHTML,active:u})}),e.panes.length&&!u&&(d.find(".tab-pane:first-child").addClass("active"+(i.fade?" in":"")),e.panes[0].active=!0)}),o&&(a.on("show",function(t){var n=$(t.target);e.$apply(function(){o.$setViewValue(n.data("index"))})}),e.$watch(i.ngModel,function(t){angular.isUndefined(t)||(p=t,setTimeout(function(){var e=$(c[0].querySelectorAll("li")[1*t]);e.hasClass("active")||e.children("a").tab("show")}))}))}}}}]),angular.module("$strap.directives").directive("bsTimepicker",["$timeout","$strapConfig",function(t,e){var n="((?:(?:[0-1][0-9])|(?:[2][0-3])|(?:[0-9])):(?:[0-5][0-9])(?::[0-5][0-9])?(?:\\s?(?:am|AM|pm|PM))?)";return{restrict:"A",require:"?ngModel",link:function(a,i,o,r){if(r){i.on("changeTime.timepicker",function(){t(function(){r.$setViewValue(i.val())})});var s=RegExp("^"+n+"$",["i"]);r.$parsers.unshift(function(t){return!t||s.test(t)?(r.$setValidity("time",!0),t):(r.$setValidity("time",!1),void 0)})}i.attr("data-toggle","timepicker"),i.parent().addClass("bootstrap-timepicker"),i.timepicker(e.timepicker||{});var l=i.data("timepicker"),u=i.siblings('[data-toggle="timepicker"]');u.length&&u.on("click",$.proxy(l.showWidget,l))}}}]),angular.module("$strap.directives").directive("bsTooltip",["$parse","$compile",function(t){return{restrict:"A",scope:!0,link:function(e,n,a){var i=t(a.bsTooltip),o=(i.assign,i(e));e.$watch(a.bsTooltip,function(t,e){t!==e&&(o=t)}),a.unique&&n.on("show",function(){$(".tooltip.in").each(function(){var t=$(this),e=t.data("tooltip");e&&!e.$element.is(n)&&t.tooltip("hide")})}),n.tooltip({title:function(){return angular.isFunction(o)?o.apply(null,arguments):o},html:!0});var r=n.data("tooltip");r.show=function(){var t=$.fn.tooltip.Constructor.prototype.show.apply(this,arguments);return this.tip().data("tooltip",this),t},e._tooltip=function(t){n.tooltip(t)},e.hide=function(){n.tooltip("hide")},e.show=function(){n.tooltip("show")},e.dismiss=e.hide}}}]),angular.module("$strap.directives").directive("bsTypeahead",["$parse",function(t){return{restrict:"A",require:"?ngModel",link:function(e,n,a,i){var o=t(a.bsTypeahead),r=(o.assign,o(e));e.$watch(a.bsTypeahead,function(t,e){t!==e&&(r=t)}),n.attr("data-provide","typeahead"),n.typeahead({source:function(){return angular.isFunction(r)?r.apply(null,arguments):r},minLength:a.minLength||1,items:a.items,updater:function(t){return i&&e.$apply(function(){i.$setViewValue(t)}),e.$emit("typeahead-updated",t),t}});var s=n.data("typeahead");s.lookup=function(){var t;return this.query=this.$element.val()||"",this.query.length