You are not logged in.
Hello.
I want to wrap popup windowses in jquery plugin named Colorbox http://colorpowered.com/colorbox/
I found out that in dialog.js function (in my browser) [Dialog._geckoOpenModal = function(_7, _8, _9) ... ] is responsible for window.open but it's kinda wierd. I don't fully understand how it works.
Colorbox can show iframed content so i think it's possible and should be easy to implement however it's not easy. Script first opens a blank window and then rest of variables.
Could someone point me wich parts of code should i change to painlessly wrap windowses in colorbox?
Offline
Of course I have uncompressed files but this one is not important though. I managed to open these windowses in Colorbox by placing statement:
parent.$.fn.colorbox({href: url, iframe:true,width:'960px',height:'500px', onLoad: function() { }});
inside a:
function Dialog(url, action, init){...}
But then there are 2 problems.
1. I dont know how to close colorbox from inside of iframe.
2. I dont know how to pass parameters to Xinha in function:
http://wklej.org/hash/f118f118a58/
in insert_image.html
More specific:
in function
function __dlg_close(val){
opener.Dialog._return(val); <-this line does not work.
window.close();
}
in popup.js.
Offline
So, anyone has ever tryed? Lightbox? Thightbox? Shadowbox? Anything?
Offline
Probably you will need to write your own Xinha.Dialog really, I think you roughly need these methods,
* the constructor
* show
* hide
* onresize
* toggle
* setValues
* getValues
* getElementById
* getElementsByName
look at modules/Dialogs/XinhaDialog.js and also modules/Dialogs/div-dialog.js
You will need your dialog to be called Xinha.Dialog so that it is the default, I think you would be able to, AFTER extending (see div dialog) and BEFORE loading the rest of Xinha.
Xinha.Dialog = MyDialog;
I think it should work, but you may need to tweak Xinha a bit perhaps.
James Sleeman
Offline
Oh wait, you're asking about the popup windows.
If you are using an iframe, they do not have openers I think. They have parents from memory. You'll want to use your javascript debugger and inspect exactly what is available to you, but probably changing opener to parent will get you somewhere.
James Sleeman
Offline
Yes, iframes dont have openers but parents don't work either. I mean, they SHOULD work but they don't in specific place:
function __dlg_close(val){
opener.Dialog._return(val); <-this line does not work.
window.close();
}
I tried debugging but there's no such thing as parent.Dialog, nor parent._return
I think this would be good thing for xinha but i don't know how to get to returning methods from iframe. Maybe someone would want to help me?
This is really easy. First, jquery, second colorbox, and then xinha.
And only one method:
parent.$.fn.colorbox({href: url, iframe:true,width:'960px',height:'500px', onLoad: function() { }}); OR
$.fn.colorbox({href: url, iframe:true,width:'960px',height:'500px', onLoad: function() { }});
//they should both work
inside a:
function Dialog(url, action, init){...}
Offline
You will need to examine the scope in __dlg_close at that point and see what is available. It will be there somewhere. window.parent, window.opener, something.
James Sleeman
Offline
I already did this, Google Chrome tells me that there are only 2 vars available:
'val' and 'this'.
'THIS' is a global scope of iframe i guess wich means I have access to everything yet I cant find such metods within 'this' scope nor 'this.parent' - another global scope from parent of iframe. I'll try again and maybe give a screenshot
Offline
You are obviously only seeing local scope variables, you need to look at the wider picture, there are probably hundreds of other properties than val and this available to you there! window for a start is always available.
Try with firebug.
James Sleeman
Offline