View state of ongoing polls,Fix some links,fix search for urls,add Chinese translation,update media API
|
@ -1,4 +1,4 @@
|
||||||
config.ini
|
config.ini
|
||||||
.ftpconfig
|
.ftpconfig
|
||||||
data/
|
data/
|
||||||
|
.htpasswd
|
Before Width: | Height: | Size: 434 KiB After Width: | Height: | Size: 434 KiB |
Before Width: | Height: | Size: 361 KiB After Width: | Height: | Size: 361 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 70 B After Width: | Height: | Size: 70 B |
Before Width: | Height: | Size: 70 B After Width: | Height: | Size: 70 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
@ -234,10 +234,10 @@ api.get("instance",function(data) {
|
||||||
if(!data.max_toot_chars) data.max_toot_chars = 500;
|
if(!data.max_toot_chars) data.max_toot_chars = 500;
|
||||||
if(!data.poll_limits) {
|
if(!data.poll_limits) {
|
||||||
data.poll_limits = new Object();
|
data.poll_limits = new Object();
|
||||||
data.poll_limits.max_options = 4;
|
data.poll_limits.max_options = 4;
|
||||||
data.poll_limits.max_option_chars = 25;
|
data.poll_limits.max_option_chars = 25;
|
||||||
data.poll_limits.min_expiration = 300;
|
data.poll_limits.min_expiration = 300;
|
||||||
data.poll_limits.max_expiration = 2629746;
|
data.poll_limits.max_expiration = 2629746;
|
||||||
}
|
}
|
||||||
localStorage.setItem("current_instance_charlimit",data.max_toot_chars);
|
localStorage.setItem("current_instance_charlimit",data.max_toot_chars);
|
||||||
current_instance_charlimit = data.max_toot_chars;
|
current_instance_charlimit = data.max_toot_chars;
|
||||||
|
@ -460,7 +460,7 @@ ctx.fillText("😗",-2,4);
|
||||||
return ctx.getImageData(0,0,1,1).data[3] > 0;
|
return ctx.getImageData(0,0,1,1).data[3] > 0;
|
||||||
}
|
}
|
||||||
function openStatus(link) {
|
function openStatus(link) {
|
||||||
api.search("q="+encodeURIComponent(link),function(response) {
|
api.search("q="+encodeURIComponent(link)+"&resolve=true",function(response) {
|
||||||
if(response.statuses.length > 0) {
|
if(response.statuses.length > 0) {
|
||||||
var data = response.statuses[0];
|
var data = response.statuses[0];
|
||||||
if(data.account.acct.indexOf("@") == -1) {
|
if(data.account.acct.indexOf("@") == -1) {
|
||||||
|
|
|
@ -131,8 +131,9 @@ 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.getUTCMinutes() > 1) expires_string = expires_at.getUTCMinutes()+" "+__("minutes");
|
||||||
else if(expires_at.getUTCSeconds() == 1) expires_string = "1 "+__("second");
|
else if(expires_at.getUTCSeconds() == 1) expires_string = "1 "+__("second");
|
||||||
else expires_string = expires_at.getUTCSeconds()+" "+__("seconds");
|
else expires_string = expires_at.getUTCSeconds()+" "+__("seconds");
|
||||||
if(poll.voted || poll.expired) {
|
const poll_random = Math.round(Math.random()*1000);
|
||||||
poll_html = (`<div class="poll_box">`);
|
if(poll.voted || poll.expired || poll.seeresult) {
|
||||||
|
poll_html = (`<div class="poll_box poll_${poll.id}" data-poll="${poll.id}" data-random="${poll_random}" id="poll_${poll.id}_${poll_random}">`);
|
||||||
optionsort = [...poll.options];
|
optionsort = [...poll.options];
|
||||||
optionsort.sort(function(a,b) {return a.votes_count - b.votes_count});
|
optionsort.sort(function(a,b) {return a.votes_count - b.votes_count});
|
||||||
optionsort.reverse();
|
optionsort.reverse();
|
||||||
|
@ -143,11 +144,11 @@ 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>
|
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>`);
|
<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>`);
|
if(poll.expired) poll_html += (`<br/><span class="poll_footer">${poll.votes_count} ${__("votes")} • ${__("Final results")} • <a href="javascript:void(0)" class="poll_refresh">${__("Refresh")}</a></span></span>`);
|
||||||
else poll_html += (`<br/><span class="poll_footer">${poll.votes_count} ${__("votes")} • ${expires_string} ${__("left")}</span>`);
|
else if(poll.seeresult) poll_html += (`<br/><span class="poll_footer">${poll.votes_count} ${__("votes")} • ${expires_string} ${__("left")} • <a href="javascript:void(0)" class="poll_refresh">${__("Back")}</a></span>`);
|
||||||
|
else poll_html += (`<br/><span class="poll_footer">${poll.votes_count} ${__("votes")} • ${expires_string} ${__("left")} • <a href="javascript:void(0)" class="poll_refresh">${__("Refresh")}</a></span>`);
|
||||||
}
|
}
|
||||||
else {
|
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}">`);
|
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++) {
|
for(var i=0;i<poll.options.length;i++) {
|
||||||
if(poll.multiple) {
|
if(poll.multiple) {
|
||||||
|
@ -160,7 +161,7 @@ poll_html += (`<div class="radiobox"><input type="radio" id="poll_${poll.id}_${p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
poll_html += (`<button class="halcyon_button poll_vote"><span>${__("Vote")}</span></button>
|
poll_html += (`<button class="halcyon_button poll_vote"><span>${__("Vote")}</span></button>
|
||||||
${poll.votes_count} ${__("votes")} • ${expires_string} ${__("left")}`);
|
${poll.votes_count} ${__("votes")} • ${expires_string} ${__("left")} • <a href="javascript:void(0)" class="poll_show_result">${__("Show results")}</a>`);
|
||||||
}
|
}
|
||||||
poll_html += (`</div>`);
|
poll_html += (`</div>`);
|
||||||
return poll_html;
|
return poll_html;
|
||||||
|
@ -289,7 +290,7 @@ const html = (`
|
||||||
<section class="toot_content">
|
<section class="toot_content">
|
||||||
<header class="toot_header">
|
<header class="toot_header">
|
||||||
<div class="text_ellipsis">
|
<div class="text_ellipsis">
|
||||||
<a href="${NotificationObj.status.halcyon.author_link}">
|
<a href="${NotificationObj.status.halcyon.account_link}">
|
||||||
<span class="displayname emoji_poss">
|
<span class="displayname emoji_poss">
|
||||||
${NotificationObj.status.account.display_name}
|
${NotificationObj.status.account.display_name}
|
||||||
</span>
|
</span>
|
||||||
|
@ -327,7 +328,7 @@ html = (`
|
||||||
<section class="toot_content">
|
<section class="toot_content">
|
||||||
<header class="toot_header">
|
<header class="toot_header">
|
||||||
<div class="text_ellipsis">
|
<div class="text_ellipsis">
|
||||||
<a href="${NotificationObj.status.halcyon.author_link}">
|
<a href="${NotificationObj.status.halcyon.account_link}">
|
||||||
<span class="displayname emoji_poss">
|
<span class="displayname emoji_poss">
|
||||||
${NotificationObj.status.account.display_name}
|
${NotificationObj.status.account.display_name}
|
||||||
</span>
|
</span>
|
||||||
|
@ -366,7 +367,7 @@ const html = (`
|
||||||
<section class="toot_content">
|
<section class="toot_content">
|
||||||
<header class="toot_header">
|
<header class="toot_header">
|
||||||
<div class="text_ellipsis">
|
<div class="text_ellipsis">
|
||||||
<a href="${NotificationObj.status.halcyon.author_link}">
|
<a href="${NotificationObj.status.halcyon.account_link}">
|
||||||
<span class="displayname emoji_poss">
|
<span class="displayname emoji_poss">
|
||||||
${NotificationObj.status.account.display_name}
|
${NotificationObj.status.account.display_name}
|
||||||
</span>
|
</span>
|
||||||
|
@ -474,7 +475,7 @@ html.find(".toot_article").append(NotificationObj.status.halcyon.poll_object);
|
||||||
return html;
|
return html;
|
||||||
} else if(NotificationObj.type === 'follow') {
|
} else if(NotificationObj.type === 'follow') {
|
||||||
const html=(`
|
const html=(`
|
||||||
<li sid="${NotificationObj.id}" class="notice_entry fol toot_entry">
|
<li class="notice_entry fol toot_entry">
|
||||||
<div class="notice_author_box">
|
<div class="notice_author_box">
|
||||||
<a href="${notice_author_link}">
|
<a href="${notice_author_link}">
|
||||||
<div class="icon_box">
|
<div class="icon_box">
|
||||||
|
|
|
@ -1316,7 +1316,7 @@ $(document).on('click','.player',function(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
$(document).on('click','.toot_entry', function(e) {
|
$(document).on('click','.toot_entry', function(e) {
|
||||||
setOverlayStatus($(this).attr('sid'));
|
if($(this).attr('sid')) setOverlayStatus($(this).attr('sid'));
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
function setOverlayMedia(sid,mediacount) {
|
function setOverlayMedia(sid,mediacount) {
|
||||||
|
@ -2298,6 +2298,29 @@ $(".poll_"+poll_id).remove();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
$(document).on('click','.poll_show_result',function(e) {
|
||||||
|
var poll_id = $(this).parent().data('poll');
|
||||||
|
var poll_random = $(this).parent().data('random');
|
||||||
|
if(poll_id !== null && poll_random !== null) {
|
||||||
|
api.get('polls/'+poll_id,function(data) {
|
||||||
|
data.seeresult = true;
|
||||||
|
$("#poll_"+poll_id+"_"+poll_random).after(poll_template(data));
|
||||||
|
$("#poll_"+poll_id+"_"+poll_random).remove();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$(document).on('click','.poll_refresh',function(e) {
|
||||||
|
var poll_id = $(this).parent().parent().data('poll');
|
||||||
|
var poll_random = $(this).parent().parent().data('random');
|
||||||
|
if(poll_id !== null && poll_random !== null) {
|
||||||
|
api.get('polls/'+poll_id,function(data) {
|
||||||
|
$("#poll_"+poll_id+"_"+poll_random).after(poll_template(data));
|
||||||
|
$("#poll_"+poll_id+"_"+poll_random).remove();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
$(document).on('click','.link_preview',function(e) {
|
$(document).on('click','.link_preview',function(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const ytcom = $(this).data("url").match(/https?:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z\d_-]+)/);
|
const ytcom = $(this).data("url").match(/https?:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z\d_-]+)/);
|
||||||
|
|
|
@ -218,14 +218,14 @@ postData = arguments[1];
|
||||||
callback = arguments[2];
|
callback = arguments[2];
|
||||||
}
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: apiBase + endpoint,
|
url: config.instance + "/api/v2/" + endpoint,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
data: postData,
|
data: postData,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
processData: false,
|
processData: false,
|
||||||
headers: {"Authorization": "Bearer " + config.api_user_token},
|
headers: {"Authorization": "Bearer " + config.api_user_token},
|
||||||
success: function(data, textStatus) {
|
success: function(data, textStatus) {
|
||||||
console.log("Successful POST API request to " +apiBase+endpoint);
|
console.log("Successful POST API request to " +config.instance + "/api/v2/"+endpoint);
|
||||||
callback(data,textStatus)
|
callback(data,textStatus)
|
||||||
},
|
},
|
||||||
error: function(xhr, textStatus, errorThrown) {
|
error: function(xhr, textStatus, errorThrown) {
|
||||||
|
|
|
@ -19,15 +19,15 @@ url_unshortener = true
|
||||||
youplay = true
|
youplay = true
|
||||||
vimeo = true
|
vimeo = true
|
||||||
youplay_fallback = true
|
youplay_fallback = true
|
||||||
invidious = invidiou.sh
|
invidious = invidious.snopyta.org
|
||||||
nitter = nitter.13ad.de
|
nitter = nitter.13ad.de
|
||||||
bibliogram = bibliogram.dsrev.ru
|
bibliogram = bibliogram.ggc-project.de
|
||||||
|
|
||||||
; The proxy can be used optionally to resolve data for privacy-friendly media embeds on the server side - It is not used for Mastodon API requests on login
|
; The proxy can be used optionally to resolve data for privacy-friendly media embeds on the server side - It is not used for Mastodon API requests on login
|
||||||
; Proxy type can be set to none, socks5, socks4, http or https - Example settings for locally installed Tor client
|
; Proxy type can be set to none, socks5, socks4, http or https
|
||||||
[Proxy]
|
[Proxy]
|
||||||
type = socks5
|
type = none
|
||||||
domain = 127.0.0.1
|
domain =
|
||||||
port = 9050
|
port =
|
||||||
username =
|
username =
|
||||||
password =
|
password =
|
||||||
|
|