(function (window, $) { dnnmodal = { //global scope load: function () { //this method prevents the popup from flashing before closing, also redirects the parent window. //parent and parent.parent needs to be assign to a varaible for opera compatibility issues. try { if (parent.location.href !== undefined) { var windowtop = parent; var parenttop = windowtop.parent; if (typeof (parenttop.$find) != "undefined") { if (location.href.indexof('popup') == -1 || windowtop.location.href.indexof("popup") > -1) { var popup = windowtop.jquery("#ipopup"); var refresh = popup.dialog("option", "refresh"); var closingurl = popup.dialog("option", "closingurl"); if (closingurl == "") { closingurl = location.href } if (popup.dialog('isopen') === true) { popup.dialog("option", { close: function (event, ui) { dnnmodal.closepopup(refresh, closingurl); } }).dialog('close'); } } else { windowtop.jquery("#ipopup").dialog({ title: document.title }); } } } } catch (err) { return false; } }, show: function (url, showreturn, height, width, refresh, closingurl) { var $modal = $("#ipopup"); if ($modal.length == 0) { $modal = $(""); $(document).find('html').css('overflow', 'hidden'); $(document).append($modal); } var windowtop = parent; //needs to be assign to a varaible for opera compatibility issues. $modal.dialog({ modal: true, autoopen: true, dialogclass: "dnnformpopup", position: "center", minwidth: width, minheight: height, maxwidth: 1920, maxheight: 1080, resizable: true, closeonescape: true, zindex: 100000, refresh: refresh, closingurl: closingurl, close: function (event, ui) { dnnmodal.closepopup(refresh, closingurl); } }) .width(width - 11) .height(height - 11); if ($('.ui-dialog-title').next('a.dnnmodalctrl').length === 0) { var $dnnmodalctrl = $(''); $('a.ui-dialog-titlebar-close').wrap($dnnmodalctrl); var $dnntogglemax = $('max'); $('a.ui-dialog-titlebar-close').before($dnntogglemax); $dnntogglemax.click(function (e) { e.preventdefault(); var $window = $(window), $this = $(this), newheight, newwidth, newposition; if ($modal.data('ismaximized')) { newheight = $modal.data('height'); newwidth = $modal.data('width'); newposition = $modal.data('position'); $modal.data('ismaximized', false); } else { $modal.data('height', $modal.dialog("option", "minheight")) .data('width', $modal.dialog("option", "minwidth")) .data('position', $modal.dialog("option", "position")); newheight = $window.height() - 46; newwidth = $window.width() - 40; newposition = [0, 0]; $modal.data('ismaximized', true); } $modal.dialog({ height: newheight, width: newwidth }); $modal.dialog({ position: 'center' }); }); } //$('a.ui.dialog-titlebar-close').before(''); // if ($('.ui-dialog-title').next("a.dnntogglemax").length === 0) { // var $dnntogglemax = $('max'); // $('.ui-dialog-title').after($dnntogglemax); // $dnntogglemax.click(function (e) { // e.preventdefault(); // var $window = $(window), // $this = $(this), // newheight, // newwidth, // newposition; // if ($modal.data('ismaximized')) { // newheight = $modal.data('height'); // newwidth = $modal.data('width'); // newposition = $modal.data('position'); // $modal.data('ismaximized', false); // } else { // $modal.data('height', $modal.dialog("option", "minheight")) // .data('width', $modal.dialog("option", "minwidth")) // .data('position', $modal.dialog("option", "position")); // newheight = $window.height() - 36; // newwidth = $window.width() - 36; // newposition = [0, 0]; // $modal.data('ismaximized', true); // } // $this.toggleclass('ui-dialog-titlebar-max'); // $this.next().toggleclass('titlebar-max'); // $modal.dialog({ height: newheight, width: newwidth }); // $modal.dialog({ position: 'center' }); // }); // }; var showloading = function () { var loading = $("
"); loading.css({ width: $modal.width() , height: $modal.height() }); $modal.before(loading); }; var hideloading = function () { $modal.prev(".dnnloading").remove(); }; showloading(); $modal[0].src = url; $modal.bind("load", function () { hideloading(); }); if (showreturn.tostring() == "true") { return false; } }, closepopup: function (refresh, url) { var windowtop = parent; //needs to be assign to a varaible for opera compatibility issues. if (typeof refresh === "undefined") { refresh = true; } if ((typeof url === "undefined") || (url == "")) { url = windowtop.location; } if (refresh.tostring() == "true") { windowtop.location.href = url; $(this).hide(); } else { $(this).remove(); } $(windowtop.document).find('html').css('overflow', ''); } }; dnnmodal.load(); } (window, jquery))