Browse Source

Реализован вывод кнопки с корректной ссылкой при изменении #28

pull/30/head
Artur Galyamov 2 years ago
parent
commit
9da6855626
  1. 19
      cms/templates/articles/new.html
  2. 1
      cms/templates/base.html

19
cms/templates/articles/new.html

@ -20,6 +20,7 @@
>
Продвинуть
</button>
<div id="vkShare"></div>
{% endbuttons %}
</form>
</div>
@ -28,9 +29,19 @@
{% endblock content %}
{% block extra_scripts %}
<script type="text/javascript">
const gen = {
url: 'https://zakonvremeni.ru/analytics/7-3-/58372-sergej-lavrov-predlozheniya-rossii-po-ukraine-luchshe-vypolnit-podobru-pozdorovu.html'
}
document.write(VK.Share.button(gen));
$(document).ready(() => {
const appendShare = ($element) => {
const articleLink = $element.val();
const gen = {
url: articleLink
}
const renderedButton = VK.Share.button(gen)
$('#vkShare').html(renderedButton)
}
$('[name="link"]').change((e) => {
appendShare($(e.target))
})
})
</script>
{% endblock %}

1
cms/templates/base.html

@ -8,6 +8,7 @@
{% 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