1 |
85ad3d82
|
Assos Assos
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
(function ($) {
|
12 |
|
|
|
13 |
|
|
Drupal.CTools = Drupal.CTools || {};
|
14 |
|
|
Drupal.CTools.Modal = Drupal.CTools.Modal || {};
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
Drupal.CTools.Modal.show = function(choice) {
|
22 |
|
|
var opts = {};
|
23 |
|
|
|
24 |
|
|
if (choice && typeof choice == 'string' && Drupal.settings[choice]) {
|
25 |
|
|
|
26 |
|
|
$.extend(true, opts, Drupal.settings[choice]);
|
27 |
|
|
}
|
28 |
|
|
else if (choice) {
|
29 |
|
|
$.extend(true, opts, choice);
|
30 |
|
|
}
|
31 |
|
|
|
32 |
|
|
var defaults = {
|
33 |
|
|
modalTheme: 'CToolsModalDialog',
|
34 |
|
|
throbberTheme: 'CToolsModalThrobber',
|
35 |
|
|
animation: 'show',
|
36 |
|
|
animationSpeed: 'fast',
|
37 |
|
|
modalSize: {
|
38 |
|
|
type: 'scale',
|
39 |
|
|
width: .8,
|
40 |
|
|
height: .8,
|
41 |
|
|
addWidth: 0,
|
42 |
|
|
addHeight: 0,
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
contentRight: 25,
|
46 |
|
|
contentBottom: 45
|
47 |
|
|
},
|
48 |
|
|
modalOptions: {
|
49 |
|
|
opacity: .55,
|
50 |
|
|
background: '#fff'
|
51 |
|
|
}
|
52 |
|
|
};
|
53 |
|
|
|
54 |
|
|
var settings = {};
|
55 |
|
|
$.extend(true, settings, defaults, Drupal.settings.CToolsModal, opts);
|
56 |
|
|
|
57 |
|
|
if (Drupal.CTools.Modal.currentSettings && Drupal.CTools.Modal.currentSettings != settings) {
|
58 |
|
|
Drupal.CTools.Modal.modal.remove();
|
59 |
|
|
Drupal.CTools.Modal.modal = null;
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
Drupal.CTools.Modal.currentSettings = settings;
|
63 |
|
|
|
64 |
|
|
var resize = function(e) {
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
var context = e ? document : Drupal.CTools.Modal.modal;
|
69 |
|
|
|
70 |
|
|
if (Drupal.CTools.Modal.currentSettings.modalSize.type == 'scale') {
|
71 |
|
|
var width = $(window).width() * Drupal.CTools.Modal.currentSettings.modalSize.width;
|
72 |
|
|
var height = $(window).height() * Drupal.CTools.Modal.currentSettings.modalSize.height;
|
73 |
|
|
}
|
74 |
|
|
else {
|
75 |
|
|
var width = Drupal.CTools.Modal.currentSettings.modalSize.width;
|
76 |
|
|
var height = Drupal.CTools.Modal.currentSettings.modalSize.height;
|
77 |
|
|
}
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
$('div.ctools-modal-content', context).css({
|
81 |
|
|
'width': width + Drupal.CTools.Modal.currentSettings.modalSize.addWidth + 'px',
|
82 |
|
|
'height': height + Drupal.CTools.Modal.currentSettings.modalSize.addHeight + 'px'
|
83 |
|
|
});
|
84 |
|
|
$('div.ctools-modal-content .modal-content', context).css({
|
85 |
|
|
'width': (width - Drupal.CTools.Modal.currentSettings.modalSize.contentRight) + 'px',
|
86 |
|
|
'height': (height - Drupal.CTools.Modal.currentSettings.modalSize.contentBottom) + 'px'
|
87 |
|
|
});
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
if (!Drupal.CTools.Modal.modal) {
|
91 |
|
|
Drupal.CTools.Modal.modal = $(Drupal.theme(settings.modalTheme));
|
92 |
|
|
if (settings.modalSize.type == 'scale') {
|
93 |
|
|
$(window).bind('resize', resize);
|
94 |
|
|
}
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
resize();
|
98 |
|
|
|
99 |
|
|
$('span.modal-title', Drupal.CTools.Modal.modal).html(Drupal.CTools.Modal.currentSettings.loadingText);
|
100 |
|
|
Drupal.CTools.Modal.modalContent(Drupal.CTools.Modal.modal, settings.modalOptions, settings.animation, settings.animationSpeed);
|
101 |
|
|
$('#modalContent .modal-content').html(Drupal.theme(settings.throbberTheme));
|
102 |
3753f249
|
Assos Assos
|
|
103 |
|
|
|
104 |
|
|
$('#modalContent .modal-content').delegate('input.form-autocomplete', 'keyup', function() {
|
105 |
|
|
$('#autocomplete').css('top', $(this).position().top + $(this).outerHeight() + $(this).offsetParent().filter('#modal-content').scrollTop());
|
106 |
|
|
});
|
107 |
85ad3d82
|
Assos Assos
|
};
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
Drupal.CTools.Modal.dismiss = function() {
|
113 |
|
|
if (Drupal.CTools.Modal.modal) {
|
114 |
|
|
Drupal.CTools.Modal.unmodalContent(Drupal.CTools.Modal.modal);
|
115 |
|
|
}
|
116 |
|
|
};
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
Drupal.theme.prototype.CToolsModalDialog = function () {
|
122 |
|
|
var html = ''
|
123 |
|
|
html += ' <div id="ctools-modal">'
|
124 |
|
|
html += ' <div class="ctools-modal-content">'
|
125 |
|
|
html += ' <div class="modal-header">';
|
126 |
|
|
html += ' <a class="close" href="#">';
|
127 |
|
|
html += Drupal.CTools.Modal.currentSettings.closeText + Drupal.CTools.Modal.currentSettings.closeImage;
|
128 |
|
|
html += ' </a>';
|
129 |
|
|
html += ' <span id="modal-title" class="modal-title"> </span>';
|
130 |
|
|
html += ' </div>';
|
131 |
|
|
html += ' <div id="modal-content" class="modal-content">';
|
132 |
|
|
html += ' </div>';
|
133 |
|
|
html += ' </div>';
|
134 |
|
|
html += ' </div>';
|
135 |
|
|
|
136 |
|
|
return html;
|
137 |
|
|
}
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
Drupal.theme.prototype.CToolsModalThrobber = function () {
|
143 |
|
|
var html = '';
|
144 |
|
|
html += ' <div id="modal-throbber">';
|
145 |
|
|
html += ' <div class="modal-throbber-wrapper">';
|
146 |
|
|
html += Drupal.CTools.Modal.currentSettings.throbber;
|
147 |
|
|
html += ' </div>';
|
148 |
|
|
html += ' </div>';
|
149 |
|
|
|
150 |
|
|
return html;
|
151 |
|
|
};
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
|
155 |
|
|
|
156 |
|
|
Drupal.CTools.Modal.getSettings = function (object) {
|
157 |
|
|
var match = $(object).attr('class').match(/ctools-modal-(\S+)/);
|
158 |
|
|
if (match) {
|
159 |
|
|
return match[1];
|
160 |
|
|
}
|
161 |
|
|
}
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
|
165 |
|
|
|
166 |
|
|
Drupal.CTools.Modal.clickAjaxCacheLink = function () {
|
167 |
|
|
Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this));
|
168 |
|
|
return Drupal.CTools.AJAX.clickAJAXCacheLink.apply(this);
|
169 |
|
|
};
|
170 |
|
|
|
171 |
|
|
|
172 |
|
|
|
173 |
|
|
|
174 |
|
|
Drupal.CTools.Modal.clickAjaxLink = function () {
|
175 |
|
|
Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this));
|
176 |
|
|
return false;
|
177 |
|
|
};
|
178 |
|
|
|
179 |
|
|
|
180 |
|
|
|
181 |
|
|
|
182 |
|
|
Drupal.CTools.Modal.submitAjaxForm = function(e) {
|
183 |
|
|
var $form = $(this);
|
184 |
|
|
var url = $form.attr('action');
|
185 |
|
|
|
186 |
|
|
setTimeout(function() { Drupal.CTools.AJAX.ajaxSubmit($form, url); }, 1);
|
187 |
|
|
return false;
|
188 |
|
|
}
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
|
193 |
|
|
Drupal.behaviors.ZZCToolsModal = {
|
194 |
|
|
attach: function(context) {
|
195 |
|
|
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
|
199 |
|
|
|
200 |
|
|
|
201 |
|
|
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
|
205 |
|
|
|
206 |
|
|
$('area.ctools-use-modal, a.ctools-use-modal', context).once('ctools-use-modal', function() {
|
207 |
|
|
var $this = $(this);
|
208 |
|
|
$this.click(Drupal.CTools.Modal.clickAjaxLink);
|
209 |
|
|
|
210 |
|
|
var element_settings = {};
|
211 |
|
|
if ($this.attr('href')) {
|
212 |
|
|
element_settings.url = $this.attr('href');
|
213 |
|
|
element_settings.event = 'click';
|
214 |
|
|
element_settings.progress = { type: 'throbber' };
|
215 |
|
|
}
|
216 |
|
|
var base = $this.attr('href');
|
217 |
|
|
Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);
|
218 |
|
|
});
|
219 |
|
|
|
220 |
|
|
|
221 |
|
|
$('input.ctools-use-modal, button.ctools-use-modal', context).once('ctools-use-modal', function() {
|
222 |
|
|
var $this = $(this);
|
223 |
|
|
$this.click(Drupal.CTools.Modal.clickAjaxLink);
|
224 |
|
|
var button = this;
|
225 |
|
|
var element_settings = {};
|
226 |
|
|
|
227 |
|
|
|
228 |
|
|
|
229 |
|
|
element_settings.url = Drupal.CTools.Modal.findURL(this);
|
230 |
3753f249
|
Assos Assos
|
if (element_settings.url == '') {
|
231 |
|
|
element_settings.url = $(this).closest('form').attr('action');
|
232 |
|
|
}
|
233 |
85ad3d82
|
Assos Assos
|
element_settings.event = 'click';
|
234 |
3753f249
|
Assos Assos
|
element_settings.setClick = true;
|
235 |
85ad3d82
|
Assos Assos
|
|
236 |
|
|
var base = $this.attr('id');
|
237 |
|
|
Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);
|
238 |
|
|
|
239 |
|
|
|
240 |
|
|
$('.' + $(button).attr('id') + '-url').change(function() {
|
241 |
|
|
Drupal.ajax[base].options.url = Drupal.CTools.Modal.findURL(button);
|
242 |
|
|
});
|
243 |
|
|
});
|
244 |
|
|
|
245 |
|
|
|
246 |
|
|
$('#modal-content form', context).once('ctools-use-modal', function() {
|
247 |
|
|
var $this = $(this);
|
248 |
|
|
var element_settings = {};
|
249 |
|
|
|
250 |
|
|
element_settings.url = $this.attr('action');
|
251 |
|
|
element_settings.event = 'submit';
|
252 |
|
|
element_settings.progress = { 'type': 'throbber' }
|
253 |
|
|
var base = $this.attr('id');
|
254 |
|
|
|
255 |
|
|
Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);
|
256 |
|
|
Drupal.ajax[base].form = $this;
|
257 |
|
|
|
258 |
|
|
$('input[type=submit], button', this).click(function(event) {
|
259 |
|
|
Drupal.ajax[base].element = this;
|
260 |
|
|
this.form.clk = this;
|
261 |
96a203dd
|
Assos Assos
|
|
262 |
|
|
if (Drupal.autocompleteSubmit && !Drupal.autocompleteSubmit()) {
|
263 |
|
|
return false;
|
264 |
|
|
}
|
265 |
85ad3d82
|
Assos Assos
|
|
266 |
|
|
|
267 |
|
|
if (event.bubbles == undefined) {
|
268 |
|
|
$(this.form).trigger('submit');
|
269 |
|
|
return false;
|
270 |
|
|
}
|
271 |
|
|
});
|
272 |
|
|
});
|
273 |
|
|
|
274 |
|
|
|
275 |
|
|
|
276 |
|
|
$('.ctools-close-modal', context).once('ctools-close-modal')
|
277 |
|
|
.click(function() {
|
278 |
|
|
Drupal.CTools.Modal.dismiss();
|
279 |
|
|
return false;
|
280 |
|
|
});
|
281 |
|
|
}
|
282 |
|
|
};
|
283 |
|
|
|
284 |
|
|
|
285 |
|
|
|
286 |
|
|
|
287 |
|
|
|
288 |
|
|
|
289 |
|
|
Drupal.CTools.Modal.modal_display = function(ajax, response, status) {
|
290 |
|
|
if ($('#modalContent').length == 0) {
|
291 |
|
|
Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(ajax.element));
|
292 |
|
|
}
|
293 |
|
|
$('#modal-title').html(response.title);
|
294 |
|
|
|
295 |
|
|
|
296 |
|
|
|
297 |
|
|
$('#modal-content').html(response.output).scrollTop(0);
|
298 |
3753f249
|
Assos Assos
|
|
299 |
|
|
|
300 |
|
|
var settings = response.settings || ajax.settings || Drupal.settings;
|
301 |
|
|
Drupal.attachBehaviors('#modalContent', settings);
|
302 |
85ad3d82
|
Assos Assos
|
}
|
303 |
|
|
|
304 |
|
|
|
305 |
|
|
|
306 |
|
|
|
307 |
|
|
Drupal.CTools.Modal.modal_dismiss = function(command) {
|
308 |
|
|
Drupal.CTools.Modal.dismiss();
|
309 |
|
|
$('link.ctools-temporary-css').remove();
|
310 |
|
|
}
|
311 |
|
|
|
312 |
|
|
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
|
316 |
|
|
Drupal.CTools.Modal.modal_loading = function(command) {
|
317 |
|
|
Drupal.CTools.Modal.modal_display({
|
318 |
|
|
output: Drupal.theme(Drupal.CTools.Modal.currentSettings.throbberTheme),
|
319 |
|
|
title: Drupal.CTools.Modal.currentSettings.loadingText
|
320 |
|
|
});
|
321 |
|
|
}
|
322 |
|
|
|
323 |
|
|
|
324 |
|
|
|
325 |
|
|
|
326 |
|
|
|
327 |
|
|
|
328 |
|
|
|
329 |
|
|
|
330 |
|
|
|
331 |
|
|
Drupal.CTools.Modal.findURL = function(item) {
|
332 |
|
|
var url = '';
|
333 |
|
|
var url_class = '.' + $(item).attr('id') + '-url';
|
334 |
|
|
$(url_class).each(
|
335 |
|
|
function() {
|
336 |
|
|
var $this = $(this);
|
337 |
|
|
if (url && $this.val()) {
|
338 |
|
|
url += '/';
|
339 |
|
|
}
|
340 |
|
|
url += $this.val();
|
341 |
|
|
});
|
342 |
|
|
return url;
|
343 |
|
|
};
|
344 |
|
|
|
345 |
|
|
|
346 |
|
|
|
347 |
|
|
|
348 |
|
|
|
349 |
|
|
|
350 |
|
|
|
351 |
|
|
|
352 |
|
|
|
353 |
|
|
Drupal.CTools.Modal.modalContent = function(content, css, animation, speed) {
|
354 |
|
|
|
355 |
|
|
if (!animation) {
|
356 |
|
|
animation = 'show';
|
357 |
|
|
}
|
358 |
|
|
else {
|
359 |
|
|
|
360 |
|
|
if (animation != 'fadeIn' && animation != 'slideDown') {
|
361 |
|
|
animation = 'show';
|
362 |
|
|
}
|
363 |
|
|
}
|
364 |
|
|
|
365 |
|
|
if (!speed) {
|
366 |
|
|
speed = 'fast';
|
367 |
|
|
}
|
368 |
|
|
|
369 |
|
|
|
370 |
|
|
css = jQuery.extend({
|
371 |
|
|
position: 'absolute',
|
372 |
|
|
left: '0px',
|
373 |
|
|
margin: '0px',
|
374 |
|
|
background: '#000',
|
375 |
|
|
opacity: '.55'
|
376 |
|
|
}, css);
|
377 |
|
|
|
378 |
|
|
|
379 |
|
|
css.filter = 'alpha(opacity=' + (100 * css.opacity) + ')';
|
380 |
|
|
content.hide();
|
381 |
|
|
|
382 |
e4c061ad
|
Assos Assos
|
|
383 |
|
|
if ($('#modalBackdrop').length) $('#modalBackdrop').remove();
|
384 |
|
|
if ($('#modalContent').length) $('#modalContent').remove();
|
385 |
85ad3d82
|
Assos Assos
|
|
386 |
|
|
|
387 |
|
|
if (self.pageYOffset) {
|
388 |
|
|
var wt = self.pageYOffset;
|
389 |
|
|
} else if (document.documentElement && document.documentElement.scrollTop) {
|
390 |
|
|
var wt = document.documentElement.scrollTop;
|
391 |
|
|
} else if (document.body) {
|
392 |
|
|
var wt = document.body.scrollTop;
|
393 |
|
|
}
|
394 |
|
|
|
395 |
|
|
|
396 |
|
|
|
397 |
|
|
|
398 |
|
|
var docHeight = $(document).height() + 50;
|
399 |
|
|
var docWidth = $(document).width();
|
400 |
|
|
var winHeight = $(window).height();
|
401 |
|
|
var winWidth = $(window).width();
|
402 |
|
|
if( docHeight < winHeight ) docHeight = winHeight;
|
403 |
|
|
|
404 |
|
|
|
405 |
|
|
$('body').append('<div id="modalBackdrop" style="z-index: 1000; display: none;"></div><div id="modalContent" style="z-index: 1001; position: absolute;">' + $(content).html() + '</div>');
|
406 |
|
|
|
407 |
|
|
|
408 |
|
|
modalEventHandler = function( event ) {
|
409 |
|
|
target = null;
|
410 |
|
|
if ( event ) {
|
411 |
|
|
target = event.target;
|
412 |
|
|
} else {
|
413 |
|
|
event = window.event;
|
414 |
|
|
target = event.srcElement;
|
415 |
|
|
}
|
416 |
|
|
|
417 |
|
|
var parents = $(target).parents().get();
|
418 |
|
|
for (var i = 0; i < parents.length; ++i) {
|
419 |
|
|
var position = $(parents[i]).css('position');
|
420 |
|
|
if (position == 'absolute' || position == 'fixed') {
|
421 |
|
|
return true;
|
422 |
|
|
}
|
423 |
|
|
}
|
424 |
e4c061ad
|
Assos Assos
|
|
425 |
|
|
if ($(target).is('#modalContent, body') || $(target).filter('*:visible').parents('#modalContent').length) {
|
426 |
|
|
|
427 |
|
|
|
428 |
85ad3d82
|
Assos Assos
|
return true;
|
429 |
|
|
}
|
430 |
e4c061ad
|
Assos Assos
|
else {
|
431 |
|
|
$('#modalContent').focus();
|
432 |
|
|
}
|
433 |
|
|
|
434 |
|
|
event.preventDefault();
|
435 |
85ad3d82
|
Assos Assos
|
};
|
436 |
|
|
$('body').bind( 'focus', modalEventHandler );
|
437 |
|
|
$('body').bind( 'keypress', modalEventHandler );
|
438 |
|
|
|
439 |
|
|
|
440 |
|
|
var modalContent = $('#modalContent').css('top','-1000px');
|
441 |
|
|
var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2);
|
442 |
|
|
var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2);
|
443 |
|
|
$('#modalBackdrop').css(css).css('top', 0).css('height', docHeight + 'px').css('width', docWidth + 'px').show();
|
444 |
|
|
modalContent.css({top: mdcTop + 'px', left: mdcLeft + 'px'}).hide()[animation](speed);
|
445 |
|
|
|
446 |
|
|
|
447 |
|
|
modalContentClose = function(){close(); return false;};
|
448 |
|
|
$('.close').bind('click', modalContentClose);
|
449 |
|
|
|
450 |
|
|
|
451 |
|
|
modalEventEscapeCloseHandler = function(event) {
|
452 |
|
|
if (event.keyCode == 27) {
|
453 |
|
|
close();
|
454 |
|
|
return false;
|
455 |
|
|
}
|
456 |
|
|
};
|
457 |
|
|
|
458 |
|
|
$(document).bind('keydown', modalEventEscapeCloseHandler);
|
459 |
|
|
|
460 |
|
|
|
461 |
|
|
function close() {
|
462 |
|
|
|
463 |
|
|
$(window).unbind('resize', modalContentResize);
|
464 |
|
|
$('body').unbind( 'focus', modalEventHandler);
|
465 |
|
|
$('body').unbind( 'keypress', modalEventHandler );
|
466 |
|
|
$('.close').unbind('click', modalContentClose);
|
467 |
|
|
$('body').unbind('keypress', modalEventEscapeCloseHandler);
|
468 |
|
|
$(document).trigger('CToolsDetachBehaviors', $('#modalContent'));
|
469 |
|
|
|
470 |
|
|
|
471 |
|
|
if ( animation == 'fadeIn' ) animation = 'fadeOut';
|
472 |
|
|
if ( animation == 'slideDown' ) animation = 'slideUp';
|
473 |
|
|
if ( animation == 'show' ) animation = 'hide';
|
474 |
|
|
|
475 |
|
|
|
476 |
|
|
modalContent.hide()[animation](speed);
|
477 |
|
|
|
478 |
|
|
|
479 |
|
|
$('#modalContent').remove();
|
480 |
|
|
$('#modalBackdrop').remove();
|
481 |
|
|
};
|
482 |
|
|
|
483 |
|
|
|
484 |
|
|
modalContentResize = function(){
|
485 |
e4c061ad
|
Assos Assos
|
|
486 |
|
|
|
487 |
|
|
if (self.pageYOffset) {
|
488 |
|
|
var wt = self.pageYOffset;
|
489 |
|
|
} else if (document.documentElement && document.documentElement.scrollTop) {
|
490 |
|
|
var wt = document.documentElement.scrollTop;
|
491 |
|
|
} else if (document.body) {
|
492 |
|
|
var wt = document.body.scrollTop;
|
493 |
|
|
}
|
494 |
|
|
|
495 |
85ad3d82
|
Assos Assos
|
|
496 |
|
|
var docHeight = $(document).height();
|
497 |
|
|
var docWidth = $(document).width();
|
498 |
|
|
var winHeight = $(window).height();
|
499 |
|
|
var winWidth = $(window).width();
|
500 |
|
|
if( docHeight < winHeight ) docHeight = winHeight;
|
501 |
|
|
|
502 |
|
|
|
503 |
|
|
var modalContent = $('#modalContent');
|
504 |
e4c061ad
|
Assos Assos
|
var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2);
|
505 |
85ad3d82
|
Assos Assos
|
var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2);
|
506 |
|
|
|
507 |
|
|
|
508 |
|
|
$('#modalBackdrop').css('height', docHeight + 'px').css('width', docWidth + 'px').show();
|
509 |
|
|
modalContent.css('top', mdcTop + 'px').css('left', mdcLeft + 'px').show();
|
510 |
|
|
};
|
511 |
|
|
$(window).bind('resize', modalContentResize);
|
512 |
|
|
|
513 |
|
|
$('#modalContent').focus();
|
514 |
|
|
};
|
515 |
|
|
|
516 |
|
|
|
517 |
|
|
|
518 |
|
|
|
519 |
|
|
|
520 |
|
|
|
521 |
|
|
|
522 |
|
|
Drupal.CTools.Modal.unmodalContent = function(content, animation, speed)
|
523 |
|
|
{
|
524 |
|
|
|
525 |
|
|
if (!animation) { var animation = 'show'; } else {
|
526 |
|
|
|
527 |
|
|
if (( animation != 'fadeOut' ) && ( animation != 'slideUp')) animation = 'show';
|
528 |
|
|
}
|
529 |
|
|
|
530 |
|
|
if ( !speed ) var speed = 'fast';
|
531 |
|
|
|
532 |
|
|
|
533 |
|
|
$(window).unbind('resize', modalContentResize);
|
534 |
|
|
$('body').unbind('focus', modalEventHandler);
|
535 |
|
|
$('body').unbind('keypress', modalEventHandler);
|
536 |
|
|
$('.close').unbind('click', modalContentClose);
|
537 |
|
|
$(document).trigger('CToolsDetachBehaviors', $('#modalContent'));
|
538 |
|
|
|
539 |
|
|
|
540 |
|
|
content.each(function(){
|
541 |
|
|
if ( animation == 'fade' ) {
|
542 |
|
|
$('#modalContent').fadeOut(speed, function() {
|
543 |
|
|
$('#modalBackdrop').fadeOut(speed, function() {
|
544 |
|
|
$(this).remove();
|
545 |
|
|
});
|
546 |
|
|
$(this).remove();
|
547 |
|
|
});
|
548 |
|
|
} else {
|
549 |
|
|
if ( animation == 'slide' ) {
|
550 |
|
|
$('#modalContent').slideUp(speed,function() {
|
551 |
|
|
$('#modalBackdrop').slideUp(speed, function() {
|
552 |
|
|
$(this).remove();
|
553 |
|
|
});
|
554 |
|
|
$(this).remove();
|
555 |
|
|
});
|
556 |
|
|
} else {
|
557 |
|
|
$('#modalContent').remove();
|
558 |
|
|
$('#modalBackdrop').remove();
|
559 |
|
|
}
|
560 |
|
|
}
|
561 |
|
|
});
|
562 |
|
|
};
|
563 |
|
|
|
564 |
|
|
$(function() {
|
565 |
|
|
Drupal.ajax.prototype.commands.modal_display = Drupal.CTools.Modal.modal_display;
|
566 |
|
|
Drupal.ajax.prototype.commands.modal_dismiss = Drupal.CTools.Modal.modal_dismiss;
|
567 |
|
|
});
|
568 |
|
|
|
569 |
|
|
})(jQuery); |