리소스
최신 현대식 창고, 문서 및 우편 자동화에 대한 자동화 리소스를 살펴보십시오.
어떻게 도와드릴까요?
특정 항목을 찾고 계십니까? 여기에서 리소스를 검색해 보십시오.
필터 및 정렬
document.addEventListener('DOMContentLoaded', function() {
let lastCleanUrl = window.location.href;
// Function to handle URL rewrite and update the page title
function rewriteUrl(initialLoad = false) {
var urlParams = new URLSearchParams(window.location.search);
if (urlParams.has('ucterms')) {
var ucterms = urlParams.get('ucterms');
var match = ucterms.match(/category~(.*)/);
if (match) {
var newUrl = window.location.origin + '/resources/' + match[1];
var newTitle = match[1].replace(/-/g, ' ') + ' - OPEX';
document.title = newTitle.charAt(0).toUpperCase() + newTitle.slice(1); // Capitalize first letter
// Only push state if the current URL is different from the new URL
if (window.location.href !== newUrl) {
if (initialLoad) {
window.history.replaceState({ path: newUrl }, '', newUrl); // Replace the state for initial load
} else {
window.history.pushState({ path: newUrl }, '', newUrl); // Push state for subsequent changes
}
lastCleanUrl = newUrl;
}
}
} else {
// Update the title to default if no ucterms parameter is present
document.title = 'Resources - OPEX';
// Only push state if the URL is already clean and different from the last clean URL
if (!initialLoad && window.location.href !== lastCleanUrl) {
window.history.pushState({ path: window.location.href }, '', window.location.href);
lastCleanUrl = window.location.href;
}
}
}
// Call rewriteUrl on page load
rewriteUrl(true);
// Listen for popstate events to handle browser navigation
window.addEventListener('popstate', function(event) {
if (event.state && event.state.path) {
window.location.href = event.state.path;
} else {
rewriteUrl();
}
});
// Listen for URL changes in SPA environments
let lastUrl = location.href;
new MutationObserver(() => {
const url = location.href;
if (url !== lastUrl) {
lastUrl = url;
rewriteUrl();
}
}).observe(document, { subtree: true, childList: true });
});