Home Academy Office 365
Office 365
Approfondisci tutto ciò che vuoi sapere su Office 365
scopri tutte le funzionalità e i vantaggi di Microsoft 365 (in precedenza Office 365). Inoltre, risponderemo alle domande più comuni in questo articolo....
5 minuti di lettura
'
html += '
'
return html;
}
function ocGetLocale() {
var localString = document.getElementsByTagName('html')[0].getAttribute("lang");
if (!localString) {
return "en";
}
if (localString.indexOf('-') === -1) {
return localString;
}
return localString.split("-")[0]
}
function isInViewport(element) {
var rect = element.getBoundingClientRect();
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.top <= (window.innerHeight || osShadowElement.documentElement.clientHeight) &&
rect.right <= (window.innerWidth || osShadowElement.documentElement.clientWidth)
);
}
function ocLogBuyClick(e) {
if (!e.target.classList.contains("onecom_plans_cta_main")) {
return;
}
var parent = e.target.parentNode.parentNode.parentNode.parentNode.parentNode;
window.dataLayer.push({
event: "addToCart",
ecommerce: {
currencyCode: parent.getAttribute("data-currency"),
add: {
actionField: {
list: document.getElementsByTagName('h1')[0].textContent
},
products: [
{
id: parent.getAttribute("data-title"),
name: parent.getAttribute("data-title"),
brand: "one.com",
category: "pps",
variant: parent.getAttribute("data-plan"),
location: document.getElementsByTagName('h1')[0].textContent,
price: parent.getAttribute("data-price"),
quantity: 1
}
]
}
}
});
}
function ocLogTrackingInfo(e) {
if ((e.getAttribute("data-marked") !== "1") || (!dataLayer)) {
return;
}
e.removeAttribute("data-marked");
if (!e.getAttribute("data-title") || e.getAttribute("data-fresh") !== "1") {
return;
}
console.info("push initiated")
window.dataLayer.push({
id: e.getAttribute("data-title"),
name: e.getAttribute("data-title"),
brand: "one.com",
category: "pps",
variant: e.getAttribute("data-plan"),
list: "/" + ocGetLocale() + "/",
location: document.getElementsByTagName('h1')[0].textContent,
price: e.getAttribute("data-price"),
position: e.getAttribute("data-position")
}
);
e.setAttribute("data-fresh", "0");
}
function ocSetImpression() {
var plans = document.getElementsByClassName('oc-plan-container');
for (var i = 0; i < plans.length; i++) {
if (isInViewport(plans[i])) {
ocLogTrackingInfo(plans[i]);
}
}
}
function ocProductImpression(e) {
var plans = document.getElementsByClassName('oc-plan-container');
for (var i = 0; i < plans.length; i++) {
if (isInViewport(plans[i])) {
plans[i].setAttribute("data-marked", "1");
ocTimeout = setTimeout(ocSetImpression, 2000)
}
}
}
/* var headingTag = window.location.hash.substr(1);
if(headingTag.length > 0){
console.log(headingTag);
osShadowElement.querySelector('#'+headingTag).scrollIntoView();
} */
//frontpage
function scrollSmooth() {
var elmntToView = osShadowElement.querySelector("#oc-plansandprices");
elmntToView.scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" });
}
const rightBtn = osShadowElement.querySelector('#right-button');
const leftBtn = osShadowElement.querySelector('#left-button');
if (rightBtn && leftBtn) {
rightBtn.addEventListener("click", function (event) {
const conent = osShadowElement.querySelector('#content');
conent.scrollLeft += 100;
event.preventDefault();
let activeElement = osShadowElement.querySelector(".banner-thumb.active");
if (osShadowElement.querySelector(".banner-menu li:last-child").classList.contains('active')) {
osShadowElement.querySelector(".banner-menu li:first-child").click();
} else {
if (activeElement.nextElementSibling) {
activeElement.nextElementSibling.click();
}
}
});
leftBtn.addEventListener("click", function (event) {
const conent = osShadowElement.querySelector('#content');
conent.scrollLeft -= 100;
event.preventDefault();
let activeElement = osShadowElement.querySelector(".banner-thumb.active");
if (osShadowElement.querySelector(".banner-menu li:first-child").classList.contains('active')) {
osShadowElement.querySelector(".banner-menu li:last-child").click();
} else {
if (activeElement.previousElementSibling) {
activeElement.previousElementSibling.click();
}
}
});
}
function nextSlide(thumbClass) {
if (thumbClass.length > 0) {
var elements = osShadowElement.querySelectorAll(".banner-section");
for (var i = 0, len = elements.length; i < len; i++) {
elements[i].style.display = "none";
}
var elements = osShadowElement.querySelectorAll(".banner-thumb");
for (var i = 0, len = elements.length; i < len; i++) {
elements[i].classList.remove("active");
}
var elmntToView = osShadowElement.querySelector('.banner-section-' + thumbClass);
elmntToView.scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" });
var menuClicked = osShadowElement.querySelector('.banner-thumb-' + thumbClass);
menuClicked.classList.add("active");
menuClicked.scrollIntoView();
osShadowElement.querySelector('.banner-section-' + thumbClass).style.display = "block";
}
}
const accordionTitlesSuccess = osShadowElement.querySelectorAll(".success-steps-col");
accordionTitlesSuccess.forEach((accordionTitle) => {
accordionTitle.addEventListener("click", () => {
if (accordionTitle.classList.contains("active")) {
accordionTitle.classList.remove("active");
} else {
const accordionTitlesWithIsOpen = document.querySelectorAll(".success-steps-col");
accordionTitlesWithIsOpen.forEach((accordionTitleWithIsOpen) => {
accordionTitleWithIsOpen.classList.remove("active");
});
accordionTitle.classList.add("active");
}
});
});
const accordionTitlesFaq = osShadowElement.querySelectorAll(".faq-col");
accordionTitlesFaq.forEach((accordionTitle) => {
accordionTitle.addEventListener("click", () => {
if (accordionTitle.classList.contains("active")) {
accordionTitle.classList.remove("active");
} else {
const accordionTitlesWithIsOpen = document.querySelectorAll(".faq-col");
accordionTitlesWithIsOpen.forEach((accordionTitleWithIsOpen) => {
accordionTitleWithIsOpen.classList.remove("active");
});
accordionTitle.classList.add("active");
}
});
});
(function () {
slide('right');
})();
/***script to call APIs starts here**/
function checkStatus(response) {
if (response.status >= 200 && response.status < 300) {
return Promise.resolve(response);
} else {
return Promise.reject(new Error(response.statusText));
}
}
function parseJson(response) {
return response.json();
}
function niceRounding(stringDigit) {
var lastDigit = stringDigit.at(-1);
if (lastDigit == 8) {
stringDigit = stringDigit.replace(/.$/, "9");
}
return stringDigit;
}
/***script to call APIs ends here**/
/**Glosssary page***/
function scrollSmoothGlossary(alphabet) {
var alphaList = osShadowElement.querySelectorAll(".alphabet-list");
for (let i = 0; i < alphaList.length; i++) {
alphaList[i].classList.remove("active");
}
var activeAlpha = osShadowElement.querySelector(".alpha-" + alphabet);
activeAlpha.classList.add("active");
var elmntToView = osShadowElement.querySelector("#div-" + alphabet);
//elmntToView.scrollTop = elmntToView.scrollHeight;
elmntToView.scrollIntoView({ behavior: "smooth" });
//elmntToView.scrollTop(elmntToView.scrollHeight);
}
/**searching**/
const $search = osShadowElement.getElementById('search-glossary');
if ($search) {
$search.addEventListener('input', (event) => {
const searchText = event.target.value;
const regex = new RegExp(searchText, 'gi');
const noSearchDiv = osShadowElement.querySelector(".no-glossary-search-found");
const itemList = osShadowElement.querySelectorAll(".oc-glossary-item-articles");
//const articleList = osShadowElement.querySelectorAll(".item-article");
var mainCount = 0;
for (let j = 0; j < itemList.length; j++) {
var articleList = itemList[j].querySelectorAll(".item-article");
var countDisplayBlock = 0;
for (let i = 0; i < articleList.length; i++) {
var h3 = articleList[i].getElementsByTagName("a")[0];
var text = h3.innerHTML;
text = text.replace(/(
|<\/mark>)/gim, '');
const newText = text.replace(regex, '$& ');
h3.innerHTML = newText;
if (text !== newText) {
articleList[i].style.display = "flex";
countDisplayBlock++;
} else {
articleList[i].style.display = "none";
}
}
if (countDisplayBlock === 0) {
itemList[j].parentNode.parentNode.style.display = "none";
} else {
itemList[j].parentNode.parentNode.style.display = "flex";
mainCount++;
}
}
if (mainCount === 0) {
noSearchDiv.classList.remove("hidden");
} else {
noSearchDiv.classList.add("hidden");
}
});
}
var select = osShadowElement.getElementById('alphabet-mobile-select');
if (select) {
select.onchange = function () {
var alphabet = this.options[this.selectedIndex].value;
this.options[this.selectedIndex].classList.add('active');
scrollSmoothGlossary(alphabet);
//var elmntToView = osShadowElement.querySelector("#" + alphabet);
//elmntToView.scrollIntoView({behavior: "smooth", block: "start", inline: "nearest"});
};
}
var glossaryHeader = osShadowElement.getElementById("glossary-header");
var glossaryStickyHeader = osShadowElement.getElementById(
"glossary-header-sticky"
);
// Get the offset position of the navbar
if (glossaryHeader) {
var sticky = glossaryHeader.offsetTop;
}
var glossarySearch = osShadowElement.querySelector(".oc-glossary-search");
// Add the sticky class to the navbar when you reach its scroll position. Remove "sticky" when you leave the scroll position
function stickyAlphabets() {
if (window.pageYOffset > sticky) {
glossaryHeader.classList.add("hidden");
glossaryStickyHeader.classList.remove("hidden");
glossaryStickyHeader.style.zIndex = "99999";
glossarySearch.classList.add("hidden");
} else {
glossaryHeader.classList.remove("hidden");
glossaryStickyHeader.classList.add("hidden");
glossarySearch.classList.remove("hidden");
}
}
/** HIGHLIGHT ALPHABET NAVIGATION LINKS WHILE SCROLLING */
// cache the navigation list-items containing links
var navigationLinks = osShadowElement.querySelectorAll('#glossary-header-sticky > .glossary-header-alphabets > ul > li');
// cache the alphabet sections
var sections = osShadowElement.querySelectorAll('.oc-glossary-item > div > span.item-head');
// map each target section ID to the corresponding navigation list-items
var sectionIdToNavigationLink = {};
for (var i = 0; i < sections.length; i++) {
var id = sections[i].id;
sectionIdToNavigationLink[id] = osShadowElement.querySelectorAll('#glossary-header-sticky > .glossary-header-alphabets > ul > li.alpha-' + id);
}
function getOffset(el) {
var _x = 0;
var _y = 0;
while (el && !isNaN(el.offsetLeft) && !isNaN(el.offsetTop)) {
_x += el.offsetLeft - el.scrollLeft;
_y += el.offsetTop - el.scrollTop;
el = el.offsetParent;
}
return { top: _y, left: _x };
}
function highlightNavigation() {
// get the current vertical position of the scroll bar
var scrollPosition = window.pageYOffset || document.documentElement.scrollTop;
// iterate the sections
for (var i = sections.length - 1; i >= 0; i--) {
var currentSection = sections[i];
// get the position of the section
var sectionTop = getOffset(currentSection).top;
// if the user has scrolled over the top of the section
if (scrollPosition >= sectionTop - 250) {
// get the section id
var id = currentSection.id;
// get the corresponding navigation link
var navigationLink = sectionIdToNavigationLink[id];
// if the link is not active
if (typeof navigationLink[0] !== 'undefined') {
if (!navigationLink[0].classList.contains('active')) {
// remove .active class from all the links
for (i = 0; i < navigationLinks.length; i++) {
navigationLinks[i].className = navigationLinks[i].className.replace(/ active/, '');
}
// add .active class to the current link
navigationLink[0].className += (' active');
}
} else {
// remove .active class from all the links
for (i = 0; i < navigationLinks.length; i++) {
navigationLinks[i].className = navigationLinks[i].className.replace(/ active/, '');
}
}
// we have found our section, so we return false to exit the each loop
return false;
}
}
}
if (glossaryHeader) {
window.addEventListener('scroll', highlightNavigation);
}
/** Glossary page ends here**/
/** NL frontpage modification - version 2.0 **/
// Get the HTML element you need.
const imageOverlay = osShadowElement.getElementById('testimonial-video-section-block-image-overlay');
const playButton = osShadowElement.getElementById('testimonial-video-section-block-play');
if (playButton) {
var vidId = playButton.getAttribute("data");
// Add the event listener for the play button.
playButton.addEventListener('click', play)
}
// The function that is called when the button is clicked.
function play(e) {
e.preventDefault();
let iframe_tag = osShadowElement.getElementById('ytplayer');
iframe_tag.setAttribute('src', 'https://www.youtube.com/embed/' + vidId + '?autoplay=1&enablejsapi=1&origin=http%3A%2F%2Flocalhost&widgetid=1');
imageOverlay.style.opacity = '0';
playButton.style.opacity = '0';
window.setTimeout(function () {
playButton.style.display = 'none';
imageOverlay.style.display = 'none';
}, 800); // timed to match animation-duration
}
// Glossary page navigationbar issue fix Start
let elemWebTopMenu = document.querySelector(".WebTop-Nav");
let elemWebTopSearch = document.querySelector(".MegaMenuAndSearchWrapper");
let elem = document.querySelector("#glossary-header-sticky");
if (elem && ( elemWebTopMenu || elemWebTopSearch ) ) {
let rect = elem.getBoundingClientRect();
let elemTop = rect.top;
let elemBottom = rect.bottom;
let rectWebTop = elemWebTopMenu.getBoundingClientRect();
let elemTopWebTop = rectWebTop.top;
let elemBottomWebTop = rectWebTop.bottom;
let rectWebTopSearch = elemWebTopSearch.getBoundingClientRect();
let elemTopWebTopSearch = rectWebTopSearch.top;
let elemBottomWebTopSearch = rectWebTopSearch.bottom;
if ( ( elemBottomWebTopSearch >= elemTop ) || ( elemBottomWebTop >= elemTop ) ) {
elem.style.zIndex = 200;
} else {
elem.style.zIndex = 0;
}
document.addEventListener('scroll', function() {
let rect = elem.getBoundingClientRect();
let elemTop = rect.top;
let elemBottom = rect.bottom;
let rectWebTop = elemWebTopMenu.getBoundingClientRect();
let elemTopWebTop = rectWebTop.top;
let elemBottomWebTop = rectWebTop.bottom;
let rectWebTopSearch = elemWebTopSearch.getBoundingClientRect();
let elemTopWebTopSearch = rectWebTopSearch.top;
let elemBottomWebTopSearch = rectWebTopSearch.bottom;
if ( ( elemBottomWebTopSearch >= elemTop ) || ( elemBottomWebTop >= elemTop ) ) {
elem.style.zIndex = 200;
} else {
elem.style.zIndex = 0;
}
});
}
let glossaryNav = document.querySelector("#glossary-header-sticky");
let topSearchBarGloss = document.querySelector(".MegaMenuAndSearchWrapper");
let navSpacer = document.querySelector(".NavSpacer");
if ( glossaryNav && topSearchBarGloss) {
topSearchBarGloss.style.position = 'static';
navSpacer.style.display = 'none';
}
// Glossary page navigationbar issue fix End
/******* Custom YouTube video embed js start *******/
let yt_thumb_wraps = document.querySelectorAll('.yt-video-wrapper.yt-play-icon');
if (yt_thumb_wraps) {
yt_thumb_wraps.forEach(yt_thumb_wrap => {
yt_thumb_wrap.addEventListener("click", function(event) {
event.preventDefault();
let vid = event.target.dataset.vid;
let yt_thumb = event.target;
let vtitle = yt_thumb.getAttribute("title");
if(!vid){
yt_thumb = yt_thumb.querySelector('.yt-thumb-image');
vid = yt_thumb.dataset.vid;
vtitle = yt_thumb.getAttribute("title");
}
if(vid && yt_thumb){
let ytvideo = 'VIDEO ';
let yt_thumb_wrap = yt_thumb.closest('.yt-video-wrapper.yt-play-icon');
yt_thumb_wrap.innerHTML = ytvideo;
yt_thumb_wrap.classList.remove("yt-play-icon");
}
});
});
}
/******* Custom YouTube video embed js end *******/