


{"id":7,"date":"2026-01-27T15:32:40","date_gmt":"2026-01-27T15:32:40","guid":{"rendered":"https:\/\/openai-search.marketport.site\/?page_id=7"},"modified":"2026-01-27T15:32:40","modified_gmt":"2026-01-27T15:32:40","slug":"ai-matcher","status":"publish","type":"page","link":"https:\/\/openai-search.marketport.site\/?page_id=7","title":{"rendered":"Ai matcher"},"content":{"rendered":"        <div class=\"ai-matcher\" data-endpoint=\"https:\/\/openai-search.marketport.site\/index.php?rest_route=\/ai-matcher\/v1\/match\" data-nonce=\"add9b2b646\" data-highlight=\"0\">\n            <form class=\"ai-matcher-form\" action=\"#\" method=\"post\">\n                <input\n                    type=\"text\"\n                    class=\"ai-matcher-input\"\n                    placeholder=\"I want a website\"\n                    required\n                \/>\n                <button type=\"submit\" class=\"ai-matcher-submit\">\n                    Start analysis                <\/button>\n            <\/form>\n\n            <div class=\"ai-matcher-status\" hidden><\/div>\n\n            <div class=\"ai-matcher-results\" hidden>\n                <section class=\"ai-matcher-requirements\" hidden>\n                    <h3 class=\"ai-matcher-title\">Requirements<\/h3>\n                    <ul class=\"ai-matcher-list\"><\/ul>\n                <\/section>\n\n                <section class=\"ai-matcher-matches\" hidden>\n                    <h3 class=\"ai-matcher-title\">Matches<\/h3>\n                    <ul class=\"ai-matcher-list\"><\/ul>\n                <\/section>\n\n                <section class=\"ai-matcher-open-points\" hidden>\n                    <h3 class=\"ai-matcher-title\">Open points<\/h3>\n                    <ul class=\"ai-matcher-list\"><\/ul>\n                <\/section>\n\n                <div class=\"ai-matcher-confidence\" hidden>\n                    <strong>Confidence:<\/strong>\n                    <span class=\"ai-matcher-confidence-value\"><\/span>\n                <\/div>\n            <\/div>\n        <\/div>\n\n        <script>\n        (function(){\n            var root = document.currentScript.previousElementSibling;\n            if (!root || !root.classList.contains('ai-matcher')) return;\n\n            var form = root.querySelector('.ai-matcher-form');\n            var input = root.querySelector('.ai-matcher-input');\n            var status = root.querySelector('.ai-matcher-status');\n            var results = root.querySelector('.ai-matcher-results');\n            var reqSec = root.querySelector('.ai-matcher-requirements');\n            var matchSec = root.querySelector('.ai-matcher-matches');\n            var openSec = root.querySelector('.ai-matcher-open-points');\n            var confBox = root.querySelector('.ai-matcher-confidence');\n            var confVal = root.querySelector('.ai-matcher-confidence-value');\n\n            var endpoint = root.getAttribute('data-endpoint');\n            var nonce = root.getAttribute('data-nonce');\n            var highlightEnabled = root.getAttribute('data-highlight') === '1';\n\n            function setStatus(msg){\n                status.textContent = msg || '';\n                status.hidden = !msg;\n            }\n\n            function clearList(sec){\n                var ul = sec.querySelector('ul');\n                ul.innerHTML = '';\n            }\n\n            function highlightText(text, terms) {\n                if (!highlightEnabled || !terms || !terms.length) return text;\n                var escaped = terms.map(function(t){ return t.replace(\/[.*+?^${}()|[\\]\\\\]\/g, '\\\\$&'); });\n                var regex = new RegExp('(' + escaped.join('|') + ')', 'gi');\n                return text.replace(regex, '<mark>$1<\/mark>');\n            }\n\n            function fillList(sec, items, isMatch){\n                var ul = sec.querySelector('ul');\n                clearList(sec);\n                if (!items || !items.length) {\n                    sec.hidden = true;\n                    return;\n                }\n                items.forEach(function(it){\n                    var li = document.createElement('li');\n\n                    if (isMatch && it.url) {\n                        var a = document.createElement('a');\n                        a.href = it.url;\n                        a.target = '_blank';\n\n                        var title = it.title || it.id || it.url;\n                        var reason = it.reason || '';\n\n                        if (highlightEnabled && window.__aiMatcherTerms) {\n                            a.innerHTML = highlightText(title, window.__aiMatcherTerms);\n                        } else {\n                            a.textContent = title;\n                        }\n                        li.appendChild(a);\n\n                        if (reason) {\n                            var p = document.createElement('p');\n                            if (highlightEnabled && window.__aiMatcherTerms) {\n                                p.innerHTML = highlightText(reason, window.__aiMatcherTerms);\n                            } else {\n                                p.textContent = reason;\n                            }\n                            li.appendChild(p);\n                        }\n                    } else {\n                        li.textContent = it.reason || it.title || String(it);\n                    }\n\n                    ul.appendChild(li);\n                });\n                sec.hidden = false;\n            }\n\n            form.addEventListener('submit', function(e){\n                e.preventDefault();\n                var q = input.value.trim();\n                if (!q) return;\n\n                setStatus('Analysis in progress\u2026');\n                results.hidden = true;\n\n                fetch(endpoint, {\n                    method: 'POST',\n                    headers: {\n                        'Content-Type': 'application\/json',\n                        'X-WP-Nonce': nonce\n                    },\n                    body: JSON.stringify({ query: q })\n                })\n                .then(function(res){ return res.json(); })\n                .then(function(data){\n                    setStatus('');\n                    results.hidden = false;\n\n                    window.__aiMatcherTerms = Array.isArray(data.requirements)\n                        ? data.requirements.filter(function(r){ return typeof r === 'string'; })\n                        : [];\n\n                    fillList(reqSec, data.requirements || [], false);\n                    fillList(matchSec, data.matches || [], true);\n                    fillList(openSec, data.open_points || [], false);\n\n                    if (typeof data.confidence === 'number') {\n                        confVal.textContent = Math.round(data.confidence * 100) + '%';\n                        confBox.hidden = false;\n                    } else {\n                        confBox.hidden = true;\n                    }\n                })\n                .catch(function(){\n                    setStatus('Error during analysis.');\n                });\n            });\n        })();\n        <\/script>\n        \n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-7","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/openai-search.marketport.site\/index.php?rest_route=\/wp\/v2\/pages\/7","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/openai-search.marketport.site\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/openai-search.marketport.site\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/openai-search.marketport.site\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/openai-search.marketport.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7"}],"version-history":[{"count":1,"href":"https:\/\/openai-search.marketport.site\/index.php?rest_route=\/wp\/v2\/pages\/7\/revisions"}],"predecessor-version":[{"id":8,"href":"https:\/\/openai-search.marketport.site\/index.php?rest_route=\/wp\/v2\/pages\/7\/revisions\/8"}],"wp:attachment":[{"href":"https:\/\/openai-search.marketport.site\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}