diff --git a/README.md b/README.md
index 51d3e09..1d39bd4 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,7 @@ We moved our instances list to our webpage: https://www.halcyon.social/instances
or read our new documentation pages to install it manually: https://www.halcyon.social/documentation.php?page=install
## Blog
+- Release of Version 2.4.3 - Fixed login,fixed YouPlay/Invidious embeds,fixed empty image placeholder when audio available,improved status template code
- Release of Version 2.4.2 - Many bugfixes,add trending hashtags,add URL unshortener,redirect YouTube to Invidious,translation improvements,add Spanish translation
- Release of Version 2.4.1 - Improve French and German translation,respect Pleromas/GlitchSocs custom poll limits,add extension download link,many bugfixes
- We published the new Halcyon Share Extension at [Firefox Addons](https://addons.mozilla.org/en-US/firefox/addon/halcyon-share/) and [NotABug](https://notabug.org/halcyon-suite/halcyon-share)
diff --git a/assets/css/style.css b/assets/css/style.css
index 2171162..1f985d1 100644
--- a/assets/css/style.css
+++ b/assets/css/style.css
@@ -176,6 +176,9 @@ border-radius: 5px;
overflow: hidden;
margin-left: 14px;
}
+#autoCompleteDropDown .label_box {
+width:200px;
+}
#header_status_form .status_main,#reply_status_form .status_main,#header_status_form .status_top,#reply_status_form .status_top {
width: calc( 100% - 54px );
margin-left: 54px;
diff --git a/assets/js/halcyon/halcyonFunctions.js b/assets/js/halcyon/halcyonFunctions.js
index e4cfb25..65d5dcb 100644
--- a/assets/js/halcyon/halcyonFunctions.js
+++ b/assets/js/halcyon/halcyonFunctions.js
@@ -96,22 +96,6 @@ $(".toot_article a,.profile_bio a,.follows_profile_bio a").filter("[data-random=
});
}
});
-$(".toot_article a").each(function(i) {
-const ytcom = $(this).attr('href').match(/https?:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z\d_-]+)/);
-const htcom = $(this).attr('href').match(/https?:\/\/(www\.)?hooktube\.com\/watch\?v=([a-zA-Z\d_-]+)/);
-const ivcom = $(this).attr('href').match(/https?:\/\/(www\.)?invidio\.us\/watch\?v=([a-zA-Z\d_-]+)/);
-const ytbe = $(this).attr('href').match(/https?:\/\/(www\.)?youtu\.be\/([a-zA-Z\d_-]+)/);
-const htbe = $(this).attr('href').match(/https?:\/\/(www\.)?hooktube\.com\/([a-zA-Z\d_-]+)/);
-const vimeo = $(this).attr('href').match(/https?:\/\/(www\.)?vimeo\.com\/([\d]+)/);
-const peertube = $(this).attr('href').match(/https?:\/\/.+..+\/videos\/watch\/([\da-z]{8}-[\da-z]{4}-[\da-z]{4}-[\da-z]{4}-[\da-z]{12})\/?$/);
-if(ytcom) embedMedia("youtube",$(this).closest(".toot_article"),ytcom[2]);
-else if(htcom) embedMedia("youtube",$(this).closest(".toot_article"),htcom[2]);
-else if(ivcom) embedMedia("youtube",$(this).closest(".toot_article"),ivcom[2]);
-else if(ytbe) embedMedia("youtube",$(this).closest(".toot_article"),ytbe[2]);
-else if(htbe) embedMedia("youtube",$(this).closest(".toot_article"),htbe[2]);
-else if(vimeo) embedMedia("vimeo",$(this).closest(".toot_article"),vimeo[2]);
-else if(peertube) embedMedia("peertube",$(this).closest(".toot_article"),peertube[0].replace("/watch/","/embed/"));
-});
}
function getConversionedDate(key, value) {
if (value === null ||
@@ -491,16 +475,34 @@ $('.overlay_redirect_invidious').data("video",video);
$('.overlay_redirect_invidious').removeClass('invisible');
}
}
-function embedMedia(source,element,watchid) {
-if(element.children(".media_views").length == 0) {
-let media_views = `
";
+}
+else media_views = "";
var media_view = $("");
media_view.append(media_views);
if(status.sensitive && localStorage.setting_show_nsfw == "false") media_view.find(".media_attachment").addClass("sensitive");
@@ -95,14 +98,6 @@ return media_view;
}
function link_preview_template(card) {
if(localStorage.setting_link_previews == "true") {
-const ytcom = card.url.match(/https?:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z\d_-]+)/);
-const htcom = card.url.match(/https?:\/\/(www\.)?hooktube\.com\/watch\?v=([a-zA-Z\d_-]+)/);
-const ivcom = card.url.match(/https?:\/\/(www\.)?invidio\.us\/watch\?v=([a-zA-Z\d_-]+)/);
-const ytbe = card.url.match(/https?:\/\/(www\.)?youtu\.be\/([a-zA-Z\d_-]+)/);
-const htbe = card.url.match(/https?:\/\/(www\.)?hooktube\.com\/([a-zA-Z\d_-]+)/);
-const vimeo = card.url.match(/https?:\/\/(www\.)?vimeo\.com\/([\d]+)/);
-const peertube = card.url.match(/https?:\/\/.+..+\/videos\/watch\/([\da-z]{8}-[\da-z]{4}-[\da-z]{4}-[\da-z]{4}-[\da-z]{12})\/?$/);
-if(((!ytcom && !htcom && !ivcom && !ytbe && !htbe) || (localStorage.setting_play_youplay == "false" && localStorage.setting_play_invidious == "false")) && (!vimeo || localStorage.setting_play_vimeo) && (!peertube || localStorage.setting_play_peertube)) {
var randattr = "";
if(server_setting_unshorten && checkURLshortener(card.url)) {
var linkrand = Math.round(Math.random()*1000000);
@@ -122,8 +117,6 @@ return preview_html;
}
else return "";
}
-else return "";
-}
function poll_template(poll) {
let poll_html = "";
var expires_at = new Date(new Date(poll.expires_at).getTime()-Date.now());
@@ -172,112 +165,28 @@ ${poll.votes_count} ${__("votes")} • ${expires_string} ${__("left")}`);
poll_html += (`
`);
return poll_html;
}
-function timeline_template(status) {
-if (status.reblog === null) {
-for(i=0;i");
-}
-status.account.display_name = htmlEscape(status.account.display_name);
-for(var i=0;i");
-}
-for(var i=0;i"+status.spoiler_text+"",
-article_option = "content_warning";
-}
-else if(status.spoiler_text && localStorage.setting_show_content_warning == "true") {
-alart_text = ""+status.spoiler_text+"";
-}
-if(status.replies_count) {
-toot_replies_count = status.replies_count;
-}
-if (status.reblogs_count) {
-toot_reblogs_count = status.reblogs_count;
-}
-if (status.favourites_count) {
-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.card) {
-preview_object = link_preview_template(status.card);
-}
-if(status.account.display_name.length == 0) {
-status.account.display_name = status.account.username;
-}
-switch(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 = (`
-
+function timeline_template(status,is_pinned=false) {
+var header_note = "";
+if(is_pinned) {
+header_note = (`
+${__('Pinned Toot')}
`);
}
-else {
-toot_footer_width = "";
-toot_reblog_button = "";
+if(status.reblog !== null) {
+restatus = prepareStatus(status);
+status = restatus.reblog;
+header_note = (`
`);
}
-var own_toot_buttons = "";
-if(status.account.acct == current_acct) {
-var own_toot_buttons = (`
${__('Delete Toot')}`);
-if(status.pinned == true) {
-own_toot_buttons += (`
${__('Unpin Toot')}`);
-}
-else {
-own_toot_buttons += (`
${__('Pin Toot')}`);
-}
-}
-else {
-var own_toot_buttons = (`
${__('Mute')} @${status.account.username}
-
${__('Block')} @${status.account.username}
-
${__('Add to list')} @${status.account.username}
-
${__('Report this Toot')}`);
-}
-var account_state_icons = "";
-if(status.account.locked == true) account_state_icons += "
";
-if(status.account.bot == true) account_state_icons += "
![](/assets/images/robot.svg)
";
+else status = prepareStatus(status);
const html=$(`
+${header_note}
`);
-html.find(".toot_article").append(media_views);
-html.find(".toot_article").append(poll_object);
-return html
-} else {
-for(i=0;i
");
-}
-status.account.display_name = htmlEscape(status.account.display_name);
-for(i=0;i");
-}
-status.reblog.account.display_name = htmlEscape(status.reblog.account.display_name);
-for(i=0;i");
-}
-for(var i=0;i"+status.reblog.spoiler_text+"",
-article_option = "content_warning";
-}
-else if(status.reblog.spoiler_text && localStorage.setting_show_content_warning == "true") {
-alart_text = ""+status.reblog.spoiler_text+"";
-}
-if(status.reblog.replies_count) {
-toot_replies_count = status.reblog.replies_count;
-}
-if (status.reblog.reblogs_count) {
-toot_reblogs_count = status.reblog.reblogs_count;
-}
-if (status.reblog.favourites_count) {
-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.reblog.card) {
-preview_object = link_preview_template(status.reblog.card);
-}
-if(status.account.display_name.length == 0) {
-status.account.display_name = status.account.username;
-}
-if(status.reblog.account.display_name.length == 0) {
-status.reblog.account.display_name = status.reblog.account.username;
-}
-switch(status.reblog.visibility) {
-case "public":toot_privacy_mode=__("Public");toot_privacy_icon="globe";break;
-case "unlisted":toot_privacy_mode=__("Unlisted");toot_privacy_icon="unlock-alt";break;
-}
-var own_toot_buttons = "";
-if(status.reblog.account.acct == current_acct) {
-var own_toot_buttons = (`${__('Delete Toot')}`);
-if(status.reblog.pinned == true) {
-own_toot_buttons += (`${__('Unpin Toot')}`);
-}
-else {
-own_toot_buttons += (`${__('Pin Toot')}`);
-}
-}
-else {
-var own_toot_buttons = (`${__('Mute')} @${status.reblog.account.username}
-${__('Block')} @${status.reblog.account.username}
-${__('Add to list')} @${status.reblog.account.username}
-${__('Report this Toot')}`);
-}
-var account_state_icons = "";
-if(status.reblog.account.locked == true) account_state_icons += " ";
-if(status.reblog.account.bot == true) account_state_icons += "
";
-const html = $(`
-
-
-
-
-
-
![](${status.reblog.account.avatar})
-
-
-
-
-
-${alart_text}
-
-${status.reblog.content}
-
-${preview_object}
-
-
-
-
-`);
-html.find(".toot_article").append(media_views);
-html.find(".toot_article").append(poll_object);
-return html
-}
-}
-function timeline_pinned_template(status) {
-for(i=0;i");
-}
-status.account.display_name = htmlEscape(status.account.display_name);
-for(i=0;i");
-}
-for(var i=0;i"+status.spoiler_text+"",
-article_option = "content_warning";
-}
-else if(status.spoiler_text && localStorage.setting_show_content_warning == "true") {
-alart_text = ""+status.spoiler_text+"";
-}
-if(status.replies_count) {
-toot_replies_count = status.replies_count;
-}
-if (status.reblogs_count) {
-toot_reblogs_count = status.reblogs_count;
-}
-if (status.favourites_count) {
-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.card) {
-preview_object = link_preview_template(status.card);
-}
-if(status.account.display_name.length == 0) {
-status.account.display_name = status.account.username;
-}
-switch(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;
-}
-var own_toot_buttons = "";
-if(status.account.acct == current_acct) {
-var own_toot_buttons = (`${__('Delete Toot')}
-${__('Unpin Toot')}`);
-}
-else {
-var own_toot_buttons = (`${__('Mute')} @${status.account.username}
-${__('Block')} @${status.account.username}
-${__('Add to list')} @${status.account.username}
-${__('Report this Toot')}`);
-}
-var account_state_icons = "";
-if(status.account.locked == true) account_state_icons += " ";
-if(status.account.bot == true) account_state_icons += "
";
-const html = $(`
-
-
-${__('Pinned Toot')}
-
-
-
-
-
![](${status.account.avatar})
-
-
-
-
-
-${alart_text}
-
-${status.content}
-
-${preview_object}
-
-
-
-
-`);
-html.find(".toot_article").append(media_views);
-html.find(".toot_article").append(poll_object);
-return html
+html.find(".toot_article").append(status.halcyon.media_views);
+html.find(".toot_article").append(status.halcyon.poll_object);
+return html;
}
function notifications_template(NotificationObj) {
var notice_author_link;
@@ -689,27 +264,8 @@ NotificationObj.account.display_name = htmlEscape(NotificationObj.account.displa
for(i=0;i");
}
-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;
-const toot_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, NotificationObj.status.created_at)),
-toot_attr_datetime = getConversionedDate(null, NotificationObj.status.created_at);
-if( NotificationObj.type=='favourite' ){
-for(i=0;i");
-}
-NotificationObj.status.account.display_name = htmlEscape(NotificationObj.status.account.display_name);
-for(i=0;i");
-}
-for(var i=0;i";
-if(NotificationObj.status.account.bot == true) account_state_icons += "
";
+if(NotificationObj.type === 'favourite') {
+NotificationObj.status = prepareStatus(NotificationObj.status);
const html = (`
@@ -727,12 +283,12 @@ const html = (`
`);
return $(html);
-} else if ( NotificationObj.type === 'reblog' ) {
-for(i=0;i");
}
-NotificationObj.status.account.display_name = htmlEscape(NotificationObj.status.account.display_name);
-for(i=0;i");
-}
-for(var i=0;i";
-if(NotificationObj.status.account.bot == true) account_state_icons += "
";
+else if(NotificationObj.type === 'reblog') {
+NotificationObj.status = prepareStatus(NotificationObj.status);
html = (`
@@ -778,12 +321,12 @@ html = (`