betterplace-content 0.7.112 → 0.7.115

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/_layouts/default.html +12 -7
  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: 635e38ae2266d1885d8621b6d69f0bd78a45581d1a95505b4315ddc9c3483317
4
+ data.tar.gz: d5887fc99523b488835aae75f6272e468dbcb8c9378b1f39640e1efc8e4a1268
5
5
  SHA512:
6
- metadata.gz: 3e4ecb3efb34dc979cc81e0212e5a57a5f7249c9c11f68a236be0b056ec11129d01df4b2017988e8e6e2ed72d41aa5fd9c73ea11326f4bca52cc11abc86dd98e
7
- data.tar.gz: 494c35a58e18785c4bc9e9203ab622fb4d02a75ec3ecf7e25c47d938dcc41b14793d63c0e3b939fdeb9a4c7ffe408e2dd87bbabaefe4d57e54c767ea686d83b2
6
+ metadata.gz: d9dcc5bbae5dc82bd7edf9414155abfbd827cdd9411233733cb0b5ce69e17038321b045300fe7ad0c06170f229335342b7edbf0da4dc9b1edae201809dbd87db
7
+ data.tar.gz: dee07c5f339f2b7371f279398b58d8a57bd99bb450acecef2f19f0888789079758837b25adf8c562bc028508152aaf206539352b324f10b459f437d985a2230c
@@ -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,17 +136,23 @@ 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
 
153
+ {% comment -%}
154
+ // These scripts must be loaded AFTER the DOMContentLoaded listener above is defined.
155
+ {% endcomment -%}
151
156
  <script src="{{ style_host }}/de/layouts/current_pack/application"></script>
152
157
  <script src="{{ style_host }}/de/layouts/current_pack/locale_{{ site.lang }}"></script>
153
158
  <script src="{{ style_host }}/de/layouts/current_pack/homepage"></script>
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.115
5
5
  platform: ruby
6
6
  authors:
7
7
  - betterplace.org Developers