|
|
@ -29,19 +29,18 @@ |
|
|
|
{% endblock content %} |
|
|
|
{% endblock content %} |
|
|
|
{% block extra_scripts %} |
|
|
|
{% block extra_scripts %} |
|
|
|
<script type="text/javascript"> |
|
|
|
<script type="text/javascript"> |
|
|
|
$(document).ready(() => { |
|
|
|
const main = () => { |
|
|
|
const appendShare = ($element) => { |
|
|
|
const appendShare = (e) => { |
|
|
|
const articleLink = $element.val(); |
|
|
|
const articleLink = e.target.value; |
|
|
|
const gen = { |
|
|
|
const gen = { |
|
|
|
url: articleLink |
|
|
|
url: articleLink |
|
|
|
} |
|
|
|
} |
|
|
|
const renderedButton = VK.Share.button(gen) |
|
|
|
document.getElementById('vkShare').innerHTML = VK.Share.button(gen) |
|
|
|
$('#vkShare').html(renderedButton) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
const $linkInput = $('[name="link"]'); |
|
|
|
const linkInput = document.querySelector('[name="link"]'); |
|
|
|
$linkInput |
|
|
|
linkInput.addEventListener('input', appendShare) |
|
|
|
.on('input', (e => appendShare($(e.target)))) |
|
|
|
linkInput.addEventListener('paste', appendShare) |
|
|
|
.on('paste', (e => appendShare($(e.target)))) |
|
|
|
} |
|
|
|
}) |
|
|
|
window.addEventListener('DOMContentLoaded', main) |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
{% endblock %} |
|
|
|
{% endblock %} |