From 8d1394f54a7794309371c994a719ecaf6b3bc3bd Mon Sep 17 00:00:00 2001 From: nipos Date: Fri, 30 Aug 2019 16:58:17 +0200 Subject: [PATCH] Fixed login,fixed YouPlay/Invidious embeds,fixed empty image placeholder when audio available,improved status template code --- README.md | 1 + assets/css/style.css | 3 + assets/js/halcyon/halcyonFunctions.js | 145 ++- assets/js/halcyon/halcyonTemplates.js | 1574 ++----------------------- login/auth.php | 2 +- user.php | 2 +- version.txt | 2 +- 7 files changed, 246 insertions(+), 1483 deletions(-) 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 = `
`; +function checkStatusLinks(text) { +$(text).find("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) text += embedMedia("youtube",ytcom[2]); +else if(htcom) text += embedMedia("youtube",htcom[2]); +else if(ivcom) text += embedMedia("youtube",ivcom[2]); +else if(ytbe) text += embedMedia("youtube",ytbe[2]); +else if(htbe) text += embedMedia("youtube",htbe[2]); +else if(vimeo) text += embedMedia("vimeo",vimeo[2]); +else if(peertube) text += embedMedia("peertube",peertube[0].replace("/watch/","/embed/")); +}); +return text; +} +function embedMedia(source,watchid) { +let media_views = `
`; if(source == "youtube" && server_setting_youplay == true && localStorage.setting_play_youplay == "true") { media_views += (`
`); } -else if( source == "youtube" && localStorage.setting_play_invidious == "true") { +else if(source == "youtube" && localStorage.setting_play_invidious == "true") { media_views += (`
@@ -519,8 +521,8 @@ media_views += (`
`); } media_views += "
"; -if($(media_views).children().length != 0) element.append(media_views); -} +if($(media_views).children().length != 0) return media_views; +else return ""; } function enableAutoComplete(textarea) { if(localStorage.setting_compose_autocomplete == "true") { @@ -567,3 +569,102 @@ else if(short_handle[1].length > 10) short = false; else short = false; return short; } +function prepareStatus(status) { +if(status.reblog === null) { +status.halcyon = new Object(); +for(i=0;i"); +} +status.account.display_name = htmlEscape(status.account.display_name); +for(var i=0;i"); +} +for(var i=0;i", +status.halcyonarticle_option = "content_warning"; +} +else if(status.spoiler_text && localStorage.setting_show_content_warning == "true") +status.halcyon.alert_text = ""+status.spoiler_text+""; +if(!status.replies_count) status.replies_count = ""; +if(!status.reblogs_count) status.reblogs_count = ""; +if(!status.favourites_count) status.favourites_count = ""; +if(status.media_attachments.length) status.halcyon.media_views = mediaattachments_template(status); +if(status.poll) status.halcyon.poll_object = poll_template(status.poll); +if(status.card) status.halcyon.preview_object = link_preview_template(status.card); +if(status.account.display_name.length == 0) status.account.display_name = status.account.username; +status.halcyon.checked_public = ""; +status.halcyon.checked_unlisted = ""; +status.halcyon.checked_private = ""; +status.halcyon.checked_direct = ""; +switch(status.visibility) { +case "public":status.halcyon.privacy_mode=__("Public");status.halcyon.privacy_icon="globe";status.halcyon.checked_public=" checked";break; +case "unlisted":status.halcyon.privacy_mode=__("Unlisted");status.halcyon.privacy_icon="unlock-alt";status.halcyon.checked_unlisted=" checked";break; +case "private":status.halcyon.privacy_mode=__("Followers-only");status.halcyon.privacy_icon="lock";status.halcyon.checked_private=" checked";break; +case "direct":status.halcyon.privacy_mode=__("Direct");status.halcyon.privacy_icon="envelope";status.halcyon.checked_direct=" checked";break; +} +if(status.halcyon.privacy_icon == "globe" || status.halcyon.privacy_icon == "unlock-alt") { +status.halcyon.footer_width = " style='width:320px'"; +status.halcyon.reblog_button = (`
+ +
`); +} +else { +status.halcyon.footer_width = ""; +status.halcyon.reblog_button = ""; +} +if(status.account.acct == current_acct) { +status.halcyon.own_toot_buttons = (`
  • ${__('Delete Toot')}
  • `); +if(status.pinned == true) status.halcyon.own_toot_buttons += (`
  • ${__('Unpin Toot')}
  • `); +else status.halcyon.own_toot_buttons += (`
  • ${__('Pin Toot')}
  • `); +} +else { +status.halcyon.own_toot_buttons = (`
  • ${__('Mute')} @${status.account.username}
  • +
  • ${__('Block')} @${status.account.username}
  • +
  • ${__('Add to list')} @${status.account.username}
  • +
  • ${__('Report this Toot')}
  • `); +} +status.halcyon.account_state_icons = ""; +if(status.account.locked == true) status.halcyon.account_state_icons += " "; +if(status.account.bot == true) status.halcyon.account_state_icons += " "; +status.content = checkStatusLinks(status.content); +return status; +} +else { +status.reblog = prepareStatus(status.reblog); +status.halcyon = new Object(); +status.account.display_name = htmlEscape(status.account.display_name); +for(i=0;i"); +} +if(status.account.acct.indexOf("@") == -1) status.halcyon.account_link = "/@"+status.account.acct+"@"+current_instance+"?mid="+status.account.id; +else status.halcyon.account_link = "/@"+status.account.acct+"?mid="+status.account.id; +if(status.account.display_name.length == 0) status.account.display_name = status.account.username; +} +return status; +} diff --git a/assets/js/halcyon/halcyonTemplates.js b/assets/js/halcyon/halcyonTemplates.js index 62ff98d..c7c3564 100644 --- a/assets/js/halcyon/halcyonTemplates.js +++ b/assets/js/halcyon/halcyonTemplates.js @@ -68,6 +68,7 @@ media_embeds.push(` if(status.media_attachments[0].type === "video" && localStorage.setting_play_video != "false" && dsplength == 1) border = ' style="border:0;border-radius:0"'; 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"; +if(media_embeds.length > 0) { media_views = `
    `; if(media_embeds.length < 3) { for(let i in media_embeds) { @@ -85,6 +86,8 @@ else media_views += media_embeds[i]; media_views += "
    "; } 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", -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 += " "; +else status = prepareStatus(status); const html=$(`
  • +${header_note}
    - +
    @@ -285,14 +194,14 @@ const html=$(`
    @@ -302,7 +211,7 @@ ${status.account.display_name}
    -
    -${alart_text} +
    +${status.halcyon.alert_text} ${status.content} -${preview_object} +${status.halcyon.preview_object}
    -
    +
    -${toot_reblog_button} +${status.halcyon.reblog_button}
  • `); -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", -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 = $(` -
  • - -
    - -
    - -
    -
    -
    -
    - -
    - - -
    -
    -
    -${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", -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')} -
    -
    - -
    - -
    -
    -
    -
    - -
    - - -
    -
    -
    -${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 `); 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
    @@ -778,12 +321,12 @@ html = (`
    @@ -797,287 +340,22 @@ ${NotificationObj.status.account.display_name} `); return $(html); } -} else if ( NotificationObj.type === 'mention' ) { -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 = ""; -preview_object = ""; -for(i=0;i"); -} -NotificationObj.status.account.display_name = htmlEscape(NotificationObj.status.account.display_name); -for(i=0;i"); -} -for(var i=0;i", -article_option = "content_warning"; -} -else if(NotificationObj.status.spoiler_text && localStorage.setting_show_content_warning == "true") { -alart_text = ""+NotificationObj.status.spoiler_text+""; -} -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.card) { -preview_object = link_preview_template(NotificationObj.status.card); -} -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 = (`
    - -
    `); -} -else { -toot_footer_width = ""; -toot_reblog_button = ""; -} -var own_toot_buttons = ""; -if(NotificationObj.status.account.acct == current_acct) { -var own_toot_buttons = (`
  • ${__('Delete Toot')}
  • `); -if(NotificationObj.status.pinned == true) { -own_toot_buttons += (`
  • ${__('Unpin Toot')}
  • `); -} -else { -own_toot_buttons += (`
  • ${__('Pin Toot')}
  • `); -} -} -else { -var own_toot_buttons = (`
  • ${__('Mute')} @${NotificationObj.status.account.username}
  • -
  • ${__('Block')} @${NotificationObj.status.account.username}
  • -
  • ${__('Add to list')} @${NotificationObj.status.account.username}
  • -
  • ${__('Report this Toot')}
  • `); -} -var account_state_icons = ""; -if(NotificationObj.status.account.locked == true) account_state_icons += " "; -if(NotificationObj.status.account.bot == true) account_state_icons += " "; -const html=$(` -
  • -
    - -
    - -
    -
    -
    -
    - -
    - - -
    -
    -
    -${alart_text} - -${NotificationObj.status.content} - -${preview_object} -
    -
    -
    - -
    -${toot_reblog_button} -
    - -
    -
    - -
    -
    -
    -
    -
  • `); -html.find(".toot_article").append(media_views); -html.find(".toot_article").append(poll_object); -return html -} 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 = ""; -preview_object = ""; -for(i=0;i"); -} -NotificationObj.status.account.display_name = htmlEscape(NotificationObj.status.account.display_name); -for(i=0;i"); -} -for(var i=0;i", -article_option = "content_warning"; -} -else if(NotificationObj.status.spoiler_text && localStorage.setting_show_content_warning == "true") { -alart_text = ""+NotificationObj.status.spoiler_text+""; -} -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.card) { -preview_object = link_preview_template(NotificationObj.status.card); -} -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 = (`
    - -
    `); -} -else { -toot_footer_width = ""; -toot_reblog_button = ""; -} -var own_toot_buttons = ""; -if(NotificationObj.status.account.acct == current_acct) { -var own_toot_buttons = (`
  • ${__('Delete Toot')}
  • `); -if(NotificationObj.status.pinned == true) { -own_toot_buttons += (`
  • ${__('Unpin Toot')}
  • `); -} -else { -own_toot_buttons += (`
  • ${__('Pin Toot')}
  • `); -} -} -else { -var own_toot_buttons = (`
  • ${__('Mute')} @${NotificationObj.status.account.username}
  • -
  • ${__('Block')} @${NotificationObj.status.account.username}
  • -
  • ${__('Add to list')} @${NotificationObj.status.account.username}
  • -
  • ${__('Report this Toot')}
  • `); -} -var account_state_icons = ""; -if(NotificationObj.status.account.locked == true) account_state_icons += " "; -if(NotificationObj.status.account.bot == true) account_state_icons += " "; -const html=$(` -
  • -
    +else if(NotificationObj.type === 'mention' || NotificationObj.type === 'poll') { +NotificationObj.status = prepareStatus(NotificationObj.status); +var poll_notify = ""; +if(NotificationObj.type === 'poll') { +poll_notify = (` +
    `); +} +const html=$(` +
  • +${poll_notify}
    - +
    @@ -1085,14 +363,14 @@ ${__('A poll you participated in has ended')}
    @@ -1102,7 +380,7 @@ ${NotificationObj.status.account.display_name}
    -
    -${alart_text} +
    +${NotificationObj.status.halcyon.alert_text} ${NotificationObj.status.content} -${preview_object} +${NotificationObj.status.halcyon.preview_object}
    -
    +
    -${toot_reblog_button} +${NotificationObj.status.halcyon.reblog_button}
  • `); -html.find(".toot_article").append(media_views); -html.find(".toot_article").append(poll_object); -return html +html.find(".toot_article").append(NotificationObj.status.halcyon.media_views); +html.find(".toot_article").append(NotificationObj.status.halcyon.poll_object); +return html; } else if(NotificationObj.type === 'follow') { const html=(`
  • @@ -1207,111 +485,8 @@ html = html.replace(new RegExp('class="emojione"',"g"),'class=emoji'); return $(html); } function status_template(status, class_options) { -if ( status.reblog === null ) { -var status_account_link; -if(status.account.acct.indexOf("@") == -1) status_account_link = "/@"+status.account.acct+"@"+current_instance+"?mid="+status.account.id; -else status_account_link = "/@"+status.account.acct+"?mid="+status.account.id; -const status_datetime= getConversionedDate(null, status.created_at), -status_attr_datetime = getConversionedDate(null, status.created_at); -let alart_text= "", -article_option= "", -toot_replies_count = "", -toot_reblogs_count= "", -toot_favourites_count = "", -media_views = "", -poll_object = ""; -preview_object = ""; -for(i=0;i"); -} -status.account.display_name = htmlEscape(status.account.display_name); -for(i=0;i"); -} -for(var i=0;i", -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; -} -checked_public = ""; -checked_unlisted = ""; -checked_private = ""; -checked_direct = ""; -switch(status.visibility) { -case "public":toot_privacy_mode=__("Public");toot_privacy_icon="globe";checked_public=" checked";break; -case "unlisted":toot_privacy_mode=__("Unlisted");toot_privacy_icon="unlock-alt";checked_unlisted=" checked";break; -case "private":toot_privacy_mode=__("Followers-only");toot_privacy_icon="lock";checked_private=" checked";break; -case "direct":toot_privacy_mode=__("Direct");toot_privacy_icon="envelope";checked_direct=" checked";break; -} -if(toot_privacy_icon == "globe" || toot_privacy_icon == "unlock-alt") { -toot_footer_width = " style='width:320px'"; -toot_reblog_button = (`
    - -
    `); -} -else { -toot_footer_width = ""; -toot_reblog_button = ""; -} -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 += " "; +if(status.reblog !== null) status = status.reblog; +status = prepareStatus(status); const html=$(`
    @@ -1319,12 +494,12 @@ const html=$(`
    - + ${status.account.display_name} -@${status.account.acct}${account_state_icons} +@${status.account.acct}${status.halcyon.account_state_icons}
    @@ -1334,7 +509,7 @@ ${status.account.display_name}
    -
    -${alart_text} +
    +${status.halcyon.alert_text} ${status.content} -${preview_object} +${status.halcyon.preview_object}
    - +
    -