PageSourceSearch

https://proswastika.org/e107_themes/proswastikav2/jslib/Gps.js

js proswastika.org collected 2026-09-24 23:54:37 UTC 2,921 bytes, 80 lines download raw bytes

1class Gps {
2    constructor(map)
3    {
4        this.map = map;
5    }
6
7    main()
8    {
9        if(document.querySelector('article #map')) {
10            this.map.setView([lat, lng], 12, {animation: true});
11        }
12        this.findAll();
13    }
14
15    async findAll()
16    {
17        let form = new FormData();
18        form.append("methode", "findAll");
19
20        await fetch("/newsAjax.php", {method: "POST", body: form, 'Content-type': 'text/plain; charset=utf-8'}).then((res) => {
21            if (res.ok && 200 === res.status) {
22                res.json().then((gps) => {
23                    // console.log(gps);
24
25                    if(Object.assign({}, gps)) {
26                        for (let other in gps.list) {
27                            let marker = new L.marker([gps.list[other].lat, gps.list[other].lng], {title : gps.list[other].title});
28
29                            let bindPopup = this.manageListGps(gps.list[other], gps.language, gps.domain);
30
31                            for(let u = parseInt(other)+1; u < gps.list.length; u++) {
32                                if(gps.list[u] && gps.list[other].lat === gps.list[u].lat && gps.list[other].lng === gps.list[u].lng) {
33                                    let tmp = this.manageListGps(gps.list[u], gps.language, gps.domain);
34
35                                    bindPopup += tmp;
36                                    delete gps.list[u];
37                                }
38                            }
39
40                            marker.bindPopup(bindPopup).openPopup();
41
42                            this.map.addLayer(marker);
43                        }
44                    }
45                });
46            } else {
47                throw("Thnaks to refresh this page (" + res.status + ") " + res.statusText);
48            }
49        }).catch((e) => {
50            console.error(e);
51        });
52    }
53
54    manageListGps(gps, language, domain)
55    {
56        let title = gps.title;
57        let bindPopup = '';
58
59        for(let i = 0; i < gps.languages.length; i++) {
60            if(gps.languages[i].language === language) {
61                bindPopup = `<div class="markerTitle">
62                                - <a class="popup" href="news.php?extend.${gps.languages[i].id}.${gps.languages[i].category}">${title}</a>
63                             </div>`;
64                break;
65            }
66        }
67
68        if(!bindPopup) {
69            for (let i = 0; i < gps.languages.length; i++) {
70                let language = gps.languages[i].language;
71
72                bindPopup += `<div class="markerTitle">
73                                  <a href="${gps.languages[i].code ? `${window.location.protocol}//${gps.languages[i].code}.` : `${window.location.protocol}//`}${domain}news.php?extend.${gps.languages[i].id}.${gps.languages[i].category}">- ${title} (${language})</a>
74                              </div>`;
75            }
76        }
77
78        return bindPopup;
79    }
80}

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.