diff --git a/README.md b/README.md index c5ac4f7..8c0b321 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,14 @@ Contains some nice [jQuery](http://jquery.com) plugins to make working with the * Localization * No dependencies to jQuery.UI * Control via [`html` markup](#let-the-markup-rule) possible +* Load an external URL (using iframe) inside the modal ## Dependencies * [jQuery.form](http://jquery.malsup.com/form/) plugin >= 2.8 for ajax form submit * [jQuery.controls](https://github.com/Nikku/jquery-controls) plugin >= 0.9 for ajax link binding support * [Bootstrap styles](http://twitter.github.com/bootstrap) 2.x to look nice +* [jQuery.query](http://archive.plugins.jquery.com/project/query-object) plugin for handling urls in jquery.dialog2.iframe ## Migrating from earlier versions * Migration from 1.x: diff --git a/lib/jquery.dialog2.iframe.js b/lib/jquery.dialog2.iframe.js new file mode 100644 index 0000000..ff96f18 --- /dev/null +++ b/lib/jquery.dialog2.iframe.js @@ -0,0 +1,109 @@ +/* +* jQuery Dialog2 IFrame +* +* Licensed under the MIT license +* http://www.opensource.org/licenses/mit-license.php +* +* @version: 1.0.2 (08/03/2013) +* +* @requires jQuery >= 1.4 +* +* @requires jQuery.dialog2 plugin >= 1.1 +* +* @requires jQuery.query plugin >= 2.1.7 +* +* @author Jorge Barnaby (jorge.barnaby {at} gmail.com) +*/ +(function ($) { + + /* + * Shows a web page (using iframe) in a jQuery dialog2 (Bootstrap style). + * + */ + $.fn.dialog2IFrame = function (options) { + options = $.extend({}, $.fn.dialog2IFrame.defaults, options); + $(this).click(function (e) { + e.preventDefault(); + var idDialogOuter = "dialog-iframe-outer"; + + var mainWin = window; + var btn = this; + var $btn = $(btn); + var $dialogOuter = $('#' + idDialogOuter).length ? + $('#' + idDialogOuter) : + $('
').hide().appendTo(document.body); + var $dialogFrame = $('iframe', $dialogOuter).length ? + $('iframe', dialogOuter) : + $('