@glitchr/transparent 1.0.14 → 1.0.17

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glitchr/transparent",
3
- "version": "1.0.14",
3
+ "version": "1.0.17",
4
4
  "description": "Transparent SPA Application",
5
5
  "main": "src/index.js",
6
6
  "access": "public",
@@ -13,3 +13,25 @@ img[data-src]:not(.loaded) {
13
13
  75% { background-color: #EFEFEFAA;}
14
14
  100% { background-color: transparent;}
15
15
  }
16
+
17
+ @keyframes blinkOpacity {
18
+ 0% { opacity: 1; }
19
+ 25% { opacity: 0; }
20
+ 50% { opacity: 1; }
21
+ 75% { opacity: 0; }
22
+ 100% { opacity: 1; }
23
+ }
24
+
25
+ .error
26
+ {
27
+ animation: blink 5s infinite;
28
+
29
+ width:100vw;
30
+ height: 100vh;
31
+
32
+ background-image:url("../images/error.svg");
33
+ background-position: center;
34
+ background-repeat: no-repeat;
35
+
36
+ animation: blinkOpacity 2s infinite;
37
+ }
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="256" height="256" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
3
+ <!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
4
+ <g>
5
+ <title>Layer 1</title>
6
+ <g stroke="null" id="svg_1">
7
+ <rect stroke="null" id="svg_2" x="0" y="0" opacity="0.3" fill="rgba(105,77,255,0)" height="256.17189" width="256.265636"/>
8
+ <path stroke="null" id="svg_3" fill="#fff" d="m128.132818,21.347657a106.777348,106.738287 0 1 0 106.777348,106.738287a106.777348,106.738287 0 0 0 -106.777348,-106.738287z"/>
9
+ <path stroke="null" id="svg_4" fill="#dd1e1e" d="m128.132818,32.021486a96.099614,96.064459 0 1 0 96.099614,96.064459a96.099614,96.064459 0 0 0 -96.099614,-96.064459zm55.524221,130.220711l-21.35547,21.347657l-34.168751,-34.156252l-34.168751,34.156252l-21.35547,-21.347657l34.168751,-34.156252l-34.168751,-34.156252l21.35547,-21.347657l34.168751,34.156252l34.168751,-34.156252l21.35547,21.347657l-34.168751,34.156252l34.168751,34.156252z"/>
10
+ </g>
11
+ </g>
12
+ </svg>
package/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  import './js/transparent.js';
2
- import './css/index.css';
2
+ import './css/index.scss';
@@ -165,6 +165,7 @@
165
165
  "response_text": {},
166
166
  "response_limit": 25,
167
167
  "throttle": 1000,
168
+ "rescue_reload": 5000,
168
169
  "identifier": "#page",
169
170
  "loader": "#loader",
170
171
  "smoothscroll_duration": "200ms",
@@ -899,21 +900,27 @@
899
900
 
900
901
  Transparent.rescue = function(dom)
901
902
  {
902
- Transparent.activeOut();
903
-
904
903
  console.error("Rescue mode.. called");
905
904
  rescueMode = true;
906
905
 
907
906
  var head = $(dom).find("head").html();
908
907
  var body = $(dom).find("body").html();
909
- if(head == undefined || body == undefined)
910
- window.reload();
911
908
 
912
- document.head.innerHTML = $(dom).find("head").html();
913
- document.body.innerHTML = $(dom).find("body").html();
909
+ if(head == undefined || body == "undefined") {
910
+
911
+ $(Settings.identifier).html("<div class='error'></div>");
912
+
913
+ setTimeout(function() { window.location.reload(); }, Transparent.parseDuration(Settings["rescue_reload"]));
914
+
915
+ } else {
914
916
 
915
- Transparent.evalScript($("head")[0]);
916
- Transparent.evalScript($("body")[0]);
917
+ document.head.innerHTML = $(dom).find("head").html();
918
+ document.body.innerHTML = $(dom).find("body").html();
919
+ Transparent.evalScript($("head")[0]);
920
+ Transparent.evalScript($("body")[0]);
921
+ }
922
+
923
+ Transparent.activeOut();
917
924
  }
918
925
 
919
926
  Transparent.userScroll = function(el = undefined) { return $(el === undefined ? document.documentElement : el).closestScrollable().prop("user-scroll") ?? true; }
@@ -1583,10 +1590,8 @@
1583
1590
  }, type != "POST");
1584
1591
  }
1585
1592
 
1586
- if(Transparent.isRescueMode()) window.location.href = url;
1587
-
1588
1593
  if(history.state && !Transparent.hasResponse(history.state.uuid))
1589
- Transparent.setResponse(history.state.uuid, Transparent.html[0], Transparent.getScrollableElementXY());
1594
+ Transparent.setResponse(history.state.uuid, Transparent.html[0], Transparent.getScrollableElementXY());
1590
1595
 
1591
1596
  // This append on user click (e.g. when user push a link)
1592
1597
  // It is null when dev is pushing or replacing state