PageSourceSearch

https://www.renfrewshiregolfunion.co.uk/js/utils/dotgolf.utils.js

js renfrewshiregolfunion.co.uk collected 2026-09-27 15:22:18 UTC 3,937 bytes, 96 lines download raw bytes

1function dgNumberToMoney(amount, currency) {
2    var i = parseFloat(amount);
3    if (isNaN(i)) { i = 0.00; }
4    var minus = '';
5    if (i < 0) { minus = '-'; }
6    i = Math.abs(i);
7    i = parseInt((i + .005) * 100);
8    i = i / 100;
9    s = new String(i);
10    if (s.indexOf('.') < 0) { s += '.00'; }
11    if (s.indexOf('.') == (s.length - 2)) { s += '0'; }
12    s = minus + s;
13    var currencySymbol = currency ? currency : "$";    
14    return currencySymbol + s;
15}
16
17
18const popupCenter = ({ url, title, w, h }) => {
19    const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX;
20    const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;
21
22    const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
23    const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
24
25    const systemZoom = width / window.screen.availWidth;
26    const left = (width - w) / 2 / systemZoom + dualScreenLeft
27    const top = (height - h) / 2 / systemZoom + dualScreenTop
28    const newWindow = window.open(url, title,
29        `
30      scrollbars=yes,
31      width=${w / systemZoom}, 
32      height=${h / systemZoom}, 
33      top=${top}, 
34      left=${left}
35      `
36    )
37
38    if (window.focus) newWindow.focus();
39}
40
41function uEditControl(controlId, pageControlId, priority, controlName, isHidden = false) {
42    popupCenter({
43        url: '/admin-edit-control.html?mode=edit&controlId=' + controlId + '&pageControlId=' + pageControlId + '&priority=' + priority + '&controlName=' + encodeURI(controlName) + '&isHidden=' + isHidden,
44        title: 'Page Control Settings',
45        w: 400,
46        h: 400
47    });
48}
49
50function uAddControl(controlId, pageControlId, beforeControl = false) {
51    popupCenter({
52        url: '/admin-edit-control.html?mode=add&controlId=' + controlId + '&pageControlId=' + pageControlId + '&beforeControl=' + beforeControl,
53        title: 'Page Control Settings',
54        w: 400,
55        h: 400
56    });
57}
58
59/**
60 * A ClubCMS global method that exclude test club names from a list of Club results.
61 * Instantiate after '/api/clubs/GetClubHierarchies'.
62 * 
63 * @param {any} listOfClubs A raw object response from ajax call.
64 * @param {boolean} isExcludeTestClubNames A boolean control property value.
65 * @param {string} testClubNameKeys A string control property value contains at least single or comma delimited string of test Club names.
66 * @returns A clean list of Club row sets.
67 */
68function dgRemoveTestClub(listOfClubs, isExcludeTestClubNames, testClubNameKeys) {
69    if (listOfClubs && isExcludeTestClubNames) {
70        let keys = ['test']; //set a default value, might remove from control property value defaults
71
72        if (testClubNameKeys != null && testClubNameKeys.length > 0) {
73            //The callback function, .filter(Boolean) removes all "falsy" values,
74            //including empty strings(""), 0, null, undefined, false, and NaN.
75            //Whilst, the "truthy" values are kept.
76            let keyValues = testClubNameKeys.split(',').filter(Boolean); // this validates a value like a series of commas: ',,,,'
77            //
78            if (keyValues.length > 0) {
79                keys = keyValues;
80            }
81        }
82
83        keys.forEach((key) => {
84            let lkey = key.trim().toLowerCase();
85
86            for (let idx = listOfClubs.length - 1; idx >= 0; --idx) {
87                let club = listOfClubs[idx].ClubName.toLowerCase();
88
89                if (club.indexOf(lkey) > -1) { //when test club found 
90                    listOfClubs.splice(idx, 1); //remove rowset of this test club
91                }
92            }
93        });
94    }
95    return listOfClubs;
96}

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.