PageSourceSearch

https://www.hypersuggest.com/assets/main/js/subscription/onDemand.js?v=1.0.0

js hypersuggest.com collected 2026-09-29 03:06:02 UTC 4,583 bytes, 131 lines download raw bytes

1(function ($) {
2    "use strict";
3
4    $(window).on("load", function () {
5        if ($(".js-range-slider-credits").length > 0) {
6            $(".js-range-slider-credits").ionRangeSlider({
7                values: calculateValues(1000, 10000000),
8                onChange: function (data) {
9                    updateOnDemandPrices();
10                },
11            });
12            updateOnDemandPrices();
13        }
14    });
15
16    let calculateValues = function (min, max) {
17        let values = [];
18        let step = 1;
19        let currentValue = min;
20
21        // Find the starting step
22        while (min >= step * 10) {
23            step *= 10;
24        }
25
26        while (currentValue <= max) {
27            values.push(currentValue);
28
29            if (currentValue + step > step * 10) {
30                step *= 10;
31            }
32
33            currentValue += step;
34        }
35        values.push(max);
36
37        return values;
38    };
39
40    let updateOnDemandPrices = function () {
41        let credits = $(".js-range-slider-credits").val();
42        credits = credits === "" ? 1000 : credits;
43        let totalAmount = Math.round(credits * 0.005);
44
45        let currency = $(".pricing-form").attr("data-currency");
46
47        let keywordDiscoveryCount = Math.round(credits / 15);
48        let clusteringCount = Math.round(credits * 1);
49        let rankTracking = Math.round(credits / 2 / 30);
50        let paaCount = Math.round(credits / 100);
51
52        $("#pricing-on-demand .total-amount").text(
53            parseInt(totalAmount).toLocaleString(
54                hypertool.environment.language,
55                {
56                    style: "currency",
57                    currency: currency,
58                    maximumFractionDigits: 0,
59                }
60            )
61        );
62        $("#pricing-on-demand .total-credits").text(
63            parseInt(credits).toLocaleString(hypertool.environment.language)
64        );
65        $("#pricing-on-demand .keyword-research-value").text(
66            keywordDiscoveryCount.toLocaleString(hypertool.environment.language)
67        );
68        $("#pricing-on-demand .clustering-value").text(
69            clusteringCount.toLocaleString(hypertool.environment.language)
70        );
71        $("#pricing-on-demand .rank-tracking-value").text(
72            rankTracking.toLocaleString(hypertool.environment.language)
73        );
74        $("#pricing-on-demand .paa-value").text(
75            paaCount.toLocaleString(hypertool.environment.language)
76        );
77    };
78
79    $(document).on(
80        "click",
81        "form.pricing-form button.submit-on-demand",
82        function () {
83            let $form = $("form.pricing-form");
84            let $button = $(this);
85            $button.attr("data-button-loading", "").prop("disabled", true);
86
87            let creditsCount = $form.find(".js-range-slider-credits").val();
88
89            let data = {
90                credits_count: creditsCount,
91            };
92
93            let formData = new FormData();
94            formData.append("data", JSON.stringify(data));
95
96            $.when(
97                hypertool.ajax(
98                    "add_on_demand_credits",
99                    formData,
100                    function (response) {
101                        $button
102                            .removeAttr("data-button-loading")
103                            .prop("disabled", false);
104
105                        if (
106                            response["status"] === "success" &&
107                            response["data"]["payment_link"] !== null
108                        ) {
109                            window.location.href =
110                                response["data"]["payment_link"];
111                        } else if (response["status"] === "success") {
112                            let successUrl = new URL(
113                                hypertool.environment.url + "/checkout/success"
114                            );
115                            successUrl.searchParams.append("type", "on_demand");
116
117                            window.location.href = successUrl;
118                        }
119
120                        if (response["status"] == "error") {
121                            $("body").append(response["data"]["message"]);
122                            hypertool.showModal(
123                                "#" + response["data"]["message_id"]
124                            );
125                        }
126                    }
127                )
128            );
129        }
130    );
131})(jQuery);

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.