[Resolved] [Plugin: Attachments] attachments.js, thickbox iframe within a thickbox iframe
I have a peculiar application whereby my post edit screen is presented in a thickbox window, instead of being the top.document.
When I click the “Attach” button located in the Attachments metabox on the post edit screen, that brings up the “Attach a file” thickbox containing the media-upload interface, within the thickbox that is already existing and holding my post edit screen.
So now I have a top.document, a first thickbox containing the post edit screen, and a second thickbox (within the first thickbox) containing the media-upload interface.
Clicking “attach” in the media-upload interface pops up the “Attached!” message, but the attachment is not actually showing up in the Attachments metabox on the post edit screen, which exists as an upper level iframe instead of all the way at top.document.
I replaced all top.document references in attachments.js with parent.document but that did not fix the problem. I’m looking at theparent=jQuery(this).parent().parent().parent() and thinking the trouble may be in there someone, but the js here is a little over my head.
This issue is outside the scope of the plugin as it’s meant to be used in a standard WordPress admin.
Stating that issue is outside the scope of the plugin is not actually a “resolution.” I’m not sure what is referred to by a “standard WordPress admin.” I am not able to find this reference in the documentation.
If readers are interested in an actual resolution, it can be had by adding something to the effect of
attach_list = Query(document).find('#attachments_list');as the first line of the attachments_handle_attach function, and then replacing the four references to top.document that appear in the attachments_handle_attach function with the variable attach_list that you just created.
In this manner, the script will successfully locate the attachments wherever they might appear within the DOM, and not blindly assume that they are in top.document.
The entire attachments.js from version 1.6.1 of the attachments plugin is reproduced here with the suggested changes. It has been reformatted with an emphasis on comprehensibility.
- The topic ‘[Resolved] [Plugin: Attachments] attachments.js, thickbox iframe within a thickbox iframe’ is closed to new replies.