I can imagine this being handy: http://www.jquery4u.com/snippets/jquery-check-window-iframe/
That way we could do a check if the node (or form) is in a iframe. So let's say you call a node (photo) trough the whole website by modalframe. But somehow the user lands on the photo node outside of the modalframe, by typing in the url (or maybe trough google). Then we could use the javascript check. If the page is not in the iframe we refresh the page with an extra parameter ?modal=no and use php to unset the modalframe_child_js().
So something like:
function drupal_glue_init() {
if (!empty($_COOKIE['has_js'])&& is_numeric(arg(1))){
$node=node_load(arg(1));
if( (!isset($_GET['nomodal']) && isset($node)) && $node->type=='advgallery' ) {
modalframe_child_js();
}
}
else if (!empty($_COOKIE['has_js'])) {
drupal_add_js(drupal_get_path('module', 'drupal_glue') .'/js/modals.js');
modalframe_parent_js();
}
}
This would make the modal very easy to implement, you could attach it the modal to every node you want to without changing the link to that node. You would only add another click function in your JS
$('a.modalframe-gallery:not(.modalframe-processed)').click(function() {
$(this).addClass('modalframe-processed');
Drupal.theme('drupalGlueModals', this);
return false;
});
And the rest would be done automatic.
I'm not sure if there is already a good way to do what i described above, if so i would love to hear it.
Comments
Comment #1
dsnopekThis is a duplicate of #1027202: Add API function to determine if your in the child frame or not.