{"id":2319,"date":"2024-04-19T10:37:33","date_gmt":"2024-04-19T10:37:33","guid":{"rendered":"https:\/\/noella.si\/new\/?page_id=2319"},"modified":"2024-08-08T09:48:51","modified_gmt":"2024-08-08T09:48:51","slug":"nastanitve","status":"publish","type":"page","link":"https:\/\/noella.si\/new\/nastanitve\/","title":{"rendered":"Nastanitve"},"content":{"rendered":"<h1>NASTANITVE<\/h1>\n<div>\n<div><!DOCTYPE html><br \/>\n<html lang=\"en\"><br \/>\n<head><br \/>\n    <meta charset=\"UTF-8\"><br \/>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><br \/>\n    <title>Search Functionality<\/title><\/p>\n<style>\n<p>.search-container {\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    margin-bottom: 20px;<\/p>\n<p>}<\/p>\n<p>#search-input {\n    width: 300px;\n    padding: 10px;\n    font-size: 18px;\n    border: 1px solid #ccc;\n    border-radius: 4px;\n    margin-right: 10px;\n    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n}<\/p>\n<p>button {\n    padding: 10px 20px;\n    font-size: 18px;\n    background-color: #f5f5f5;\n    color: #333;\n    border: none;\n    border-radius: 4px;\n    cursor: pointer;\n    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n}<\/p>\n<p>.highlight {\n    background-color: yellow;\n}<\/p>\n<\/style>\n<p><\/head><br \/>\n<body><br \/>\n    <input type=\"text\" id=\"search-input\" placeholder=\"I\u0161\u010di...\"><br \/>\n    <button onclick=\"searchText()\">I\u0161\u010di<\/button><br \/>\n<script>document.addEventListener('DOMContentLoaded', () => {\n    const searchInput = document.getElementById('search-input');<\/p>\n<p>    searchInput.addEventListener('keydown', (event) => {\n        if (event.key === 'Enter') {\n            searchText();\n        }\n    });\n});<\/p>\n<p>function searchText() {\n    \/\/ Get the search query\n    const query = document.getElementById('search-input').value;\n    if (!query) return;<\/p>\n<p>    \/\/ Remove existing highlights\n    removeHighlights();<\/p>\n<p>    \/\/ Get all the text nodes in the body\n    const textNodes = getTextNodes(document.body);<\/p>\n<p>    \/\/ Highlight the search query\n    const firstHighlight = highlightText(textNodes, query);<\/p>\n<p>    \/\/ Scroll to the first highlight\n    if (firstHighlight) {\n        firstHighlight.scrollIntoView({ behavior: 'smooth', block: 'center' });\n        firstHighlight.focus(); \/\/ Optional: Focus the first highlight for better visibility\n    }\n}<\/p>\n<p>function getTextNodes(node) {\n    let textNodes = [];\n    if (node.nodeType === Node.TEXT_NODE) {\n        textNodes.push(node);\n    } else {\n        node.childNodes.forEach(child => {\n            textNodes = textNodes.concat(getTextNodes(child));\n        });\n    }\n    return textNodes;\n}<\/p>\n<p>function highlightText(textNodes, query) {\n    const queryRegex = new RegExp(query, 'gi');\n    let firstHighlight = null;<\/p>\n<p>    textNodes.forEach(node => {\n        const matches = node.textContent.match(queryRegex);\n        if (matches) {\n            const parent = node.parentNode;\n            const highlightedFragment = document.createDocumentFragment();<\/p>\n<p>            let lastIndex = 0;\n            node.textContent.split(queryRegex).forEach((part, index) => {\n                if (index > 0) {\n                    const highlightSpan = document.createElement('span');\n                    highlightSpan.classList.add('highlight');\n                    highlightSpan.textContent = matches[index - 1];\n                    highlightSpan.tabIndex = -1; \/\/ Make the span focusable<\/p>\n<p>                    if (!firstHighlight) {\n                        firstHighlight = highlightSpan;\n                    }<\/p>\n<p>                    highlightedFragment.appendChild(highlightSpan);\n                }\n                highlightedFragment.appendChild(document.createTextNode(part));\n                lastIndex += part.length + (matches[index - 1] ? matches[index - 1].length : 0);\n            });<\/p>\n<p>            parent.replaceChild(highlightedFragment, node);\n        }\n    });<\/p>\n<p>    return firstHighlight;\n}<\/p>\n<p>function removeHighlights() {\n    document.querySelectorAll('.highlight').forEach(el => {\n        const parent = el.parentNode;\n        parent.replaceChild(document.createTextNode(el.textContent), el);\n        parent.normalize(); \/\/ Merge adjacent text nodes\n    });\n}<\/p>\n<p><\/script><br \/>\n<\/body><br \/>\n<\/html>\n<\/div>\n<\/div>\n<div>\n<\/div>\n<p><!--more--><br \/>\n<!-- {\"type\":\"layout\",\"children\":[{\"type\":\"section\",\"props\":{\"animation\":\"fade\",\"class\":\"uk-text-center\",\"header_transparent\":true,\"header_transparent_noplaceholder\":true,\"header_transparent_text_color\":\"light\",\"image_loading\":true,\"image_position\":\"center-center\",\"image_size\":\"cover\",\"image_width\":\"2560\",\"padding\":\"xlarge\",\"style\":\"default\",\"text_color\":\"light\",\"title_breakpoint\":\"xl\",\"title_position\":\"top-left\",\"title_rotation\":\"left\",\"vertical_align\":\"\",\"video\":\"wp-content\\\/uploads\\\/2024\\\/04\\\/AdobeStock_503610161.mp4\",\"width\":\"\"},\"children\":[{\"type\":\"row\",\"children\":[{\"type\":\"column\",\"props\":{\"image_position\":\"center-center\",\"padding\":\"none\",\"position_sticky_breakpoint\":\"m\",\"width_medium\":\"1-1\"},\"children\":[{\"type\":\"headline\",\"props\":{\"class\":\"uk-display-inline-block\",\"content\":\"NASTANITVE\",\"text_align\":\"center\",\"title_element\":\"h1\"}}]}]}],\"name\":\"Hero\"},{\"type\":\"section\",\"props\":{\"image_position\":\"center-center\",\"style\":\"default\",\"title_breakpoint\":\"xl\",\"title_position\":\"top-left\",\"title_rotation\":\"left\",\"vertical_align\":\"\",\"width\":\"default\"},\"children\":[{\"type\":\"row\",\"children\":[{\"type\":\"column\",\"props\":{\"image_position\":\"center-center\",\"position_sticky_breakpoint\":\"m\"},\"children\":[{\"name\":\"Panel Style Card Default\",\"type\":\"panel\",\"props\":{\"block_align\":\"center\",\"content\":\"<!DOCTYPE html>\\n<html lang=\\\"en\\\">\\n<head>\\n    <meta charset=\\\"UTF-8\\\">\\n    <meta name=\\\"viewport\\\" content=\\\"width=device-width, initial-scale=1.0\\\">\\n    <title>Search Functionality<\\\/title>\\n    \n\n<style>\\n\\n.search-container {\\n    display: flex;\\n    justify-content: center;\\n    align-items: center;\\n    margin-bottom: 20px;\\n \\n}\\n\\n#search-input {\\n    width: 300px;\\n    padding: 10px;\\n    font-size: 18px;\\n    border: 1px solid #ccc;\\n    border-radius: 4px;\\n    margin-right: 10px;\\n    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\\n}\\n\\nbutton {\\n    padding: 10px 20px;\\n    font-size: 18px;\\n    background-color: #f5f5f5;\\n    color: #333;\\n    border: none;\\n    border-radius: 4px;\\n    cursor: pointer;\\n    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\\n}\\n\\n.highlight {\\n    background-color: yellow;\\n}\\n\\n    <\\\/style>\\n<\\\/head>\\n<body>\\n    <input type=\\\"text\\\" id=\\\"search-input\\\" placeholder=\\\"I\\u0161\\u010di...\\\">\\n    <button onclick=\\\"searchText()\\\">I\\u0161\\u010di<\\\/button>\\n<script>document.addEventListener('DOMContentLoaded', () => {\\n    const searchInput = document.getElementById('search-input');\\n\\n    searchInput.addEventListener('keydown', (event) => {\\n        if (event.key === 'Enter') {\\n            searchText();\\n        }\\n    });\\n});\\n\\nfunction searchText() {\\n    \\\/\\\/ Get the search query\\n    const query = document.getElementById('search-input').value;\\n    if (!query) return;\\n\\n    \\\/\\\/ Remove existing highlights\\n    removeHighlights();\\n\\n    \\\/\\\/ Get all the text nodes in the body\\n    const textNodes = getTextNodes(document.body);\\n\\n    \\\/\\\/ Highlight the search query\\n    const firstHighlight = highlightText(textNodes, query);\\n\\n    \\\/\\\/ Scroll to the first highlight\\n    if (firstHighlight) {\\n        firstHighlight.scrollIntoView({ behavior: 'smooth', block: 'center' });\\n        firstHighlight.focus(); \\\/\\\/ Optional: Focus the first highlight for better visibility\\n    }\\n}\\n\\nfunction getTextNodes(node) {\\n    let textNodes = [];\\n    if (node.nodeType === Node.TEXT_NODE) {\\n        textNodes.push(node);\\n    } else {\\n        node.childNodes.forEach(child => {\\n            textNodes = textNodes.concat(getTextNodes(child));\\n        });\\n    }\\n    return textNodes;\\n}\\n\\nfunction highlightText(textNodes, query) {\\n    const queryRegex = new RegExp(query, 'gi');\\n    let firstHighlight = null;\\n\\n    textNodes.forEach(node => {\\n        const matches = node.textContent.match(queryRegex);\\n        if (matches) {\\n            const parent = node.parentNode;\\n            const highlightedFragment = document.createDocumentFragment();\\n\\n            let lastIndex = 0;\\n            node.textContent.split(queryRegex).forEach((part, index) => {\\n                if (index > 0) {\\n                    const highlightSpan = document.createElement('span');\\n                    highlightSpan.classList.add('highlight');\\n                    highlightSpan.textContent = matches[index - 1];\\n                    highlightSpan.tabIndex = -1; \\\/\\\/ Make the span focusable\\n\\n                    if (!firstHighlight) {\\n                        firstHighlight = highlightSpan;\\n                    }\\n\\n                    highlightedFragment.appendChild(highlightSpan);\\n                }\\n                highlightedFragment.appendChild(document.createTextNode(part));\\n                lastIndex += part.length + (matches[index - 1] ? matches[index - 1].length : 0);\\n            });\\n\\n            parent.replaceChild(highlightedFragment, node);\\n        }\\n    });\\n\\n    return firstHighlight;\\n}\\n\\nfunction removeHighlights() {\\n    document.querySelectorAll('.highlight').forEach(el => {\\n        const parent = el.parentNode;\\n        parent.replaceChild(document.createTextNode(el.textContent), el);\\n        parent.normalize(); \\\/\\\/ Merge adjacent text nodes\\n    });\\n}\\n\\n<\\\/script>\\n<\\\/body>\\n<\\\/html>\\n\",\"content_column_breakpoint\":\"m\",\"content_margin\":\"small\",\"icon_width\":80,\"image\":\"\",\"image_align\":\"top\",\"image_grid_breakpoint\":\"m\",\"image_grid_width\":\"1-2\",\"image_height\":\"50\",\"image_svg_color\":\"primary\",\"image_svg_inline\":true,\"image_width\":\"50\",\"link_style\":\"default\",\"link_text\":\"Read more\",\"margin\":\"default\",\"margin_remove_top\":false,\"meta\":\"\",\"meta_align\":\"above-title\",\"meta_element\":\"div\",\"meta_style\":\"text-meta\",\"panel_card_image\":false,\"panel_padding\":\"default\",\"text_align\":\"center\",\"title\":\"\",\"title_align\":\"top\",\"title_element\":\"h3\",\"title_grid_breakpoint\":\"m\",\"title_grid_width\":\"1-2\",\"title_hover_style\":\"reset\"}}]}]},{\"type\":\"row\",\"children\":[{\"type\":\"column\",\"props\":{\"image_position\":\"center-center\",\"position_sticky_breakpoint\":\"m\"},\"children\":[{\"name\":\"Grid Panel Style Card\",\"type\":\"grid\",\"children\":[{\"type\":\"grid_item\",\"props\":{\"content\":\"\"},\"source\":{\"query\":{\"name\":\"categories.customCategory\",\"arguments\":{\"id\":43},\"field\":{\"name\":\"pages\",\"arguments\":{\"offset\":0,\"limit\":10,\"order\":\"date\",\"order_direction\":\"DESC\"}}},\"props\":{\"title\":{\"filters\":{\"search\":\"\"},\"name\":\"title\"},\"meta\":{\"filters\":{\"search\":\"\",\"date\":\"\"},\"name\":\"date\"},\"image\":{\"filters\":{\"search\":\"\"},\"name\":\"featuredImage.url\"},\"link\":{\"filters\":{\"search\":\"\"},\"name\":\"link\"}}}}],\"props\":{\"content_column_breakpoint\":\"m\",\"content_margin\":\"small\",\"filter_align\":\"left\",\"filter_all\":true,\"filter_grid_breakpoint\":\"m\",\"filter_grid_width\":\"auto\",\"filter_position\":\"top\",\"filter_style\":\"tab\",\"grid_column_align\":true,\"grid_default\":\"1\",\"grid_medium\":\"3\",\"grid_small\":\"2\",\"icon_width\":80,\"image_align\":\"top\",\"image_grid_breakpoint\":\"m\",\"image_grid_width\":\"1-2\",\"image_link\":true,\"image_svg_color\":\"emphasis\",\"image_width\":\"900\",\"item_animation\":true,\"link_style\":\"text\",\"link_text\":\"Read More\",\"margin\":\"remove-vertical\",\"meta_align\":\"above-title\",\"meta_element\":\"div\",\"meta_style\":\"text-meta\",\"panel_image_no_padding\":true,\"panel_link\":false,\"panel_padding\":\"default\",\"panel_style\":\"card-default\",\"parallax_easing\":\"1\",\"show_content\":true,\"show_image\":true,\"show_link\":true,\"show_meta\":false,\"show_title\":true,\"title_align\":\"top\",\"title_element\":\"h2\",\"title_grid_breakpoint\":\"m\",\"title_grid_width\":\"1-2\",\"title_hover_style\":\"reset\",\"title_link\":true,\"title_margin\":\"small\",\"title_style\":\"h3\"}}]}]}]}],\"version\":\"4.4.7\"} --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>NASTANITVE Search Functionality I\u0161\u010di<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[],"tags":[],"class_list":["post-2319","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/noella.si\/new\/wp-json\/wp\/v2\/pages\/2319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/noella.si\/new\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/noella.si\/new\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/noella.si\/new\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/noella.si\/new\/wp-json\/wp\/v2\/comments?post=2319"}],"version-history":[{"count":116,"href":"https:\/\/noella.si\/new\/wp-json\/wp\/v2\/pages\/2319\/revisions"}],"predecessor-version":[{"id":3102,"href":"https:\/\/noella.si\/new\/wp-json\/wp\/v2\/pages\/2319\/revisions\/3102"}],"wp:attachment":[{"href":"https:\/\/noella.si\/new\/wp-json\/wp\/v2\/media?parent=2319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/noella.si\/new\/wp-json\/wp\/v2\/categories?post=2319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/noella.si\/new\/wp-json\/wp\/v2\/tags?post=2319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}