PageSourceSearch

https://www.3dmark.com/static/n9A9NJ0RKK678t1hXy7Ijl2JFFgsIjNl5fZv0BIEJ9t.js

js 3dmark.com collected 2026-10-02 04:46:19 UTC 3,493 bytes, 101 lines download raw bytes

1if(!$)
2    $ = jQuery;
3
4$(document).ready(function () {
5    console.log("prices.js loaded");
6
7    /* Add/remove discounted prices below
8        "3dm adv": "$8.74",
9        "3dmandpcm10andvrm adv": "$14.85",
10        "pcm10 adv": "$7.49",
11        "vrm adv": "$4.99",
12    */
13    var discounts = {
14        /*"3dm adv": "$8.75",
15        "pcm10 adv": "$7.49",
16        "vrm adv": "$4.99",
17        "3dmandpcm10andvrm adv": "$16.94",
18        "3dmstorage adv": "$1.49",
19        "3dmspeedway adv": "$2.49"*/
20    };
21
22    var rootUrl = window.location.href;
23    var pricesJsonUrl = "";
24
25    if (rootUrl.indexOf("localhost") > -1) {
26        pricesJsonUrl = window.location.protocol + "//"  + window.location.host + "/beachhead/cooltown/ajax/prices";
27    } else {
28        // TODO: fix this. cannot use window.location.host since this is used in futuremark.com, 3dmark.com and benchmarks.ul.com
29        pricesJsonUrl = "https://benchmarks.ul.com/cooltown/ajax/prices";
30    }
31
32    var isChineseSite = (window.location.host.indexOf("cn.") == 0 || window.location.host.indexOf("zh-") == 0)
33
34    //var rootUrl = window.location.protocol + "//"  + window.location.host; //href.match(/(^.*)\/benchmarks(?:$|\/)/)[1];
35    //var pricesJsonUrl = rootUrl + "/cooltown/cooltown/ajax/prices";
36
37    function splitPrice(price) {
38        var currencyAmountMatch = price.match("^([^0-9].*?)(|[0-9]*\.[0-9]+|[0-9]+)$");
39        if(currencyAmountMatch) {
40            return {"currency": currencyAmountMatch[1], "amount": currencyAmountMatch[2], "currencyFirst": true};
41        }
42
43        var amountCurrencyMatch = price.match("^([0-9]*\.[0-9]+|[0-9]+)([^0-9].*?)$");
44        if(amountCurrencyMatch) {
45            return {"currency": amountCurrencyMatch[2], "amount": amountCurrencyMatch[1], "currencyFirst": false};
46        }
47    }
48
49    function joinPrice(priceParts) {
50        if(priceParts.currencyFirst) {
51            return priceParts.currency + priceParts.amount;
52        } else {
53            return priceParts.amount + priceParts.currency;
54        }
55    }
56
57    function getChinesePrice(price) {
58        var priceParts = splitPrice(price);
59        if(priceParts !== undefined) {
60            priceParts.currency = " \u7f8e\u5143";
61            priceParts.currencyFirst = false;
62
63            return joinPrice(priceParts);
64        }
65    }
66
67    $.getJSON(pricesJsonUrl, function(prices) {
68        var price_elems = $(".price");
69        price_elems.each(function(i, domElem) {
70            var elem = $(domElem);
71
72            var product = elem.attr("data-product");
73            var edition = elem.attr("data-edition");
74
75            if(product !== undefined && edition !== undefined) {
76                var standardPrice = prices[product][edition];
77
78                if(isChineseSite) {
79                    standardPrice = getChinesePrice(standardPrice);
80                }
81
82                var discountKey = product + " " + edition;
83
84                elem.empty();
85                if(discounts.hasOwnProperty(discountKey)) {
86                    var discountPrice = discounts[discountKey];
87
88                    if(isChineseSite) {
89                        discountPrice = getChinesePrice(discountPrice);
90                    }
91
92                    elem.append($('<span class="strike">').text(standardPrice));
93                    elem.append("&nbsp;&nbsp;");
94                    elem.append(discountPrice);
95                } else {
96                    elem.append(standardPrice);
97                }
98            }
99        });
100    });
101});

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.