1/*1787424516000*/ 2/** 3 * Copyright (c) 2000-present Liferay, Inc. All rights reserved. 4 * 5 * This library is free software; you can redistribute it and/or modify it under 6 * the terms of the GNU Lesser General Public License as published by the Free 7 * Software Foundation; either version 2.1 of the License, or (at your option) 8 * any later version. 9 * 10 * This library is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 13 * details. 14 */ 15 16/* eslint-disable prefer-arrow-callback */ 17AUI().ready( 18 /* 19 This function gets loaded when all the HTML, not including the portlets, is 20 loaded. 21 */ 22 23 function () {} 24); 25 26Liferay.Portlet.ready( 27 /* 28 This function gets loaded after each and every portlet on the page. 29 30 portletId: the current portlet's id 31 node: the Alloy Node object of the current portlet 32 */ 33 34 function (_portletId, _node) {} 35); 36 37Liferay.on( 38 "allPortletsReady", 39 40 /* 41 This function gets loaded when everything, including the portlets, is on 42 the page. 43 */ 44 45 function () { 46 function toggleFocus(element) { 47 const parent = element.parentNode.parentNode; 48 const isActive = parent.classList.contains("active"); 49 if (element.value == "") { 50 return parent.classList.remove("active"); 51 } 52 return parent.classList.add("active"); 53 } 54 function handleEvent(input) { 55 input.addEventListener("keyup", (e) => { 56 toggleFocus(e.target); 57 }); 58 input.addEventListener("keydown", (e) => { 59 toggleFocus(e.target); 60 }); 61 } 62 63 document.querySelectorAll(".input-hp input").forEach(handleEvent); 64 document.querySelectorAll("textarea").forEach(handleEvent); 65 66 function handleSelect() { 67 function clearSelect(select) { 68 select.querySelectorAll(".dropdown-item").forEach((item) => { 69 item.classList.remove("active"); 70 }); 71 select.querySelector(".input").innerHTML = ""; 72 select.querySelector("input[type='hidden']").value = ""; 73 } 74 75 function valueWithComma(value) { 76 if (value.length > 0) { 77 return value + ", "; 78 } 79 return value; 80 } 81 function addValue(input, value) { 82 input.value = valueWithComma(input.value) + value; 83 } 84 function removeValue(input, value) { 85 input.value = input.value.replace(", " + value, ""); 86 input.value = input.value.replace(value, ""); 87 } 88 89 function addLabel(label, option) { 90 newContent = valueWithComma(label.innerHTML) + option; 91 if (newContent.indexOf("<") > 0) { 92 return (label.innerHTML = newContent); 93 } 94 const dots = newContent.length > 25 ? "..." : ""; 95 label.innerHTML = newContent.substr(0, 25) + dots; 96 label.value = newContent.substr(0, 25) + dots; 97 } 98 99 function removeLabel(label, option) { 100 label.innerHTML = label.innerHTML.replace(", " + option, ""); 101 label.innerHTML = label.innerHTML.replace(option, ""); 102 } 103 function activateSelect(select) { 104 if (!select.classList.contains("active")) { 105 select.classList.add("active"); 106 select.querySelector(".input-hp").classList.add("active"); 107 } 108 } 109 function deActivateSelect(select) { 110 select.classList.remove("active"); 111 select.querySelector(".input-hp").classList.remove("active"); 112 } 113 114 function removeItem(select, input, label, value, option) { 115 removeValue(input, value); 116 removeLabel(label, option); 117 if (input.value == "") { 118 deActivateSelect(select); 119 } 120 } 121 function addItem(select, input, label, value, option) { 122 addValue(input, value); 123 addLabel(label, option); 124 activateSelect(select); 125 } 126 127 function getSelectElements(select, item) { 128 return { 129 status: item.classList.contains("active"), 130 label: select.querySelector(".input"), 131 input: select.querySelector("input[type='hidden']"), 132 value: item.getAttribute("value"), 133 option: item.innerHTML, 134 textOption: item.innerText, 135 }; 136 } 137 138 function toggleItem(select, item) { 139 const { status, label, input, value, option, textOption } = 140 getSelectElements(select, item); 141 142 if (status) { 143 return removeItem(select, input, label, value, option); 144 } 145 clearSelect(select); 146 147 item.classList.toggle("active"); 148 return addItem(select, input, label, value, option); 149 } 150 151 function toggleItemMultiple(select, item) { 152 const { status, label, input, value, option, textOption } = 153 getSelectElements(select, item); 154 const selectedOptions = []; 155 select 156 .querySelectorAll(".dropdown-item.active") 157 .forEach((activeItem) => { 158 selectedOptions.push(activeItem.innerText); 159 }); 160 if (status) { 161 selectedOptions.splice(selectedOptions.indexOf(item.innerText), 1); 162 } else { 163 selectedOptions.push(item.innerText); 164 } 165 let newContent = selectedOptions.join(", ").substr(0, 25); 166 if (newContent.substr(newContent.length - 1, 1) == ",") { 167 newContent = newContent.substr(0, newContent.length - 1); 168 } 169 170 if (newContent.length > 24) { 171 newContent = newContent + "..."; 172 } 173 174 item.classList.toggle("active"); 175 if (status) { 176 removeItem(select, input, label, value, option); 177 return (label.innerHTML = newContent); 178 } 179 180 addItem(select, input, label, value, textOption); 181 return (label.innerHTML = newContent); 182 } 183 184 function addClickEvent(select, item) { 185 if (select.classList.contains("multiple")) { 186 return item.addEventListener("click", (e) => { 187 toggleItemMultiple(select, item); 188 }); 189 } 190 191 item.addEventListener("click", (e) => { 192 toggleItem(select, item); 193 }); 194 } 195 function addSelect(select) { 196 select 197 .querySelectorAll(".dropdown-item") 198 .forEach((item) => addClickEvent(select, item)); 199 } 200 201 document.querySelectorAll(".select-hp").forEach(addSelect); 202 } 203 handleSelect();
204 let urlParams = new URLSearchParams(window.location.search); 205 if(urlParams.get('showSimulationPopup') == 'true'){ 206 $("#simulationModal").modal('toggle'); 207 $("#simulationModal").removeClass('hide'); 208 } 209 210 if(urlParams.get('showSiteRedirectPopup') == 'true'){ 211 $("#SiteRedirectPopup").modal('toggle'); 212 } 213 214 $("#simulationModal").on('hidden.bs.modal', function (e) { 215 window.history.pushState({}, '',window.location.origin + window.location.pathname + window.location.search.replace('showSimulationPopup=true&','')); 216 }); 217 218 $('#SiteRedirectPopup').on('hidden.bs.modal', function (e) { 219 window.location.search = window.location.search.replace("showSiteRedirectPopup=true",""); 220 }); 221 } 222);
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.