PageSourceSearch

https://board.portal2.sr/js/score.js

js portal2.sr collected 2026-09-25 22:09:20 UTC 1,601 bytes, 60 lines download raw bytes

1function formatScoreTime(time) {
2    time = Math.abs(time);
3    time = Math.round(time);
4    var hundreds = (time % 100);
5    var totalSeconds = Math.floor(time / 100);
6    var minutes = Math.floor(totalSeconds / 60);
7    var seconds = totalSeconds % 60 ;
8
9    if (seconds < 10 && minutes > 0)
10        seconds = "0"+seconds.toString();
11    if (hundreds < 10)
12        hundreds = "0"+hundreds.toString();
13
14    if (minutes > 0) {
15        return minutes + ":" + seconds + "." + hundreds;
16    } else {
17        return seconds + "." + hundreds;
18    }
19}
20
21function getScoreFromString(str) {
22
23    if (!str.match(/^[0-9.:]+$/g) ) {
24        return null;
25    }
26
27    var hours = 0;
28    var minutes = 0;
29    var seconds = 0;
30    if (str.indexOf(":") != -1) {
31        var minutesOrHours = parseInt(str.split(":")[0]);
32        str = str.split(":")[1];
33        if (str.indexOf(":") != -1) {
34            hours = minutesOrHours;
35            minutes = parseInt(str.split(":")[0]);
36            str = str.split(":")[1];
37        } else {
38            minutes = minutesOrHours;
39        }
40    }
41
42    if (str.indexOf(".") != -1) {
43        seconds = parseInt(str.split(".")[0]);
44        str = str.split(".")[1];
45    } else {
46        return null;
47    }
48
49    var hundredths = 0;
50    var hundredthsStr = str.split(".")[0];
51    if (hundredthsStr.length == 1) {
52        hundredths = 10 * parseInt(hundredthsStr);
53    } else if (hundredthsStr.length == 2) {
54        hundredths = parseInt(hundredthsStr);
55    } else {
56        return null;
57    }
58
59    return hundredths + (100 * seconds) + (100 * 60 * minutes) + (100 * 60 * 60 * hours);
60}

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.