| 1 |
// $Id: popups.js,v 1.9.8.11 2009/03/20 00:03:03 starbow Exp $ |
// $Id: popups.js,v 1.9.8.13 2009/03/26 04:43:11 starbow Exp $ |
| 2 |
|
|
| 3 |
/** |
/** |
| 4 |
* Popup Modal Dialog API |
* Popup Modal Dialog API |
| 318 |
* Hash of options associated with these links. |
* Hash of options associated with these links. |
| 319 |
*/ |
*/ |
| 320 |
Popups.attach = function(context, selector, options) { |
Popups.attach = function(context, selector, options) { |
|
// console.log(options); |
|
| 321 |
$(selector, context).not('.popups-processed').each(function() { |
$(selector, context).not('.popups-processed').each(function() { |
| 322 |
var $element = $(this); |
var $element = $(this); |
| 323 |
|
|
| 593 |
|
|
| 594 |
// Should I fold this function into Popups.pop? |
// Should I fold this function into Popups.pop? |
| 595 |
Popups.removePopup = function(popup) { |
Popups.removePopup = function(popup) { |
|
// console.log("Popups.removePopup: " + popup); |
|
| 596 |
if (!Popups.isset(popup)) { |
if (!Popups.isset(popup)) { |
| 597 |
popup = Popups.activePopup(); |
popup = Popups.activePopup(); |
| 598 |
} |
} |
| 599 |
if (popup) { |
if (popup) { |
|
// console.log('removing '+popup.id); |
|
| 600 |
popup.$popup().remove(); |
popup.$popup().remove(); |
| 601 |
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() |
| 602 |
} |
} |
|
// else { |
|
|
// console.log("Popups.removePopup - there is no popup to remove."); |
|
|
// } |
|
| 603 |
}; |
}; |
| 604 |
|
|
| 605 |
/** |
/** |
| 745 |
|
|
| 746 |
// Add new JS settings to the page, needed for #ahah properties to work. |
// Add new JS settings to the page, needed for #ahah properties to work. |
| 747 |
Drupal.settings = js.setting; |
Drupal.settings = js.setting; |
|
// console.log('js.setting...'); |
|
|
// console.log(js.setting); |
|
| 748 |
|
|
| 749 |
for (var i in scripts) { |
for (var i in scripts) { |
| 750 |
var src = scripts[i]; |
var src = scripts[i]; |
| 832 |
var returnPath; |
var returnPath; |
| 833 |
if (parent) { |
if (parent) { |
| 834 |
returnPath = parent.path; |
returnPath = parent.path; |
|
// console.log('Popup parent is ...'); |
|
|
// console.log(parent); |
|
| 835 |
} |
} |
| 836 |
else { // No parent, so bring flow back to original page. |
else { // No parent, so bring flow back to original page. |
| 837 |
returnPath = Popups.originalSettings.popups.originalPath; |
returnPath = Popups.originalSettings.popups.originalPath; |
| 838 |
} |
} |
| 839 |
href = href.replace(/destination=[^;&]*[;&]?/, ''); // Strip out any existing destination param. |
href = href.replace(/destination=[^;&]*[;&]?/, ''); // Strip out any existing destination param. |
|
// console.log("Hijacking destination to " + returnPath); |
|
| 840 |
params.destination = returnPath; // Set the destination to return to the parent's path. |
params.destination = returnPath; // Set the destination to return to the parent's path. |
| 841 |
} |
} |
| 842 |
|
|
| 896 |
// Set properties on new popup. |
// Set properties on new popup. |
| 897 |
popup.parent = parent; |
popup.parent = parent; |
| 898 |
popup.path = path; |
popup.path = path; |
|
// console.log("Setting popup " + popup.id + " originalPath to " + path); |
|
| 899 |
popup.options = options; |
popup.options = options; |
| 900 |
popup.element = element; |
popup.element = element; |
| 901 |
|
|