{"id":27330,"date":"2026-09-16T13:28:38","date_gmt":"2026-09-16T08:58:38","guid":{"rendered":"https:\/\/wikishop.co\/mag\/?page_id=27330"},"modified":"2026-09-16T15:52:31","modified_gmt":"2026-09-16T11:22:31","slug":"car-loan","status":"publish","type":"page","link":"https:\/\/wikishop.co\/mag\/car-loan\/","title":{"rendered":"car-loan"},"content":{"rendered":"\n    <div id=\"ws-fast-bridge\">\n\n        <iframe\n            id=\"ws-fast-frame\"\n            src=\"https:\/\/wikishop.co\/installment-car-sales\"\n            title=\"\u062a\u0633\u0647\u06cc\u0644\u0627\u062a \u062e\u0631\u06cc\u062f \u062e\u0648\u062f\u0631\u0648\"\n        ><\/iframe>\n\n    <\/div>\n\n    <style>\n\n        #ws-fast-bridge {\n            position: fixed;\n            inset: 0;\n            width: 100%;\n            height: 100%;\n            background: #fff;\n            z-index: 2147483647;\n        }\n\n        #ws-fast-frame {\n            position: absolute;\n            inset: 0;\n            width: 100%;\n            height: 100%;\n            border: 0;\n            background: #fff;\n        }\n\n    <\/style>\n\n    <script>\n    (function () {\n\n        const frame =\n            document.getElementById('ws-fast-frame');\n\n\n        const params =\n            new URLSearchParams(\n                window.location.search\n            );\n\n\n        const TARGET =\n            parseInt(\n                String(\n                    params.get('price') || ''\n                ).replace(\/[^\\d]\/g, ''),\n                10\n            );\n\n\n        let MONTHS =\n            parseInt(\n                params.get('months') || '48',\n                10\n            );\n\n\n        if (![12,24,36,48].includes(MONTHS)) {\n            MONTHS = 48;\n        }\n\n\n        if (!TARGET) {\n            return;\n        }\n\n\n        \/*\n         * URL \u0631\u0627 \u0633\u0631\u06cc\u0639\u0627\u064b \u0634\u0628\u06cc\u0647 \u0645\u0642\u0635\u062f \u0645\u06cc\u200c\u06a9\u0646\u06cc\u0645\n         *\/\n        try {\n\n            window.history.replaceState(\n                {\n                    wikishopBridge: true,\n                    requested: TARGET,\n                    months: MONTHS\n                },\n                '',\n                '\/installment-car-sales'\n            );\n\n        } catch (e) {}\n\n\n        function sleep(ms) {\n\n            return new Promise(\n                resolve =>\n                    setTimeout(resolve, ms)\n            );\n\n        }\n\n\n        function numberFromText(text) {\n\n            return Number(\n                String(text || '')\n                    .replace(\/[^\\d]\/g, '')\n            );\n\n        }\n\n\n        \/*\n         * \u0628\u0647\u200c\u062c\u0627\u06cc delay \u062b\u0627\u0628\u062a\u060c\n         * \u0645\u0646\u062a\u0638\u0631 \u062a\u063a\u06cc\u06cc\u0631 \u0648\u0627\u0642\u0639\u06cc Active \u0645\u06cc\u200c\u0645\u0627\u0646\u06cc\u0645\n         *\/\n        async function waitForActiveChange(\n            getActive,\n            oldIndex,\n            timeout = 500\n        ) {\n\n            const start =\n                performance.now();\n\n\n            while (\n                performance.now() - start <\n                timeout\n            ) {\n\n                const active =\n                    getActive();\n\n\n                if (\n                    active &&\n                    active.index !== oldIndex\n                ) {\n\n                    return active;\n\n                }\n\n\n                await sleep(20);\n\n            }\n\n\n            return getActive();\n\n        }\n\n\n        async function configureTool() {\n\n            const win =\n                frame.contentWindow;\n\n\n            const doc =\n                frame.contentDocument ||\n                win.document;\n\n\n            const slider =\n                doc.querySelector(\n                    '#sliderShow'\n                );\n\n\n            const plusButton =\n                doc.querySelector(\n                    '#left'\n                );\n\n\n            const minusButton =\n                doc.querySelector(\n                    '#right'\n                );\n\n\n            if (\n                !slider ||\n                !plusButton ||\n                !minusButton\n            ) {\n\n                return false;\n\n            }\n\n\n            \/*\n             * -----------------------------\n             * \u0627\u0646\u062a\u062e\u0627\u0628 \u0645\u062f\u062a \u0628\u0627\u0632\u067e\u0631\u062f\u0627\u062e\u062a\n             * -----------------------------\n             *\/\n\n            const monthButton =\n                doc.querySelector(\n                    '#month' + MONTHS\n                );\n\n\n            if (\n                monthButton &&\n                !monthButton.checked\n            ) {\n\n                monthButton.click();\n\n\n                \/*\n                 * \u0641\u0642\u0637 \u062a\u0627 \u0632\u0645\u0627\u0646\u06cc \u0635\u0628\u0631 \u0645\u06cc\u200c\u06a9\u0646\u06cc\u0645\n                 * \u06a9\u0647 slider \u062f\u0648\u0628\u0627\u0631\u0647 \u0622\u0645\u0627\u062f\u0647 \u0634\u0648\u062f\n                 *\/\n                await sleep(150);\n\n            }\n\n\n            \/*\n             * -----------------------------\n             * \u0622\u06cc\u062a\u0645\u200c\u0647\u0627\u06cc \u0627\u0633\u0644\u0627\u06cc\u062f\u0631\n             * -----------------------------\n             *\/\n\n            function getItems() {\n\n                return Array.from(\n                    slider.children\n                )\n                .map(\n                    function (\n                        element,\n                        index\n                    ) {\n\n                        const span =\n                            element.querySelector(\n                                'span'\n                            );\n\n\n                        return {\n\n                            index:\n                                index,\n\n                            element:\n                                element,\n\n                            amount:\n                                numberFromText(\n                                    span\n                                        ? span.textContent\n                                        : ''\n                                ),\n\n                            active:\n                                element.classList\n                                    .contains('active')\n\n                        };\n\n                    }\n                )\n                .filter(\n                    item =>\n                        item.amount > 0\n                );\n\n            }\n\n\n            function getActive() {\n\n                return getItems()\n                    .find(\n                        item =>\n                            item.active\n                    );\n\n            }\n\n\n            const items =\n                getItems();\n\n\n            if (!items.length) {\n                return false;\n            }\n\n\n            \/*\n             * -----------------------------\n             * \u0646\u0632\u062f\u06cc\u06a9\u200c\u062a\u0631\u06cc\u0646 \u0645\u0628\u0644\u063a\n             * -----------------------------\n             *\/\n\n            const targetItem =\n                items.reduce(\n                    function (\n                        best,\n                        item\n                    ) {\n\n                        return (\n                            Math.abs(\n                                item.amount -\n                                TARGET\n                            ) <\n                            Math.abs(\n                                best.amount -\n                                TARGET\n                            )\n                        )\n                            ? item\n                            : best;\n\n                    }\n                );\n\n\n            let active =\n                getActive();\n\n\n            if (!active) {\n                return false;\n            }\n\n\n            \/*\n             * -----------------------------\n             * \u062d\u0631\u06a9\u062a \u0633\u0631\u06cc\u0639 \u0627\u0633\u0644\u0627\u06cc\u062f\u0631\n             * -----------------------------\n             *\/\n\n            let safety = 0;\n\n\n            while (\n                active.index !==\n                    targetItem.index &&\n                safety < 40\n            ) {\n\n                safety++;\n\n\n                const previousIndex =\n                    active.index;\n\n\n                if (\n                    active.index <\n                    targetItem.index\n                ) {\n\n                    plusButton.click();\n\n                } else {\n\n                    minusButton.click();\n\n                }\n\n\n                \/*\n                 * \u0628\u0647 \u062c\u0627\u06cc 450ms\n                 * \u0641\u0642\u0637 \u0645\u0646\u062a\u0638\u0631 \u062a\u063a\u06cc\u06cc\u0631 \u0648\u0627\u0642\u0639\u06cc \u0645\u06cc\u200c\u0645\u0627\u0646\u06cc\u0645\n                 *\/\n                active =\n                    await waitForActiveChange(\n                        getActive,\n                        previousIndex\n                    );\n\n\n                if (!active) {\n                    break;\n                }\n\n            }\n\n\n            \/*\n             * \u0641\u0631\u0635\u062a \u06a9\u0648\u062a\u0627\u0647 \u0628\u0631\u0627\u06cc \u0622\u067e\u062f\u06cc\u062a\n             * \u0645\u0628\u0644\u063a \u0642\u0633\u0637 \u0648 \u0633\u0627\u06cc\u0631 \u062c\u0632\u0626\u06cc\u0627\u062a\n             *\/\n            await sleep(150);\n\n\n            active =\n                getActive();\n\n\n            const installment =\n                doc.querySelector(\n                    '#installment'\n                );\n\n\n            console.log(\n                '[WIKISHOP FAST BRIDGE]',\n                {\n\n                    requested:\n                        TARGET,\n\n                    selected:\n                        active\n                            ? active.amount\n                            : null,\n\n                    months:\n                        MONTHS,\n\n                    installment:\n                        installment\n                            ? installment\n                                .textContent\n                                .trim()\n                            : null\n\n                }\n            );\n\n\n            \/*\n             * -----------------------------\n             * \u0627\u0633\u06a9\u0631\u0648\u0644 \u0631\u0648\u06cc \u0627\u0628\u0632\u0627\u0631\n             * -----------------------------\n             *\/\n\n            const tool =\n                doc.querySelector(\n                    '.slider-containerr'\n                );\n\n\n            if (tool) {\n\n                tool.scrollIntoView({\n                    behavior: 'auto',\n                    block: 'center'\n                });\n\n            }\n\n\n            return true;\n\n        }\n\n\n        \/*\n         * -----------------------------\n         * \u0634\u0631\u0648\u0639 \u0628\u0647 \u0645\u062d\u0636 Load iframe\n         * -----------------------------\n         *\/\n\n        frame.addEventListener(\n            'load',\n            async function () {\n\n                \/*\n                 * \u062f\u06cc\u06af\u0631 1500ms \u0635\u0628\u0631 \u062b\u0627\u0628\u062a \u0646\u062f\u0627\u0631\u06cc\u0645.\n                 * \u0647\u0631 50ms \u0628\u0631\u0631\u0633\u06cc \u0645\u06cc\u200c\u06a9\u0646\u06cc\u0645 \u06a9\u0647\n                 * \u0627\u0628\u0632\u0627\u0631 \u0622\u0645\u0627\u062f\u0647 \u0634\u062f\u0647 \u06cc\u0627 \u0646\u0647.\n                 *\/\n\n                for (\n                    let attempt = 1;\n                    attempt <= 100;\n                    attempt++\n                ) {\n\n                    try {\n\n                        const success =\n                            await configureTool();\n\n\n                        if (success) {\n\n                            return;\n\n                        }\n\n                    } catch (error) {\n\n                        console.error(\n                            '[WIKISHOP FAST]',\n                            error\n                        );\n\n                    }\n\n\n                    await sleep(50);\n\n                }\n\n            }\n        );\n\n\n    })();\n    <\/script>\n\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-27330","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/wikishop.co\/mag\/wp-json\/wp\/v2\/pages\/27330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wikishop.co\/mag\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/wikishop.co\/mag\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/wikishop.co\/mag\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wikishop.co\/mag\/wp-json\/wp\/v2\/comments?post=27330"}],"version-history":[{"count":8,"href":"https:\/\/wikishop.co\/mag\/wp-json\/wp\/v2\/pages\/27330\/revisions"}],"predecessor-version":[{"id":27341,"href":"https:\/\/wikishop.co\/mag\/wp-json\/wp\/v2\/pages\/27330\/revisions\/27341"}],"wp:attachment":[{"href":"https:\/\/wikishop.co\/mag\/wp-json\/wp\/v2\/media?parent=27330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}