Skip to content

Commit 4f53f19

Browse files
committed
Switch CDN to unpkg
1 parent 82693eb commit 4f53f19

File tree

7 files changed

+194
-82
lines changed

7 files changed

+194
-82
lines changed

_config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ version: 2.4.3
77
# links to file/dir viewers
88
treeUrl: https://github.com/mistic100/jQuery-QueryBuilder/tree/master
99
blobUrl: https://github.com/mistic100/jQuery-QueryBuilder/blob/master
10-
cdnUrl: https://cdn.jsdelivr.net/jquery.query-builder/2.4.3
10+
cdnUrl: https://unpkg.com/jQuery-QueryBuilder@2.4.3/dist
1111
# licence of the software
1212
license: MIT License
1313
licenseUrl: http://opensource.org/licenses/MIT
@@ -25,9 +25,9 @@ download:
2525
bower: jQuery-QueryBuilder
2626
npm: jQuery-QueryBuilder
2727
cdn:
28-
url: https://www.jsdelivr.com/projects/jquery.query-builder
29-
img: http://querybuilder.js.org/assets/images/jsdelivr-logo.png
30-
name: jsDelivr
28+
url: https://unpkg.com/jQuery-QueryBuilder/dist/
29+
img: http://querybuilder.js.org/assets/images/unpkg-logo.png
30+
name: unpkg
3131

3232
# set this to true to replace the generated header navbar by _includes/navbar.html
3333
customNavBar: true

assets/css/style.css

Lines changed: 97 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
/**
2+
* Overwrites
3+
*/
14
.bs-docs-masthead {
25
padding-top: 50px;
36
padding-bottom: 40px;
47
margin-bottom: 20px;
58
}
69

710
.bs-docs-header h1, .bs-docs-header p {
8-
margin-right: 0px;
11+
margin-right: 0;
912
}
1013

1114
.bs-docs-sidebar .nav > li > a {
@@ -27,14 +30,17 @@
2730
#content:after {
2831
content: "";
2932
position: absolute;
30-
bottom: 0px;
31-
right: 0px;
33+
bottom: 0;
34+
right: 0;
3235
height: 50px;
3336
width: 30%;
3437
min-width: 300px;
3538
background: linear-gradient(135deg, transparent 50px, white 50px);
3639
}
3740

41+
/**
42+
* Title anchors
43+
*/
3844
.anchor-link {
3945
opacity: 0;
4046
position: absolute;
@@ -58,6 +64,9 @@ h5:hover .anchor-link {
5864
opacity: 1;
5965
}
6066

67+
/**
68+
* Releases titles
69+
*/
6170
#releases h1 {
6271
font-size: 28px;
6372
}
@@ -70,3 +79,88 @@ h5:hover .anchor-link {
7079
float: right;
7180
font-size: 18px;
7281
}
82+
83+
/**
84+
* Loader
85+
* http://codepen.io/fox_hover/pen/YZxGed
86+
*/
87+
.spinner {
88+
position: relative;
89+
display: inline-block;
90+
width: 1em;
91+
height: 1em;
92+
}
93+
94+
.spinner::before, .spinner::after {
95+
content: "";
96+
display: block;
97+
position: absolute;
98+
border: 0.05em solid currentcolor;
99+
border-radius: 50%;
100+
}
101+
102+
.spinner::before {
103+
width: 0.936em;
104+
height: 0.936em;
105+
border-top-color: rgba(33, 33, 33, 0);
106+
border-left-color: rgba(33, 33, 33, 0);
107+
top: 0;
108+
left: 0;
109+
-webkit-animation: rotate-animation 1s linear 0s infinite;
110+
animation: rotate-animation 1s linear 0s infinite;
111+
}
112+
113+
.spinner::after {
114+
width: 0.6552em;
115+
height: 0.6552em;
116+
border-top-color: rgba(33, 33, 33, 0);
117+
border-left-color: rgba(33, 33, 33, 0);
118+
top: 0.1404em;
119+
left: 0.1404em;
120+
-webkit-animation: anti-rotate-animation 0.85s linear 0s infinite;
121+
animation: anti-rotate-animation 0.85s linear 0s infinite;
122+
}
123+
124+
@-webkit-keyframes rotate-animation {
125+
0% {
126+
-webkit-transform: rotateZ(0deg);
127+
transform: rotateZ(0deg);
128+
}
129+
100% {
130+
-webkit-transform: rotateZ(360deg);
131+
transform: rotateZ(360deg);
132+
}
133+
}
134+
135+
@keyframes rotate-animation {
136+
0% {
137+
-webkit-transform: rotateZ(0deg);
138+
transform: rotateZ(0deg);
139+
}
140+
100% {
141+
-webkit-transform: rotateZ(360deg);
142+
transform: rotateZ(360deg);
143+
}
144+
}
145+
146+
@-webkit-keyframes anti-rotate-animation {
147+
0% {
148+
-webkit-transform: rotateZ(0deg);
149+
transform: rotateZ(0deg);
150+
}
151+
100% {
152+
-webkit-transform: rotateZ(-360deg);
153+
transform: rotateZ(-360deg);
154+
}
155+
}
156+
157+
@keyframes anti-rotate-animation {
158+
0% {
159+
-webkit-transform: rotateZ(0deg);
160+
transform: rotateZ(0deg);
161+
}
162+
100% {
163+
-webkit-transform: rotateZ(-360deg);
164+
transform: rotateZ(-360deg);
165+
}
166+
}

