Browse Source

Выпилили jquery #28

чтобы не подключать CDN.
И не возиться со статикой, если подключать локально.
pull/30/head
Artur Galyamov 2 years ago
parent
commit
ac9c382c47
  1. 19
      cms/templates/articles/new.html
  2. 1
      cms/templates/base.html

19
cms/templates/articles/new.html

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

1
cms/templates/base.html

@ -8,7 +8,6 @@
{% bootstrap_javascript %}
{% bootstrap_messages %}
<script type="text/javascript" src="https://vk.com/js/api/share.js?93" charset="windows-1251"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.6.3.min.js"></script>
</head>
<body>
{% block content %}

Loading…
Cancel
Save