Merge pull request 'preview' (#30) from preview into master
Reviewed-on: http://pulsdel.ru/ZakonVremeni/crossposting/pulls/30
This commit is contained in:
commit
e808b41b3b
@ -14,15 +14,43 @@
|
|||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% bootstrap_form new_article_form %}
|
{% bootstrap_form new_article_form %}
|
||||||
{% buttons %}
|
{% buttons %}
|
||||||
<button
|
<div class="row">
|
||||||
class="btn btn-primary"
|
<div class="col">
|
||||||
type="submit"
|
<button
|
||||||
>
|
class="btn btn-primary"
|
||||||
Продвинуть
|
type="submit"
|
||||||
</button>
|
>
|
||||||
|
Продвинуть
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="vkShare" class="col"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endbuttons %}
|
{% endbuttons %}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
{% block extra_scripts %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
const main = () => {
|
||||||
|
const appendShare = (e) => {
|
||||||
|
const articleLink = e.target.value;
|
||||||
|
const gen = {
|
||||||
|
url: articleLink
|
||||||
|
}
|
||||||
|
const buttonType = {
|
||||||
|
type: "custom",
|
||||||
|
text: '<img src="https://vk.com/images/share_32_2x.png" width="32" height="32" alt="share icon" />'
|
||||||
|
}
|
||||||
|
document.getElementById('vkShare').innerHTML = VK.Share.button(gen, buttonType)
|
||||||
|
}
|
||||||
|
const linkInput = document.querySelector('[name="link"]');
|
||||||
|
linkInput.addEventListener('input', appendShare)
|
||||||
|
linkInput.addEventListener('paste', appendShare)
|
||||||
|
}
|
||||||
|
window.addEventListener('DOMContentLoaded', main)
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
@ -7,9 +7,12 @@
|
|||||||
{% bootstrap_css %}
|
{% bootstrap_css %}
|
||||||
{% 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>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
{% block extra_scripts %}
|
||||||
|
{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
x
Reference in New Issue
Block a user