1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-12-04 09:42:31 +02:00
imgproxy/docs/assets/docsify-edit-link.js
2019-10-15 18:21:59 +06:00

31 lines
671 B
JavaScript

; (function (win) {
win.EditOnGithubPlugin = {}
function create(docBase) {
var docEditBase = docBase.replace(/\/blob\//, '/edit/')
return function (hook, vm) {
hook.afterEach(function (html) {
var url = docBase
var docName = vm.route.file
if (docName) {
url = docEditBase + docName
}
var header = [
'<a class="github-edit-btn" title="Edit on GitHub" href="',
url,
'" target="_blank">',
'Edit on <strong>GitHub</strong>',
'</a>'
].join('')
return html + header
})
}
}
win.EditOnGithubPlugin.create = create
})(window)