Skip to content

Commit d16056a

Browse files
committed
Local fallback for jQuery library served with CDN
1 parent 71e9c94 commit d16056a

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ install: bindata format
2424
bindata: deps
2525
@echo "--> Generate bindata"
2626
@go-bindata -pkg tornote templates/... \
27+
public/vendor/jquery/dist/jquery.slim.min.js \
2728
public/vendor/sjcl/sjcl.js \
2829
public/main.js \
2930
public/styles.css

bower.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"name": "tornote",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"homepage": "https://github.com/osminogin/tornote",
55
"authors": [
66
"Vladimir Osintsev <[email protected]>"
77
],
88
"description": "Anonymous self-destructing notes written in Go",
99
"license": "AGPLv3",
1010
"dependencies": {
11+
"jquery": "~3.0.0",
1112
"sjcl": "~1.0.3"
1213
}
1314
}

templates/layout/base.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7"
1515
crossorigin="anonymous">
1616
<link rel="stylesheet" href="/public/styles.css">
17+
18+
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
1719
</head>
1820
<body>
1921

@@ -42,7 +44,9 @@
4244
</div>
4345
</footer>
4446

45-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
47+
<script> // Local fallback for jQuery library served with CDN
48+
if (!window.jQuery) { document.write('<script src="/public/vendor/jquery/dist/jquery.slim.min.js"><\/script>'); }
49+
</script>
4650
<script src="/public/vendor/sjcl/sjcl.js"></script>
4751
<script src="/public/main.js"></script>
4852
</body>

0 commit comments

Comments
 (0)