https://ilias.bgn-akademie.de/src/UI/templates/js/MainControls/dist/maincontrols.min.js?version=9_20
1/** 2 * This file is part of ILIAS, a powerful learning management system 3 * published by ILIAS open source e-Learning e.V. 4 * 5 * ILIAS is licensed with the GPL-3.0, 6 * see https://www.gnu.org/licenses/gpl-3.0.en.html 7 * You should have received a copy of said license along with the 8 * source code, too. 9 * 10 * If this is not the case or you just want to try ILIAS, you'll find 11 * us at: 12 * https://www.ilias.de 13 * https://github.com/ILIAS-eLearning 14 */ 15!function(t,e){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=n(t),a=n(e);const i="engaged",o="il-maincontrols-metabar",r="il-metabar-slates",l="il-metabar-more-button",u="il-metabar-more-slate",c="il-maincontrols-slate",h="engaged";function g(t){t.removeClass(i),t.attr("aria-expanded",!1)}class d{#t;#e;#n;#s;#a;#i;#o;constructor(t,e,n,s,a,i){this.#t=t,this.#e=e,this.#s=n,this.#a=s,this.#i=a,this.#o=i}registerSignals(t,e){this.#t(document).on(t,((t,e)=>(this.#r(t,e),this.#s()&&this.#i(),!1))),this.#t(document).on(e,(()=>(this.onClickDisengageAll(),!1))),this.#t(`.${o}`).on("click",(()=>{this.#n=!0})),this.#t("body").on("click",(()=>{this.#n?this.#n=!1:this.onClickDisengageAll()})),this.#t(`.${r} > .${c}`).on("focusout",(t=>{if(!this.#s()){const e=t.relatedTarget,n=t.currentTarget;null==e||this.#t.contains(n,e)||this.onClickDisengageAll()}}))}#r(t,e){const n=e.triggerer;!function(t){return t.hasClass(i)}(n)?(this.disengageAll(),function(t){t.addClass(i),t.attr("aria-expanded",!0)}(n),setTimeout((()=>{const t=n[0];this.focusInEngagedSlate(t)}),10)):g(n)}onClickDisengageAll(){this.disengageAllButtons(),this.disengageAllSlates()}disengageAllButtons(){document.querySelectorAll(`#${this.#e}.${o} > li > .btn.${i}`).forEach((t=>{g($(t))}));document.querySelectorAll(`#${this.#e}.${o} > li > .${r} > .${u} > .il-maincontrols-slate-content > .btn.${i}`).forEach((t=>{g($(t))}))}disengageAllSlates(){this.getEngagedSlates().each(((t,e)=>{this.#o(this.#t(e))}))}disengageAll(){this.disengageAllSlates(),this.disengageAllButtons()}getEngagedSlates(){const t=`#${this.#e} .${c}.${h}`;return this.#t(t)}focusInEngagedSlate(t){const e=function(t,e){let n=t.parentElement;for(;n&&!n.classList.contains(e);)n=n.parentElement;return n||console.warn(`No parent element with class "${e}" found.`),n}(t,o);if(e){const t=e.querySelector(`.${c}.${h}`);if(t){const e=t.querySelector("input, button");e&&e.focus()}}}init(){this.#l(),this.#u(),this.#s()?this.#c():this.#h(),this.#t(`.${o}`).css("visibility","visible"),this.#t(`#${this.#e} .${r}`).children(`.${c}`).attr("aria-hidden",!0)}#c(){this.#g(),this.#d().hide(),this.getMoreButton().show(),this.#f()}#h(){this.getMoreButton().hide(),this.#d().show()}#l(){if(0===this.getMoreButton().length){const t=this.#t(`#${this.#e}.${o}`).find(".btn, .il-link").last();this.#t(t).addClass(l)}}#u(){if(0===this.#y().length){const t=this.#t(`#${this.#e} .${r}`).children(`.${c}`).last();this.#t(t).addClass(u)}}getMoreButton(){return this.#t(`.${l}`)}#y(){return this.#t(`.${u}`)}#d(){return this.#t(`#${this.#e}.${o}`).children("li").children(".btn, .il-link").not(`.${l}`)}#g(){const t=this.#y().children(".il-maincontrols-slate-content");0===t.children().length&&this.#d().clone(!0,!0).appendTo(t)}#f(){const t=this.#a.getCounterObjectOrNull(this.#y());t&&this.#a.getCounterObject(this.getMoreButton()).setNoveltyTo(t.getNoveltyCount()).setStatusTo(t.getStatusCount())}}const f="engaged",y="disengaged";function S(t){return t.hasClass(f)}function m(t){t.removeClass(y),t.addClass(f),t.attr("aria-expanded","true"),t.attr("aria-hidden","false")}function b(t){t.removeClass(f),t.addClass(y),t.attr("aria-expanded","false"),t.attr("aria-hidden","true")}function p(t){S(t)?b(t):m(t)}var C=function(t){var e="il-counter",n={getCounterObject:function(t){let e;return e=s(t),console.assert(e.length>0,"Passed jQuery Object does not contain a counter"),a(e)},getCounterObjectOrNull:function(t){let e;return e=s(t),0===e.length?null:a(e)}},s=function(n){console.assert(n instanceof t,"$object_containing_counter is not a jQuery Object, param: "+n);var s=n;return n.hasClass(e)||(s=n.find("."+e)),s},a=function(e){return v.bind({})(e,t)};return n},v=function(t,e){const n=" Counter does not exist in the DOM. Make sure the respective Counter type has been rendered before applying this operations.",s=" is not a number";
15this.getStatusCount=function(){return r(o(t))},this.getNoveltyCount=function(){return r(i(t))},this.hasNoveltyObject=function(){return i(t).length>0},this.hasStatusObject=function(){return o(t).length>0},this.setNoveltyTo=function(e){console.assert(this.hasNoveltyObject(),"Novelty "+n),console.assert("number"==typeof e,e+s);var a=i(t);return a.html(e),0===e?a.hide():a.show(),this},this.setStatusTo=function(e){console.assert(this.hasStatusObject(),"Status "+n),console.assert("number"==typeof e,e+s);var a=o(t);return a.html(e),0===e?a.hide():a.show(),this},this.incrementNoveltyCount=function(e){return console.assert(this.hasNoveltyObject(),"Novelty "+n),console.assert("number"==typeof e,e+s),l((function(t){t.hasNoveltyObject()&&t.setNoveltyTo(t.getNoveltyCount()+e)}),t),this},this.decrementNoveltyCount=function(e){return console.assert(this.hasNoveltyObject(),"Novelty "+n),console.assert("number"==typeof e,e+s),l((function(t){t.hasNoveltyObject()&&t.setNoveltyTo(t.getNoveltyCount()-e)}),t),this},this.incrementStatusCount=function(e){return console.assert(this.hasStatusObject(),"Status "+n),console.assert("number"==typeof e,e+s),l((function(t){t.hasStatusObject()&&t.setStatusTo(t.getStatusCount()+e)}),t),this},this.decrementStatusCount=function(e){return console.assert(this.hasStatusObject(),"Status "+n),console.assert("number"==typeof e,e+s),l((function(t){t.hasStatusObject()&&t.setStatusTo(t.getStatusCount()-e)}),t),this},this.setTotalNoveltyToStatusCount=function(){return console.assert(this.hasStatusObject(),"Status "+n),console.assert(this.hasNoveltyObject(),"Novelty "+n),this.incrementStatusCount(this.getNoveltyCount()).setNoveltyTo(0)};var a={getNoveltyCount:this.getNoveltyCount,getStatusCount:this.getStatusCount,hasNoveltyObject:this.hasNoveltyObject,hasStatusObject:this.hasStatusObject,setNoveltyTo:this.setNoveltyTo,setStatusTo:this.setStatusTo,incrementNoveltyCount:this.incrementNoveltyCount,decrementNoveltyCount:this.decrementNoveltyCount,incrementStatusCount:this.incrementStatusCount,decrementStatusCount:this.decrementStatusCount,setTotalNoveltyToStatusCount:this.setTotalNoveltyToStatusCount},i=function(t){return t.find(".il-counter-novelty")},o=function(t){return t.find(".il-counter-status")},r=function(t){var n=0;return t.each((function(){var t=e(this).text();n+=parseInt(t)})),n},l=function(t,n){n.each((function(){var n=C(e).getCounterObject(e(this));t(n,e(this))}))};return a};s.default.UI=s.default.UI||{},s.default.UI.maincontrols=s.default.UI.maincontrols||{},s.default.UI.maincontrols.metabar=new class{#t;#S=[];#s;#a;#i;#o;constructor(t,e,n,s,a){this.#t=t,this.#s=e,this.#a=n,this.#i=s,this.#o=a}init(t){if(void 0!==this.#S[t])throw new Error(`Metabar with id '${t}' has already been initialized.`);this.#S[t]=new d(this.#t,t,this.#s,this.#a,this.#i,this.#o)}get(t){return this.#S[t]??null}disengageAll(){Object.values(this.#S).forEach((t=>t.disengageAll()))}}(a.default,s.default.UI.page.isSmallScreen,C(a.default),(()=>s.default.UI.maincontrols.mainbar.disengageAll()),(t=>s.default.UI.maincontrols.slate.disengage(t))),s.default.UI.maincontrols.slate=new class{#t;#m;#b;constructor(t,e,n){this.#t=t,this.#m=e,this.#b=n}onSignal(t,e,n,s){const a=this.#t(`#${s}`),{triggerer:i}=n,o=i.parents(".il-metabar-more-slate").length>0;if("toggle"===t)this.#p(a,i,o);else if("engage"===t)m(a);else{if("replace"!==t)throw new Error(`No such SignalType: ${t}`);this.#C(s,n)}}#p(t,e,n){const s=t.closest(".il-maincontrols-metabar").attr("id"),a=this.#b.get(s);e.attr("id")!==a.getMoreButton().attr("id")?(p(t),n||(S(t)?(e.addClass(f),e.removeClass(y),t.trigger("in_view")):(e.removeClass(f),e.addClass(y)))):a.getEngagedSlates().length>0?a.disengageAllSlates():p(t)}disengage=b;#C(t,e){const{url:n}=e.options;this.#m(t,n,"content")}}(a.default,function(t){return function(e,n,s){t.ajax({url:n,dataType:"html"}).done((function(n){var a=t("<div>"+n+"</div>"),i=a.find("[data-replace-marker='"+s+"']").first();0==i.length?t("#"+e+" [data-replace-marker='"+s+"']").html(n):(t("#"+e+" [data-replace-marker='"+s+"']").first().replaceWith(i),t("#"+e+" [data-replace-marker='"+s+"']").first().after(a.find("[data-replace-marker='script']")))}))}}(a.default),s.default.UI.maincontrols.metabar)}(il,$);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.