diff --git a/business_solutions/jquery.tocify.min.js b/business_solutions/jquery.tocify.min.js
index 55f8a9d..5051d08 100644
--- a/business_solutions/jquery.tocify.min.js
+++ b/business_solutions/jquery.tocify.min.js
@@ -1,5 +1,4 @@
-/*! jquery.tocify - v1.9.0 - 2013-10-01
-* http://gregfranko.com/jquery.tocify.js/
-* Copyright (c) 2013 Greg Franko; Licensed MIT*/
-
-!function(){"use strict";!function(r,d,c){"use strict";var o="tocify",e="tocify-focus",t="tocify-hover",n="tocify-hide",a="tocify-header",i="."+a,l="tocify-subheader",h="."+l,f="tocify-item",u="."+f,p="tocify-extend-page",g="."+p;r.widget("toc.tocify",{version:"1.9.0",options:{context:"body",ignoreSelector:null,selectors:"h1, h2, h3",showAndHide:!0,showEffect:"slideDown",showEffectSpeed:"medium",hideEffect:"slideUp",hideEffectSpeed:"medium",smoothScroll:!0,smoothScrollSpeed:"medium",scrollTo:0,showAndHideOnScroll:!0,highlightOnScroll:!0,highlightOffset:40,theme:"bootstrap",extendPage:!0,extendPageOffset:100,history:!0,scrollHistory:!1,hashGenerator:"compact",highlightDefault:!0},_create:function(){var e=this;e.extendPageScroll=!0,e.items=[],e._generateToc(),e._addCSSClasses(),e.webkit=function(){for(var e in d)if(e&&-1!==e.toLowerCase().indexOf("webkit"))return!0;return!1}(),e._setEventHandlers(),r(d).load(function(){e._setActiveElement(!0),r("html, body").promise().done(function(){setTimeout(function(){e.extendPageScroll=!1},0)})})},_generateToc:function(){var e,t,s=this,i=s.options.ignoreSelector;return e=-1!==this.options.selectors.indexOf(",")?r(this.options.context).find(this.options.selectors.replace(/ /g,"").substr(0,this.options.selectors.indexOf(","))):r(this.options.context).find(this.options.selectors.replace(/ /g,"")),e.length?(s.element.addClass(o),e.each(function(e){r(this).is(i)||(t=r("
",{id:a+e,class:a}).append(s._nestElements(r(this),e)),s.element.append(t),r(this).nextUntil(this.nodeName.toLowerCase()).each(function(){0===r(this).find(s.options.selectors).length?r(this).filter(s.options.selectors).each(function(){r(this).is(i)||s._appendSubheaders.call(this,s,t)}):r(this).find(s.options.selectors).each(function(){r(this).is(i)||s._appendSubheaders.call(this,s,t)})}))}),undefined):(s.element.addClass(n),undefined)},_setActiveElement:function(e){var t=this,s=d.location.hash.substring(1),i=t.element.find('li[data-unique="'+s+'"]');return s.length?(t.element.find("."+t.focusClass).removeClass(t.focusClass),i.addClass(t.focusClass),t.options.showAndHide&&i.click()):(t.element.find("."+t.focusClass).removeClass(t.focusClass),!s.length&&e&&t.options.highlightDefault&&t.element.find(u).first().addClass(t.focusClass)),t},_nestElements:function(t,e){var s,i,o;return s=r.grep(this.items,function(e){return e===t.text()}),s.length?this.items.push(t.text()+e):this.items.push(t.text()),o=this._generateHashValue(s,t,e),i=r("",{class:f,"data-unique":o}).append(r("",{text:t.text()})),t.before(r("",{name:o,"data-unique":o})),i},_generateHashValue:function(e,t,s){var i="",o=this.options.hashGenerator;if("pretty"===o){for(i=t.text().toLowerCase().replace(/\s/g,"-");i.indexOf("--")>-1;)i=i.replace(/--/g,"-");for(;i.indexOf(":-")>-1;)i=i.replace(/:-/g,"-")}else i="function"==typeof o?o(t.text(),t):t.text().replace(/\s/g,"");return e.length&&(i+=""+s),i},_appendSubheaders:function(e,t){var s=r(this).index(e.options.selectors),i=r(e.options.selectors).eq(s-1),o=+r(this).prop("tagName").charAt(1),n=+i.prop("tagName").charAt(1);n>o?e.element.find(h+"[data-tag="+o+"]").last().append(e._nestElements(r(this),s)):o===n?t.find(u).last().after(e._nestElements(r(this),s)):t.find(u).last().after(r("",{class:l,"data-tag":o})).next(h).append(e._nestElements(r(this),s))},_setEventHandlers:function(){var h=this;this.element.on("click.tocify","li",function(){if(h.options.history&&(d.location.hash=r(this).attr("data-unique")),h.element.find("."+h.focusClass).removeClass(h.focusClass),r(this).addClass(h.focusClass),h.options.showAndHide){var e=r('li[data-unique="'+r(this).attr("data-unique")+'"]');h._triggerShow(e)}h._scrollTo(r(this))}),this.element.find("li").on({"mouseenter.tocify":function(){r(this).addClass(h.hoverClass),r(this).css("cursor","pointer")},"mouseleave.tocify":function(){"bootstrap"!==h.options.theme&&r(this).removeClass(h.hoverClass)}}),(h.options.extendPage||h.options.highlightOnScroll||h.options.scrollHistory||h.options.showAndHideOnScroll)&&r(d).on("scroll.tocify",function(){r("html, body").promise().done(function(){var o,e,t,s,n=r(d).scrollTop(),i=r(d).height(),a=r(c).height(),l=r("body")[0].scrollHeight;if(h.options.extendPage&&(h.webkit&&n>=l-i-h.options.extendPageOffset||!h.webkit&&i+n>a-h.options.extendPageOffset)&&!r(g).length){if(e=r('div[data-unique="'+r(u).last().attr("data-unique")+'"]'),!e.length)return;t=e.offset().top,r(h.options.context).append(r("",{class:p,height:Math.abs(t-n)+"px","data-unique":p})),h.extendPageScroll&&(s=h.element.find("li.active"),h._scrollTo(r('div[data-unique="'+s.attr("data-unique")+'"]')))}setTimeout(function(){var e,s=null,i=null,t=r(h.options.context).find("div[data-unique]");t.each(function(e){var t=Math.abs((r(this).next().length?r(this).next():r(this)).offset().top-n-h.options.highlightOffset);return null==s||s>t?(s=t,i=e,undefined):!1}),e=r(t[i]).attr("data-unique"),o=r('li[data-unique="'+e+'"]'),h.options.highlightOnScroll&&o.length&&(h.element.find("."+h.focusClass).removeClass(h.focusClass),o.addClass(h.focusClass)),h.options.scrollHistory&&d.location.hash!=="#"+e&&d.location.replace("#"+e),h.options.showAndHideOnScroll&&h.options.showAndHide&&h._triggerShow(o,!0)},0)})})},show:function(e){var t=this;if(!e.is(":visible"))switch(e.find(h).length||e.parent().is(i)||e.parent().is(":visible")?e.children(h).length||e.parent().is(i)||(e=e.closest(h)):e=e.parents(h).add(e),t.options.showEffect){case"none":e.show();break;case"show":e.show(t.options.showEffectSpeed);break;case"slideDown":e.slideDown(t.options.showEffectSpeed);break;case"fadeIn":e.fadeIn(t.options.showEffectSpeed);break;default:e.show()}return e.parent().is(i)?t.hide(r(h).not(e)):t.hide(r(h).not(e.closest(i).find(h).not(e.siblings()))),t},hide:function(e){var t=this;switch(t.options.hideEffect){case"none":e.hide();break;case"hide":e.hide(t.options.hideEffectSpeed);break;case"slideUp":e.slideUp(t.options.hideEffectSpeed);break;case"fadeOut":e.fadeOut(t.options.hideEffectSpeed);break;default:e.hide()}return t},_triggerShow:function(e,t){var s=this;return e.parent().is(i)||e.next().is(h)?s.show(e.next(h),t):e.parent().is(h)&&s.show(e.parent(),t),s},_addCSSClasses:function(){return"jqueryui"===this.options.theme?(this.focusClass="ui-state-default",this.hoverClass="ui-state-hover",this.element.addClass("ui-widget").find(".toc-title").addClass("ui-widget-header").end().find("li").addClass("ui-widget-content")):"bootstrap"===this.options.theme?(this.element.find(i+","+h).addClass("nav nav-list"),this.focusClass="active"):(this.focusClass=e,this.hoverClass=t),this},setOption:function(){r.Widget.prototype._setOption.apply(this,arguments)},setOptions:function(){r.Widget.prototype._setOptions.apply(this,arguments)},_scrollTo:function(e){var t=document.querySelector('div[data-unique="'+e.attr("data-unique")+'"]');if(t)t.scrollIntoView({behavior:this.options.smoothScroll?"smooth":"auto",block:"start"});return this}})}(window.jQuery,window,document)}();
\ No newline at end of file
+/*! jquery.tocify - v1.9.0 - 2013-10-01
+ * http://gregfranko.com/jquery.tocify.js/
+ * Copyright (c) 2013 Greg Franko; Licensed MIT*/
+!function(){"use strict";var a,l,h,o,s,n,r,i,d,c;a=window.jQuery,l=window,h=document,s="."+(o="tocify-header"),r="."+(n="tocify-subheader"),d="."+(i="tocify-item"),c="tocify-extend-page",a.widget("toc.tocify",{version:"1.9.0",options:{context:"body",ignoreSelector:null,selectors:"h1, h2, h3",showAndHide:!0,showEffect:"slideDown",showEffectSpeed:"medium",hideEffect:"slideUp",hideEffectSpeed:"medium",smoothScroll:!0,smoothScrollSpeed:"medium",scrollTo:0,showAndHideOnScroll:!0,highlightOnScroll:!0,highlightOffset:40,theme:"bootstrap",extendPage:!0,extendPageOffset:100,history:!0,scrollHistory:!1,hashGenerator:"compact",highlightDefault:!0},_create:function(){var e=this;e.extendPageScroll=!0,e.items=[],e._generateToc(),e._addCSSClasses(),e.webkit=function(){for(var e in l)if(e&&-1!==e.toLowerCase().indexOf("webkit"))return!0;return!1}(),e._setEventHandlers(),a(l).load(function(){e._setActiveElement(!0),a("html, body").promise().done(function(){setTimeout(function(){e.extendPageScroll=!1},0)})})},_generateToc:function(){var t,s=this,i=s.options.ignoreSelector,e=-1!==this.options.selectors.indexOf(",")?a(this.options.context).find(this.options.selectors.replace(/ /g,"").substr(0,this.options.selectors.indexOf(","))):a(this.options.context).find(this.options.selectors.replace(/ /g,""));return e.length?(s.element.addClass("tocify"),void e.each(function(e){a(this).is(i)||(t=a("",{id:o+e,class:o}).append(s._nestElements(a(this),e)),s.element.append(t),a(this).nextUntil(this.nodeName.toLowerCase()).each(function(){(0===a(this).find(s.options.selectors).length?a(this).filter(s.options.selectors):a(this).find(s.options.selectors)).each(function(){a(this).is(i)||s._appendSubheaders.call(this,s,t)})}))})):void s.element.addClass("tocify-hide")},_setActiveElement:function(e){var t=this,s=l.location.hash.substring(1),i=t.element.find('li[data-unique="'+s+'"]');return s.length?(t.element.find("."+t.focusClass).removeClass(t.focusClass),i.addClass(t.focusClass),t.options.showAndHide&&i.click()):(t.element.find("."+t.focusClass).removeClass(t.focusClass),!s.length&&e&&t.options.highlightDefault&&t.element.find(d).first().addClass(t.focusClass)),t},_nestElements:function(t,e){var s=a.grep(this.items,function(e){return e===t.text()});return s.length?this.items.push(t.text()+e):this.items.push(t.text()),s=this._generateHashValue(s,t,e),e=a("",{class:i,"data-unique":s}).append(a("",{text:t.text()})),t.before(a("",{name:s,"data-unique":s})),e},_generateHashValue:function(e,t,s){var i="",o=this.options.hashGenerator;if("pretty"===o){for(i=t.text().toLowerCase().replace(/\s/g,"-");-1",{class:n,"data-tag":o})).next(r).append(e._nestElements(a(this),s))},_setEventHandlers:function(){var n=this;this.element.on("click.tocify","li",function(){var e;n.options.history&&(l.location.hash=a(this).attr("data-unique")),n.element.find("."+n.focusClass).removeClass(n.focusClass),a(this).addClass(n.focusClass),n.options.showAndHide&&(e=a('li[data-unique="'+a(this).attr("data-unique")+'"]'),n._triggerShow(e)),n._scrollTo(a(this))}),this.element.find("li").on({"mouseenter.tocify":function(){a(this).addClass(n.hoverClass),a(this).css("cursor","pointer")},"mouseleave.tocify":function(){"bootstrap"!==n.options.theme&&a(this).removeClass(n.hoverClass)}}),(n.options.extendPage||n.options.highlightOnScroll||n.options.scrollHistory||n.options.showAndHideOnScroll)&&a(l).on("scroll.tocify",function(){a("html, body").promise().done(function(){var t,o=a(l).scrollTop(),e=a(l).height(),s=a(h).height(),i=a("body")[0].scrollHeight;if(n.options.extendPage&&(n.webkit&&o>=i-e-n.options.extendPageOffset||!n.webkit&&e+o>s-n.options.extendPageOffset)&&!a(".tocify-extend-page").length){if(!(i=a('div[data-unique="'+a(d).last().attr("data-unique")+'"]')).length)return;e=i.offset().top,a(n.options.context).append(a("",{class:c,height:Math.abs(e-o)+"px","data-unique":c})),n.extendPageScroll&&(s=n.element.find("li.active"),n._scrollTo(a('div[data-unique="'+s.attr("data-unique")+'"]')))}setTimeout(function(){var s=null,i=null,e=a(n.options.context).find("div[data-unique]");e.each(function(e){var t=Math.abs((a(this).next().length?a(this).next():a(this)).offset().top-o-n.options.highlightOffset);return(null==s||t {
const lan = document.documentElement.lang;
-
return lan ? document.documentElement.lang : "ru";
};
@@ -13,186 +12,125 @@ function getProduct() {
case "elma-rpa.ai":
product = {
name: "rpa",
-
id: "33678c11-fea6-4adb-aa39-adc4e8295b53",
};
-
break;
-
case "www.elma-bpm.ru":
product = {
name: "elma3/4",
-
id: "44b97702-146c-414b-9db7-0b09705556ed",
};
-
break;
-
default:
product = {
name: "elma365",
-
id: "3354c78a-720e-4584-a9c6-83f0f1396d22",
};
-
break;
}
-
return product;
}
-document
- .querySelector(".solution-select")
- .addEventListener("mouseenter", function () {
- this.classList.add("active");
-
- document.querySelector(".solution-select__list").classList.add("active");
- });
-
-document
- .querySelector(".solution-select__list")
- .addEventListener("mouseleave", function () {
- this.classList.remove("active");
-
- document.querySelector(".solution-select").classList.remove("active");
- });
-
-const titleName = () => {
- let textSpanTitle = document.querySelector(".solution-select__selected");
-
- let currentPlace = window.location.pathname
- .replace("/en/help/", "")
- .split("/")[0];
-
- textSpanTitle.textContent =
- currentPlace.charAt(0).toUpperCase() + currentPlace.slice(1);
-
- if (currentPlace === "crm" || "ecm") {
- textSpanTitle.textContent = currentPlace.toUpperCase();
- }
-
- if (currentPlace === "business_solutions") {
- let business = currentPlace.replace("_", " ");
-
- textSpanTitle.textContent =
- business.charAt(0).toUpperCase() +
- business.slice(1, 8) +
- " " +
- business.charAt(9).toUpperCase() +
- business.slice(10);
- }
-};
-
-/*// Commerce version
-
-const files = document.querySelectorAll(".filelink");
-
-if (files.length) {
-
- files.forEach((file) =>
-
- file.setAttribute("download", "Postman_collection.json")
-
- );
-
-}*/
-
const insertWordBreaks = (selector) => {
document.querySelectorAll(selector).forEach((el) => {
- el.innerHTML = el.textContent.replace(/([\/\-=<>:_])/g, "$1");
+ el.innerHTML = el.textContent.replace(/([\/\-=:<>_])/g, "$1");
});
};
insertWordBreaks("code");
-const scrollToLink = () => {
- let myHash = location.hash; //�������� �������� ����
+const addCanonicalUrl = () => {
+ const urlMapping = {
+ "/ru/help/business_solutions/platform-distribution.html":
+ "/ru/help/platform/platform-distribution.html",
+ };
- location.hash = ""; //������� ���
+ const listUrl = [
+ "/ru/haproxy-postgresql.html",
+ "/ru/doc_template.docx",
+ "/ru/platform-distribution.html",
+ "/ru/help/platform/haproxy-postgresql.html",
+ "/ru/help/platform/platform-distribution.html",
+ "/ru/help/ecm/doc_template.docx",
+ ];
- if (myHash[1]) {
- //���������, ���� �� � ���� �����-�� ��������
+ const currentPath = window.location.pathname;
+ const baseUrl = window.location.origin.includes("localhost")
+ ? window.location.origin
+ : "https://elma365.com";
- $("html, body").animate({ scrollTop: $(myHash).offset().top }, 300); //�������� �� ����������
+ if (urlMapping[currentPath]) {
+ setCanonicalUrl(baseUrl + urlMapping[currentPath]);
+ return;
+ }
+
+ if (listUrl.includes(currentPath)) {
+ setCanonicalUrl(baseUrl + currentPath);
}
};
+const setCanonicalUrl = (canonicalUrl) => {
+ const canonicalLink = document.createElement("link");
+ canonicalLink.href = canonicalUrl;
+ canonicalLink.setAttribute("rel", "canonical");
+ document.querySelector("head").appendChild(canonicalLink);
+};
+
+addCanonicalUrl();
+
+const scrollToLink = () => {
+ let myHash = window.location.pathname; //�������� �������� ����
+ if (myHash) {
+ //���������, ���� �� � ���� �����-�� ��������
+ $("html, body").animate({ scrollTop: $(myHash).offset().top }, 100); //�������� �� ����������
+ }
+};
// scrollToLink();
-// function scrollLink() {
-
-// document.addEventListener("DOMContentLoaded", function () {
-
-// const hash = decodeURIComponent(window.location.hash.slice(1)); // убираем '#' и декодим
-
-// if (hash) {
-
-// const target = document.querySelector(`[data-unique="${hash}"]`);
-
-// if (target) {
-
-// target.scrollIntoView({ behavior: "smooth" });
-
-// }
-
-// }
-
-// });
-
-// }
-
-// scrollLink();
+function scrollLink() {
+ document.addEventListener("DOMContentLoaded", function () {
+ const hash = decodeURIComponent(window.location.hash.slice(1)); // убираем '#' и декодим
+ if (hash) {
+ const target = document.querySelector(`[data-unique="${hash}"]`);
+ if (target) {
+ target.scrollIntoView({ behavior: "smooth" });
+ }
+ }
+ });
+}
+scrollLink();
const createVersionNode = (title, className) => {
const articleNode = document.querySelector(".topic__title");
-
const pVersion = document.createElement("p");
-
pVersion.innerText = title;
-
pVersion.classList.add(className);
-
articleNode.append(pVersion);
};
-const {
- href,
-
- pathname,
-} = window.location;
-
+const { href, pathname } = window.location;
let locale = getLocale();
-
const pathnameArr = pathname.split("/");
-
let currentPage = pathnameArr[pathnameArr.length - 1] || null;
//���� �� ��������� ��������, ������ ���������� ������ � �����
-
const changeHeaderLinks = () => {
const host = "elma4.sarl.inner.elma365.com";
-
const path = "/ru/platform/";
-
const headerLinks = document.querySelector(".header__list");
-
const footerList = document.querySelector(".footer-mobile__list");
-
const appendList = ``;
if (window.location.host === host) {
if (window.location.pathname !== path) {
headerLinks.insertAdjacentHTML("beforeend", appendList);
-
footerList.insertAdjacentHTML("beforeend", appendList);
}
}
};
-
//changeHeaderLinks()
// standard example
-
function findExampleContent(node, container, endString) {
if (
node.classList.contains("p_CodeExample") &&
@@ -201,68 +139,48 @@ function findExampleContent(node, container, endString) {
node.firstElementChild.innerText.toLowerCase().includes(endString)
) {
node.remove();
-
return;
}
-
const nextElement = node.nextElementSibling;
-
container.append(node);
-
findExampleContent(nextElement, container, endString);
}
function createNotation(item, notationType, endString) {
const container = document.createElement("div");
-
const exampleTitle = item.nextElementSibling;
-
const nextSibling = exampleTitle.nextElementSibling;
container.classList.add(notationType);
-
exampleTitle.classList.add(notationType + "__title");
-
container.append(exampleTitle);
-
findExampleContent(nextSibling, container, endString);
-
item.after(container);
-
item.remove();
}
function getArticleName(url) {
const arrFromUrl = url.split("/");
-
const lastPath = arrFromUrl[arrFromUrl.length - 1];
-
return lastPath.split(".")[0];
}
function removeCollapsedClass(node, tagName, className) {
const closestNode = node.closest(tagName);
-
if (!closestNode) {
return;
}
-
closestNode.classList.remove(className);
-
removeCollapsedClass(closestNode.parentElement, tagName, className);
}
function loadBottomLinks() {
const toc = document.querySelector("#toc");
-
const bottomLinks = document.querySelectorAll(".bottom-nav__link");
-
if (toc && bottomLinks.length) {
bottomLinks.forEach((link) => {
const path = `a[href="${link.innerText}"]`;
-
const targetLink = toc.querySelector(path);
-
link.innerText = targetLink.innerText;
});
}
@@ -270,32 +188,25 @@ function loadBottomLinks() {
function hideAllSideUls() {
const hidingMenu = document.querySelectorAll("#toc li ul");
-
hidingMenu.forEach((item) => {
item.classList.add("hide-side-menu-item");
-
item.closest("li").classList.add("collapsed");
});
}
function toggleUlsLinksHandler(menu, link) {
menu.forEach((link) => link.classList.remove("active-side-menu"));
-
link.classList.add("active-side-menu");
-
removeCollapsedClass(link, "ul", "hide-side-menu-item");
-
if (
link.nextElementSibling &&
link.nextElementSibling.classList.contains("hide-side-menu-item")
) {
removeCollapsedClass(link, "li", "collapsed");
-
link.nextElementSibling.classList.remove("hide-side-menu-item");
} else {
removeCollapsedClass(link, "li", "collapsed");
}
-
setTimeout(() => {
scrollToSelector(".active-side-menu");
}, 100);
@@ -303,28 +214,19 @@ function toggleUlsLinksHandler(menu, link) {
function scrollToSelector(selector) {
// document.body.style.position = 'fixed';
-
document.querySelector(".sidebar__wrapper").style.position = "fixed";
-
document
-
.querySelector(selector)
-
.scrollIntoView({ behavior: "smooth", block: "center" });
-
document.querySelector(".sidebar__wrapper").style.position = "sticky";
-
// document.body.style.position = 'unset';
}
function toggleUlsHandler() {
const tocNode = document.querySelector("#toc");
-
if (tocNode) {
const linksMenu = tocNode.querySelectorAll("a");
-
const activeItem = getArticleName(window.location.pathname);
-
linksMenu.forEach((link) => {
if (getArticleName(link.pathname) === activeItem) {
toggleUlsLinksHandler(linksMenu, link);
@@ -335,37 +237,29 @@ function toggleUlsHandler() {
function prepareContent() {
const commerceId = document.getElementById("commerce");
-
const communityId = document.getElementById("community");
href.includes("zoom_highlightsub") &&
$("body").addClass("--highlight-disabled");
//Set document title
-
const h1pageTitle = document.querySelector("h1 span.f_Heading1");
-
if (h1pageTitle) {
document.querySelector("title").innerText = h1pageTitle.innerText;
}
-
if (commerceId || communityId) {
commerceId
? (commerceId.style.display = "none")
: (communityId.style.display = "none");
-
commerceId
? createVersionNode("Enterprise", "pCommerce")
: createVersionNode("Community Edition", "pCommunity");
}
-
hideAllSideUls();
-
toggleUlsHandler();
const visibleSideBar = (sidebar) => {
const input = sidebar.querySelector('input[type="checkbox"]');
-
let isVisible = false;
input.addEventListener("change", () => {
@@ -378,55 +272,35 @@ function prepareContent() {
}
});
};
-
//TODO навигация по статье (якори)
-
const toc2 = document.getElementById("toc2");
-
if (toc2) {
const toc2Wrapper = document.querySelector(".article__sidebar");
-
if (!toc2.dataset.tocInitialized) {
$("#toc2").tocify({
context: "section.article__content",
-
selectors: "h2, h3",
-
extendPage: false,
});
-
toc2.dataset.tocInitialized = "true";
}
-
// $("#toc2").tocify({
-
// context: "section.article__content",
-
// selectors: "h2, h3",
-
// extendPage: false,
-
// });
-
const points = toc2.querySelectorAll("a");
-
if (points.length > 0) {
points.forEach((point) => {
if (!point.innerText.trim()) {
point.remove();
}
});
-
toc2Wrapper.style.display = "block";
-
visibleSideBar(toc2Wrapper);
-
// document.querySelector("body").classList.add(".scroll-nav");
-
// setTimeout(() => {
-
// document.querySelector("body").classList.remove(".scroll-nav");
-
// }, 500);
} else {
toc2Wrapper.style.display = "none";
@@ -434,14 +308,12 @@ function prepareContent() {
}
const images = document.querySelectorAll(".p_Normal > img");
-
images.forEach(
(image) =>
image.closest("p") && image.closest("p").classList.add("image-container")
);
const breadcrumbs = document.querySelector(".topic__breadcrumbs");
-
if (breadcrumbs && breadcrumbs.firstElementChild) {
breadcrumbs.firstElementChild.childNodes.forEach((node) => {
if (node.nodeValue && node.nodeValue.includes(">")) {
@@ -450,18 +322,17 @@ function prepareContent() {
});
}
- const spans = document.querySelectorAll("span");
-
- if (spans.length) {
- spans.forEach((span) => {
- if (span.innerHTML === " ") {
- span.remove();
- }
- });
- }
+ // const spans = document.querySelectorAll('span');
+ // if (spans.length) {
+ // spans.forEach(span => {
+ // if (span.innerHTML === ' ') {
+ // span.remove();
+ // console.log(span.innerHTML);
+ // }
+ // });
+ // }
// example exapand
-
const examplesToggle = document.querySelectorAll(
'a[class="dropdown-toggle"]'
);
@@ -476,54 +347,37 @@ function prepareContent() {
example.parentElement.tagName === "p"
? example.parentElement
: example.closest("p");
-
const nextSiblingDiv = parentP.nextElementSibling;
-
if (nextSiblingDiv && nextSiblingDiv.tagName === "DIV") {
parentP.classList.add("example");
-
const id = nextSiblingDiv.id;
-
const button = document.createElement("a");
-
const obj = nextSiblingDiv.attributes;
-
let expandState = "0";
-
parentP.setAttribute("data-state", expandState);
-
button.classList.add("btn-example");
-
button.innerHTML =
locale === "ru"
? 'СвернутьПосмотреть полностью'
: 'HideShow all';
-
button.addEventListener("click", (evt) => {
evt.preventDefault();
-
window.HMToggle("toggle", id);
-
Object.entries(obj).map((el) => {
if (el[1].name === "hm.state") {
expandState = el[1].value;
-
parentP.setAttribute("data-state", expandState);
}
});
});
-
parentP.append(button);
-
example.setAttribute("href", "javascript:void(0)");
-
example.after(nextSiblingDiv);
}
});
}
const pArray = document.querySelectorAll(".p_Normal");
-
if (pArray.length) {
pArray.forEach((p) => {
if (p.innerHTML === " ") {
@@ -533,11 +387,9 @@ function prepareContent() {
}
const examples = document.querySelectorAll("p.p_CodeExample");
-
if (examples.length) {
examples.forEach((example) => {
const childSpan = example.firstElementChild;
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -545,7 +397,6 @@ function prepareContent() {
) {
createNotation(example, "example", "примера");
}
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -553,7 +404,6 @@ function prepareContent() {
) {
createNotation(example, "warning", "внимание");
}
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -565,22 +415,15 @@ function prepareContent() {
}
//small icon
-
const icons = document.querySelectorAll(".content img");
-
if (icons.length) {
icons.forEach((icon, idx) => {
const iconWidth = parseInt(icon.width);
-
const floated = icon.style.float;
-
floated !== "" && icon.classList.add("img-float--" + floated);
-
if (iconWidth < 200) {
icon.classList.add("small-img");
-
const iconHeight = parseInt(icon.height);
-
if (
iconWidth > 70 &&
iconHeight > 70 &&
@@ -593,33 +436,28 @@ function prepareContent() {
});
}
}
-
//TODO скрытие хедера
-
function stickyHeader() {
var lastScrollTop = 0;
-
var delta = 15;
-
$(window)
.on("scroll", function () {
var st = $(this).scrollTop();
-
if (Math.abs(lastScrollTop - st) <= delta) return;
-
if (st > lastScrollTop && lastScrollTop > 0) {
$("body").addClass("--header-hidden");
-
$(".solution-select__list").removeClass("active");
-
$(".solution-select").removeClass("active");
} else {
$("body").removeClass("--header-hidden");
-
$(".solution-select__list").removeClass("active");
-
$(".solution-select").removeClass("active");
}
+ //TEST
+ // if (document.querySelector("body").classList.contains(".scroll-nav")) {
+ // $("body").addClass("--header-hidden");
+ // }
+ //TEST
lastScrollTop = st;
})
@@ -640,35 +478,23 @@ $(window).resize(function () {
function iconsTableOfContents() {
const toggledLi = document.querySelectorAll('li[data-bg*="collapsed"]');
-
toggledLi.forEach((li) => li.classList.add("toggled"));
}
$(document).ready(function () {
prepareContent();
-
toggleUlsHandler();
-
- //TODO вызов хедера
-
+ //TODO вызов скрытия хедера
// stickyHeader();
$("#side-menu").load("index.html #toc", function () {
- //TODO ререндер toc
-
- // window.addEventListener('popstate', () => {
-
- // // $(".article-inner").empty();
-
- // $('#article').load(`${window.location.href} .article-inner`, function () {
-
+ //TODO вызавает каждый раз ререндер при изменении href(добавление якоря как например)
+ // window.addEventListener("popstate", () => {
+ // $("#article").load(`${window.location.href} .article-inner`, function () {
// loadBottomLinks();
-
// prepareContent();
-
// });
-
- // })
+ // });
function onUrlChange(callback) {
const originalPushState = history.pushState;
@@ -731,50 +557,56 @@ $(document).ready(function () {
});
// Дополнительно: обработка void-ссылок
- document.querySelectorAll('a[href^="javascript:"]').forEach((link) => {
- link.addEventListener("click", (e) => {
- e.preventDefault();
- // Можно добавить здесь свою логику обработки клика
- });
- });
+ // document.querySelectorAll('a[href^="javascript:"]').forEach((link) => {
+ // link.addEventListener("click", (e) => {
+ // e.preventDefault();
+ // // Можно добавить здесь свою логику обработки клика
+ // });
+ // });
//
-
loadBottomLinks();
-
hideAllSideUls();
-
toggleUlsHandler();
-
document.addEventListener("DOMContentLoaded", () => {
if (document.visibilityState === "visible") {
hideAllSideUls();
}
});
+ //toc
+ function tryHideSideUlsWhenActive() {
+ if (document.visibilityState === "visible") {
+ hideAllSideUls();
+ } else {
+ document.addEventListener(
+ "visibilitychange",
+ () => {
+ if (document.visibilityState === "visible") {
+ hideAllSideUls();
+ }
+ },
+ { once: true }
+ );
+ }
+ }
+
+ document.addEventListener("DOMContentLoaded", tryHideSideUlsWhenActive);
const menuItems = this.querySelectorAll("a");
-
menuItems.forEach((item) => {
item.addEventListener("click", (evt) => {
evt.preventDefault();
-
const url =
evt.target.nodeName === "A"
? evt.target.href
: evt.target.closest("a").href;
-
const sideMenu = document.querySelector(".sidebar");
-
const htmlTag = document.querySelector("html");
-
const toggledLi = document.querySelectorAll('li[data-bg*="collapsed"]');
window.scrollTo(0, 0);
-
htmlTag.classList.remove("--locked");
-
$("body").removeClass("index-page search-page");
-
sideMenu.classList.remove("show-side-menu");
if (toggledLi.length) {
@@ -786,42 +618,17 @@ $(document).ready(function () {
if (url !== window.location.href) {
if (!url.includes("javascript:void")) {
$(".article-inner").empty();
-
$("#article").load(`${url} .article-inner`, function () {
history.pushState({}, null, url);
-
//metaDecsription.attr('content', metaDescriptionInitial);
-
loadBottomLinks();
-
prepareContent();
});
} else {
- // const _target = evt.target;
-
- // const _targetUl = _target.parentElement.nextElementSibling;
-
- // if (_target.nodeName === "SPAN" && _targetUl.nodeName === "UL" && _targetUl.classList.contains("hide-side-menu-item")) {
-
- // _targetUl.querySelectorAll('a')[0].click();
-
- // } else {
-
- // const _ul = _target.parentElement.querySelectorAll('a')[0].nextElementSibling;
-
- // if (_ul.nodeName === "UL") {
-
- // _ul.querySelectorAll('a')[0].click();
-
- // };
-
- // }
-
+ //TEST
function isFakeLink(link) {
if (!link) return false;
-
const href = link.getAttribute("href");
-
return href === "#" || href === "javascript:void(0);";
}
@@ -831,45 +638,34 @@ $(document).ready(function () {
function findFirstLinkInElement(element) {
if (!element) return null;
-
return element.querySelector("a");
}
function findFirstRealNestedLink(element) {
if (!element) return null;
-
const links = element.querySelectorAll("a");
-
for (const link of links) {
if (isRealLink(link)) return link;
}
-
return null;
}
document.addEventListener("click", (evt) => {
const _target = evt.target;
-
if (_target.nodeName !== "SPAN") return;
const _targetLi = _target.closest("li");
-
if (!_targetLi) return;
const submenu = _targetLi.querySelector("ul");
-
const firstLink = findFirstLinkInElement(_targetLi);
// заглушки
-
if (firstLink && isFakeLink(firstLink)) {
const nestedReal = findFirstRealNestedLink(submenu);
-
if (nestedReal) {
nestedReal.click();
-
// в первом фрагменте, после nestedReal.click();
-
setTimeout(() => {
document.dispatchEvent(new Event("subcategory:update"));
}, 50);
@@ -881,6 +677,7 @@ $(document).ready(function () {
firstLink.click(); // кликаем по нормальной ссылке
}
});
+ //TEST
}
}
});
@@ -890,28 +687,20 @@ $(document).ready(function () {
const obj = pagedata.reduce((acc, words) => {
const searchObj = {
title: words[1],
-
link: words[0],
};
-
return [...acc, searchObj];
}, []);
-
$(".search-form__input").each(function () {
var _that = $(this);
-
var _searchForm = _that.parent();
-
_that
.autocomplete({
autoFocus: false,
-
minLength: 2,
-
focus: function (event, ui) {
itemUiLinkSelected = ui.item.link;
},
-
source: function (request, response) {
const results = obj.filter(
(item) =>
@@ -920,9 +709,7 @@ $(document).ready(function () {
.includes(request.term.toLowerCase()) &&
document.querySelector(`a[href="${item.link.slice(2)}"]`)
);
-
const sliceResults = results.slice(0, 5);
-
sliceResults.map((result) => {
const aItem = document.querySelector(
`a[href="${result.link.slice(2)}"]`
@@ -930,7 +717,6 @@ $(document).ready(function () {
if (aItem) {
const parent = aItem.closest("li.heading1");
-
result.breadcrumb =
parent.querySelector("span.heading1").innerText;
} else {
@@ -949,7 +735,6 @@ $(document).ready(function () {
item.breadcrumb || ""
}`
)
-
.appendTo(ul);
};
@@ -963,15 +748,10 @@ $(document).ready(function () {
$(".glossary-abc__nav a").on("click", function (e) {
e.preventDefault();
-
var target = $(this).attr("href");
-
console.log($(this).parent().siblings());
-
$(".glossary-abc__nav a").removeClass("--active");
-
$(this).addClass("--active");
-
$("html, body").animate(
{
scrollTop: $(target).offset().top - 150,
@@ -980,33 +760,39 @@ $(document).ready(function () {
);
});
- // Хлебные крошки на странице поиска
+ const name = "Сайт ELMA365";
+ const cusLi = document.createElement("li");
+ cusLi.classList.add("heading1");
+ cusLi.classList.add("heading10");
+ const cusA = document.createElement("a");
+ cusA.classList.add("heading1");
+ cusA.setAttribute("href", "https://elma365.com/ru/");
+ cusA.setAttribute("target", "_blank");
+ const cusSpan = document.createElement("span");
+ cusSpan.classList.add("heading1");
+ cusSpan.textContent = name;
+ cusA.appendChild(cusSpan);
+ cusLi.appendChild(cusA);
+ document.querySelector("#toc").prepend(cusLi);
+ // Хлебные крошки на странице поиска
function findPrevBreadcrumbs(node, breadcrumbs) {
var breadcrumbsNew =
breadcrumbs || $('');
-
var prevParentEl = node.closest("ul") ? node.closest("ul").prev() : null;
-
if (!prevParentEl[0] || prevParentEl[0].tagName !== "A") {
return breadcrumbsNew;
}
-
breadcrumbsNew.prepend(' / ');
-
breadcrumbsNew.prepend(prevParentEl.clone());
-
return findPrevBreadcrumbs(prevParentEl, breadcrumbsNew);
}
$(".result_title a").each(function () {
var bc = "";
-
var currentArticleName = $(this);
-
$("#toc a span").each(function () {
var tocCurrentNode = $(this);
-
if (tocCurrentNode.text().trim() === currentArticleName.text().trim()) {
bc = findPrevBreadcrumbs(tocCurrentNode);
}
@@ -1019,56 +805,16 @@ $(document).ready(function () {
});
});
-//let scrollPos = 0;
-
-/* $('body').scroll(function () {
-
- let st = $(this).scrollTop();
-
- if (st > scrollPos) {
-
- $('.scroll-top').hide();
-
- } else {
-
- $('.scroll-top').show();
-
- }
-
- scrollPos = st;
-
-});
-
-
-
-$('.scroll-top').on('click', function (e) {
-
- e.preventDefault();
-
- $('html, body').animate({
-
- scrollTop: 0
-
- });
-
-}); */
-
//side menu mobile
-
const sideMenuIcon = document.querySelector("#side-menu-icon");
-
const htmlTag = document.querySelector("html");
-
const sideMenu = document.querySelector("#sidebar");
-
const closeButton = document.querySelector("#close");
if (sideMenuIcon) {
sideMenuIcon.addEventListener("click", (evt) => {
evt.preventDefault();
-
sideMenu.classList.toggle("show-side-menu");
-
htmlTag.classList.toggle("--locked");
});
}
@@ -1076,15 +822,12 @@ if (sideMenuIcon) {
if (closeButton) {
closeButton.addEventListener("click", (e) => {
e.preventDefault();
-
sideMenu.classList.remove("show-side-menu");
-
htmlTag.classList.remove("--locked");
});
}
var triggerTitleMegaGuide = false;
-
if (getTitleSite() === "Mega Guide" || /hmftsearch.html/i.test(href)) {
triggerTitleMegaGuide = true;
}
@@ -1102,9 +845,6 @@ function getTitleSite() {
const currentUrl = window.location.href;
if (
- /http:\/\/localhost/i.test(currentUrl) ||
- /brix365.t-elma365\/en\/help/i.test(currentUrl) ||
- /brix365.com\/en\/help/i.test(currentUrl) ||
/elma365.com\/ru\/help/i.test(currentUrl) ||
/elma365.com\/en\/help/i.test(currentUrl) ||
/elma365\/help\/ru/i.test(currentUrl) ||
@@ -1114,44 +854,29 @@ if (
) {
window.addEventListener("load", () => {
const searchIcon = document.querySelector("#search-icon");
-
const searchPanel = document.querySelector("#search-panel");
-
const searchInput = searchPanel.querySelector('input[type="text"]');
-
const heroSearch = document.querySelector(".hero__search");
-
if (searchIcon) {
searchIcon.addEventListener("click", (evt) => {
- console.log(searchIcon);
-
evt.preventDefault();
-
searchPanel.classList.toggle("show-search-panel");
-
setTimeout(() => searchInput.focus(), 500);
heroSearch.classList.add("hero__search--active");
});
- } else {
- console.log("error");
}
-
if (searchInput) {
const label = searchInput.closest("label");
-
searchInput.addEventListener("blur", () => {
searchPanel.classList.remove("show-search-panel");
-
heroSearch.classList.remove("hero__search--active");
-
if (searchInput.value) {
label.classList.add("cross");
} else {
label.classList.remove("cross");
}
});
-
searchInput.addEventListener("focus", () => {
label.classList.add("cross");
});
@@ -1167,15 +892,12 @@ if (
$(".arrow-top").click(function () {
$("html, body").animate({ scrollTop: 0 }, 600);
-
return false;
});
// очистить поиск
-
if (document.querySelector("#reset-search")) {
const resetButton = document.querySelector("#reset-search");
-
resetButton.addEventListener("click", () => {
searchInput.value = "";
});
@@ -1190,84 +912,37 @@ if (
wrapperSearch.classList.add("search-form__label");
const tagSpanIcons = document.createElement("span");
-
tagSpanIcons.className = "search__icon";
-
tagSpanIcons.setAttribute("id", "reset-search");
-
wrapperSearch.prepend(tagSpanIcons);
- // const insertInnerHtml = document.querySelector('tr .ya-site-form__search-input-layout-l');
-
- // const divBlockHeroSearch = document.createElement('div');
-
- //
-
- // divBlockHeroSearch.classList.add('hero__search')
-
- // divBlockHeroSearch.innerHTML = `
-
- //
-
- //
-
- //
-
- //
-
- // `;
-
- // setTimeout(() => {
-
- // insertInnerHtml.appendChild(divBlockHeroSearch);
-
- // }, 1000);
-
const searchIcon = document.querySelector("#search-icon");
-
const searchPanel = document.querySelector(
".ya-site-form.ya-site-form_bg_transparent.ya-site-form_inited_yes"
);
-
const searchInput = searchPanel.querySelector('input[type="search"]');
-
const heroSearch = document.querySelector(".hero__search");
-
if (searchIcon) {
searchIcon.addEventListener("click", (evt) => {
- console.log(searchIcon);
-
evt.preventDefault();
-
searchPanel.classList.toggle("show-search-panel");
-
setTimeout(() => searchInput.focus(), 500);
-
heroSearch.classList.add("hero__search--active");
});
}
-
if (searchInput) {
const div = searchInput.closest(".ya-site-form__input");
-
searchInput.addEventListener("blur", searchWatch);
function searchWatch() {
searchPanel.classList.remove("show-search-panel");
-
heroSearch.classList.remove("hero__search--active");
-
if (searchInput.value !== "") {
div.classList.add("cross");
} else {
div.classList.remove("cross");
}
}
-
searchInput.addEventListener("focus", () => {
div.classList.add("cross");
});
@@ -1283,21 +958,15 @@ if (
$(".arrow-top").click(function () {
$("html, body").animate({ scrollTop: 0 }, 600);
-
return false;
});
// очистить поиск
-
const resetButton = document.querySelector("#reset-search");
-
resetButton.addEventListener("click", () => {
searchInput.value = "";
-
searchInput.focus();
-
baseUrl = window.location.href.split("?")[0];
-
window.history.pushState("name", "", baseUrl);
});
});
@@ -1311,29 +980,20 @@ function searchFormHeader() {
$(".search-form").each(function () {
$(this).on("submit", (evt) => {
evt.preventDefault();
-
evt.stopPropagation();
-
var searchStr = evt.target[0].value;
-
if (searchStr.trim()) {
if (
(/elma365.com\/ru\/help/i.test(window.location.href) ||
/elma365.com\/en\/help/i.test(window.location.href) ||
/t-elma365.com/i.test(window.location.href) ||
- /brix365.com\/en\/help/i.test(window.location.href) ||
/([\d+]{3}).(\d).(\d).(\d)/i.test(window.location.href) ||
/http:\/\/localhost/i.test(window.location.href)) &&
!triggerTitleMegaGuide
) {
window.location.href = `./search.html?query=${searchStr}`;
- }
-
- //фикс поиска, тест
- else {
- // window.location.href = `./hmftsearch.html?zoom_query=${searchStr}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
- window.location.href = `./search.html?query=${searchStr}`;
+ } else {
+ window.location.href = `./hmftsearch.html?zoom_query=${searchStr}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
}
}
});
@@ -1347,41 +1007,28 @@ if (
Boolean(document.querySelector(".searchheading"))
) {
const searchTitle = document.querySelector(".searchheading");
-
const queryString = window.location.search;
-
let currentPageNumber = null;
const searchParams = queryString.split("&");
-
searchParams.forEach((param) => {
const paramArr = param.split("=");
-
if (paramArr[0] === "zoom_page") {
currentPageNumber = +paramArr[1];
}
});
-
const searchWord = decodeURI(searchParams[0].split("=")[1]);
-
searchTitle.innerText =
locale === "ru" ? "Результаты поиска:" : "Search results for:";
-
const searchWordP = document.createElement("p");
-
searchWordP.classList.add("search-word");
-
searchWordP.innerText = searchWord;
-
searchTitle.append(searchWordP);
let pagesCount = "0";
-
const resultPagesCount = document.querySelector(".result_pagescount");
-
if (resultPagesCount) {
pagesCount = parseInt(resultPagesCount.innerText.trim());
-
resultPagesCount.remove();
}
@@ -1389,109 +1036,62 @@ if (
switch (currentPage) {
case "first-page": {
resultPages[0].textContent = "<< < ";
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = "1";
-
resultPages[0].after(span);
-
const aEnd = document.createElement("a");
-
const urlEnd = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=${pagesCount}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aEnd.setAttribute("href", urlEnd);
-
aEnd.textContent = " >>";
-
// resultPages[resultPages.length - 1].textContent = ' >>';
-
resultPages[resultPages.length - 1].after(aEnd);
-
resultPages[resultPages.length - 2].remove();
-
resultPages[resultPages.length - 2].textContent = " > ";
-
break;
}
-
case "last-page": {
resultPages[resultPages.length - 1].textContent = ` > >>`;
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = currentPageNumber;
-
const aBegin = document.createElement("a");
-
const urlBegin = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=1&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aBegin.setAttribute("href", urlBegin);
-
aBegin.textContent = "<< ";
-
resultPages[resultPages.length - 1].before(span);
-
// resultPages[0].textContent = '<< ';
-
resultPages[1].before(aBegin);
-
resultPages[0].remove();
-
resultPages[1].textContent = "< ";
-
break;
}
-
case "default-page": {
const aBegin = document.createElement("a");
-
const aEnd = document.createElement("a");
-
const urlBegin = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=1&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
const urlEnd = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=${pagesCount}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aBegin.setAttribute("href", urlBegin);
-
aBegin.textContent = "<< ";
-
aEnd.setAttribute("href", urlEnd);
-
aEnd.textContent = " >>";
-
resultPages[1].before(aBegin);
-
resultPages[0].remove();
-
//resultPages[0].textContent = '<< ';
-
//resultPages[0] = aBegin;
-
resultPages[1].textContent = " < ";
-
resultPages[resultPages.length - 2].textContent = " > ";
-
//resultPages[resultPages.length - 1].textContent = ' >> ';
-
resultPages[resultPages.length - 2].after(aEnd);
-
resultPages[resultPages.length - 1].remove();
-
break;
}
-
default:
break;
}
}
const resultPagesNode = document.querySelector(".result_pages");
-
const resultPages = resultPagesNode
? document.querySelector(".result_pages").childNodes
: [];
@@ -1516,15 +1116,10 @@ if (
resultPages.forEach((node) => {
if (+node.textContent.trim() === currentPageNumber) {
const nextElement = node.nextSibling;
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = currentPageNumber;
-
nextElement.before(span);
-
node.remove();
}
});
@@ -1532,33 +1127,17 @@ if (
}
const summary = document.querySelectorAll(".summary");
-
if (summary.length > 0 && locale === "ru") {
const count = parseInt(summary[0].innerText.trim());
-
summary[0].innerText = count
? `Найдено совпадений: ${count}`
: (summary.innerText = "Совпадений не найдено");
}
}
-// подменяет текст в абзаце в зависимости от атрибута lang
-
-// if (document.documentElement.lang === "en") {
-
-// $('#found_typo').html('Found a typo? Highlight the text, press ctrl + enter and notify us')
-
-// } else if (document.documentElement.lang === "ru") {
-
-// $('#found_typo').html('Нашли опечатку? Выделите текст, нажмите ctrl + enter и оповестите нас')
-
-// }
-
$(window).on("load", () => {
// правит текст в фильтре результатов поиска
-
// $('.b-loader__wrapper').css('opacity', 0);
-
function replace() {
var intervalReplace = setInterval(() => {
if (
@@ -1574,20 +1153,17 @@ $(window).on("load", () => {
setTimeout(() => {
clearInterval(intervalReplace);
-
// }, 180000);
}, 10000);
function t() {
if (document.documentElement.lang === "en") {
textResult("нашёл", "Matches found", "all resourses", 13);
-
textFindSection("Search through ");
}
if (document.documentElement.lang === "ru") {
textResult("нашёл", "Найдено совпадений", "всем ресурсам", 18);
-
textFindSection("Искать по ");
}
@@ -1596,14 +1172,11 @@ $(window).on("load", () => {
searchAny = $(
".b-dropdowna__switcher .b-pseudo-link_is-bem_yes"
).text();
-
var e = text.replace(textFound, textFoundRes),
t = searchAny.replace("любой", textAny);
-
$("tr td.b-head__r .b-head__found").text(
e.substring(0, n) + ": " + parseInt(text.match(/\d+/))
);
-
$(".b-dropdowna__switcher .b-pseudo-link_is-bem_yes").text(t);
if ($("tr td.b-head__r .b-head__found").text().indexOf("найдёт") == 0) {
@@ -1637,11 +1210,8 @@ $(window).on("load", () => {
if (i > 0) {
if (element.childNodes[0].textContent.indexOf("раздел") === 0) {
var htmlTag = [];
-
htmlTag.push(element.childNodes[i]);
-
element.textContent = textResSection;
-
htmlTag.forEach((item) => {
element.appendChild(item);
});
@@ -1666,7 +1236,6 @@ $(window).on("load", () => {
setTimeout(() => {
clearInterval(intervalAddElementSubsection);
-
// }, 180000)
}, 10000);
@@ -1680,71 +1249,48 @@ $(window).on("load", () => {
var textContent = $("yass-li.b-serp-item .b-serp-url__item")[index]
.textContent;
-
switch (true) {
// ELMA365
-
case /elma365.com\/ru\/help/i.test(textContent):
subsectionTitle("Справка");
-
break;
-
case /academy.com/i.test(textContent):
subsectionTitle("ELMA Academy");
-
break;
-
case /tssdk.elma/i.test(textContent):
subsectionTitle("TS SDK");
-
break;
-
case /exchange.elma/i.test(textContent):
subsectionTitle("ELMA365 Exchange");
-
break;
// Английская версия
-
case /en\/help/i.test(textContent):
subsectionTitle("Help");
-
break;
// rpa
-
case /rpa.ai\/ru/i.test(textContent):
subsectionTitle("RPA");
-
break;
// ELMA4
-
case /ru\/help4\/ecm/i.test(textContent):
subsectionTitle("ECM+");
-
break;
-
case /ru\/help4\/crm/i.test(textContent):
subsectionTitle("CRM+");
-
break;
-
case /ru\/help4\/projects/i.test(textContent):
subsectionTitle("Проекты");
-
break;
-
case /elma-bpm.ru\/help4/i.test(textContent):
subsectionTitle("BPM");
-
break;
-
case /ru\/KB/i.test(textContent) ||
/elma-bpm.ru\/…help/i.test(textContent) ||
/help/i.test(textContent):
subsectionTitle("База знаний");
-
break;
}
@@ -1753,11 +1299,8 @@ $(window).on("load", () => {
$(".subsection-title")[index].textContent = text;
} else {
var newBlockDiv = document.createElement("div");
-
newBlockDiv.classList.add("subsection-title");
-
newBlockDiv.textContent = text;
-
$(".b-serp-item__title")[index].prepend(newBlockDiv);
}
}
@@ -1775,20 +1318,16 @@ $(window).on("load", () => {
if ($("tr td.b-head__r .b-head__found")) {
var intervalTimer = setInterval(() => {
replace();
-
addElementSubsection();
}, 200);
// через 3 минуты интервал останавливается (время взято примерно, чтобы успело все прогрузиться)
-
setTimeout(() => {
clearInterval(intervalTimer);
-
// }, 180000);
}, 10000);
} else {
replace();
-
addElementSubsection();
}
});
@@ -1797,41 +1336,25 @@ $(window).on("load", () => {
const leadhandler = "https://web.s-elma365.ru";
var rootNode = document.createElement("div");
-
document.body.appendChild(rootNode);
-
var typo = new TypoReporter(
{
formId: "1FAIpQLSfXEIXAFoOiHgetf0reIjWrOAw6V7KCZrhAv8VVD6WL7Rs46g", // required, see previous step
// Optional example stuff below
-
locale: getLocale(), // optional language, defaults to 'en'
-
// translations: { // optinal object with translated strings
-
// fr: {
-
// // see source code for keys to translate
-
// },
-
// ru: {
-
//
-
// }
-
// },
-
offset: 100, // amount of context text to grab from before and after the selection, defaults to 50
-
endpointUrl: leadhandler + "/api/baglist/", // optional, defaults to Google Forms
-
snippetFieldName: "typo", // optional, if using custom form
-
commentFieldName: "comment", // optional, if using custom form
-
urlFieldName: "url", // optional, if using custom form
},
rootNode
@@ -1839,14 +1362,12 @@ var typo = new TypoReporter(
$(document).on("focus", ".fill_listener", function () {
//console.log("test");
-
$(this).parent().addClass("focused");
});
$(document).on("blur", ".fill_listener", function () {
$(this).parent().removeClass("focused");
});
-
$(document).on("change", ".fill_listener", function () {
if ($(this).val().length) {
$(this).parent().addClass("filled");
@@ -1858,21 +1379,16 @@ $(document).on("change", ".fill_listener", function () {
function feedbackSubmit() {
$("#feedback-form").on("submit", function () {
var $form = $(this);
-
var formData = $form.serializeArray().slice(0, -1);
-
var context = {};
$(formData).each(function (index, obj) {
if (obj.name === "useful" && obj.value === "true") {
context.other = "";
-
context.useful = true;
-
context.category = [
{
code: "",
-
name: "",
},
];
@@ -1883,14 +1399,11 @@ function feedbackSubmit() {
if (obj.name === "other") {
context.other = obj.value;
}
-
context.useful = false;
-
if (obj.name === "category") {
context.category = [
{
code: obj.value,
-
name: $form.find('option[value="' + obj.value + '"]').text(),
},
];
@@ -1900,18 +1413,13 @@ function feedbackSubmit() {
});
context.produkt = ["6b55aead-f008-42c7-9186-0806c06d4f2c"];
-
context.link = window.location.href;
-
var data = {
context,
};
-
var request = $.ajax({
type: "POST",
-
url: leadhandler + "/api/feedback/create",
-
data: JSON.stringify(data),
})
.fail(function (response) {
@@ -1920,7 +1428,6 @@ function feedbackSubmit() {
.done(function (response) {
return response;
});
-
return false;
});
}
@@ -1936,32 +1443,23 @@ $(document).ready(function () {
var $form = $(this),
textarea = $form.find('textarea[name="help_question"]'),
//formData = $form.serializeArray().slice(0, -1),
-
context = {};
context.other = textarea.val();
-
context.category = [
{
code: "question",
-
name: "Задать вопрос",
},
];
-
context.produkt = ["6b55aead-f008-42c7-9186-0806c06d4f2c"];
-
context.link = window.location.href;
-
var data = {
context,
};
-
var request = $.ajax({
type: "POST",
-
url: leadhandler + "/api/feedback/create",
-
data: JSON.stringify(data),
})
.fail(function (response) {
@@ -1972,23 +1470,18 @@ $(document).ready(function () {
.parent()
.find(".question-success")
.removeClass("hidden");
-
setTimeout(() => {
$(".question-xs").attr("style", "display:none;");
-
textarea.val("");
});
-
setTimeout(() => {
$(".question__popup")
.parent()
.find(".question-success")
.addClass("hidden");
-
$(".question").removeClass("active");
}, 3000);
});
-
return false;
});
});
@@ -1998,7 +1491,6 @@ function question() {
const questionPopup = $(this).parent().find(".question-xs");
questionPopup.attr("style", "display:block;");
-
setTimeout(() => {
$(this).parent().find('textarea[name="help_question"]').focus();
}, 200);
@@ -2006,7 +1498,6 @@ function question() {
$(document).mouseup(function (e) {
let container = $(".question-xs");
-
if (!container.is(e.target) && container.has(e.target).length === 0) {
container.attr("style", "display:none;");
}
@@ -2018,12 +1509,9 @@ function question() {
$(".question-xs").on("submit", function () {
$(this).parent().find(".question-success-xs").removeClass("hidden");
-
$(this).removeClass("active");
-
setTimeout(() => {
$(this).parent().find(".question-success-xs").addClass("hidden");
-
$(this).addClass("active");
}, 3000);
});
@@ -2033,28 +1521,23 @@ question();
$(document).click(function (e) {
if ($(e.target).closest(".ReportTypo-popup").length != 0) return false;
-
$(".ReportTypo").fadeOut(100);
});
$(document).click(function (e) {
if ($(e.target).closest(".ReportTypo-popup").length != 0) return false;
-
$(".ReportTypo").fadeOut(100);
});
jQuery(function ($) {
$(document).mouseup(function (e) {
// ������� ����� �� ���-���������
-
var div = $("#feedback-form"); // ��� ��������� ID ��������
-
if (
!div.is(e.target) && // ���� ���� ��� �� �� ������ �����
div.has(e.target).length === 0
) {
// � �� �� ��� �������� ���������
-
$(".feedback-form").find("input:checked").removeAttr("checked");
}
});
@@ -2062,25 +1545,17 @@ jQuery(function ($) {
function feedback() {
const yesLabel = document.getElementById("feedback__useful_yes");
-
const thxWindow = document.getElementById("feedback__popup_thx");
-
const noLabel = document.getElementById("feedback__useful_no");
-
const feedbackWhyPopup = document.getElementById("feedback__popup_why");
-
const form = document.getElementById("feedback-form");
-
const otherInput = document.getElementById("other_reason");
-
const otherPopup = document.getElementById("feedback__popup-other");
-
const feedbackOtherBtn = document.querySelector(".feedback__other-btn");
const inputs = [
...document.querySelectorAll('#feedback__popup_why input[type="radio"]'),
];
-
const allRadio = inputs.filter((item) => item.id !== "other_reason");
allRadio.forEach((item) =>
@@ -2099,16 +1574,12 @@ function feedback() {
otherInput.addEventListener("change", (e) => {
if (e.target.checked) {
feedbackWhyPopup.style.display = "none";
-
otherPopup.style.display = "block";
-
$(".feedback__popup").find('textarea[name="other"]').focus();
feedbackOtherBtn.addEventListener("click", function () {
otherPopup.style.display = "none";
-
$("#feedback-success-popup").show();
-
setTimeout(() => {
$("#feedback-success-popup").hide();
}, 3000);
@@ -2122,9 +1593,7 @@ function feedback() {
if (Boolean(feedbackWhyPopup)) {
document.addEventListener("click", (e) => {
const target = e.target;
-
feedbackWhyPopup.style.display = "none";
-
thxWindow.style.display = "none";
if (target.matches("#feedback__useful_no")) {
@@ -2160,7 +1629,6 @@ $(window).on("load", function () {
document.querySelectorAll("main article section div")[1]
) {
let el = document.querySelectorAll("main article section div")[1];
-
el.setAttribute("id", "table-mobile-desktop_size");
}
});
@@ -2178,7 +1646,6 @@ if (document.querySelector("#side-menu")) {
document.querySelectorAll("main article section div")[1]
) {
let el = document.querySelectorAll("main article section div")[1];
-
el.setAttribute("id", "table-mobile-desktop_size");
}
}, 200);
@@ -2194,52 +1661,39 @@ if (document.querySelector("#side-menu")) {
if (document.getElementsByClassName("accordion-btn__show")) {
var showAccordionBtn = document.querySelector(".accordion-btn__show");
-
var elementAccordionHide = document.querySelector(".accordion__hide");
-
var linearGradient = document.querySelector(".linear-gradient");
-
var heightAccordionElem =
document.querySelector(".card-stack-50").scrollHeight;
var t = false;
-
showAccordionBtn.addEventListener("click", () => {
switch (true) {
case showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.contains("arrow__show"):
elementAccordionHide.classList.add("accordion__show");
-
elementAccordionHide.style.maxHeight = heightAccordionElem + "px";
-
elementAccordionHide.classList.remove("accordion__hide");
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.remove("arrow__show");
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.add("arrow__hide");
setTimeout(() => {
linearGradient.classList.remove("linear-gradient");
-
showAccordionBtn.querySelector("p").textContent = "Свернуть";
}, 1000);
-
break;
case showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.contains("arrow__hide"):
elementAccordionHide.classList.add("accordion__hide");
-
elementAccordionHide.classList.remove("accordion__show");
-
elementAccordionHide.style.maxHeight = "";
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.add("arrow__show");
@@ -2248,12 +1702,9 @@ if (document.getElementsByClassName("accordion-btn__show")) {
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.remove("arrow__hide");
-
linearGradient.classList.add("linear-gradient");
-
showAccordionBtn.querySelector("p").textContent = "Показать всё";
}, 1000);
-
break;
}
});
@@ -2266,7 +1717,6 @@ if (document.getElementsByClassName("accordion-btn__show")) {
(function () {
if (document.querySelector(".accordion__items")) {
var btn = document.querySelectorAll(".accordion__item-question");
-
var dehiscentItems = document.querySelectorAll(
".accordion__item-question-answer"
);
@@ -2279,11 +1729,8 @@ if (document.getElementsByClassName("accordion-btn__show")) {
removeActiveClass();
} else {
removeActiveClass();
-
this.classList.toggle("accordion__active");
-
nextEl.style.maxHeight = nextEl.scrollHeight + "px";
-
nextEl.style.marginBottom = "15px";
}
});
@@ -2296,7 +1743,6 @@ if (document.getElementsByClassName("accordion-btn__show")) {
dehiscentItems.forEach((i) => {
i.style.maxHeight = null;
-
i.style.marginBottom = null;
});
}
diff --git a/crm/jquery.tocify.min.js b/crm/jquery.tocify.min.js
index 55f8a9d..5051d08 100644
--- a/crm/jquery.tocify.min.js
+++ b/crm/jquery.tocify.min.js
@@ -1,5 +1,4 @@
-/*! jquery.tocify - v1.9.0 - 2013-10-01
-* http://gregfranko.com/jquery.tocify.js/
-* Copyright (c) 2013 Greg Franko; Licensed MIT*/
-
-!function(){"use strict";!function(r,d,c){"use strict";var o="tocify",e="tocify-focus",t="tocify-hover",n="tocify-hide",a="tocify-header",i="."+a,l="tocify-subheader",h="."+l,f="tocify-item",u="."+f,p="tocify-extend-page",g="."+p;r.widget("toc.tocify",{version:"1.9.0",options:{context:"body",ignoreSelector:null,selectors:"h1, h2, h3",showAndHide:!0,showEffect:"slideDown",showEffectSpeed:"medium",hideEffect:"slideUp",hideEffectSpeed:"medium",smoothScroll:!0,smoothScrollSpeed:"medium",scrollTo:0,showAndHideOnScroll:!0,highlightOnScroll:!0,highlightOffset:40,theme:"bootstrap",extendPage:!0,extendPageOffset:100,history:!0,scrollHistory:!1,hashGenerator:"compact",highlightDefault:!0},_create:function(){var e=this;e.extendPageScroll=!0,e.items=[],e._generateToc(),e._addCSSClasses(),e.webkit=function(){for(var e in d)if(e&&-1!==e.toLowerCase().indexOf("webkit"))return!0;return!1}(),e._setEventHandlers(),r(d).load(function(){e._setActiveElement(!0),r("html, body").promise().done(function(){setTimeout(function(){e.extendPageScroll=!1},0)})})},_generateToc:function(){var e,t,s=this,i=s.options.ignoreSelector;return e=-1!==this.options.selectors.indexOf(",")?r(this.options.context).find(this.options.selectors.replace(/ /g,"").substr(0,this.options.selectors.indexOf(","))):r(this.options.context).find(this.options.selectors.replace(/ /g,"")),e.length?(s.element.addClass(o),e.each(function(e){r(this).is(i)||(t=r("",{id:a+e,class:a}).append(s._nestElements(r(this),e)),s.element.append(t),r(this).nextUntil(this.nodeName.toLowerCase()).each(function(){0===r(this).find(s.options.selectors).length?r(this).filter(s.options.selectors).each(function(){r(this).is(i)||s._appendSubheaders.call(this,s,t)}):r(this).find(s.options.selectors).each(function(){r(this).is(i)||s._appendSubheaders.call(this,s,t)})}))}),undefined):(s.element.addClass(n),undefined)},_setActiveElement:function(e){var t=this,s=d.location.hash.substring(1),i=t.element.find('li[data-unique="'+s+'"]');return s.length?(t.element.find("."+t.focusClass).removeClass(t.focusClass),i.addClass(t.focusClass),t.options.showAndHide&&i.click()):(t.element.find("."+t.focusClass).removeClass(t.focusClass),!s.length&&e&&t.options.highlightDefault&&t.element.find(u).first().addClass(t.focusClass)),t},_nestElements:function(t,e){var s,i,o;return s=r.grep(this.items,function(e){return e===t.text()}),s.length?this.items.push(t.text()+e):this.items.push(t.text()),o=this._generateHashValue(s,t,e),i=r("",{class:f,"data-unique":o}).append(r("",{text:t.text()})),t.before(r("",{name:o,"data-unique":o})),i},_generateHashValue:function(e,t,s){var i="",o=this.options.hashGenerator;if("pretty"===o){for(i=t.text().toLowerCase().replace(/\s/g,"-");i.indexOf("--")>-1;)i=i.replace(/--/g,"-");for(;i.indexOf(":-")>-1;)i=i.replace(/:-/g,"-")}else i="function"==typeof o?o(t.text(),t):t.text().replace(/\s/g,"");return e.length&&(i+=""+s),i},_appendSubheaders:function(e,t){var s=r(this).index(e.options.selectors),i=r(e.options.selectors).eq(s-1),o=+r(this).prop("tagName").charAt(1),n=+i.prop("tagName").charAt(1);n>o?e.element.find(h+"[data-tag="+o+"]").last().append(e._nestElements(r(this),s)):o===n?t.find(u).last().after(e._nestElements(r(this),s)):t.find(u).last().after(r("",{class:l,"data-tag":o})).next(h).append(e._nestElements(r(this),s))},_setEventHandlers:function(){var h=this;this.element.on("click.tocify","li",function(){if(h.options.history&&(d.location.hash=r(this).attr("data-unique")),h.element.find("."+h.focusClass).removeClass(h.focusClass),r(this).addClass(h.focusClass),h.options.showAndHide){var e=r('li[data-unique="'+r(this).attr("data-unique")+'"]');h._triggerShow(e)}h._scrollTo(r(this))}),this.element.find("li").on({"mouseenter.tocify":function(){r(this).addClass(h.hoverClass),r(this).css("cursor","pointer")},"mouseleave.tocify":function(){"bootstrap"!==h.options.theme&&r(this).removeClass(h.hoverClass)}}),(h.options.extendPage||h.options.highlightOnScroll||h.options.scrollHistory||h.options.showAndHideOnScroll)&&r(d).on("scroll.tocify",function(){r("html, body").promise().done(function(){var o,e,t,s,n=r(d).scrollTop(),i=r(d).height(),a=r(c).height(),l=r("body")[0].scrollHeight;if(h.options.extendPage&&(h.webkit&&n>=l-i-h.options.extendPageOffset||!h.webkit&&i+n>a-h.options.extendPageOffset)&&!r(g).length){if(e=r('div[data-unique="'+r(u).last().attr("data-unique")+'"]'),!e.length)return;t=e.offset().top,r(h.options.context).append(r("",{class:p,height:Math.abs(t-n)+"px","data-unique":p})),h.extendPageScroll&&(s=h.element.find("li.active"),h._scrollTo(r('div[data-unique="'+s.attr("data-unique")+'"]')))}setTimeout(function(){var e,s=null,i=null,t=r(h.options.context).find("div[data-unique]");t.each(function(e){var t=Math.abs((r(this).next().length?r(this).next():r(this)).offset().top-n-h.options.highlightOffset);return null==s||s>t?(s=t,i=e,undefined):!1}),e=r(t[i]).attr("data-unique"),o=r('li[data-unique="'+e+'"]'),h.options.highlightOnScroll&&o.length&&(h.element.find("."+h.focusClass).removeClass(h.focusClass),o.addClass(h.focusClass)),h.options.scrollHistory&&d.location.hash!=="#"+e&&d.location.replace("#"+e),h.options.showAndHideOnScroll&&h.options.showAndHide&&h._triggerShow(o,!0)},0)})})},show:function(e){var t=this;if(!e.is(":visible"))switch(e.find(h).length||e.parent().is(i)||e.parent().is(":visible")?e.children(h).length||e.parent().is(i)||(e=e.closest(h)):e=e.parents(h).add(e),t.options.showEffect){case"none":e.show();break;case"show":e.show(t.options.showEffectSpeed);break;case"slideDown":e.slideDown(t.options.showEffectSpeed);break;case"fadeIn":e.fadeIn(t.options.showEffectSpeed);break;default:e.show()}return e.parent().is(i)?t.hide(r(h).not(e)):t.hide(r(h).not(e.closest(i).find(h).not(e.siblings()))),t},hide:function(e){var t=this;switch(t.options.hideEffect){case"none":e.hide();break;case"hide":e.hide(t.options.hideEffectSpeed);break;case"slideUp":e.slideUp(t.options.hideEffectSpeed);break;case"fadeOut":e.fadeOut(t.options.hideEffectSpeed);break;default:e.hide()}return t},_triggerShow:function(e,t){var s=this;return e.parent().is(i)||e.next().is(h)?s.show(e.next(h),t):e.parent().is(h)&&s.show(e.parent(),t),s},_addCSSClasses:function(){return"jqueryui"===this.options.theme?(this.focusClass="ui-state-default",this.hoverClass="ui-state-hover",this.element.addClass("ui-widget").find(".toc-title").addClass("ui-widget-header").end().find("li").addClass("ui-widget-content")):"bootstrap"===this.options.theme?(this.element.find(i+","+h).addClass("nav nav-list"),this.focusClass="active"):(this.focusClass=e,this.hoverClass=t),this},setOption:function(){r.Widget.prototype._setOption.apply(this,arguments)},setOptions:function(){r.Widget.prototype._setOptions.apply(this,arguments)},_scrollTo:function(e){var t=document.querySelector('div[data-unique="'+e.attr("data-unique")+'"]');if(t)t.scrollIntoView({behavior:this.options.smoothScroll?"smooth":"auto",block:"start"});return this}})}(window.jQuery,window,document)}();
\ No newline at end of file
+/*! jquery.tocify - v1.9.0 - 2013-10-01
+ * http://gregfranko.com/jquery.tocify.js/
+ * Copyright (c) 2013 Greg Franko; Licensed MIT*/
+!function(){"use strict";var a,l,h,o,s,n,r,i,d,c;a=window.jQuery,l=window,h=document,s="."+(o="tocify-header"),r="."+(n="tocify-subheader"),d="."+(i="tocify-item"),c="tocify-extend-page",a.widget("toc.tocify",{version:"1.9.0",options:{context:"body",ignoreSelector:null,selectors:"h1, h2, h3",showAndHide:!0,showEffect:"slideDown",showEffectSpeed:"medium",hideEffect:"slideUp",hideEffectSpeed:"medium",smoothScroll:!0,smoothScrollSpeed:"medium",scrollTo:0,showAndHideOnScroll:!0,highlightOnScroll:!0,highlightOffset:40,theme:"bootstrap",extendPage:!0,extendPageOffset:100,history:!0,scrollHistory:!1,hashGenerator:"compact",highlightDefault:!0},_create:function(){var e=this;e.extendPageScroll=!0,e.items=[],e._generateToc(),e._addCSSClasses(),e.webkit=function(){for(var e in l)if(e&&-1!==e.toLowerCase().indexOf("webkit"))return!0;return!1}(),e._setEventHandlers(),a(l).load(function(){e._setActiveElement(!0),a("html, body").promise().done(function(){setTimeout(function(){e.extendPageScroll=!1},0)})})},_generateToc:function(){var t,s=this,i=s.options.ignoreSelector,e=-1!==this.options.selectors.indexOf(",")?a(this.options.context).find(this.options.selectors.replace(/ /g,"").substr(0,this.options.selectors.indexOf(","))):a(this.options.context).find(this.options.selectors.replace(/ /g,""));return e.length?(s.element.addClass("tocify"),void e.each(function(e){a(this).is(i)||(t=a("",{id:o+e,class:o}).append(s._nestElements(a(this),e)),s.element.append(t),a(this).nextUntil(this.nodeName.toLowerCase()).each(function(){(0===a(this).find(s.options.selectors).length?a(this).filter(s.options.selectors):a(this).find(s.options.selectors)).each(function(){a(this).is(i)||s._appendSubheaders.call(this,s,t)})}))})):void s.element.addClass("tocify-hide")},_setActiveElement:function(e){var t=this,s=l.location.hash.substring(1),i=t.element.find('li[data-unique="'+s+'"]');return s.length?(t.element.find("."+t.focusClass).removeClass(t.focusClass),i.addClass(t.focusClass),t.options.showAndHide&&i.click()):(t.element.find("."+t.focusClass).removeClass(t.focusClass),!s.length&&e&&t.options.highlightDefault&&t.element.find(d).first().addClass(t.focusClass)),t},_nestElements:function(t,e){var s=a.grep(this.items,function(e){return e===t.text()});return s.length?this.items.push(t.text()+e):this.items.push(t.text()),s=this._generateHashValue(s,t,e),e=a("",{class:i,"data-unique":s}).append(a("",{text:t.text()})),t.before(a("",{name:s,"data-unique":s})),e},_generateHashValue:function(e,t,s){var i="",o=this.options.hashGenerator;if("pretty"===o){for(i=t.text().toLowerCase().replace(/\s/g,"-");-1",{class:n,"data-tag":o})).next(r).append(e._nestElements(a(this),s))},_setEventHandlers:function(){var n=this;this.element.on("click.tocify","li",function(){var e;n.options.history&&(l.location.hash=a(this).attr("data-unique")),n.element.find("."+n.focusClass).removeClass(n.focusClass),a(this).addClass(n.focusClass),n.options.showAndHide&&(e=a('li[data-unique="'+a(this).attr("data-unique")+'"]'),n._triggerShow(e)),n._scrollTo(a(this))}),this.element.find("li").on({"mouseenter.tocify":function(){a(this).addClass(n.hoverClass),a(this).css("cursor","pointer")},"mouseleave.tocify":function(){"bootstrap"!==n.options.theme&&a(this).removeClass(n.hoverClass)}}),(n.options.extendPage||n.options.highlightOnScroll||n.options.scrollHistory||n.options.showAndHideOnScroll)&&a(l).on("scroll.tocify",function(){a("html, body").promise().done(function(){var t,o=a(l).scrollTop(),e=a(l).height(),s=a(h).height(),i=a("body")[0].scrollHeight;if(n.options.extendPage&&(n.webkit&&o>=i-e-n.options.extendPageOffset||!n.webkit&&e+o>s-n.options.extendPageOffset)&&!a(".tocify-extend-page").length){if(!(i=a('div[data-unique="'+a(d).last().attr("data-unique")+'"]')).length)return;e=i.offset().top,a(n.options.context).append(a("",{class:c,height:Math.abs(e-o)+"px","data-unique":c})),n.extendPageScroll&&(s=n.element.find("li.active"),n._scrollTo(a('div[data-unique="'+s.attr("data-unique")+'"]')))}setTimeout(function(){var s=null,i=null,e=a(n.options.context).find("div[data-unique]");e.each(function(e){var t=Math.abs((a(this).next().length?a(this).next():a(this)).offset().top-o-n.options.highlightOffset);return(null==s||t {
const lan = document.documentElement.lang;
-
return lan ? document.documentElement.lang : "ru";
};
@@ -13,186 +12,125 @@ function getProduct() {
case "elma-rpa.ai":
product = {
name: "rpa",
-
id: "33678c11-fea6-4adb-aa39-adc4e8295b53",
};
-
break;
-
case "www.elma-bpm.ru":
product = {
name: "elma3/4",
-
id: "44b97702-146c-414b-9db7-0b09705556ed",
};
-
break;
-
default:
product = {
name: "elma365",
-
id: "3354c78a-720e-4584-a9c6-83f0f1396d22",
};
-
break;
}
-
return product;
}
-document
- .querySelector(".solution-select")
- .addEventListener("mouseenter", function () {
- this.classList.add("active");
-
- document.querySelector(".solution-select__list").classList.add("active");
- });
-
-document
- .querySelector(".solution-select__list")
- .addEventListener("mouseleave", function () {
- this.classList.remove("active");
-
- document.querySelector(".solution-select").classList.remove("active");
- });
-
-const titleName = () => {
- let textSpanTitle = document.querySelector(".solution-select__selected");
-
- let currentPlace = window.location.pathname
- .replace("/en/help/", "")
- .split("/")[0];
-
- textSpanTitle.textContent =
- currentPlace.charAt(0).toUpperCase() + currentPlace.slice(1);
-
- if (currentPlace === "crm" || "ecm") {
- textSpanTitle.textContent = currentPlace.toUpperCase();
- }
-
- if (currentPlace === "business_solutions") {
- let business = currentPlace.replace("_", " ");
-
- textSpanTitle.textContent =
- business.charAt(0).toUpperCase() +
- business.slice(1, 8) +
- " " +
- business.charAt(9).toUpperCase() +
- business.slice(10);
- }
-};
-
-/*// Commerce version
-
-const files = document.querySelectorAll(".filelink");
-
-if (files.length) {
-
- files.forEach((file) =>
-
- file.setAttribute("download", "Postman_collection.json")
-
- );
-
-}*/
-
const insertWordBreaks = (selector) => {
document.querySelectorAll(selector).forEach((el) => {
- el.innerHTML = el.textContent.replace(/([\/\-=<>:_])/g, "$1");
+ el.innerHTML = el.textContent.replace(/([\/\-=:<>_])/g, "$1");
});
};
insertWordBreaks("code");
-const scrollToLink = () => {
- let myHash = location.hash; //�������� �������� ����
+const addCanonicalUrl = () => {
+ const urlMapping = {
+ "/ru/help/business_solutions/platform-distribution.html":
+ "/ru/help/platform/platform-distribution.html",
+ };
- location.hash = ""; //������� ���
+ const listUrl = [
+ "/ru/haproxy-postgresql.html",
+ "/ru/doc_template.docx",
+ "/ru/platform-distribution.html",
+ "/ru/help/platform/haproxy-postgresql.html",
+ "/ru/help/platform/platform-distribution.html",
+ "/ru/help/ecm/doc_template.docx",
+ ];
- if (myHash[1]) {
- //���������, ���� �� � ���� �����-�� ��������
+ const currentPath = window.location.pathname;
+ const baseUrl = window.location.origin.includes("localhost")
+ ? window.location.origin
+ : "https://elma365.com";
- $("html, body").animate({ scrollTop: $(myHash).offset().top }, 300); //�������� �� ����������
+ if (urlMapping[currentPath]) {
+ setCanonicalUrl(baseUrl + urlMapping[currentPath]);
+ return;
+ }
+
+ if (listUrl.includes(currentPath)) {
+ setCanonicalUrl(baseUrl + currentPath);
}
};
+const setCanonicalUrl = (canonicalUrl) => {
+ const canonicalLink = document.createElement("link");
+ canonicalLink.href = canonicalUrl;
+ canonicalLink.setAttribute("rel", "canonical");
+ document.querySelector("head").appendChild(canonicalLink);
+};
+
+addCanonicalUrl();
+
+const scrollToLink = () => {
+ let myHash = window.location.pathname; //�������� �������� ����
+ if (myHash) {
+ //���������, ���� �� � ���� �����-�� ��������
+ $("html, body").animate({ scrollTop: $(myHash).offset().top }, 100); //�������� �� ����������
+ }
+};
// scrollToLink();
-// function scrollLink() {
-
-// document.addEventListener("DOMContentLoaded", function () {
-
-// const hash = decodeURIComponent(window.location.hash.slice(1)); // убираем '#' и декодим
-
-// if (hash) {
-
-// const target = document.querySelector(`[data-unique="${hash}"]`);
-
-// if (target) {
-
-// target.scrollIntoView({ behavior: "smooth" });
-
-// }
-
-// }
-
-// });
-
-// }
-
-// scrollLink();
+function scrollLink() {
+ document.addEventListener("DOMContentLoaded", function () {
+ const hash = decodeURIComponent(window.location.hash.slice(1)); // убираем '#' и декодим
+ if (hash) {
+ const target = document.querySelector(`[data-unique="${hash}"]`);
+ if (target) {
+ target.scrollIntoView({ behavior: "smooth" });
+ }
+ }
+ });
+}
+scrollLink();
const createVersionNode = (title, className) => {
const articleNode = document.querySelector(".topic__title");
-
const pVersion = document.createElement("p");
-
pVersion.innerText = title;
-
pVersion.classList.add(className);
-
articleNode.append(pVersion);
};
-const {
- href,
-
- pathname,
-} = window.location;
-
+const { href, pathname } = window.location;
let locale = getLocale();
-
const pathnameArr = pathname.split("/");
-
let currentPage = pathnameArr[pathnameArr.length - 1] || null;
//���� �� ��������� ��������, ������ ���������� ������ � �����
-
const changeHeaderLinks = () => {
const host = "elma4.sarl.inner.elma365.com";
-
const path = "/ru/platform/";
-
const headerLinks = document.querySelector(".header__list");
-
const footerList = document.querySelector(".footer-mobile__list");
-
const appendList = ``;
if (window.location.host === host) {
if (window.location.pathname !== path) {
headerLinks.insertAdjacentHTML("beforeend", appendList);
-
footerList.insertAdjacentHTML("beforeend", appendList);
}
}
};
-
//changeHeaderLinks()
// standard example
-
function findExampleContent(node, container, endString) {
if (
node.classList.contains("p_CodeExample") &&
@@ -201,68 +139,48 @@ function findExampleContent(node, container, endString) {
node.firstElementChild.innerText.toLowerCase().includes(endString)
) {
node.remove();
-
return;
}
-
const nextElement = node.nextElementSibling;
-
container.append(node);
-
findExampleContent(nextElement, container, endString);
}
function createNotation(item, notationType, endString) {
const container = document.createElement("div");
-
const exampleTitle = item.nextElementSibling;
-
const nextSibling = exampleTitle.nextElementSibling;
container.classList.add(notationType);
-
exampleTitle.classList.add(notationType + "__title");
-
container.append(exampleTitle);
-
findExampleContent(nextSibling, container, endString);
-
item.after(container);
-
item.remove();
}
function getArticleName(url) {
const arrFromUrl = url.split("/");
-
const lastPath = arrFromUrl[arrFromUrl.length - 1];
-
return lastPath.split(".")[0];
}
function removeCollapsedClass(node, tagName, className) {
const closestNode = node.closest(tagName);
-
if (!closestNode) {
return;
}
-
closestNode.classList.remove(className);
-
removeCollapsedClass(closestNode.parentElement, tagName, className);
}
function loadBottomLinks() {
const toc = document.querySelector("#toc");
-
const bottomLinks = document.querySelectorAll(".bottom-nav__link");
-
if (toc && bottomLinks.length) {
bottomLinks.forEach((link) => {
const path = `a[href="${link.innerText}"]`;
-
const targetLink = toc.querySelector(path);
-
link.innerText = targetLink.innerText;
});
}
@@ -270,32 +188,25 @@ function loadBottomLinks() {
function hideAllSideUls() {
const hidingMenu = document.querySelectorAll("#toc li ul");
-
hidingMenu.forEach((item) => {
item.classList.add("hide-side-menu-item");
-
item.closest("li").classList.add("collapsed");
});
}
function toggleUlsLinksHandler(menu, link) {
menu.forEach((link) => link.classList.remove("active-side-menu"));
-
link.classList.add("active-side-menu");
-
removeCollapsedClass(link, "ul", "hide-side-menu-item");
-
if (
link.nextElementSibling &&
link.nextElementSibling.classList.contains("hide-side-menu-item")
) {
removeCollapsedClass(link, "li", "collapsed");
-
link.nextElementSibling.classList.remove("hide-side-menu-item");
} else {
removeCollapsedClass(link, "li", "collapsed");
}
-
setTimeout(() => {
scrollToSelector(".active-side-menu");
}, 100);
@@ -303,28 +214,19 @@ function toggleUlsLinksHandler(menu, link) {
function scrollToSelector(selector) {
// document.body.style.position = 'fixed';
-
document.querySelector(".sidebar__wrapper").style.position = "fixed";
-
document
-
.querySelector(selector)
-
.scrollIntoView({ behavior: "smooth", block: "center" });
-
document.querySelector(".sidebar__wrapper").style.position = "sticky";
-
// document.body.style.position = 'unset';
}
function toggleUlsHandler() {
const tocNode = document.querySelector("#toc");
-
if (tocNode) {
const linksMenu = tocNode.querySelectorAll("a");
-
const activeItem = getArticleName(window.location.pathname);
-
linksMenu.forEach((link) => {
if (getArticleName(link.pathname) === activeItem) {
toggleUlsLinksHandler(linksMenu, link);
@@ -335,37 +237,29 @@ function toggleUlsHandler() {
function prepareContent() {
const commerceId = document.getElementById("commerce");
-
const communityId = document.getElementById("community");
href.includes("zoom_highlightsub") &&
$("body").addClass("--highlight-disabled");
//Set document title
-
const h1pageTitle = document.querySelector("h1 span.f_Heading1");
-
if (h1pageTitle) {
document.querySelector("title").innerText = h1pageTitle.innerText;
}
-
if (commerceId || communityId) {
commerceId
? (commerceId.style.display = "none")
: (communityId.style.display = "none");
-
commerceId
? createVersionNode("Enterprise", "pCommerce")
: createVersionNode("Community Edition", "pCommunity");
}
-
hideAllSideUls();
-
toggleUlsHandler();
const visibleSideBar = (sidebar) => {
const input = sidebar.querySelector('input[type="checkbox"]');
-
let isVisible = false;
input.addEventListener("change", () => {
@@ -378,55 +272,35 @@ function prepareContent() {
}
});
};
-
//TODO навигация по статье (якори)
-
const toc2 = document.getElementById("toc2");
-
if (toc2) {
const toc2Wrapper = document.querySelector(".article__sidebar");
-
if (!toc2.dataset.tocInitialized) {
$("#toc2").tocify({
context: "section.article__content",
-
selectors: "h2, h3",
-
extendPage: false,
});
-
toc2.dataset.tocInitialized = "true";
}
-
// $("#toc2").tocify({
-
// context: "section.article__content",
-
// selectors: "h2, h3",
-
// extendPage: false,
-
// });
-
const points = toc2.querySelectorAll("a");
-
if (points.length > 0) {
points.forEach((point) => {
if (!point.innerText.trim()) {
point.remove();
}
});
-
toc2Wrapper.style.display = "block";
-
visibleSideBar(toc2Wrapper);
-
// document.querySelector("body").classList.add(".scroll-nav");
-
// setTimeout(() => {
-
// document.querySelector("body").classList.remove(".scroll-nav");
-
// }, 500);
} else {
toc2Wrapper.style.display = "none";
@@ -434,14 +308,12 @@ function prepareContent() {
}
const images = document.querySelectorAll(".p_Normal > img");
-
images.forEach(
(image) =>
image.closest("p") && image.closest("p").classList.add("image-container")
);
const breadcrumbs = document.querySelector(".topic__breadcrumbs");
-
if (breadcrumbs && breadcrumbs.firstElementChild) {
breadcrumbs.firstElementChild.childNodes.forEach((node) => {
if (node.nodeValue && node.nodeValue.includes(">")) {
@@ -450,18 +322,17 @@ function prepareContent() {
});
}
- const spans = document.querySelectorAll("span");
-
- if (spans.length) {
- spans.forEach((span) => {
- if (span.innerHTML === " ") {
- span.remove();
- }
- });
- }
+ // const spans = document.querySelectorAll('span');
+ // if (spans.length) {
+ // spans.forEach(span => {
+ // if (span.innerHTML === ' ') {
+ // span.remove();
+ // console.log(span.innerHTML);
+ // }
+ // });
+ // }
// example exapand
-
const examplesToggle = document.querySelectorAll(
'a[class="dropdown-toggle"]'
);
@@ -476,54 +347,37 @@ function prepareContent() {
example.parentElement.tagName === "p"
? example.parentElement
: example.closest("p");
-
const nextSiblingDiv = parentP.nextElementSibling;
-
if (nextSiblingDiv && nextSiblingDiv.tagName === "DIV") {
parentP.classList.add("example");
-
const id = nextSiblingDiv.id;
-
const button = document.createElement("a");
-
const obj = nextSiblingDiv.attributes;
-
let expandState = "0";
-
parentP.setAttribute("data-state", expandState);
-
button.classList.add("btn-example");
-
button.innerHTML =
locale === "ru"
? 'СвернутьПосмотреть полностью'
: 'HideShow all';
-
button.addEventListener("click", (evt) => {
evt.preventDefault();
-
window.HMToggle("toggle", id);
-
Object.entries(obj).map((el) => {
if (el[1].name === "hm.state") {
expandState = el[1].value;
-
parentP.setAttribute("data-state", expandState);
}
});
});
-
parentP.append(button);
-
example.setAttribute("href", "javascript:void(0)");
-
example.after(nextSiblingDiv);
}
});
}
const pArray = document.querySelectorAll(".p_Normal");
-
if (pArray.length) {
pArray.forEach((p) => {
if (p.innerHTML === " ") {
@@ -533,11 +387,9 @@ function prepareContent() {
}
const examples = document.querySelectorAll("p.p_CodeExample");
-
if (examples.length) {
examples.forEach((example) => {
const childSpan = example.firstElementChild;
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -545,7 +397,6 @@ function prepareContent() {
) {
createNotation(example, "example", "примера");
}
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -553,7 +404,6 @@ function prepareContent() {
) {
createNotation(example, "warning", "внимание");
}
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -565,22 +415,15 @@ function prepareContent() {
}
//small icon
-
const icons = document.querySelectorAll(".content img");
-
if (icons.length) {
icons.forEach((icon, idx) => {
const iconWidth = parseInt(icon.width);
-
const floated = icon.style.float;
-
floated !== "" && icon.classList.add("img-float--" + floated);
-
if (iconWidth < 200) {
icon.classList.add("small-img");
-
const iconHeight = parseInt(icon.height);
-
if (
iconWidth > 70 &&
iconHeight > 70 &&
@@ -593,33 +436,28 @@ function prepareContent() {
});
}
}
-
//TODO скрытие хедера
-
function stickyHeader() {
var lastScrollTop = 0;
-
var delta = 15;
-
$(window)
.on("scroll", function () {
var st = $(this).scrollTop();
-
if (Math.abs(lastScrollTop - st) <= delta) return;
-
if (st > lastScrollTop && lastScrollTop > 0) {
$("body").addClass("--header-hidden");
-
$(".solution-select__list").removeClass("active");
-
$(".solution-select").removeClass("active");
} else {
$("body").removeClass("--header-hidden");
-
$(".solution-select__list").removeClass("active");
-
$(".solution-select").removeClass("active");
}
+ //TEST
+ // if (document.querySelector("body").classList.contains(".scroll-nav")) {
+ // $("body").addClass("--header-hidden");
+ // }
+ //TEST
lastScrollTop = st;
})
@@ -640,35 +478,23 @@ $(window).resize(function () {
function iconsTableOfContents() {
const toggledLi = document.querySelectorAll('li[data-bg*="collapsed"]');
-
toggledLi.forEach((li) => li.classList.add("toggled"));
}
$(document).ready(function () {
prepareContent();
-
toggleUlsHandler();
-
- //TODO вызов хедера
-
+ //TODO вызов скрытия хедера
// stickyHeader();
$("#side-menu").load("index.html #toc", function () {
- //TODO ререндер toc
-
- // window.addEventListener('popstate', () => {
-
- // // $(".article-inner").empty();
-
- // $('#article').load(`${window.location.href} .article-inner`, function () {
-
+ //TODO вызавает каждый раз ререндер при изменении href(добавление якоря как например)
+ // window.addEventListener("popstate", () => {
+ // $("#article").load(`${window.location.href} .article-inner`, function () {
// loadBottomLinks();
-
// prepareContent();
-
// });
-
- // })
+ // });
function onUrlChange(callback) {
const originalPushState = history.pushState;
@@ -731,50 +557,56 @@ $(document).ready(function () {
});
// Дополнительно: обработка void-ссылок
- document.querySelectorAll('a[href^="javascript:"]').forEach((link) => {
- link.addEventListener("click", (e) => {
- e.preventDefault();
- // Можно добавить здесь свою логику обработки клика
- });
- });
+ // document.querySelectorAll('a[href^="javascript:"]').forEach((link) => {
+ // link.addEventListener("click", (e) => {
+ // e.preventDefault();
+ // // Можно добавить здесь свою логику обработки клика
+ // });
+ // });
//
-
loadBottomLinks();
-
hideAllSideUls();
-
toggleUlsHandler();
-
document.addEventListener("DOMContentLoaded", () => {
if (document.visibilityState === "visible") {
hideAllSideUls();
}
});
+ //toc
+ function tryHideSideUlsWhenActive() {
+ if (document.visibilityState === "visible") {
+ hideAllSideUls();
+ } else {
+ document.addEventListener(
+ "visibilitychange",
+ () => {
+ if (document.visibilityState === "visible") {
+ hideAllSideUls();
+ }
+ },
+ { once: true }
+ );
+ }
+ }
+
+ document.addEventListener("DOMContentLoaded", tryHideSideUlsWhenActive);
const menuItems = this.querySelectorAll("a");
-
menuItems.forEach((item) => {
item.addEventListener("click", (evt) => {
evt.preventDefault();
-
const url =
evt.target.nodeName === "A"
? evt.target.href
: evt.target.closest("a").href;
-
const sideMenu = document.querySelector(".sidebar");
-
const htmlTag = document.querySelector("html");
-
const toggledLi = document.querySelectorAll('li[data-bg*="collapsed"]');
window.scrollTo(0, 0);
-
htmlTag.classList.remove("--locked");
-
$("body").removeClass("index-page search-page");
-
sideMenu.classList.remove("show-side-menu");
if (toggledLi.length) {
@@ -786,42 +618,17 @@ $(document).ready(function () {
if (url !== window.location.href) {
if (!url.includes("javascript:void")) {
$(".article-inner").empty();
-
$("#article").load(`${url} .article-inner`, function () {
history.pushState({}, null, url);
-
//metaDecsription.attr('content', metaDescriptionInitial);
-
loadBottomLinks();
-
prepareContent();
});
} else {
- // const _target = evt.target;
-
- // const _targetUl = _target.parentElement.nextElementSibling;
-
- // if (_target.nodeName === "SPAN" && _targetUl.nodeName === "UL" && _targetUl.classList.contains("hide-side-menu-item")) {
-
- // _targetUl.querySelectorAll('a')[0].click();
-
- // } else {
-
- // const _ul = _target.parentElement.querySelectorAll('a')[0].nextElementSibling;
-
- // if (_ul.nodeName === "UL") {
-
- // _ul.querySelectorAll('a')[0].click();
-
- // };
-
- // }
-
+ //TEST
function isFakeLink(link) {
if (!link) return false;
-
const href = link.getAttribute("href");
-
return href === "#" || href === "javascript:void(0);";
}
@@ -831,45 +638,34 @@ $(document).ready(function () {
function findFirstLinkInElement(element) {
if (!element) return null;
-
return element.querySelector("a");
}
function findFirstRealNestedLink(element) {
if (!element) return null;
-
const links = element.querySelectorAll("a");
-
for (const link of links) {
if (isRealLink(link)) return link;
}
-
return null;
}
document.addEventListener("click", (evt) => {
const _target = evt.target;
-
if (_target.nodeName !== "SPAN") return;
const _targetLi = _target.closest("li");
-
if (!_targetLi) return;
const submenu = _targetLi.querySelector("ul");
-
const firstLink = findFirstLinkInElement(_targetLi);
// заглушки
-
if (firstLink && isFakeLink(firstLink)) {
const nestedReal = findFirstRealNestedLink(submenu);
-
if (nestedReal) {
nestedReal.click();
-
// в первом фрагменте, после nestedReal.click();
-
setTimeout(() => {
document.dispatchEvent(new Event("subcategory:update"));
}, 50);
@@ -881,6 +677,7 @@ $(document).ready(function () {
firstLink.click(); // кликаем по нормальной ссылке
}
});
+ //TEST
}
}
});
@@ -890,28 +687,20 @@ $(document).ready(function () {
const obj = pagedata.reduce((acc, words) => {
const searchObj = {
title: words[1],
-
link: words[0],
};
-
return [...acc, searchObj];
}, []);
-
$(".search-form__input").each(function () {
var _that = $(this);
-
var _searchForm = _that.parent();
-
_that
.autocomplete({
autoFocus: false,
-
minLength: 2,
-
focus: function (event, ui) {
itemUiLinkSelected = ui.item.link;
},
-
source: function (request, response) {
const results = obj.filter(
(item) =>
@@ -920,9 +709,7 @@ $(document).ready(function () {
.includes(request.term.toLowerCase()) &&
document.querySelector(`a[href="${item.link.slice(2)}"]`)
);
-
const sliceResults = results.slice(0, 5);
-
sliceResults.map((result) => {
const aItem = document.querySelector(
`a[href="${result.link.slice(2)}"]`
@@ -930,7 +717,6 @@ $(document).ready(function () {
if (aItem) {
const parent = aItem.closest("li.heading1");
-
result.breadcrumb =
parent.querySelector("span.heading1").innerText;
} else {
@@ -949,7 +735,6 @@ $(document).ready(function () {
item.breadcrumb || ""
}`
)
-
.appendTo(ul);
};
@@ -963,15 +748,10 @@ $(document).ready(function () {
$(".glossary-abc__nav a").on("click", function (e) {
e.preventDefault();
-
var target = $(this).attr("href");
-
console.log($(this).parent().siblings());
-
$(".glossary-abc__nav a").removeClass("--active");
-
$(this).addClass("--active");
-
$("html, body").animate(
{
scrollTop: $(target).offset().top - 150,
@@ -980,33 +760,39 @@ $(document).ready(function () {
);
});
- // Хлебные крошки на странице поиска
+ const name = "Сайт ELMA365";
+ const cusLi = document.createElement("li");
+ cusLi.classList.add("heading1");
+ cusLi.classList.add("heading10");
+ const cusA = document.createElement("a");
+ cusA.classList.add("heading1");
+ cusA.setAttribute("href", "https://elma365.com/ru/");
+ cusA.setAttribute("target", "_blank");
+ const cusSpan = document.createElement("span");
+ cusSpan.classList.add("heading1");
+ cusSpan.textContent = name;
+ cusA.appendChild(cusSpan);
+ cusLi.appendChild(cusA);
+ document.querySelector("#toc").prepend(cusLi);
+ // Хлебные крошки на странице поиска
function findPrevBreadcrumbs(node, breadcrumbs) {
var breadcrumbsNew =
breadcrumbs || $('');
-
var prevParentEl = node.closest("ul") ? node.closest("ul").prev() : null;
-
if (!prevParentEl[0] || prevParentEl[0].tagName !== "A") {
return breadcrumbsNew;
}
-
breadcrumbsNew.prepend(' / ');
-
breadcrumbsNew.prepend(prevParentEl.clone());
-
return findPrevBreadcrumbs(prevParentEl, breadcrumbsNew);
}
$(".result_title a").each(function () {
var bc = "";
-
var currentArticleName = $(this);
-
$("#toc a span").each(function () {
var tocCurrentNode = $(this);
-
if (tocCurrentNode.text().trim() === currentArticleName.text().trim()) {
bc = findPrevBreadcrumbs(tocCurrentNode);
}
@@ -1019,56 +805,16 @@ $(document).ready(function () {
});
});
-//let scrollPos = 0;
-
-/* $('body').scroll(function () {
-
- let st = $(this).scrollTop();
-
- if (st > scrollPos) {
-
- $('.scroll-top').hide();
-
- } else {
-
- $('.scroll-top').show();
-
- }
-
- scrollPos = st;
-
-});
-
-
-
-$('.scroll-top').on('click', function (e) {
-
- e.preventDefault();
-
- $('html, body').animate({
-
- scrollTop: 0
-
- });
-
-}); */
-
//side menu mobile
-
const sideMenuIcon = document.querySelector("#side-menu-icon");
-
const htmlTag = document.querySelector("html");
-
const sideMenu = document.querySelector("#sidebar");
-
const closeButton = document.querySelector("#close");
if (sideMenuIcon) {
sideMenuIcon.addEventListener("click", (evt) => {
evt.preventDefault();
-
sideMenu.classList.toggle("show-side-menu");
-
htmlTag.classList.toggle("--locked");
});
}
@@ -1076,15 +822,12 @@ if (sideMenuIcon) {
if (closeButton) {
closeButton.addEventListener("click", (e) => {
e.preventDefault();
-
sideMenu.classList.remove("show-side-menu");
-
htmlTag.classList.remove("--locked");
});
}
var triggerTitleMegaGuide = false;
-
if (getTitleSite() === "Mega Guide" || /hmftsearch.html/i.test(href)) {
triggerTitleMegaGuide = true;
}
@@ -1102,9 +845,6 @@ function getTitleSite() {
const currentUrl = window.location.href;
if (
- /http:\/\/localhost/i.test(currentUrl) ||
- /brix365.t-elma365\/en\/help/i.test(currentUrl) ||
- /brix365.com\/en\/help/i.test(currentUrl) ||
/elma365.com\/ru\/help/i.test(currentUrl) ||
/elma365.com\/en\/help/i.test(currentUrl) ||
/elma365\/help\/ru/i.test(currentUrl) ||
@@ -1114,44 +854,29 @@ if (
) {
window.addEventListener("load", () => {
const searchIcon = document.querySelector("#search-icon");
-
const searchPanel = document.querySelector("#search-panel");
-
const searchInput = searchPanel.querySelector('input[type="text"]');
-
const heroSearch = document.querySelector(".hero__search");
-
if (searchIcon) {
searchIcon.addEventListener("click", (evt) => {
- console.log(searchIcon);
-
evt.preventDefault();
-
searchPanel.classList.toggle("show-search-panel");
-
setTimeout(() => searchInput.focus(), 500);
heroSearch.classList.add("hero__search--active");
});
- } else {
- console.log("error");
}
-
if (searchInput) {
const label = searchInput.closest("label");
-
searchInput.addEventListener("blur", () => {
searchPanel.classList.remove("show-search-panel");
-
heroSearch.classList.remove("hero__search--active");
-
if (searchInput.value) {
label.classList.add("cross");
} else {
label.classList.remove("cross");
}
});
-
searchInput.addEventListener("focus", () => {
label.classList.add("cross");
});
@@ -1167,15 +892,12 @@ if (
$(".arrow-top").click(function () {
$("html, body").animate({ scrollTop: 0 }, 600);
-
return false;
});
// очистить поиск
-
if (document.querySelector("#reset-search")) {
const resetButton = document.querySelector("#reset-search");
-
resetButton.addEventListener("click", () => {
searchInput.value = "";
});
@@ -1190,84 +912,37 @@ if (
wrapperSearch.classList.add("search-form__label");
const tagSpanIcons = document.createElement("span");
-
tagSpanIcons.className = "search__icon";
-
tagSpanIcons.setAttribute("id", "reset-search");
-
wrapperSearch.prepend(tagSpanIcons);
- // const insertInnerHtml = document.querySelector('tr .ya-site-form__search-input-layout-l');
-
- // const divBlockHeroSearch = document.createElement('div');
-
- //
-
- // divBlockHeroSearch.classList.add('hero__search')
-
- // divBlockHeroSearch.innerHTML = `
-
- //
-
- //
-
- //
-
- //
-
- // `;
-
- // setTimeout(() => {
-
- // insertInnerHtml.appendChild(divBlockHeroSearch);
-
- // }, 1000);
-
const searchIcon = document.querySelector("#search-icon");
-
const searchPanel = document.querySelector(
".ya-site-form.ya-site-form_bg_transparent.ya-site-form_inited_yes"
);
-
const searchInput = searchPanel.querySelector('input[type="search"]');
-
const heroSearch = document.querySelector(".hero__search");
-
if (searchIcon) {
searchIcon.addEventListener("click", (evt) => {
- console.log(searchIcon);
-
evt.preventDefault();
-
searchPanel.classList.toggle("show-search-panel");
-
setTimeout(() => searchInput.focus(), 500);
-
heroSearch.classList.add("hero__search--active");
});
}
-
if (searchInput) {
const div = searchInput.closest(".ya-site-form__input");
-
searchInput.addEventListener("blur", searchWatch);
function searchWatch() {
searchPanel.classList.remove("show-search-panel");
-
heroSearch.classList.remove("hero__search--active");
-
if (searchInput.value !== "") {
div.classList.add("cross");
} else {
div.classList.remove("cross");
}
}
-
searchInput.addEventListener("focus", () => {
div.classList.add("cross");
});
@@ -1283,21 +958,15 @@ if (
$(".arrow-top").click(function () {
$("html, body").animate({ scrollTop: 0 }, 600);
-
return false;
});
// очистить поиск
-
const resetButton = document.querySelector("#reset-search");
-
resetButton.addEventListener("click", () => {
searchInput.value = "";
-
searchInput.focus();
-
baseUrl = window.location.href.split("?")[0];
-
window.history.pushState("name", "", baseUrl);
});
});
@@ -1311,29 +980,20 @@ function searchFormHeader() {
$(".search-form").each(function () {
$(this).on("submit", (evt) => {
evt.preventDefault();
-
evt.stopPropagation();
-
var searchStr = evt.target[0].value;
-
if (searchStr.trim()) {
if (
(/elma365.com\/ru\/help/i.test(window.location.href) ||
/elma365.com\/en\/help/i.test(window.location.href) ||
/t-elma365.com/i.test(window.location.href) ||
- /brix365.com\/en\/help/i.test(window.location.href) ||
/([\d+]{3}).(\d).(\d).(\d)/i.test(window.location.href) ||
/http:\/\/localhost/i.test(window.location.href)) &&
!triggerTitleMegaGuide
) {
window.location.href = `./search.html?query=${searchStr}`;
- }
-
- //фикс поиска, тест
- else {
- // window.location.href = `./hmftsearch.html?zoom_query=${searchStr}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
- window.location.href = `./search.html?query=${searchStr}`;
+ } else {
+ window.location.href = `./hmftsearch.html?zoom_query=${searchStr}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
}
}
});
@@ -1347,41 +1007,28 @@ if (
Boolean(document.querySelector(".searchheading"))
) {
const searchTitle = document.querySelector(".searchheading");
-
const queryString = window.location.search;
-
let currentPageNumber = null;
const searchParams = queryString.split("&");
-
searchParams.forEach((param) => {
const paramArr = param.split("=");
-
if (paramArr[0] === "zoom_page") {
currentPageNumber = +paramArr[1];
}
});
-
const searchWord = decodeURI(searchParams[0].split("=")[1]);
-
searchTitle.innerText =
locale === "ru" ? "Результаты поиска:" : "Search results for:";
-
const searchWordP = document.createElement("p");
-
searchWordP.classList.add("search-word");
-
searchWordP.innerText = searchWord;
-
searchTitle.append(searchWordP);
let pagesCount = "0";
-
const resultPagesCount = document.querySelector(".result_pagescount");
-
if (resultPagesCount) {
pagesCount = parseInt(resultPagesCount.innerText.trim());
-
resultPagesCount.remove();
}
@@ -1389,109 +1036,62 @@ if (
switch (currentPage) {
case "first-page": {
resultPages[0].textContent = "<< < ";
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = "1";
-
resultPages[0].after(span);
-
const aEnd = document.createElement("a");
-
const urlEnd = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=${pagesCount}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aEnd.setAttribute("href", urlEnd);
-
aEnd.textContent = " >>";
-
// resultPages[resultPages.length - 1].textContent = ' >>';
-
resultPages[resultPages.length - 1].after(aEnd);
-
resultPages[resultPages.length - 2].remove();
-
resultPages[resultPages.length - 2].textContent = " > ";
-
break;
}
-
case "last-page": {
resultPages[resultPages.length - 1].textContent = ` > >>`;
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = currentPageNumber;
-
const aBegin = document.createElement("a");
-
const urlBegin = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=1&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aBegin.setAttribute("href", urlBegin);
-
aBegin.textContent = "<< ";
-
resultPages[resultPages.length - 1].before(span);
-
// resultPages[0].textContent = '<< ';
-
resultPages[1].before(aBegin);
-
resultPages[0].remove();
-
resultPages[1].textContent = "< ";
-
break;
}
-
case "default-page": {
const aBegin = document.createElement("a");
-
const aEnd = document.createElement("a");
-
const urlBegin = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=1&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
const urlEnd = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=${pagesCount}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aBegin.setAttribute("href", urlBegin);
-
aBegin.textContent = "<< ";
-
aEnd.setAttribute("href", urlEnd);
-
aEnd.textContent = " >>";
-
resultPages[1].before(aBegin);
-
resultPages[0].remove();
-
//resultPages[0].textContent = '<< ';
-
//resultPages[0] = aBegin;
-
resultPages[1].textContent = " < ";
-
resultPages[resultPages.length - 2].textContent = " > ";
-
//resultPages[resultPages.length - 1].textContent = ' >> ';
-
resultPages[resultPages.length - 2].after(aEnd);
-
resultPages[resultPages.length - 1].remove();
-
break;
}
-
default:
break;
}
}
const resultPagesNode = document.querySelector(".result_pages");
-
const resultPages = resultPagesNode
? document.querySelector(".result_pages").childNodes
: [];
@@ -1516,15 +1116,10 @@ if (
resultPages.forEach((node) => {
if (+node.textContent.trim() === currentPageNumber) {
const nextElement = node.nextSibling;
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = currentPageNumber;
-
nextElement.before(span);
-
node.remove();
}
});
@@ -1532,33 +1127,17 @@ if (
}
const summary = document.querySelectorAll(".summary");
-
if (summary.length > 0 && locale === "ru") {
const count = parseInt(summary[0].innerText.trim());
-
summary[0].innerText = count
? `Найдено совпадений: ${count}`
: (summary.innerText = "Совпадений не найдено");
}
}
-// подменяет текст в абзаце в зависимости от атрибута lang
-
-// if (document.documentElement.lang === "en") {
-
-// $('#found_typo').html('Found a typo? Highlight the text, press ctrl + enter and notify us')
-
-// } else if (document.documentElement.lang === "ru") {
-
-// $('#found_typo').html('Нашли опечатку? Выделите текст, нажмите ctrl + enter и оповестите нас')
-
-// }
-
$(window).on("load", () => {
// правит текст в фильтре результатов поиска
-
// $('.b-loader__wrapper').css('opacity', 0);
-
function replace() {
var intervalReplace = setInterval(() => {
if (
@@ -1574,20 +1153,17 @@ $(window).on("load", () => {
setTimeout(() => {
clearInterval(intervalReplace);
-
// }, 180000);
}, 10000);
function t() {
if (document.documentElement.lang === "en") {
textResult("нашёл", "Matches found", "all resourses", 13);
-
textFindSection("Search through ");
}
if (document.documentElement.lang === "ru") {
textResult("нашёл", "Найдено совпадений", "всем ресурсам", 18);
-
textFindSection("Искать по ");
}
@@ -1596,14 +1172,11 @@ $(window).on("load", () => {
searchAny = $(
".b-dropdowna__switcher .b-pseudo-link_is-bem_yes"
).text();
-
var e = text.replace(textFound, textFoundRes),
t = searchAny.replace("любой", textAny);
-
$("tr td.b-head__r .b-head__found").text(
e.substring(0, n) + ": " + parseInt(text.match(/\d+/))
);
-
$(".b-dropdowna__switcher .b-pseudo-link_is-bem_yes").text(t);
if ($("tr td.b-head__r .b-head__found").text().indexOf("найдёт") == 0) {
@@ -1637,11 +1210,8 @@ $(window).on("load", () => {
if (i > 0) {
if (element.childNodes[0].textContent.indexOf("раздел") === 0) {
var htmlTag = [];
-
htmlTag.push(element.childNodes[i]);
-
element.textContent = textResSection;
-
htmlTag.forEach((item) => {
element.appendChild(item);
});
@@ -1666,7 +1236,6 @@ $(window).on("load", () => {
setTimeout(() => {
clearInterval(intervalAddElementSubsection);
-
// }, 180000)
}, 10000);
@@ -1680,71 +1249,48 @@ $(window).on("load", () => {
var textContent = $("yass-li.b-serp-item .b-serp-url__item")[index]
.textContent;
-
switch (true) {
// ELMA365
-
case /elma365.com\/ru\/help/i.test(textContent):
subsectionTitle("Справка");
-
break;
-
case /academy.com/i.test(textContent):
subsectionTitle("ELMA Academy");
-
break;
-
case /tssdk.elma/i.test(textContent):
subsectionTitle("TS SDK");
-
break;
-
case /exchange.elma/i.test(textContent):
subsectionTitle("ELMA365 Exchange");
-
break;
// Английская версия
-
case /en\/help/i.test(textContent):
subsectionTitle("Help");
-
break;
// rpa
-
case /rpa.ai\/ru/i.test(textContent):
subsectionTitle("RPA");
-
break;
// ELMA4
-
case /ru\/help4\/ecm/i.test(textContent):
subsectionTitle("ECM+");
-
break;
-
case /ru\/help4\/crm/i.test(textContent):
subsectionTitle("CRM+");
-
break;
-
case /ru\/help4\/projects/i.test(textContent):
subsectionTitle("Проекты");
-
break;
-
case /elma-bpm.ru\/help4/i.test(textContent):
subsectionTitle("BPM");
-
break;
-
case /ru\/KB/i.test(textContent) ||
/elma-bpm.ru\/…help/i.test(textContent) ||
/help/i.test(textContent):
subsectionTitle("База знаний");
-
break;
}
@@ -1753,11 +1299,8 @@ $(window).on("load", () => {
$(".subsection-title")[index].textContent = text;
} else {
var newBlockDiv = document.createElement("div");
-
newBlockDiv.classList.add("subsection-title");
-
newBlockDiv.textContent = text;
-
$(".b-serp-item__title")[index].prepend(newBlockDiv);
}
}
@@ -1775,20 +1318,16 @@ $(window).on("load", () => {
if ($("tr td.b-head__r .b-head__found")) {
var intervalTimer = setInterval(() => {
replace();
-
addElementSubsection();
}, 200);
// через 3 минуты интервал останавливается (время взято примерно, чтобы успело все прогрузиться)
-
setTimeout(() => {
clearInterval(intervalTimer);
-
// }, 180000);
}, 10000);
} else {
replace();
-
addElementSubsection();
}
});
@@ -1797,41 +1336,25 @@ $(window).on("load", () => {
const leadhandler = "https://web.s-elma365.ru";
var rootNode = document.createElement("div");
-
document.body.appendChild(rootNode);
-
var typo = new TypoReporter(
{
formId: "1FAIpQLSfXEIXAFoOiHgetf0reIjWrOAw6V7KCZrhAv8VVD6WL7Rs46g", // required, see previous step
// Optional example stuff below
-
locale: getLocale(), // optional language, defaults to 'en'
-
// translations: { // optinal object with translated strings
-
// fr: {
-
// // see source code for keys to translate
-
// },
-
// ru: {
-
//
-
// }
-
// },
-
offset: 100, // amount of context text to grab from before and after the selection, defaults to 50
-
endpointUrl: leadhandler + "/api/baglist/", // optional, defaults to Google Forms
-
snippetFieldName: "typo", // optional, if using custom form
-
commentFieldName: "comment", // optional, if using custom form
-
urlFieldName: "url", // optional, if using custom form
},
rootNode
@@ -1839,14 +1362,12 @@ var typo = new TypoReporter(
$(document).on("focus", ".fill_listener", function () {
//console.log("test");
-
$(this).parent().addClass("focused");
});
$(document).on("blur", ".fill_listener", function () {
$(this).parent().removeClass("focused");
});
-
$(document).on("change", ".fill_listener", function () {
if ($(this).val().length) {
$(this).parent().addClass("filled");
@@ -1858,21 +1379,16 @@ $(document).on("change", ".fill_listener", function () {
function feedbackSubmit() {
$("#feedback-form").on("submit", function () {
var $form = $(this);
-
var formData = $form.serializeArray().slice(0, -1);
-
var context = {};
$(formData).each(function (index, obj) {
if (obj.name === "useful" && obj.value === "true") {
context.other = "";
-
context.useful = true;
-
context.category = [
{
code: "",
-
name: "",
},
];
@@ -1883,14 +1399,11 @@ function feedbackSubmit() {
if (obj.name === "other") {
context.other = obj.value;
}
-
context.useful = false;
-
if (obj.name === "category") {
context.category = [
{
code: obj.value,
-
name: $form.find('option[value="' + obj.value + '"]').text(),
},
];
@@ -1900,18 +1413,13 @@ function feedbackSubmit() {
});
context.produkt = ["6b55aead-f008-42c7-9186-0806c06d4f2c"];
-
context.link = window.location.href;
-
var data = {
context,
};
-
var request = $.ajax({
type: "POST",
-
url: leadhandler + "/api/feedback/create",
-
data: JSON.stringify(data),
})
.fail(function (response) {
@@ -1920,7 +1428,6 @@ function feedbackSubmit() {
.done(function (response) {
return response;
});
-
return false;
});
}
@@ -1936,32 +1443,23 @@ $(document).ready(function () {
var $form = $(this),
textarea = $form.find('textarea[name="help_question"]'),
//formData = $form.serializeArray().slice(0, -1),
-
context = {};
context.other = textarea.val();
-
context.category = [
{
code: "question",
-
name: "Задать вопрос",
},
];
-
context.produkt = ["6b55aead-f008-42c7-9186-0806c06d4f2c"];
-
context.link = window.location.href;
-
var data = {
context,
};
-
var request = $.ajax({
type: "POST",
-
url: leadhandler + "/api/feedback/create",
-
data: JSON.stringify(data),
})
.fail(function (response) {
@@ -1972,23 +1470,18 @@ $(document).ready(function () {
.parent()
.find(".question-success")
.removeClass("hidden");
-
setTimeout(() => {
$(".question-xs").attr("style", "display:none;");
-
textarea.val("");
});
-
setTimeout(() => {
$(".question__popup")
.parent()
.find(".question-success")
.addClass("hidden");
-
$(".question").removeClass("active");
}, 3000);
});
-
return false;
});
});
@@ -1998,7 +1491,6 @@ function question() {
const questionPopup = $(this).parent().find(".question-xs");
questionPopup.attr("style", "display:block;");
-
setTimeout(() => {
$(this).parent().find('textarea[name="help_question"]').focus();
}, 200);
@@ -2006,7 +1498,6 @@ function question() {
$(document).mouseup(function (e) {
let container = $(".question-xs");
-
if (!container.is(e.target) && container.has(e.target).length === 0) {
container.attr("style", "display:none;");
}
@@ -2018,12 +1509,9 @@ function question() {
$(".question-xs").on("submit", function () {
$(this).parent().find(".question-success-xs").removeClass("hidden");
-
$(this).removeClass("active");
-
setTimeout(() => {
$(this).parent().find(".question-success-xs").addClass("hidden");
-
$(this).addClass("active");
}, 3000);
});
@@ -2033,28 +1521,23 @@ question();
$(document).click(function (e) {
if ($(e.target).closest(".ReportTypo-popup").length != 0) return false;
-
$(".ReportTypo").fadeOut(100);
});
$(document).click(function (e) {
if ($(e.target).closest(".ReportTypo-popup").length != 0) return false;
-
$(".ReportTypo").fadeOut(100);
});
jQuery(function ($) {
$(document).mouseup(function (e) {
// ������� ����� �� ���-���������
-
var div = $("#feedback-form"); // ��� ��������� ID ��������
-
if (
!div.is(e.target) && // ���� ���� ��� �� �� ������ �����
div.has(e.target).length === 0
) {
// � �� �� ��� �������� ���������
-
$(".feedback-form").find("input:checked").removeAttr("checked");
}
});
@@ -2062,25 +1545,17 @@ jQuery(function ($) {
function feedback() {
const yesLabel = document.getElementById("feedback__useful_yes");
-
const thxWindow = document.getElementById("feedback__popup_thx");
-
const noLabel = document.getElementById("feedback__useful_no");
-
const feedbackWhyPopup = document.getElementById("feedback__popup_why");
-
const form = document.getElementById("feedback-form");
-
const otherInput = document.getElementById("other_reason");
-
const otherPopup = document.getElementById("feedback__popup-other");
-
const feedbackOtherBtn = document.querySelector(".feedback__other-btn");
const inputs = [
...document.querySelectorAll('#feedback__popup_why input[type="radio"]'),
];
-
const allRadio = inputs.filter((item) => item.id !== "other_reason");
allRadio.forEach((item) =>
@@ -2099,16 +1574,12 @@ function feedback() {
otherInput.addEventListener("change", (e) => {
if (e.target.checked) {
feedbackWhyPopup.style.display = "none";
-
otherPopup.style.display = "block";
-
$(".feedback__popup").find('textarea[name="other"]').focus();
feedbackOtherBtn.addEventListener("click", function () {
otherPopup.style.display = "none";
-
$("#feedback-success-popup").show();
-
setTimeout(() => {
$("#feedback-success-popup").hide();
}, 3000);
@@ -2122,9 +1593,7 @@ function feedback() {
if (Boolean(feedbackWhyPopup)) {
document.addEventListener("click", (e) => {
const target = e.target;
-
feedbackWhyPopup.style.display = "none";
-
thxWindow.style.display = "none";
if (target.matches("#feedback__useful_no")) {
@@ -2160,7 +1629,6 @@ $(window).on("load", function () {
document.querySelectorAll("main article section div")[1]
) {
let el = document.querySelectorAll("main article section div")[1];
-
el.setAttribute("id", "table-mobile-desktop_size");
}
});
@@ -2178,7 +1646,6 @@ if (document.querySelector("#side-menu")) {
document.querySelectorAll("main article section div")[1]
) {
let el = document.querySelectorAll("main article section div")[1];
-
el.setAttribute("id", "table-mobile-desktop_size");
}
}, 200);
@@ -2194,52 +1661,39 @@ if (document.querySelector("#side-menu")) {
if (document.getElementsByClassName("accordion-btn__show")) {
var showAccordionBtn = document.querySelector(".accordion-btn__show");
-
var elementAccordionHide = document.querySelector(".accordion__hide");
-
var linearGradient = document.querySelector(".linear-gradient");
-
var heightAccordionElem =
document.querySelector(".card-stack-50").scrollHeight;
var t = false;
-
showAccordionBtn.addEventListener("click", () => {
switch (true) {
case showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.contains("arrow__show"):
elementAccordionHide.classList.add("accordion__show");
-
elementAccordionHide.style.maxHeight = heightAccordionElem + "px";
-
elementAccordionHide.classList.remove("accordion__hide");
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.remove("arrow__show");
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.add("arrow__hide");
setTimeout(() => {
linearGradient.classList.remove("linear-gradient");
-
showAccordionBtn.querySelector("p").textContent = "Свернуть";
}, 1000);
-
break;
case showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.contains("arrow__hide"):
elementAccordionHide.classList.add("accordion__hide");
-
elementAccordionHide.classList.remove("accordion__show");
-
elementAccordionHide.style.maxHeight = "";
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.add("arrow__show");
@@ -2248,12 +1702,9 @@ if (document.getElementsByClassName("accordion-btn__show")) {
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.remove("arrow__hide");
-
linearGradient.classList.add("linear-gradient");
-
showAccordionBtn.querySelector("p").textContent = "Показать всё";
}, 1000);
-
break;
}
});
@@ -2266,7 +1717,6 @@ if (document.getElementsByClassName("accordion-btn__show")) {
(function () {
if (document.querySelector(".accordion__items")) {
var btn = document.querySelectorAll(".accordion__item-question");
-
var dehiscentItems = document.querySelectorAll(
".accordion__item-question-answer"
);
@@ -2279,11 +1729,8 @@ if (document.getElementsByClassName("accordion-btn__show")) {
removeActiveClass();
} else {
removeActiveClass();
-
this.classList.toggle("accordion__active");
-
nextEl.style.maxHeight = nextEl.scrollHeight + "px";
-
nextEl.style.marginBottom = "15px";
}
});
@@ -2296,7 +1743,6 @@ if (document.getElementsByClassName("accordion-btn__show")) {
dehiscentItems.forEach((i) => {
i.style.maxHeight = null;
-
i.style.marginBottom = null;
});
}
diff --git a/ecm/jquery.tocify.min.js b/ecm/jquery.tocify.min.js
index 55f8a9d..5051d08 100644
--- a/ecm/jquery.tocify.min.js
+++ b/ecm/jquery.tocify.min.js
@@ -1,5 +1,4 @@
-/*! jquery.tocify - v1.9.0 - 2013-10-01
-* http://gregfranko.com/jquery.tocify.js/
-* Copyright (c) 2013 Greg Franko; Licensed MIT*/
-
-!function(){"use strict";!function(r,d,c){"use strict";var o="tocify",e="tocify-focus",t="tocify-hover",n="tocify-hide",a="tocify-header",i="."+a,l="tocify-subheader",h="."+l,f="tocify-item",u="."+f,p="tocify-extend-page",g="."+p;r.widget("toc.tocify",{version:"1.9.0",options:{context:"body",ignoreSelector:null,selectors:"h1, h2, h3",showAndHide:!0,showEffect:"slideDown",showEffectSpeed:"medium",hideEffect:"slideUp",hideEffectSpeed:"medium",smoothScroll:!0,smoothScrollSpeed:"medium",scrollTo:0,showAndHideOnScroll:!0,highlightOnScroll:!0,highlightOffset:40,theme:"bootstrap",extendPage:!0,extendPageOffset:100,history:!0,scrollHistory:!1,hashGenerator:"compact",highlightDefault:!0},_create:function(){var e=this;e.extendPageScroll=!0,e.items=[],e._generateToc(),e._addCSSClasses(),e.webkit=function(){for(var e in d)if(e&&-1!==e.toLowerCase().indexOf("webkit"))return!0;return!1}(),e._setEventHandlers(),r(d).load(function(){e._setActiveElement(!0),r("html, body").promise().done(function(){setTimeout(function(){e.extendPageScroll=!1},0)})})},_generateToc:function(){var e,t,s=this,i=s.options.ignoreSelector;return e=-1!==this.options.selectors.indexOf(",")?r(this.options.context).find(this.options.selectors.replace(/ /g,"").substr(0,this.options.selectors.indexOf(","))):r(this.options.context).find(this.options.selectors.replace(/ /g,"")),e.length?(s.element.addClass(o),e.each(function(e){r(this).is(i)||(t=r("",{id:a+e,class:a}).append(s._nestElements(r(this),e)),s.element.append(t),r(this).nextUntil(this.nodeName.toLowerCase()).each(function(){0===r(this).find(s.options.selectors).length?r(this).filter(s.options.selectors).each(function(){r(this).is(i)||s._appendSubheaders.call(this,s,t)}):r(this).find(s.options.selectors).each(function(){r(this).is(i)||s._appendSubheaders.call(this,s,t)})}))}),undefined):(s.element.addClass(n),undefined)},_setActiveElement:function(e){var t=this,s=d.location.hash.substring(1),i=t.element.find('li[data-unique="'+s+'"]');return s.length?(t.element.find("."+t.focusClass).removeClass(t.focusClass),i.addClass(t.focusClass),t.options.showAndHide&&i.click()):(t.element.find("."+t.focusClass).removeClass(t.focusClass),!s.length&&e&&t.options.highlightDefault&&t.element.find(u).first().addClass(t.focusClass)),t},_nestElements:function(t,e){var s,i,o;return s=r.grep(this.items,function(e){return e===t.text()}),s.length?this.items.push(t.text()+e):this.items.push(t.text()),o=this._generateHashValue(s,t,e),i=r("",{class:f,"data-unique":o}).append(r("",{text:t.text()})),t.before(r("",{name:o,"data-unique":o})),i},_generateHashValue:function(e,t,s){var i="",o=this.options.hashGenerator;if("pretty"===o){for(i=t.text().toLowerCase().replace(/\s/g,"-");i.indexOf("--")>-1;)i=i.replace(/--/g,"-");for(;i.indexOf(":-")>-1;)i=i.replace(/:-/g,"-")}else i="function"==typeof o?o(t.text(),t):t.text().replace(/\s/g,"");return e.length&&(i+=""+s),i},_appendSubheaders:function(e,t){var s=r(this).index(e.options.selectors),i=r(e.options.selectors).eq(s-1),o=+r(this).prop("tagName").charAt(1),n=+i.prop("tagName").charAt(1);n>o?e.element.find(h+"[data-tag="+o+"]").last().append(e._nestElements(r(this),s)):o===n?t.find(u).last().after(e._nestElements(r(this),s)):t.find(u).last().after(r("",{class:l,"data-tag":o})).next(h).append(e._nestElements(r(this),s))},_setEventHandlers:function(){var h=this;this.element.on("click.tocify","li",function(){if(h.options.history&&(d.location.hash=r(this).attr("data-unique")),h.element.find("."+h.focusClass).removeClass(h.focusClass),r(this).addClass(h.focusClass),h.options.showAndHide){var e=r('li[data-unique="'+r(this).attr("data-unique")+'"]');h._triggerShow(e)}h._scrollTo(r(this))}),this.element.find("li").on({"mouseenter.tocify":function(){r(this).addClass(h.hoverClass),r(this).css("cursor","pointer")},"mouseleave.tocify":function(){"bootstrap"!==h.options.theme&&r(this).removeClass(h.hoverClass)}}),(h.options.extendPage||h.options.highlightOnScroll||h.options.scrollHistory||h.options.showAndHideOnScroll)&&r(d).on("scroll.tocify",function(){r("html, body").promise().done(function(){var o,e,t,s,n=r(d).scrollTop(),i=r(d).height(),a=r(c).height(),l=r("body")[0].scrollHeight;if(h.options.extendPage&&(h.webkit&&n>=l-i-h.options.extendPageOffset||!h.webkit&&i+n>a-h.options.extendPageOffset)&&!r(g).length){if(e=r('div[data-unique="'+r(u).last().attr("data-unique")+'"]'),!e.length)return;t=e.offset().top,r(h.options.context).append(r("",{class:p,height:Math.abs(t-n)+"px","data-unique":p})),h.extendPageScroll&&(s=h.element.find("li.active"),h._scrollTo(r('div[data-unique="'+s.attr("data-unique")+'"]')))}setTimeout(function(){var e,s=null,i=null,t=r(h.options.context).find("div[data-unique]");t.each(function(e){var t=Math.abs((r(this).next().length?r(this).next():r(this)).offset().top-n-h.options.highlightOffset);return null==s||s>t?(s=t,i=e,undefined):!1}),e=r(t[i]).attr("data-unique"),o=r('li[data-unique="'+e+'"]'),h.options.highlightOnScroll&&o.length&&(h.element.find("."+h.focusClass).removeClass(h.focusClass),o.addClass(h.focusClass)),h.options.scrollHistory&&d.location.hash!=="#"+e&&d.location.replace("#"+e),h.options.showAndHideOnScroll&&h.options.showAndHide&&h._triggerShow(o,!0)},0)})})},show:function(e){var t=this;if(!e.is(":visible"))switch(e.find(h).length||e.parent().is(i)||e.parent().is(":visible")?e.children(h).length||e.parent().is(i)||(e=e.closest(h)):e=e.parents(h).add(e),t.options.showEffect){case"none":e.show();break;case"show":e.show(t.options.showEffectSpeed);break;case"slideDown":e.slideDown(t.options.showEffectSpeed);break;case"fadeIn":e.fadeIn(t.options.showEffectSpeed);break;default:e.show()}return e.parent().is(i)?t.hide(r(h).not(e)):t.hide(r(h).not(e.closest(i).find(h).not(e.siblings()))),t},hide:function(e){var t=this;switch(t.options.hideEffect){case"none":e.hide();break;case"hide":e.hide(t.options.hideEffectSpeed);break;case"slideUp":e.slideUp(t.options.hideEffectSpeed);break;case"fadeOut":e.fadeOut(t.options.hideEffectSpeed);break;default:e.hide()}return t},_triggerShow:function(e,t){var s=this;return e.parent().is(i)||e.next().is(h)?s.show(e.next(h),t):e.parent().is(h)&&s.show(e.parent(),t),s},_addCSSClasses:function(){return"jqueryui"===this.options.theme?(this.focusClass="ui-state-default",this.hoverClass="ui-state-hover",this.element.addClass("ui-widget").find(".toc-title").addClass("ui-widget-header").end().find("li").addClass("ui-widget-content")):"bootstrap"===this.options.theme?(this.element.find(i+","+h).addClass("nav nav-list"),this.focusClass="active"):(this.focusClass=e,this.hoverClass=t),this},setOption:function(){r.Widget.prototype._setOption.apply(this,arguments)},setOptions:function(){r.Widget.prototype._setOptions.apply(this,arguments)},_scrollTo:function(e){var t=document.querySelector('div[data-unique="'+e.attr("data-unique")+'"]');if(t)t.scrollIntoView({behavior:this.options.smoothScroll?"smooth":"auto",block:"start"});return this}})}(window.jQuery,window,document)}();
\ No newline at end of file
+/*! jquery.tocify - v1.9.0 - 2013-10-01
+ * http://gregfranko.com/jquery.tocify.js/
+ * Copyright (c) 2013 Greg Franko; Licensed MIT*/
+!function(){"use strict";var a,l,h,o,s,n,r,i,d,c;a=window.jQuery,l=window,h=document,s="."+(o="tocify-header"),r="."+(n="tocify-subheader"),d="."+(i="tocify-item"),c="tocify-extend-page",a.widget("toc.tocify",{version:"1.9.0",options:{context:"body",ignoreSelector:null,selectors:"h1, h2, h3",showAndHide:!0,showEffect:"slideDown",showEffectSpeed:"medium",hideEffect:"slideUp",hideEffectSpeed:"medium",smoothScroll:!0,smoothScrollSpeed:"medium",scrollTo:0,showAndHideOnScroll:!0,highlightOnScroll:!0,highlightOffset:40,theme:"bootstrap",extendPage:!0,extendPageOffset:100,history:!0,scrollHistory:!1,hashGenerator:"compact",highlightDefault:!0},_create:function(){var e=this;e.extendPageScroll=!0,e.items=[],e._generateToc(),e._addCSSClasses(),e.webkit=function(){for(var e in l)if(e&&-1!==e.toLowerCase().indexOf("webkit"))return!0;return!1}(),e._setEventHandlers(),a(l).load(function(){e._setActiveElement(!0),a("html, body").promise().done(function(){setTimeout(function(){e.extendPageScroll=!1},0)})})},_generateToc:function(){var t,s=this,i=s.options.ignoreSelector,e=-1!==this.options.selectors.indexOf(",")?a(this.options.context).find(this.options.selectors.replace(/ /g,"").substr(0,this.options.selectors.indexOf(","))):a(this.options.context).find(this.options.selectors.replace(/ /g,""));return e.length?(s.element.addClass("tocify"),void e.each(function(e){a(this).is(i)||(t=a("",{id:o+e,class:o}).append(s._nestElements(a(this),e)),s.element.append(t),a(this).nextUntil(this.nodeName.toLowerCase()).each(function(){(0===a(this).find(s.options.selectors).length?a(this).filter(s.options.selectors):a(this).find(s.options.selectors)).each(function(){a(this).is(i)||s._appendSubheaders.call(this,s,t)})}))})):void s.element.addClass("tocify-hide")},_setActiveElement:function(e){var t=this,s=l.location.hash.substring(1),i=t.element.find('li[data-unique="'+s+'"]');return s.length?(t.element.find("."+t.focusClass).removeClass(t.focusClass),i.addClass(t.focusClass),t.options.showAndHide&&i.click()):(t.element.find("."+t.focusClass).removeClass(t.focusClass),!s.length&&e&&t.options.highlightDefault&&t.element.find(d).first().addClass(t.focusClass)),t},_nestElements:function(t,e){var s=a.grep(this.items,function(e){return e===t.text()});return s.length?this.items.push(t.text()+e):this.items.push(t.text()),s=this._generateHashValue(s,t,e),e=a("",{class:i,"data-unique":s}).append(a("",{text:t.text()})),t.before(a("",{name:s,"data-unique":s})),e},_generateHashValue:function(e,t,s){var i="",o=this.options.hashGenerator;if("pretty"===o){for(i=t.text().toLowerCase().replace(/\s/g,"-");-1",{class:n,"data-tag":o})).next(r).append(e._nestElements(a(this),s))},_setEventHandlers:function(){var n=this;this.element.on("click.tocify","li",function(){var e;n.options.history&&(l.location.hash=a(this).attr("data-unique")),n.element.find("."+n.focusClass).removeClass(n.focusClass),a(this).addClass(n.focusClass),n.options.showAndHide&&(e=a('li[data-unique="'+a(this).attr("data-unique")+'"]'),n._triggerShow(e)),n._scrollTo(a(this))}),this.element.find("li").on({"mouseenter.tocify":function(){a(this).addClass(n.hoverClass),a(this).css("cursor","pointer")},"mouseleave.tocify":function(){"bootstrap"!==n.options.theme&&a(this).removeClass(n.hoverClass)}}),(n.options.extendPage||n.options.highlightOnScroll||n.options.scrollHistory||n.options.showAndHideOnScroll)&&a(l).on("scroll.tocify",function(){a("html, body").promise().done(function(){var t,o=a(l).scrollTop(),e=a(l).height(),s=a(h).height(),i=a("body")[0].scrollHeight;if(n.options.extendPage&&(n.webkit&&o>=i-e-n.options.extendPageOffset||!n.webkit&&e+o>s-n.options.extendPageOffset)&&!a(".tocify-extend-page").length){if(!(i=a('div[data-unique="'+a(d).last().attr("data-unique")+'"]')).length)return;e=i.offset().top,a(n.options.context).append(a("",{class:c,height:Math.abs(e-o)+"px","data-unique":c})),n.extendPageScroll&&(s=n.element.find("li.active"),n._scrollTo(a('div[data-unique="'+s.attr("data-unique")+'"]')))}setTimeout(function(){var s=null,i=null,e=a(n.options.context).find("div[data-unique]");e.each(function(e){var t=Math.abs((a(this).next().length?a(this).next():a(this)).offset().top-o-n.options.highlightOffset);return(null==s||t {
const lan = document.documentElement.lang;
-
return lan ? document.documentElement.lang : "ru";
};
@@ -13,186 +12,125 @@ function getProduct() {
case "elma-rpa.ai":
product = {
name: "rpa",
-
id: "33678c11-fea6-4adb-aa39-adc4e8295b53",
};
-
break;
-
case "www.elma-bpm.ru":
product = {
name: "elma3/4",
-
id: "44b97702-146c-414b-9db7-0b09705556ed",
};
-
break;
-
default:
product = {
name: "elma365",
-
id: "3354c78a-720e-4584-a9c6-83f0f1396d22",
};
-
break;
}
-
return product;
}
-document
- .querySelector(".solution-select")
- .addEventListener("mouseenter", function () {
- this.classList.add("active");
-
- document.querySelector(".solution-select__list").classList.add("active");
- });
-
-document
- .querySelector(".solution-select__list")
- .addEventListener("mouseleave", function () {
- this.classList.remove("active");
-
- document.querySelector(".solution-select").classList.remove("active");
- });
-
-const titleName = () => {
- let textSpanTitle = document.querySelector(".solution-select__selected");
-
- let currentPlace = window.location.pathname
- .replace("/en/help/", "")
- .split("/")[0];
-
- textSpanTitle.textContent =
- currentPlace.charAt(0).toUpperCase() + currentPlace.slice(1);
-
- if (currentPlace === "crm" || "ecm") {
- textSpanTitle.textContent = currentPlace.toUpperCase();
- }
-
- if (currentPlace === "business_solutions") {
- let business = currentPlace.replace("_", " ");
-
- textSpanTitle.textContent =
- business.charAt(0).toUpperCase() +
- business.slice(1, 8) +
- " " +
- business.charAt(9).toUpperCase() +
- business.slice(10);
- }
-};
-
-/*// Commerce version
-
-const files = document.querySelectorAll(".filelink");
-
-if (files.length) {
-
- files.forEach((file) =>
-
- file.setAttribute("download", "Postman_collection.json")
-
- );
-
-}*/
-
const insertWordBreaks = (selector) => {
document.querySelectorAll(selector).forEach((el) => {
- el.innerHTML = el.textContent.replace(/([\/\-=<>:_])/g, "$1");
+ el.innerHTML = el.textContent.replace(/([\/\-=:<>_])/g, "$1");
});
};
insertWordBreaks("code");
-const scrollToLink = () => {
- let myHash = location.hash; //�������� �������� ����
+const addCanonicalUrl = () => {
+ const urlMapping = {
+ "/ru/help/business_solutions/platform-distribution.html":
+ "/ru/help/platform/platform-distribution.html",
+ };
- location.hash = ""; //������� ���
+ const listUrl = [
+ "/ru/haproxy-postgresql.html",
+ "/ru/doc_template.docx",
+ "/ru/platform-distribution.html",
+ "/ru/help/platform/haproxy-postgresql.html",
+ "/ru/help/platform/platform-distribution.html",
+ "/ru/help/ecm/doc_template.docx",
+ ];
- if (myHash[1]) {
- //���������, ���� �� � ���� �����-�� ��������
+ const currentPath = window.location.pathname;
+ const baseUrl = window.location.origin.includes("localhost")
+ ? window.location.origin
+ : "https://elma365.com";
- $("html, body").animate({ scrollTop: $(myHash).offset().top }, 300); //�������� �� ����������
+ if (urlMapping[currentPath]) {
+ setCanonicalUrl(baseUrl + urlMapping[currentPath]);
+ return;
+ }
+
+ if (listUrl.includes(currentPath)) {
+ setCanonicalUrl(baseUrl + currentPath);
}
};
+const setCanonicalUrl = (canonicalUrl) => {
+ const canonicalLink = document.createElement("link");
+ canonicalLink.href = canonicalUrl;
+ canonicalLink.setAttribute("rel", "canonical");
+ document.querySelector("head").appendChild(canonicalLink);
+};
+
+addCanonicalUrl();
+
+const scrollToLink = () => {
+ let myHash = window.location.pathname; //�������� �������� ����
+ if (myHash) {
+ //���������, ���� �� � ���� �����-�� ��������
+ $("html, body").animate({ scrollTop: $(myHash).offset().top }, 100); //�������� �� ����������
+ }
+};
// scrollToLink();
-// function scrollLink() {
-
-// document.addEventListener("DOMContentLoaded", function () {
-
-// const hash = decodeURIComponent(window.location.hash.slice(1)); // убираем '#' и декодим
-
-// if (hash) {
-
-// const target = document.querySelector(`[data-unique="${hash}"]`);
-
-// if (target) {
-
-// target.scrollIntoView({ behavior: "smooth" });
-
-// }
-
-// }
-
-// });
-
-// }
-
-// scrollLink();
+function scrollLink() {
+ document.addEventListener("DOMContentLoaded", function () {
+ const hash = decodeURIComponent(window.location.hash.slice(1)); // убираем '#' и декодим
+ if (hash) {
+ const target = document.querySelector(`[data-unique="${hash}"]`);
+ if (target) {
+ target.scrollIntoView({ behavior: "smooth" });
+ }
+ }
+ });
+}
+scrollLink();
const createVersionNode = (title, className) => {
const articleNode = document.querySelector(".topic__title");
-
const pVersion = document.createElement("p");
-
pVersion.innerText = title;
-
pVersion.classList.add(className);
-
articleNode.append(pVersion);
};
-const {
- href,
-
- pathname,
-} = window.location;
-
+const { href, pathname } = window.location;
let locale = getLocale();
-
const pathnameArr = pathname.split("/");
-
let currentPage = pathnameArr[pathnameArr.length - 1] || null;
//���� �� ��������� ��������, ������ ���������� ������ � �����
-
const changeHeaderLinks = () => {
const host = "elma4.sarl.inner.elma365.com";
-
const path = "/ru/platform/";
-
const headerLinks = document.querySelector(".header__list");
-
const footerList = document.querySelector(".footer-mobile__list");
-
const appendList = ``;
if (window.location.host === host) {
if (window.location.pathname !== path) {
headerLinks.insertAdjacentHTML("beforeend", appendList);
-
footerList.insertAdjacentHTML("beforeend", appendList);
}
}
};
-
//changeHeaderLinks()
// standard example
-
function findExampleContent(node, container, endString) {
if (
node.classList.contains("p_CodeExample") &&
@@ -201,68 +139,48 @@ function findExampleContent(node, container, endString) {
node.firstElementChild.innerText.toLowerCase().includes(endString)
) {
node.remove();
-
return;
}
-
const nextElement = node.nextElementSibling;
-
container.append(node);
-
findExampleContent(nextElement, container, endString);
}
function createNotation(item, notationType, endString) {
const container = document.createElement("div");
-
const exampleTitle = item.nextElementSibling;
-
const nextSibling = exampleTitle.nextElementSibling;
container.classList.add(notationType);
-
exampleTitle.classList.add(notationType + "__title");
-
container.append(exampleTitle);
-
findExampleContent(nextSibling, container, endString);
-
item.after(container);
-
item.remove();
}
function getArticleName(url) {
const arrFromUrl = url.split("/");
-
const lastPath = arrFromUrl[arrFromUrl.length - 1];
-
return lastPath.split(".")[0];
}
function removeCollapsedClass(node, tagName, className) {
const closestNode = node.closest(tagName);
-
if (!closestNode) {
return;
}
-
closestNode.classList.remove(className);
-
removeCollapsedClass(closestNode.parentElement, tagName, className);
}
function loadBottomLinks() {
const toc = document.querySelector("#toc");
-
const bottomLinks = document.querySelectorAll(".bottom-nav__link");
-
if (toc && bottomLinks.length) {
bottomLinks.forEach((link) => {
const path = `a[href="${link.innerText}"]`;
-
const targetLink = toc.querySelector(path);
-
link.innerText = targetLink.innerText;
});
}
@@ -270,32 +188,25 @@ function loadBottomLinks() {
function hideAllSideUls() {
const hidingMenu = document.querySelectorAll("#toc li ul");
-
hidingMenu.forEach((item) => {
item.classList.add("hide-side-menu-item");
-
item.closest("li").classList.add("collapsed");
});
}
function toggleUlsLinksHandler(menu, link) {
menu.forEach((link) => link.classList.remove("active-side-menu"));
-
link.classList.add("active-side-menu");
-
removeCollapsedClass(link, "ul", "hide-side-menu-item");
-
if (
link.nextElementSibling &&
link.nextElementSibling.classList.contains("hide-side-menu-item")
) {
removeCollapsedClass(link, "li", "collapsed");
-
link.nextElementSibling.classList.remove("hide-side-menu-item");
} else {
removeCollapsedClass(link, "li", "collapsed");
}
-
setTimeout(() => {
scrollToSelector(".active-side-menu");
}, 100);
@@ -303,28 +214,19 @@ function toggleUlsLinksHandler(menu, link) {
function scrollToSelector(selector) {
// document.body.style.position = 'fixed';
-
document.querySelector(".sidebar__wrapper").style.position = "fixed";
-
document
-
.querySelector(selector)
-
.scrollIntoView({ behavior: "smooth", block: "center" });
-
document.querySelector(".sidebar__wrapper").style.position = "sticky";
-
// document.body.style.position = 'unset';
}
function toggleUlsHandler() {
const tocNode = document.querySelector("#toc");
-
if (tocNode) {
const linksMenu = tocNode.querySelectorAll("a");
-
const activeItem = getArticleName(window.location.pathname);
-
linksMenu.forEach((link) => {
if (getArticleName(link.pathname) === activeItem) {
toggleUlsLinksHandler(linksMenu, link);
@@ -335,37 +237,29 @@ function toggleUlsHandler() {
function prepareContent() {
const commerceId = document.getElementById("commerce");
-
const communityId = document.getElementById("community");
href.includes("zoom_highlightsub") &&
$("body").addClass("--highlight-disabled");
//Set document title
-
const h1pageTitle = document.querySelector("h1 span.f_Heading1");
-
if (h1pageTitle) {
document.querySelector("title").innerText = h1pageTitle.innerText;
}
-
if (commerceId || communityId) {
commerceId
? (commerceId.style.display = "none")
: (communityId.style.display = "none");
-
commerceId
? createVersionNode("Enterprise", "pCommerce")
: createVersionNode("Community Edition", "pCommunity");
}
-
hideAllSideUls();
-
toggleUlsHandler();
const visibleSideBar = (sidebar) => {
const input = sidebar.querySelector('input[type="checkbox"]');
-
let isVisible = false;
input.addEventListener("change", () => {
@@ -378,55 +272,35 @@ function prepareContent() {
}
});
};
-
//TODO навигация по статье (якори)
-
const toc2 = document.getElementById("toc2");
-
if (toc2) {
const toc2Wrapper = document.querySelector(".article__sidebar");
-
if (!toc2.dataset.tocInitialized) {
$("#toc2").tocify({
context: "section.article__content",
-
selectors: "h2, h3",
-
extendPage: false,
});
-
toc2.dataset.tocInitialized = "true";
}
-
// $("#toc2").tocify({
-
// context: "section.article__content",
-
// selectors: "h2, h3",
-
// extendPage: false,
-
// });
-
const points = toc2.querySelectorAll("a");
-
if (points.length > 0) {
points.forEach((point) => {
if (!point.innerText.trim()) {
point.remove();
}
});
-
toc2Wrapper.style.display = "block";
-
visibleSideBar(toc2Wrapper);
-
// document.querySelector("body").classList.add(".scroll-nav");
-
// setTimeout(() => {
-
// document.querySelector("body").classList.remove(".scroll-nav");
-
// }, 500);
} else {
toc2Wrapper.style.display = "none";
@@ -434,14 +308,12 @@ function prepareContent() {
}
const images = document.querySelectorAll(".p_Normal > img");
-
images.forEach(
(image) =>
image.closest("p") && image.closest("p").classList.add("image-container")
);
const breadcrumbs = document.querySelector(".topic__breadcrumbs");
-
if (breadcrumbs && breadcrumbs.firstElementChild) {
breadcrumbs.firstElementChild.childNodes.forEach((node) => {
if (node.nodeValue && node.nodeValue.includes(">")) {
@@ -450,18 +322,17 @@ function prepareContent() {
});
}
- const spans = document.querySelectorAll("span");
-
- if (spans.length) {
- spans.forEach((span) => {
- if (span.innerHTML === " ") {
- span.remove();
- }
- });
- }
+ // const spans = document.querySelectorAll('span');
+ // if (spans.length) {
+ // spans.forEach(span => {
+ // if (span.innerHTML === ' ') {
+ // span.remove();
+ // console.log(span.innerHTML);
+ // }
+ // });
+ // }
// example exapand
-
const examplesToggle = document.querySelectorAll(
'a[class="dropdown-toggle"]'
);
@@ -476,54 +347,37 @@ function prepareContent() {
example.parentElement.tagName === "p"
? example.parentElement
: example.closest("p");
-
const nextSiblingDiv = parentP.nextElementSibling;
-
if (nextSiblingDiv && nextSiblingDiv.tagName === "DIV") {
parentP.classList.add("example");
-
const id = nextSiblingDiv.id;
-
const button = document.createElement("a");
-
const obj = nextSiblingDiv.attributes;
-
let expandState = "0";
-
parentP.setAttribute("data-state", expandState);
-
button.classList.add("btn-example");
-
button.innerHTML =
locale === "ru"
? 'СвернутьПосмотреть полностью'
: 'HideShow all';
-
button.addEventListener("click", (evt) => {
evt.preventDefault();
-
window.HMToggle("toggle", id);
-
Object.entries(obj).map((el) => {
if (el[1].name === "hm.state") {
expandState = el[1].value;
-
parentP.setAttribute("data-state", expandState);
}
});
});
-
parentP.append(button);
-
example.setAttribute("href", "javascript:void(0)");
-
example.after(nextSiblingDiv);
}
});
}
const pArray = document.querySelectorAll(".p_Normal");
-
if (pArray.length) {
pArray.forEach((p) => {
if (p.innerHTML === " ") {
@@ -533,11 +387,9 @@ function prepareContent() {
}
const examples = document.querySelectorAll("p.p_CodeExample");
-
if (examples.length) {
examples.forEach((example) => {
const childSpan = example.firstElementChild;
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -545,7 +397,6 @@ function prepareContent() {
) {
createNotation(example, "example", "примера");
}
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -553,7 +404,6 @@ function prepareContent() {
) {
createNotation(example, "warning", "внимание");
}
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -565,22 +415,15 @@ function prepareContent() {
}
//small icon
-
const icons = document.querySelectorAll(".content img");
-
if (icons.length) {
icons.forEach((icon, idx) => {
const iconWidth = parseInt(icon.width);
-
const floated = icon.style.float;
-
floated !== "" && icon.classList.add("img-float--" + floated);
-
if (iconWidth < 200) {
icon.classList.add("small-img");
-
const iconHeight = parseInt(icon.height);
-
if (
iconWidth > 70 &&
iconHeight > 70 &&
@@ -593,33 +436,28 @@ function prepareContent() {
});
}
}
-
//TODO скрытие хедера
-
function stickyHeader() {
var lastScrollTop = 0;
-
var delta = 15;
-
$(window)
.on("scroll", function () {
var st = $(this).scrollTop();
-
if (Math.abs(lastScrollTop - st) <= delta) return;
-
if (st > lastScrollTop && lastScrollTop > 0) {
$("body").addClass("--header-hidden");
-
$(".solution-select__list").removeClass("active");
-
$(".solution-select").removeClass("active");
} else {
$("body").removeClass("--header-hidden");
-
$(".solution-select__list").removeClass("active");
-
$(".solution-select").removeClass("active");
}
+ //TEST
+ // if (document.querySelector("body").classList.contains(".scroll-nav")) {
+ // $("body").addClass("--header-hidden");
+ // }
+ //TEST
lastScrollTop = st;
})
@@ -640,35 +478,23 @@ $(window).resize(function () {
function iconsTableOfContents() {
const toggledLi = document.querySelectorAll('li[data-bg*="collapsed"]');
-
toggledLi.forEach((li) => li.classList.add("toggled"));
}
$(document).ready(function () {
prepareContent();
-
toggleUlsHandler();
-
- //TODO вызов хедера
-
+ //TODO вызов скрытия хедера
// stickyHeader();
$("#side-menu").load("index.html #toc", function () {
- //TODO ререндер toc
-
- // window.addEventListener('popstate', () => {
-
- // // $(".article-inner").empty();
-
- // $('#article').load(`${window.location.href} .article-inner`, function () {
-
+ //TODO вызавает каждый раз ререндер при изменении href(добавление якоря как например)
+ // window.addEventListener("popstate", () => {
+ // $("#article").load(`${window.location.href} .article-inner`, function () {
// loadBottomLinks();
-
// prepareContent();
-
// });
-
- // })
+ // });
function onUrlChange(callback) {
const originalPushState = history.pushState;
@@ -731,50 +557,56 @@ $(document).ready(function () {
});
// Дополнительно: обработка void-ссылок
- document.querySelectorAll('a[href^="javascript:"]').forEach((link) => {
- link.addEventListener("click", (e) => {
- e.preventDefault();
- // Можно добавить здесь свою логику обработки клика
- });
- });
+ // document.querySelectorAll('a[href^="javascript:"]').forEach((link) => {
+ // link.addEventListener("click", (e) => {
+ // e.preventDefault();
+ // // Можно добавить здесь свою логику обработки клика
+ // });
+ // });
//
-
loadBottomLinks();
-
hideAllSideUls();
-
toggleUlsHandler();
-
document.addEventListener("DOMContentLoaded", () => {
if (document.visibilityState === "visible") {
hideAllSideUls();
}
});
+ //toc
+ function tryHideSideUlsWhenActive() {
+ if (document.visibilityState === "visible") {
+ hideAllSideUls();
+ } else {
+ document.addEventListener(
+ "visibilitychange",
+ () => {
+ if (document.visibilityState === "visible") {
+ hideAllSideUls();
+ }
+ },
+ { once: true }
+ );
+ }
+ }
+
+ document.addEventListener("DOMContentLoaded", tryHideSideUlsWhenActive);
const menuItems = this.querySelectorAll("a");
-
menuItems.forEach((item) => {
item.addEventListener("click", (evt) => {
evt.preventDefault();
-
const url =
evt.target.nodeName === "A"
? evt.target.href
: evt.target.closest("a").href;
-
const sideMenu = document.querySelector(".sidebar");
-
const htmlTag = document.querySelector("html");
-
const toggledLi = document.querySelectorAll('li[data-bg*="collapsed"]');
window.scrollTo(0, 0);
-
htmlTag.classList.remove("--locked");
-
$("body").removeClass("index-page search-page");
-
sideMenu.classList.remove("show-side-menu");
if (toggledLi.length) {
@@ -786,42 +618,17 @@ $(document).ready(function () {
if (url !== window.location.href) {
if (!url.includes("javascript:void")) {
$(".article-inner").empty();
-
$("#article").load(`${url} .article-inner`, function () {
history.pushState({}, null, url);
-
//metaDecsription.attr('content', metaDescriptionInitial);
-
loadBottomLinks();
-
prepareContent();
});
} else {
- // const _target = evt.target;
-
- // const _targetUl = _target.parentElement.nextElementSibling;
-
- // if (_target.nodeName === "SPAN" && _targetUl.nodeName === "UL" && _targetUl.classList.contains("hide-side-menu-item")) {
-
- // _targetUl.querySelectorAll('a')[0].click();
-
- // } else {
-
- // const _ul = _target.parentElement.querySelectorAll('a')[0].nextElementSibling;
-
- // if (_ul.nodeName === "UL") {
-
- // _ul.querySelectorAll('a')[0].click();
-
- // };
-
- // }
-
+ //TEST
function isFakeLink(link) {
if (!link) return false;
-
const href = link.getAttribute("href");
-
return href === "#" || href === "javascript:void(0);";
}
@@ -831,45 +638,34 @@ $(document).ready(function () {
function findFirstLinkInElement(element) {
if (!element) return null;
-
return element.querySelector("a");
}
function findFirstRealNestedLink(element) {
if (!element) return null;
-
const links = element.querySelectorAll("a");
-
for (const link of links) {
if (isRealLink(link)) return link;
}
-
return null;
}
document.addEventListener("click", (evt) => {
const _target = evt.target;
-
if (_target.nodeName !== "SPAN") return;
const _targetLi = _target.closest("li");
-
if (!_targetLi) return;
const submenu = _targetLi.querySelector("ul");
-
const firstLink = findFirstLinkInElement(_targetLi);
// заглушки
-
if (firstLink && isFakeLink(firstLink)) {
const nestedReal = findFirstRealNestedLink(submenu);
-
if (nestedReal) {
nestedReal.click();
-
// в первом фрагменте, после nestedReal.click();
-
setTimeout(() => {
document.dispatchEvent(new Event("subcategory:update"));
}, 50);
@@ -881,6 +677,7 @@ $(document).ready(function () {
firstLink.click(); // кликаем по нормальной ссылке
}
});
+ //TEST
}
}
});
@@ -890,28 +687,20 @@ $(document).ready(function () {
const obj = pagedata.reduce((acc, words) => {
const searchObj = {
title: words[1],
-
link: words[0],
};
-
return [...acc, searchObj];
}, []);
-
$(".search-form__input").each(function () {
var _that = $(this);
-
var _searchForm = _that.parent();
-
_that
.autocomplete({
autoFocus: false,
-
minLength: 2,
-
focus: function (event, ui) {
itemUiLinkSelected = ui.item.link;
},
-
source: function (request, response) {
const results = obj.filter(
(item) =>
@@ -920,9 +709,7 @@ $(document).ready(function () {
.includes(request.term.toLowerCase()) &&
document.querySelector(`a[href="${item.link.slice(2)}"]`)
);
-
const sliceResults = results.slice(0, 5);
-
sliceResults.map((result) => {
const aItem = document.querySelector(
`a[href="${result.link.slice(2)}"]`
@@ -930,7 +717,6 @@ $(document).ready(function () {
if (aItem) {
const parent = aItem.closest("li.heading1");
-
result.breadcrumb =
parent.querySelector("span.heading1").innerText;
} else {
@@ -949,7 +735,6 @@ $(document).ready(function () {
item.breadcrumb || ""
}`
)
-
.appendTo(ul);
};
@@ -963,15 +748,10 @@ $(document).ready(function () {
$(".glossary-abc__nav a").on("click", function (e) {
e.preventDefault();
-
var target = $(this).attr("href");
-
console.log($(this).parent().siblings());
-
$(".glossary-abc__nav a").removeClass("--active");
-
$(this).addClass("--active");
-
$("html, body").animate(
{
scrollTop: $(target).offset().top - 150,
@@ -980,33 +760,39 @@ $(document).ready(function () {
);
});
- // Хлебные крошки на странице поиска
+ const name = "Сайт ELMA365";
+ const cusLi = document.createElement("li");
+ cusLi.classList.add("heading1");
+ cusLi.classList.add("heading10");
+ const cusA = document.createElement("a");
+ cusA.classList.add("heading1");
+ cusA.setAttribute("href", "https://elma365.com/ru/");
+ cusA.setAttribute("target", "_blank");
+ const cusSpan = document.createElement("span");
+ cusSpan.classList.add("heading1");
+ cusSpan.textContent = name;
+ cusA.appendChild(cusSpan);
+ cusLi.appendChild(cusA);
+ document.querySelector("#toc").prepend(cusLi);
+ // Хлебные крошки на странице поиска
function findPrevBreadcrumbs(node, breadcrumbs) {
var breadcrumbsNew =
breadcrumbs || $('');
-
var prevParentEl = node.closest("ul") ? node.closest("ul").prev() : null;
-
if (!prevParentEl[0] || prevParentEl[0].tagName !== "A") {
return breadcrumbsNew;
}
-
breadcrumbsNew.prepend(' / ');
-
breadcrumbsNew.prepend(prevParentEl.clone());
-
return findPrevBreadcrumbs(prevParentEl, breadcrumbsNew);
}
$(".result_title a").each(function () {
var bc = "";
-
var currentArticleName = $(this);
-
$("#toc a span").each(function () {
var tocCurrentNode = $(this);
-
if (tocCurrentNode.text().trim() === currentArticleName.text().trim()) {
bc = findPrevBreadcrumbs(tocCurrentNode);
}
@@ -1019,56 +805,16 @@ $(document).ready(function () {
});
});
-//let scrollPos = 0;
-
-/* $('body').scroll(function () {
-
- let st = $(this).scrollTop();
-
- if (st > scrollPos) {
-
- $('.scroll-top').hide();
-
- } else {
-
- $('.scroll-top').show();
-
- }
-
- scrollPos = st;
-
-});
-
-
-
-$('.scroll-top').on('click', function (e) {
-
- e.preventDefault();
-
- $('html, body').animate({
-
- scrollTop: 0
-
- });
-
-}); */
-
//side menu mobile
-
const sideMenuIcon = document.querySelector("#side-menu-icon");
-
const htmlTag = document.querySelector("html");
-
const sideMenu = document.querySelector("#sidebar");
-
const closeButton = document.querySelector("#close");
if (sideMenuIcon) {
sideMenuIcon.addEventListener("click", (evt) => {
evt.preventDefault();
-
sideMenu.classList.toggle("show-side-menu");
-
htmlTag.classList.toggle("--locked");
});
}
@@ -1076,15 +822,12 @@ if (sideMenuIcon) {
if (closeButton) {
closeButton.addEventListener("click", (e) => {
e.preventDefault();
-
sideMenu.classList.remove("show-side-menu");
-
htmlTag.classList.remove("--locked");
});
}
var triggerTitleMegaGuide = false;
-
if (getTitleSite() === "Mega Guide" || /hmftsearch.html/i.test(href)) {
triggerTitleMegaGuide = true;
}
@@ -1102,9 +845,6 @@ function getTitleSite() {
const currentUrl = window.location.href;
if (
- /http:\/\/localhost/i.test(currentUrl) ||
- /brix365.t-elma365\/en\/help/i.test(currentUrl) ||
- /brix365.com\/en\/help/i.test(currentUrl) ||
/elma365.com\/ru\/help/i.test(currentUrl) ||
/elma365.com\/en\/help/i.test(currentUrl) ||
/elma365\/help\/ru/i.test(currentUrl) ||
@@ -1114,44 +854,29 @@ if (
) {
window.addEventListener("load", () => {
const searchIcon = document.querySelector("#search-icon");
-
const searchPanel = document.querySelector("#search-panel");
-
const searchInput = searchPanel.querySelector('input[type="text"]');
-
const heroSearch = document.querySelector(".hero__search");
-
if (searchIcon) {
searchIcon.addEventListener("click", (evt) => {
- console.log(searchIcon);
-
evt.preventDefault();
-
searchPanel.classList.toggle("show-search-panel");
-
setTimeout(() => searchInput.focus(), 500);
heroSearch.classList.add("hero__search--active");
});
- } else {
- console.log("error");
}
-
if (searchInput) {
const label = searchInput.closest("label");
-
searchInput.addEventListener("blur", () => {
searchPanel.classList.remove("show-search-panel");
-
heroSearch.classList.remove("hero__search--active");
-
if (searchInput.value) {
label.classList.add("cross");
} else {
label.classList.remove("cross");
}
});
-
searchInput.addEventListener("focus", () => {
label.classList.add("cross");
});
@@ -1167,15 +892,12 @@ if (
$(".arrow-top").click(function () {
$("html, body").animate({ scrollTop: 0 }, 600);
-
return false;
});
// очистить поиск
-
if (document.querySelector("#reset-search")) {
const resetButton = document.querySelector("#reset-search");
-
resetButton.addEventListener("click", () => {
searchInput.value = "";
});
@@ -1190,84 +912,37 @@ if (
wrapperSearch.classList.add("search-form__label");
const tagSpanIcons = document.createElement("span");
-
tagSpanIcons.className = "search__icon";
-
tagSpanIcons.setAttribute("id", "reset-search");
-
wrapperSearch.prepend(tagSpanIcons);
- // const insertInnerHtml = document.querySelector('tr .ya-site-form__search-input-layout-l');
-
- // const divBlockHeroSearch = document.createElement('div');
-
- //
-
- // divBlockHeroSearch.classList.add('hero__search')
-
- // divBlockHeroSearch.innerHTML = `
-
- //
-
- //
-
- //
-
- //
-
- // `;
-
- // setTimeout(() => {
-
- // insertInnerHtml.appendChild(divBlockHeroSearch);
-
- // }, 1000);
-
const searchIcon = document.querySelector("#search-icon");
-
const searchPanel = document.querySelector(
".ya-site-form.ya-site-form_bg_transparent.ya-site-form_inited_yes"
);
-
const searchInput = searchPanel.querySelector('input[type="search"]');
-
const heroSearch = document.querySelector(".hero__search");
-
if (searchIcon) {
searchIcon.addEventListener("click", (evt) => {
- console.log(searchIcon);
-
evt.preventDefault();
-
searchPanel.classList.toggle("show-search-panel");
-
setTimeout(() => searchInput.focus(), 500);
-
heroSearch.classList.add("hero__search--active");
});
}
-
if (searchInput) {
const div = searchInput.closest(".ya-site-form__input");
-
searchInput.addEventListener("blur", searchWatch);
function searchWatch() {
searchPanel.classList.remove("show-search-panel");
-
heroSearch.classList.remove("hero__search--active");
-
if (searchInput.value !== "") {
div.classList.add("cross");
} else {
div.classList.remove("cross");
}
}
-
searchInput.addEventListener("focus", () => {
div.classList.add("cross");
});
@@ -1283,21 +958,15 @@ if (
$(".arrow-top").click(function () {
$("html, body").animate({ scrollTop: 0 }, 600);
-
return false;
});
// очистить поиск
-
const resetButton = document.querySelector("#reset-search");
-
resetButton.addEventListener("click", () => {
searchInput.value = "";
-
searchInput.focus();
-
baseUrl = window.location.href.split("?")[0];
-
window.history.pushState("name", "", baseUrl);
});
});
@@ -1311,29 +980,20 @@ function searchFormHeader() {
$(".search-form").each(function () {
$(this).on("submit", (evt) => {
evt.preventDefault();
-
evt.stopPropagation();
-
var searchStr = evt.target[0].value;
-
if (searchStr.trim()) {
if (
(/elma365.com\/ru\/help/i.test(window.location.href) ||
/elma365.com\/en\/help/i.test(window.location.href) ||
/t-elma365.com/i.test(window.location.href) ||
- /brix365.com\/en\/help/i.test(window.location.href) ||
/([\d+]{3}).(\d).(\d).(\d)/i.test(window.location.href) ||
/http:\/\/localhost/i.test(window.location.href)) &&
!triggerTitleMegaGuide
) {
window.location.href = `./search.html?query=${searchStr}`;
- }
-
- //фикс поиска, тест
- else {
- // window.location.href = `./hmftsearch.html?zoom_query=${searchStr}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
- window.location.href = `./search.html?query=${searchStr}`;
+ } else {
+ window.location.href = `./hmftsearch.html?zoom_query=${searchStr}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
}
}
});
@@ -1347,41 +1007,28 @@ if (
Boolean(document.querySelector(".searchheading"))
) {
const searchTitle = document.querySelector(".searchheading");
-
const queryString = window.location.search;
-
let currentPageNumber = null;
const searchParams = queryString.split("&");
-
searchParams.forEach((param) => {
const paramArr = param.split("=");
-
if (paramArr[0] === "zoom_page") {
currentPageNumber = +paramArr[1];
}
});
-
const searchWord = decodeURI(searchParams[0].split("=")[1]);
-
searchTitle.innerText =
locale === "ru" ? "Результаты поиска:" : "Search results for:";
-
const searchWordP = document.createElement("p");
-
searchWordP.classList.add("search-word");
-
searchWordP.innerText = searchWord;
-
searchTitle.append(searchWordP);
let pagesCount = "0";
-
const resultPagesCount = document.querySelector(".result_pagescount");
-
if (resultPagesCount) {
pagesCount = parseInt(resultPagesCount.innerText.trim());
-
resultPagesCount.remove();
}
@@ -1389,109 +1036,62 @@ if (
switch (currentPage) {
case "first-page": {
resultPages[0].textContent = "<< < ";
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = "1";
-
resultPages[0].after(span);
-
const aEnd = document.createElement("a");
-
const urlEnd = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=${pagesCount}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aEnd.setAttribute("href", urlEnd);
-
aEnd.textContent = " >>";
-
// resultPages[resultPages.length - 1].textContent = ' >>';
-
resultPages[resultPages.length - 1].after(aEnd);
-
resultPages[resultPages.length - 2].remove();
-
resultPages[resultPages.length - 2].textContent = " > ";
-
break;
}
-
case "last-page": {
resultPages[resultPages.length - 1].textContent = ` > >>`;
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = currentPageNumber;
-
const aBegin = document.createElement("a");
-
const urlBegin = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=1&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aBegin.setAttribute("href", urlBegin);
-
aBegin.textContent = "<< ";
-
resultPages[resultPages.length - 1].before(span);
-
// resultPages[0].textContent = '<< ';
-
resultPages[1].before(aBegin);
-
resultPages[0].remove();
-
resultPages[1].textContent = "< ";
-
break;
}
-
case "default-page": {
const aBegin = document.createElement("a");
-
const aEnd = document.createElement("a");
-
const urlBegin = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=1&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
const urlEnd = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=${pagesCount}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aBegin.setAttribute("href", urlBegin);
-
aBegin.textContent = "<< ";
-
aEnd.setAttribute("href", urlEnd);
-
aEnd.textContent = " >>";
-
resultPages[1].before(aBegin);
-
resultPages[0].remove();
-
//resultPages[0].textContent = '<< ';
-
//resultPages[0] = aBegin;
-
resultPages[1].textContent = " < ";
-
resultPages[resultPages.length - 2].textContent = " > ";
-
//resultPages[resultPages.length - 1].textContent = ' >> ';
-
resultPages[resultPages.length - 2].after(aEnd);
-
resultPages[resultPages.length - 1].remove();
-
break;
}
-
default:
break;
}
}
const resultPagesNode = document.querySelector(".result_pages");
-
const resultPages = resultPagesNode
? document.querySelector(".result_pages").childNodes
: [];
@@ -1516,15 +1116,10 @@ if (
resultPages.forEach((node) => {
if (+node.textContent.trim() === currentPageNumber) {
const nextElement = node.nextSibling;
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = currentPageNumber;
-
nextElement.before(span);
-
node.remove();
}
});
@@ -1532,33 +1127,17 @@ if (
}
const summary = document.querySelectorAll(".summary");
-
if (summary.length > 0 && locale === "ru") {
const count = parseInt(summary[0].innerText.trim());
-
summary[0].innerText = count
? `Найдено совпадений: ${count}`
: (summary.innerText = "Совпадений не найдено");
}
}
-// подменяет текст в абзаце в зависимости от атрибута lang
-
-// if (document.documentElement.lang === "en") {
-
-// $('#found_typo').html('Found a typo? Highlight the text, press ctrl + enter and notify us')
-
-// } else if (document.documentElement.lang === "ru") {
-
-// $('#found_typo').html('Нашли опечатку? Выделите текст, нажмите ctrl + enter и оповестите нас')
-
-// }
-
$(window).on("load", () => {
// правит текст в фильтре результатов поиска
-
// $('.b-loader__wrapper').css('opacity', 0);
-
function replace() {
var intervalReplace = setInterval(() => {
if (
@@ -1574,20 +1153,17 @@ $(window).on("load", () => {
setTimeout(() => {
clearInterval(intervalReplace);
-
// }, 180000);
}, 10000);
function t() {
if (document.documentElement.lang === "en") {
textResult("нашёл", "Matches found", "all resourses", 13);
-
textFindSection("Search through ");
}
if (document.documentElement.lang === "ru") {
textResult("нашёл", "Найдено совпадений", "всем ресурсам", 18);
-
textFindSection("Искать по ");
}
@@ -1596,14 +1172,11 @@ $(window).on("load", () => {
searchAny = $(
".b-dropdowna__switcher .b-pseudo-link_is-bem_yes"
).text();
-
var e = text.replace(textFound, textFoundRes),
t = searchAny.replace("любой", textAny);
-
$("tr td.b-head__r .b-head__found").text(
e.substring(0, n) + ": " + parseInt(text.match(/\d+/))
);
-
$(".b-dropdowna__switcher .b-pseudo-link_is-bem_yes").text(t);
if ($("tr td.b-head__r .b-head__found").text().indexOf("найдёт") == 0) {
@@ -1637,11 +1210,8 @@ $(window).on("load", () => {
if (i > 0) {
if (element.childNodes[0].textContent.indexOf("раздел") === 0) {
var htmlTag = [];
-
htmlTag.push(element.childNodes[i]);
-
element.textContent = textResSection;
-
htmlTag.forEach((item) => {
element.appendChild(item);
});
@@ -1666,7 +1236,6 @@ $(window).on("load", () => {
setTimeout(() => {
clearInterval(intervalAddElementSubsection);
-
// }, 180000)
}, 10000);
@@ -1680,71 +1249,48 @@ $(window).on("load", () => {
var textContent = $("yass-li.b-serp-item .b-serp-url__item")[index]
.textContent;
-
switch (true) {
// ELMA365
-
case /elma365.com\/ru\/help/i.test(textContent):
subsectionTitle("Справка");
-
break;
-
case /academy.com/i.test(textContent):
subsectionTitle("ELMA Academy");
-
break;
-
case /tssdk.elma/i.test(textContent):
subsectionTitle("TS SDK");
-
break;
-
case /exchange.elma/i.test(textContent):
subsectionTitle("ELMA365 Exchange");
-
break;
// Английская версия
-
case /en\/help/i.test(textContent):
subsectionTitle("Help");
-
break;
// rpa
-
case /rpa.ai\/ru/i.test(textContent):
subsectionTitle("RPA");
-
break;
// ELMA4
-
case /ru\/help4\/ecm/i.test(textContent):
subsectionTitle("ECM+");
-
break;
-
case /ru\/help4\/crm/i.test(textContent):
subsectionTitle("CRM+");
-
break;
-
case /ru\/help4\/projects/i.test(textContent):
subsectionTitle("Проекты");
-
break;
-
case /elma-bpm.ru\/help4/i.test(textContent):
subsectionTitle("BPM");
-
break;
-
case /ru\/KB/i.test(textContent) ||
/elma-bpm.ru\/…help/i.test(textContent) ||
/help/i.test(textContent):
subsectionTitle("База знаний");
-
break;
}
@@ -1753,11 +1299,8 @@ $(window).on("load", () => {
$(".subsection-title")[index].textContent = text;
} else {
var newBlockDiv = document.createElement("div");
-
newBlockDiv.classList.add("subsection-title");
-
newBlockDiv.textContent = text;
-
$(".b-serp-item__title")[index].prepend(newBlockDiv);
}
}
@@ -1775,20 +1318,16 @@ $(window).on("load", () => {
if ($("tr td.b-head__r .b-head__found")) {
var intervalTimer = setInterval(() => {
replace();
-
addElementSubsection();
}, 200);
// через 3 минуты интервал останавливается (время взято примерно, чтобы успело все прогрузиться)
-
setTimeout(() => {
clearInterval(intervalTimer);
-
// }, 180000);
}, 10000);
} else {
replace();
-
addElementSubsection();
}
});
@@ -1797,41 +1336,25 @@ $(window).on("load", () => {
const leadhandler = "https://web.s-elma365.ru";
var rootNode = document.createElement("div");
-
document.body.appendChild(rootNode);
-
var typo = new TypoReporter(
{
formId: "1FAIpQLSfXEIXAFoOiHgetf0reIjWrOAw6V7KCZrhAv8VVD6WL7Rs46g", // required, see previous step
// Optional example stuff below
-
locale: getLocale(), // optional language, defaults to 'en'
-
// translations: { // optinal object with translated strings
-
// fr: {
-
// // see source code for keys to translate
-
// },
-
// ru: {
-
//
-
// }
-
// },
-
offset: 100, // amount of context text to grab from before and after the selection, defaults to 50
-
endpointUrl: leadhandler + "/api/baglist/", // optional, defaults to Google Forms
-
snippetFieldName: "typo", // optional, if using custom form
-
commentFieldName: "comment", // optional, if using custom form
-
urlFieldName: "url", // optional, if using custom form
},
rootNode
@@ -1839,14 +1362,12 @@ var typo = new TypoReporter(
$(document).on("focus", ".fill_listener", function () {
//console.log("test");
-
$(this).parent().addClass("focused");
});
$(document).on("blur", ".fill_listener", function () {
$(this).parent().removeClass("focused");
});
-
$(document).on("change", ".fill_listener", function () {
if ($(this).val().length) {
$(this).parent().addClass("filled");
@@ -1858,21 +1379,16 @@ $(document).on("change", ".fill_listener", function () {
function feedbackSubmit() {
$("#feedback-form").on("submit", function () {
var $form = $(this);
-
var formData = $form.serializeArray().slice(0, -1);
-
var context = {};
$(formData).each(function (index, obj) {
if (obj.name === "useful" && obj.value === "true") {
context.other = "";
-
context.useful = true;
-
context.category = [
{
code: "",
-
name: "",
},
];
@@ -1883,14 +1399,11 @@ function feedbackSubmit() {
if (obj.name === "other") {
context.other = obj.value;
}
-
context.useful = false;
-
if (obj.name === "category") {
context.category = [
{
code: obj.value,
-
name: $form.find('option[value="' + obj.value + '"]').text(),
},
];
@@ -1900,18 +1413,13 @@ function feedbackSubmit() {
});
context.produkt = ["6b55aead-f008-42c7-9186-0806c06d4f2c"];
-
context.link = window.location.href;
-
var data = {
context,
};
-
var request = $.ajax({
type: "POST",
-
url: leadhandler + "/api/feedback/create",
-
data: JSON.stringify(data),
})
.fail(function (response) {
@@ -1920,7 +1428,6 @@ function feedbackSubmit() {
.done(function (response) {
return response;
});
-
return false;
});
}
@@ -1936,32 +1443,23 @@ $(document).ready(function () {
var $form = $(this),
textarea = $form.find('textarea[name="help_question"]'),
//formData = $form.serializeArray().slice(0, -1),
-
context = {};
context.other = textarea.val();
-
context.category = [
{
code: "question",
-
name: "Задать вопрос",
},
];
-
context.produkt = ["6b55aead-f008-42c7-9186-0806c06d4f2c"];
-
context.link = window.location.href;
-
var data = {
context,
};
-
var request = $.ajax({
type: "POST",
-
url: leadhandler + "/api/feedback/create",
-
data: JSON.stringify(data),
})
.fail(function (response) {
@@ -1972,23 +1470,18 @@ $(document).ready(function () {
.parent()
.find(".question-success")
.removeClass("hidden");
-
setTimeout(() => {
$(".question-xs").attr("style", "display:none;");
-
textarea.val("");
});
-
setTimeout(() => {
$(".question__popup")
.parent()
.find(".question-success")
.addClass("hidden");
-
$(".question").removeClass("active");
}, 3000);
});
-
return false;
});
});
@@ -1998,7 +1491,6 @@ function question() {
const questionPopup = $(this).parent().find(".question-xs");
questionPopup.attr("style", "display:block;");
-
setTimeout(() => {
$(this).parent().find('textarea[name="help_question"]').focus();
}, 200);
@@ -2006,7 +1498,6 @@ function question() {
$(document).mouseup(function (e) {
let container = $(".question-xs");
-
if (!container.is(e.target) && container.has(e.target).length === 0) {
container.attr("style", "display:none;");
}
@@ -2018,12 +1509,9 @@ function question() {
$(".question-xs").on("submit", function () {
$(this).parent().find(".question-success-xs").removeClass("hidden");
-
$(this).removeClass("active");
-
setTimeout(() => {
$(this).parent().find(".question-success-xs").addClass("hidden");
-
$(this).addClass("active");
}, 3000);
});
@@ -2033,28 +1521,23 @@ question();
$(document).click(function (e) {
if ($(e.target).closest(".ReportTypo-popup").length != 0) return false;
-
$(".ReportTypo").fadeOut(100);
});
$(document).click(function (e) {
if ($(e.target).closest(".ReportTypo-popup").length != 0) return false;
-
$(".ReportTypo").fadeOut(100);
});
jQuery(function ($) {
$(document).mouseup(function (e) {
// ������� ����� �� ���-���������
-
var div = $("#feedback-form"); // ��� ��������� ID ��������
-
if (
!div.is(e.target) && // ���� ���� ��� �� �� ������ �����
div.has(e.target).length === 0
) {
// � �� �� ��� �������� ���������
-
$(".feedback-form").find("input:checked").removeAttr("checked");
}
});
@@ -2062,25 +1545,17 @@ jQuery(function ($) {
function feedback() {
const yesLabel = document.getElementById("feedback__useful_yes");
-
const thxWindow = document.getElementById("feedback__popup_thx");
-
const noLabel = document.getElementById("feedback__useful_no");
-
const feedbackWhyPopup = document.getElementById("feedback__popup_why");
-
const form = document.getElementById("feedback-form");
-
const otherInput = document.getElementById("other_reason");
-
const otherPopup = document.getElementById("feedback__popup-other");
-
const feedbackOtherBtn = document.querySelector(".feedback__other-btn");
const inputs = [
...document.querySelectorAll('#feedback__popup_why input[type="radio"]'),
];
-
const allRadio = inputs.filter((item) => item.id !== "other_reason");
allRadio.forEach((item) =>
@@ -2099,16 +1574,12 @@ function feedback() {
otherInput.addEventListener("change", (e) => {
if (e.target.checked) {
feedbackWhyPopup.style.display = "none";
-
otherPopup.style.display = "block";
-
$(".feedback__popup").find('textarea[name="other"]').focus();
feedbackOtherBtn.addEventListener("click", function () {
otherPopup.style.display = "none";
-
$("#feedback-success-popup").show();
-
setTimeout(() => {
$("#feedback-success-popup").hide();
}, 3000);
@@ -2122,9 +1593,7 @@ function feedback() {
if (Boolean(feedbackWhyPopup)) {
document.addEventListener("click", (e) => {
const target = e.target;
-
feedbackWhyPopup.style.display = "none";
-
thxWindow.style.display = "none";
if (target.matches("#feedback__useful_no")) {
@@ -2160,7 +1629,6 @@ $(window).on("load", function () {
document.querySelectorAll("main article section div")[1]
) {
let el = document.querySelectorAll("main article section div")[1];
-
el.setAttribute("id", "table-mobile-desktop_size");
}
});
@@ -2178,7 +1646,6 @@ if (document.querySelector("#side-menu")) {
document.querySelectorAll("main article section div")[1]
) {
let el = document.querySelectorAll("main article section div")[1];
-
el.setAttribute("id", "table-mobile-desktop_size");
}
}, 200);
@@ -2194,52 +1661,39 @@ if (document.querySelector("#side-menu")) {
if (document.getElementsByClassName("accordion-btn__show")) {
var showAccordionBtn = document.querySelector(".accordion-btn__show");
-
var elementAccordionHide = document.querySelector(".accordion__hide");
-
var linearGradient = document.querySelector(".linear-gradient");
-
var heightAccordionElem =
document.querySelector(".card-stack-50").scrollHeight;
var t = false;
-
showAccordionBtn.addEventListener("click", () => {
switch (true) {
case showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.contains("arrow__show"):
elementAccordionHide.classList.add("accordion__show");
-
elementAccordionHide.style.maxHeight = heightAccordionElem + "px";
-
elementAccordionHide.classList.remove("accordion__hide");
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.remove("arrow__show");
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.add("arrow__hide");
setTimeout(() => {
linearGradient.classList.remove("linear-gradient");
-
showAccordionBtn.querySelector("p").textContent = "Свернуть";
}, 1000);
-
break;
case showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.contains("arrow__hide"):
elementAccordionHide.classList.add("accordion__hide");
-
elementAccordionHide.classList.remove("accordion__show");
-
elementAccordionHide.style.maxHeight = "";
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.add("arrow__show");
@@ -2248,12 +1702,9 @@ if (document.getElementsByClassName("accordion-btn__show")) {
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.remove("arrow__hide");
-
linearGradient.classList.add("linear-gradient");
-
showAccordionBtn.querySelector("p").textContent = "Показать всё";
}, 1000);
-
break;
}
});
@@ -2266,7 +1717,6 @@ if (document.getElementsByClassName("accordion-btn__show")) {
(function () {
if (document.querySelector(".accordion__items")) {
var btn = document.querySelectorAll(".accordion__item-question");
-
var dehiscentItems = document.querySelectorAll(
".accordion__item-question-answer"
);
@@ -2279,11 +1729,8 @@ if (document.getElementsByClassName("accordion-btn__show")) {
removeActiveClass();
} else {
removeActiveClass();
-
this.classList.toggle("accordion__active");
-
nextEl.style.maxHeight = nextEl.scrollHeight + "px";
-
nextEl.style.marginBottom = "15px";
}
});
@@ -2296,7 +1743,6 @@ if (document.getElementsByClassName("accordion-btn__show")) {
dehiscentItems.forEach((i) => {
i.style.maxHeight = null;
-
i.style.marginBottom = null;
});
}
diff --git a/platform/jquery.tocify.min.js b/platform/jquery.tocify.min.js
index 55f8a9d..5051d08 100644
--- a/platform/jquery.tocify.min.js
+++ b/platform/jquery.tocify.min.js
@@ -1,5 +1,4 @@
-/*! jquery.tocify - v1.9.0 - 2013-10-01
-* http://gregfranko.com/jquery.tocify.js/
-* Copyright (c) 2013 Greg Franko; Licensed MIT*/
-
-!function(){"use strict";!function(r,d,c){"use strict";var o="tocify",e="tocify-focus",t="tocify-hover",n="tocify-hide",a="tocify-header",i="."+a,l="tocify-subheader",h="."+l,f="tocify-item",u="."+f,p="tocify-extend-page",g="."+p;r.widget("toc.tocify",{version:"1.9.0",options:{context:"body",ignoreSelector:null,selectors:"h1, h2, h3",showAndHide:!0,showEffect:"slideDown",showEffectSpeed:"medium",hideEffect:"slideUp",hideEffectSpeed:"medium",smoothScroll:!0,smoothScrollSpeed:"medium",scrollTo:0,showAndHideOnScroll:!0,highlightOnScroll:!0,highlightOffset:40,theme:"bootstrap",extendPage:!0,extendPageOffset:100,history:!0,scrollHistory:!1,hashGenerator:"compact",highlightDefault:!0},_create:function(){var e=this;e.extendPageScroll=!0,e.items=[],e._generateToc(),e._addCSSClasses(),e.webkit=function(){for(var e in d)if(e&&-1!==e.toLowerCase().indexOf("webkit"))return!0;return!1}(),e._setEventHandlers(),r(d).load(function(){e._setActiveElement(!0),r("html, body").promise().done(function(){setTimeout(function(){e.extendPageScroll=!1},0)})})},_generateToc:function(){var e,t,s=this,i=s.options.ignoreSelector;return e=-1!==this.options.selectors.indexOf(",")?r(this.options.context).find(this.options.selectors.replace(/ /g,"").substr(0,this.options.selectors.indexOf(","))):r(this.options.context).find(this.options.selectors.replace(/ /g,"")),e.length?(s.element.addClass(o),e.each(function(e){r(this).is(i)||(t=r("",{id:a+e,class:a}).append(s._nestElements(r(this),e)),s.element.append(t),r(this).nextUntil(this.nodeName.toLowerCase()).each(function(){0===r(this).find(s.options.selectors).length?r(this).filter(s.options.selectors).each(function(){r(this).is(i)||s._appendSubheaders.call(this,s,t)}):r(this).find(s.options.selectors).each(function(){r(this).is(i)||s._appendSubheaders.call(this,s,t)})}))}),undefined):(s.element.addClass(n),undefined)},_setActiveElement:function(e){var t=this,s=d.location.hash.substring(1),i=t.element.find('li[data-unique="'+s+'"]');return s.length?(t.element.find("."+t.focusClass).removeClass(t.focusClass),i.addClass(t.focusClass),t.options.showAndHide&&i.click()):(t.element.find("."+t.focusClass).removeClass(t.focusClass),!s.length&&e&&t.options.highlightDefault&&t.element.find(u).first().addClass(t.focusClass)),t},_nestElements:function(t,e){var s,i,o;return s=r.grep(this.items,function(e){return e===t.text()}),s.length?this.items.push(t.text()+e):this.items.push(t.text()),o=this._generateHashValue(s,t,e),i=r("",{class:f,"data-unique":o}).append(r("",{text:t.text()})),t.before(r("",{name:o,"data-unique":o})),i},_generateHashValue:function(e,t,s){var i="",o=this.options.hashGenerator;if("pretty"===o){for(i=t.text().toLowerCase().replace(/\s/g,"-");i.indexOf("--")>-1;)i=i.replace(/--/g,"-");for(;i.indexOf(":-")>-1;)i=i.replace(/:-/g,"-")}else i="function"==typeof o?o(t.text(),t):t.text().replace(/\s/g,"");return e.length&&(i+=""+s),i},_appendSubheaders:function(e,t){var s=r(this).index(e.options.selectors),i=r(e.options.selectors).eq(s-1),o=+r(this).prop("tagName").charAt(1),n=+i.prop("tagName").charAt(1);n>o?e.element.find(h+"[data-tag="+o+"]").last().append(e._nestElements(r(this),s)):o===n?t.find(u).last().after(e._nestElements(r(this),s)):t.find(u).last().after(r("",{class:l,"data-tag":o})).next(h).append(e._nestElements(r(this),s))},_setEventHandlers:function(){var h=this;this.element.on("click.tocify","li",function(){if(h.options.history&&(d.location.hash=r(this).attr("data-unique")),h.element.find("."+h.focusClass).removeClass(h.focusClass),r(this).addClass(h.focusClass),h.options.showAndHide){var e=r('li[data-unique="'+r(this).attr("data-unique")+'"]');h._triggerShow(e)}h._scrollTo(r(this))}),this.element.find("li").on({"mouseenter.tocify":function(){r(this).addClass(h.hoverClass),r(this).css("cursor","pointer")},"mouseleave.tocify":function(){"bootstrap"!==h.options.theme&&r(this).removeClass(h.hoverClass)}}),(h.options.extendPage||h.options.highlightOnScroll||h.options.scrollHistory||h.options.showAndHideOnScroll)&&r(d).on("scroll.tocify",function(){r("html, body").promise().done(function(){var o,e,t,s,n=r(d).scrollTop(),i=r(d).height(),a=r(c).height(),l=r("body")[0].scrollHeight;if(h.options.extendPage&&(h.webkit&&n>=l-i-h.options.extendPageOffset||!h.webkit&&i+n>a-h.options.extendPageOffset)&&!r(g).length){if(e=r('div[data-unique="'+r(u).last().attr("data-unique")+'"]'),!e.length)return;t=e.offset().top,r(h.options.context).append(r("",{class:p,height:Math.abs(t-n)+"px","data-unique":p})),h.extendPageScroll&&(s=h.element.find("li.active"),h._scrollTo(r('div[data-unique="'+s.attr("data-unique")+'"]')))}setTimeout(function(){var e,s=null,i=null,t=r(h.options.context).find("div[data-unique]");t.each(function(e){var t=Math.abs((r(this).next().length?r(this).next():r(this)).offset().top-n-h.options.highlightOffset);return null==s||s>t?(s=t,i=e,undefined):!1}),e=r(t[i]).attr("data-unique"),o=r('li[data-unique="'+e+'"]'),h.options.highlightOnScroll&&o.length&&(h.element.find("."+h.focusClass).removeClass(h.focusClass),o.addClass(h.focusClass)),h.options.scrollHistory&&d.location.hash!=="#"+e&&d.location.replace("#"+e),h.options.showAndHideOnScroll&&h.options.showAndHide&&h._triggerShow(o,!0)},0)})})},show:function(e){var t=this;if(!e.is(":visible"))switch(e.find(h).length||e.parent().is(i)||e.parent().is(":visible")?e.children(h).length||e.parent().is(i)||(e=e.closest(h)):e=e.parents(h).add(e),t.options.showEffect){case"none":e.show();break;case"show":e.show(t.options.showEffectSpeed);break;case"slideDown":e.slideDown(t.options.showEffectSpeed);break;case"fadeIn":e.fadeIn(t.options.showEffectSpeed);break;default:e.show()}return e.parent().is(i)?t.hide(r(h).not(e)):t.hide(r(h).not(e.closest(i).find(h).not(e.siblings()))),t},hide:function(e){var t=this;switch(t.options.hideEffect){case"none":e.hide();break;case"hide":e.hide(t.options.hideEffectSpeed);break;case"slideUp":e.slideUp(t.options.hideEffectSpeed);break;case"fadeOut":e.fadeOut(t.options.hideEffectSpeed);break;default:e.hide()}return t},_triggerShow:function(e,t){var s=this;return e.parent().is(i)||e.next().is(h)?s.show(e.next(h),t):e.parent().is(h)&&s.show(e.parent(),t),s},_addCSSClasses:function(){return"jqueryui"===this.options.theme?(this.focusClass="ui-state-default",this.hoverClass="ui-state-hover",this.element.addClass("ui-widget").find(".toc-title").addClass("ui-widget-header").end().find("li").addClass("ui-widget-content")):"bootstrap"===this.options.theme?(this.element.find(i+","+h).addClass("nav nav-list"),this.focusClass="active"):(this.focusClass=e,this.hoverClass=t),this},setOption:function(){r.Widget.prototype._setOption.apply(this,arguments)},setOptions:function(){r.Widget.prototype._setOptions.apply(this,arguments)},_scrollTo:function(e){var t=document.querySelector('div[data-unique="'+e.attr("data-unique")+'"]');if(t)t.scrollIntoView({behavior:this.options.smoothScroll?"smooth":"auto",block:"start"});return this}})}(window.jQuery,window,document)}();
\ No newline at end of file
+/*! jquery.tocify - v1.9.0 - 2013-10-01
+ * http://gregfranko.com/jquery.tocify.js/
+ * Copyright (c) 2013 Greg Franko; Licensed MIT*/
+!function(){"use strict";var a,l,h,o,s,n,r,i,d,c;a=window.jQuery,l=window,h=document,s="."+(o="tocify-header"),r="."+(n="tocify-subheader"),d="."+(i="tocify-item"),c="tocify-extend-page",a.widget("toc.tocify",{version:"1.9.0",options:{context:"body",ignoreSelector:null,selectors:"h1, h2, h3",showAndHide:!0,showEffect:"slideDown",showEffectSpeed:"medium",hideEffect:"slideUp",hideEffectSpeed:"medium",smoothScroll:!0,smoothScrollSpeed:"medium",scrollTo:0,showAndHideOnScroll:!0,highlightOnScroll:!0,highlightOffset:40,theme:"bootstrap",extendPage:!0,extendPageOffset:100,history:!0,scrollHistory:!1,hashGenerator:"compact",highlightDefault:!0},_create:function(){var e=this;e.extendPageScroll=!0,e.items=[],e._generateToc(),e._addCSSClasses(),e.webkit=function(){for(var e in l)if(e&&-1!==e.toLowerCase().indexOf("webkit"))return!0;return!1}(),e._setEventHandlers(),a(l).load(function(){e._setActiveElement(!0),a("html, body").promise().done(function(){setTimeout(function(){e.extendPageScroll=!1},0)})})},_generateToc:function(){var t,s=this,i=s.options.ignoreSelector,e=-1!==this.options.selectors.indexOf(",")?a(this.options.context).find(this.options.selectors.replace(/ /g,"").substr(0,this.options.selectors.indexOf(","))):a(this.options.context).find(this.options.selectors.replace(/ /g,""));return e.length?(s.element.addClass("tocify"),void e.each(function(e){a(this).is(i)||(t=a("",{id:o+e,class:o}).append(s._nestElements(a(this),e)),s.element.append(t),a(this).nextUntil(this.nodeName.toLowerCase()).each(function(){(0===a(this).find(s.options.selectors).length?a(this).filter(s.options.selectors):a(this).find(s.options.selectors)).each(function(){a(this).is(i)||s._appendSubheaders.call(this,s,t)})}))})):void s.element.addClass("tocify-hide")},_setActiveElement:function(e){var t=this,s=l.location.hash.substring(1),i=t.element.find('li[data-unique="'+s+'"]');return s.length?(t.element.find("."+t.focusClass).removeClass(t.focusClass),i.addClass(t.focusClass),t.options.showAndHide&&i.click()):(t.element.find("."+t.focusClass).removeClass(t.focusClass),!s.length&&e&&t.options.highlightDefault&&t.element.find(d).first().addClass(t.focusClass)),t},_nestElements:function(t,e){var s=a.grep(this.items,function(e){return e===t.text()});return s.length?this.items.push(t.text()+e):this.items.push(t.text()),s=this._generateHashValue(s,t,e),e=a("",{class:i,"data-unique":s}).append(a("",{text:t.text()})),t.before(a("",{name:s,"data-unique":s})),e},_generateHashValue:function(e,t,s){var i="",o=this.options.hashGenerator;if("pretty"===o){for(i=t.text().toLowerCase().replace(/\s/g,"-");-1",{class:n,"data-tag":o})).next(r).append(e._nestElements(a(this),s))},_setEventHandlers:function(){var n=this;this.element.on("click.tocify","li",function(){var e;n.options.history&&(l.location.hash=a(this).attr("data-unique")),n.element.find("."+n.focusClass).removeClass(n.focusClass),a(this).addClass(n.focusClass),n.options.showAndHide&&(e=a('li[data-unique="'+a(this).attr("data-unique")+'"]'),n._triggerShow(e)),n._scrollTo(a(this))}),this.element.find("li").on({"mouseenter.tocify":function(){a(this).addClass(n.hoverClass),a(this).css("cursor","pointer")},"mouseleave.tocify":function(){"bootstrap"!==n.options.theme&&a(this).removeClass(n.hoverClass)}}),(n.options.extendPage||n.options.highlightOnScroll||n.options.scrollHistory||n.options.showAndHideOnScroll)&&a(l).on("scroll.tocify",function(){a("html, body").promise().done(function(){var t,o=a(l).scrollTop(),e=a(l).height(),s=a(h).height(),i=a("body")[0].scrollHeight;if(n.options.extendPage&&(n.webkit&&o>=i-e-n.options.extendPageOffset||!n.webkit&&e+o>s-n.options.extendPageOffset)&&!a(".tocify-extend-page").length){if(!(i=a('div[data-unique="'+a(d).last().attr("data-unique")+'"]')).length)return;e=i.offset().top,a(n.options.context).append(a("",{class:c,height:Math.abs(e-o)+"px","data-unique":c})),n.extendPageScroll&&(s=n.element.find("li.active"),n._scrollTo(a('div[data-unique="'+s.attr("data-unique")+'"]')))}setTimeout(function(){var s=null,i=null,e=a(n.options.context).find("div[data-unique]");e.each(function(e){var t=Math.abs((a(this).next().length?a(this).next():a(this)).offset().top-o-n.options.highlightOffset);return(null==s||t {
const lan = document.documentElement.lang;
-
return lan ? document.documentElement.lang : "ru";
};
@@ -13,186 +12,125 @@ function getProduct() {
case "elma-rpa.ai":
product = {
name: "rpa",
-
id: "33678c11-fea6-4adb-aa39-adc4e8295b53",
};
-
break;
-
case "www.elma-bpm.ru":
product = {
name: "elma3/4",
-
id: "44b97702-146c-414b-9db7-0b09705556ed",
};
-
break;
-
default:
product = {
name: "elma365",
-
id: "3354c78a-720e-4584-a9c6-83f0f1396d22",
};
-
break;
}
-
return product;
}
-document
- .querySelector(".solution-select")
- .addEventListener("mouseenter", function () {
- this.classList.add("active");
-
- document.querySelector(".solution-select__list").classList.add("active");
- });
-
-document
- .querySelector(".solution-select__list")
- .addEventListener("mouseleave", function () {
- this.classList.remove("active");
-
- document.querySelector(".solution-select").classList.remove("active");
- });
-
-const titleName = () => {
- let textSpanTitle = document.querySelector(".solution-select__selected");
-
- let currentPlace = window.location.pathname
- .replace("/en/help/", "")
- .split("/")[0];
-
- textSpanTitle.textContent =
- currentPlace.charAt(0).toUpperCase() + currentPlace.slice(1);
-
- if (currentPlace === "crm" || "ecm") {
- textSpanTitle.textContent = currentPlace.toUpperCase();
- }
-
- if (currentPlace === "business_solutions") {
- let business = currentPlace.replace("_", " ");
-
- textSpanTitle.textContent =
- business.charAt(0).toUpperCase() +
- business.slice(1, 8) +
- " " +
- business.charAt(9).toUpperCase() +
- business.slice(10);
- }
-};
-
-/*// Commerce version
-
-const files = document.querySelectorAll(".filelink");
-
-if (files.length) {
-
- files.forEach((file) =>
-
- file.setAttribute("download", "Postman_collection.json")
-
- );
-
-}*/
-
const insertWordBreaks = (selector) => {
document.querySelectorAll(selector).forEach((el) => {
- el.innerHTML = el.textContent.replace(/([\/\-=<>:_])/g, "$1");
+ el.innerHTML = el.textContent.replace(/([\/\-=:<>_])/g, "$1");
});
};
insertWordBreaks("code");
-const scrollToLink = () => {
- let myHash = location.hash; //�������� �������� ����
+const addCanonicalUrl = () => {
+ const urlMapping = {
+ "/ru/help/business_solutions/platform-distribution.html":
+ "/ru/help/platform/platform-distribution.html",
+ };
- location.hash = ""; //������� ���
+ const listUrl = [
+ "/ru/haproxy-postgresql.html",
+ "/ru/doc_template.docx",
+ "/ru/platform-distribution.html",
+ "/ru/help/platform/haproxy-postgresql.html",
+ "/ru/help/platform/platform-distribution.html",
+ "/ru/help/ecm/doc_template.docx",
+ ];
- if (myHash[1]) {
- //���������, ���� �� � ���� �����-�� ��������
+ const currentPath = window.location.pathname;
+ const baseUrl = window.location.origin.includes("localhost")
+ ? window.location.origin
+ : "https://elma365.com";
- $("html, body").animate({ scrollTop: $(myHash).offset().top }, 300); //�������� �� ����������
+ if (urlMapping[currentPath]) {
+ setCanonicalUrl(baseUrl + urlMapping[currentPath]);
+ return;
+ }
+
+ if (listUrl.includes(currentPath)) {
+ setCanonicalUrl(baseUrl + currentPath);
}
};
+const setCanonicalUrl = (canonicalUrl) => {
+ const canonicalLink = document.createElement("link");
+ canonicalLink.href = canonicalUrl;
+ canonicalLink.setAttribute("rel", "canonical");
+ document.querySelector("head").appendChild(canonicalLink);
+};
+
+addCanonicalUrl();
+
+const scrollToLink = () => {
+ let myHash = window.location.pathname; //�������� �������� ����
+ if (myHash) {
+ //���������, ���� �� � ���� �����-�� ��������
+ $("html, body").animate({ scrollTop: $(myHash).offset().top }, 100); //�������� �� ����������
+ }
+};
// scrollToLink();
-// function scrollLink() {
-
-// document.addEventListener("DOMContentLoaded", function () {
-
-// const hash = decodeURIComponent(window.location.hash.slice(1)); // убираем '#' и декодим
-
-// if (hash) {
-
-// const target = document.querySelector(`[data-unique="${hash}"]`);
-
-// if (target) {
-
-// target.scrollIntoView({ behavior: "smooth" });
-
-// }
-
-// }
-
-// });
-
-// }
-
-// scrollLink();
+function scrollLink() {
+ document.addEventListener("DOMContentLoaded", function () {
+ const hash = decodeURIComponent(window.location.hash.slice(1)); // убираем '#' и декодим
+ if (hash) {
+ const target = document.querySelector(`[data-unique="${hash}"]`);
+ if (target) {
+ target.scrollIntoView({ behavior: "smooth" });
+ }
+ }
+ });
+}
+scrollLink();
const createVersionNode = (title, className) => {
const articleNode = document.querySelector(".topic__title");
-
const pVersion = document.createElement("p");
-
pVersion.innerText = title;
-
pVersion.classList.add(className);
-
articleNode.append(pVersion);
};
-const {
- href,
-
- pathname,
-} = window.location;
-
+const { href, pathname } = window.location;
let locale = getLocale();
-
const pathnameArr = pathname.split("/");
-
let currentPage = pathnameArr[pathnameArr.length - 1] || null;
//���� �� ��������� ��������, ������ ���������� ������ � �����
-
const changeHeaderLinks = () => {
const host = "elma4.sarl.inner.elma365.com";
-
const path = "/ru/platform/";
-
const headerLinks = document.querySelector(".header__list");
-
const footerList = document.querySelector(".footer-mobile__list");
-
const appendList = ``;
if (window.location.host === host) {
if (window.location.pathname !== path) {
headerLinks.insertAdjacentHTML("beforeend", appendList);
-
footerList.insertAdjacentHTML("beforeend", appendList);
}
}
};
-
//changeHeaderLinks()
// standard example
-
function findExampleContent(node, container, endString) {
if (
node.classList.contains("p_CodeExample") &&
@@ -201,68 +139,48 @@ function findExampleContent(node, container, endString) {
node.firstElementChild.innerText.toLowerCase().includes(endString)
) {
node.remove();
-
return;
}
-
const nextElement = node.nextElementSibling;
-
container.append(node);
-
findExampleContent(nextElement, container, endString);
}
function createNotation(item, notationType, endString) {
const container = document.createElement("div");
-
const exampleTitle = item.nextElementSibling;
-
const nextSibling = exampleTitle.nextElementSibling;
container.classList.add(notationType);
-
exampleTitle.classList.add(notationType + "__title");
-
container.append(exampleTitle);
-
findExampleContent(nextSibling, container, endString);
-
item.after(container);
-
item.remove();
}
function getArticleName(url) {
const arrFromUrl = url.split("/");
-
const lastPath = arrFromUrl[arrFromUrl.length - 1];
-
return lastPath.split(".")[0];
}
function removeCollapsedClass(node, tagName, className) {
const closestNode = node.closest(tagName);
-
if (!closestNode) {
return;
}
-
closestNode.classList.remove(className);
-
removeCollapsedClass(closestNode.parentElement, tagName, className);
}
function loadBottomLinks() {
const toc = document.querySelector("#toc");
-
const bottomLinks = document.querySelectorAll(".bottom-nav__link");
-
if (toc && bottomLinks.length) {
bottomLinks.forEach((link) => {
const path = `a[href="${link.innerText}"]`;
-
const targetLink = toc.querySelector(path);
-
link.innerText = targetLink.innerText;
});
}
@@ -270,32 +188,25 @@ function loadBottomLinks() {
function hideAllSideUls() {
const hidingMenu = document.querySelectorAll("#toc li ul");
-
hidingMenu.forEach((item) => {
item.classList.add("hide-side-menu-item");
-
item.closest("li").classList.add("collapsed");
});
}
function toggleUlsLinksHandler(menu, link) {
menu.forEach((link) => link.classList.remove("active-side-menu"));
-
link.classList.add("active-side-menu");
-
removeCollapsedClass(link, "ul", "hide-side-menu-item");
-
if (
link.nextElementSibling &&
link.nextElementSibling.classList.contains("hide-side-menu-item")
) {
removeCollapsedClass(link, "li", "collapsed");
-
link.nextElementSibling.classList.remove("hide-side-menu-item");
} else {
removeCollapsedClass(link, "li", "collapsed");
}
-
setTimeout(() => {
scrollToSelector(".active-side-menu");
}, 100);
@@ -303,28 +214,19 @@ function toggleUlsLinksHandler(menu, link) {
function scrollToSelector(selector) {
// document.body.style.position = 'fixed';
-
document.querySelector(".sidebar__wrapper").style.position = "fixed";
-
document
-
.querySelector(selector)
-
.scrollIntoView({ behavior: "smooth", block: "center" });
-
document.querySelector(".sidebar__wrapper").style.position = "sticky";
-
// document.body.style.position = 'unset';
}
function toggleUlsHandler() {
const tocNode = document.querySelector("#toc");
-
if (tocNode) {
const linksMenu = tocNode.querySelectorAll("a");
-
const activeItem = getArticleName(window.location.pathname);
-
linksMenu.forEach((link) => {
if (getArticleName(link.pathname) === activeItem) {
toggleUlsLinksHandler(linksMenu, link);
@@ -335,37 +237,29 @@ function toggleUlsHandler() {
function prepareContent() {
const commerceId = document.getElementById("commerce");
-
const communityId = document.getElementById("community");
href.includes("zoom_highlightsub") &&
$("body").addClass("--highlight-disabled");
//Set document title
-
const h1pageTitle = document.querySelector("h1 span.f_Heading1");
-
if (h1pageTitle) {
document.querySelector("title").innerText = h1pageTitle.innerText;
}
-
if (commerceId || communityId) {
commerceId
? (commerceId.style.display = "none")
: (communityId.style.display = "none");
-
commerceId
? createVersionNode("Enterprise", "pCommerce")
: createVersionNode("Community Edition", "pCommunity");
}
-
hideAllSideUls();
-
toggleUlsHandler();
const visibleSideBar = (sidebar) => {
const input = sidebar.querySelector('input[type="checkbox"]');
-
let isVisible = false;
input.addEventListener("change", () => {
@@ -378,55 +272,35 @@ function prepareContent() {
}
});
};
-
//TODO навигация по статье (якори)
-
const toc2 = document.getElementById("toc2");
-
if (toc2) {
const toc2Wrapper = document.querySelector(".article__sidebar");
-
if (!toc2.dataset.tocInitialized) {
$("#toc2").tocify({
context: "section.article__content",
-
selectors: "h2, h3",
-
extendPage: false,
});
-
toc2.dataset.tocInitialized = "true";
}
-
// $("#toc2").tocify({
-
// context: "section.article__content",
-
// selectors: "h2, h3",
-
// extendPage: false,
-
// });
-
const points = toc2.querySelectorAll("a");
-
if (points.length > 0) {
points.forEach((point) => {
if (!point.innerText.trim()) {
point.remove();
}
});
-
toc2Wrapper.style.display = "block";
-
visibleSideBar(toc2Wrapper);
-
// document.querySelector("body").classList.add(".scroll-nav");
-
// setTimeout(() => {
-
// document.querySelector("body").classList.remove(".scroll-nav");
-
// }, 500);
} else {
toc2Wrapper.style.display = "none";
@@ -434,14 +308,12 @@ function prepareContent() {
}
const images = document.querySelectorAll(".p_Normal > img");
-
images.forEach(
(image) =>
image.closest("p") && image.closest("p").classList.add("image-container")
);
const breadcrumbs = document.querySelector(".topic__breadcrumbs");
-
if (breadcrumbs && breadcrumbs.firstElementChild) {
breadcrumbs.firstElementChild.childNodes.forEach((node) => {
if (node.nodeValue && node.nodeValue.includes(">")) {
@@ -450,18 +322,17 @@ function prepareContent() {
});
}
- const spans = document.querySelectorAll("span");
-
- if (spans.length) {
- spans.forEach((span) => {
- if (span.innerHTML === " ") {
- span.remove();
- }
- });
- }
+ // const spans = document.querySelectorAll('span');
+ // if (spans.length) {
+ // spans.forEach(span => {
+ // if (span.innerHTML === ' ') {
+ // span.remove();
+ // console.log(span.innerHTML);
+ // }
+ // });
+ // }
// example exapand
-
const examplesToggle = document.querySelectorAll(
'a[class="dropdown-toggle"]'
);
@@ -476,54 +347,37 @@ function prepareContent() {
example.parentElement.tagName === "p"
? example.parentElement
: example.closest("p");
-
const nextSiblingDiv = parentP.nextElementSibling;
-
if (nextSiblingDiv && nextSiblingDiv.tagName === "DIV") {
parentP.classList.add("example");
-
const id = nextSiblingDiv.id;
-
const button = document.createElement("a");
-
const obj = nextSiblingDiv.attributes;
-
let expandState = "0";
-
parentP.setAttribute("data-state", expandState);
-
button.classList.add("btn-example");
-
button.innerHTML =
locale === "ru"
? 'СвернутьПосмотреть полностью'
: 'HideShow all';
-
button.addEventListener("click", (evt) => {
evt.preventDefault();
-
window.HMToggle("toggle", id);
-
Object.entries(obj).map((el) => {
if (el[1].name === "hm.state") {
expandState = el[1].value;
-
parentP.setAttribute("data-state", expandState);
}
});
});
-
parentP.append(button);
-
example.setAttribute("href", "javascript:void(0)");
-
example.after(nextSiblingDiv);
}
});
}
const pArray = document.querySelectorAll(".p_Normal");
-
if (pArray.length) {
pArray.forEach((p) => {
if (p.innerHTML === " ") {
@@ -533,11 +387,9 @@ function prepareContent() {
}
const examples = document.querySelectorAll("p.p_CodeExample");
-
if (examples.length) {
examples.forEach((example) => {
const childSpan = example.firstElementChild;
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -545,7 +397,6 @@ function prepareContent() {
) {
createNotation(example, "example", "примера");
}
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -553,7 +404,6 @@ function prepareContent() {
) {
createNotation(example, "warning", "внимание");
}
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -565,22 +415,15 @@ function prepareContent() {
}
//small icon
-
const icons = document.querySelectorAll(".content img");
-
if (icons.length) {
icons.forEach((icon, idx) => {
const iconWidth = parseInt(icon.width);
-
const floated = icon.style.float;
-
floated !== "" && icon.classList.add("img-float--" + floated);
-
if (iconWidth < 200) {
icon.classList.add("small-img");
-
const iconHeight = parseInt(icon.height);
-
if (
iconWidth > 70 &&
iconHeight > 70 &&
@@ -593,33 +436,28 @@ function prepareContent() {
});
}
}
-
//TODO скрытие хедера
-
function stickyHeader() {
var lastScrollTop = 0;
-
var delta = 15;
-
$(window)
.on("scroll", function () {
var st = $(this).scrollTop();
-
if (Math.abs(lastScrollTop - st) <= delta) return;
-
if (st > lastScrollTop && lastScrollTop > 0) {
$("body").addClass("--header-hidden");
-
$(".solution-select__list").removeClass("active");
-
$(".solution-select").removeClass("active");
} else {
$("body").removeClass("--header-hidden");
-
$(".solution-select__list").removeClass("active");
-
$(".solution-select").removeClass("active");
}
+ //TEST
+ // if (document.querySelector("body").classList.contains(".scroll-nav")) {
+ // $("body").addClass("--header-hidden");
+ // }
+ //TEST
lastScrollTop = st;
})
@@ -640,35 +478,23 @@ $(window).resize(function () {
function iconsTableOfContents() {
const toggledLi = document.querySelectorAll('li[data-bg*="collapsed"]');
-
toggledLi.forEach((li) => li.classList.add("toggled"));
}
$(document).ready(function () {
prepareContent();
-
toggleUlsHandler();
-
- //TODO вызов хедера
-
+ //TODO вызов скрытия хедера
// stickyHeader();
$("#side-menu").load("index.html #toc", function () {
- //TODO ререндер toc
-
- // window.addEventListener('popstate', () => {
-
- // // $(".article-inner").empty();
-
- // $('#article').load(`${window.location.href} .article-inner`, function () {
-
+ //TODO вызавает каждый раз ререндер при изменении href(добавление якоря как например)
+ // window.addEventListener("popstate", () => {
+ // $("#article").load(`${window.location.href} .article-inner`, function () {
// loadBottomLinks();
-
// prepareContent();
-
// });
-
- // })
+ // });
function onUrlChange(callback) {
const originalPushState = history.pushState;
@@ -731,50 +557,56 @@ $(document).ready(function () {
});
// Дополнительно: обработка void-ссылок
- document.querySelectorAll('a[href^="javascript:"]').forEach((link) => {
- link.addEventListener("click", (e) => {
- e.preventDefault();
- // Можно добавить здесь свою логику обработки клика
- });
- });
+ // document.querySelectorAll('a[href^="javascript:"]').forEach((link) => {
+ // link.addEventListener("click", (e) => {
+ // e.preventDefault();
+ // // Можно добавить здесь свою логику обработки клика
+ // });
+ // });
//
-
loadBottomLinks();
-
hideAllSideUls();
-
toggleUlsHandler();
-
document.addEventListener("DOMContentLoaded", () => {
if (document.visibilityState === "visible") {
hideAllSideUls();
}
});
+ //toc
+ function tryHideSideUlsWhenActive() {
+ if (document.visibilityState === "visible") {
+ hideAllSideUls();
+ } else {
+ document.addEventListener(
+ "visibilitychange",
+ () => {
+ if (document.visibilityState === "visible") {
+ hideAllSideUls();
+ }
+ },
+ { once: true }
+ );
+ }
+ }
+
+ document.addEventListener("DOMContentLoaded", tryHideSideUlsWhenActive);
const menuItems = this.querySelectorAll("a");
-
menuItems.forEach((item) => {
item.addEventListener("click", (evt) => {
evt.preventDefault();
-
const url =
evt.target.nodeName === "A"
? evt.target.href
: evt.target.closest("a").href;
-
const sideMenu = document.querySelector(".sidebar");
-
const htmlTag = document.querySelector("html");
-
const toggledLi = document.querySelectorAll('li[data-bg*="collapsed"]');
window.scrollTo(0, 0);
-
htmlTag.classList.remove("--locked");
-
$("body").removeClass("index-page search-page");
-
sideMenu.classList.remove("show-side-menu");
if (toggledLi.length) {
@@ -786,42 +618,17 @@ $(document).ready(function () {
if (url !== window.location.href) {
if (!url.includes("javascript:void")) {
$(".article-inner").empty();
-
$("#article").load(`${url} .article-inner`, function () {
history.pushState({}, null, url);
-
//metaDecsription.attr('content', metaDescriptionInitial);
-
loadBottomLinks();
-
prepareContent();
});
} else {
- // const _target = evt.target;
-
- // const _targetUl = _target.parentElement.nextElementSibling;
-
- // if (_target.nodeName === "SPAN" && _targetUl.nodeName === "UL" && _targetUl.classList.contains("hide-side-menu-item")) {
-
- // _targetUl.querySelectorAll('a')[0].click();
-
- // } else {
-
- // const _ul = _target.parentElement.querySelectorAll('a')[0].nextElementSibling;
-
- // if (_ul.nodeName === "UL") {
-
- // _ul.querySelectorAll('a')[0].click();
-
- // };
-
- // }
-
+ //TEST
function isFakeLink(link) {
if (!link) return false;
-
const href = link.getAttribute("href");
-
return href === "#" || href === "javascript:void(0);";
}
@@ -831,45 +638,34 @@ $(document).ready(function () {
function findFirstLinkInElement(element) {
if (!element) return null;
-
return element.querySelector("a");
}
function findFirstRealNestedLink(element) {
if (!element) return null;
-
const links = element.querySelectorAll("a");
-
for (const link of links) {
if (isRealLink(link)) return link;
}
-
return null;
}
document.addEventListener("click", (evt) => {
const _target = evt.target;
-
if (_target.nodeName !== "SPAN") return;
const _targetLi = _target.closest("li");
-
if (!_targetLi) return;
const submenu = _targetLi.querySelector("ul");
-
const firstLink = findFirstLinkInElement(_targetLi);
// заглушки
-
if (firstLink && isFakeLink(firstLink)) {
const nestedReal = findFirstRealNestedLink(submenu);
-
if (nestedReal) {
nestedReal.click();
-
// в первом фрагменте, после nestedReal.click();
-
setTimeout(() => {
document.dispatchEvent(new Event("subcategory:update"));
}, 50);
@@ -881,6 +677,7 @@ $(document).ready(function () {
firstLink.click(); // кликаем по нормальной ссылке
}
});
+ //TEST
}
}
});
@@ -890,28 +687,20 @@ $(document).ready(function () {
const obj = pagedata.reduce((acc, words) => {
const searchObj = {
title: words[1],
-
link: words[0],
};
-
return [...acc, searchObj];
}, []);
-
$(".search-form__input").each(function () {
var _that = $(this);
-
var _searchForm = _that.parent();
-
_that
.autocomplete({
autoFocus: false,
-
minLength: 2,
-
focus: function (event, ui) {
itemUiLinkSelected = ui.item.link;
},
-
source: function (request, response) {
const results = obj.filter(
(item) =>
@@ -920,9 +709,7 @@ $(document).ready(function () {
.includes(request.term.toLowerCase()) &&
document.querySelector(`a[href="${item.link.slice(2)}"]`)
);
-
const sliceResults = results.slice(0, 5);
-
sliceResults.map((result) => {
const aItem = document.querySelector(
`a[href="${result.link.slice(2)}"]`
@@ -930,7 +717,6 @@ $(document).ready(function () {
if (aItem) {
const parent = aItem.closest("li.heading1");
-
result.breadcrumb =
parent.querySelector("span.heading1").innerText;
} else {
@@ -949,7 +735,6 @@ $(document).ready(function () {
item.breadcrumb || ""
}`
)
-
.appendTo(ul);
};
@@ -963,15 +748,10 @@ $(document).ready(function () {
$(".glossary-abc__nav a").on("click", function (e) {
e.preventDefault();
-
var target = $(this).attr("href");
-
console.log($(this).parent().siblings());
-
$(".glossary-abc__nav a").removeClass("--active");
-
$(this).addClass("--active");
-
$("html, body").animate(
{
scrollTop: $(target).offset().top - 150,
@@ -980,33 +760,39 @@ $(document).ready(function () {
);
});
- // Хлебные крошки на странице поиска
+ const name = "Сайт ELMA365";
+ const cusLi = document.createElement("li");
+ cusLi.classList.add("heading1");
+ cusLi.classList.add("heading10");
+ const cusA = document.createElement("a");
+ cusA.classList.add("heading1");
+ cusA.setAttribute("href", "https://elma365.com/ru/");
+ cusA.setAttribute("target", "_blank");
+ const cusSpan = document.createElement("span");
+ cusSpan.classList.add("heading1");
+ cusSpan.textContent = name;
+ cusA.appendChild(cusSpan);
+ cusLi.appendChild(cusA);
+ document.querySelector("#toc").prepend(cusLi);
+ // Хлебные крошки на странице поиска
function findPrevBreadcrumbs(node, breadcrumbs) {
var breadcrumbsNew =
breadcrumbs || $('');
-
var prevParentEl = node.closest("ul") ? node.closest("ul").prev() : null;
-
if (!prevParentEl[0] || prevParentEl[0].tagName !== "A") {
return breadcrumbsNew;
}
-
breadcrumbsNew.prepend(' / ');
-
breadcrumbsNew.prepend(prevParentEl.clone());
-
return findPrevBreadcrumbs(prevParentEl, breadcrumbsNew);
}
$(".result_title a").each(function () {
var bc = "";
-
var currentArticleName = $(this);
-
$("#toc a span").each(function () {
var tocCurrentNode = $(this);
-
if (tocCurrentNode.text().trim() === currentArticleName.text().trim()) {
bc = findPrevBreadcrumbs(tocCurrentNode);
}
@@ -1019,56 +805,16 @@ $(document).ready(function () {
});
});
-//let scrollPos = 0;
-
-/* $('body').scroll(function () {
-
- let st = $(this).scrollTop();
-
- if (st > scrollPos) {
-
- $('.scroll-top').hide();
-
- } else {
-
- $('.scroll-top').show();
-
- }
-
- scrollPos = st;
-
-});
-
-
-
-$('.scroll-top').on('click', function (e) {
-
- e.preventDefault();
-
- $('html, body').animate({
-
- scrollTop: 0
-
- });
-
-}); */
-
//side menu mobile
-
const sideMenuIcon = document.querySelector("#side-menu-icon");
-
const htmlTag = document.querySelector("html");
-
const sideMenu = document.querySelector("#sidebar");
-
const closeButton = document.querySelector("#close");
if (sideMenuIcon) {
sideMenuIcon.addEventListener("click", (evt) => {
evt.preventDefault();
-
sideMenu.classList.toggle("show-side-menu");
-
htmlTag.classList.toggle("--locked");
});
}
@@ -1076,15 +822,12 @@ if (sideMenuIcon) {
if (closeButton) {
closeButton.addEventListener("click", (e) => {
e.preventDefault();
-
sideMenu.classList.remove("show-side-menu");
-
htmlTag.classList.remove("--locked");
});
}
var triggerTitleMegaGuide = false;
-
if (getTitleSite() === "Mega Guide" || /hmftsearch.html/i.test(href)) {
triggerTitleMegaGuide = true;
}
@@ -1102,9 +845,6 @@ function getTitleSite() {
const currentUrl = window.location.href;
if (
- /http:\/\/localhost/i.test(currentUrl) ||
- /brix365.t-elma365\/en\/help/i.test(currentUrl) ||
- /brix365.com\/en\/help/i.test(currentUrl) ||
/elma365.com\/ru\/help/i.test(currentUrl) ||
/elma365.com\/en\/help/i.test(currentUrl) ||
/elma365\/help\/ru/i.test(currentUrl) ||
@@ -1114,44 +854,29 @@ if (
) {
window.addEventListener("load", () => {
const searchIcon = document.querySelector("#search-icon");
-
const searchPanel = document.querySelector("#search-panel");
-
const searchInput = searchPanel.querySelector('input[type="text"]');
-
const heroSearch = document.querySelector(".hero__search");
-
if (searchIcon) {
searchIcon.addEventListener("click", (evt) => {
- console.log(searchIcon);
-
evt.preventDefault();
-
searchPanel.classList.toggle("show-search-panel");
-
setTimeout(() => searchInput.focus(), 500);
heroSearch.classList.add("hero__search--active");
});
- } else {
- console.log("error");
}
-
if (searchInput) {
const label = searchInput.closest("label");
-
searchInput.addEventListener("blur", () => {
searchPanel.classList.remove("show-search-panel");
-
heroSearch.classList.remove("hero__search--active");
-
if (searchInput.value) {
label.classList.add("cross");
} else {
label.classList.remove("cross");
}
});
-
searchInput.addEventListener("focus", () => {
label.classList.add("cross");
});
@@ -1167,15 +892,12 @@ if (
$(".arrow-top").click(function () {
$("html, body").animate({ scrollTop: 0 }, 600);
-
return false;
});
// очистить поиск
-
if (document.querySelector("#reset-search")) {
const resetButton = document.querySelector("#reset-search");
-
resetButton.addEventListener("click", () => {
searchInput.value = "";
});
@@ -1190,84 +912,37 @@ if (
wrapperSearch.classList.add("search-form__label");
const tagSpanIcons = document.createElement("span");
-
tagSpanIcons.className = "search__icon";
-
tagSpanIcons.setAttribute("id", "reset-search");
-
wrapperSearch.prepend(tagSpanIcons);
- // const insertInnerHtml = document.querySelector('tr .ya-site-form__search-input-layout-l');
-
- // const divBlockHeroSearch = document.createElement('div');
-
- //
-
- // divBlockHeroSearch.classList.add('hero__search')
-
- // divBlockHeroSearch.innerHTML = `
-
- //
-
- //
-
- //
-
- //
-
- // `;
-
- // setTimeout(() => {
-
- // insertInnerHtml.appendChild(divBlockHeroSearch);
-
- // }, 1000);
-
const searchIcon = document.querySelector("#search-icon");
-
const searchPanel = document.querySelector(
".ya-site-form.ya-site-form_bg_transparent.ya-site-form_inited_yes"
);
-
const searchInput = searchPanel.querySelector('input[type="search"]');
-
const heroSearch = document.querySelector(".hero__search");
-
if (searchIcon) {
searchIcon.addEventListener("click", (evt) => {
- console.log(searchIcon);
-
evt.preventDefault();
-
searchPanel.classList.toggle("show-search-panel");
-
setTimeout(() => searchInput.focus(), 500);
-
heroSearch.classList.add("hero__search--active");
});
}
-
if (searchInput) {
const div = searchInput.closest(".ya-site-form__input");
-
searchInput.addEventListener("blur", searchWatch);
function searchWatch() {
searchPanel.classList.remove("show-search-panel");
-
heroSearch.classList.remove("hero__search--active");
-
if (searchInput.value !== "") {
div.classList.add("cross");
} else {
div.classList.remove("cross");
}
}
-
searchInput.addEventListener("focus", () => {
div.classList.add("cross");
});
@@ -1283,21 +958,15 @@ if (
$(".arrow-top").click(function () {
$("html, body").animate({ scrollTop: 0 }, 600);
-
return false;
});
// очистить поиск
-
const resetButton = document.querySelector("#reset-search");
-
resetButton.addEventListener("click", () => {
searchInput.value = "";
-
searchInput.focus();
-
baseUrl = window.location.href.split("?")[0];
-
window.history.pushState("name", "", baseUrl);
});
});
@@ -1311,29 +980,20 @@ function searchFormHeader() {
$(".search-form").each(function () {
$(this).on("submit", (evt) => {
evt.preventDefault();
-
evt.stopPropagation();
-
var searchStr = evt.target[0].value;
-
if (searchStr.trim()) {
if (
(/elma365.com\/ru\/help/i.test(window.location.href) ||
/elma365.com\/en\/help/i.test(window.location.href) ||
/t-elma365.com/i.test(window.location.href) ||
- /brix365.com\/en\/help/i.test(window.location.href) ||
/([\d+]{3}).(\d).(\d).(\d)/i.test(window.location.href) ||
/http:\/\/localhost/i.test(window.location.href)) &&
!triggerTitleMegaGuide
) {
window.location.href = `./search.html?query=${searchStr}`;
- }
-
- //фикс поиска, тест
- else {
- // window.location.href = `./hmftsearch.html?zoom_query=${searchStr}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
- window.location.href = `./search.html?query=${searchStr}`;
+ } else {
+ window.location.href = `./hmftsearch.html?zoom_query=${searchStr}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
}
}
});
@@ -1347,41 +1007,28 @@ if (
Boolean(document.querySelector(".searchheading"))
) {
const searchTitle = document.querySelector(".searchheading");
-
const queryString = window.location.search;
-
let currentPageNumber = null;
const searchParams = queryString.split("&");
-
searchParams.forEach((param) => {
const paramArr = param.split("=");
-
if (paramArr[0] === "zoom_page") {
currentPageNumber = +paramArr[1];
}
});
-
const searchWord = decodeURI(searchParams[0].split("=")[1]);
-
searchTitle.innerText =
locale === "ru" ? "Результаты поиска:" : "Search results for:";
-
const searchWordP = document.createElement("p");
-
searchWordP.classList.add("search-word");
-
searchWordP.innerText = searchWord;
-
searchTitle.append(searchWordP);
let pagesCount = "0";
-
const resultPagesCount = document.querySelector(".result_pagescount");
-
if (resultPagesCount) {
pagesCount = parseInt(resultPagesCount.innerText.trim());
-
resultPagesCount.remove();
}
@@ -1389,109 +1036,62 @@ if (
switch (currentPage) {
case "first-page": {
resultPages[0].textContent = "<< < ";
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = "1";
-
resultPages[0].after(span);
-
const aEnd = document.createElement("a");
-
const urlEnd = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=${pagesCount}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aEnd.setAttribute("href", urlEnd);
-
aEnd.textContent = " >>";
-
// resultPages[resultPages.length - 1].textContent = ' >>';
-
resultPages[resultPages.length - 1].after(aEnd);
-
resultPages[resultPages.length - 2].remove();
-
resultPages[resultPages.length - 2].textContent = " > ";
-
break;
}
-
case "last-page": {
resultPages[resultPages.length - 1].textContent = ` > >>`;
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = currentPageNumber;
-
const aBegin = document.createElement("a");
-
const urlBegin = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=1&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aBegin.setAttribute("href", urlBegin);
-
aBegin.textContent = "<< ";
-
resultPages[resultPages.length - 1].before(span);
-
// resultPages[0].textContent = '<< ';
-
resultPages[1].before(aBegin);
-
resultPages[0].remove();
-
resultPages[1].textContent = "< ";
-
break;
}
-
case "default-page": {
const aBegin = document.createElement("a");
-
const aEnd = document.createElement("a");
-
const urlBegin = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=1&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
const urlEnd = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=${pagesCount}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aBegin.setAttribute("href", urlBegin);
-
aBegin.textContent = "<< ";
-
aEnd.setAttribute("href", urlEnd);
-
aEnd.textContent = " >>";
-
resultPages[1].before(aBegin);
-
resultPages[0].remove();
-
//resultPages[0].textContent = '<< ';
-
//resultPages[0] = aBegin;
-
resultPages[1].textContent = " < ";
-
resultPages[resultPages.length - 2].textContent = " > ";
-
//resultPages[resultPages.length - 1].textContent = ' >> ';
-
resultPages[resultPages.length - 2].after(aEnd);
-
resultPages[resultPages.length - 1].remove();
-
break;
}
-
default:
break;
}
}
const resultPagesNode = document.querySelector(".result_pages");
-
const resultPages = resultPagesNode
? document.querySelector(".result_pages").childNodes
: [];
@@ -1516,15 +1116,10 @@ if (
resultPages.forEach((node) => {
if (+node.textContent.trim() === currentPageNumber) {
const nextElement = node.nextSibling;
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = currentPageNumber;
-
nextElement.before(span);
-
node.remove();
}
});
@@ -1532,33 +1127,17 @@ if (
}
const summary = document.querySelectorAll(".summary");
-
if (summary.length > 0 && locale === "ru") {
const count = parseInt(summary[0].innerText.trim());
-
summary[0].innerText = count
? `Найдено совпадений: ${count}`
: (summary.innerText = "Совпадений не найдено");
}
}
-// подменяет текст в абзаце в зависимости от атрибута lang
-
-// if (document.documentElement.lang === "en") {
-
-// $('#found_typo').html('Found a typo? Highlight the text, press ctrl + enter and notify us')
-
-// } else if (document.documentElement.lang === "ru") {
-
-// $('#found_typo').html('Нашли опечатку? Выделите текст, нажмите ctrl + enter и оповестите нас')
-
-// }
-
$(window).on("load", () => {
// правит текст в фильтре результатов поиска
-
// $('.b-loader__wrapper').css('opacity', 0);
-
function replace() {
var intervalReplace = setInterval(() => {
if (
@@ -1574,20 +1153,17 @@ $(window).on("load", () => {
setTimeout(() => {
clearInterval(intervalReplace);
-
// }, 180000);
}, 10000);
function t() {
if (document.documentElement.lang === "en") {
textResult("нашёл", "Matches found", "all resourses", 13);
-
textFindSection("Search through ");
}
if (document.documentElement.lang === "ru") {
textResult("нашёл", "Найдено совпадений", "всем ресурсам", 18);
-
textFindSection("Искать по ");
}
@@ -1596,14 +1172,11 @@ $(window).on("load", () => {
searchAny = $(
".b-dropdowna__switcher .b-pseudo-link_is-bem_yes"
).text();
-
var e = text.replace(textFound, textFoundRes),
t = searchAny.replace("любой", textAny);
-
$("tr td.b-head__r .b-head__found").text(
e.substring(0, n) + ": " + parseInt(text.match(/\d+/))
);
-
$(".b-dropdowna__switcher .b-pseudo-link_is-bem_yes").text(t);
if ($("tr td.b-head__r .b-head__found").text().indexOf("найдёт") == 0) {
@@ -1637,11 +1210,8 @@ $(window).on("load", () => {
if (i > 0) {
if (element.childNodes[0].textContent.indexOf("раздел") === 0) {
var htmlTag = [];
-
htmlTag.push(element.childNodes[i]);
-
element.textContent = textResSection;
-
htmlTag.forEach((item) => {
element.appendChild(item);
});
@@ -1666,7 +1236,6 @@ $(window).on("load", () => {
setTimeout(() => {
clearInterval(intervalAddElementSubsection);
-
// }, 180000)
}, 10000);
@@ -1680,71 +1249,48 @@ $(window).on("load", () => {
var textContent = $("yass-li.b-serp-item .b-serp-url__item")[index]
.textContent;
-
switch (true) {
// ELMA365
-
case /elma365.com\/ru\/help/i.test(textContent):
subsectionTitle("Справка");
-
break;
-
case /academy.com/i.test(textContent):
subsectionTitle("ELMA Academy");
-
break;
-
case /tssdk.elma/i.test(textContent):
subsectionTitle("TS SDK");
-
break;
-
case /exchange.elma/i.test(textContent):
subsectionTitle("ELMA365 Exchange");
-
break;
// Английская версия
-
case /en\/help/i.test(textContent):
subsectionTitle("Help");
-
break;
// rpa
-
case /rpa.ai\/ru/i.test(textContent):
subsectionTitle("RPA");
-
break;
// ELMA4
-
case /ru\/help4\/ecm/i.test(textContent):
subsectionTitle("ECM+");
-
break;
-
case /ru\/help4\/crm/i.test(textContent):
subsectionTitle("CRM+");
-
break;
-
case /ru\/help4\/projects/i.test(textContent):
subsectionTitle("Проекты");
-
break;
-
case /elma-bpm.ru\/help4/i.test(textContent):
subsectionTitle("BPM");
-
break;
-
case /ru\/KB/i.test(textContent) ||
/elma-bpm.ru\/…help/i.test(textContent) ||
/help/i.test(textContent):
subsectionTitle("База знаний");
-
break;
}
@@ -1753,11 +1299,8 @@ $(window).on("load", () => {
$(".subsection-title")[index].textContent = text;
} else {
var newBlockDiv = document.createElement("div");
-
newBlockDiv.classList.add("subsection-title");
-
newBlockDiv.textContent = text;
-
$(".b-serp-item__title")[index].prepend(newBlockDiv);
}
}
@@ -1775,20 +1318,16 @@ $(window).on("load", () => {
if ($("tr td.b-head__r .b-head__found")) {
var intervalTimer = setInterval(() => {
replace();
-
addElementSubsection();
}, 200);
// через 3 минуты интервал останавливается (время взято примерно, чтобы успело все прогрузиться)
-
setTimeout(() => {
clearInterval(intervalTimer);
-
// }, 180000);
}, 10000);
} else {
replace();
-
addElementSubsection();
}
});
@@ -1797,41 +1336,25 @@ $(window).on("load", () => {
const leadhandler = "https://web.s-elma365.ru";
var rootNode = document.createElement("div");
-
document.body.appendChild(rootNode);
-
var typo = new TypoReporter(
{
formId: "1FAIpQLSfXEIXAFoOiHgetf0reIjWrOAw6V7KCZrhAv8VVD6WL7Rs46g", // required, see previous step
// Optional example stuff below
-
locale: getLocale(), // optional language, defaults to 'en'
-
// translations: { // optinal object with translated strings
-
// fr: {
-
// // see source code for keys to translate
-
// },
-
// ru: {
-
//
-
// }
-
// },
-
offset: 100, // amount of context text to grab from before and after the selection, defaults to 50
-
endpointUrl: leadhandler + "/api/baglist/", // optional, defaults to Google Forms
-
snippetFieldName: "typo", // optional, if using custom form
-
commentFieldName: "comment", // optional, if using custom form
-
urlFieldName: "url", // optional, if using custom form
},
rootNode
@@ -1839,14 +1362,12 @@ var typo = new TypoReporter(
$(document).on("focus", ".fill_listener", function () {
//console.log("test");
-
$(this).parent().addClass("focused");
});
$(document).on("blur", ".fill_listener", function () {
$(this).parent().removeClass("focused");
});
-
$(document).on("change", ".fill_listener", function () {
if ($(this).val().length) {
$(this).parent().addClass("filled");
@@ -1858,21 +1379,16 @@ $(document).on("change", ".fill_listener", function () {
function feedbackSubmit() {
$("#feedback-form").on("submit", function () {
var $form = $(this);
-
var formData = $form.serializeArray().slice(0, -1);
-
var context = {};
$(formData).each(function (index, obj) {
if (obj.name === "useful" && obj.value === "true") {
context.other = "";
-
context.useful = true;
-
context.category = [
{
code: "",
-
name: "",
},
];
@@ -1883,14 +1399,11 @@ function feedbackSubmit() {
if (obj.name === "other") {
context.other = obj.value;
}
-
context.useful = false;
-
if (obj.name === "category") {
context.category = [
{
code: obj.value,
-
name: $form.find('option[value="' + obj.value + '"]').text(),
},
];
@@ -1900,18 +1413,13 @@ function feedbackSubmit() {
});
context.produkt = ["6b55aead-f008-42c7-9186-0806c06d4f2c"];
-
context.link = window.location.href;
-
var data = {
context,
};
-
var request = $.ajax({
type: "POST",
-
url: leadhandler + "/api/feedback/create",
-
data: JSON.stringify(data),
})
.fail(function (response) {
@@ -1920,7 +1428,6 @@ function feedbackSubmit() {
.done(function (response) {
return response;
});
-
return false;
});
}
@@ -1936,32 +1443,23 @@ $(document).ready(function () {
var $form = $(this),
textarea = $form.find('textarea[name="help_question"]'),
//formData = $form.serializeArray().slice(0, -1),
-
context = {};
context.other = textarea.val();
-
context.category = [
{
code: "question",
-
name: "Задать вопрос",
},
];
-
context.produkt = ["6b55aead-f008-42c7-9186-0806c06d4f2c"];
-
context.link = window.location.href;
-
var data = {
context,
};
-
var request = $.ajax({
type: "POST",
-
url: leadhandler + "/api/feedback/create",
-
data: JSON.stringify(data),
})
.fail(function (response) {
@@ -1972,23 +1470,18 @@ $(document).ready(function () {
.parent()
.find(".question-success")
.removeClass("hidden");
-
setTimeout(() => {
$(".question-xs").attr("style", "display:none;");
-
textarea.val("");
});
-
setTimeout(() => {
$(".question__popup")
.parent()
.find(".question-success")
.addClass("hidden");
-
$(".question").removeClass("active");
}, 3000);
});
-
return false;
});
});
@@ -1998,7 +1491,6 @@ function question() {
const questionPopup = $(this).parent().find(".question-xs");
questionPopup.attr("style", "display:block;");
-
setTimeout(() => {
$(this).parent().find('textarea[name="help_question"]').focus();
}, 200);
@@ -2006,7 +1498,6 @@ function question() {
$(document).mouseup(function (e) {
let container = $(".question-xs");
-
if (!container.is(e.target) && container.has(e.target).length === 0) {
container.attr("style", "display:none;");
}
@@ -2018,12 +1509,9 @@ function question() {
$(".question-xs").on("submit", function () {
$(this).parent().find(".question-success-xs").removeClass("hidden");
-
$(this).removeClass("active");
-
setTimeout(() => {
$(this).parent().find(".question-success-xs").addClass("hidden");
-
$(this).addClass("active");
}, 3000);
});
@@ -2033,28 +1521,23 @@ question();
$(document).click(function (e) {
if ($(e.target).closest(".ReportTypo-popup").length != 0) return false;
-
$(".ReportTypo").fadeOut(100);
});
$(document).click(function (e) {
if ($(e.target).closest(".ReportTypo-popup").length != 0) return false;
-
$(".ReportTypo").fadeOut(100);
});
jQuery(function ($) {
$(document).mouseup(function (e) {
// ������� ����� �� ���-���������
-
var div = $("#feedback-form"); // ��� ��������� ID ��������
-
if (
!div.is(e.target) && // ���� ���� ��� �� �� ������ �����
div.has(e.target).length === 0
) {
// � �� �� ��� �������� ���������
-
$(".feedback-form").find("input:checked").removeAttr("checked");
}
});
@@ -2062,25 +1545,17 @@ jQuery(function ($) {
function feedback() {
const yesLabel = document.getElementById("feedback__useful_yes");
-
const thxWindow = document.getElementById("feedback__popup_thx");
-
const noLabel = document.getElementById("feedback__useful_no");
-
const feedbackWhyPopup = document.getElementById("feedback__popup_why");
-
const form = document.getElementById("feedback-form");
-
const otherInput = document.getElementById("other_reason");
-
const otherPopup = document.getElementById("feedback__popup-other");
-
const feedbackOtherBtn = document.querySelector(".feedback__other-btn");
const inputs = [
...document.querySelectorAll('#feedback__popup_why input[type="radio"]'),
];
-
const allRadio = inputs.filter((item) => item.id !== "other_reason");
allRadio.forEach((item) =>
@@ -2099,16 +1574,12 @@ function feedback() {
otherInput.addEventListener("change", (e) => {
if (e.target.checked) {
feedbackWhyPopup.style.display = "none";
-
otherPopup.style.display = "block";
-
$(".feedback__popup").find('textarea[name="other"]').focus();
feedbackOtherBtn.addEventListener("click", function () {
otherPopup.style.display = "none";
-
$("#feedback-success-popup").show();
-
setTimeout(() => {
$("#feedback-success-popup").hide();
}, 3000);
@@ -2122,9 +1593,7 @@ function feedback() {
if (Boolean(feedbackWhyPopup)) {
document.addEventListener("click", (e) => {
const target = e.target;
-
feedbackWhyPopup.style.display = "none";
-
thxWindow.style.display = "none";
if (target.matches("#feedback__useful_no")) {
@@ -2160,7 +1629,6 @@ $(window).on("load", function () {
document.querySelectorAll("main article section div")[1]
) {
let el = document.querySelectorAll("main article section div")[1];
-
el.setAttribute("id", "table-mobile-desktop_size");
}
});
@@ -2178,7 +1646,6 @@ if (document.querySelector("#side-menu")) {
document.querySelectorAll("main article section div")[1]
) {
let el = document.querySelectorAll("main article section div")[1];
-
el.setAttribute("id", "table-mobile-desktop_size");
}
}, 200);
@@ -2194,52 +1661,39 @@ if (document.querySelector("#side-menu")) {
if (document.getElementsByClassName("accordion-btn__show")) {
var showAccordionBtn = document.querySelector(".accordion-btn__show");
-
var elementAccordionHide = document.querySelector(".accordion__hide");
-
var linearGradient = document.querySelector(".linear-gradient");
-
var heightAccordionElem =
document.querySelector(".card-stack-50").scrollHeight;
var t = false;
-
showAccordionBtn.addEventListener("click", () => {
switch (true) {
case showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.contains("arrow__show"):
elementAccordionHide.classList.add("accordion__show");
-
elementAccordionHide.style.maxHeight = heightAccordionElem + "px";
-
elementAccordionHide.classList.remove("accordion__hide");
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.remove("arrow__show");
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.add("arrow__hide");
setTimeout(() => {
linearGradient.classList.remove("linear-gradient");
-
showAccordionBtn.querySelector("p").textContent = "Свернуть";
}, 1000);
-
break;
case showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.contains("arrow__hide"):
elementAccordionHide.classList.add("accordion__hide");
-
elementAccordionHide.classList.remove("accordion__show");
-
elementAccordionHide.style.maxHeight = "";
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.add("arrow__show");
@@ -2248,12 +1702,9 @@ if (document.getElementsByClassName("accordion-btn__show")) {
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.remove("arrow__hide");
-
linearGradient.classList.add("linear-gradient");
-
showAccordionBtn.querySelector("p").textContent = "Показать всё";
}, 1000);
-
break;
}
});
@@ -2266,7 +1717,6 @@ if (document.getElementsByClassName("accordion-btn__show")) {
(function () {
if (document.querySelector(".accordion__items")) {
var btn = document.querySelectorAll(".accordion__item-question");
-
var dehiscentItems = document.querySelectorAll(
".accordion__item-question-answer"
);
@@ -2279,11 +1729,8 @@ if (document.getElementsByClassName("accordion-btn__show")) {
removeActiveClass();
} else {
removeActiveClass();
-
this.classList.toggle("accordion__active");
-
nextEl.style.maxHeight = nextEl.scrollHeight + "px";
-
nextEl.style.marginBottom = "15px";
}
});
@@ -2296,7 +1743,6 @@ if (document.getElementsByClassName("accordion-btn__show")) {
dehiscentItems.forEach((i) => {
i.style.maxHeight = null;
-
i.style.marginBottom = null;
});
}
diff --git a/projects/jquery.tocify.min.js b/projects/jquery.tocify.min.js
index 55f8a9d..5051d08 100644
--- a/projects/jquery.tocify.min.js
+++ b/projects/jquery.tocify.min.js
@@ -1,5 +1,4 @@
-/*! jquery.tocify - v1.9.0 - 2013-10-01
-* http://gregfranko.com/jquery.tocify.js/
-* Copyright (c) 2013 Greg Franko; Licensed MIT*/
-
-!function(){"use strict";!function(r,d,c){"use strict";var o="tocify",e="tocify-focus",t="tocify-hover",n="tocify-hide",a="tocify-header",i="."+a,l="tocify-subheader",h="."+l,f="tocify-item",u="."+f,p="tocify-extend-page",g="."+p;r.widget("toc.tocify",{version:"1.9.0",options:{context:"body",ignoreSelector:null,selectors:"h1, h2, h3",showAndHide:!0,showEffect:"slideDown",showEffectSpeed:"medium",hideEffect:"slideUp",hideEffectSpeed:"medium",smoothScroll:!0,smoothScrollSpeed:"medium",scrollTo:0,showAndHideOnScroll:!0,highlightOnScroll:!0,highlightOffset:40,theme:"bootstrap",extendPage:!0,extendPageOffset:100,history:!0,scrollHistory:!1,hashGenerator:"compact",highlightDefault:!0},_create:function(){var e=this;e.extendPageScroll=!0,e.items=[],e._generateToc(),e._addCSSClasses(),e.webkit=function(){for(var e in d)if(e&&-1!==e.toLowerCase().indexOf("webkit"))return!0;return!1}(),e._setEventHandlers(),r(d).load(function(){e._setActiveElement(!0),r("html, body").promise().done(function(){setTimeout(function(){e.extendPageScroll=!1},0)})})},_generateToc:function(){var e,t,s=this,i=s.options.ignoreSelector;return e=-1!==this.options.selectors.indexOf(",")?r(this.options.context).find(this.options.selectors.replace(/ /g,"").substr(0,this.options.selectors.indexOf(","))):r(this.options.context).find(this.options.selectors.replace(/ /g,"")),e.length?(s.element.addClass(o),e.each(function(e){r(this).is(i)||(t=r("",{id:a+e,class:a}).append(s._nestElements(r(this),e)),s.element.append(t),r(this).nextUntil(this.nodeName.toLowerCase()).each(function(){0===r(this).find(s.options.selectors).length?r(this).filter(s.options.selectors).each(function(){r(this).is(i)||s._appendSubheaders.call(this,s,t)}):r(this).find(s.options.selectors).each(function(){r(this).is(i)||s._appendSubheaders.call(this,s,t)})}))}),undefined):(s.element.addClass(n),undefined)},_setActiveElement:function(e){var t=this,s=d.location.hash.substring(1),i=t.element.find('li[data-unique="'+s+'"]');return s.length?(t.element.find("."+t.focusClass).removeClass(t.focusClass),i.addClass(t.focusClass),t.options.showAndHide&&i.click()):(t.element.find("."+t.focusClass).removeClass(t.focusClass),!s.length&&e&&t.options.highlightDefault&&t.element.find(u).first().addClass(t.focusClass)),t},_nestElements:function(t,e){var s,i,o;return s=r.grep(this.items,function(e){return e===t.text()}),s.length?this.items.push(t.text()+e):this.items.push(t.text()),o=this._generateHashValue(s,t,e),i=r("",{class:f,"data-unique":o}).append(r("",{text:t.text()})),t.before(r("",{name:o,"data-unique":o})),i},_generateHashValue:function(e,t,s){var i="",o=this.options.hashGenerator;if("pretty"===o){for(i=t.text().toLowerCase().replace(/\s/g,"-");i.indexOf("--")>-1;)i=i.replace(/--/g,"-");for(;i.indexOf(":-")>-1;)i=i.replace(/:-/g,"-")}else i="function"==typeof o?o(t.text(),t):t.text().replace(/\s/g,"");return e.length&&(i+=""+s),i},_appendSubheaders:function(e,t){var s=r(this).index(e.options.selectors),i=r(e.options.selectors).eq(s-1),o=+r(this).prop("tagName").charAt(1),n=+i.prop("tagName").charAt(1);n>o?e.element.find(h+"[data-tag="+o+"]").last().append(e._nestElements(r(this),s)):o===n?t.find(u).last().after(e._nestElements(r(this),s)):t.find(u).last().after(r("",{class:l,"data-tag":o})).next(h).append(e._nestElements(r(this),s))},_setEventHandlers:function(){var h=this;this.element.on("click.tocify","li",function(){if(h.options.history&&(d.location.hash=r(this).attr("data-unique")),h.element.find("."+h.focusClass).removeClass(h.focusClass),r(this).addClass(h.focusClass),h.options.showAndHide){var e=r('li[data-unique="'+r(this).attr("data-unique")+'"]');h._triggerShow(e)}h._scrollTo(r(this))}),this.element.find("li").on({"mouseenter.tocify":function(){r(this).addClass(h.hoverClass),r(this).css("cursor","pointer")},"mouseleave.tocify":function(){"bootstrap"!==h.options.theme&&r(this).removeClass(h.hoverClass)}}),(h.options.extendPage||h.options.highlightOnScroll||h.options.scrollHistory||h.options.showAndHideOnScroll)&&r(d).on("scroll.tocify",function(){r("html, body").promise().done(function(){var o,e,t,s,n=r(d).scrollTop(),i=r(d).height(),a=r(c).height(),l=r("body")[0].scrollHeight;if(h.options.extendPage&&(h.webkit&&n>=l-i-h.options.extendPageOffset||!h.webkit&&i+n>a-h.options.extendPageOffset)&&!r(g).length){if(e=r('div[data-unique="'+r(u).last().attr("data-unique")+'"]'),!e.length)return;t=e.offset().top,r(h.options.context).append(r("",{class:p,height:Math.abs(t-n)+"px","data-unique":p})),h.extendPageScroll&&(s=h.element.find("li.active"),h._scrollTo(r('div[data-unique="'+s.attr("data-unique")+'"]')))}setTimeout(function(){var e,s=null,i=null,t=r(h.options.context).find("div[data-unique]");t.each(function(e){var t=Math.abs((r(this).next().length?r(this).next():r(this)).offset().top-n-h.options.highlightOffset);return null==s||s>t?(s=t,i=e,undefined):!1}),e=r(t[i]).attr("data-unique"),o=r('li[data-unique="'+e+'"]'),h.options.highlightOnScroll&&o.length&&(h.element.find("."+h.focusClass).removeClass(h.focusClass),o.addClass(h.focusClass)),h.options.scrollHistory&&d.location.hash!=="#"+e&&d.location.replace("#"+e),h.options.showAndHideOnScroll&&h.options.showAndHide&&h._triggerShow(o,!0)},0)})})},show:function(e){var t=this;if(!e.is(":visible"))switch(e.find(h).length||e.parent().is(i)||e.parent().is(":visible")?e.children(h).length||e.parent().is(i)||(e=e.closest(h)):e=e.parents(h).add(e),t.options.showEffect){case"none":e.show();break;case"show":e.show(t.options.showEffectSpeed);break;case"slideDown":e.slideDown(t.options.showEffectSpeed);break;case"fadeIn":e.fadeIn(t.options.showEffectSpeed);break;default:e.show()}return e.parent().is(i)?t.hide(r(h).not(e)):t.hide(r(h).not(e.closest(i).find(h).not(e.siblings()))),t},hide:function(e){var t=this;switch(t.options.hideEffect){case"none":e.hide();break;case"hide":e.hide(t.options.hideEffectSpeed);break;case"slideUp":e.slideUp(t.options.hideEffectSpeed);break;case"fadeOut":e.fadeOut(t.options.hideEffectSpeed);break;default:e.hide()}return t},_triggerShow:function(e,t){var s=this;return e.parent().is(i)||e.next().is(h)?s.show(e.next(h),t):e.parent().is(h)&&s.show(e.parent(),t),s},_addCSSClasses:function(){return"jqueryui"===this.options.theme?(this.focusClass="ui-state-default",this.hoverClass="ui-state-hover",this.element.addClass("ui-widget").find(".toc-title").addClass("ui-widget-header").end().find("li").addClass("ui-widget-content")):"bootstrap"===this.options.theme?(this.element.find(i+","+h).addClass("nav nav-list"),this.focusClass="active"):(this.focusClass=e,this.hoverClass=t),this},setOption:function(){r.Widget.prototype._setOption.apply(this,arguments)},setOptions:function(){r.Widget.prototype._setOptions.apply(this,arguments)},_scrollTo:function(e){var t=document.querySelector('div[data-unique="'+e.attr("data-unique")+'"]');if(t)t.scrollIntoView({behavior:this.options.smoothScroll?"smooth":"auto",block:"start"});return this}})}(window.jQuery,window,document)}();
\ No newline at end of file
+/*! jquery.tocify - v1.9.0 - 2013-10-01
+ * http://gregfranko.com/jquery.tocify.js/
+ * Copyright (c) 2013 Greg Franko; Licensed MIT*/
+!function(){"use strict";var a,l,h,o,s,n,r,i,d,c;a=window.jQuery,l=window,h=document,s="."+(o="tocify-header"),r="."+(n="tocify-subheader"),d="."+(i="tocify-item"),c="tocify-extend-page",a.widget("toc.tocify",{version:"1.9.0",options:{context:"body",ignoreSelector:null,selectors:"h1, h2, h3",showAndHide:!0,showEffect:"slideDown",showEffectSpeed:"medium",hideEffect:"slideUp",hideEffectSpeed:"medium",smoothScroll:!0,smoothScrollSpeed:"medium",scrollTo:0,showAndHideOnScroll:!0,highlightOnScroll:!0,highlightOffset:40,theme:"bootstrap",extendPage:!0,extendPageOffset:100,history:!0,scrollHistory:!1,hashGenerator:"compact",highlightDefault:!0},_create:function(){var e=this;e.extendPageScroll=!0,e.items=[],e._generateToc(),e._addCSSClasses(),e.webkit=function(){for(var e in l)if(e&&-1!==e.toLowerCase().indexOf("webkit"))return!0;return!1}(),e._setEventHandlers(),a(l).load(function(){e._setActiveElement(!0),a("html, body").promise().done(function(){setTimeout(function(){e.extendPageScroll=!1},0)})})},_generateToc:function(){var t,s=this,i=s.options.ignoreSelector,e=-1!==this.options.selectors.indexOf(",")?a(this.options.context).find(this.options.selectors.replace(/ /g,"").substr(0,this.options.selectors.indexOf(","))):a(this.options.context).find(this.options.selectors.replace(/ /g,""));return e.length?(s.element.addClass("tocify"),void e.each(function(e){a(this).is(i)||(t=a("",{id:o+e,class:o}).append(s._nestElements(a(this),e)),s.element.append(t),a(this).nextUntil(this.nodeName.toLowerCase()).each(function(){(0===a(this).find(s.options.selectors).length?a(this).filter(s.options.selectors):a(this).find(s.options.selectors)).each(function(){a(this).is(i)||s._appendSubheaders.call(this,s,t)})}))})):void s.element.addClass("tocify-hide")},_setActiveElement:function(e){var t=this,s=l.location.hash.substring(1),i=t.element.find('li[data-unique="'+s+'"]');return s.length?(t.element.find("."+t.focusClass).removeClass(t.focusClass),i.addClass(t.focusClass),t.options.showAndHide&&i.click()):(t.element.find("."+t.focusClass).removeClass(t.focusClass),!s.length&&e&&t.options.highlightDefault&&t.element.find(d).first().addClass(t.focusClass)),t},_nestElements:function(t,e){var s=a.grep(this.items,function(e){return e===t.text()});return s.length?this.items.push(t.text()+e):this.items.push(t.text()),s=this._generateHashValue(s,t,e),e=a("",{class:i,"data-unique":s}).append(a("",{text:t.text()})),t.before(a("",{name:s,"data-unique":s})),e},_generateHashValue:function(e,t,s){var i="",o=this.options.hashGenerator;if("pretty"===o){for(i=t.text().toLowerCase().replace(/\s/g,"-");-1",{class:n,"data-tag":o})).next(r).append(e._nestElements(a(this),s))},_setEventHandlers:function(){var n=this;this.element.on("click.tocify","li",function(){var e;n.options.history&&(l.location.hash=a(this).attr("data-unique")),n.element.find("."+n.focusClass).removeClass(n.focusClass),a(this).addClass(n.focusClass),n.options.showAndHide&&(e=a('li[data-unique="'+a(this).attr("data-unique")+'"]'),n._triggerShow(e)),n._scrollTo(a(this))}),this.element.find("li").on({"mouseenter.tocify":function(){a(this).addClass(n.hoverClass),a(this).css("cursor","pointer")},"mouseleave.tocify":function(){"bootstrap"!==n.options.theme&&a(this).removeClass(n.hoverClass)}}),(n.options.extendPage||n.options.highlightOnScroll||n.options.scrollHistory||n.options.showAndHideOnScroll)&&a(l).on("scroll.tocify",function(){a("html, body").promise().done(function(){var t,o=a(l).scrollTop(),e=a(l).height(),s=a(h).height(),i=a("body")[0].scrollHeight;if(n.options.extendPage&&(n.webkit&&o>=i-e-n.options.extendPageOffset||!n.webkit&&e+o>s-n.options.extendPageOffset)&&!a(".tocify-extend-page").length){if(!(i=a('div[data-unique="'+a(d).last().attr("data-unique")+'"]')).length)return;e=i.offset().top,a(n.options.context).append(a("",{class:c,height:Math.abs(e-o)+"px","data-unique":c})),n.extendPageScroll&&(s=n.element.find("li.active"),n._scrollTo(a('div[data-unique="'+s.attr("data-unique")+'"]')))}setTimeout(function(){var s=null,i=null,e=a(n.options.context).find("div[data-unique]");e.each(function(e){var t=Math.abs((a(this).next().length?a(this).next():a(this)).offset().top-o-n.options.highlightOffset);return(null==s||t {
const lan = document.documentElement.lang;
-
return lan ? document.documentElement.lang : "ru";
};
@@ -13,186 +12,125 @@ function getProduct() {
case "elma-rpa.ai":
product = {
name: "rpa",
-
id: "33678c11-fea6-4adb-aa39-adc4e8295b53",
};
-
break;
-
case "www.elma-bpm.ru":
product = {
name: "elma3/4",
-
id: "44b97702-146c-414b-9db7-0b09705556ed",
};
-
break;
-
default:
product = {
name: "elma365",
-
id: "3354c78a-720e-4584-a9c6-83f0f1396d22",
};
-
break;
}
-
return product;
}
-document
- .querySelector(".solution-select")
- .addEventListener("mouseenter", function () {
- this.classList.add("active");
-
- document.querySelector(".solution-select__list").classList.add("active");
- });
-
-document
- .querySelector(".solution-select__list")
- .addEventListener("mouseleave", function () {
- this.classList.remove("active");
-
- document.querySelector(".solution-select").classList.remove("active");
- });
-
-const titleName = () => {
- let textSpanTitle = document.querySelector(".solution-select__selected");
-
- let currentPlace = window.location.pathname
- .replace("/en/help/", "")
- .split("/")[0];
-
- textSpanTitle.textContent =
- currentPlace.charAt(0).toUpperCase() + currentPlace.slice(1);
-
- if (currentPlace === "crm" || "ecm") {
- textSpanTitle.textContent = currentPlace.toUpperCase();
- }
-
- if (currentPlace === "business_solutions") {
- let business = currentPlace.replace("_", " ");
-
- textSpanTitle.textContent =
- business.charAt(0).toUpperCase() +
- business.slice(1, 8) +
- " " +
- business.charAt(9).toUpperCase() +
- business.slice(10);
- }
-};
-
-/*// Commerce version
-
-const files = document.querySelectorAll(".filelink");
-
-if (files.length) {
-
- files.forEach((file) =>
-
- file.setAttribute("download", "Postman_collection.json")
-
- );
-
-}*/
-
const insertWordBreaks = (selector) => {
document.querySelectorAll(selector).forEach((el) => {
- el.innerHTML = el.textContent.replace(/([\/\-=<>:_])/g, "$1");
+ el.innerHTML = el.textContent.replace(/([\/\-=:<>_])/g, "$1");
});
};
insertWordBreaks("code");
-const scrollToLink = () => {
- let myHash = location.hash; //�������� �������� ����
+const addCanonicalUrl = () => {
+ const urlMapping = {
+ "/ru/help/business_solutions/platform-distribution.html":
+ "/ru/help/platform/platform-distribution.html",
+ };
- location.hash = ""; //������� ���
+ const listUrl = [
+ "/ru/haproxy-postgresql.html",
+ "/ru/doc_template.docx",
+ "/ru/platform-distribution.html",
+ "/ru/help/platform/haproxy-postgresql.html",
+ "/ru/help/platform/platform-distribution.html",
+ "/ru/help/ecm/doc_template.docx",
+ ];
- if (myHash[1]) {
- //���������, ���� �� � ���� �����-�� ��������
+ const currentPath = window.location.pathname;
+ const baseUrl = window.location.origin.includes("localhost")
+ ? window.location.origin
+ : "https://elma365.com";
- $("html, body").animate({ scrollTop: $(myHash).offset().top }, 300); //�������� �� ����������
+ if (urlMapping[currentPath]) {
+ setCanonicalUrl(baseUrl + urlMapping[currentPath]);
+ return;
+ }
+
+ if (listUrl.includes(currentPath)) {
+ setCanonicalUrl(baseUrl + currentPath);
}
};
+const setCanonicalUrl = (canonicalUrl) => {
+ const canonicalLink = document.createElement("link");
+ canonicalLink.href = canonicalUrl;
+ canonicalLink.setAttribute("rel", "canonical");
+ document.querySelector("head").appendChild(canonicalLink);
+};
+
+addCanonicalUrl();
+
+const scrollToLink = () => {
+ let myHash = window.location.pathname; //�������� �������� ����
+ if (myHash) {
+ //���������, ���� �� � ���� �����-�� ��������
+ $("html, body").animate({ scrollTop: $(myHash).offset().top }, 100); //�������� �� ����������
+ }
+};
// scrollToLink();
-// function scrollLink() {
-
-// document.addEventListener("DOMContentLoaded", function () {
-
-// const hash = decodeURIComponent(window.location.hash.slice(1)); // убираем '#' и декодим
-
-// if (hash) {
-
-// const target = document.querySelector(`[data-unique="${hash}"]`);
-
-// if (target) {
-
-// target.scrollIntoView({ behavior: "smooth" });
-
-// }
-
-// }
-
-// });
-
-// }
-
-// scrollLink();
+function scrollLink() {
+ document.addEventListener("DOMContentLoaded", function () {
+ const hash = decodeURIComponent(window.location.hash.slice(1)); // убираем '#' и декодим
+ if (hash) {
+ const target = document.querySelector(`[data-unique="${hash}"]`);
+ if (target) {
+ target.scrollIntoView({ behavior: "smooth" });
+ }
+ }
+ });
+}
+scrollLink();
const createVersionNode = (title, className) => {
const articleNode = document.querySelector(".topic__title");
-
const pVersion = document.createElement("p");
-
pVersion.innerText = title;
-
pVersion.classList.add(className);
-
articleNode.append(pVersion);
};
-const {
- href,
-
- pathname,
-} = window.location;
-
+const { href, pathname } = window.location;
let locale = getLocale();
-
const pathnameArr = pathname.split("/");
-
let currentPage = pathnameArr[pathnameArr.length - 1] || null;
//���� �� ��������� ��������, ������ ���������� ������ � �����
-
const changeHeaderLinks = () => {
const host = "elma4.sarl.inner.elma365.com";
-
const path = "/ru/platform/";
-
const headerLinks = document.querySelector(".header__list");
-
const footerList = document.querySelector(".footer-mobile__list");
-
const appendList = ``;
if (window.location.host === host) {
if (window.location.pathname !== path) {
headerLinks.insertAdjacentHTML("beforeend", appendList);
-
footerList.insertAdjacentHTML("beforeend", appendList);
}
}
};
-
//changeHeaderLinks()
// standard example
-
function findExampleContent(node, container, endString) {
if (
node.classList.contains("p_CodeExample") &&
@@ -201,68 +139,48 @@ function findExampleContent(node, container, endString) {
node.firstElementChild.innerText.toLowerCase().includes(endString)
) {
node.remove();
-
return;
}
-
const nextElement = node.nextElementSibling;
-
container.append(node);
-
findExampleContent(nextElement, container, endString);
}
function createNotation(item, notationType, endString) {
const container = document.createElement("div");
-
const exampleTitle = item.nextElementSibling;
-
const nextSibling = exampleTitle.nextElementSibling;
container.classList.add(notationType);
-
exampleTitle.classList.add(notationType + "__title");
-
container.append(exampleTitle);
-
findExampleContent(nextSibling, container, endString);
-
item.after(container);
-
item.remove();
}
function getArticleName(url) {
const arrFromUrl = url.split("/");
-
const lastPath = arrFromUrl[arrFromUrl.length - 1];
-
return lastPath.split(".")[0];
}
function removeCollapsedClass(node, tagName, className) {
const closestNode = node.closest(tagName);
-
if (!closestNode) {
return;
}
-
closestNode.classList.remove(className);
-
removeCollapsedClass(closestNode.parentElement, tagName, className);
}
function loadBottomLinks() {
const toc = document.querySelector("#toc");
-
const bottomLinks = document.querySelectorAll(".bottom-nav__link");
-
if (toc && bottomLinks.length) {
bottomLinks.forEach((link) => {
const path = `a[href="${link.innerText}"]`;
-
const targetLink = toc.querySelector(path);
-
link.innerText = targetLink.innerText;
});
}
@@ -270,32 +188,25 @@ function loadBottomLinks() {
function hideAllSideUls() {
const hidingMenu = document.querySelectorAll("#toc li ul");
-
hidingMenu.forEach((item) => {
item.classList.add("hide-side-menu-item");
-
item.closest("li").classList.add("collapsed");
});
}
function toggleUlsLinksHandler(menu, link) {
menu.forEach((link) => link.classList.remove("active-side-menu"));
-
link.classList.add("active-side-menu");
-
removeCollapsedClass(link, "ul", "hide-side-menu-item");
-
if (
link.nextElementSibling &&
link.nextElementSibling.classList.contains("hide-side-menu-item")
) {
removeCollapsedClass(link, "li", "collapsed");
-
link.nextElementSibling.classList.remove("hide-side-menu-item");
} else {
removeCollapsedClass(link, "li", "collapsed");
}
-
setTimeout(() => {
scrollToSelector(".active-side-menu");
}, 100);
@@ -303,28 +214,19 @@ function toggleUlsLinksHandler(menu, link) {
function scrollToSelector(selector) {
// document.body.style.position = 'fixed';
-
document.querySelector(".sidebar__wrapper").style.position = "fixed";
-
document
-
.querySelector(selector)
-
.scrollIntoView({ behavior: "smooth", block: "center" });
-
document.querySelector(".sidebar__wrapper").style.position = "sticky";
-
// document.body.style.position = 'unset';
}
function toggleUlsHandler() {
const tocNode = document.querySelector("#toc");
-
if (tocNode) {
const linksMenu = tocNode.querySelectorAll("a");
-
const activeItem = getArticleName(window.location.pathname);
-
linksMenu.forEach((link) => {
if (getArticleName(link.pathname) === activeItem) {
toggleUlsLinksHandler(linksMenu, link);
@@ -335,37 +237,29 @@ function toggleUlsHandler() {
function prepareContent() {
const commerceId = document.getElementById("commerce");
-
const communityId = document.getElementById("community");
href.includes("zoom_highlightsub") &&
$("body").addClass("--highlight-disabled");
//Set document title
-
const h1pageTitle = document.querySelector("h1 span.f_Heading1");
-
if (h1pageTitle) {
document.querySelector("title").innerText = h1pageTitle.innerText;
}
-
if (commerceId || communityId) {
commerceId
? (commerceId.style.display = "none")
: (communityId.style.display = "none");
-
commerceId
? createVersionNode("Enterprise", "pCommerce")
: createVersionNode("Community Edition", "pCommunity");
}
-
hideAllSideUls();
-
toggleUlsHandler();
const visibleSideBar = (sidebar) => {
const input = sidebar.querySelector('input[type="checkbox"]');
-
let isVisible = false;
input.addEventListener("change", () => {
@@ -378,55 +272,35 @@ function prepareContent() {
}
});
};
-
//TODO навигация по статье (якори)
-
const toc2 = document.getElementById("toc2");
-
if (toc2) {
const toc2Wrapper = document.querySelector(".article__sidebar");
-
if (!toc2.dataset.tocInitialized) {
$("#toc2").tocify({
context: "section.article__content",
-
selectors: "h2, h3",
-
extendPage: false,
});
-
toc2.dataset.tocInitialized = "true";
}
-
// $("#toc2").tocify({
-
// context: "section.article__content",
-
// selectors: "h2, h3",
-
// extendPage: false,
-
// });
-
const points = toc2.querySelectorAll("a");
-
if (points.length > 0) {
points.forEach((point) => {
if (!point.innerText.trim()) {
point.remove();
}
});
-
toc2Wrapper.style.display = "block";
-
visibleSideBar(toc2Wrapper);
-
// document.querySelector("body").classList.add(".scroll-nav");
-
// setTimeout(() => {
-
// document.querySelector("body").classList.remove(".scroll-nav");
-
// }, 500);
} else {
toc2Wrapper.style.display = "none";
@@ -434,14 +308,12 @@ function prepareContent() {
}
const images = document.querySelectorAll(".p_Normal > img");
-
images.forEach(
(image) =>
image.closest("p") && image.closest("p").classList.add("image-container")
);
const breadcrumbs = document.querySelector(".topic__breadcrumbs");
-
if (breadcrumbs && breadcrumbs.firstElementChild) {
breadcrumbs.firstElementChild.childNodes.forEach((node) => {
if (node.nodeValue && node.nodeValue.includes(">")) {
@@ -450,18 +322,17 @@ function prepareContent() {
});
}
- const spans = document.querySelectorAll("span");
-
- if (spans.length) {
- spans.forEach((span) => {
- if (span.innerHTML === " ") {
- span.remove();
- }
- });
- }
+ // const spans = document.querySelectorAll('span');
+ // if (spans.length) {
+ // spans.forEach(span => {
+ // if (span.innerHTML === ' ') {
+ // span.remove();
+ // console.log(span.innerHTML);
+ // }
+ // });
+ // }
// example exapand
-
const examplesToggle = document.querySelectorAll(
'a[class="dropdown-toggle"]'
);
@@ -476,54 +347,37 @@ function prepareContent() {
example.parentElement.tagName === "p"
? example.parentElement
: example.closest("p");
-
const nextSiblingDiv = parentP.nextElementSibling;
-
if (nextSiblingDiv && nextSiblingDiv.tagName === "DIV") {
parentP.classList.add("example");
-
const id = nextSiblingDiv.id;
-
const button = document.createElement("a");
-
const obj = nextSiblingDiv.attributes;
-
let expandState = "0";
-
parentP.setAttribute("data-state", expandState);
-
button.classList.add("btn-example");
-
button.innerHTML =
locale === "ru"
? 'СвернутьПосмотреть полностью'
: 'HideShow all';
-
button.addEventListener("click", (evt) => {
evt.preventDefault();
-
window.HMToggle("toggle", id);
-
Object.entries(obj).map((el) => {
if (el[1].name === "hm.state") {
expandState = el[1].value;
-
parentP.setAttribute("data-state", expandState);
}
});
});
-
parentP.append(button);
-
example.setAttribute("href", "javascript:void(0)");
-
example.after(nextSiblingDiv);
}
});
}
const pArray = document.querySelectorAll(".p_Normal");
-
if (pArray.length) {
pArray.forEach((p) => {
if (p.innerHTML === " ") {
@@ -533,11 +387,9 @@ function prepareContent() {
}
const examples = document.querySelectorAll("p.p_CodeExample");
-
if (examples.length) {
examples.forEach((example) => {
const childSpan = example.firstElementChild;
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -545,7 +397,6 @@ function prepareContent() {
) {
createNotation(example, "example", "примера");
}
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -553,7 +404,6 @@ function prepareContent() {
) {
createNotation(example, "warning", "внимание");
}
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -565,22 +415,15 @@ function prepareContent() {
}
//small icon
-
const icons = document.querySelectorAll(".content img");
-
if (icons.length) {
icons.forEach((icon, idx) => {
const iconWidth = parseInt(icon.width);
-
const floated = icon.style.float;
-
floated !== "" && icon.classList.add("img-float--" + floated);
-
if (iconWidth < 200) {
icon.classList.add("small-img");
-
const iconHeight = parseInt(icon.height);
-
if (
iconWidth > 70 &&
iconHeight > 70 &&
@@ -593,33 +436,28 @@ function prepareContent() {
});
}
}
-
//TODO скрытие хедера
-
function stickyHeader() {
var lastScrollTop = 0;
-
var delta = 15;
-
$(window)
.on("scroll", function () {
var st = $(this).scrollTop();
-
if (Math.abs(lastScrollTop - st) <= delta) return;
-
if (st > lastScrollTop && lastScrollTop > 0) {
$("body").addClass("--header-hidden");
-
$(".solution-select__list").removeClass("active");
-
$(".solution-select").removeClass("active");
} else {
$("body").removeClass("--header-hidden");
-
$(".solution-select__list").removeClass("active");
-
$(".solution-select").removeClass("active");
}
+ //TEST
+ // if (document.querySelector("body").classList.contains(".scroll-nav")) {
+ // $("body").addClass("--header-hidden");
+ // }
+ //TEST
lastScrollTop = st;
})
@@ -640,35 +478,23 @@ $(window).resize(function () {
function iconsTableOfContents() {
const toggledLi = document.querySelectorAll('li[data-bg*="collapsed"]');
-
toggledLi.forEach((li) => li.classList.add("toggled"));
}
$(document).ready(function () {
prepareContent();
-
toggleUlsHandler();
-
- //TODO вызов хедера
-
+ //TODO вызов скрытия хедера
// stickyHeader();
$("#side-menu").load("index.html #toc", function () {
- //TODO ререндер toc
-
- // window.addEventListener('popstate', () => {
-
- // // $(".article-inner").empty();
-
- // $('#article').load(`${window.location.href} .article-inner`, function () {
-
+ //TODO вызавает каждый раз ререндер при изменении href(добавление якоря как например)
+ // window.addEventListener("popstate", () => {
+ // $("#article").load(`${window.location.href} .article-inner`, function () {
// loadBottomLinks();
-
// prepareContent();
-
// });
-
- // })
+ // });
function onUrlChange(callback) {
const originalPushState = history.pushState;
@@ -731,50 +557,56 @@ $(document).ready(function () {
});
// Дополнительно: обработка void-ссылок
- document.querySelectorAll('a[href^="javascript:"]').forEach((link) => {
- link.addEventListener("click", (e) => {
- e.preventDefault();
- // Можно добавить здесь свою логику обработки клика
- });
- });
+ // document.querySelectorAll('a[href^="javascript:"]').forEach((link) => {
+ // link.addEventListener("click", (e) => {
+ // e.preventDefault();
+ // // Можно добавить здесь свою логику обработки клика
+ // });
+ // });
//
-
loadBottomLinks();
-
hideAllSideUls();
-
toggleUlsHandler();
-
document.addEventListener("DOMContentLoaded", () => {
if (document.visibilityState === "visible") {
hideAllSideUls();
}
});
+ //toc
+ function tryHideSideUlsWhenActive() {
+ if (document.visibilityState === "visible") {
+ hideAllSideUls();
+ } else {
+ document.addEventListener(
+ "visibilitychange",
+ () => {
+ if (document.visibilityState === "visible") {
+ hideAllSideUls();
+ }
+ },
+ { once: true }
+ );
+ }
+ }
+
+ document.addEventListener("DOMContentLoaded", tryHideSideUlsWhenActive);
const menuItems = this.querySelectorAll("a");
-
menuItems.forEach((item) => {
item.addEventListener("click", (evt) => {
evt.preventDefault();
-
const url =
evt.target.nodeName === "A"
? evt.target.href
: evt.target.closest("a").href;
-
const sideMenu = document.querySelector(".sidebar");
-
const htmlTag = document.querySelector("html");
-
const toggledLi = document.querySelectorAll('li[data-bg*="collapsed"]');
window.scrollTo(0, 0);
-
htmlTag.classList.remove("--locked");
-
$("body").removeClass("index-page search-page");
-
sideMenu.classList.remove("show-side-menu");
if (toggledLi.length) {
@@ -786,42 +618,17 @@ $(document).ready(function () {
if (url !== window.location.href) {
if (!url.includes("javascript:void")) {
$(".article-inner").empty();
-
$("#article").load(`${url} .article-inner`, function () {
history.pushState({}, null, url);
-
//metaDecsription.attr('content', metaDescriptionInitial);
-
loadBottomLinks();
-
prepareContent();
});
} else {
- // const _target = evt.target;
-
- // const _targetUl = _target.parentElement.nextElementSibling;
-
- // if (_target.nodeName === "SPAN" && _targetUl.nodeName === "UL" && _targetUl.classList.contains("hide-side-menu-item")) {
-
- // _targetUl.querySelectorAll('a')[0].click();
-
- // } else {
-
- // const _ul = _target.parentElement.querySelectorAll('a')[0].nextElementSibling;
-
- // if (_ul.nodeName === "UL") {
-
- // _ul.querySelectorAll('a')[0].click();
-
- // };
-
- // }
-
+ //TEST
function isFakeLink(link) {
if (!link) return false;
-
const href = link.getAttribute("href");
-
return href === "#" || href === "javascript:void(0);";
}
@@ -831,45 +638,34 @@ $(document).ready(function () {
function findFirstLinkInElement(element) {
if (!element) return null;
-
return element.querySelector("a");
}
function findFirstRealNestedLink(element) {
if (!element) return null;
-
const links = element.querySelectorAll("a");
-
for (const link of links) {
if (isRealLink(link)) return link;
}
-
return null;
}
document.addEventListener("click", (evt) => {
const _target = evt.target;
-
if (_target.nodeName !== "SPAN") return;
const _targetLi = _target.closest("li");
-
if (!_targetLi) return;
const submenu = _targetLi.querySelector("ul");
-
const firstLink = findFirstLinkInElement(_targetLi);
// заглушки
-
if (firstLink && isFakeLink(firstLink)) {
const nestedReal = findFirstRealNestedLink(submenu);
-
if (nestedReal) {
nestedReal.click();
-
// в первом фрагменте, после nestedReal.click();
-
setTimeout(() => {
document.dispatchEvent(new Event("subcategory:update"));
}, 50);
@@ -881,6 +677,7 @@ $(document).ready(function () {
firstLink.click(); // кликаем по нормальной ссылке
}
});
+ //TEST
}
}
});
@@ -890,28 +687,20 @@ $(document).ready(function () {
const obj = pagedata.reduce((acc, words) => {
const searchObj = {
title: words[1],
-
link: words[0],
};
-
return [...acc, searchObj];
}, []);
-
$(".search-form__input").each(function () {
var _that = $(this);
-
var _searchForm = _that.parent();
-
_that
.autocomplete({
autoFocus: false,
-
minLength: 2,
-
focus: function (event, ui) {
itemUiLinkSelected = ui.item.link;
},
-
source: function (request, response) {
const results = obj.filter(
(item) =>
@@ -920,9 +709,7 @@ $(document).ready(function () {
.includes(request.term.toLowerCase()) &&
document.querySelector(`a[href="${item.link.slice(2)}"]`)
);
-
const sliceResults = results.slice(0, 5);
-
sliceResults.map((result) => {
const aItem = document.querySelector(
`a[href="${result.link.slice(2)}"]`
@@ -930,7 +717,6 @@ $(document).ready(function () {
if (aItem) {
const parent = aItem.closest("li.heading1");
-
result.breadcrumb =
parent.querySelector("span.heading1").innerText;
} else {
@@ -949,7 +735,6 @@ $(document).ready(function () {
item.breadcrumb || ""
}`
)
-
.appendTo(ul);
};
@@ -963,15 +748,10 @@ $(document).ready(function () {
$(".glossary-abc__nav a").on("click", function (e) {
e.preventDefault();
-
var target = $(this).attr("href");
-
console.log($(this).parent().siblings());
-
$(".glossary-abc__nav a").removeClass("--active");
-
$(this).addClass("--active");
-
$("html, body").animate(
{
scrollTop: $(target).offset().top - 150,
@@ -980,33 +760,39 @@ $(document).ready(function () {
);
});
- // Хлебные крошки на странице поиска
+ const name = "Сайт ELMA365";
+ const cusLi = document.createElement("li");
+ cusLi.classList.add("heading1");
+ cusLi.classList.add("heading10");
+ const cusA = document.createElement("a");
+ cusA.classList.add("heading1");
+ cusA.setAttribute("href", "https://elma365.com/ru/");
+ cusA.setAttribute("target", "_blank");
+ const cusSpan = document.createElement("span");
+ cusSpan.classList.add("heading1");
+ cusSpan.textContent = name;
+ cusA.appendChild(cusSpan);
+ cusLi.appendChild(cusA);
+ document.querySelector("#toc").prepend(cusLi);
+ // Хлебные крошки на странице поиска
function findPrevBreadcrumbs(node, breadcrumbs) {
var breadcrumbsNew =
breadcrumbs || $('');
-
var prevParentEl = node.closest("ul") ? node.closest("ul").prev() : null;
-
if (!prevParentEl[0] || prevParentEl[0].tagName !== "A") {
return breadcrumbsNew;
}
-
breadcrumbsNew.prepend(' / ');
-
breadcrumbsNew.prepend(prevParentEl.clone());
-
return findPrevBreadcrumbs(prevParentEl, breadcrumbsNew);
}
$(".result_title a").each(function () {
var bc = "";
-
var currentArticleName = $(this);
-
$("#toc a span").each(function () {
var tocCurrentNode = $(this);
-
if (tocCurrentNode.text().trim() === currentArticleName.text().trim()) {
bc = findPrevBreadcrumbs(tocCurrentNode);
}
@@ -1019,56 +805,16 @@ $(document).ready(function () {
});
});
-//let scrollPos = 0;
-
-/* $('body').scroll(function () {
-
- let st = $(this).scrollTop();
-
- if (st > scrollPos) {
-
- $('.scroll-top').hide();
-
- } else {
-
- $('.scroll-top').show();
-
- }
-
- scrollPos = st;
-
-});
-
-
-
-$('.scroll-top').on('click', function (e) {
-
- e.preventDefault();
-
- $('html, body').animate({
-
- scrollTop: 0
-
- });
-
-}); */
-
//side menu mobile
-
const sideMenuIcon = document.querySelector("#side-menu-icon");
-
const htmlTag = document.querySelector("html");
-
const sideMenu = document.querySelector("#sidebar");
-
const closeButton = document.querySelector("#close");
if (sideMenuIcon) {
sideMenuIcon.addEventListener("click", (evt) => {
evt.preventDefault();
-
sideMenu.classList.toggle("show-side-menu");
-
htmlTag.classList.toggle("--locked");
});
}
@@ -1076,15 +822,12 @@ if (sideMenuIcon) {
if (closeButton) {
closeButton.addEventListener("click", (e) => {
e.preventDefault();
-
sideMenu.classList.remove("show-side-menu");
-
htmlTag.classList.remove("--locked");
});
}
var triggerTitleMegaGuide = false;
-
if (getTitleSite() === "Mega Guide" || /hmftsearch.html/i.test(href)) {
triggerTitleMegaGuide = true;
}
@@ -1102,9 +845,6 @@ function getTitleSite() {
const currentUrl = window.location.href;
if (
- /http:\/\/localhost/i.test(currentUrl) ||
- /brix365.t-elma365\/en\/help/i.test(currentUrl) ||
- /brix365.com\/en\/help/i.test(currentUrl) ||
/elma365.com\/ru\/help/i.test(currentUrl) ||
/elma365.com\/en\/help/i.test(currentUrl) ||
/elma365\/help\/ru/i.test(currentUrl) ||
@@ -1114,44 +854,29 @@ if (
) {
window.addEventListener("load", () => {
const searchIcon = document.querySelector("#search-icon");
-
const searchPanel = document.querySelector("#search-panel");
-
const searchInput = searchPanel.querySelector('input[type="text"]');
-
const heroSearch = document.querySelector(".hero__search");
-
if (searchIcon) {
searchIcon.addEventListener("click", (evt) => {
- console.log(searchIcon);
-
evt.preventDefault();
-
searchPanel.classList.toggle("show-search-panel");
-
setTimeout(() => searchInput.focus(), 500);
heroSearch.classList.add("hero__search--active");
});
- } else {
- console.log("error");
}
-
if (searchInput) {
const label = searchInput.closest("label");
-
searchInput.addEventListener("blur", () => {
searchPanel.classList.remove("show-search-panel");
-
heroSearch.classList.remove("hero__search--active");
-
if (searchInput.value) {
label.classList.add("cross");
} else {
label.classList.remove("cross");
}
});
-
searchInput.addEventListener("focus", () => {
label.classList.add("cross");
});
@@ -1167,15 +892,12 @@ if (
$(".arrow-top").click(function () {
$("html, body").animate({ scrollTop: 0 }, 600);
-
return false;
});
// очистить поиск
-
if (document.querySelector("#reset-search")) {
const resetButton = document.querySelector("#reset-search");
-
resetButton.addEventListener("click", () => {
searchInput.value = "";
});
@@ -1190,84 +912,37 @@ if (
wrapperSearch.classList.add("search-form__label");
const tagSpanIcons = document.createElement("span");
-
tagSpanIcons.className = "search__icon";
-
tagSpanIcons.setAttribute("id", "reset-search");
-
wrapperSearch.prepend(tagSpanIcons);
- // const insertInnerHtml = document.querySelector('tr .ya-site-form__search-input-layout-l');
-
- // const divBlockHeroSearch = document.createElement('div');
-
- //
-
- // divBlockHeroSearch.classList.add('hero__search')
-
- // divBlockHeroSearch.innerHTML = `
-
- //
-
- //
-
- //
-
- //
-
- // `;
-
- // setTimeout(() => {
-
- // insertInnerHtml.appendChild(divBlockHeroSearch);
-
- // }, 1000);
-
const searchIcon = document.querySelector("#search-icon");
-
const searchPanel = document.querySelector(
".ya-site-form.ya-site-form_bg_transparent.ya-site-form_inited_yes"
);
-
const searchInput = searchPanel.querySelector('input[type="search"]');
-
const heroSearch = document.querySelector(".hero__search");
-
if (searchIcon) {
searchIcon.addEventListener("click", (evt) => {
- console.log(searchIcon);
-
evt.preventDefault();
-
searchPanel.classList.toggle("show-search-panel");
-
setTimeout(() => searchInput.focus(), 500);
-
heroSearch.classList.add("hero__search--active");
});
}
-
if (searchInput) {
const div = searchInput.closest(".ya-site-form__input");
-
searchInput.addEventListener("blur", searchWatch);
function searchWatch() {
searchPanel.classList.remove("show-search-panel");
-
heroSearch.classList.remove("hero__search--active");
-
if (searchInput.value !== "") {
div.classList.add("cross");
} else {
div.classList.remove("cross");
}
}
-
searchInput.addEventListener("focus", () => {
div.classList.add("cross");
});
@@ -1283,21 +958,15 @@ if (
$(".arrow-top").click(function () {
$("html, body").animate({ scrollTop: 0 }, 600);
-
return false;
});
// очистить поиск
-
const resetButton = document.querySelector("#reset-search");
-
resetButton.addEventListener("click", () => {
searchInput.value = "";
-
searchInput.focus();
-
baseUrl = window.location.href.split("?")[0];
-
window.history.pushState("name", "", baseUrl);
});
});
@@ -1311,29 +980,20 @@ function searchFormHeader() {
$(".search-form").each(function () {
$(this).on("submit", (evt) => {
evt.preventDefault();
-
evt.stopPropagation();
-
var searchStr = evt.target[0].value;
-
if (searchStr.trim()) {
if (
(/elma365.com\/ru\/help/i.test(window.location.href) ||
/elma365.com\/en\/help/i.test(window.location.href) ||
/t-elma365.com/i.test(window.location.href) ||
- /brix365.com\/en\/help/i.test(window.location.href) ||
/([\d+]{3}).(\d).(\d).(\d)/i.test(window.location.href) ||
/http:\/\/localhost/i.test(window.location.href)) &&
!triggerTitleMegaGuide
) {
window.location.href = `./search.html?query=${searchStr}`;
- }
-
- //фикс поиска, тест
- else {
- // window.location.href = `./hmftsearch.html?zoom_query=${searchStr}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
- window.location.href = `./search.html?query=${searchStr}`;
+ } else {
+ window.location.href = `./hmftsearch.html?zoom_query=${searchStr}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
}
}
});
@@ -1347,41 +1007,28 @@ if (
Boolean(document.querySelector(".searchheading"))
) {
const searchTitle = document.querySelector(".searchheading");
-
const queryString = window.location.search;
-
let currentPageNumber = null;
const searchParams = queryString.split("&");
-
searchParams.forEach((param) => {
const paramArr = param.split("=");
-
if (paramArr[0] === "zoom_page") {
currentPageNumber = +paramArr[1];
}
});
-
const searchWord = decodeURI(searchParams[0].split("=")[1]);
-
searchTitle.innerText =
locale === "ru" ? "Результаты поиска:" : "Search results for:";
-
const searchWordP = document.createElement("p");
-
searchWordP.classList.add("search-word");
-
searchWordP.innerText = searchWord;
-
searchTitle.append(searchWordP);
let pagesCount = "0";
-
const resultPagesCount = document.querySelector(".result_pagescount");
-
if (resultPagesCount) {
pagesCount = parseInt(resultPagesCount.innerText.trim());
-
resultPagesCount.remove();
}
@@ -1389,109 +1036,62 @@ if (
switch (currentPage) {
case "first-page": {
resultPages[0].textContent = "<< < ";
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = "1";
-
resultPages[0].after(span);
-
const aEnd = document.createElement("a");
-
const urlEnd = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=${pagesCount}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aEnd.setAttribute("href", urlEnd);
-
aEnd.textContent = " >>";
-
// resultPages[resultPages.length - 1].textContent = ' >>';
-
resultPages[resultPages.length - 1].after(aEnd);
-
resultPages[resultPages.length - 2].remove();
-
resultPages[resultPages.length - 2].textContent = " > ";
-
break;
}
-
case "last-page": {
resultPages[resultPages.length - 1].textContent = ` > >>`;
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = currentPageNumber;
-
const aBegin = document.createElement("a");
-
const urlBegin = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=1&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aBegin.setAttribute("href", urlBegin);
-
aBegin.textContent = "<< ";
-
resultPages[resultPages.length - 1].before(span);
-
// resultPages[0].textContent = '<< ';
-
resultPages[1].before(aBegin);
-
resultPages[0].remove();
-
resultPages[1].textContent = "< ";
-
break;
}
-
case "default-page": {
const aBegin = document.createElement("a");
-
const aEnd = document.createElement("a");
-
const urlBegin = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=1&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
const urlEnd = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=${pagesCount}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aBegin.setAttribute("href", urlBegin);
-
aBegin.textContent = "<< ";
-
aEnd.setAttribute("href", urlEnd);
-
aEnd.textContent = " >>";
-
resultPages[1].before(aBegin);
-
resultPages[0].remove();
-
//resultPages[0].textContent = '<< ';
-
//resultPages[0] = aBegin;
-
resultPages[1].textContent = " < ";
-
resultPages[resultPages.length - 2].textContent = " > ";
-
//resultPages[resultPages.length - 1].textContent = ' >> ';
-
resultPages[resultPages.length - 2].after(aEnd);
-
resultPages[resultPages.length - 1].remove();
-
break;
}
-
default:
break;
}
}
const resultPagesNode = document.querySelector(".result_pages");
-
const resultPages = resultPagesNode
? document.querySelector(".result_pages").childNodes
: [];
@@ -1516,15 +1116,10 @@ if (
resultPages.forEach((node) => {
if (+node.textContent.trim() === currentPageNumber) {
const nextElement = node.nextSibling;
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = currentPageNumber;
-
nextElement.before(span);
-
node.remove();
}
});
@@ -1532,33 +1127,17 @@ if (
}
const summary = document.querySelectorAll(".summary");
-
if (summary.length > 0 && locale === "ru") {
const count = parseInt(summary[0].innerText.trim());
-
summary[0].innerText = count
? `Найдено совпадений: ${count}`
: (summary.innerText = "Совпадений не найдено");
}
}
-// подменяет текст в абзаце в зависимости от атрибута lang
-
-// if (document.documentElement.lang === "en") {
-
-// $('#found_typo').html('Found a typo? Highlight the text, press ctrl + enter and notify us')
-
-// } else if (document.documentElement.lang === "ru") {
-
-// $('#found_typo').html('Нашли опечатку? Выделите текст, нажмите ctrl + enter и оповестите нас')
-
-// }
-
$(window).on("load", () => {
// правит текст в фильтре результатов поиска
-
// $('.b-loader__wrapper').css('opacity', 0);
-
function replace() {
var intervalReplace = setInterval(() => {
if (
@@ -1574,20 +1153,17 @@ $(window).on("load", () => {
setTimeout(() => {
clearInterval(intervalReplace);
-
// }, 180000);
}, 10000);
function t() {
if (document.documentElement.lang === "en") {
textResult("нашёл", "Matches found", "all resourses", 13);
-
textFindSection("Search through ");
}
if (document.documentElement.lang === "ru") {
textResult("нашёл", "Найдено совпадений", "всем ресурсам", 18);
-
textFindSection("Искать по ");
}
@@ -1596,14 +1172,11 @@ $(window).on("load", () => {
searchAny = $(
".b-dropdowna__switcher .b-pseudo-link_is-bem_yes"
).text();
-
var e = text.replace(textFound, textFoundRes),
t = searchAny.replace("любой", textAny);
-
$("tr td.b-head__r .b-head__found").text(
e.substring(0, n) + ": " + parseInt(text.match(/\d+/))
);
-
$(".b-dropdowna__switcher .b-pseudo-link_is-bem_yes").text(t);
if ($("tr td.b-head__r .b-head__found").text().indexOf("найдёт") == 0) {
@@ -1637,11 +1210,8 @@ $(window).on("load", () => {
if (i > 0) {
if (element.childNodes[0].textContent.indexOf("раздел") === 0) {
var htmlTag = [];
-
htmlTag.push(element.childNodes[i]);
-
element.textContent = textResSection;
-
htmlTag.forEach((item) => {
element.appendChild(item);
});
@@ -1666,7 +1236,6 @@ $(window).on("load", () => {
setTimeout(() => {
clearInterval(intervalAddElementSubsection);
-
// }, 180000)
}, 10000);
@@ -1680,71 +1249,48 @@ $(window).on("load", () => {
var textContent = $("yass-li.b-serp-item .b-serp-url__item")[index]
.textContent;
-
switch (true) {
// ELMA365
-
case /elma365.com\/ru\/help/i.test(textContent):
subsectionTitle("Справка");
-
break;
-
case /academy.com/i.test(textContent):
subsectionTitle("ELMA Academy");
-
break;
-
case /tssdk.elma/i.test(textContent):
subsectionTitle("TS SDK");
-
break;
-
case /exchange.elma/i.test(textContent):
subsectionTitle("ELMA365 Exchange");
-
break;
// Английская версия
-
case /en\/help/i.test(textContent):
subsectionTitle("Help");
-
break;
// rpa
-
case /rpa.ai\/ru/i.test(textContent):
subsectionTitle("RPA");
-
break;
// ELMA4
-
case /ru\/help4\/ecm/i.test(textContent):
subsectionTitle("ECM+");
-
break;
-
case /ru\/help4\/crm/i.test(textContent):
subsectionTitle("CRM+");
-
break;
-
case /ru\/help4\/projects/i.test(textContent):
subsectionTitle("Проекты");
-
break;
-
case /elma-bpm.ru\/help4/i.test(textContent):
subsectionTitle("BPM");
-
break;
-
case /ru\/KB/i.test(textContent) ||
/elma-bpm.ru\/…help/i.test(textContent) ||
/help/i.test(textContent):
subsectionTitle("База знаний");
-
break;
}
@@ -1753,11 +1299,8 @@ $(window).on("load", () => {
$(".subsection-title")[index].textContent = text;
} else {
var newBlockDiv = document.createElement("div");
-
newBlockDiv.classList.add("subsection-title");
-
newBlockDiv.textContent = text;
-
$(".b-serp-item__title")[index].prepend(newBlockDiv);
}
}
@@ -1775,20 +1318,16 @@ $(window).on("load", () => {
if ($("tr td.b-head__r .b-head__found")) {
var intervalTimer = setInterval(() => {
replace();
-
addElementSubsection();
}, 200);
// через 3 минуты интервал останавливается (время взято примерно, чтобы успело все прогрузиться)
-
setTimeout(() => {
clearInterval(intervalTimer);
-
// }, 180000);
}, 10000);
} else {
replace();
-
addElementSubsection();
}
});
@@ -1797,41 +1336,25 @@ $(window).on("load", () => {
const leadhandler = "https://web.s-elma365.ru";
var rootNode = document.createElement("div");
-
document.body.appendChild(rootNode);
-
var typo = new TypoReporter(
{
formId: "1FAIpQLSfXEIXAFoOiHgetf0reIjWrOAw6V7KCZrhAv8VVD6WL7Rs46g", // required, see previous step
// Optional example stuff below
-
locale: getLocale(), // optional language, defaults to 'en'
-
// translations: { // optinal object with translated strings
-
// fr: {
-
// // see source code for keys to translate
-
// },
-
// ru: {
-
//
-
// }
-
// },
-
offset: 100, // amount of context text to grab from before and after the selection, defaults to 50
-
endpointUrl: leadhandler + "/api/baglist/", // optional, defaults to Google Forms
-
snippetFieldName: "typo", // optional, if using custom form
-
commentFieldName: "comment", // optional, if using custom form
-
urlFieldName: "url", // optional, if using custom form
},
rootNode
@@ -1839,14 +1362,12 @@ var typo = new TypoReporter(
$(document).on("focus", ".fill_listener", function () {
//console.log("test");
-
$(this).parent().addClass("focused");
});
$(document).on("blur", ".fill_listener", function () {
$(this).parent().removeClass("focused");
});
-
$(document).on("change", ".fill_listener", function () {
if ($(this).val().length) {
$(this).parent().addClass("filled");
@@ -1858,21 +1379,16 @@ $(document).on("change", ".fill_listener", function () {
function feedbackSubmit() {
$("#feedback-form").on("submit", function () {
var $form = $(this);
-
var formData = $form.serializeArray().slice(0, -1);
-
var context = {};
$(formData).each(function (index, obj) {
if (obj.name === "useful" && obj.value === "true") {
context.other = "";
-
context.useful = true;
-
context.category = [
{
code: "",
-
name: "",
},
];
@@ -1883,14 +1399,11 @@ function feedbackSubmit() {
if (obj.name === "other") {
context.other = obj.value;
}
-
context.useful = false;
-
if (obj.name === "category") {
context.category = [
{
code: obj.value,
-
name: $form.find('option[value="' + obj.value + '"]').text(),
},
];
@@ -1900,18 +1413,13 @@ function feedbackSubmit() {
});
context.produkt = ["6b55aead-f008-42c7-9186-0806c06d4f2c"];
-
context.link = window.location.href;
-
var data = {
context,
};
-
var request = $.ajax({
type: "POST",
-
url: leadhandler + "/api/feedback/create",
-
data: JSON.stringify(data),
})
.fail(function (response) {
@@ -1920,7 +1428,6 @@ function feedbackSubmit() {
.done(function (response) {
return response;
});
-
return false;
});
}
@@ -1936,32 +1443,23 @@ $(document).ready(function () {
var $form = $(this),
textarea = $form.find('textarea[name="help_question"]'),
//formData = $form.serializeArray().slice(0, -1),
-
context = {};
context.other = textarea.val();
-
context.category = [
{
code: "question",
-
name: "Задать вопрос",
},
];
-
context.produkt = ["6b55aead-f008-42c7-9186-0806c06d4f2c"];
-
context.link = window.location.href;
-
var data = {
context,
};
-
var request = $.ajax({
type: "POST",
-
url: leadhandler + "/api/feedback/create",
-
data: JSON.stringify(data),
})
.fail(function (response) {
@@ -1972,23 +1470,18 @@ $(document).ready(function () {
.parent()
.find(".question-success")
.removeClass("hidden");
-
setTimeout(() => {
$(".question-xs").attr("style", "display:none;");
-
textarea.val("");
});
-
setTimeout(() => {
$(".question__popup")
.parent()
.find(".question-success")
.addClass("hidden");
-
$(".question").removeClass("active");
}, 3000);
});
-
return false;
});
});
@@ -1998,7 +1491,6 @@ function question() {
const questionPopup = $(this).parent().find(".question-xs");
questionPopup.attr("style", "display:block;");
-
setTimeout(() => {
$(this).parent().find('textarea[name="help_question"]').focus();
}, 200);
@@ -2006,7 +1498,6 @@ function question() {
$(document).mouseup(function (e) {
let container = $(".question-xs");
-
if (!container.is(e.target) && container.has(e.target).length === 0) {
container.attr("style", "display:none;");
}
@@ -2018,12 +1509,9 @@ function question() {
$(".question-xs").on("submit", function () {
$(this).parent().find(".question-success-xs").removeClass("hidden");
-
$(this).removeClass("active");
-
setTimeout(() => {
$(this).parent().find(".question-success-xs").addClass("hidden");
-
$(this).addClass("active");
}, 3000);
});
@@ -2033,28 +1521,23 @@ question();
$(document).click(function (e) {
if ($(e.target).closest(".ReportTypo-popup").length != 0) return false;
-
$(".ReportTypo").fadeOut(100);
});
$(document).click(function (e) {
if ($(e.target).closest(".ReportTypo-popup").length != 0) return false;
-
$(".ReportTypo").fadeOut(100);
});
jQuery(function ($) {
$(document).mouseup(function (e) {
// ������� ����� �� ���-���������
-
var div = $("#feedback-form"); // ��� ��������� ID ��������
-
if (
!div.is(e.target) && // ���� ���� ��� �� �� ������ �����
div.has(e.target).length === 0
) {
// � �� �� ��� �������� ���������
-
$(".feedback-form").find("input:checked").removeAttr("checked");
}
});
@@ -2062,25 +1545,17 @@ jQuery(function ($) {
function feedback() {
const yesLabel = document.getElementById("feedback__useful_yes");
-
const thxWindow = document.getElementById("feedback__popup_thx");
-
const noLabel = document.getElementById("feedback__useful_no");
-
const feedbackWhyPopup = document.getElementById("feedback__popup_why");
-
const form = document.getElementById("feedback-form");
-
const otherInput = document.getElementById("other_reason");
-
const otherPopup = document.getElementById("feedback__popup-other");
-
const feedbackOtherBtn = document.querySelector(".feedback__other-btn");
const inputs = [
...document.querySelectorAll('#feedback__popup_why input[type="radio"]'),
];
-
const allRadio = inputs.filter((item) => item.id !== "other_reason");
allRadio.forEach((item) =>
@@ -2099,16 +1574,12 @@ function feedback() {
otherInput.addEventListener("change", (e) => {
if (e.target.checked) {
feedbackWhyPopup.style.display = "none";
-
otherPopup.style.display = "block";
-
$(".feedback__popup").find('textarea[name="other"]').focus();
feedbackOtherBtn.addEventListener("click", function () {
otherPopup.style.display = "none";
-
$("#feedback-success-popup").show();
-
setTimeout(() => {
$("#feedback-success-popup").hide();
}, 3000);
@@ -2122,9 +1593,7 @@ function feedback() {
if (Boolean(feedbackWhyPopup)) {
document.addEventListener("click", (e) => {
const target = e.target;
-
feedbackWhyPopup.style.display = "none";
-
thxWindow.style.display = "none";
if (target.matches("#feedback__useful_no")) {
@@ -2160,7 +1629,6 @@ $(window).on("load", function () {
document.querySelectorAll("main article section div")[1]
) {
let el = document.querySelectorAll("main article section div")[1];
-
el.setAttribute("id", "table-mobile-desktop_size");
}
});
@@ -2178,7 +1646,6 @@ if (document.querySelector("#side-menu")) {
document.querySelectorAll("main article section div")[1]
) {
let el = document.querySelectorAll("main article section div")[1];
-
el.setAttribute("id", "table-mobile-desktop_size");
}
}, 200);
@@ -2194,52 +1661,39 @@ if (document.querySelector("#side-menu")) {
if (document.getElementsByClassName("accordion-btn__show")) {
var showAccordionBtn = document.querySelector(".accordion-btn__show");
-
var elementAccordionHide = document.querySelector(".accordion__hide");
-
var linearGradient = document.querySelector(".linear-gradient");
-
var heightAccordionElem =
document.querySelector(".card-stack-50").scrollHeight;
var t = false;
-
showAccordionBtn.addEventListener("click", () => {
switch (true) {
case showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.contains("arrow__show"):
elementAccordionHide.classList.add("accordion__show");
-
elementAccordionHide.style.maxHeight = heightAccordionElem + "px";
-
elementAccordionHide.classList.remove("accordion__hide");
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.remove("arrow__show");
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.add("arrow__hide");
setTimeout(() => {
linearGradient.classList.remove("linear-gradient");
-
showAccordionBtn.querySelector("p").textContent = "Свернуть";
}, 1000);
-
break;
case showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.contains("arrow__hide"):
elementAccordionHide.classList.add("accordion__hide");
-
elementAccordionHide.classList.remove("accordion__show");
-
elementAccordionHide.style.maxHeight = "";
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.add("arrow__show");
@@ -2248,12 +1702,9 @@ if (document.getElementsByClassName("accordion-btn__show")) {
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.remove("arrow__hide");
-
linearGradient.classList.add("linear-gradient");
-
showAccordionBtn.querySelector("p").textContent = "Показать всё";
}, 1000);
-
break;
}
});
@@ -2266,7 +1717,6 @@ if (document.getElementsByClassName("accordion-btn__show")) {
(function () {
if (document.querySelector(".accordion__items")) {
var btn = document.querySelectorAll(".accordion__item-question");
-
var dehiscentItems = document.querySelectorAll(
".accordion__item-question-answer"
);
@@ -2279,11 +1729,8 @@ if (document.getElementsByClassName("accordion-btn__show")) {
removeActiveClass();
} else {
removeActiveClass();
-
this.classList.toggle("accordion__active");
-
nextEl.style.maxHeight = nextEl.scrollHeight + "px";
-
nextEl.style.marginBottom = "15px";
}
});
@@ -2296,7 +1743,6 @@ if (document.getElementsByClassName("accordion-btn__show")) {
dehiscentItems.forEach((i) => {
i.style.maxHeight = null;
-
i.style.marginBottom = null;
});
}
diff --git a/service/jquery.tocify.min.js b/service/jquery.tocify.min.js
index 55f8a9d..5051d08 100644
--- a/service/jquery.tocify.min.js
+++ b/service/jquery.tocify.min.js
@@ -1,5 +1,4 @@
-/*! jquery.tocify - v1.9.0 - 2013-10-01
-* http://gregfranko.com/jquery.tocify.js/
-* Copyright (c) 2013 Greg Franko; Licensed MIT*/
-
-!function(){"use strict";!function(r,d,c){"use strict";var o="tocify",e="tocify-focus",t="tocify-hover",n="tocify-hide",a="tocify-header",i="."+a,l="tocify-subheader",h="."+l,f="tocify-item",u="."+f,p="tocify-extend-page",g="."+p;r.widget("toc.tocify",{version:"1.9.0",options:{context:"body",ignoreSelector:null,selectors:"h1, h2, h3",showAndHide:!0,showEffect:"slideDown",showEffectSpeed:"medium",hideEffect:"slideUp",hideEffectSpeed:"medium",smoothScroll:!0,smoothScrollSpeed:"medium",scrollTo:0,showAndHideOnScroll:!0,highlightOnScroll:!0,highlightOffset:40,theme:"bootstrap",extendPage:!0,extendPageOffset:100,history:!0,scrollHistory:!1,hashGenerator:"compact",highlightDefault:!0},_create:function(){var e=this;e.extendPageScroll=!0,e.items=[],e._generateToc(),e._addCSSClasses(),e.webkit=function(){for(var e in d)if(e&&-1!==e.toLowerCase().indexOf("webkit"))return!0;return!1}(),e._setEventHandlers(),r(d).load(function(){e._setActiveElement(!0),r("html, body").promise().done(function(){setTimeout(function(){e.extendPageScroll=!1},0)})})},_generateToc:function(){var e,t,s=this,i=s.options.ignoreSelector;return e=-1!==this.options.selectors.indexOf(",")?r(this.options.context).find(this.options.selectors.replace(/ /g,"").substr(0,this.options.selectors.indexOf(","))):r(this.options.context).find(this.options.selectors.replace(/ /g,"")),e.length?(s.element.addClass(o),e.each(function(e){r(this).is(i)||(t=r("",{id:a+e,class:a}).append(s._nestElements(r(this),e)),s.element.append(t),r(this).nextUntil(this.nodeName.toLowerCase()).each(function(){0===r(this).find(s.options.selectors).length?r(this).filter(s.options.selectors).each(function(){r(this).is(i)||s._appendSubheaders.call(this,s,t)}):r(this).find(s.options.selectors).each(function(){r(this).is(i)||s._appendSubheaders.call(this,s,t)})}))}),undefined):(s.element.addClass(n),undefined)},_setActiveElement:function(e){var t=this,s=d.location.hash.substring(1),i=t.element.find('li[data-unique="'+s+'"]');return s.length?(t.element.find("."+t.focusClass).removeClass(t.focusClass),i.addClass(t.focusClass),t.options.showAndHide&&i.click()):(t.element.find("."+t.focusClass).removeClass(t.focusClass),!s.length&&e&&t.options.highlightDefault&&t.element.find(u).first().addClass(t.focusClass)),t},_nestElements:function(t,e){var s,i,o;return s=r.grep(this.items,function(e){return e===t.text()}),s.length?this.items.push(t.text()+e):this.items.push(t.text()),o=this._generateHashValue(s,t,e),i=r("",{class:f,"data-unique":o}).append(r("",{text:t.text()})),t.before(r("",{name:o,"data-unique":o})),i},_generateHashValue:function(e,t,s){var i="",o=this.options.hashGenerator;if("pretty"===o){for(i=t.text().toLowerCase().replace(/\s/g,"-");i.indexOf("--")>-1;)i=i.replace(/--/g,"-");for(;i.indexOf(":-")>-1;)i=i.replace(/:-/g,"-")}else i="function"==typeof o?o(t.text(),t):t.text().replace(/\s/g,"");return e.length&&(i+=""+s),i},_appendSubheaders:function(e,t){var s=r(this).index(e.options.selectors),i=r(e.options.selectors).eq(s-1),o=+r(this).prop("tagName").charAt(1),n=+i.prop("tagName").charAt(1);n>o?e.element.find(h+"[data-tag="+o+"]").last().append(e._nestElements(r(this),s)):o===n?t.find(u).last().after(e._nestElements(r(this),s)):t.find(u).last().after(r("",{class:l,"data-tag":o})).next(h).append(e._nestElements(r(this),s))},_setEventHandlers:function(){var h=this;this.element.on("click.tocify","li",function(){if(h.options.history&&(d.location.hash=r(this).attr("data-unique")),h.element.find("."+h.focusClass).removeClass(h.focusClass),r(this).addClass(h.focusClass),h.options.showAndHide){var e=r('li[data-unique="'+r(this).attr("data-unique")+'"]');h._triggerShow(e)}h._scrollTo(r(this))}),this.element.find("li").on({"mouseenter.tocify":function(){r(this).addClass(h.hoverClass),r(this).css("cursor","pointer")},"mouseleave.tocify":function(){"bootstrap"!==h.options.theme&&r(this).removeClass(h.hoverClass)}}),(h.options.extendPage||h.options.highlightOnScroll||h.options.scrollHistory||h.options.showAndHideOnScroll)&&r(d).on("scroll.tocify",function(){r("html, body").promise().done(function(){var o,e,t,s,n=r(d).scrollTop(),i=r(d).height(),a=r(c).height(),l=r("body")[0].scrollHeight;if(h.options.extendPage&&(h.webkit&&n>=l-i-h.options.extendPageOffset||!h.webkit&&i+n>a-h.options.extendPageOffset)&&!r(g).length){if(e=r('div[data-unique="'+r(u).last().attr("data-unique")+'"]'),!e.length)return;t=e.offset().top,r(h.options.context).append(r("",{class:p,height:Math.abs(t-n)+"px","data-unique":p})),h.extendPageScroll&&(s=h.element.find("li.active"),h._scrollTo(r('div[data-unique="'+s.attr("data-unique")+'"]')))}setTimeout(function(){var e,s=null,i=null,t=r(h.options.context).find("div[data-unique]");t.each(function(e){var t=Math.abs((r(this).next().length?r(this).next():r(this)).offset().top-n-h.options.highlightOffset);return null==s||s>t?(s=t,i=e,undefined):!1}),e=r(t[i]).attr("data-unique"),o=r('li[data-unique="'+e+'"]'),h.options.highlightOnScroll&&o.length&&(h.element.find("."+h.focusClass).removeClass(h.focusClass),o.addClass(h.focusClass)),h.options.scrollHistory&&d.location.hash!=="#"+e&&d.location.replace("#"+e),h.options.showAndHideOnScroll&&h.options.showAndHide&&h._triggerShow(o,!0)},0)})})},show:function(e){var t=this;if(!e.is(":visible"))switch(e.find(h).length||e.parent().is(i)||e.parent().is(":visible")?e.children(h).length||e.parent().is(i)||(e=e.closest(h)):e=e.parents(h).add(e),t.options.showEffect){case"none":e.show();break;case"show":e.show(t.options.showEffectSpeed);break;case"slideDown":e.slideDown(t.options.showEffectSpeed);break;case"fadeIn":e.fadeIn(t.options.showEffectSpeed);break;default:e.show()}return e.parent().is(i)?t.hide(r(h).not(e)):t.hide(r(h).not(e.closest(i).find(h).not(e.siblings()))),t},hide:function(e){var t=this;switch(t.options.hideEffect){case"none":e.hide();break;case"hide":e.hide(t.options.hideEffectSpeed);break;case"slideUp":e.slideUp(t.options.hideEffectSpeed);break;case"fadeOut":e.fadeOut(t.options.hideEffectSpeed);break;default:e.hide()}return t},_triggerShow:function(e,t){var s=this;return e.parent().is(i)||e.next().is(h)?s.show(e.next(h),t):e.parent().is(h)&&s.show(e.parent(),t),s},_addCSSClasses:function(){return"jqueryui"===this.options.theme?(this.focusClass="ui-state-default",this.hoverClass="ui-state-hover",this.element.addClass("ui-widget").find(".toc-title").addClass("ui-widget-header").end().find("li").addClass("ui-widget-content")):"bootstrap"===this.options.theme?(this.element.find(i+","+h).addClass("nav nav-list"),this.focusClass="active"):(this.focusClass=e,this.hoverClass=t),this},setOption:function(){r.Widget.prototype._setOption.apply(this,arguments)},setOptions:function(){r.Widget.prototype._setOptions.apply(this,arguments)},_scrollTo:function(e){var t=document.querySelector('div[data-unique="'+e.attr("data-unique")+'"]');if(t)t.scrollIntoView({behavior:this.options.smoothScroll?"smooth":"auto",block:"start"});return this}})}(window.jQuery,window,document)}();
\ No newline at end of file
+/*! jquery.tocify - v1.9.0 - 2013-10-01
+ * http://gregfranko.com/jquery.tocify.js/
+ * Copyright (c) 2013 Greg Franko; Licensed MIT*/
+!function(){"use strict";var a,l,h,o,s,n,r,i,d,c;a=window.jQuery,l=window,h=document,s="."+(o="tocify-header"),r="."+(n="tocify-subheader"),d="."+(i="tocify-item"),c="tocify-extend-page",a.widget("toc.tocify",{version:"1.9.0",options:{context:"body",ignoreSelector:null,selectors:"h1, h2, h3",showAndHide:!0,showEffect:"slideDown",showEffectSpeed:"medium",hideEffect:"slideUp",hideEffectSpeed:"medium",smoothScroll:!0,smoothScrollSpeed:"medium",scrollTo:0,showAndHideOnScroll:!0,highlightOnScroll:!0,highlightOffset:40,theme:"bootstrap",extendPage:!0,extendPageOffset:100,history:!0,scrollHistory:!1,hashGenerator:"compact",highlightDefault:!0},_create:function(){var e=this;e.extendPageScroll=!0,e.items=[],e._generateToc(),e._addCSSClasses(),e.webkit=function(){for(var e in l)if(e&&-1!==e.toLowerCase().indexOf("webkit"))return!0;return!1}(),e._setEventHandlers(),a(l).load(function(){e._setActiveElement(!0),a("html, body").promise().done(function(){setTimeout(function(){e.extendPageScroll=!1},0)})})},_generateToc:function(){var t,s=this,i=s.options.ignoreSelector,e=-1!==this.options.selectors.indexOf(",")?a(this.options.context).find(this.options.selectors.replace(/ /g,"").substr(0,this.options.selectors.indexOf(","))):a(this.options.context).find(this.options.selectors.replace(/ /g,""));return e.length?(s.element.addClass("tocify"),void e.each(function(e){a(this).is(i)||(t=a("",{id:o+e,class:o}).append(s._nestElements(a(this),e)),s.element.append(t),a(this).nextUntil(this.nodeName.toLowerCase()).each(function(){(0===a(this).find(s.options.selectors).length?a(this).filter(s.options.selectors):a(this).find(s.options.selectors)).each(function(){a(this).is(i)||s._appendSubheaders.call(this,s,t)})}))})):void s.element.addClass("tocify-hide")},_setActiveElement:function(e){var t=this,s=l.location.hash.substring(1),i=t.element.find('li[data-unique="'+s+'"]');return s.length?(t.element.find("."+t.focusClass).removeClass(t.focusClass),i.addClass(t.focusClass),t.options.showAndHide&&i.click()):(t.element.find("."+t.focusClass).removeClass(t.focusClass),!s.length&&e&&t.options.highlightDefault&&t.element.find(d).first().addClass(t.focusClass)),t},_nestElements:function(t,e){var s=a.grep(this.items,function(e){return e===t.text()});return s.length?this.items.push(t.text()+e):this.items.push(t.text()),s=this._generateHashValue(s,t,e),e=a("",{class:i,"data-unique":s}).append(a("",{text:t.text()})),t.before(a("",{name:s,"data-unique":s})),e},_generateHashValue:function(e,t,s){var i="",o=this.options.hashGenerator;if("pretty"===o){for(i=t.text().toLowerCase().replace(/\s/g,"-");-1",{class:n,"data-tag":o})).next(r).append(e._nestElements(a(this),s))},_setEventHandlers:function(){var n=this;this.element.on("click.tocify","li",function(){var e;n.options.history&&(l.location.hash=a(this).attr("data-unique")),n.element.find("."+n.focusClass).removeClass(n.focusClass),a(this).addClass(n.focusClass),n.options.showAndHide&&(e=a('li[data-unique="'+a(this).attr("data-unique")+'"]'),n._triggerShow(e)),n._scrollTo(a(this))}),this.element.find("li").on({"mouseenter.tocify":function(){a(this).addClass(n.hoverClass),a(this).css("cursor","pointer")},"mouseleave.tocify":function(){"bootstrap"!==n.options.theme&&a(this).removeClass(n.hoverClass)}}),(n.options.extendPage||n.options.highlightOnScroll||n.options.scrollHistory||n.options.showAndHideOnScroll)&&a(l).on("scroll.tocify",function(){a("html, body").promise().done(function(){var t,o=a(l).scrollTop(),e=a(l).height(),s=a(h).height(),i=a("body")[0].scrollHeight;if(n.options.extendPage&&(n.webkit&&o>=i-e-n.options.extendPageOffset||!n.webkit&&e+o>s-n.options.extendPageOffset)&&!a(".tocify-extend-page").length){if(!(i=a('div[data-unique="'+a(d).last().attr("data-unique")+'"]')).length)return;e=i.offset().top,a(n.options.context).append(a("",{class:c,height:Math.abs(e-o)+"px","data-unique":c})),n.extendPageScroll&&(s=n.element.find("li.active"),n._scrollTo(a('div[data-unique="'+s.attr("data-unique")+'"]')))}setTimeout(function(){var s=null,i=null,e=a(n.options.context).find("div[data-unique]");e.each(function(e){var t=Math.abs((a(this).next().length?a(this).next():a(this)).offset().top-o-n.options.highlightOffset);return(null==s||t {
const lan = document.documentElement.lang;
-
return lan ? document.documentElement.lang : "ru";
};
@@ -13,186 +12,125 @@ function getProduct() {
case "elma-rpa.ai":
product = {
name: "rpa",
-
id: "33678c11-fea6-4adb-aa39-adc4e8295b53",
};
-
break;
-
case "www.elma-bpm.ru":
product = {
name: "elma3/4",
-
id: "44b97702-146c-414b-9db7-0b09705556ed",
};
-
break;
-
default:
product = {
name: "elma365",
-
id: "3354c78a-720e-4584-a9c6-83f0f1396d22",
};
-
break;
}
-
return product;
}
-document
- .querySelector(".solution-select")
- .addEventListener("mouseenter", function () {
- this.classList.add("active");
-
- document.querySelector(".solution-select__list").classList.add("active");
- });
-
-document
- .querySelector(".solution-select__list")
- .addEventListener("mouseleave", function () {
- this.classList.remove("active");
-
- document.querySelector(".solution-select").classList.remove("active");
- });
-
-const titleName = () => {
- let textSpanTitle = document.querySelector(".solution-select__selected");
-
- let currentPlace = window.location.pathname
- .replace("/en/help/", "")
- .split("/")[0];
-
- textSpanTitle.textContent =
- currentPlace.charAt(0).toUpperCase() + currentPlace.slice(1);
-
- if (currentPlace === "crm" || "ecm") {
- textSpanTitle.textContent = currentPlace.toUpperCase();
- }
-
- if (currentPlace === "business_solutions") {
- let business = currentPlace.replace("_", " ");
-
- textSpanTitle.textContent =
- business.charAt(0).toUpperCase() +
- business.slice(1, 8) +
- " " +
- business.charAt(9).toUpperCase() +
- business.slice(10);
- }
-};
-
-/*// Commerce version
-
-const files = document.querySelectorAll(".filelink");
-
-if (files.length) {
-
- files.forEach((file) =>
-
- file.setAttribute("download", "Postman_collection.json")
-
- );
-
-}*/
-
const insertWordBreaks = (selector) => {
document.querySelectorAll(selector).forEach((el) => {
- el.innerHTML = el.textContent.replace(/([\/\-=<>:_])/g, "$1");
+ el.innerHTML = el.textContent.replace(/([\/\-=:<>_])/g, "$1");
});
};
insertWordBreaks("code");
-const scrollToLink = () => {
- let myHash = location.hash; //�������� �������� ����
+const addCanonicalUrl = () => {
+ const urlMapping = {
+ "/ru/help/business_solutions/platform-distribution.html":
+ "/ru/help/platform/platform-distribution.html",
+ };
- location.hash = ""; //������� ���
+ const listUrl = [
+ "/ru/haproxy-postgresql.html",
+ "/ru/doc_template.docx",
+ "/ru/platform-distribution.html",
+ "/ru/help/platform/haproxy-postgresql.html",
+ "/ru/help/platform/platform-distribution.html",
+ "/ru/help/ecm/doc_template.docx",
+ ];
- if (myHash[1]) {
- //���������, ���� �� � ���� �����-�� ��������
+ const currentPath = window.location.pathname;
+ const baseUrl = window.location.origin.includes("localhost")
+ ? window.location.origin
+ : "https://elma365.com";
- $("html, body").animate({ scrollTop: $(myHash).offset().top }, 300); //�������� �� ����������
+ if (urlMapping[currentPath]) {
+ setCanonicalUrl(baseUrl + urlMapping[currentPath]);
+ return;
+ }
+
+ if (listUrl.includes(currentPath)) {
+ setCanonicalUrl(baseUrl + currentPath);
}
};
+const setCanonicalUrl = (canonicalUrl) => {
+ const canonicalLink = document.createElement("link");
+ canonicalLink.href = canonicalUrl;
+ canonicalLink.setAttribute("rel", "canonical");
+ document.querySelector("head").appendChild(canonicalLink);
+};
+
+addCanonicalUrl();
+
+const scrollToLink = () => {
+ let myHash = window.location.pathname; //�������� �������� ����
+ if (myHash) {
+ //���������, ���� �� � ���� �����-�� ��������
+ $("html, body").animate({ scrollTop: $(myHash).offset().top }, 100); //�������� �� ����������
+ }
+};
// scrollToLink();
-// function scrollLink() {
-
-// document.addEventListener("DOMContentLoaded", function () {
-
-// const hash = decodeURIComponent(window.location.hash.slice(1)); // убираем '#' и декодим
-
-// if (hash) {
-
-// const target = document.querySelector(`[data-unique="${hash}"]`);
-
-// if (target) {
-
-// target.scrollIntoView({ behavior: "smooth" });
-
-// }
-
-// }
-
-// });
-
-// }
-
-// scrollLink();
+function scrollLink() {
+ document.addEventListener("DOMContentLoaded", function () {
+ const hash = decodeURIComponent(window.location.hash.slice(1)); // убираем '#' и декодим
+ if (hash) {
+ const target = document.querySelector(`[data-unique="${hash}"]`);
+ if (target) {
+ target.scrollIntoView({ behavior: "smooth" });
+ }
+ }
+ });
+}
+scrollLink();
const createVersionNode = (title, className) => {
const articleNode = document.querySelector(".topic__title");
-
const pVersion = document.createElement("p");
-
pVersion.innerText = title;
-
pVersion.classList.add(className);
-
articleNode.append(pVersion);
};
-const {
- href,
-
- pathname,
-} = window.location;
-
+const { href, pathname } = window.location;
let locale = getLocale();
-
const pathnameArr = pathname.split("/");
-
let currentPage = pathnameArr[pathnameArr.length - 1] || null;
//���� �� ��������� ��������, ������ ���������� ������ � �����
-
const changeHeaderLinks = () => {
const host = "elma4.sarl.inner.elma365.com";
-
const path = "/ru/platform/";
-
const headerLinks = document.querySelector(".header__list");
-
const footerList = document.querySelector(".footer-mobile__list");
-
const appendList = ``;
if (window.location.host === host) {
if (window.location.pathname !== path) {
headerLinks.insertAdjacentHTML("beforeend", appendList);
-
footerList.insertAdjacentHTML("beforeend", appendList);
}
}
};
-
//changeHeaderLinks()
// standard example
-
function findExampleContent(node, container, endString) {
if (
node.classList.contains("p_CodeExample") &&
@@ -201,68 +139,48 @@ function findExampleContent(node, container, endString) {
node.firstElementChild.innerText.toLowerCase().includes(endString)
) {
node.remove();
-
return;
}
-
const nextElement = node.nextElementSibling;
-
container.append(node);
-
findExampleContent(nextElement, container, endString);
}
function createNotation(item, notationType, endString) {
const container = document.createElement("div");
-
const exampleTitle = item.nextElementSibling;
-
const nextSibling = exampleTitle.nextElementSibling;
container.classList.add(notationType);
-
exampleTitle.classList.add(notationType + "__title");
-
container.append(exampleTitle);
-
findExampleContent(nextSibling, container, endString);
-
item.after(container);
-
item.remove();
}
function getArticleName(url) {
const arrFromUrl = url.split("/");
-
const lastPath = arrFromUrl[arrFromUrl.length - 1];
-
return lastPath.split(".")[0];
}
function removeCollapsedClass(node, tagName, className) {
const closestNode = node.closest(tagName);
-
if (!closestNode) {
return;
}
-
closestNode.classList.remove(className);
-
removeCollapsedClass(closestNode.parentElement, tagName, className);
}
function loadBottomLinks() {
const toc = document.querySelector("#toc");
-
const bottomLinks = document.querySelectorAll(".bottom-nav__link");
-
if (toc && bottomLinks.length) {
bottomLinks.forEach((link) => {
const path = `a[href="${link.innerText}"]`;
-
const targetLink = toc.querySelector(path);
-
link.innerText = targetLink.innerText;
});
}
@@ -270,32 +188,25 @@ function loadBottomLinks() {
function hideAllSideUls() {
const hidingMenu = document.querySelectorAll("#toc li ul");
-
hidingMenu.forEach((item) => {
item.classList.add("hide-side-menu-item");
-
item.closest("li").classList.add("collapsed");
});
}
function toggleUlsLinksHandler(menu, link) {
menu.forEach((link) => link.classList.remove("active-side-menu"));
-
link.classList.add("active-side-menu");
-
removeCollapsedClass(link, "ul", "hide-side-menu-item");
-
if (
link.nextElementSibling &&
link.nextElementSibling.classList.contains("hide-side-menu-item")
) {
removeCollapsedClass(link, "li", "collapsed");
-
link.nextElementSibling.classList.remove("hide-side-menu-item");
} else {
removeCollapsedClass(link, "li", "collapsed");
}
-
setTimeout(() => {
scrollToSelector(".active-side-menu");
}, 100);
@@ -303,28 +214,19 @@ function toggleUlsLinksHandler(menu, link) {
function scrollToSelector(selector) {
// document.body.style.position = 'fixed';
-
document.querySelector(".sidebar__wrapper").style.position = "fixed";
-
document
-
.querySelector(selector)
-
.scrollIntoView({ behavior: "smooth", block: "center" });
-
document.querySelector(".sidebar__wrapper").style.position = "sticky";
-
// document.body.style.position = 'unset';
}
function toggleUlsHandler() {
const tocNode = document.querySelector("#toc");
-
if (tocNode) {
const linksMenu = tocNode.querySelectorAll("a");
-
const activeItem = getArticleName(window.location.pathname);
-
linksMenu.forEach((link) => {
if (getArticleName(link.pathname) === activeItem) {
toggleUlsLinksHandler(linksMenu, link);
@@ -335,37 +237,29 @@ function toggleUlsHandler() {
function prepareContent() {
const commerceId = document.getElementById("commerce");
-
const communityId = document.getElementById("community");
href.includes("zoom_highlightsub") &&
$("body").addClass("--highlight-disabled");
//Set document title
-
const h1pageTitle = document.querySelector("h1 span.f_Heading1");
-
if (h1pageTitle) {
document.querySelector("title").innerText = h1pageTitle.innerText;
}
-
if (commerceId || communityId) {
commerceId
? (commerceId.style.display = "none")
: (communityId.style.display = "none");
-
commerceId
? createVersionNode("Enterprise", "pCommerce")
: createVersionNode("Community Edition", "pCommunity");
}
-
hideAllSideUls();
-
toggleUlsHandler();
const visibleSideBar = (sidebar) => {
const input = sidebar.querySelector('input[type="checkbox"]');
-
let isVisible = false;
input.addEventListener("change", () => {
@@ -378,55 +272,35 @@ function prepareContent() {
}
});
};
-
//TODO навигация по статье (якори)
-
const toc2 = document.getElementById("toc2");
-
if (toc2) {
const toc2Wrapper = document.querySelector(".article__sidebar");
-
if (!toc2.dataset.tocInitialized) {
$("#toc2").tocify({
context: "section.article__content",
-
selectors: "h2, h3",
-
extendPage: false,
});
-
toc2.dataset.tocInitialized = "true";
}
-
// $("#toc2").tocify({
-
// context: "section.article__content",
-
// selectors: "h2, h3",
-
// extendPage: false,
-
// });
-
const points = toc2.querySelectorAll("a");
-
if (points.length > 0) {
points.forEach((point) => {
if (!point.innerText.trim()) {
point.remove();
}
});
-
toc2Wrapper.style.display = "block";
-
visibleSideBar(toc2Wrapper);
-
// document.querySelector("body").classList.add(".scroll-nav");
-
// setTimeout(() => {
-
// document.querySelector("body").classList.remove(".scroll-nav");
-
// }, 500);
} else {
toc2Wrapper.style.display = "none";
@@ -434,14 +308,12 @@ function prepareContent() {
}
const images = document.querySelectorAll(".p_Normal > img");
-
images.forEach(
(image) =>
image.closest("p") && image.closest("p").classList.add("image-container")
);
const breadcrumbs = document.querySelector(".topic__breadcrumbs");
-
if (breadcrumbs && breadcrumbs.firstElementChild) {
breadcrumbs.firstElementChild.childNodes.forEach((node) => {
if (node.nodeValue && node.nodeValue.includes(">")) {
@@ -450,18 +322,17 @@ function prepareContent() {
});
}
- const spans = document.querySelectorAll("span");
-
- if (spans.length) {
- spans.forEach((span) => {
- if (span.innerHTML === " ") {
- span.remove();
- }
- });
- }
+ // const spans = document.querySelectorAll('span');
+ // if (spans.length) {
+ // spans.forEach(span => {
+ // if (span.innerHTML === ' ') {
+ // span.remove();
+ // console.log(span.innerHTML);
+ // }
+ // });
+ // }
// example exapand
-
const examplesToggle = document.querySelectorAll(
'a[class="dropdown-toggle"]'
);
@@ -476,54 +347,37 @@ function prepareContent() {
example.parentElement.tagName === "p"
? example.parentElement
: example.closest("p");
-
const nextSiblingDiv = parentP.nextElementSibling;
-
if (nextSiblingDiv && nextSiblingDiv.tagName === "DIV") {
parentP.classList.add("example");
-
const id = nextSiblingDiv.id;
-
const button = document.createElement("a");
-
const obj = nextSiblingDiv.attributes;
-
let expandState = "0";
-
parentP.setAttribute("data-state", expandState);
-
button.classList.add("btn-example");
-
button.innerHTML =
locale === "ru"
? 'СвернутьПосмотреть полностью'
: 'HideShow all';
-
button.addEventListener("click", (evt) => {
evt.preventDefault();
-
window.HMToggle("toggle", id);
-
Object.entries(obj).map((el) => {
if (el[1].name === "hm.state") {
expandState = el[1].value;
-
parentP.setAttribute("data-state", expandState);
}
});
});
-
parentP.append(button);
-
example.setAttribute("href", "javascript:void(0)");
-
example.after(nextSiblingDiv);
}
});
}
const pArray = document.querySelectorAll(".p_Normal");
-
if (pArray.length) {
pArray.forEach((p) => {
if (p.innerHTML === " ") {
@@ -533,11 +387,9 @@ function prepareContent() {
}
const examples = document.querySelectorAll("p.p_CodeExample");
-
if (examples.length) {
examples.forEach((example) => {
const childSpan = example.firstElementChild;
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -545,7 +397,6 @@ function prepareContent() {
) {
createNotation(example, "example", "примера");
}
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -553,7 +404,6 @@ function prepareContent() {
) {
createNotation(example, "warning", "внимание");
}
-
if (
childSpan &&
childSpan.innerText.toLowerCase().includes("начало") &&
@@ -565,22 +415,15 @@ function prepareContent() {
}
//small icon
-
const icons = document.querySelectorAll(".content img");
-
if (icons.length) {
icons.forEach((icon, idx) => {
const iconWidth = parseInt(icon.width);
-
const floated = icon.style.float;
-
floated !== "" && icon.classList.add("img-float--" + floated);
-
if (iconWidth < 200) {
icon.classList.add("small-img");
-
const iconHeight = parseInt(icon.height);
-
if (
iconWidth > 70 &&
iconHeight > 70 &&
@@ -593,33 +436,28 @@ function prepareContent() {
});
}
}
-
//TODO скрытие хедера
-
function stickyHeader() {
var lastScrollTop = 0;
-
var delta = 15;
-
$(window)
.on("scroll", function () {
var st = $(this).scrollTop();
-
if (Math.abs(lastScrollTop - st) <= delta) return;
-
if (st > lastScrollTop && lastScrollTop > 0) {
$("body").addClass("--header-hidden");
-
$(".solution-select__list").removeClass("active");
-
$(".solution-select").removeClass("active");
} else {
$("body").removeClass("--header-hidden");
-
$(".solution-select__list").removeClass("active");
-
$(".solution-select").removeClass("active");
}
+ //TEST
+ // if (document.querySelector("body").classList.contains(".scroll-nav")) {
+ // $("body").addClass("--header-hidden");
+ // }
+ //TEST
lastScrollTop = st;
})
@@ -640,35 +478,23 @@ $(window).resize(function () {
function iconsTableOfContents() {
const toggledLi = document.querySelectorAll('li[data-bg*="collapsed"]');
-
toggledLi.forEach((li) => li.classList.add("toggled"));
}
$(document).ready(function () {
prepareContent();
-
toggleUlsHandler();
-
- //TODO вызов хедера
-
+ //TODO вызов скрытия хедера
// stickyHeader();
$("#side-menu").load("index.html #toc", function () {
- //TODO ререндер toc
-
- // window.addEventListener('popstate', () => {
-
- // // $(".article-inner").empty();
-
- // $('#article').load(`${window.location.href} .article-inner`, function () {
-
+ //TODO вызавает каждый раз ререндер при изменении href(добавление якоря как например)
+ // window.addEventListener("popstate", () => {
+ // $("#article").load(`${window.location.href} .article-inner`, function () {
// loadBottomLinks();
-
// prepareContent();
-
// });
-
- // })
+ // });
function onUrlChange(callback) {
const originalPushState = history.pushState;
@@ -731,50 +557,56 @@ $(document).ready(function () {
});
// Дополнительно: обработка void-ссылок
- document.querySelectorAll('a[href^="javascript:"]').forEach((link) => {
- link.addEventListener("click", (e) => {
- e.preventDefault();
- // Можно добавить здесь свою логику обработки клика
- });
- });
+ // document.querySelectorAll('a[href^="javascript:"]').forEach((link) => {
+ // link.addEventListener("click", (e) => {
+ // e.preventDefault();
+ // // Можно добавить здесь свою логику обработки клика
+ // });
+ // });
//
-
loadBottomLinks();
-
hideAllSideUls();
-
toggleUlsHandler();
-
document.addEventListener("DOMContentLoaded", () => {
if (document.visibilityState === "visible") {
hideAllSideUls();
}
});
+ //toc
+ function tryHideSideUlsWhenActive() {
+ if (document.visibilityState === "visible") {
+ hideAllSideUls();
+ } else {
+ document.addEventListener(
+ "visibilitychange",
+ () => {
+ if (document.visibilityState === "visible") {
+ hideAllSideUls();
+ }
+ },
+ { once: true }
+ );
+ }
+ }
+
+ document.addEventListener("DOMContentLoaded", tryHideSideUlsWhenActive);
const menuItems = this.querySelectorAll("a");
-
menuItems.forEach((item) => {
item.addEventListener("click", (evt) => {
evt.preventDefault();
-
const url =
evt.target.nodeName === "A"
? evt.target.href
: evt.target.closest("a").href;
-
const sideMenu = document.querySelector(".sidebar");
-
const htmlTag = document.querySelector("html");
-
const toggledLi = document.querySelectorAll('li[data-bg*="collapsed"]');
window.scrollTo(0, 0);
-
htmlTag.classList.remove("--locked");
-
$("body").removeClass("index-page search-page");
-
sideMenu.classList.remove("show-side-menu");
if (toggledLi.length) {
@@ -786,42 +618,17 @@ $(document).ready(function () {
if (url !== window.location.href) {
if (!url.includes("javascript:void")) {
$(".article-inner").empty();
-
$("#article").load(`${url} .article-inner`, function () {
history.pushState({}, null, url);
-
//metaDecsription.attr('content', metaDescriptionInitial);
-
loadBottomLinks();
-
prepareContent();
});
} else {
- // const _target = evt.target;
-
- // const _targetUl = _target.parentElement.nextElementSibling;
-
- // if (_target.nodeName === "SPAN" && _targetUl.nodeName === "UL" && _targetUl.classList.contains("hide-side-menu-item")) {
-
- // _targetUl.querySelectorAll('a')[0].click();
-
- // } else {
-
- // const _ul = _target.parentElement.querySelectorAll('a')[0].nextElementSibling;
-
- // if (_ul.nodeName === "UL") {
-
- // _ul.querySelectorAll('a')[0].click();
-
- // };
-
- // }
-
+ //TEST
function isFakeLink(link) {
if (!link) return false;
-
const href = link.getAttribute("href");
-
return href === "#" || href === "javascript:void(0);";
}
@@ -831,45 +638,34 @@ $(document).ready(function () {
function findFirstLinkInElement(element) {
if (!element) return null;
-
return element.querySelector("a");
}
function findFirstRealNestedLink(element) {
if (!element) return null;
-
const links = element.querySelectorAll("a");
-
for (const link of links) {
if (isRealLink(link)) return link;
}
-
return null;
}
document.addEventListener("click", (evt) => {
const _target = evt.target;
-
if (_target.nodeName !== "SPAN") return;
const _targetLi = _target.closest("li");
-
if (!_targetLi) return;
const submenu = _targetLi.querySelector("ul");
-
const firstLink = findFirstLinkInElement(_targetLi);
// заглушки
-
if (firstLink && isFakeLink(firstLink)) {
const nestedReal = findFirstRealNestedLink(submenu);
-
if (nestedReal) {
nestedReal.click();
-
// в первом фрагменте, после nestedReal.click();
-
setTimeout(() => {
document.dispatchEvent(new Event("subcategory:update"));
}, 50);
@@ -881,6 +677,7 @@ $(document).ready(function () {
firstLink.click(); // кликаем по нормальной ссылке
}
});
+ //TEST
}
}
});
@@ -890,28 +687,20 @@ $(document).ready(function () {
const obj = pagedata.reduce((acc, words) => {
const searchObj = {
title: words[1],
-
link: words[0],
};
-
return [...acc, searchObj];
}, []);
-
$(".search-form__input").each(function () {
var _that = $(this);
-
var _searchForm = _that.parent();
-
_that
.autocomplete({
autoFocus: false,
-
minLength: 2,
-
focus: function (event, ui) {
itemUiLinkSelected = ui.item.link;
},
-
source: function (request, response) {
const results = obj.filter(
(item) =>
@@ -920,9 +709,7 @@ $(document).ready(function () {
.includes(request.term.toLowerCase()) &&
document.querySelector(`a[href="${item.link.slice(2)}"]`)
);
-
const sliceResults = results.slice(0, 5);
-
sliceResults.map((result) => {
const aItem = document.querySelector(
`a[href="${result.link.slice(2)}"]`
@@ -930,7 +717,6 @@ $(document).ready(function () {
if (aItem) {
const parent = aItem.closest("li.heading1");
-
result.breadcrumb =
parent.querySelector("span.heading1").innerText;
} else {
@@ -949,7 +735,6 @@ $(document).ready(function () {
item.breadcrumb || ""
}`
)
-
.appendTo(ul);
};
@@ -963,15 +748,10 @@ $(document).ready(function () {
$(".glossary-abc__nav a").on("click", function (e) {
e.preventDefault();
-
var target = $(this).attr("href");
-
console.log($(this).parent().siblings());
-
$(".glossary-abc__nav a").removeClass("--active");
-
$(this).addClass("--active");
-
$("html, body").animate(
{
scrollTop: $(target).offset().top - 150,
@@ -980,33 +760,39 @@ $(document).ready(function () {
);
});
- // Хлебные крошки на странице поиска
+ const name = "Сайт ELMA365";
+ const cusLi = document.createElement("li");
+ cusLi.classList.add("heading1");
+ cusLi.classList.add("heading10");
+ const cusA = document.createElement("a");
+ cusA.classList.add("heading1");
+ cusA.setAttribute("href", "https://elma365.com/ru/");
+ cusA.setAttribute("target", "_blank");
+ const cusSpan = document.createElement("span");
+ cusSpan.classList.add("heading1");
+ cusSpan.textContent = name;
+ cusA.appendChild(cusSpan);
+ cusLi.appendChild(cusA);
+ document.querySelector("#toc").prepend(cusLi);
+ // Хлебные крошки на странице поиска
function findPrevBreadcrumbs(node, breadcrumbs) {
var breadcrumbsNew =
breadcrumbs || $('');
-
var prevParentEl = node.closest("ul") ? node.closest("ul").prev() : null;
-
if (!prevParentEl[0] || prevParentEl[0].tagName !== "A") {
return breadcrumbsNew;
}
-
breadcrumbsNew.prepend(' / ');
-
breadcrumbsNew.prepend(prevParentEl.clone());
-
return findPrevBreadcrumbs(prevParentEl, breadcrumbsNew);
}
$(".result_title a").each(function () {
var bc = "";
-
var currentArticleName = $(this);
-
$("#toc a span").each(function () {
var tocCurrentNode = $(this);
-
if (tocCurrentNode.text().trim() === currentArticleName.text().trim()) {
bc = findPrevBreadcrumbs(tocCurrentNode);
}
@@ -1019,56 +805,16 @@ $(document).ready(function () {
});
});
-//let scrollPos = 0;
-
-/* $('body').scroll(function () {
-
- let st = $(this).scrollTop();
-
- if (st > scrollPos) {
-
- $('.scroll-top').hide();
-
- } else {
-
- $('.scroll-top').show();
-
- }
-
- scrollPos = st;
-
-});
-
-
-
-$('.scroll-top').on('click', function (e) {
-
- e.preventDefault();
-
- $('html, body').animate({
-
- scrollTop: 0
-
- });
-
-}); */
-
//side menu mobile
-
const sideMenuIcon = document.querySelector("#side-menu-icon");
-
const htmlTag = document.querySelector("html");
-
const sideMenu = document.querySelector("#sidebar");
-
const closeButton = document.querySelector("#close");
if (sideMenuIcon) {
sideMenuIcon.addEventListener("click", (evt) => {
evt.preventDefault();
-
sideMenu.classList.toggle("show-side-menu");
-
htmlTag.classList.toggle("--locked");
});
}
@@ -1076,15 +822,12 @@ if (sideMenuIcon) {
if (closeButton) {
closeButton.addEventListener("click", (e) => {
e.preventDefault();
-
sideMenu.classList.remove("show-side-menu");
-
htmlTag.classList.remove("--locked");
});
}
var triggerTitleMegaGuide = false;
-
if (getTitleSite() === "Mega Guide" || /hmftsearch.html/i.test(href)) {
triggerTitleMegaGuide = true;
}
@@ -1102,9 +845,6 @@ function getTitleSite() {
const currentUrl = window.location.href;
if (
- /http:\/\/localhost/i.test(currentUrl) ||
- /brix365.t-elma365\/en\/help/i.test(currentUrl) ||
- /brix365.com\/en\/help/i.test(currentUrl) ||
/elma365.com\/ru\/help/i.test(currentUrl) ||
/elma365.com\/en\/help/i.test(currentUrl) ||
/elma365\/help\/ru/i.test(currentUrl) ||
@@ -1114,44 +854,29 @@ if (
) {
window.addEventListener("load", () => {
const searchIcon = document.querySelector("#search-icon");
-
const searchPanel = document.querySelector("#search-panel");
-
const searchInput = searchPanel.querySelector('input[type="text"]');
-
const heroSearch = document.querySelector(".hero__search");
-
if (searchIcon) {
searchIcon.addEventListener("click", (evt) => {
- console.log(searchIcon);
-
evt.preventDefault();
-
searchPanel.classList.toggle("show-search-panel");
-
setTimeout(() => searchInput.focus(), 500);
heroSearch.classList.add("hero__search--active");
});
- } else {
- console.log("error");
}
-
if (searchInput) {
const label = searchInput.closest("label");
-
searchInput.addEventListener("blur", () => {
searchPanel.classList.remove("show-search-panel");
-
heroSearch.classList.remove("hero__search--active");
-
if (searchInput.value) {
label.classList.add("cross");
} else {
label.classList.remove("cross");
}
});
-
searchInput.addEventListener("focus", () => {
label.classList.add("cross");
});
@@ -1167,15 +892,12 @@ if (
$(".arrow-top").click(function () {
$("html, body").animate({ scrollTop: 0 }, 600);
-
return false;
});
// очистить поиск
-
if (document.querySelector("#reset-search")) {
const resetButton = document.querySelector("#reset-search");
-
resetButton.addEventListener("click", () => {
searchInput.value = "";
});
@@ -1190,84 +912,37 @@ if (
wrapperSearch.classList.add("search-form__label");
const tagSpanIcons = document.createElement("span");
-
tagSpanIcons.className = "search__icon";
-
tagSpanIcons.setAttribute("id", "reset-search");
-
wrapperSearch.prepend(tagSpanIcons);
- // const insertInnerHtml = document.querySelector('tr .ya-site-form__search-input-layout-l');
-
- // const divBlockHeroSearch = document.createElement('div');
-
- //
-
- // divBlockHeroSearch.classList.add('hero__search')
-
- // divBlockHeroSearch.innerHTML = `
-
- //
-
- //
-
- //
-
- //
-
- // `;
-
- // setTimeout(() => {
-
- // insertInnerHtml.appendChild(divBlockHeroSearch);
-
- // }, 1000);
-
const searchIcon = document.querySelector("#search-icon");
-
const searchPanel = document.querySelector(
".ya-site-form.ya-site-form_bg_transparent.ya-site-form_inited_yes"
);
-
const searchInput = searchPanel.querySelector('input[type="search"]');
-
const heroSearch = document.querySelector(".hero__search");
-
if (searchIcon) {
searchIcon.addEventListener("click", (evt) => {
- console.log(searchIcon);
-
evt.preventDefault();
-
searchPanel.classList.toggle("show-search-panel");
-
setTimeout(() => searchInput.focus(), 500);
-
heroSearch.classList.add("hero__search--active");
});
}
-
if (searchInput) {
const div = searchInput.closest(".ya-site-form__input");
-
searchInput.addEventListener("blur", searchWatch);
function searchWatch() {
searchPanel.classList.remove("show-search-panel");
-
heroSearch.classList.remove("hero__search--active");
-
if (searchInput.value !== "") {
div.classList.add("cross");
} else {
div.classList.remove("cross");
}
}
-
searchInput.addEventListener("focus", () => {
div.classList.add("cross");
});
@@ -1283,21 +958,15 @@ if (
$(".arrow-top").click(function () {
$("html, body").animate({ scrollTop: 0 }, 600);
-
return false;
});
// очистить поиск
-
const resetButton = document.querySelector("#reset-search");
-
resetButton.addEventListener("click", () => {
searchInput.value = "";
-
searchInput.focus();
-
baseUrl = window.location.href.split("?")[0];
-
window.history.pushState("name", "", baseUrl);
});
});
@@ -1311,29 +980,20 @@ function searchFormHeader() {
$(".search-form").each(function () {
$(this).on("submit", (evt) => {
evt.preventDefault();
-
evt.stopPropagation();
-
var searchStr = evt.target[0].value;
-
if (searchStr.trim()) {
if (
(/elma365.com\/ru\/help/i.test(window.location.href) ||
/elma365.com\/en\/help/i.test(window.location.href) ||
/t-elma365.com/i.test(window.location.href) ||
- /brix365.com\/en\/help/i.test(window.location.href) ||
/([\d+]{3}).(\d).(\d).(\d)/i.test(window.location.href) ||
/http:\/\/localhost/i.test(window.location.href)) &&
!triggerTitleMegaGuide
) {
window.location.href = `./search.html?query=${searchStr}`;
- }
-
- //фикс поиска, тест
- else {
- // window.location.href = `./hmftsearch.html?zoom_query=${searchStr}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
- window.location.href = `./search.html?query=${searchStr}`;
+ } else {
+ window.location.href = `./hmftsearch.html?zoom_query=${searchStr}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
}
}
});
@@ -1347,41 +1007,28 @@ if (
Boolean(document.querySelector(".searchheading"))
) {
const searchTitle = document.querySelector(".searchheading");
-
const queryString = window.location.search;
-
let currentPageNumber = null;
const searchParams = queryString.split("&");
-
searchParams.forEach((param) => {
const paramArr = param.split("=");
-
if (paramArr[0] === "zoom_page") {
currentPageNumber = +paramArr[1];
}
});
-
const searchWord = decodeURI(searchParams[0].split("=")[1]);
-
searchTitle.innerText =
locale === "ru" ? "Результаты поиска:" : "Search results for:";
-
const searchWordP = document.createElement("p");
-
searchWordP.classList.add("search-word");
-
searchWordP.innerText = searchWord;
-
searchTitle.append(searchWordP);
let pagesCount = "0";
-
const resultPagesCount = document.querySelector(".result_pagescount");
-
if (resultPagesCount) {
pagesCount = parseInt(resultPagesCount.innerText.trim());
-
resultPagesCount.remove();
}
@@ -1389,109 +1036,62 @@ if (
switch (currentPage) {
case "first-page": {
resultPages[0].textContent = "<< < ";
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = "1";
-
resultPages[0].after(span);
-
const aEnd = document.createElement("a");
-
const urlEnd = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=${pagesCount}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aEnd.setAttribute("href", urlEnd);
-
aEnd.textContent = " >>";
-
// resultPages[resultPages.length - 1].textContent = ' >>';
-
resultPages[resultPages.length - 1].after(aEnd);
-
resultPages[resultPages.length - 2].remove();
-
resultPages[resultPages.length - 2].textContent = " > ";
-
break;
}
-
case "last-page": {
resultPages[resultPages.length - 1].textContent = ` > >>`;
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = currentPageNumber;
-
const aBegin = document.createElement("a");
-
const urlBegin = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=1&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aBegin.setAttribute("href", urlBegin);
-
aBegin.textContent = "<< ";
-
resultPages[resultPages.length - 1].before(span);
-
// resultPages[0].textContent = '<< ';
-
resultPages[1].before(aBegin);
-
resultPages[0].remove();
-
resultPages[1].textContent = "< ";
-
break;
}
-
case "default-page": {
const aBegin = document.createElement("a");
-
const aEnd = document.createElement("a");
-
const urlBegin = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=1&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
const urlEnd = `./hmftsearch.html?zoom_query=${searchWord}&zoom_page=${pagesCount}&zoom_per_page=10&zoom_and=1&zoom_sort=0`;
-
aBegin.setAttribute("href", urlBegin);
-
aBegin.textContent = "<< ";
-
aEnd.setAttribute("href", urlEnd);
-
aEnd.textContent = " >>";
-
resultPages[1].before(aBegin);
-
resultPages[0].remove();
-
//resultPages[0].textContent = '<< ';
-
//resultPages[0] = aBegin;
-
resultPages[1].textContent = " < ";
-
resultPages[resultPages.length - 2].textContent = " > ";
-
//resultPages[resultPages.length - 1].textContent = ' >> ';
-
resultPages[resultPages.length - 2].after(aEnd);
-
resultPages[resultPages.length - 1].remove();
-
break;
}
-
default:
break;
}
}
const resultPagesNode = document.querySelector(".result_pages");
-
const resultPages = resultPagesNode
? document.querySelector(".result_pages").childNodes
: [];
@@ -1516,15 +1116,10 @@ if (
resultPages.forEach((node) => {
if (+node.textContent.trim() === currentPageNumber) {
const nextElement = node.nextSibling;
-
const span = document.createElement("span");
-
span.classList.add("current-page");
-
span.innerText = currentPageNumber;
-
nextElement.before(span);
-
node.remove();
}
});
@@ -1532,33 +1127,17 @@ if (
}
const summary = document.querySelectorAll(".summary");
-
if (summary.length > 0 && locale === "ru") {
const count = parseInt(summary[0].innerText.trim());
-
summary[0].innerText = count
? `Найдено совпадений: ${count}`
: (summary.innerText = "Совпадений не найдено");
}
}
-// подменяет текст в абзаце в зависимости от атрибута lang
-
-// if (document.documentElement.lang === "en") {
-
-// $('#found_typo').html('Found a typo? Highlight the text, press ctrl + enter and notify us')
-
-// } else if (document.documentElement.lang === "ru") {
-
-// $('#found_typo').html('Нашли опечатку? Выделите текст, нажмите ctrl + enter и оповестите нас')
-
-// }
-
$(window).on("load", () => {
// правит текст в фильтре результатов поиска
-
// $('.b-loader__wrapper').css('opacity', 0);
-
function replace() {
var intervalReplace = setInterval(() => {
if (
@@ -1574,20 +1153,17 @@ $(window).on("load", () => {
setTimeout(() => {
clearInterval(intervalReplace);
-
// }, 180000);
}, 10000);
function t() {
if (document.documentElement.lang === "en") {
textResult("нашёл", "Matches found", "all resourses", 13);
-
textFindSection("Search through ");
}
if (document.documentElement.lang === "ru") {
textResult("нашёл", "Найдено совпадений", "всем ресурсам", 18);
-
textFindSection("Искать по ");
}
@@ -1596,14 +1172,11 @@ $(window).on("load", () => {
searchAny = $(
".b-dropdowna__switcher .b-pseudo-link_is-bem_yes"
).text();
-
var e = text.replace(textFound, textFoundRes),
t = searchAny.replace("любой", textAny);
-
$("tr td.b-head__r .b-head__found").text(
e.substring(0, n) + ": " + parseInt(text.match(/\d+/))
);
-
$(".b-dropdowna__switcher .b-pseudo-link_is-bem_yes").text(t);
if ($("tr td.b-head__r .b-head__found").text().indexOf("найдёт") == 0) {
@@ -1637,11 +1210,8 @@ $(window).on("load", () => {
if (i > 0) {
if (element.childNodes[0].textContent.indexOf("раздел") === 0) {
var htmlTag = [];
-
htmlTag.push(element.childNodes[i]);
-
element.textContent = textResSection;
-
htmlTag.forEach((item) => {
element.appendChild(item);
});
@@ -1666,7 +1236,6 @@ $(window).on("load", () => {
setTimeout(() => {
clearInterval(intervalAddElementSubsection);
-
// }, 180000)
}, 10000);
@@ -1680,71 +1249,48 @@ $(window).on("load", () => {
var textContent = $("yass-li.b-serp-item .b-serp-url__item")[index]
.textContent;
-
switch (true) {
// ELMA365
-
case /elma365.com\/ru\/help/i.test(textContent):
subsectionTitle("Справка");
-
break;
-
case /academy.com/i.test(textContent):
subsectionTitle("ELMA Academy");
-
break;
-
case /tssdk.elma/i.test(textContent):
subsectionTitle("TS SDK");
-
break;
-
case /exchange.elma/i.test(textContent):
subsectionTitle("ELMA365 Exchange");
-
break;
// Английская версия
-
case /en\/help/i.test(textContent):
subsectionTitle("Help");
-
break;
// rpa
-
case /rpa.ai\/ru/i.test(textContent):
subsectionTitle("RPA");
-
break;
// ELMA4
-
case /ru\/help4\/ecm/i.test(textContent):
subsectionTitle("ECM+");
-
break;
-
case /ru\/help4\/crm/i.test(textContent):
subsectionTitle("CRM+");
-
break;
-
case /ru\/help4\/projects/i.test(textContent):
subsectionTitle("Проекты");
-
break;
-
case /elma-bpm.ru\/help4/i.test(textContent):
subsectionTitle("BPM");
-
break;
-
case /ru\/KB/i.test(textContent) ||
/elma-bpm.ru\/…help/i.test(textContent) ||
/help/i.test(textContent):
subsectionTitle("База знаний");
-
break;
}
@@ -1753,11 +1299,8 @@ $(window).on("load", () => {
$(".subsection-title")[index].textContent = text;
} else {
var newBlockDiv = document.createElement("div");
-
newBlockDiv.classList.add("subsection-title");
-
newBlockDiv.textContent = text;
-
$(".b-serp-item__title")[index].prepend(newBlockDiv);
}
}
@@ -1775,20 +1318,16 @@ $(window).on("load", () => {
if ($("tr td.b-head__r .b-head__found")) {
var intervalTimer = setInterval(() => {
replace();
-
addElementSubsection();
}, 200);
// через 3 минуты интервал останавливается (время взято примерно, чтобы успело все прогрузиться)
-
setTimeout(() => {
clearInterval(intervalTimer);
-
// }, 180000);
}, 10000);
} else {
replace();
-
addElementSubsection();
}
});
@@ -1797,41 +1336,25 @@ $(window).on("load", () => {
const leadhandler = "https://web.s-elma365.ru";
var rootNode = document.createElement("div");
-
document.body.appendChild(rootNode);
-
var typo = new TypoReporter(
{
formId: "1FAIpQLSfXEIXAFoOiHgetf0reIjWrOAw6V7KCZrhAv8VVD6WL7Rs46g", // required, see previous step
// Optional example stuff below
-
locale: getLocale(), // optional language, defaults to 'en'
-
// translations: { // optinal object with translated strings
-
// fr: {
-
// // see source code for keys to translate
-
// },
-
// ru: {
-
//
-
// }
-
// },
-
offset: 100, // amount of context text to grab from before and after the selection, defaults to 50
-
endpointUrl: leadhandler + "/api/baglist/", // optional, defaults to Google Forms
-
snippetFieldName: "typo", // optional, if using custom form
-
commentFieldName: "comment", // optional, if using custom form
-
urlFieldName: "url", // optional, if using custom form
},
rootNode
@@ -1839,14 +1362,12 @@ var typo = new TypoReporter(
$(document).on("focus", ".fill_listener", function () {
//console.log("test");
-
$(this).parent().addClass("focused");
});
$(document).on("blur", ".fill_listener", function () {
$(this).parent().removeClass("focused");
});
-
$(document).on("change", ".fill_listener", function () {
if ($(this).val().length) {
$(this).parent().addClass("filled");
@@ -1858,21 +1379,16 @@ $(document).on("change", ".fill_listener", function () {
function feedbackSubmit() {
$("#feedback-form").on("submit", function () {
var $form = $(this);
-
var formData = $form.serializeArray().slice(0, -1);
-
var context = {};
$(formData).each(function (index, obj) {
if (obj.name === "useful" && obj.value === "true") {
context.other = "";
-
context.useful = true;
-
context.category = [
{
code: "",
-
name: "",
},
];
@@ -1883,14 +1399,11 @@ function feedbackSubmit() {
if (obj.name === "other") {
context.other = obj.value;
}
-
context.useful = false;
-
if (obj.name === "category") {
context.category = [
{
code: obj.value,
-
name: $form.find('option[value="' + obj.value + '"]').text(),
},
];
@@ -1900,18 +1413,13 @@ function feedbackSubmit() {
});
context.produkt = ["6b55aead-f008-42c7-9186-0806c06d4f2c"];
-
context.link = window.location.href;
-
var data = {
context,
};
-
var request = $.ajax({
type: "POST",
-
url: leadhandler + "/api/feedback/create",
-
data: JSON.stringify(data),
})
.fail(function (response) {
@@ -1920,7 +1428,6 @@ function feedbackSubmit() {
.done(function (response) {
return response;
});
-
return false;
});
}
@@ -1936,32 +1443,23 @@ $(document).ready(function () {
var $form = $(this),
textarea = $form.find('textarea[name="help_question"]'),
//formData = $form.serializeArray().slice(0, -1),
-
context = {};
context.other = textarea.val();
-
context.category = [
{
code: "question",
-
name: "Задать вопрос",
},
];
-
context.produkt = ["6b55aead-f008-42c7-9186-0806c06d4f2c"];
-
context.link = window.location.href;
-
var data = {
context,
};
-
var request = $.ajax({
type: "POST",
-
url: leadhandler + "/api/feedback/create",
-
data: JSON.stringify(data),
})
.fail(function (response) {
@@ -1972,23 +1470,18 @@ $(document).ready(function () {
.parent()
.find(".question-success")
.removeClass("hidden");
-
setTimeout(() => {
$(".question-xs").attr("style", "display:none;");
-
textarea.val("");
});
-
setTimeout(() => {
$(".question__popup")
.parent()
.find(".question-success")
.addClass("hidden");
-
$(".question").removeClass("active");
}, 3000);
});
-
return false;
});
});
@@ -1998,7 +1491,6 @@ function question() {
const questionPopup = $(this).parent().find(".question-xs");
questionPopup.attr("style", "display:block;");
-
setTimeout(() => {
$(this).parent().find('textarea[name="help_question"]').focus();
}, 200);
@@ -2006,7 +1498,6 @@ function question() {
$(document).mouseup(function (e) {
let container = $(".question-xs");
-
if (!container.is(e.target) && container.has(e.target).length === 0) {
container.attr("style", "display:none;");
}
@@ -2018,12 +1509,9 @@ function question() {
$(".question-xs").on("submit", function () {
$(this).parent().find(".question-success-xs").removeClass("hidden");
-
$(this).removeClass("active");
-
setTimeout(() => {
$(this).parent().find(".question-success-xs").addClass("hidden");
-
$(this).addClass("active");
}, 3000);
});
@@ -2033,28 +1521,23 @@ question();
$(document).click(function (e) {
if ($(e.target).closest(".ReportTypo-popup").length != 0) return false;
-
$(".ReportTypo").fadeOut(100);
});
$(document).click(function (e) {
if ($(e.target).closest(".ReportTypo-popup").length != 0) return false;
-
$(".ReportTypo").fadeOut(100);
});
jQuery(function ($) {
$(document).mouseup(function (e) {
// ������� ����� �� ���-���������
-
var div = $("#feedback-form"); // ��� ��������� ID ��������
-
if (
!div.is(e.target) && // ���� ���� ��� �� �� ������ �����
div.has(e.target).length === 0
) {
// � �� �� ��� �������� ���������
-
$(".feedback-form").find("input:checked").removeAttr("checked");
}
});
@@ -2062,25 +1545,17 @@ jQuery(function ($) {
function feedback() {
const yesLabel = document.getElementById("feedback__useful_yes");
-
const thxWindow = document.getElementById("feedback__popup_thx");
-
const noLabel = document.getElementById("feedback__useful_no");
-
const feedbackWhyPopup = document.getElementById("feedback__popup_why");
-
const form = document.getElementById("feedback-form");
-
const otherInput = document.getElementById("other_reason");
-
const otherPopup = document.getElementById("feedback__popup-other");
-
const feedbackOtherBtn = document.querySelector(".feedback__other-btn");
const inputs = [
...document.querySelectorAll('#feedback__popup_why input[type="radio"]'),
];
-
const allRadio = inputs.filter((item) => item.id !== "other_reason");
allRadio.forEach((item) =>
@@ -2099,16 +1574,12 @@ function feedback() {
otherInput.addEventListener("change", (e) => {
if (e.target.checked) {
feedbackWhyPopup.style.display = "none";
-
otherPopup.style.display = "block";
-
$(".feedback__popup").find('textarea[name="other"]').focus();
feedbackOtherBtn.addEventListener("click", function () {
otherPopup.style.display = "none";
-
$("#feedback-success-popup").show();
-
setTimeout(() => {
$("#feedback-success-popup").hide();
}, 3000);
@@ -2122,9 +1593,7 @@ function feedback() {
if (Boolean(feedbackWhyPopup)) {
document.addEventListener("click", (e) => {
const target = e.target;
-
feedbackWhyPopup.style.display = "none";
-
thxWindow.style.display = "none";
if (target.matches("#feedback__useful_no")) {
@@ -2160,7 +1629,6 @@ $(window).on("load", function () {
document.querySelectorAll("main article section div")[1]
) {
let el = document.querySelectorAll("main article section div")[1];
-
el.setAttribute("id", "table-mobile-desktop_size");
}
});
@@ -2178,7 +1646,6 @@ if (document.querySelector("#side-menu")) {
document.querySelectorAll("main article section div")[1]
) {
let el = document.querySelectorAll("main article section div")[1];
-
el.setAttribute("id", "table-mobile-desktop_size");
}
}, 200);
@@ -2194,52 +1661,39 @@ if (document.querySelector("#side-menu")) {
if (document.getElementsByClassName("accordion-btn__show")) {
var showAccordionBtn = document.querySelector(".accordion-btn__show");
-
var elementAccordionHide = document.querySelector(".accordion__hide");
-
var linearGradient = document.querySelector(".linear-gradient");
-
var heightAccordionElem =
document.querySelector(".card-stack-50").scrollHeight;
var t = false;
-
showAccordionBtn.addEventListener("click", () => {
switch (true) {
case showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.contains("arrow__show"):
elementAccordionHide.classList.add("accordion__show");
-
elementAccordionHide.style.maxHeight = heightAccordionElem + "px";
-
elementAccordionHide.classList.remove("accordion__hide");
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.remove("arrow__show");
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.add("arrow__hide");
setTimeout(() => {
linearGradient.classList.remove("linear-gradient");
-
showAccordionBtn.querySelector("p").textContent = "Свернуть";
}, 1000);
-
break;
case showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.contains("arrow__hide"):
elementAccordionHide.classList.add("accordion__hide");
-
elementAccordionHide.classList.remove("accordion__show");
-
elementAccordionHide.style.maxHeight = "";
-
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.add("arrow__show");
@@ -2248,12 +1702,9 @@ if (document.getElementsByClassName("accordion-btn__show")) {
showAccordionBtn
.querySelector(".accordion-btn__text")
.classList.remove("arrow__hide");
-
linearGradient.classList.add("linear-gradient");
-
showAccordionBtn.querySelector("p").textContent = "Показать всё";
}, 1000);
-
break;
}
});
@@ -2266,7 +1717,6 @@ if (document.getElementsByClassName("accordion-btn__show")) {
(function () {
if (document.querySelector(".accordion__items")) {
var btn = document.querySelectorAll(".accordion__item-question");
-
var dehiscentItems = document.querySelectorAll(
".accordion__item-question-answer"
);
@@ -2279,11 +1729,8 @@ if (document.getElementsByClassName("accordion-btn__show")) {
removeActiveClass();
} else {
removeActiveClass();
-
this.classList.toggle("accordion__active");
-
nextEl.style.maxHeight = nextEl.scrollHeight + "px";
-
nextEl.style.marginBottom = "15px";
}
});
@@ -2296,7 +1743,6 @@ if (document.getElementsByClassName("accordion-btn__show")) {
dehiscentItems.forEach((i) => {
i.style.maxHeight = null;
-
i.style.marginBottom = null;
});
}