betterplace-content 0.7.111 → 0.7.114

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 +26 -8
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 852a3dc718ff902ec2d407c08ea42eab020e4c8a567ffc4b795c7c3e5d569a92
4
- data.tar.gz: 1023f93eab4d476a8a2f5f04ace23d4fcf70e084a325e72a85493acbf957559d
3
+ metadata.gz: cc9bce1e12fa89694ea584859fb3707b65ab87e19356722f728a181890792bd3
4
+ data.tar.gz: 5ce506be0ab8ef2d65d6b4b2c7587d555fd97da291e2769a25ab3a4b34172581
5
5
  SHA512:
6
- metadata.gz: e486032d796fd41259b0e1a6a728aed0a39a4a061b7218522949008fa8dbc616ada779a7f1d77f40e868365128d8e792aa416bee22362bd64c5bd6bc49a65769
7
- data.tar.gz: 3a50ec78cc3a8fc05637fcd4fb3cb68616592320978e99ff975cd222f11aeb01bfa32f0e0be026157e453e6485143ad4aaa6a8ebd8f57cdf8f16ee2e0bdf4e79
6
+ metadata.gz: 4c2ba79981bd461dc783f81b552cf7a83a03e6efe507ce31069521bb9f9a9656585b61f6c01e3dc127a64eddff60f1f77fea5d52c0bfd2d9b9a591e23d504e86
7
+ data.tar.gz: 3244a0c30e05c1452694bda19955fbdd3cc89ba26e4c0acab8d170a8558b31e334c0ca62063197282965999965d8fcd6da2bbb735b9da1f1e881e6c6661acbb7
@@ -110,11 +110,7 @@ Update 2019-07-19: Another problem that came us is, that URLs endet in .html whi
110
110
 
111
111
  </div>
112
112
 
113
- <script src="{{ style_host }}/de/layouts/current_pack/application"></script>
114
- <script src="{{ style_host }}/de/layouts/current_pack/locale_{{ site.lang }}"></script>
115
- <script src="{{ style_host }}/de/layouts/current_pack/homepage"></script>
116
113
  <script>
117
- // Make sure we can test the Rails-staging CSS on jekyll-staging.
118
114
  {% comment -%}
119
115
  // For Staging: Simulate the environment by replacing the URLs.
120
116
  // For Development: This does nothing, unless you force `JEKYLL_ENV=production`.
@@ -126,18 +122,40 @@ Update 2019-07-19: Another problem that came us is, that URLs endet in .html whi
126
122
  // app.cloudcannon.com, proxy.cloudcannon.com: do nothing
127
123
  // www.bp42.com: replace
128
124
  {% endcomment -%}
129
- const prd = window.location.hostname.indexOf('.org') !== -1
130
- const dev = window.location.hostname.indexOf('.dev') !== -1
131
- const edit = window.location.hostname.indexOf('.cloud') !== -1
132
- if (!prd && !dev && !edit) {
125
+
126
+ const replaceHost = () => {
127
+ if (!/\.(?:org|dev|cloud)/.test(window.location.hostname)) return
128
+
133
129
  document.querySelectorAll("[href]").forEach(element => {
134
130
  if (element.href.includes('www.betterplace.org')) {
135
131
  element.href = element.href.replace('www.betterplace.org', window.location.hostname)
136
132
  element.setAttribute('data-host-replaced', 'true')
137
133
  }
138
134
  })
135
+
136
+ {% comment -%}
137
+ // Some URLs in the header files are stored in data attributes for use in React.
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
+ {% endcomment -%}
141
+ ;['data-login-url', 'data-login-check-url', 'data-search-url'].forEach(dataAttr => {
142
+ document.querySelectorAll("[" + dataAttr + "]").forEach(element => {
143
+ const modifiedUrl = element.getAttribute(dataAttr).replace('www.betterplace.org', window.location.hostname)
144
+ element.setAttribute(dataAttr, modifiedUrl)
145
+ element.setAttribute('data-host-replaced', 'true')
146
+ })
147
+ })
139
148
  }
149
+
150
+ document.addEventListener('DOMContentLoaded', replaceHost)
140
151
  </script>
141
152
 
153
+ {% comment -%}
154
+ // These scripts must be loaded AFTER the DOMContentLoaded listener above is defined.
155
+ {% endcomment -%}
156
+ <script src="{{ style_host }}/de/layouts/current_pack/application"></script>
157
+ <script src="{{ style_host }}/de/layouts/current_pack/locale_{{ site.lang }}"></script>
158
+ <script src="{{ style_host }}/de/layouts/current_pack/homepage"></script>
159
+
142
160
  </body>
143
161
  </html>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: betterplace-content
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.111
4
+ version: 0.7.114
5
5
  platform: ruby
6
6
  authors:
7
7
  - betterplace.org Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-20 00:00:00.000000000 Z
11
+ date: 2022-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  - !ruby/object:Gem::Version
218
218
  version: '0'
219
219
  requirements: []
220
- rubygems_version: 3.2.30
220
+ rubygems_version: 3.3.15
221
221
  signing_key:
222
222
  specification_version: 4
223
223
  summary: betterplace.org's Jekyll Content Theme