Mercurial > defr > drupal > popups
diff popups.js @ 2:c076d54409cb
Popus: Version RF
author | Franck Deroche <franck@defr.org> |
---|---|
date | Fri, 31 Dec 2010 13:46:12 +0100 |
parents | 76f9b43738f2 |
children |
line wrap: on
line diff
--- a/popups.js Fri Dec 31 13:41:08 2010 +0100 +++ b/popups.js Fri Dec 31 13:46:12 2010 +0100 @@ -77,7 +77,7 @@ */ Popups.defaultOptions = { doneTest: null, // null, *path*, *regexp*. how do we know when a multiform flow is done? - updateMethod: 'ajax', // none, ajax, reload, *callback* + updateMethod: 'ajax', // none, ajax, reload, callback updateSource: 'initial', // initial, final. Only used if updateMethod != none. href: null, width: null, // Override the width specified in the css. @@ -86,7 +86,8 @@ reloadOnError: false, // Force the entire page to reload if the popup href is unaccessable. noMessage: false, // Don't show drupal_set_message messages. skipDirtyCheck: false, // If true, this popup will not check for edits on the originating page. - hijackDestination: true // Use the destiination param to force a form submit to return to the originating page. + hijackDestination: true, // Use the destiination param to force a form submit to return to the originating page. + onUpdate: null // Callback used for the updateMethod: 'callback' type }; // *************************************************************************** @@ -604,7 +605,8 @@ if (popup) { // console.log('removing '+popup.id); popup.$popup().remove(); - Popups.popupStack.splice(Popups.popupStack.indexOf(popup), 1); // Remove popup from stack. Probably should rework into .pop() +// Popups.popupStack.splice(Popups.popupStack.indexOf(popup), 1); // Remove popup from stack. Probably should rework into .pop() + Popups.popupStack.pop(); } // else { // console.log("Popups.removePopup - there is no popup to remove."); @@ -759,7 +761,7 @@ for (var i in scripts) { var src = scripts[i]; - if (!$('script[src='+ src + ']').length && !Popups.addedJS[src]) { + if (!$("script[src='"+ src + "']").length && !Popups.addedJS[src]) { // Get the script from the server and execute it. $.ajax({ type: 'GET', @@ -803,6 +805,9 @@ * Do before the form in the popups is submitted. */ Popups.beforeSubmit = function(formData, $form, options) { + if ($form.hasClass('views-processed') && $form.parents('div.view-filters').size()) { + return false; + } Popups.removePopup(); // Remove just the dialog, but not the overlay. Popups.addLoading(); }; @@ -922,17 +927,18 @@ popup.refocus(); // If the popups contains a form, capture submits. - var $form = $('form', popup.$popupBody()); + var $form = $('form:not(.no-popup)', popup.$popupBody()); if ($form.length) { $form.ajaxForm({ dataType: 'json', + iframe: false, beforeSubmit: Popups.beforeSubmit, beforeSend: Popups.beforeSend, success: function(json, status) { Popups.formSuccess(popup, json); }, error: function() { - Popups.message("Bad Response form submission"); + Popups.message(Drupal.t("Bad Response form submission")); } }); }