betterplace-content 0.7.112 → 0.7.113

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/_layouts/default.html +15 -10
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6de0427027848af378b51d0a48235a87b8b6d11a911014f751095d899f7f4990
4
- data.tar.gz: e53908f2047919150eb0778e1baab6e57d53098390b50f2495c3fd9b86a1223a
3
+ metadata.gz: ce3b385ede297a78abda000a636b83b46b76b0d325bbdbfe89def175e6b82ce0
4
+ data.tar.gz: 6926abc0e908ec56e63673546ed71c340fdcac65e8c831b68cc15ac4477485f4
5
5
  SHA512:
6
- metadata.gz: 3e4ecb3efb34dc979cc81e0212e5a57a5f7249c9c11f68a236be0b056ec11129d01df4b2017988e8e6e2ed72d41aa5fd9c73ea11326f4bca52cc11abc86dd98e
7
- data.tar.gz: 494c35a58e18785c4bc9e9203ab622fb4d02a75ec3ecf7e25c47d938dcc41b14793d63c0e3b939fdeb9a4c7ffe408e2dd87bbabaefe4d57e54c767ea686d83b2
6
+ metadata.gz: 14ee258b0076621c43874dc8a141b237b4ae3c195a32e64ebf3b99a3e69a0ff2faa139355300d7ff1821016a31b2a1d6ca9fa2fbb2d3849b5ece7f9ca408eafc
7
+ data.tar.gz: db46b151b18598ab65eb273097866461119cf8b4ecf0817d86cc57508eb7e8f1f935c32dcb468d3bee77cf6b7a21bc139e78f716566dd79cf8a38a24eb7d9221
@@ -111,7 +111,6 @@ Update 2019-07-19: Another problem that came us is, that URLs endet in .html whi
111
111
  </div>
112
112
 
113
113
  <script>
114
- // Make sure we can test the Rails-staging CSS on jekyll-staging.
115
114
  {% comment -%}
116
115
  // For Staging: Simulate the environment by replacing the URLs.
117
116
  // For Development: This does nothing, unless you force `JEKYLL_ENV=production`.
@@ -123,10 +122,10 @@ Update 2019-07-19: Another problem that came us is, that URLs endet in .html whi
123
122
  // app.cloudcannon.com, proxy.cloudcannon.com: do nothing
124
123
  // www.bp42.com: replace
125
124
  {% endcomment -%}
126
- const prd = window.location.hostname.indexOf('.org') !== -1
127
- const dev = window.location.hostname.indexOf('.dev') !== -1
128
- const edit = window.location.hostname.indexOf('.cloud') !== -1
129
- if (!prd && !dev && !edit) {
125
+
126
+ const replaceHost = () => {
127
+ if (!/\.(?:org|dev|cloud)/.test(window.location.hostname)) return
128
+
130
129
  document.querySelectorAll("[href]").forEach(element => {
131
130
  if (element.href.includes('www.betterplace.org')) {
132
131
  element.href = element.href.replace('www.betterplace.org', window.location.hostname)
@@ -137,20 +136,26 @@ Update 2019-07-19: Another problem that came us is, that URLs endet in .html whi
137
136
  {% comment -%}
138
137
  // Some URLs in the header files are stored in data attributes for use in React.
139
138
  // These cases can be found by searching for /data[^'"]*['"]http/ in this repo.
139
+ // The preceding semicolon is required in browser JS land ;)
140
140
  {% endcomment -%}
141
- ['data-login-url', 'data-login-check-url', 'data-search-url'].forEach(dataAttr => {
142
- document.querySelectorAll("["+ dataAttr + "]").forEach(element => {
141
+ ;['data-login-url', 'data-login-check-url', 'data-search-url'].forEach(dataAttr => {
142
+ document.querySelectorAll("[" + dataAttr + "]").forEach(element => {
143
143
  const modifiedUrl = element.getAttribute(dataAttr).replace('www.betterplace.org', window.location.hostname)
144
144
  element.setAttribute(dataAttr, modifiedUrl)
145
145
  element.setAttribute('data-host-replaced', 'true')
146
146
  })
147
147
  })
148
148
  }
149
+
150
+ document.addEventListener('DOMContentLoaded', replaceHost)
149
151
  </script>
150
152
 
151
- <script src="{{ style_host }}/de/layouts/current_pack/application"></script>
152
- <script src="{{ style_host }}/de/layouts/current_pack/locale_{{ site.lang }}"></script>
153
- <script src="{{ style_host }}/de/layouts/current_pack/homepage"></script>
153
+ {% comment -%}
154
+ // These scripts must be loaded AFTER the DOMContentLoaded listener above is defined.
155
+ {% endcomment -%}
156
+ <script src="https://betterplace.dev/de/layouts/current_pack/application"></script>
157
+ <script src="https://betterplace.dev/de/layouts/current_pack/locale_{{ site.lang }}"></script>
158
+ <script src="https://betterplace.dev/de/layouts/current_pack/homepage"></script>
154
159
 
155
160
  </body>
156
161
  </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: betterplace-content
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.112
4
+ version: 0.7.113
5
5
  platform: ruby
6
6
  authors:
7
7
  - betterplace.org Developers