Add full support for polls,remove whitespace when using full image height,improve toot counter,remove bar between unrelated posts
This commit is contained in:
parent
f15f134d75
commit
dd7ebb31f3
|
@ -20,12 +20,14 @@ We moved our instances list to our webpage: https://www.halcyon.social/instances
|
|||
- No tracking, No ads.
|
||||
- Supports multiple languages.
|
||||
- Privacy-friendly video embeds.
|
||||
- Full support for Mastodon polls.
|
||||
|
||||
## Install
|
||||
[![Install Halcyon with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=halcyon)
|
||||
or read our new documentation pages to install it manually: https://www.halcyon.social/documentation.php?page=install
|
||||
|
||||
## Blog
|
||||
- Release of Version 2.3.0 - Blog article will be published soon
|
||||
- Release of Version 2.2.5 - Add French translation,improve German translation,add support for video captions,add support for video thumbnails
|
||||
- Release of Version 2.2.4 - Easily switch between pictures in overlay,show pictures in full height in timeline,duplicated threads removed,many smaller bugfixes
|
||||
- Release of Version 2.2.3 - Fixed login with Pleroma,fixed compatibility with Pawoo (older Mastodon),added support for prefers-color-scheme,some more fixes
|
||||
|
|
|
@ -21,6 +21,10 @@ background-color:#243447!important;
|
|||
background-color:#189EFC !important;
|
||||
opacity:0.5;
|
||||
}
|
||||
.status_form .status_bottom .disabled {
|
||||
color:#189EFC !important;
|
||||
opacity:0.5;
|
||||
}
|
||||
.status_form .status_top .status_spoiler {
|
||||
color:#fff;
|
||||
border:1px solid #000;
|
||||
|
@ -34,7 +38,8 @@ background-color:#132030;
|
|||
background-color: #132030;
|
||||
color:#fff;
|
||||
}
|
||||
.status_form .status_textarea .media_attachments_preview_area {
|
||||
.status_form .status_textarea .media_attachments_preview_area,
|
||||
.status_form .status_textarea .status_poll_editor {
|
||||
background-color:#1B2836;
|
||||
border-top:1px solid #000;
|
||||
}
|
||||
|
@ -52,6 +57,22 @@ background-color:rgba(0,0,0,0);
|
|||
color:#fff;
|
||||
background-color:rgba(0,0,0,.8);
|
||||
}
|
||||
.poll_time {
|
||||
color: #FFFFFF;
|
||||
border:1px solid #AAB8C2;
|
||||
background-color:#1B2836;
|
||||
}
|
||||
.poll_time:focus-within {
|
||||
border:1px solid #189EFC;
|
||||
background-color:#1B2836;
|
||||
}
|
||||
.poll_time.redborder {
|
||||
border:1px solid #FF0000;
|
||||
}
|
||||
.poll_time input {
|
||||
color:#FFFFFF;
|
||||
background-color:#1B2836;
|
||||
}
|
||||
.status_form .status_bottom .status_option_button {
|
||||
color:#189EFC;
|
||||
}
|
||||
|
@ -459,7 +480,7 @@ color:#999;
|
|||
.toot_detail {
|
||||
background-color:#1B2836;
|
||||
}
|
||||
.toot_entry.ancestors_status .toot_entry_body::after,.toot_entry.descendants_status .toot_entry_body::after {
|
||||
.toot_entry.ancestors_status .toot_entry_body::after,.toot_entry.descendants_status.direct_answer .toot_entry_body::after {
|
||||
border:2px solid #76BFEC;
|
||||
}
|
||||
.toot_entry.descendants_status:last-child .toot_entry_body::after {
|
||||
|
@ -495,12 +516,11 @@ background:#243447;
|
|||
background:#189EFC;
|
||||
}
|
||||
.radiobox input[type="radio"] + .radiotext:before {
|
||||
background:#243447;
|
||||
border:1px solid #AAB8C2;
|
||||
}
|
||||
.radiobox input[type="radio"]:checked + .radiotext:before {
|
||||
background-color:#189EFC;
|
||||
box-shadow:inset 0 0 0 4px #fff;
|
||||
box-shadow: inset 0 0 0 4px #243447;
|
||||
border-color:#189EFC;
|
||||
}
|
||||
.options {
|
||||
|
@ -631,3 +651,12 @@ background: rgb(101, 119, 134);
|
|||
.player .volume .pointer {
|
||||
background: #189EFC;
|
||||
}
|
||||
.poll_bar {
|
||||
background-color:rgb(101, 119, 134);
|
||||
}
|
||||
.poll_winner {
|
||||
background-color:#189EFC;
|
||||
}
|
||||
.poll_footer {
|
||||
color:#66757f;
|
||||
}
|
||||
|
|
|
@ -131,6 +131,11 @@ background-color: #A3D8FF!important;
|
|||
pointer-events: none;
|
||||
cursor: default;
|
||||
}
|
||||
.status_form .status_bottom .disabled {
|
||||
color: #A3D8FF!important;
|
||||
pointer-events: none;
|
||||
cursor: default;
|
||||
}
|
||||
.status_form .status_top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@ -185,14 +190,21 @@ overflow: hidden;
|
|||
.status_form .status_textarea textarea.focus {
|
||||
height: 68px;
|
||||
}
|
||||
.status_form .status_textarea .media_attachments_preview_area {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
.status_form .status_textarea .media_attachments_preview_area,
|
||||
.status_form .status_textarea .status_poll_editor {
|
||||
margin: 8px -8px -8px -8px;
|
||||
padding: 8px 12px;
|
||||
background-color: #F1F1F1;
|
||||
border-top: 1px solid #C7E7FB;
|
||||
}
|
||||
.status_form .status_textarea.closed .media_attachments_preview_area,
|
||||
.status_form .status_textarea.closed .status_poll_editor {
|
||||
display:none;
|
||||
}
|
||||
.status_form .status_textarea .media_attachments_preview_area {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.status_form .status_textarea .media_attachments_preview {
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
|
@ -245,6 +257,57 @@ justify-content: center;
|
|||
font-size: 14px;
|
||||
margin: 4px 4px 0 0;
|
||||
}
|
||||
.status_form .status_textarea .status_poll_editor .poll_field {
|
||||
margin:5px;
|
||||
width:calc(100% - 29px);
|
||||
}
|
||||
input[type='number'] {
|
||||
-moz-appearance:textfield;
|
||||
}
|
||||
input::-webkit-outer-spin-button,
|
||||
input::-webkit-inner-spin-button {
|
||||
-webkit-appearance:none;
|
||||
}
|
||||
.poll_time {
|
||||
margin-top:5px;
|
||||
padding-right:10px;
|
||||
font-size: 14px;
|
||||
color: #66757F;
|
||||
box-sizing: border-box;
|
||||
height:30px;
|
||||
border:1px solid #AAB8C2;
|
||||
border-radius:2px;
|
||||
background-color:#FFFFFF;
|
||||
display:inline-block;
|
||||
}
|
||||
.poll_time:focus-within {
|
||||
border:1px solid #189EFC;
|
||||
background-color:#FFFFFF;
|
||||
}
|
||||
.poll_time.redborder {
|
||||
border:1px solid #FF0000;
|
||||
}
|
||||
.poll_time input {
|
||||
outline:0;
|
||||
border:0;
|
||||
height:28px;
|
||||
max-width:60px;
|
||||
border-radius:2px;
|
||||
padding-left:5px;
|
||||
text-align:center;
|
||||
color: #66757F;
|
||||
}
|
||||
.poll_time input:focus {
|
||||
outline:0;
|
||||
}
|
||||
.poll_time input:invalid {
|
||||
box-shadow:none;
|
||||
}
|
||||
.poll_mc_switch {
|
||||
margin:0 !important;
|
||||
display:inline-block;
|
||||
vertical-align:middle;
|
||||
}
|
||||
.status_form .status_bottom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@ -874,7 +937,6 @@ border: 1px solid #DCDFE1;
|
|||
}
|
||||
.media_views.media_full_height {
|
||||
height:auto;
|
||||
min-height:336px;
|
||||
}
|
||||
.media_views .media_attachment {
|
||||
overflow: hidden;
|
||||
|
@ -980,6 +1042,11 @@ font-size: 14px;
|
|||
line-height: 18px;
|
||||
border-bottom: 1px solid #E6ECF0;
|
||||
}
|
||||
.timeline .poll_notify_header {
|
||||
padding: 10px 0 0 70px !important;
|
||||
font-size: 14px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.timeline .notice_entry .notice_entry_body {
|
||||
width: 480px;
|
||||
border: 1px solid #E6ECF0;
|
||||
|
@ -1003,7 +1070,7 @@ overflow: hidden;
|
|||
.timeline .notice_entry .icon_box img {
|
||||
width: 24px;
|
||||
}
|
||||
.timeline .notice_entry .font-icon {
|
||||
.timeline .toot_entry .font-icon {
|
||||
position: relative;
|
||||
padding: 3px;
|
||||
left: -23px;
|
||||
|
@ -1013,28 +1080,32 @@ font-size: 10px;
|
|||
border-radius: 3px;
|
||||
color: #fff;
|
||||
}
|
||||
.timeline .notice_entry .font-icon.follow {
|
||||
.timeline .toot_entry .font-icon.follow {
|
||||
background: #1DA1F2;;
|
||||
}
|
||||
.timeline .notice_entry .font-icon.boost {
|
||||
.timeline .toot_entry .font-icon.boost {
|
||||
background: #17BF63;
|
||||
}
|
||||
.timeline .notice_entry .font-icon.favourite {
|
||||
.timeline .toot_entry .font-icon.favourite {
|
||||
background: #FFAD1A;
|
||||
}
|
||||
.timeline .notice_entry .notice_author_box {
|
||||
.timeline .toot_entry .font-icon.poll {
|
||||
background: #FF4040;
|
||||
top:0;
|
||||
}
|
||||
.timeline .toot_entry .notice_author_box {
|
||||
padding: 3px 0;
|
||||
}
|
||||
.timeline .notice_entry .notice_author_box > a.notice_author {
|
||||
.timeline .toot_entry .notice_author_box > a.notice_author {
|
||||
margin-left: -18px;
|
||||
}
|
||||
.timeline .notice_entry .notice_author_box > a.notice_author span {
|
||||
.timeline .toot_entry .notice_author_box > a.notice_author span {
|
||||
font-weight: 600;
|
||||
}
|
||||
.timeline .notice_entry .toot_content .toot_header a .displayname {
|
||||
.timeline .toot_entry .toot_content .toot_header a .displayname {
|
||||
font-weight: 600;
|
||||
}
|
||||
.timeline .notice_entry .toot_content .toot_header a .username {
|
||||
.timeline .toot_entry .toot_content .toot_header a .username {
|
||||
color: #66757F;
|
||||
}
|
||||
.timeline .toot_entry .toot_content .toot_article .status_content p:not(:last-child) {
|
||||
|
@ -1355,13 +1426,13 @@ box-sizing: border-box;
|
|||
height:30px;
|
||||
border:1px solid #AAB8C2;
|
||||
border-radius:2px;
|
||||
background-color:transparent;
|
||||
background-color:#FFFFFF;
|
||||
outline:0;
|
||||
}
|
||||
.textfield:focus {
|
||||
outline:0;
|
||||
border:1px solid #189EFC;
|
||||
background-color:transparent;
|
||||
background-color:#FFFFFF;
|
||||
}
|
||||
.account_box {
|
||||
display: flex;
|
||||
|
@ -2557,7 +2628,7 @@ opacity: 0;
|
|||
}
|
||||
.radiobox input[type="radio"] + .radiotext:before {
|
||||
content: '';
|
||||
background: #ffffff;
|
||||
background: transparent;
|
||||
border-radius: 100%;
|
||||
border: 1px solid #AAB8C2;
|
||||
display: inline-block;
|
||||
|
@ -2573,7 +2644,7 @@ top: -8px;
|
|||
}
|
||||
.radiobox input[type="radio"]:checked + .radiotext:before {
|
||||
background-color: #189EFC;
|
||||
box-shadow: inset 0 0 0 4px #ffffff;
|
||||
box-shadow: inset 0 0 0 4px #FFF;
|
||||
outline: none;
|
||||
border-color: #189EFC;
|
||||
}
|
||||
|
@ -2801,3 +2872,48 @@ background: #189EFC;
|
|||
-moz-border-radius: 50%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.poll_box {
|
||||
position:relative;
|
||||
}
|
||||
.poll_box_form {
|
||||
line-height:20px;
|
||||
}
|
||||
.poll_box .radiobox {
|
||||
margin:0;
|
||||
margin-top:10px;
|
||||
}
|
||||
.poll_checkbox_label {
|
||||
line-height:30px;
|
||||
}
|
||||
.poll_checkbox_label:before {
|
||||
vertical-align:top !important;
|
||||
}
|
||||
.toot_detail.main_status .poll_checkbox_label:before {
|
||||
vertical-align:middle !important;
|
||||
}
|
||||
.poll_vote {
|
||||
display:inline;
|
||||
}
|
||||
.toot_detail.main_status .poll_vote {
|
||||
vertical-align:text-bottom;
|
||||
}
|
||||
.poll_bar {
|
||||
position:absolute;
|
||||
background-color:#CCCCCC;
|
||||
border-radius:4px;
|
||||
height:25px;
|
||||
}
|
||||
.poll_winner {
|
||||
background-color:#189EFC;
|
||||
}
|
||||
.toot_detail.main_status .poll_bar {
|
||||
height:35px;
|
||||
}
|
||||
.poll_result_label {
|
||||
position:relative;
|
||||
display:inline-block;
|
||||
padding:5px;
|
||||
}
|
||||
.poll_footer {
|
||||
color:#66757F;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ if(status.media_attachments[0].remote_url != null) {
|
|||
status.media_attachments[0].url = status.media_attachments[0].remote_url;
|
||||
}
|
||||
if(status.media_attachments[0].type === "video" && localStorage.setting_play_video != "false") border = ' style="border:0;border-radius:0"';
|
||||
if(localStorage.setting_full_height == "true") {
|
||||
if(localStorage.setting_full_height == "true" && status.media_attachments.length == 1 && (status.media_attachments[0].type == "image" || (status.media_attachments[0].type === "video" && localStorage.setting_play_video == "false") || (status.media_attachments[0].type === "gifv" && localStorage.setting_play_gif == "false"))) {
|
||||
mvfullheight = " media_full_height";
|
||||
dsplength = "1";
|
||||
}
|
||||
|
@ -82,6 +82,52 @@ media_views += "</div>";
|
|||
}
|
||||
return media_views;
|
||||
}
|
||||
function poll_template(poll) {
|
||||
let poll_html = "";
|
||||
var expires_at = new Date(new Date(poll.expires_at).getTime()-Date.now());
|
||||
var expires_string;
|
||||
if(expires_at.getUTCDate() == 2) expires_string = "1 "+__("day");
|
||||
else if(expires_at.getUTCDate() > 2) expires_string = (expires_at.getUTCDate()-1)+" "+__("days");
|
||||
else if(expires_at.getUTCHours() == 1) expires_string = "1 "+__("hour");
|
||||
else if(expires_at.getUTCHours() > 1) expires_string = expires_at.getUTCHours()+" "+__("hours");
|
||||
else if(expires_at.getUTCMinutes() == 1) expires_string = "1 "+__("minute");
|
||||
else if(expires_at.getUTCMinutes() > 1) expires_string = expires_at.getUTCMinutes()+" "+__("minutes");
|
||||
else if(expires_at.getUTCSeconds() == 1) expires_string = "1 "+__("second");
|
||||
else expires_string = expires_at.getUTCSeconds()+" "+__("seconds");
|
||||
if(poll.voted || poll.expired) {
|
||||
poll_html = (`<div class="poll_box">`);
|
||||
optionsort = [...poll.options];
|
||||
optionsort.sort(function(a,b) {return a.votes_count - b.votes_count});
|
||||
optionsort.reverse();
|
||||
if(optionsort[0].votes_count != optionsort[1].votes_count) poll.options[poll.options.indexOf(optionsort[0])].winner = true;
|
||||
for(var i=0;i<poll.options.length;i++) {
|
||||
var winner = "";
|
||||
if(poll.options[i].winner) winner = " poll_winner";
|
||||
poll_html += (`<div class="poll_result_option"><span class="poll_bar${winner}" style="width:${poll.options[i].votes_count/poll.votes_count*100}%"></div>
|
||||
<label class="poll_result_label"><strong>${Math.round(poll.options[i].votes_count/poll.votes_count*100) || 0}%</strong> <span class="emoji_poss">${poll.options[i].title}</span></label>`);
|
||||
}
|
||||
if(poll.expired) poll_html += (`<br/><span class="poll_footer">${poll.votes_count} ${__("votes")} • ${__("Final results")}</span>`);
|
||||
else poll_html += (`<br/><span class="poll_footer">${poll.votes_count} ${__("votes")} • ${expires_string} ${__("left")}</span>`);
|
||||
}
|
||||
else {
|
||||
const poll_random = Math.round(Math.random()*1000);
|
||||
poll_html = (`<div class="poll_box poll_box_form poll_${poll.id}" data-poll="${poll.id}" data-random="${poll_random}" id="poll_${poll.id}_${poll_random}">`);
|
||||
for(var i=0;i<poll.options.length;i++) {
|
||||
if(poll.multiple) {
|
||||
poll_html += (`<input type="checkbox" id="poll_${poll.id}_${poll_random}_${i}" name="poll_${poll.id}" class="poll_vote_option checkbox">
|
||||
<label for="poll_${poll.id}_${poll_random}_${i}" class="poll_vote_label poll_checkbox_label emoji_poss">${poll.options[i].title}</label><br/>`);
|
||||
}
|
||||
else {
|
||||
poll_html += (`<div class="radiobox"><input type="radio" id="poll_${poll.id}_${poll_random}_${i}" name="poll_${poll.id}" class="poll_vote_option">
|
||||
<label for="poll_${poll.id}_${poll_random}_${i}" class="poll_vote_label radiotext emoji_poss">${poll.options[i].title}</label></div>`);
|
||||
}
|
||||
}
|
||||
poll_html += (`<button class="halcyon_button poll_vote"><span>${__("Vote")}</span></button>
|
||||
${poll.votes_count} ${__("votes")} • ${expires_string} ${__("left")}`);
|
||||
}
|
||||
poll_html += (`</div>`);
|
||||
return poll_html;
|
||||
}
|
||||
function timeline_template(status) {
|
||||
if (status.reblog === null) {
|
||||
for(i=0;i<status.emojis.length;i++) {
|
||||
|
@ -111,7 +157,8 @@ article_option= "",
|
|||
toot_replies_count = "",
|
||||
toot_reblogs_count= "",
|
||||
toot_favourites_count = "",
|
||||
media_views = "";
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
if(status.spoiler_text && localStorage.setting_show_content_warning == "false") {
|
||||
alart_text = "<span>"+status.spoiler_text+"</span><button class='cw_button'>"+__('SHOW MORE')+"</button>",
|
||||
article_option = "content_warning";
|
||||
|
@ -128,9 +175,12 @@ toot_reblogs_count = status.reblogs_count;
|
|||
if (status.favourites_count) {
|
||||
toot_favourites_count = status.favourites_count;
|
||||
}
|
||||
if ( status.media_attachments.length ) {
|
||||
if(status.media_attachments.length) {
|
||||
media_views = mediaattachments_template(status);
|
||||
}
|
||||
if(status.poll) {
|
||||
poll_object = poll_template(status.poll);
|
||||
}
|
||||
if(status.account.display_name.length == 0) {
|
||||
status.account.display_name = status.account.username;
|
||||
}
|
||||
|
@ -238,6 +288,7 @@ ${toot_reblog_button}
|
|||
</div>
|
||||
</li>`);
|
||||
html.find(".toot_article").append(media_views);
|
||||
html.find(".toot_article").append(poll_object);
|
||||
return html
|
||||
} else {
|
||||
for(i=0;i<status.reblog.emojis.length;i++) {
|
||||
|
@ -273,7 +324,8 @@ article_option= "",
|
|||
toot_replies_count = "",
|
||||
toot_reblogs_count= "",
|
||||
toot_favourites_count = "",
|
||||
media_views = "";
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
if(status.reblog.spoiler_text && localStorage.setting_show_content_warning == "false") {
|
||||
alart_text = "<span>"+status.reblog.spoiler_text+"</span><button class='cw_button'>"+__('SHOW MORE')+"</button>",
|
||||
article_option = "content_warning";
|
||||
|
@ -293,6 +345,9 @@ toot_favourites_count = status.reblog.favourites_count;
|
|||
if ( status.reblog.media_attachments.length ) {
|
||||
media_views = mediaattachments_template(status.reblog);
|
||||
}
|
||||
if(status.reblog.poll) {
|
||||
poll_object = poll_template(status.reblog.poll);
|
||||
}
|
||||
if(status.account.display_name.length == 0) {
|
||||
status.account.display_name = status.account.username;
|
||||
}
|
||||
|
@ -398,6 +453,7 @@ ${status.reblog.content}
|
|||
</div>
|
||||
</li>`);
|
||||
html.find(".toot_article").append(media_views);
|
||||
html.find(".toot_article").append(poll_object);
|
||||
return html
|
||||
}
|
||||
}
|
||||
|
@ -429,7 +485,8 @@ article_option= "",
|
|||
toot_replies_count = "",
|
||||
toot_reblogs_count= "",
|
||||
toot_favourites_count = "",
|
||||
media_views = "";
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
if(status.spoiler_text && localStorage.setting_show_content_warning == "false") {
|
||||
alart_text = "<span>"+status.spoiler_text+"</span><button class='cw_button'>"+__('SHOW MORE')+"</button>",
|
||||
article_option = "content_warning";
|
||||
|
@ -449,6 +506,9 @@ toot_favourites_count = status.favourites_count;
|
|||
if ( status.media_attachments.length ) {
|
||||
media_views = mediaattachments_template(status);
|
||||
}
|
||||
if(status.poll) {
|
||||
poll_object = poll_template(status.poll);
|
||||
}
|
||||
if(status.account.display_name.length == 0) {
|
||||
status.account.display_name = status.account.username;
|
||||
}
|
||||
|
@ -544,6 +604,7 @@ ${status.content}
|
|||
</div>
|
||||
</li>`);
|
||||
html.find(".toot_article").append(media_views);
|
||||
html.find(".toot_article").append(poll_object);
|
||||
return html
|
||||
}
|
||||
function notifications_template(NotificationObj) {
|
||||
|
@ -557,7 +618,7 @@ NotificationObj.account.display_name = htmlEscape(NotificationObj.account.displa
|
|||
for(i=0;i<NotificationObj.account.emojis.length;i++) {
|
||||
NotificationObj.account.display_name = NotificationObj.account.display_name.replace(new RegExp(":"+NotificationObj.account.emojis[i].shortcode+":","g"),"<img src='"+NotificationObj.account.emojis[i].url+"' class='emoji'>");
|
||||
}
|
||||
if ( NotificationObj.type === 'favourite' | NotificationObj.type === 'reblog' ) {
|
||||
if (NotificationObj.type === 'favourite' | NotificationObj.type === 'reblog' ) {
|
||||
var toot_author_link;
|
||||
if(NotificationObj.status.account.acct.indexOf("@") == -1) toot_author_link = "/@"+NotificationObj.status.account.acct+"@"+current_instance+"?mid="+NotificationObj.status.account.id;
|
||||
else toot_author_link = "/@"+NotificationObj.status.account.acct+"?mid="+NotificationObj.status.account.id;
|
||||
|
@ -676,7 +737,8 @@ article_option= "",
|
|||
toot_replies_count = "",
|
||||
toot_reblogs_count= "",
|
||||
toot_favourites_count = "",
|
||||
media_views = "";
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
for(i=0;i<NotificationObj.status.emojis.length;i++) {
|
||||
NotificationObj.status.content = NotificationObj.status.content.replace(new RegExp(":"+NotificationObj.status.emojis[i].shortcode+":","g"),"<img src='"+NotificationObj.status.emojis[i].url+"' class='emoji'>");
|
||||
}
|
||||
|
@ -713,6 +775,9 @@ toot_favourites_count = NotificationObj.status.favourites_count;
|
|||
if (NotificationObj.status.media_attachments.length) {
|
||||
media_views = mediaattachments_template(NotificationObj.status);
|
||||
}
|
||||
if(NotificationObj.status.poll) {
|
||||
poll_object = poll_template(NotificationObj.status.poll);
|
||||
}
|
||||
if(NotificationObj.status.account.display_name.length == 0) {
|
||||
NotificationObj.status.account.display_name = NotificationObj.status.account.username;
|
||||
}
|
||||
|
@ -820,8 +885,176 @@ ${toot_reblog_button}
|
|||
</div>
|
||||
</li>`);
|
||||
html.find(".toot_article").append(media_views);
|
||||
html.find(".toot_article").append(poll_object);
|
||||
return html
|
||||
} else {
|
||||
} else if ( NotificationObj.type === 'poll' ) {
|
||||
var toot_author_link;
|
||||
if(NotificationObj.status.account.acct.indexOf("@") == -1) toot_author_link = "/@"+NotificationObj.status.account.acct+"@"+current_instance+"?mid="+NotificationObj.status.account.id;
|
||||
else toot_author_link = "/@"+NotificationObj.status.account.acct+"?mid="+NotificationObj.status.account.id;
|
||||
const toot_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, NotificationObj.status.created_at)),
|
||||
toot_attr_datetime = getConversionedDate(null, NotificationObj.status.created_at);
|
||||
let alart_text= "",
|
||||
article_option= "",
|
||||
toot_replies_count = "",
|
||||
toot_reblogs_count= "",
|
||||
toot_favourites_count = "",
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
for(i=0;i<NotificationObj.status.emojis.length;i++) {
|
||||
NotificationObj.status.content = NotificationObj.status.content.replace(new RegExp(":"+NotificationObj.status.emojis[i].shortcode+":","g"),"<img src='"+NotificationObj.status.emojis[i].url+"' class='emoji'>");
|
||||
}
|
||||
NotificationObj.status.account.display_name = htmlEscape(NotificationObj.status.account.display_name);
|
||||
for(i=0;i<NotificationObj.status.account.emojis.length;i++) {
|
||||
NotificationObj.status.account.display_name = NotificationObj.status.account.display_name.replace(new RegExp(":"+NotificationObj.status.account.emojis[i].shortcode+":","g"),"<img src='"+NotificationObj.status.account.emojis[i].url+"' class='emoji'>");
|
||||
}
|
||||
for(var i=0;i<NotificationObj.status.mentions.length;i++) {
|
||||
if(NotificationObj.status.mentions[i].acct.indexOf("@") == -1) NotificationObj.status.content = NotificationObj.status.content.replace(new RegExp('href="'+NotificationObj.status.mentions[i].url+'"',"g"),'href="/@'+NotificationObj.status.mentions[i].acct+'@'+current_instance+'?mid='+NotificationObj.status.mentions[i].id+'"');
|
||||
else NotificationObj.status.content = NotificationObj.status.content.replace(new RegExp('href="'+NotificationObj.status.mentions[i].url+'"',"g"),'href="/@'+NotificationObj.status.mentions[i].acct+'?mid='+NotificationObj.status.mentions[i].id+'"');
|
||||
}
|
||||
var writtenby = new Object();
|
||||
writtenby.id = NotificationObj.status.account.id;
|
||||
writtenby.username = NotificationObj.status.account.username;
|
||||
writtenby.url = NotificationObj.status.account.url;
|
||||
writtenby.acct = NotificationObj.status.account.acct;
|
||||
NotificationObj.status.mentions.push(writtenby);
|
||||
if(NotificationObj.status.spoiler_text && localStorage.setting_show_content_warning == "false") {
|
||||
alart_text = "<span>"+NotificationObj.status.spoiler_text+"</span><button class='cw_button'>"+__('SHOW MORE')+"</button>",
|
||||
article_option = "content_warning";
|
||||
}
|
||||
else if(NotificationObj.status.spoiler_text && localStorage.setting_show_content_warning == "true") {
|
||||
alart_text = "<span>"+NotificationObj.status.spoiler_text+"</span><button class='cw_button'>"+__('SHOW LESS')+"</button>";
|
||||
}
|
||||
if(NotificationObj.status.replies_count) {
|
||||
toot_replies_count = NotificationObj.status.replies_count;
|
||||
}
|
||||
if (NotificationObj.status.reblogs_count) {
|
||||
toot_reblogs_count = NotificationObj.status.reblogs_count;
|
||||
}
|
||||
if (NotificationObj.status.favourites_count) {
|
||||
toot_favourites_count = NotificationObj.status.favourites_count;
|
||||
}
|
||||
if (NotificationObj.status.media_attachments.length) {
|
||||
media_views = mediaattachments_template(NotificationObj.status);
|
||||
}
|
||||
if(NotificationObj.status.poll) {
|
||||
poll_object = poll_template(NotificationObj.status.poll);
|
||||
}
|
||||
if(NotificationObj.status.account.display_name.length == 0) {
|
||||
NotificationObj.status.account.display_name = NotificationObj.status.account.username;
|
||||
}
|
||||
switch(NotificationObj.status.visibility) {
|
||||
case "public":toot_privacy_mode=__("Public");toot_privacy_icon="globe";break;
|
||||
case "unlisted":toot_privacy_mode=__("Unlisted");toot_privacy_icon="unlock-alt";break;
|
||||
case "private":toot_privacy_mode=__("Followers-only");toot_privacy_icon="lock";break;
|
||||
case "direct":toot_privacy_mode=__("Direct");toot_privacy_icon="envelope";break;
|
||||
}
|
||||
if(toot_privacy_icon == "globe" || toot_privacy_icon == "unlock-alt") {
|
||||
toot_footer_width = " style='width:320px'";
|
||||
toot_reblog_button = (`<div class="toot_reaction">
|
||||
<button class="boost_button" tid="${NotificationObj.status.id}" reblogged="${NotificationObj.status.reblogged}">
|
||||
<i class="fa fa-fw fa-retweet"></i>
|
||||
<span class="reaction_count boost_count">${toot_reblogs_count}</span>
|
||||
</button>
|
||||
</div>`);
|
||||
}
|
||||
else {
|
||||
toot_footer_width = "";
|
||||
toot_reblog_button = "";
|
||||
}
|
||||
var own_toot_buttons = "";
|
||||
if(NotificationObj.status.account.acct == current_acct) {
|
||||
var own_toot_buttons = (`<li><a class="delete_button" tid="${NotificationObj.status.id}">${__('Delete Toot')}</a></li>`);
|
||||
if(NotificationObj.status.pinned == true) {
|
||||
own_toot_buttons += (`<li><a class="unpin_button" tid="${NotificationObj.status.id}">${__('Unpin Toot')}</a></li>`);
|
||||
}
|
||||
else {
|
||||
own_toot_buttons += (`<li><a class="pin_button" tid="${NotificationObj.status.id}">${__('Pin Toot')}</a></li>`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
var own_toot_buttons = (`<li><a class="mute_button" mid="${NotificationObj.status.account.id}" sid="${NotificationObj.status.id}">${__('Mute')} @${NotificationObj.status.account.username}</a></li>
|
||||
<li><a class="block_button" mid="${NotificationObj.status.account.id}" sid="${NotificationObj.status.id}">${__('Block')} @${NotificationObj.status.account.username}</a></li>
|
||||
<li><a class="addlist_button" mid="${NotificationObj.status.account.id}" sid="${NotificationObj.status.id}" display_name="${NotificationObj.status.account.display_name}">${__('Add to list')} @${NotificationObj.status.account.username}</a></li>
|
||||
<li><a class="report_button" mid="${NotificationObj.status.account.id}" sid="${NotificationObj.status.id}" display_name="${NotificationObj.account.display_name}">${__('Report this Toot')}</a></li>`);
|
||||
}
|
||||
var account_state_icons = "";
|
||||
if(NotificationObj.status.account.locked == true) account_state_icons += " <i class='fa fa-lock'></i>";
|
||||
if(NotificationObj.status.account.bot == true) account_state_icons += " <img src='/assets/images/robot.svg' class='emoji'>";
|
||||
const html=$(`
|
||||
<li sid="${NotificationObj.status.id}" class="toot_entry">
|
||||
<div class="notice_author_box poll_notify_header">
|
||||
<i class="fa fa-fw fa-pie-chart font-icon poll"></i>
|
||||
<a class="notice_author" href="javascript:void(0)">
|
||||
${__('A poll you participated in has ended')}
|
||||
</a>
|
||||
</div>
|
||||
<div class="toot_entry_body">
|
||||
<a href="${toot_author_link}">
|
||||
<div class="icon_box">
|
||||
<img src="${NotificationObj.status.account.avatar}">
|
||||
</div>
|
||||
</a>
|
||||
<section class="toot_content">
|
||||
<header class="toot_header">
|
||||
<div class="text_ellipsis">
|
||||
<a href="${toot_author_link}">
|
||||
<span class="displayname emoji_poss">
|
||||
${NotificationObj.status.account.display_name}
|
||||
</span>
|
||||
<span class="username">
|
||||
@${NotificationObj.status.account.acct}${account_state_icons}
|
||||
</span>
|
||||
<time datetime="${toot_attr_datetime}">${toot_datetime}</time>
|
||||
</a>
|
||||
</div>
|
||||
<div class="expand_button_wrap">
|
||||
<button class="expand_button">
|
||||
<i class="fa fa-fw fa-chevron-down"></i>
|
||||
</button>
|
||||
<div class="expand_menu invisible disallow_select">
|
||||
<ul>
|
||||
<li><a class="copylink_button" url="${NotificationObj.status.url}" >${__('Copy link to Toot')}</a></li>
|
||||
${own_toot_buttons}
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="${NotificationObj.status.url}" target="_blank">${__('View original')}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<article class="toot_article ${article_option}">
|
||||
${alart_text}
|
||||
<span class="status_content emoji_poss">
|
||||
${NotificationObj.status.content}
|
||||
</span>
|
||||
</article>
|
||||
<footer class="toot_footer"${toot_footer_width}>
|
||||
<div class="toot_reaction">
|
||||
<button class="reply_button" tid="${NotificationObj.status.id}" mentions='${JSON.stringify(NotificationObj.status.mentions)}' display_name="${NotificationObj.account.display_name}" privacy="${NotificationObj.status.visibility}">
|
||||
<i class="fa fa-fw fa-reply"></i>
|
||||
<span class="reaction_count reply_count">${toot_replies_count}</span>
|
||||
</button>
|
||||
</div>
|
||||
${toot_reblog_button}
|
||||
<div class="toot_reaction">
|
||||
<button class="fav_button" tid="${NotificationObj.status.id}" favourited="${NotificationObj.status.favourited}">
|
||||
<i class="fa fa-fw fa-star"></i>
|
||||
<span class="reaction_count fav_count">${toot_favourites_count}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="toot_reaction">
|
||||
<button>
|
||||
<i class="fa fa-fw fa-${toot_privacy_icon}" title="${toot_privacy_mode}"></i>
|
||||
</button>
|
||||
</div>
|
||||
</footer>
|
||||
</section>
|
||||
</div>
|
||||
</li>`);
|
||||
html.find(".toot_article").append(media_views);
|
||||
html.find(".toot_article").append(poll_object);
|
||||
return html
|
||||
} else if(NotificationObj.type === 'follow') {
|
||||
const html=(`
|
||||
<li sid="${NotificationObj.id}" class="notice_entry fol">
|
||||
<div class="notice_author_box">
|
||||
|
@ -896,7 +1129,8 @@ article_option= "",
|
|||
toot_replies_count = "",
|
||||
toot_reblogs_count= "",
|
||||
toot_favourites_count = "",
|
||||
media_views = "";
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
for(i=0;i<status.emojis.length;i++) {
|
||||
status.content = status.content.replace(new RegExp(":"+status.emojis[i].shortcode+":","g"),"<img src='"+status.emojis[i].url+"' class='emoji'>");
|
||||
}
|
||||
|
@ -933,6 +1167,9 @@ toot_favourites_count = status.favourites_count;
|
|||
if (status.media_attachments.length) {
|
||||
media_views = mediaattachments_template(status);
|
||||
}
|
||||
if(status.poll) {
|
||||
poll_object = poll_template(status.poll);
|
||||
}
|
||||
if(status.account.display_name.length == 0) {
|
||||
status.account.display_name = status.account.username;
|
||||
}
|
||||
|
@ -1052,6 +1289,23 @@ ${toot_reblog_button}
|
|||
<div class="status_textarea">
|
||||
<textarea class="emoji_poss" name="status_textarea" placeholder="${__('Toot your reply')}"></textarea>
|
||||
<div class="media_attachments_preview_area invisible"></div>
|
||||
<div class="status_poll_editor invisible">
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<div style="height:32px;display:inline-block;padding-top:10px">${__("Expires in")} </div>
|
||||
<div style="float:right;margin-right:5px"><div class="poll_time"><input type="number" min="0" max="7" placeholder="0-7" class="poll_days">${__('Days')}</div>
|
||||
<div class="poll_time"><input type="number" min="0" max="24" placeholder="0-24" class="poll_hours">${__('Hours')}</div>
|
||||
<div class="poll_time"><input type="number" min="0" max="60" placeholder="0-60" class="poll_mins">${__('Minutes')}</div></div><br/>
|
||||
<div class="switch poll_mc_switch">
|
||||
<input type="checkbox" class="poll_multiple_choice">
|
||||
<div class="switch-btn">
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
${__("Multiple choice")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="status_bottom invisible">
|
||||
|
@ -1087,6 +1341,9 @@ ${toot_reblog_button}
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label for="reply_status_poll" class="status_poll status_option_button">
|
||||
<i class="fa fa-pie-chart" aria-hidden="true"></i>
|
||||
</label>
|
||||
<label for="reply_status_emoji" class="status_emoji status_option_button">
|
||||
<i class="fa fa-smile-o" aria-hidden="true"></i>
|
||||
</label>
|
||||
|
@ -1115,6 +1372,7 @@ ${current_instance_charlimit}
|
|||
</form>`);
|
||||
history.pushState(null, null, status_account_link.replace("?mid=",'/status/'+status.id+"?mid="));
|
||||
html.find(".toot_article").append(media_views);
|
||||
html.find(".toot_article").append(poll_object);
|
||||
return html
|
||||
} else {
|
||||
const status_datetime= getConversionedDate(null, status.reblog.created_at),
|
||||
|
@ -1129,7 +1387,8 @@ article_option= "",
|
|||
toot_replies_count = "",
|
||||
toot_reblogs_count= "",
|
||||
toot_favourites_count = "",
|
||||
media_views = "";
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
for(i=0;i<status.reblog.emojis.length;i++) {
|
||||
status.reblog.content = status.reblog.content.replace(new RegExp(":"+status.reblog.emojis[i].shortcode+":","g"),"<img src='"+status.reblog.emojis[i].url+"' class='emoji'>");
|
||||
}
|
||||
|
@ -1170,6 +1429,9 @@ toot_favourites_count = status.reblog.favourites_count;
|
|||
if(status.reblog.media_attachments.length){
|
||||
media_views = mediaattachments_template(status.reblog);
|
||||
}
|
||||
if(status.reblog.poll) {
|
||||
poll_object = poll_template(status.reblog.poll);
|
||||
}
|
||||
if(status.account.display_name.length == 0) {
|
||||
status.account.display_name = status.account.username;
|
||||
}
|
||||
|
@ -1280,6 +1542,23 @@ ${status.reblog.content}
|
|||
<div class="status_textarea">
|
||||
<textarea class="emoji_poss" name="status_textarea" placeholder="${__('Toot your reply')}"></textarea>
|
||||
<div class="media_attachments_preview_area invisible"></div>
|
||||
<div class="status_poll_editor invisible">
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<div style="height:32px;display:inline-block;padding-top:10px">${__("Expires in")} </div>
|
||||
<div style="float:right;margin-right:5px"><div class="poll_time"><input type="number" min="0" max="7" placeholder="0-7" class="poll_days">${__('Days')}</div>
|
||||
<div class="poll_time"><input type="number" min="0" max="24" placeholder="0-24" class="poll_hours">${__('Hours')}</div>
|
||||
<div class="poll_time"><input type="number" min="0" max="60" placeholder="0-60" class="poll_mins">${__('Minutes')}</div></div><br/>
|
||||
<div class="switch poll_mc_switch">
|
||||
<input type="checkbox" class="poll_multiple_choice">
|
||||
<div class="switch-btn">
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
${__("Multiple choice")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="status_bottom invisible">
|
||||
|
@ -1315,7 +1594,10 @@ ${status.reblog.content}
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label for="single_reply_status_emoji" class="status_emoji status_option_button">
|
||||
<label for="reply_status_poll" class="status_poll status_option_button">
|
||||
<i class="fa fa-pie-chart" aria-hidden="true"></i>
|
||||
</label>
|
||||
<label for="reply_status_emoji" class="status_emoji status_option_button">
|
||||
<i class="fa fa-smile-o" aria-hidden="true"></i>
|
||||
</label>
|
||||
<input id="reply_status_media_atta" name="files" type="file" multiple class="invisible"/>
|
||||
|
@ -1344,6 +1626,7 @@ ${current_instance_charlimit}
|
|||
`);
|
||||
history.pushState(null, null, status_reblog_account_link.replace("?mid=",'/status/'+status.reblog.id+"?mid="));
|
||||
html.find(".toot_article").append(media_views);
|
||||
html.find(".toot_article").append(poll_object);
|
||||
return html
|
||||
}
|
||||
}
|
||||
|
@ -1395,7 +1678,8 @@ article_option= "",
|
|||
toot_replies_count = "",
|
||||
toot_reblogs_count= "",
|
||||
toot_favourites_count = "",
|
||||
media_views = "";
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
for(i=0;i<status.emojis.length;i++) {
|
||||
status.content = status.content.replace(new RegExp(":"+status.emojis[i].shortcode+":","g"),"<img src='"+status.emojis[i].url+"' class='emoji'>");
|
||||
}
|
||||
|
@ -1432,6 +1716,9 @@ toot_favourites_count = status.favourites_count;
|
|||
if( status.media_attachments.length) {
|
||||
media_views = mediaattachments_template(status);
|
||||
}
|
||||
if(status.poll) {
|
||||
poll_object = poll_template(status.poll);
|
||||
}
|
||||
if(status.account.display_name.length == 0) {
|
||||
status.account.display_name = status.account.username;
|
||||
}
|
||||
|
@ -1535,6 +1822,7 @@ ${toot_reblog_button}
|
|||
</div>
|
||||
</div>`);
|
||||
html.find(".toot_article").append(media_views);
|
||||
html.find(".toot_article").append(poll_object);
|
||||
return html
|
||||
} else {
|
||||
const status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, status.reblog.created_at)),
|
||||
|
@ -1549,7 +1837,8 @@ article_option= "",
|
|||
toot_replies_count = "",
|
||||
toot_reblogs_count= "",
|
||||
toot_favourites_count = "",
|
||||
media_views = "";
|
||||
media_views = "",
|
||||
poll_object = "";
|
||||
for(i=0;i<status.reblog.emojis.length;i++) {
|
||||
status.reblog.content = status.reblog.content.replace(new RegExp(":"+status.reblog.emojis[i].shortcode+":","g"),"<img src='"+status.reblog.emojis[i].url+"' class='emoji'>");
|
||||
}
|
||||
|
@ -1590,6 +1879,9 @@ toot_favourites_count = status.reblog.favourites_count;
|
|||
if (status.reblog.media_attachments.length) {
|
||||
media_views = mediaattachments_template(status.reblog);
|
||||
}
|
||||
if(status.reblog.poll) {
|
||||
poll_object = poll_template(status.reblog.poll);
|
||||
}
|
||||
if(status.account.display_name.length == 0) {
|
||||
status.account.display_name = status.account.username;
|
||||
}
|
||||
|
@ -1691,6 +1983,7 @@ ${status.reblog.content}
|
|||
</div>
|
||||
</div>`);
|
||||
html.find(".toot_article").append(media_views);
|
||||
html.find(".toot_article").append(poll_object);
|
||||
return html
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,11 +107,13 @@ api.post("statuses/"+$(this).attr('tid')+"/reblog", function (data) {
|
|||
});
|
||||
$(this).attr('reblogged', "true");
|
||||
$(this).toggleClass('active');
|
||||
$(".js_current_toots_count").html(++localStorage.current_statuses_count);
|
||||
} else {
|
||||
api.post("statuses/"+$(this).attr('tid')+"/unreblog", function (data) {
|
||||
});
|
||||
$(this).attr('reblogged', "hold");
|
||||
$(this).toggleClass('active');
|
||||
$(".js_current_toots_count").html(--localStorage.current_statuses_count);
|
||||
$(this).mouseout(function(e) {
|
||||
$(this).attr('reblogged', "null");
|
||||
});
|
||||
|
@ -147,6 +149,7 @@ $('.overlay_confirm_text').text(__("Are you sure that you want to delete this to
|
|||
$('.overlay_confirm_yes').click(function() {
|
||||
$('.close_button').click();
|
||||
api.delete("statuses/"+sid, function (data) {
|
||||
if($('.toot_entry[sid="'+sid+'"] .reply_button').attr("privacy") != "direct") $(".js_current_toots_count").html(--localStorage.current_statuses_count);
|
||||
$('.toot_entry[sid="'+sid+'"]').remove();
|
||||
putMessage(__("Your Toot has been deleted"));
|
||||
});
|
||||
|
@ -1065,6 +1068,7 @@ case "favourite":pushNotification(__("New favourite"),userstream.payload.account
|
|||
case "reblog":pushNotification(__("New boost"),userstream.payload.account.display_name+" "+__("boosted your toot"));break;
|
||||
case "follow":pushNotification(__("New follower"),userstream.payload.account.display_name+" "+__("followed you"));$(".js_current_followers_count").html(++localStorage.current_followers_count);break;
|
||||
case "mention":pushNotification(__("New mention"),userstream.payload.account.display_name+" "+__("mentioned you"));break;
|
||||
case "poll":pushNotification(__("Poll finished"),__("A poll you participated in has ended"));break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1303,28 +1307,45 @@ $("#overlay_status_nsfw")[0].checked = true;
|
|||
$('#overlay_status_form .media_attachments_preview_area').addClass('nsfw');
|
||||
}
|
||||
});
|
||||
$(document).on('change keyup','#overlay_status_form textarea, #overlay_status_form .status_spoiler', function(e) {
|
||||
$(document).on('change keyup','#overlay_status_form textarea,#overlay_status_form .status_spoiler,#overlay_status_form .poll_days,#overlay_status_form .poll_hours,#overlay_status_form .poll_mins', function(e) {
|
||||
var is_ready;
|
||||
if(e.keyCode !== 224 & e.keyCode !== 17) {
|
||||
const textCount = $('#overlay_status_form textarea').val().length + $('#overlay_status_form .status_spoiler').val().length;
|
||||
let textLen = ( current_instance_charlimit - textCount );
|
||||
if ( textLen <= -1 ) {
|
||||
$('#overlay_status_form .character_count').addClass('red');
|
||||
$('#overlay_status_form').addClass('ready');
|
||||
} else if ( textLen === current_instance_charlimit ) {
|
||||
$('#overlay_status_form').addClass('ready');
|
||||
} else {
|
||||
$('#overlay_status_form .character_count').removeClass('red');
|
||||
$('#overlay_status_form').removeClass('ready');
|
||||
}
|
||||
if(e.key == ":") {
|
||||
replace_emoji_textarea(this);
|
||||
}
|
||||
const textCount = $('#overlay_status_form textarea').val().length + $('#overlay_status_form .status_spoiler').val().length;
|
||||
let textLen = ( current_instance_charlimit - textCount );
|
||||
if(textLen <= -1) {
|
||||
$('#overlay_status_form .character_count').addClass('red');
|
||||
is_ready = true;
|
||||
} else if(textLen === current_instance_charlimit) {
|
||||
is_ready = true;
|
||||
} else {
|
||||
$('#overlay_status_form .character_count').removeClass('red');
|
||||
is_ready = false;
|
||||
}
|
||||
$('#overlay_status_form .character_count').text(textLen);
|
||||
}
|
||||
if($('#overlay_status_form .status_poll_editor').hasClass("invisible")) {
|
||||
if(is_ready) $('#overlay_status_form').addClass('ready');
|
||||
else $('#overlay_status_form').removeClass('ready');
|
||||
}
|
||||
else {
|
||||
if($('#overlay_status_form .poll_days').is(":valid") && $('#overlay_status_form .poll_hours').is(":valid") && $('#overlay_status_form .poll_mins').is(":valid")) {
|
||||
if(is_ready) $('#overlay_status_form').addClass('ready');
|
||||
else $('#overlay_status_form').removeClass('ready');
|
||||
}
|
||||
else $('#overlay_status_form').addClass('ready');
|
||||
}
|
||||
});
|
||||
$(document).on('click','#overlay_status_form .status_CW', function(e) {
|
||||
$('#overlay_status_form .status_spoiler').toggleClass('invisible');
|
||||
});
|
||||
$(document).on('click','#overlay_status_form .status_poll', function(e) {
|
||||
$('#overlay_status_form .status_poll_editor').toggleClass('invisible');
|
||||
$('#overlay_status_form .status_media_attachment').toggleClass('disabled');
|
||||
$('#overlay_status_form textarea').keyup();
|
||||
});
|
||||
$(document).on('click','#overlay_status_form .expand_privacy_menu_button', function(e) {
|
||||
$('#overlay_status_form .expand_privacy_menu').removeClass('invisible');
|
||||
});
|
||||
|
@ -1336,6 +1357,7 @@ $('#overlay_status_form .expand_privacy_menu').addClass('invisible');
|
|||
$(document).on('change','#overlay_status_media_atta', function(e) {
|
||||
$('#overlay_status_form .media_attachments_preview_area').empty();
|
||||
$('#overlay_status_form .status_textarea .media_attachments_preview_area').removeClass('invisible');
|
||||
$('#overlay_status_form .status_poll').addClass('disabled');
|
||||
for ( let i = 0, f; f = e.target.files[i]; i++ ) {
|
||||
let reader= new FileReader();
|
||||
reader.readAsDataURL(f);
|
||||
|
@ -1357,17 +1379,29 @@ $('#overlay_status_form').addClass('ready');
|
|||
$('#overlay_status_form .status_textarea').addClass('disallow_select');
|
||||
$('#overlay_status_form .character_count').html('<i class="fa fa-circle-o-notch fa-spin" aria-hidden="true"></i>');
|
||||
const form = document.forms.overlay_status_form;
|
||||
if ( !$('#overlay_status_media_atta')[0].files.length ) {
|
||||
if (!$('#overlay_status_media_atta')[0].files.length || !$('#overlay_status_form .status_poll_editor').hasClass("invisible")) {
|
||||
const params = {
|
||||
status : form.status_textarea.value,
|
||||
sensitive: form.status_nsfw.checked,
|
||||
spoiler_text : form.status_spoiler.value,
|
||||
visibility : form.privacy_option.value
|
||||
}
|
||||
if(!$('#overlay_status_form .status_poll_editor').hasClass("invisible")) {
|
||||
params.poll = new Object;
|
||||
params.poll.options = new Array;
|
||||
for(var i=0;i < $('#overlay_status_form .poll_field').length;i++) {
|
||||
if($('#overlay_status_form .poll_field').eq(i).val().length > 0) params.poll.options.push($('#overlay_status_form .poll_field').eq(i).val());
|
||||
}
|
||||
if(params.poll.options.length > 0) {
|
||||
params.poll.expires_in = $('#overlay_status_form .poll_days').val()*86400+$('#overlay_status_form .poll_hours').val()*3600+$('#overlay_status_form .poll_mins').val()*60;
|
||||
if($('#overlay_status_form .poll_multiple_choice')[0].checked) params.poll.multiple = "On";
|
||||
}
|
||||
}
|
||||
api.post("statuses", params, function (data) {
|
||||
$('#overlay_status_form .media_attachments_preview_area').empty();
|
||||
$('#overlay_status_form .status_spoiler').addClass('invisible');
|
||||
$('#overlay_status_form .status_textarea .media_attachments_preview_area').addClass('invisible');
|
||||
$('#overlay_status_form .status_poll').removeClass('disabled');
|
||||
form.reset();
|
||||
$('#overlay_status_form').removeClass('ready');
|
||||
$('#overlay_status_form .status_textarea').removeClass('disallow_select');
|
||||
|
@ -1401,6 +1435,7 @@ api.post("statuses", params, function (data) {
|
|||
$('#overlay_status_form .media_attachments_preview_area').empty();
|
||||
$('#overlay_status_form .status_spoiler').addClass('invisible');
|
||||
$('#overlay_status_form .status_textarea .media_attachments_preview_area').addClass('invisible');
|
||||
$('#overlay_status_form .status_poll').removeClass('disabled');
|
||||
form.reset();
|
||||
$('#overlay_status_form').removeClass('ready');
|
||||
$('#overlay_status_form .status_textarea').removeClass('disallow_select');
|
||||
|
@ -1434,9 +1469,11 @@ $('#header_status_form .status_bottom').addClass('invisible');
|
|||
autosize.destroy($('#header_status_form .status_textarea textarea'));
|
||||
$('#header_status_emoji').lsxEmojiPicker("destroy");
|
||||
$('#header_status_form .status_textarea textarea').autoCompleteToken("destroy");
|
||||
$('#header_status_form .status_textarea').addClass("closed");
|
||||
}
|
||||
});
|
||||
$(document).on('change keyup','#header_status_form textarea, #header_status_form .status_spoiler', function(e) {
|
||||
$(document).on('change keyup','#header_status_form textarea,#header_status_form .status_spoiler,#header_status_form .poll_days,#header_status_form .poll_hours,#header_status_form .poll_mins', function(e) {
|
||||
var is_ready;
|
||||
if(e.keyCode !== 224 & e.keyCode !== 17) {
|
||||
if(e.key == ":") {
|
||||
replace_emoji_textarea(this);
|
||||
|
@ -1445,19 +1482,35 @@ const textCount = $('#header_status_form textarea').val().length + $('#header_st
|
|||
let textLen = ( current_instance_charlimit - textCount );
|
||||
if(textLen <= -1) {
|
||||
$('#header_status_form .character_count').addClass('red');
|
||||
$('#header_status_form').addClass('ready');
|
||||
is_ready = true;
|
||||
} else if(textLen === current_instance_charlimit) {
|
||||
$('#header_status_form').addClass('ready');
|
||||
is_ready = true;
|
||||
} else {
|
||||
$('#header_status_form .character_count').removeClass('red');
|
||||
$('#header_status_form').removeClass('ready');
|
||||
is_ready = false;
|
||||
}
|
||||
$('#header_status_form .character_count').text(textLen);
|
||||
}
|
||||
if($('#header_status_form .status_poll_editor').hasClass("invisible")) {
|
||||
if(is_ready) $('#header_status_form').addClass('ready');
|
||||
else $('#header_status_form').removeClass('ready');
|
||||
}
|
||||
else {
|
||||
if($('#header_status_form .poll_days').is(":valid") && $('#header_status_form .poll_hours').is(":valid") && $('#header_status_form .poll_mins').is(":valid")) {
|
||||
if(is_ready) $('#header_status_form').addClass('ready');
|
||||
else $('#header_status_form').removeClass('ready');
|
||||
}
|
||||
else $('#header_status_form').addClass('ready');
|
||||
}
|
||||
});
|
||||
$(document).on('click','#header_status_form .status_CW', function(e) {
|
||||
$('#header_status_form .status_spoiler').toggleClass('invisible');
|
||||
});
|
||||
$(document).on('click','#header_status_form .status_poll', function(e) {
|
||||
$('#header_status_form .status_poll_editor').toggleClass('invisible');
|
||||
$('#header_status_form .status_media_attachment').toggleClass('disabled');
|
||||
$('#header_status_form textarea').keyup();
|
||||
});
|
||||
$(document).on('click','#header_status_form .expand_privacy_menu_button', function(e) {
|
||||
$('#header_status_form .expand_privacy_menu').removeClass('invisible');
|
||||
});
|
||||
|
@ -1475,6 +1528,7 @@ case "private":picon="lock";break;
|
|||
case "direct":picon="envelope";break;
|
||||
}
|
||||
if(!$('#header_status_form .status_textarea textarea').hasClass('focus')) {
|
||||
$('#header_status_form .status_textarea').removeClass("closed");
|
||||
$('#header_status_form input[name="privacy_option"]').val([localStorage.getItem("setting_post_privacy")]);
|
||||
$('#header_status_form .expand_privacy_menu_button > i').attr('class', "fa fa-" + picon);
|
||||
$('#header_status_form .status_textarea textarea').addClass('focus');
|
||||
|
@ -1509,6 +1563,7 @@ $('#header_status_form .media_attachments_preview_area').addClass('nsfw');
|
|||
$(document).on('change','#header_status_media_atta', function(e) {
|
||||
$('#header_status_form .media_attachments_preview_area').empty();
|
||||
$('#header_status_form .status_textarea .media_attachments_preview_area').removeClass('invisible');
|
||||
$('#header_status_form .status_poll').addClass('disabled');
|
||||
for ( let i = 0, f; f = e.target.files[i]; i++ ) {
|
||||
let reader= new FileReader();
|
||||
reader.readAsDataURL(f);
|
||||
|
@ -1530,17 +1585,29 @@ $('#header_status_form').addClass('ready');
|
|||
$('#header_status_form .status_textarea').addClass('disallow_select');
|
||||
$('#header_status_form .character_count').html('<i class="fa fa-circle-o-notch fa-spin" aria-hidden="true"></i>');
|
||||
const form = document.forms.header_status_form;
|
||||
if ( !$('#header_status_media_atta')[0].files.length ) {
|
||||
if(!$('#header_status_media_atta')[0].files.length || !$('#header_status_form .status_poll_editor').hasClass("invisible")) {
|
||||
const params = {
|
||||
status : form.status_textarea.value,
|
||||
sensitive: form.status_nsfw.checked,
|
||||
spoiler_text : form.status_spoiler.value,
|
||||
visibility : form.privacy_option.value
|
||||
}
|
||||
if(!$('#header_status_form .status_poll_editor').hasClass("invisible")) {
|
||||
params.poll = new Object;
|
||||
params.poll.options = new Array;
|
||||
for(var i=0;i < $('#header_status_form .poll_field').length;i++) {
|
||||
if($('#header_status_form .poll_field').eq(i).val().length > 0) params.poll.options.push($('#header_status_form .poll_field').eq(i).val());
|
||||
}
|
||||
if(params.poll.options.length > 0) {
|
||||
params.poll.expires_in = $('#header_status_form .poll_days').val()*86400+$('#header_status_form .poll_hours').val()*3600+$('#header_status_form .poll_mins').val()*60;
|
||||
if($('#header_status_form .poll_multiple_choice')[0].checked) params.poll.multiple = "On";
|
||||
}
|
||||
}
|
||||
api.post("statuses", params, function (data) {
|
||||
$('#header_status_form .media_attachments_preview_area').empty();
|
||||
$('#header_status_form .status_spoiler').addClass('invisible');
|
||||
$('#header_status_form .status_textarea .media_attachments_preview_area').addClass('invisible');
|
||||
$('#header_status_form .status_poll').removeClass('disabled');
|
||||
form.reset();
|
||||
$('#header_status_form').removeClass('ready');
|
||||
$('#header_status_form .status_textarea').removeClass('disallow_select');
|
||||
|
@ -1570,6 +1637,7 @@ api.post("statuses", params, function (data) {
|
|||
$('#header_status_form .media_attachments_preview_area').empty();
|
||||
$('#header_status_form .status_spoiler').addClass('invisible');
|
||||
$('#header_status_form .status_textarea .media_attachments_preview_area').addClass('invisible');
|
||||
$('#header_status_form .status_poll').removeClass('disabled');
|
||||
form.reset();
|
||||
$('#header_status_form').removeClass('ready');
|
||||
$('#header_status_form .status_textarea').removeClass('disallow_select');
|
||||
|
@ -1639,28 +1707,45 @@ $('#reply_status_form .media_attachments_preview_area').addClass('nsfw');
|
|||
}
|
||||
}
|
||||
});
|
||||
$(document).on('change keyup','#reply_status_form textarea, #reply_status_form .status_spoiler', function(e) {
|
||||
$(document).on('change keyup','#reply_status_form textarea,#reply_status_form .status_spoiler,#reply_status_form .poll_days,#reply_status_form .poll_hours,#reply_status_form .poll_mins', function(e) {
|
||||
var is_ready;
|
||||
if(e.keyCode !== 224 & e.keyCode !== 17) {
|
||||
const textCount = $('#reply_status_form textarea').val().length + $('#reply_status_form .status_spoiler').val().length;
|
||||
let textLen = ( current_instance_charlimit - textCount );
|
||||
if ( textLen <= -1 ) {
|
||||
$('#reply_status_form .character_count').addClass('red');
|
||||
$('#reply_status_form').addClass('ready');
|
||||
} else if ( textLen === current_instance_charlimit ) {
|
||||
$('#reply_status_form').addClass('ready');
|
||||
} else {
|
||||
$('#reply_status_form .character_count').removeClass('red');
|
||||
$('#reply_status_form').removeClass('ready');
|
||||
}
|
||||
if(e.key == ":") {
|
||||
replace_emoji_textarea(this);
|
||||
}
|
||||
const textCount = $('#reply_status_form textarea').val().length + $('#reply_status_form .status_spoiler').val().length;
|
||||
let textLen = ( current_instance_charlimit - textCount );
|
||||
if(textLen <= -1) {
|
||||
$('#reply_status_form .character_count').addClass('red');
|
||||
is_ready = true;
|
||||
} else if(textLen === current_instance_charlimit) {
|
||||
is_ready = true;
|
||||
} else {
|
||||
$('#reply_status_form .character_count').removeClass('red');
|
||||
is_ready = false;
|
||||
}
|
||||
$('#reply_status_form .character_count').text(textLen);
|
||||
}
|
||||
if($('#reply_status_form .status_poll_editor').hasClass("invisible")) {
|
||||
if(is_ready) $('#reply_status_form').addClass('ready');
|
||||
else $('#reply_status_form').removeClass('ready');
|
||||
}
|
||||
else {
|
||||
if($('#reply_status_form .poll_days').is(":valid") && $('#reply_status_form .poll_hours').is(":valid") && $('#reply_status_form .poll_mins').is(":valid")) {
|
||||
if(is_ready) $('#reply_status_form').addClass('ready');
|
||||
else $('#reply_status_form').removeClass('ready');
|
||||
}
|
||||
else $('#reply_status_form').addClass('ready');
|
||||
}
|
||||
});
|
||||
$(document).on('click','#reply_status_form .status_CW', function(e) {
|
||||
$('#reply_status_form .status_spoiler').toggleClass('invisible');
|
||||
});
|
||||
$(document).on('click','#reply_status_form .status_poll', function(e) {
|
||||
$('#reply_status_form .status_poll_editor').toggleClass('invisible');
|
||||
$('#reply_status_form .status_media_attachment').toggleClass('disabled');
|
||||
$('#reply_status_form textarea').keyup();
|
||||
});
|
||||
$(document).on('click','#reply_status_form .expand_privacy_menu_button', function(e) {
|
||||
$('#reply_status_form .expand_privacy_menu').removeClass('invisible');
|
||||
});
|
||||
|
@ -1672,6 +1757,7 @@ $('#reply_status_form .expand_privacy_menu').addClass('invisible');
|
|||
$(document).on('change','#reply_status_media_atta', function(e) {
|
||||
$('#reply_status_form .media_attachments_preview_area').empty();
|
||||
$('#reply_status_form .status_textarea .media_attachments_preview_area').removeClass('invisible');
|
||||
$('#reply_status_form .status_poll').addClass('disabled');
|
||||
for ( let i = 0, f; f = e.target.files[i]; i++ ) {
|
||||
let reader= new FileReader();
|
||||
reader.readAsDataURL(f);
|
||||
|
@ -1693,7 +1779,7 @@ $('#reply_status_form').addClass('ready');
|
|||
$('#reply_status_form .status_textarea').addClass('disallow_select');
|
||||
$('#reply_status_form .character_count').html('<i class="fa fa-circle-o-notch fa-spin" aria-hidden="true"></i>');
|
||||
let form = document.forms.reply_status_form;
|
||||
if ( !$('#reply_status_media_atta')[0].files.length ) {
|
||||
if(!$('#reply_status_media_atta')[0].files.length || !$('#reply_status_form .status_poll_editor').hasClass("invisible")) {
|
||||
const params = {
|
||||
status : form.status_textarea.value,
|
||||
sensitive: form.status_nsfw.checked,
|
||||
|
@ -1701,10 +1787,22 @@ spoiler_text : form.status_spoiler.value,
|
|||
visibility : form.privacy_option.value,
|
||||
in_reply_to_id : $('#reply_status_form').attr('sid')
|
||||
}
|
||||
if(!$('#reply_status_form .status_poll_editor').hasClass("invisible")) {
|
||||
params.poll = new Object;
|
||||
params.poll.options = new Array;
|
||||
for(var i=0;i < $('#reply_status_form .poll_field').length;i++) {
|
||||
if($('#reply_status_form .poll_field').eq(i).val().length > 0) params.poll.options.push($('#reply_status_form .poll_field').eq(i).val());
|
||||
}
|
||||
if(params.poll.options.length > 0) {
|
||||
params.poll.expires_in = $('#reply_status_form .poll_days').val()*86400+$('#reply_status_form .poll_hours').val()*3600+$('#reply_status_form .poll_mins').val()*60;
|
||||
if($('#reply_status_form .poll_multiple_choice')[0].checked) params.poll.multiple = "On";
|
||||
}
|
||||
}
|
||||
api.post("statuses", params, function (data) {
|
||||
$('#reply_status_form .media_attachments_preview_area').empty();
|
||||
$('#reply_status_form .status_spoiler').addClass('invisible');
|
||||
$('#reply_status_form .status_textarea .media_attachments_preview_area').addClass('invisible');
|
||||
$('#reply_status_form .status_poll').removeClass('disabled');
|
||||
form.reset();
|
||||
$('#reply_status_form').removeClass('ready');
|
||||
$('#reply_status_form .status_textarea').removeClass('disallow_select');
|
||||
|
@ -1738,6 +1836,7 @@ api.post("statuses", params, function (data) {
|
|||
$('#reply_status_form .media_attachments_preview_area').empty();
|
||||
$('#reply_status_form .status_spoiler').addClass('invisible');
|
||||
$('#reply_status_form .status_textarea .media_attachments_preview_area').addClass('invisible');
|
||||
$('#reply_status_form .status_poll').removeClass('disabled');
|
||||
form.reset();
|
||||
$('#reply_status_form').removeClass('ready');
|
||||
$('#reply_status_form .status_textarea').removeClass('disallow_select');
|
||||
|
@ -1831,28 +1930,45 @@ replace_emoji();
|
|||
});
|
||||
return false;
|
||||
});
|
||||
$(document).on('change keyup','#single_reply_status_form textarea, #single_reply_status_form .status_spoiler', function(e) {
|
||||
$(document).on('change keyup','#single_reply_status_form textarea,#single_reply_status_form .status_spoiler,#single_reply_status_form .poll_days,#single_reply_status_form .poll_hours,#single_reply_status_form .poll_mins', function(e) {
|
||||
var is_ready;
|
||||
if(e.keyCode !== 224 & e.keyCode !== 17) {
|
||||
const textCount = $('#single_reply_status_form textarea').val().length + $('#single_reply_status_form .status_spoiler').val().length;
|
||||
let textLen = ( current_instance_charlimit - textCount );
|
||||
if ( textLen <= -1 ) {
|
||||
$('#single_reply_status_form .character_count').addClass('red');
|
||||
$('#single_reply_status_form').addClass('ready');
|
||||
} else if ( textLen === current_instance_charlimit ) {
|
||||
$('#single_reply_status_form').addClass('ready');
|
||||
} else {
|
||||
$('#single_reply_status_form .character_count').removeClass('red');
|
||||
$('#single_reply_status_form').removeClass('ready');
|
||||
}
|
||||
if(e.key == ":") {
|
||||
replace_emoji_textarea(this);
|
||||
}
|
||||
const textCount = $('#single_reply_status_form textarea').val().length + $('#single_reply_status_form .status_spoiler').val().length;
|
||||
let textLen = ( current_instance_charlimit - textCount );
|
||||
if(textLen <= -1) {
|
||||
$('#single_reply_status_form .character_count').addClass('red');
|
||||
is_ready = true;
|
||||
} else if(textLen === current_instance_charlimit) {
|
||||
is_ready = true;
|
||||
} else {
|
||||
$('#single_reply_status_form .character_count').removeClass('red');
|
||||
is_ready = false;
|
||||
}
|
||||
$('#single_reply_status_form .character_count').text(textLen);
|
||||
}
|
||||
if($('#single_reply_status_form .status_poll_editor').hasClass("invisible")) {
|
||||
if(is_ready) $('#single_reply_status_form').addClass('ready');
|
||||
else $('#single_reply_status_form').removeClass('ready');
|
||||
}
|
||||
else {
|
||||
if($('#single_reply_status_form .poll_days').is(":valid") && $('#single_reply_status_form .poll_hours').is(":valid") && $('#single_reply_status_form .poll_mins').is(":valid")) {
|
||||
if(is_ready) $('#single_reply_status_form').addClass('ready');
|
||||
else $('#single_reply_status_form').removeClass('ready');
|
||||
}
|
||||
else $('#single_reply_status_form').addClass('ready');
|
||||
}
|
||||
});
|
||||
$(document).on('click','#single_reply_status_form .status_CW', function(e) {
|
||||
$('#single_reply_status_form .status_spoiler').toggleClass('invisible');
|
||||
});
|
||||
$(document).on('click','#single_reply_status_form .status_poll', function(e) {
|
||||
$('#single_reply_status_form .status_poll_editor').toggleClass('invisible');
|
||||
$('#single_reply_status_form .status_media_attachment').toggleClass('disabled');
|
||||
$('#single_reply_status_form textarea').keyup();
|
||||
});
|
||||
$(document).on('click','#single_reply_status_form .expand_privacy_menu_button', function(e) {
|
||||
$('#single_reply_status_form .expand_privacy_menu').removeClass('invisible');
|
||||
});
|
||||
|
@ -1864,6 +1980,7 @@ $('#single_reply_status_form .expand_privacy_menu').addClass('invisible');
|
|||
$(document).on('change','#single_reply_status_media_atta', function(e) {
|
||||
$('#single_reply_status_form .media_attachments_preview_area').empty();
|
||||
$('#single_reply_status_form .status_textarea .media_attachments_preview_area').removeClass('invisible');
|
||||
$('#single_reply_status_form .status_poll').addClass('disabled');
|
||||
for ( let i = 0, f; f = e.target.files[i]; i++ ) {
|
||||
let reader= new FileReader();
|
||||
reader.readAsDataURL(f);
|
||||
|
@ -1885,7 +2002,7 @@ $('#single_reply_status_form').addClass('ready');
|
|||
$('#single_reply_status_form .status_textarea').addClass('disallow_select');
|
||||
$('#single_reply_status_form .character_count').html('<i class="fa fa-circle-o-notch fa-spin" aria-hidden="true"></i>');
|
||||
let form = document.forms.single_reply_status_form;
|
||||
if ( !$('#single_reply_status_media_atta')[0].files.length ) {
|
||||
if(!$('#single_reply_status_media_atta')[0].files.length || !$('#single_reply_status_form .status_poll_editor').hasClass("invisible")) {
|
||||
const params = {
|
||||
status : form.status_textarea.value,
|
||||
sensitive: form.status_nsfw.checked,
|
||||
|
@ -1893,10 +2010,22 @@ spoiler_text : form.status_spoiler.value,
|
|||
visibility : form.privacy_option.value,
|
||||
in_reply_to_id : $('#single_reply_status_form').attr('tid')
|
||||
}
|
||||
if(!$('#single_reply_status_form .status_poll_editor').hasClass("invisible")) {
|
||||
params.poll = new Object;
|
||||
params.poll.options = new Array;
|
||||
for(var i=0;i < $('#single_reply_status_form .poll_field').length;i++) {
|
||||
if($('#single_reply_status_form .poll_field').eq(i).val().length > 0) params.poll.options.push($('#single_reply_status_form .poll_field').eq(i).val());
|
||||
}
|
||||
if(params.poll.options.length > 0) {
|
||||
params.poll.expires_in = $('#single_reply_status_form .poll_days').val()*86400+$('#single_reply_status_form .poll_hours').val()*3600+$('#single_reply_status_form .poll_mins').val()*60;
|
||||
if($('#single_reply_status_form .poll_multiple_choice')[0].checked) params.poll.multiple = "On";
|
||||
}
|
||||
}
|
||||
api.post("statuses", params, function (data) {
|
||||
$('#single_reply_status_form .media_attachments_preview_area').empty();
|
||||
$('#single_reply_status_form .status_spoiler').addClass('invisible');
|
||||
$('#single_reply_status_form .status_textarea .media_attachments_preview_area').addClass('invisible');
|
||||
$('#single_reply_status_form .status_poll').removeClass('disabled');
|
||||
form.reset();
|
||||
$('#single_reply_status_form').removeClass('ready');
|
||||
$('#single_reply_status_form .status_textarea').removeClass('disallow_select');
|
||||
|
@ -1934,6 +2063,7 @@ api.post("statuses", params, function (data) {
|
|||
$('#single_reply_status_form .media_attachments_preview_area').empty();
|
||||
$('#single_reply_status_form .status_spoiler').addClass('invisible');
|
||||
$('#single_reply_status_form .status_textarea .media_attachments_preview_area').addClass('invisible');
|
||||
$('#single_reply_status_form .status_poll').removeClass('disabled');
|
||||
form.reset();
|
||||
$('#single_reply_status_form').removeClass('ready');
|
||||
$('#single_reply_status_form .status_textarea').removeClass('disallow_select');
|
||||
|
@ -2161,6 +2291,31 @@ if($(".media_detail").attr("cid") == JSON.parse($(".media_detail").attr("picture
|
|||
$(".media_detail .media_backward").fadeIn();
|
||||
$(".media_detail .media_box img").attr("src",JSON.parse($(".media_detail").attr("pictures"))[$(".media_detail").attr("cid")]);
|
||||
});
|
||||
$(document).on("keyup",".status_poll_editor .poll_time input",function() {
|
||||
console.log("checked");
|
||||
if($(this).is(":invalid")) $(this).parent().addClass("redborder");
|
||||
else $(this).parent().removeClass("redborder");
|
||||
});
|
||||
$(document).on("click",".poll_vote_option,.poll_vote_label,.poll_vote",function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
$(document).on('click','.poll_vote',function(e) {
|
||||
var poll_id = $(this).parent().data('poll');
|
||||
var poll_random = $(this).parent().data('random');
|
||||
if(poll_id !== null) {
|
||||
let poll_options = new Array;
|
||||
$('#poll_'+poll_id+'_'+poll_random+' input[name="poll_'+poll_id+'"]').each(function(i) {
|
||||
if($(this).is(":checked")) poll_options.push(i);
|
||||
});
|
||||
if(poll_options.length != 0) {
|
||||
api.post('polls/'+poll_id+'/votes',{choices:poll_options},function(data) {
|
||||
$(".poll_"+poll_id).after(poll_template(data));
|
||||
$(".poll_"+poll_id).remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
shortcut.add("n",function() {
|
||||
$("#creat_status").click();
|
||||
},{
|
||||
|
|
|
@ -173,7 +173,7 @@ type: "POST",
|
|||
data: postData,
|
||||
headers: requestHeaders,
|
||||
success: function(data, textStatus) {
|
||||
if(endpoint == "statuses") {
|
||||
if(endpoint == "statuses" && data.visibility != "direct") {
|
||||
$(".js_current_toots_count").html(++localStorage.current_statuses_count);
|
||||
}
|
||||
else if(endpoint.indexOf("/follow") != -1) {
|
||||
|
@ -244,9 +244,6 @@ url: apiBase + endpoint,
|
|||
type: "DELETE",
|
||||
headers: {"Authorization": "Bearer " + config.api_user_token},
|
||||
success: function(data, textStatus) {
|
||||
if(endpoint.indexOf("statuses") != -1) {
|
||||
$(".js_current_toots_count").html(--localStorage.current_statuses_count);
|
||||
}
|
||||
console.log("Successful DELETE API request to " +apiBase+endpoint);
|
||||
callback(data,textStatus)
|
||||
},
|
||||
|
|
|
@ -1 +1 @@
|
|||
2.2.5
|
||||
2.3.0
|
||||
|
|
|
@ -9,6 +9,23 @@
|
|||
<div class="status_textarea">
|
||||
<textarea class="emoji_poss" name="status_textarea" placeholder="<?=_('What\'s happening?')?>"></textarea>
|
||||
<div class="media_attachments_preview_area invisible"></div>
|
||||
<div class="status_poll_editor invisible">
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<div style="height:32px;display:inline-block;padding-top:10px"><?=_("Expires in")?> </div>
|
||||
<div style="float:right;margin-right:5px"><div class="poll_time"><input type="number" min="0" max="7" placeholder="0-7" class="poll_days"><?=_('Days')?></div>
|
||||
<div class="poll_time"><input type="number" min="0" max="24" placeholder="0-24" class="poll_hours"><?=_('Hours')?></div>
|
||||
<div class="poll_time"><input type="number" min="0" max="60" placeholder="0-60" class="poll_mins"><?=_('Minutes')?></div></div><br/>
|
||||
<div class="switch poll_mc_switch">
|
||||
<input type="checkbox" class="poll_multiple_choice">
|
||||
<div class="switch-btn">
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
<?=_("Multiple choice")?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="status_bottom invisible">
|
||||
|
@ -38,6 +55,9 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label for="header_status_poll" class="status_poll status_option_button">
|
||||
<i class="fa fa-pie-chart" aria-hidden="true"></i>
|
||||
</label>
|
||||
<label for="header_status_emoji" class="status_emoji status_option_button">
|
||||
<i class="fa fa-smile-o" aria-hidden="true"></i>
|
||||
</label>
|
||||
|
|
|
@ -10,6 +10,23 @@
|
|||
<div class="status_textarea">
|
||||
<textarea class="emoji_poss" name="status_textarea" placeholder="What's happening?"></textarea>
|
||||
<div class="media_attachments_preview_area invisible"></div>
|
||||
<div class="status_poll_editor invisible">
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<div style="height:32px;display:inline-block;padding-top:10px"><?=_("Expires in")?> </div>
|
||||
<div style="float:right;margin-right:5px"><div class="poll_time"><input type="number" min="0" max="7" placeholder="0-7" class="poll_days"><?=_('Days')?></div>
|
||||
<div class="poll_time"><input type="number" min="0" max="24" placeholder="0-24" class="poll_hours"><?=_('Hours')?></div>
|
||||
<div class="poll_time"><input type="number" min="0" max="60" placeholder="0-60" class="poll_mins"><?=_('Minutes')?></div></div><br/>
|
||||
<div class="switch poll_mc_switch">
|
||||
<input type="checkbox" class="poll_multiple_choice">
|
||||
<div class="switch-btn">
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
<?=_("Multiple choice")?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="status_bottom">
|
||||
|
@ -39,6 +56,9 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label for="overlay_status_poll" class="status_poll status_option_button">
|
||||
<i class="fa fa-pie-chart" aria-hidden="true"></i>
|
||||
</label>
|
||||
<label for="overlay_status_emoji" class="status_emoji status_option_button">
|
||||
<i class="fa fa-smile-o" aria-hidden="true"></i>
|
||||
</label>
|
||||
|
|
|
@ -11,6 +11,23 @@
|
|||
<div class="status_textarea">
|
||||
<textarea class="emoji_poss" name="status_textarea" placeholder="<?=_('What\'s happening?')?>"></textarea>
|
||||
<div class="media_attachments_preview_area invisible"></div>
|
||||
<div class="status_poll_editor invisible">
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<i class="fa fa-circle-o"></i> <input name="options[]" type="text" class="disallow_enter textfield poll_field" maxlength="25"><br/>
|
||||
<div style="height:32px;display:inline-block;padding-top:10px"><?=_("Expires in")?> </div>
|
||||
<div style="float:right;margin-right:5px"><div class="poll_time"><input type="number" min="0" max="7" placeholder="0-7" class="poll_days"><?=_('Days')?></div>
|
||||
<div class="poll_time"><input type="number" min="0" max="24" placeholder="0-24" class="poll_hours"><?=_('Hours')?></div>
|
||||
<div class="poll_time"><input type="number" min="0" max="60" placeholder="0-60" class="poll_mins"><?=_('Minutes')?></div></div><br/>
|
||||
<div class="switch poll_mc_switch">
|
||||
<input type="checkbox" class="poll_multiple_choice">
|
||||
<div class="switch-btn">
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
<?=_("Multiple choice")?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="status_bottom">
|
||||
|
@ -40,6 +57,9 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label for="single_reply_status_poll" class="status_poll status_option_button">
|
||||
<i class="fa fa-pie-chart" aria-hidden="true"></i>
|
||||
</label>
|
||||
<label for="single_reply_status_emoji" class="status_emoji status_option_button">
|
||||
<i class="fa fa-smile-o" aria-hidden="true"></i>
|
||||
</label>
|
||||
|
|
Loading…
Reference in New Issue