File tree 2 files changed +6
-13
lines changed
2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change 1
1
/**
2
2
* mdbook の "Suggest an edit" ボタンを改造し、
3
3
* lean4 web editor へのリンクにしてしまう
4
+ *
5
+ * 一瞬元のアイコンが表示されるのを防ぐためにHTML側で上書きを行っていることに注意
4
6
*/
5
7
function filePlay ( ) {
6
8
// 編集ボタンのアイコン部分の `i` 要素
7
- const editButtonIcon = document . querySelector ( "#git-edit-button" ) ;
8
- editButtonIcon . className = "fa fa-play" ;
9
- editButtonIcon . id = "lean-play-button" ;
9
+ const editButtonIcon = document . querySelector ( "#lean-play-button" ) ;
10
10
11
11
// 編集ボタンを表す `a` 要素
12
12
const editButtonLink = editButtonIcon . parentElement ;
13
- editButtonLink . title = "Run on Lean 4 playground" ;
14
- editButtonLink . ariaLabel = editButtonLink . title ;
15
13
16
14
// 拡張子が `.md` になっているので `.lean` に修正する
17
15
editButtonLink . href = editButtonLink . href . replace ( / \. m d $ / , ".lean" ) ;
Original file line number Diff line number Diff line change 184
184
</a >
185
185
{{ /if }}
186
186
{{!--
187
- Discord への招待ボタン
188
- 本来はアイコンを Discord のアイコンにすべきだが、mdbook が使用している FontAwesome はバージョンが 4.7.0 であり
189
- Discord のアイコンが存在しない。そのため、コミュニティっぽいアイコンで代用している。
187
+ 本来編集ページへのリンクだが、改造してファイル単位の実行ボタンにしている
190
188
--}}
191
- <a href =" https://discord.gg/p32ZfnVawh" title =" Join our community" aria-label =" Join community" >
192
- <i id =" discord-invite-button" class =" fa fa-comments-o" ></i >
193
- </a >
194
189
{{ #if git_repository_edit_url }}
195
- <a href =" {{ git_repository_edit_url }} " title =" Suggest an edit " aria-label =" Suggest an edit "
190
+ <a href =" {{ git_repository_edit_url }} " title =" Run on Lean 4 playground " aria-label =" Run on Lean 4 playground "
196
191
target = _blank>
197
- <i id =" git-edit -button" class =" fa fa-edit " ></i >
192
+ <i id =" lean-play -button" class =" fa fa-play " ></i >
198
193
</a >
199
194
{{ /if }}
200
195
</div >
You can’t perform that action at this time.
0 commit comments