assets/images/unpkg-logo.png

4.74 KB
Loading

assets/js/changelog.js

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
(function() {
2+
/**
3+
* Fetch releases from github with a cache of 1 hour
4+
* @returns {promise<object[]>}
5+
*/
6+
function fetchReleases() {
7+
var cacheDate = localStorage.releasesCacheDate;
8+
9+
if (cacheDate && (new Date() - new Date(cacheDate)) < 1000 * 3600) {
10+
return $.when(JSON.parse(localStorage.releasesCache));
11+
}
12+
else {
13+
return $.getJSON(releasesAPI)
14+
.then(function(data) {
15+
localStorage.releasesCacheDate = new Date().toString();
16+
localStorage.releasesCache = JSON.stringify(data);
17+
return data;
18+
});
19+
}
20+
}
21+
22+
/**
23+
* Adds a release to #releases
24+
* @param {object} release
25+
*/
26+
function appendRelease(release) {
27+
// Format date
28+
var date = moment(release.published_at).format('LL');
29+
30+
// Convert markdown to html
31+
var desc = marked(release.body, { breaks: true });
32+
33+
// Remove some escaping done by marked.js
34+
desc = desc.replace(/&quot;/g, '"').replace(/&#39;/g, "'");
35+
36+
// Add links to issues
37+
desc = desc.replace(/(#([0-9]+))/g, '<a href="' + issuesBase + '$2">$1</a>');
38+
39+
// Exclude headers from side menu
40+
desc = desc.replace(/(<h[2-5])/g, '$1 data-no-menu');
41+
42+
// Build dom
43+
$('#releases').append(
44+
$('<section>')
45+
.addClass('bs-docs-section')
46+
.append(
47+
$('<h1>')
48+
.addClass('page-header')
49+
.attr('id', release.id)
50+
.text(release.name)
51+
.append(
52+
$('<small>')
53+
.text(date),
54+
$('<a>')
55+
.addClass('release-date')
56+
.attr('href', release.html_url)
57+
.append(
58+
$('<i>').addClass('glyphicon glyphicon-tag')
59+
)
60+
),
61+
$('<article>').html(desc)
62+
)
63+
);
64+
}
65+
66+
fetchReleases()
67+
.then(function(releases) {
68+
$('#spinner').remove();
69+
70+
releases.forEach(function(release) {
71+
appendRelease(release);
72+
});
73+
74+
if (jekyllBootstrapDoc) {
75+
jekyllBootstrapDoc.buildSideMenu();
76+
jekyllBootstrapDoc.addHeadingAnchors();
77+
}
78+
79+
if (window.location.hash && $(window.location.hash).length) {
80+
$(window.location.hash)[0].scrollIntoView();
81+
}
82+
});
83+
}());

assets/js/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ var jekyllBootstrapDoc = {
6363

6464
header.css('background-image', 'url(' + pattern.png() + ')');
6565
}
66-
}
66+
};
6767

6868
$(function() {
6969
jekyllBootstrapDoc.buildSideMenu();

changelog.html

Lines changed: 7 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -3,83 +3,18 @@
33
title: Changelog
44
---
55

6-
<div id="releases"></div>
6+
<div id="releases">
7+
<div id="spinner" style="text-align:center; color: #888; font-size:100px;">
8+
<span class="spinner"></span>
9+
</div>
10+
</div>
711

812
<script src="https://cdn.jsdelivr.net/marked/0.3.5/marked.min.js"></script>
913
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
1014

1115
<script>
1216
var releasesAPI = 'https://api.github.com/repos/{{site.id}}/releases';
1317
var issuesBase = 'https://github.com/{{site.id}}/issues/';
14-
15-
(function() {
16-
function fetchReleases() {
17-
var cacheDate = localStorage.releasesCacheDate;
18-
19-
if (cacheDate && (new Date() - new Date(cacheDate)) < 1000 * 3600) {
20-
return $.when(JSON.parse(localStorage.releasesCache));
21-
}
22-
else {
23-
return $.getJSON(releasesAPI)
24-
.then(function(data) {
25-
localStorage.releasesCacheDate = new Date().toString();
26-
localStorage.releasesCache = JSON.stringify(data);
27-
return data;
28-
});
29-
}
30-
}
31-
32-
function unescape(html) {
33-
return html
34-
.replace(/&quot;/g, '"')
35-
.replace(/&#39;/g, "'");
36-
}
37-
38-
function replaceIssueLinks(html) {
39-
return html.replace(/(#([0-9]+))/g, '<a href="' + issuesBase + '$2">$1</a>');
40-
}
41-
42-
function sanitizeHeaders(html) {
43-
return html.replace(/(<h[2-5])/g, '$1 data-no-menu');
44-
}
45-
46-
function appendRelease(release, container) {
47-
var date = moment(release.published_at);
48-
var desc = sanitizeHeaders(replaceIssueLinks(unescape(marked(release.body, { breaks: true }))));
49-
50-
container.append(
51-
$('<section>')
52-
.addClass('bs-docs-section')
53-
.append(
54-
$('<h1>')
55-
.addClass('page-header')
56-
.attr('id', release.id)
57-
.text(release.name)
58-
.append(
59-
$('<small>')
60-
.text(date.format('LL')),
61-
$('<a>')
62-
.addClass('release-date')
63-
.attr('href', release.html_url)
64-
.html('<i class="glyphicon glyphicon-tag"></i>')
65-
),
66-
$('<article>').html(desc)
67-
)
68-
);
69-
}
70-
71-
fetchReleases()
72-
.then(function(releases) {
73-
var container = $('#releases');
74-
75-
releases.forEach(function(release) {
76-
appendRelease(release, container);
77-
});
78-
79-
if (jekyllBootstrapDoc) {
80-
jekyllBootstrapDoc.buildSideMenu();
81-
jekyllBootstrapDoc.addHeadingAnchors();
82-
}
83-
});
84-
}());
8518
</script>
19+
20+
<script src="{{site.github.url}}/assets/js/changelog.js"></script>

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ <h3 id="backends">Backends</h3>
104104
<a href="https://github.com/fourlabsldn/QBJSParserBundle">QBJSParserBundle</a></li>
105105
<li><b>PHP (Laravel)</b> <i class="glyphicon glyphicon-chevron-right"></i>
106106
timgws / <a href="https://github.com/timgws/QueryBuilderParser">QueryBuilderParser</a></li>
107-
<li><b>PHP (Yii 2)</b> <i class="glyphicon glyphicon-chevron-right"></i>
107+
<li><b>PHP (Yii 2)</b> <i class="glyphicon glyphicon-chevron-right"></i>
108108
leandrogehlen / <a href="https://github.com/leandrogehlen/yii2-querybuilder">yii2-querybuilder</a></li>
109-
<li><b>PHP (Doctrine)</b> <i class="glyphicon glyphicon-chevron-right"></i>
109+
<li><b>PHP (Doctrine)</b> <i class="glyphicon glyphicon-chevron-right"></i>
110110
josedacosta / <a href="https://github.com/josedacosta/jQueryQueryBuilderBundle">jQueryQueryBuilderBundle</a></li>
111111
<li><b>Rails</b> <i class="glyphicon glyphicon-chevron-right"></i>
112112
SixiS / <a href="https://github.com/SixiS/jquery_query_builder-rails">jquery_query_builder-rails</a></li>

0 commit comments

Comments
 (0)