add share

merge-requests/3/head
bug_creator 3 years ago
parent 2b6f7d8a1c
commit 63b8cff51c

@ -9,6 +9,50 @@
<link href="{{ url_for('static',filename='home.css') }}" rel="stylesheet">
<link href="{{ url_for('static',filename='posts.css') }}" rel="stylesheet">
<link href="{{ url_for('static',filename='interact.css') }}" rel="stylesheet">
<style>
.dialog{
position: absolute;
top: 10%;
left: 0;
right: 0;
z-index: 100;
margin: auto;
box-shadow: 0 0 3px 3px #dddddd;
border-radius: 10px;
width: 400px;
height:50px;
background-color: white;
text-align: center;
line-height: 50px;
font-size: 1em;
vertical-align: middle;
}
</style>
<script>
function copyText(text, callback){
const tag = document.createElement('input');
tag.setAttribute('id', 'cp_hgz_input');
tag.value = text;
document.getElementsByTagName('body')[0].appendChild(tag);
document.getElementById('cp_hgz_input').select();
document.execCommand('copy');
document.getElementById('cp_hgz_input').remove();
if(callback) {callback();}}
function dialog(text){
div=document.createElement("div")
div.setAttribute("class","dialog")
div.innerText=text
div.onclick=(function () {
this.remove()
})
document.body.appendChild(div)
setTimeout( function () {
div.remove()
},2000)
}
</script>
{% endblock %}
{#主导航#}
@ -189,6 +233,12 @@
<a href="{{ url_for('.report', id=question_id,type='question') }}" class="glyphicon glyphicon-alert">
Report</a>
</li>
<li id="btn-5">
<a href="javascript:void (0);" class="glyphicon glyphicon-share" onclick="copyText(window.location.href,function() {
dialog('成功复制链接')
})">
Share</a>
</li>
</ul>
</div>
</div>

@ -55,6 +55,50 @@
$(this).socialShare("tQQ");
})
</script>
<style>
.dialog{
position: absolute;
top: 10%;
left: 0;
right: 0;
z-index: 100;
margin: auto;
box-shadow: 0 0 3px 3px #dddddd;
border-radius: 10px;
width: 400px;
height:50px;
background-color: white;
text-align: center;
line-height: 50px;
font-size: 1em;
vertical-align: middle;
}
</style>
<script>
function copyText(text, callback){
const tag = document.createElement('input');
tag.setAttribute('id', 'cp_hgz_input');
tag.value = text;
document.getElementsByTagName('body')[0].appendChild(tag);
document.getElementById('cp_hgz_input').select();
document.execCommand('copy');
document.getElementById('cp_hgz_input').remove();
if(callback) {callback();}}
function dialog(text){
div=document.createElement("div")
div.setAttribute("class","dialog")
div.innerText=text
div.onclick=(function () {
this.remove()
})
document.body.appendChild(div)
setTimeout( function () {
div.remove()
},2000)
}
</script>
{% endblock %}
@ -72,7 +116,11 @@
{{ post.question.title }}
</a>
</h1>
<div id="socialShare"></div>
{# <div id="socialShare"></div>#}
<a href="javascript:void (0);" class="glyphicon glyphicon-share" onclick="copyText(window.location.href,function() {
dialog('成功复制链接')
})">
Share</a>
<div class="content" id="fancy-content" style="padding-bottom:20px;
border-bottom: 1px solid #ddd;margin: 30px;">
{{ post.body_html| safe }}

@ -23,7 +23,7 @@ class Config:
FLASKY_COMMENTS_PER_PAGE = 30
FLASKY_LIKER_PER_PAGE = 50
CACHE_TYPE = "simple"
ADMIN_EMAIL=['1148636961@qq.com','me@echo.cool','2721712688@qq.com']
ADMIN_EMAIL=['1148636961@qq.com','me@echo.cool','2721712688@qq.com','1635743062@qq.com']
@staticmethod

Binary file not shown.
Loading…
Cancel
Save