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

1
cms/templates/base.html

@ -8,6 +8,7 @@
{% bootstrap_javascript %} {% bootstrap_javascript %}
{% bootstrap_messages %} {% 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://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> </head>
<body> <body>
{% block content %} {% block content %}

Loading…
Cancel
Save