Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions assets/filePlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,12 @@
// 演習問題のファイルのみ、`Examples` ディレクトリではなくて `Exercise` ディレクトリにある
editButtonLink.href = editButtonLink.href.replace('/Examples/Exercise/', '/Exercise/');

// ボタンをクリックしたときに以下を実行
editButtonLink.addEventListener('click', async function (e) {
// デフォルトの挙動をキャンセル
e.preventDefault();

fetch(editButtonLink.href)
.then(response => response.text())
.then(body => {
const escaped_code = encodeURIComponent(body);
const url = `https://live.lean-lang.org/#code=${escaped_code}`;
open(url);
});
});
// URL を書き換える
fetch(editButtonLink.href)
.then(response => response.text())
.then(body => {
const escaped_code = encodeURIComponent(body);
const url = `https://live.lean-lang.org/#code=${escaped_code}`;
editButtonLink.href = url;
});
})();
2 changes: 1 addition & 1 deletion theme/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
</a>
{{/if}}
{{#if git_repository_edit_url}}
<a href="{{git_repository_edit_url}}" title="Suggest an edit" aria-label="Suggest an edit">
<a href="{{git_repository_edit_url}}" title="Suggest an edit" aria-label="Suggest an edit" target=_blank>
<i id="git-edit-button" class="fa fa-edit"></i>
</a>
{{/if}}
Expand Down