// Added by Solin, Onno Schuit, onno@solin.nl, February 2016 $(document).ready(function(){ //console.log('Okay so far from init_colorbox'); var queries = {}; $.each(document.location.search.substr(1).split('&'), function(c,q){ var i = q.split('='); if (typeof i !== 'undefined') { if ( (typeof i[0] !== 'undefined') && (typeof i[1] !== 'undefined') ){ queries[i[0].toString()] = i[1].toString(); } } }); $(".iframe").colorbox({ iframe:true, width:"100%", height:"100%", current: "Activity {current} of {total}", onLoad:function(){ //console.log('now loading content of iframe'); }, onClosed:function() { location.reload(true); //window.location.href = window.location.href.split('?')[0] + '?' + querystring + '&selected_section=' + M.format_grid.selected_section_no; }, onOpen:function(){ $("#colorbox").hide(); }, onComplete:function() { // The onComplete event finishes when the colorbox is ready. The content is not necessarily loaded yet. So we hide the content for now. // The content will be set to visible by the freshly loaded page (so, by the content itself) $('#cboxLoadedContent').hide(); $("#colorbox").show(); // The iframe is only now available $("iframe.cboxIframe").each(function() { // Add onload handler $(this).load(function() { //console.log('Completely loaded: ' + this.contentWindow.location); // Now that the iframe is completely loaded, we can proceed to attach an unload handler to the contentWindow. $(this.contentWindow).unload(function() { //console.log('content window is being unloaded'); // Hide the content of the colorbox (toggled to visibility again in /theme/bizzdesign/javascript/add_css_class_in_iframe.js) $('#cboxLoadedContent').hide(); }); }); }); } }); //console.log('executed init_colorbox'); });