Skip to content

Commit 2cb6cb4

Browse files
committed
Update svg links
1 parent d7ba1e5 commit 2cb6cb4

File tree

4 files changed

+34
-29
lines changed

4 files changed

+34
-29
lines changed

content/cc.svg

-5
This file was deleted.

content/ccheart.svg

-12
This file was deleted.

themes/vocabulary_theme/templates/layout.html

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
2-
31
<!doctype html>
42
<meta charset="utf-8">
53
<meta name="viewport" content="width=device-width, initial-scale=1" />
64
<link rel="shortcut icon" type="image/x-icon" href="{{ '/static/favicon.ico'|url }}">
75
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet"
86
integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
9-
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700" rel="stylesheet">
107
<link rel="stylesheet" href="{{ '/static/gen/style.css'|url }}">
118
<link rel="stylesheet" href="{{ get_pygments_stylesheet()|url }}">
9+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@creativecommons/vocabulary@1.0.0-beta.14/css/vocabulary.css">
1210
<meta property="og:site_name" content="Creative Commons" />
1311
<meta property="og:title" content="{{ this.title }}" />
1412
{% if this.description %}
@@ -161,8 +159,9 @@ <h1 class="page-title pb-3 mb-4">{% block header %}{{ this.title }}{% endblock %
161159
<div class="columns">
162160
<div class="column">
163161
<a href="https://creativecommons.org" class="main-logo margin-bottom-bigger">
164-
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" viewBox="0 0 304 73">
165-
<use href="/cc.svg#logomark"></use>
162+
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" viewBox="0 0 304 73"
163+
class=has-text-white>
164+
<use href="#logomark"></use>
166165
</svg>
167166
</a>
168167
<p>
@@ -229,16 +228,14 @@ <h5 class="b-header">Subscribe to our newsletter</h5>
229228
<aside class="donate-section">
230229
<h5>Our work relies on you!</h5>
231230
<p>Help us keep the internet free and open.</p>
232-
{% set cc = site.get('/').attachments.get('ccheart.svg') %}
233231
<a class="button small donate">
234232
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" viewBox="0 0 80 72">
235-
<use href="/ccheart.svg#ccheart"></use>
236-
</svg>Donate now
233+
<use href="#letterheart"></use>
234+
</svg>Donate Now
237235
</a>
238236
</aside>
239237
</div>
240238
</div>
241239
</div>
242240
</footer>
243-
244-
</body>
241+
</body>

webpack/js/main.js

+27-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
1-
$(document).ready(function() {
2-
$(window).scroll(function() {
1+
$(document).ready(function () {
2+
$(window).scroll(function () {
33
if ($(this).scrollTop() > 500) {
44
$('#back-to-top').fadeIn();
55
} else {
66
$('#back-to-top').fadeOut();
77
}
88
});
99
});
10+
11+
const getFullyQualifiedUrl = (path, version) => {
12+
let baseUrl = "https://unpkg.com/@creativecommons/vocabulary"
13+
if (version) {
14+
baseUrl = `${baseUrl}@${version}`
15+
}
16+
return `${baseUrl}/${path}`
17+
}
18+
19+
const patchAssetIntoDom = (asset, version = null) => {
20+
const ajax = new XMLHttpRequest();
21+
ajax.open("GET", getFullyQualifiedUrl(asset, version), true);
22+
ajax.onload = () => {
23+
var div = document.createElement("div");
24+
// Render SVG in the page
25+
div.innerHTML = ajax.responseText;
26+
div.style.display = 'none';
27+
document.body.insertBefore(div, document.body.childNodes[0]);
28+
}
29+
30+
ajax.send();
31+
}
32+
33+
patchAssetIntoDom('/assets/logos/cc/logomark.svg');
34+
patchAssetIntoDom('/assets/logos/cc/letterheart.svg');

0 commit comments

Comments
 (0)