public static function renderBootstrapModalJs($item = '.btn')
{
$document = Factory::getDocument();
HTMLHelper::_('jquery.framework', false);
$s = '
jQuery(document).ready(function(){
jQuery("#phModalPlay").on("hidden.bs.modal", function (e) {
jQuery("#phModalPlay iframe").attr("src", jQuery("#phModalPlay iframe").attr("src"));
jQuery("audio").each(function(){this.pause();this.currentTime = 0;});
jQuery("video").each(function(){this.pause();this.currentTime = 0;});
});
jQuery("' . $item . '").on("click", function () {
var $target = jQuery(this).data("target");
var $href = jQuery(this).data("href");
var $body = $target + "Body";
var $dialog = $target + "Dialog";
var $height = jQuery(this).data("height");
var $width = jQuery(this).data("width");
var $heightD= jQuery(this).data("height-dialog");
var $widthD = jQuery(this).data("width-dialog");
var $type = jQuery(this).data("type");
jQuery($body).css("height", $height);
jQuery($target).css("width", $width);
jQuery($body).css("overflow-y", "auto");
jQuery($dialog).css("height", $heightD);
jQuery($dialog).css("width", $widthD);
if ($type == "image") {
jQuery($body).html(\'<img class="img-responsive" src="/apis/\' + $href + \'" />\');
} else if ($type == "document") {
$widthD = $widthD -50;
$heightD = $heightD -40;
jQuery($body).html(\'<object type="application/pdf" data="\' + $href + \'" width="\' + $widthD + \'" height="\' + $heightD + \'" ></object>\');
} else {
/*jQuery($body).load($href, function (response, status, xhr) {
if (status == "success") {
//jQuery($target).modal({ show: true });
}
});*/
}
});
});';
$document->addScriptDeclaration($s);
}