nice vote
This commit is contained in:
parent
2cc8551386
commit
b948608ce3
|
@ -644,6 +644,7 @@ p:not(:last-child) {
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
.fa-2x > .emoji-img {
|
.fa-2x > .emoji-img {
|
||||||
width: 36px !important;
|
width: 36px !important;
|
||||||
|
@ -688,12 +689,22 @@ p:not(:last-child) {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
.lpAnime {
|
||||||
|
animation-duration: 1s;
|
||||||
|
animation-name: fadeInLeft;
|
||||||
|
}
|
||||||
.onPoll {
|
.onPoll {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.maxVoter {
|
.maxVoter {
|
||||||
background-color: var(--shared);
|
background-color: var(--shared);
|
||||||
}
|
}
|
||||||
|
.ownMark img {
|
||||||
|
width: 1.2rem !important;
|
||||||
|
position: relative;
|
||||||
|
top: -1px;
|
||||||
|
margin-left: 5px !important;
|
||||||
|
}
|
||||||
.jump {
|
.jump {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
animation: jump 0.75s linear infinite;
|
animation: jump 0.75s linear infinite;
|
||||||
|
|
|
@ -689,7 +689,9 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
||||||
var featured = ` <a onclick="tagFeature('${tag.name}','${acct_id}')" class="pointer" title="add it to Featured tags">Feature</a> `
|
var featured = ` <a onclick="tagFeature('${tag.name}','${acct_id}')" class="pointer" title="add it to Featured tags">Feature</a> `
|
||||||
tags =
|
tags =
|
||||||
tags +
|
tags +
|
||||||
`<span class="hide" data-tag="${tag.name}" data-regTag="${tag.name.toLowerCase()}">#${tag.name}:
|
`<span class="hide" data-tag="${tag.name}" data-regTag="${tag.name.toLowerCase()}">#${
|
||||||
|
tag.name
|
||||||
|
}:
|
||||||
<a onclick="tl('tag','${tag.name}','${acct_id}','add')" class="pointer"
|
<a onclick="tl('tag','${tag.name}','${acct_id}','add')" class="pointer"
|
||||||
title="${lang.lang_parse_tagTL.replace(
|
title="${lang.lang_parse_tagTL.replace(
|
||||||
'{{tag}}',
|
'{{tag}}',
|
||||||
|
@ -1344,6 +1346,12 @@ function client(name) {
|
||||||
//Poll Parser
|
//Poll Parser
|
||||||
function pollParse(poll, acct_id) {
|
function pollParse(poll, acct_id) {
|
||||||
var datetype = localStorage.getItem('datetype')
|
var datetype = localStorage.getItem('datetype')
|
||||||
|
var anime = localStorage.getItem('animation')
|
||||||
|
if (anime == 'yes' || !anime) {
|
||||||
|
var lpAnime = 'lpAnime'
|
||||||
|
} else {
|
||||||
|
var lpAnime = ''
|
||||||
|
}
|
||||||
var choices = poll.options
|
var choices = poll.options
|
||||||
if (poll.own_votes) {
|
if (poll.own_votes) {
|
||||||
var minechoice = poll.own_votes
|
var minechoice = poll.own_votes
|
||||||
|
@ -1355,7 +1363,7 @@ function pollParse(poll, acct_id) {
|
||||||
</a>`
|
</a>`
|
||||||
if (poll.voted) {
|
if (poll.voted) {
|
||||||
var myvote = lang.lang_parse_voted
|
var myvote = lang.lang_parse_voted
|
||||||
if(poll.expired) myvote = myvote + '/' + lang.lang_parse_endedvote
|
if (poll.expired) myvote = myvote + '/' + lang.lang_parse_endedvote
|
||||||
var result_hide = ''
|
var result_hide = ''
|
||||||
} else if (poll.expired) {
|
} else if (poll.expired) {
|
||||||
var myvote = lang.lang_parse_endedvote
|
var myvote = lang.lang_parse_endedvote
|
||||||
|
@ -1373,14 +1381,19 @@ function pollParse(poll, acct_id) {
|
||||||
}
|
}
|
||||||
var ended = date(poll.expires_at, datetype)
|
var ended = date(poll.expires_at, datetype)
|
||||||
var pollHtml = ''
|
var pollHtml = ''
|
||||||
var max = _.maxBy(choices, 'votes_count').votes_count;
|
if (choices[0].votes_count) {
|
||||||
|
var max = _.maxBy(choices, 'votes_count').votes_count
|
||||||
|
} else {
|
||||||
|
var max = 0
|
||||||
|
}
|
||||||
|
|
||||||
Object.keys(choices).forEach(function(keyc) {
|
Object.keys(choices).forEach(function(keyc) {
|
||||||
var choice = choices[keyc]
|
var choice = choices[keyc]
|
||||||
var voteit = ''
|
var voteit = ''
|
||||||
for (var i = 0; i < minechoice.length; i++) {
|
for (var i = 0; i < minechoice.length; i++) {
|
||||||
var me = minechoice[i]
|
var me = minechoice[i]
|
||||||
if (me == keyc) {
|
if (me == keyc) {
|
||||||
var voteit = '✅'
|
var voteit = '<span class="ownMark">✅</span>'
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1392,21 +1405,27 @@ function pollParse(poll, acct_id) {
|
||||||
var votesel = ''
|
var votesel = ''
|
||||||
var voteclass = ''
|
var voteclass = ''
|
||||||
}
|
}
|
||||||
var per = Math.ceil(choice.votes_count / poll.votes_count * 100)
|
var per = Math.ceil((choice.votes_count / poll.votes_count) * 100)
|
||||||
if(max == choice.votes_count) {
|
if(!per) per = 0
|
||||||
|
if (max == choice.votes_count) {
|
||||||
var addPoll = 'maxVoter'
|
var addPoll = 'maxVoter'
|
||||||
} else {
|
} else {
|
||||||
var addPoll = ''
|
var addPoll = ''
|
||||||
}
|
}
|
||||||
|
var openData = ''
|
||||||
|
if (choice.votes_count !== null) {
|
||||||
|
openData = `<span style="float: right">${choice.votes_count}<span class="sml">(${per}%)</span></span>`
|
||||||
|
} else {
|
||||||
|
openData = `<span style="float: right">?<span class="sml">(-%)</span></span>`
|
||||||
|
}
|
||||||
pollHtml =
|
pollHtml =
|
||||||
pollHtml +
|
pollHtml +
|
||||||
`<div class="${voteclass} vote vote_${acct_id}_${poll.id}_${keyc}" onclick="${votesel}">
|
`<div class="${voteclass} vote vote_${acct_id}_${poll.id}_${keyc}" onclick="${votesel}">
|
||||||
<span class="leadPoll ${addPoll}" style="width: ${per}%"></span>
|
<span class="leadPoll ${addPoll} ${lpAnime}" style="width: ${per}%"></span>
|
||||||
<span class="onPoll">${escapeHTML(choice.title)}</span>
|
<span class="onPoll">${escapeHTML(choice.title)}${voteit}</span>
|
||||||
<span class="vote_${acct_id}_${poll.id}_result ${result_hide} onPoll">
|
<span class="vote_${acct_id}_${poll.id}_result ${result_hide} onPoll">
|
||||||
(${choice.votes_count}/${per}%)
|
${openData}
|
||||||
</span>
|
</span>
|
||||||
${voteit}
|
|
||||||
</div>`
|
</div>`
|
||||||
})
|
})
|
||||||
if (poll.expired) {
|
if (poll.expired) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user