/************************************************************************************************************************************************************************************************************ * * JS PER AUDIO IN IMAGE PLUS * ************************************************************************************************************************************************************************************************************/ function ajaxAttachedDocsDrawer(elt, appendPopupDiv) { var tagsList = ""; appendPopupDiv = true; if (appendPopupDiv && isEmpty($('body').find('#iplus_popupMedia'))) $('body').append('
'); var fileContainerPath = contextPath + '/applications/webwork/parts/partFileContainer.jsp'; var $divPopMed = $("div#iplus_popupMedia"); var links = $("#" + $(elt).attr("id") + " a").map( function () { var href = $(this).attr('href'); if (href) { if (href.startsWith("#") && href.length > 1) { var $tag = $(href); var html = $tag.html(); if (html) { //findIPlusMedia($(this)); changeIplusMediaTextA($(this)); findIPlusMedia($(this)); } else { return href; } } } }).get(); if (links.length > 0) { links = jQuery.unique(links); tagsList = (("" + links ).split("[").join("")).split("]").join("").split(" ").join("");//.split("#").join("@"); ajaxAttMedia(tagsList, $divPopMed, fileContainerPath); //setTimeout( $("#" + $(elt).attr("id") + " a").map( function () { var href = $(this).attr('href'); if (href) { if (href.startsWith("#") && href.length > 1) { var $tag = $(href); var html = $tag.html(); if (html) { changeIplusMediaTextA($(this)); findIPlusMedia($(this)); } else { removeIPlusMediaClass($(this)); return href; } } } }).get(); // ,1000); } $("#" + $(elt).attr("id") + " a").map( function () { var href = $(this).attr('href'); if (href) { if (href.startsWith('^$^')) { ajaxAttTeo($(this), $divPopMed, fileContainerPath); return $(this); } } }).get(); /* if (linksA.length > 0) { console.debug("linksA"); console.debug(linksA); for (var prop in linksA) { ajaxAttTeo(prop, $divPopMed, fileContainerPath); } }*/ getMbMediaPlayer(); } function ajaxAttMedia( tagsList, $divPopMed, fileContainerPath) { var data = { 'TAGS':tagsList, 'isSingleFile':'yes'}; $.ajax({ async:false, data:data, url:fileContainerPath, dataType:'html', cache:false, success:function (html) { if (html) { var $absDiv = $(html); $absDiv.hide(); $absDiv.insertAfter($divPopMed); } } }); } function ajaxAttMediaTag( tag, $divPopMed, fileContainerPath) { var data = { 'TAG':tag, 'isSingleFile':'yes'}; $.ajax({ async:false, data:data, url:fileContainerPath, dataType:'html', cache:false, success:function (html) { if (html) { var $absDiv = $(html); $absDiv.hide(); $absDiv.insertAfter($divPopMed); } } }); } /*function mbMediaPlayer(elt) { $("#" + $(elt).attr("id") + " a").map( function () { var href = $(this).attr('tag'); if (href) { if (href.startsWith("#") && href.length > 1) { var $tag = $(href); var html = $tag.html(); if (html) { getmediaDesign($tag) ; } else { return href; } } } }).get(); }*/ function getMbMediaPlayer(){ if ($(".mb_mm_audio_player").length > 0) { $(".mb_mm_audio_player").each(function(){ var thisAudio = $(this); var thisId = thisAudio.attr("id"); if ($("#JPL_mb_" + thisId).attr("id")==undefined) { $.mbMiniPlayer.swfPath = "" + contextPath + "/commons/layout/multimedia/audioPlayer/inc/"; $(thisAudio).mb_miniPlayer({ inLine:false, width:120, skin:"black" }); } }); } } function ajaxAttTeo(ele, $divPopMed, fileContainerPath) { var $this = $(ele); var href = $this.attr('href'); var isSingleFile = href.startsWith('^$^SF_'); var isImagePlus = href.startsWith('^$^IPS_'); var elId; if (isSingleFile) elId = href.substring(6); else if (isImagePlus) elId = href.substring(7); var tag = ''; // per evitare di modificare tutti i link nei testi di Chambra if (!isSingleFile && !isImagePlus) { tag = href.substring(1); isSingleFile = true; } var str = $this.attr('data-elindom'); var elInDOM = !str || "yes" == str; data = {'elId':elId, 'isIncluded':elInDOM ? 'yes' : 'no', 'isSingleFile':(isSingleFile ? 'yes' : 'no' ), 'isImagePlus':(isImagePlus ? 'yes' : 'no'), 'TAG':tag}; $.ajax({ async:false, data:data, url:fileContainerPath, dataType:'html', cache:false, success:function (html) { if (html) { // elemento in page if (isImagePlus || elInDOM) { var $html = $(html); $html.insertAfter($this); //$('
').insertAfter($html); $this.remove(); // audio in popup } else { href = href.replace("^$^", ""); var $absDiv = $("
" + _floatingDivContainer(html, href) + "
"); $absDiv.hide(); $absDiv.insertAfter($divPopMed); $this.removeAttr('href').attr('href', '#' + href); findIPlusMedia($this); } } } }); } function _floatingDivContainer(html, href) { html = "
" + " " + " " + " " + " " + " " + " " + " " + " " + " " + "
" + " " + "
" + html + "
" + "

"; return html; } function findIPlusMedia($a) { var href = $a.attr("href"); var iplusFrame = $a.parents('div').filter('.iplus_frame'); $a.removeAttr("href"); if (!$a.attr("tag")) $a.attr("tag", href); if (iplusFrame.attr('class') == "iplus_frame") { $a.parents('div').filter(':first').addClass('iplus_tabMediaFrame').attr("tag", href); $a.addClass("iplus_tabMedia"); } else $a.addClass("iplus_tabMedia"); } function removeIPlusMediaClass($a) { var href = $a.attr("href"); var parentDiv = $a.parents('div').filter('.iplus_frame'); if (parentDiv.attr('class') == "iplus_frame") { $a.parents('div').filter(':first').removeClass("iplus_tabMediaFrame").attr("tag", href); $a.removeClass("iplus_tabMedia"); } else $a.removeClass("iplus_tabMedia"); $a.attr("href", $a.attr('tag')); } function openIplusMediaDiv(elt) { $(elt).find("a.iplus_tabMedia,a.iplus_tabMediaFrame,div.iplus_tabMediaFrame").each(function () { var $this = $(this); var $tag = $($this.attr('tag')); var html = $tag.html(); if (!html) { removeIPlusMediaClass($this); } else { $this.click( function () { hideAllIPlusMediaDiv(); _stopReadAlongs(); nearBestPosition(this.id, $tag.attr('id')); // playInPlace if ($this.attr('data-playInPlace') == "yes" || $this.attr('data-playInPlace')==undefined) { $tag.find('.play').click(); // classe del play di mbPlayer } else { $tag.css({zIndex:'999'}); $tag.show(); $tag.slideDown("slow"); } } ); } }); } function openIplusMediaDivTag(ele) { var $this = $(ele); if ($this.hasClass('iplus_tabMediaFrame')){ var $tag = $($this.attr('tag')); var html = $tag.html(); if (!html) { removeIPlusMediaClass($this); } else { hideAllIPlusMediaDiv(); _stopReadAlongs(); nearBestPosition(ele.id, $tag.attr('id')); // playInPlace if ($this.attr('data-playInPlace') == "yes" || $this.attr('data-playInPlace')==undefined) { $tag.find('.play').click(); // classe del play di mbPlayer } else { $tag.css({zIndex:'999'}); $tag.show(); $tag.slideDown("slow"); } } } } function hideIPlusMediaDiv(elt) { var $this = $(elt); var tag = $this.attr('tag'); var parentDiv = $this.parents('div').filter("#" + tag); parentDiv.hide(); hideAllIPlusMediaDiv(); } function changeIplusMediaText(elt) { $(elt).find("a.iplus_tabMedia,a.iplus_tabMediaFrame,div.iplus_tabMediaFrame").each(function () { var $this = $(this); var parentDiv = $this.parents('div').filter('.iplus_frame'); var $a; if (parentDiv.attr('class') == "iplus_frame") { $a = $this.find("a"); parentDiv.css({textAlign:"center", verticalAlign:"middle"}); } else $a = $this; var linkText = $a.parents('div').filter('.iplus_div_wrapper').attr('data-txt'); var textEx = linkText && linkText != ''; var text = ""; text += (textEx ? linkText : ""); if (!($this.attr('data-hideAudioImg') == "yes")) { text += "audio "; } text += ""; $a.html(text); }); } function changeIplusMediaTextA(elt) { var $this = $(elt); var $a; $a = $this; var linkText = $this.parents('div').filter('.iplus_div_wrapper').attr('data-txt'); var textEx = linkText && linkText != ''; var text = ""; text += (textEx ? linkText : ""); if (!($this.attr('data-hideAudioImg') == "yes")) { text += "audio "; } text += ""; $a.html(text); }