/* Teams doc embedding via custom WRAP teamsdoc */
jQuery(function() {
if (typeof(wrap_teamsdoc) === 'undefined')
{
wrap_teamsdoc = true;
var original_url = jQuery(".wrap_teamsdoc").text();
var url = original_url;
url = url.replace("&mobileredirect=true", "");
url = url.replace("&action=default", "");
url = url.replace("%7B", "{");
url = url.replace("%7D", "}");
var pos = url.indexOf("&file=");
if (pos > 0) {
url = url.substring(0, url.indexOf("&file="));
}
if (url != "")
{
url = url.trim() + "&action=embedview";
console.log("CYA : TEAMSDOC", url);
jQuery(".wrap_teamsdoc").html('Show doc in Teams');
document.querySelectorAll(".wrap_teamsdoc iframe").forEach(function(e) {
e.style.aspectRatio = "1 / 2";
});
}
}
});