Skip to content

Commit 429baa3

Browse files
committed
Replace the non-link elements.
Good for CSP.
1 parent 1f632f1 commit 429baa3

6 files changed

Lines changed: 68 additions & 57 deletions

File tree

_includes/post-nav.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,21 @@
1111
{% if page.previous.url %}
1212
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary">
1313
<p>{{ page.previous.title }}</p>
14+
</a>
1415
{% else %}
15-
<a href="javascript:;" class="btn btn-outline-primary disabled">
16+
<span class="btn btn-outline-primary disabled">
1617
<p>-</p>
18+
</span>
1719
{% endif %}
18-
</a>
1920

2021
{% if page.next.url %}
2122
<a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary">
2223
<p>{{ page.next.title }}</p>
24+
</a>
2325
{% else %}
24-
<a href="javascript:;" class="btn btn-outline-primary disabled">
26+
<span class="btn btn-outline-primary disabled">
2527
<p>-</p>
28+
</span>
2629
{% endif %}
27-
</a>
30+
2831
</div>

_includes/topbar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<input class="form-control" id="search-input" type="search" placeholder="{{ site.data.label.search_hint }}...">
4545
<i class="fa fa-times-circle fa-fw" id="search-cleaner"></i>
4646
</span>
47-
<a href="javascript:;">Cancel</a>
47+
<span id="search-cancel" >Cancel</span>
4848
</div>
4949

5050
</div>

assets/css/main.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ body {
328328
visibility: hidden;
329329
}
330330

331-
#search-wrapper+a { /* 'Cancel' link */
331+
#search-cancel { /* 'Cancel' link */
332332
color: var(--link-color, #2a408e);
333333
margin-left: 1rem;
334334
display: none;

assets/css/post.scss

Lines changed: 57 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -27,70 +27,78 @@
2727
font-size: 0.85rem;
2828
}
2929

30+
$prompt-older: "Older";
31+
$prompt-newer: "Newer";
32+
3033
.post-navigation {
3134
padding-top: 3rem;
3235
padding-bottom: 2rem;
33-
}
3436

35-
.post-navigation .btn,
36-
.post-navigation .btn.disabled {
37-
width: 50%;
38-
position: relative;
39-
color: var(--link-color, #2a408e);
40-
border-color: var(--main-border, #e9ecef);
41-
}
37+
.btn, .btn.disabled {
38+
width: 50%;
39+
position: relative;
40+
color: var(--link-color, #2a408e);
41+
border-color: var(--main-border, #e9ecef);
42+
}
4243

43-
.post-navigation .btn:hover {
44-
background: #2a408e;
45-
color: #fff;
46-
border-color: #2a408e;
47-
}
44+
.btn:hover {
45+
background: #2a408e;
46+
color: #fff;
47+
border-color: #2a408e;
48+
}
4849

49-
.post-navigation a.btn.disabled {
50-
pointer-events: auto;
51-
cursor: not-allowed;
52-
background: none;
53-
color: gray;
54-
border-color: var(--main-border, #e9ecef);
55-
}
50+
.btn.disabled {
51+
pointer-events: auto;
52+
cursor: not-allowed;
53+
background: none;
54+
color: gray;
55+
// border-color: var(--main-border, #e9ecef);
56+
}
5657

57-
.post-navigation a.btn.btn-outline-primary.disabled:focus {
58-
box-shadow: none;
59-
}
58+
.btn.btn-outline-primary.disabled:focus {
59+
box-shadow: none;
60+
}
6061

61-
.post-navigation a > p {
62-
font-size: 1.1rem;
63-
line-height: 1.5rem;
64-
margin-top: .3rem;
65-
white-space: normal;
66-
}
62+
p {
63+
font-size: 1.1rem;
64+
line-height: 1.5rem;
65+
margin-top: .3rem;
66+
white-space: normal;
67+
}
6768

68-
.post-navigation a:first-child {
69-
border-top-right-radius: 0;
70-
border-bottom-right-radius: 0;
71-
left: .5px;
72-
}
69+
a::before,
70+
span::before {
71+
color: var(--text-muted-color, gray);
72+
font-size: .65rem;
73+
text-transform: uppercase;
74+
}
7375

74-
.post-navigation a:last-child {
75-
border-top-left-radius: 0;
76-
border-bottom-left-radius: 0;
77-
right: .5px;
78-
}
76+
a:first-child,
77+
span:first-child {
78+
border-top-right-radius: 0;
79+
border-bottom-right-radius: 0;
80+
left: .5px;
81+
}
7982

80-
.post-navigation a::before {
81-
color: var(--text-muted-color, gray);
82-
font-size: .65rem;
83-
text-transform: uppercase;
84-
}
83+
a:last-child,
84+
span:last-child {
85+
border-top-left-radius: 0;
86+
border-bottom-left-radius: 0;
87+
right: .5px;
88+
}
8589

86-
.post-navigation a:first-child::before {
87-
content: "Older";
88-
}
90+
a:first-child::before,
91+
span:first-child::before {
92+
content: $prompt-older
93+
}
8994

90-
.post-navigation a:last-child::before {
91-
content: "Newer";
95+
a:last-child::before,
96+
span:last-child::before {
97+
content: $prompt-newer
98+
}
9299
}
93100

101+
94102
@keyframes fade-up {
95103
from {
96104
opacity: 0;

assets/js/_src/_commons/search-display.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ $(function() {
1010

1111
var btnSbTrigger = $('#sidebar-trigger');
1212
var btnSearchTrigger = $('#search-trigger');
13-
var btnCancel = $('#search-wrapper + a');
13+
var btnCancel = $('#search-cancel');
1414
var btnClear = $('#search-cleaner');
1515

1616
var main = $('#main');

assets/js/dist/_commons/search-display.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)