Compare commits

...

14 Commits

Author SHA1 Message Date
nipos dfdfccc044 Update version and readme 2020-07-22 16:17:59 +00:00
nipos 82ae0882d1 View state of ongoing polls,Fix some links,fix search for urls,add Chinese translation,update media API 2020-07-22 16:11:54 +00:00
nipos eabad44fea Add support for bookmarks,add support for announcements,add support for emoji reactions 2020-03-29 20:17:40 +02:00
nipos aadcb94355 Repair emoji autocomplete,repair YouPlay,improve Invidious embed,change Vinayaka instance,add Bibliogram and NoFB redirects 2020-02-09 19:26:29 +01:00
nipos 6ffa5dab2f Replace some removed Mastodon APIs,fix Toot button not locking on CTRL+Enter,make navbar a bit more responsive 2019-12-23 14:58:06 +01:00
nipos 875c3e0b17 Support for emoji categories,added links to admin panel,rewrite links to Invidious and Nitter at compose,bugfixes 2019-10-13 18:34:02 +02:00
nipos d120e6438c Option to rewrite all Twitter links to Nitter,click on animated GIF works like image now,full height for images option now works for animated GIF 2019-09-21 17:13:45 +02:00
nipos 660e6c46e6 Critical bugfix: Some statuses cause Javascript errors and prevent the timeline from further rendering 2019-09-07 15:35:12 +02:00
nipos 8d1394f54a Fixed login,fixed YouPlay/Invidious embeds,fixed empty image placeholder when audio available,improved status template code 2019-08-30 16:58:17 +02:00
nipos 045d6f74c5 Many bugfixes,add trending hashtags,add URL unshortener,redirect YouTube to Invidious,translation improvements,add Spanish translation 2019-08-21 18:25:27 +02:00
nipos 3b87814f98 Improve French and German translation,respect Pleromas/GlitchSocs custom poll limits,add extension download link,many bugfixes 2019-07-17 17:52:20 +02:00
Niklas Poslovski af6e3d416f Merge branch 'master' of butterflyoffire/halcyon into master 2019-07-15 10:52:05 +00:00
ButterflyOfFire 99602df380 Updating french translation .mo
Updating french translation .mo compiled via Weblate.
2019-07-15 10:48:51 +00:00
ButterflyOfFire bd6d478739 Updating french translation 2019-07-15 10:48:17 +00:00
214 changed files with 5565 additions and 2050 deletions

2
.gitignore vendored Normal file → Executable file
View File

@ -1,4 +1,4 @@
config.ini
.ftpconfig
data/
.htpasswd

4
.htaccess Normal file → Executable file
View File

@ -31,6 +31,10 @@ RewriteRule ^federated/?$ federated\.php [NC,L]
RewriteBase /notifications
RewriteRule ^notifications/?$ notifications\.php [NC,L]
# Bookmarks
RewriteBase /bookmarks
RewriteRule ^bookmarks/?$ bookmarks\.php [NC,L]
# Who to follow
RewriteBase /whotofollow
RewriteRule ^whotofollow/?$ who_to_follow\.php [NC,L]

0
404.php Normal file → Executable file
View File

6
Caddyfile Normal file → Executable file
View File

@ -67,6 +67,12 @@ halcyon.domain.tld {
r ^/notifications/?$
to /notifications.php
}
# Bookmarks
rewrite {
r ^/bookmarks/?$
to /bookmarks.php
}
# Who to follow
rewrite {

0
LICENSE Normal file → Executable file
View File

10
README.md Normal file → Executable file
View File

@ -28,6 +28,16 @@ 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.9 - View state of ongoing polls,Fix some links,fix search for urls,add Chinese translation,update media API
- Release of Version 2.4.8 - Add support for bookmarks,add support for announcements,add support for emoji reactions
- Release of Version 2.4.7 - Repair emoji autocomplete,repair YouPlay,improve Invidious embed,change Vinayaka instance,add Bibliogram and NoFB redirects
- Release of Version 2.4.6 - Replace some removed Mastodon APIs,fix Toot button not locking on CTRL+Enter,make navbar a bit more responsive
- Release of Version 2.4.5 - Support for emoji categories,added links to admin panel,rewrite links to Invidious and Nitter at compose,bugfixes
- Release of Version 2.4.4 - Option to rewrite all Twitter links to Nitter,click on animated GIF works like image now,full height for images option now works for animated GIF
- 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)
- Release of Version 2.4.0 - Share links to Halcyon,preview overlays for mentions and more (blog article coming soon)
- Release of Version 2.3.4 - Introduce BlurHash,repair YouPlay,improve link previews feature,add debug mode,add lighttpd example config,bug fixes
- Release of Version 2.3.3 - New media uploader,sort uploads,drag&drop and copy&paste uploads,fix automatic dark mode

0
assets/css/404.css Normal file → Executable file
View File

0
assets/css/cookieconsent.min.css vendored Normal file → Executable file
View File

34
assets/css/dark.css Normal file → Executable file
View File

@ -587,7 +587,7 @@ border-bottom:0 solid #E6ECF0;
background-color:#189EFC;
color:#fff;
}
.toot_entry .toot_entry_body .toot_content .toot_article a,#main .article_wrap .left_column .profile_section_wrap > .profile_bio a {
.toot_entry .toot_entry_body .toot_content .toot_article a,#main .article_wrap .left_column .profile_section_wrap > .profile_bio a,.announcement .announcement_content .announcement_text a {
color:#189EFC;
}
.toot_entry .toot_entry_body .toot_content .toot_reaction button,.toot_detail .toot_footer .toot_reaction button {
@ -690,3 +690,35 @@ color:#189EFC;
background-color:#189EFC;
color:#1B2836;
}
.announcement {
background-color:#243447;
border:1px solid #000;
}
.announcement_icon {
color:#AAB8C2;
}
.announcement_text {
color:#EEE;
}
.emoreact {
border:1px solid #189EFC;
}
.emoreact .emoreact_count {
color:#189EFC;
}
.emoreact.active,
.emoreact:hover {
background-color:#189EFC;
}
.emoreact.active .emoreact_count,
.emoreact:hover .emoreact_count {
color:#FFFFFF;
}
.emoreact_add {
border:1px solid #189EFC;
color:#189EFC;
}
.emoreact_add:hover {
background-color:#189EFC;
color:#FFFFFF;
}

9
assets/css/emojipicker.css Normal file → Executable file
View File

@ -5,6 +5,12 @@ width: 33px;
height: 35px;
cursor: pointer;
}
.lsx-emojipicker-emoji p {
font-size:12px;
color:#66757F;
text-align:center;
border-bottom:1px solid #E6ECF0;
}
.lsx-emojipicker-appender {
position: relative;
}
@ -20,6 +26,7 @@ transition: all 0.5s ease-in-out;
-webkit-transition: all 0.5s ease-in-out;
display: none;
font-family:"apple color emoji","segoe ui emoji",notocoloremoji,"segoe ui symbol","android emoji",emojisymbols,"emojione mozilla";
color:initial;
}
ul.lsx-emojipicker-tabs {
margin: 0;
@ -42,7 +49,7 @@ ul.lsx-emojipicker-tabs li:HOVER {
border-bottom: 3px solid #189EFC;
}
.lsx-emojipicker-tabs img.emoji {
margin: 5px 10px;
margin: 0;
cursor: pointer;
}
.lsx-emojipicker-tabs img.emoji:HOVER,

0
assets/css/fontawesome.min.css vendored Normal file → Executable file
View File

0
assets/css/sharebox.css Normal file → Executable file
View File

0
assets/css/sharebox_dark.css Normal file → Executable file
View File

179
assets/css/style.css Normal file → Executable file
View File

@ -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;
@ -333,6 +336,11 @@ outline:0;
.poll_time input:invalid {
box-shadow:none;
}
.poll_time_warning {
width:100%;
text-align:center;
color:#FF0000;
}
.poll_mc_switch {
margin:0 !important;
display:inline-block;
@ -574,10 +582,10 @@ font-weight: 300;
.single_reply_status .status_preview,.report_status .status_preview {
border-top: 1px solid #E1E8ED;
}
.single_reply_status .status_preview .toot_entry .toot_footer,.report_stauts .status_preview .toot_entry .toot_footer {
.single_reply_status .status_preview .toot_entry .toot_footer,.report_status .status_preview .toot_entry .toot_footer {
display: none!important;
}
.single_reply_status .status_preview .toot_entry .link_preview,.report_stauts .status_preview .toot_entry .link_preview {
.single_reply_status .status_preview .toot_entry .link_preview,.report_status .status_preview .toot_entry .link_preview {
display: none!important;
}
.single_reply_status .status_form .status_bottom,.report_status .status_form .status_bottom {
@ -850,7 +858,7 @@ border-radius: 3px;
box-sizing: border-box;
background-color: #fff;
box-shadow: 0.5px 0.5px 3px rgba(0,0,0,0.26);
z-index: 1;
z-index: 9;
}
.toot_entry .toot_entry_body .toot_content .toot_header .expand_button_wrap .expand_menu::before {
display: block;
@ -907,7 +915,9 @@ font-size: 14px;
line-height: 20px;
margin-top: 4px;
}
.toot_entry .toot_entry_body .toot_content .toot_article a,.halcyon_link {
.toot_entry .toot_entry_body .toot_content .toot_article a,
.announcement .announcement_content .announcement_text a,
.halcyon_link {
color: #2588D0;
}
.toot_entry .toot_entry_body .toot_content .toot_article.content_warning .status_content {
@ -917,7 +927,7 @@ display: none;
display: flex;
flex-wrap: nowrap;
align-items: center;
width: 240px;
width: 320px;
height: 21px;
margin-top: 8px;
}
@ -948,18 +958,22 @@ font-weight: 600;
.toot_entry .toot_entry_body .toot_content .toot_reaction .reply_button:hover {
color: #1DA1F2;
}
.toot_entry .toot_entry_body .toot_content .toot_reaction .boost_button[reblogged="null"]:hover,
.toot_entry .toot_entry_body .toot_content .toot_reaction .boost_button[reblogged="false"]:hover,
.toot_entry .toot_entry_body .toot_content .toot_reaction .boost_button[reblogged="true"],
.toot_entry .toot_entry_body .toot_content .toot_reaction .boost_button[reblogged="null"]:hover .reaction_count,
.toot_entry .toot_entry_body .toot_content .toot_reaction .boost_button[reblogged="false"]:hover .reaction_count,
.toot_entry .toot_entry_body .toot_content .toot_reaction .boost_button[reblogged="true"] .reaction_count {
color: #17BF63;
}
.toot_entry .toot_entry_body .toot_content .toot_reaction .fav_button[favourited="null"]:hover,
.toot_entry .toot_entry_body .toot_content .toot_reaction .fav_button[favourited="false"]:hover,
.toot_entry .toot_entry_body .toot_content .toot_reaction .fav_button[favourited="true"],
.toot_entry .toot_entry_body .toot_content .toot_reaction .fav_button[favourited="null"]:hover .reaction_count,
.toot_entry .toot_entry_body .toot_content .toot_reaction .fav_button[favourited="false"]:hover .reaction_count,
.toot_entry .toot_entry_body .toot_content .toot_reaction .fav_button[favourited="true"] .reaction_count {
color: #FFAD1A;
}
.toot_entry .toot_entry_body .toot_content .toot_reaction .bookmark_button[bookmarked="false"]:hover,
.toot_entry .toot_entry_body .toot_content .toot_reaction .bookmark_button[bookmarked="true"] {
color: #FF5050;
}
.media_views {
margin: 8px 0;
height: 336px;
@ -970,6 +984,9 @@ position: relative;
box-sizing: border-box;
border: 1px solid #DCDFE1;
}
.media_views.link_preview {
cursor:pointer;
}
.media_views.media_full_height {
height:auto;
}
@ -986,32 +1003,42 @@ object-fit: cover;
.media_views .media_attachment > iframe {
object-fit: fill;
}
.media_views.sensitive .sensitive_alart {
.media_attachment .sensitive_alert {
display:none;
}
.media_attachment.sensitive .sensitive_alert {
display: flex;
z-index: 1;
flex-direction: column;
justify-content: center;
align-items: center;
position: absolute;
position: relative;
width: 100%;
height: 100%;
top:-100%;
overflow:hidden;
background-color: #000;
background-size:cover;
background-position:center;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
.media_views.sensitive .sensitive_alart .text1 {
.media_attachment.sensitive .sensitive_alert .text1 {
font-size: 26px;
line-height:20px;
font-weight: 200;
padding: 8px 16px;
color: #fff;
}
.media_views.sensitive .sensitive_alart .text2 {
.media_attachment.sensitive .sensitive_alert .text2 {
font-size:15px;
font-weight: 200;
padding: 2px 4px;
margin-top: 3px;
color: #fff;
}
.media_attachment.sensitive iframe+.sensitive_alert {
top:calc(-100% - 7px);
}
.media_views[media_length="2"] {
display: flex;
}
@ -1091,6 +1118,15 @@ border: 1px solid #E6ECF0;
border-radius: 5px;
padding: 8px 12px;
}
.timeline .notice_entry .notice_entry_body .notice_emoji {
float:left;
margin-left:-3px;
margin-right:5px;
}
.timeline .notice_entry .notice_entry_body .notice_emoji img {
height:34px;
width:unset;
}
.timeline .notice_entry .notice_entry_body .toot_header {
height: 17px;
}
@ -1127,6 +1163,9 @@ background: #17BF63;
.timeline .toot_entry .font-icon.favourite {
background: #FFAD1A;
}
.timeline .toot_entry .font-icon.reaction {
background: #FBA457;
}
.timeline .toot_entry .font-icon.poll {
background: #FF4040;
top:0;
@ -1502,9 +1541,12 @@ overflow: hidden;
margin-right: 8px;
border-radius: 5px;
}
.account_box .label_box {
.what_to_follow .account_box .label_box {
width: 200px;
}
.trending_hashtags .account_box .label_box {
width:100%;
}
.account_box .label_box h3 {
overflow: hidden;
white-space: nowrap;
@ -2511,7 +2553,7 @@ font-weight: 300;
display: flex;
flex-wrap: nowrap;
align-items: center;
width: 230px;
width: 320px;
height: 21px;
margin-top: 12px;
}
@ -2554,6 +2596,10 @@ color: #17BF63;
.toot_detail .toot_footer .toot_reaction .fav_button[favourited="true"] .reaction_count {
color: #FFAD1A;
}
.toot_detail .toot_footer .toot_reaction .bookmark_button[bookmarked="false"]:hover,
.toot_detail .toot_footer .toot_reaction .bookmark_button[bookmarked="true"] {
color: #FF5050;
}
.toot_detail .status_form {
border-top: 1px solid #E6ECF0;
border-bottom: 1px solid #E6ECF0;
@ -2575,7 +2621,8 @@ border-bottom-left-radius: 5px;
.media_detail .toot_entry .toot_entry_body {
border-bottom: none;
}
.media_detail .toot_entry .media_views {
.media_detail .toot_entry .media_views,
.media_detail .toot_entry .player {
display: none;
}
.switch {
@ -2721,6 +2768,90 @@ border:0 solid #189EFC;
border-left-width:5px;
border-right-width:5px;
}
.announcement_wrap {
display:flex;
flex-wrap:wrap;
width:1200px;
margin:auto;
margin-top:2px;
}
.announcement {
margin-left:5px;
margin-right:5px;
margin-top:10px;
width:100%;
padding:15px;
border-radius: 5px;
background-color:#fff;
border:1px solid #E6ECF0;
}
.announcement_icon {
float:left;
color:rgb(101,119,134);
}
.announcement_content {
float:left;
margin-left:10px;
width:calc(100% - 58px);
}
.announcement_text {
color:#333;
font-size:14px;
padding:5px;
}
.announcement_reactions {
float:left;
}
.announcement_date {
float:right;
}
.emoreact {
margin:3px;
padding:3px;
border-radius:3px;
border:1px solid #189EFC;
cursor:pointer;
}
.emoreact .emoji {
vertical-align:-4px;
}
.emoreact .emoreact_count {
margin-left:3px;
vertical-align:-2px;
color:#189EFC;
}
.emoreact.active,
.emoreact:hover {
background-color:#189EFC;
}
.emoreact.active .emoreact_count,
.emoreact:hover .emoreact_count {
color:#FFFFFF;
}
.emoreact_add {
margin:3px;
border-radius:3px;
border:1px solid #189EFC;
cursor:pointer;
color:#189EFC;
font-size:18px;
padding-left:5px;
padding-right:5px;
padding-top:4px;
vertical-align:-3px;
}
.emoreact_add:hover {
background-color:#189EFC;
color:#FFFFFF;
}
.emoreact_add .lsx-emojipicker-appender {
display:inline-block;
left:15px;
}
.status_reactions {
margin-left:-3px;
margin-top:5px;
}
@media(max-width:1199px) {
#main .profile_nav_wrap .profile_nav {
width:900px;
@ -2731,7 +2862,8 @@ width:590px;
#js-follows_profile {
width:600px;
}
#main .article_wrap {
#main .article_wrap,
#main .announcement {
width:900px;
}
}
@ -2968,3 +3100,16 @@ color:#FFFFFF;
.media_attachments_delete_button i{
margin:5px;
}
@media(max-width:899px) {
#header .header_nav_wrap .header_left_box ul.header_nav_list li.header_nav_item a > span,
#header .header_nav_wrap .header_right_box ul.header_nav_list li.search_form_wrap,
#header .header_nav_wrap .header_right_box ul.header_nav_list li.toot_button_wrap .toot_button_label > span {
display:none;
}
#header .header_nav_wrap .header_right_box ul.header_nav_list li.toot_button_wrap .toot_button {
width:40px;
}
#header .header_nav_wrap .header_left_box ul.header_nav_list li.header_nav_item a {
padding-right:4px;
}
}

0
assets/fonts/MIT-LICENSE.txt Normal file → Executable file
View File

0
assets/fonts/SIL-OFL-LICENSE.txt Normal file → Executable file
View File

0
assets/fonts/fontawesome.eot Normal file → Executable file
View File

0
assets/fonts/fontawesome.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 434 KiB

After

Width:  |  Height:  |  Size: 434 KiB

0
assets/fonts/fontawesome.ttf Normal file → Executable file
View File

0
assets/fonts/fontawesome.woff Normal file → Executable file
View File

0
assets/fonts/fontawesome.woff2 Normal file → Executable file
View File

0
assets/images/favicon.ico Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 361 KiB

After

Width:  |  Height:  |  Size: 361 KiB

0
assets/images/halcyon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

0
assets/images/halcyon_logo.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

0
assets/images/halcyon_w.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

0
assets/images/mastodon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

0
assets/images/mastodon.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
assets/images/missing.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 70 B

After

Width:  |  Height:  |  Size: 70 B

0
assets/images/missing_header.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 70 B

After

Width:  |  Height:  |  Size: 70 B

0
assets/images/robot.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

0
assets/images/self_auth.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

0
assets/images/self_auth_min.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

0
assets/js/autocomplete/license-textarea.txt Normal file → Executable file
View File

8
assets/js/autocomplete/search.js Normal file → Executable file
View File

@ -1,4 +1,5 @@
function searchlocalfill() {
if(current_search_history.length > 0) {
var dropdown = $("<ul>").addClass("account_list");
var searchsuggestions = new Array();
current_search_history.reverse();
@ -16,17 +17,18 @@ current_search_history.reverse();
$(".header_search_suggestions").empty().removeClass("invisible").append(dropdown);
replace_emoji();
}
}
function searchremotefill(text) {
if(text == "@") searchlocalfill();
else {
api.get("search?q="+encodeURIComponent(text)+"&resolve=false&limit=5",function(data) {
api.search("q="+encodeURIComponent(text)+"&resolve=false&limit=5",function(data) {
if(data.hashtags.length == 0 && data.accounts.length == 0) $(".header_search_suggestions").addClass("invisible");
else {
var dropdown = $("<ul>").addClass("account_list");
for(var i=0;i<data.hashtags.length;i++) {
if(i == 5) break;
dropdown.append($("<li>").data("value",data.hashtags[i]).addClass("account_box").append($("<div>").addClass("icon_box").append($("<span>").addClass("emoji_poss").html("#️⃣").css("float","left").css("font-size","32px")))
.append($("<div>").addClass("label_box").append($("<span>").addClass("dn").append($("<h3>").html("#"+data.hashtags[i])))).click(function() {
dropdown.append($("<li>").data("value",data.hashtags[i].name).addClass("account_box").append($("<div>").addClass("icon_box").append($("<span>").addClass("emoji_poss").html("#️⃣").css("float","left").css("font-size","32px")))
.append($("<div>").addClass("label_box").append($("<span>").addClass("dn").append($("<h3>").html("#"+data.hashtags[i].name)))).click(function() {
window.location.href = "/search?q="+encodeURIComponent($(this).data("value"));
}));
}

14
assets/js/autocomplete/textarea.js Normal file → Executable file
View File

@ -61,7 +61,6 @@ blurredEle && addToken(blurredEle,prepend,callback);
blurredEle = null;
getDropDown().removeClass('showDropDown').addClass('hideDropDown');
});
if(resultname) {
if(resultname == "acct") {
if(ele.display_name == "") ele.display_name = ele.username;
ele.display_name = htmlEscape(ele.display_name);
@ -72,6 +71,11 @@ $(liNode).data("value",prepend+ele[resultname]+" ");
$(liNode).addClass("account_box").append($("<div>").addClass("icon_box").append($("<img>").attr("src",ele.avatar).css("float","left")))
.append($("<div>").addClass("label_box").append($("<span>").addClass("dn").append($("<h3>").html(ele.display_name).addClass("emoji_poss"))).append($("<span>").addClass("un").html(prepend+ele.acct)));
}
else if(prepend == "#") {
$(liNode).data("value",prepend+ele[resultname]+" ");
$(liNode).addClass("account_box").append($("<div>").addClass("icon_box").append($("<span>").addClass("emoji_poss").html("#️⃣").css("float","left").css("font-size","32px")))
.append($("<div>").addClass("label_box").append($("<span>").addClass("dn").append($("<h3>").html(prepend+ele[resultname]))));
}
else {
$(liNode).data("value",prepend+ele[resultname]+": ");
if(ele.value) {
@ -83,12 +87,6 @@ $(liNode).addClass("account_box").append($("<div>").addClass("icon_box").append(
.append($("<div>").addClass("label_box").append($("<span>").addClass("dn").append($("<h3>").html(ele.name))));
}
}
}
else {
$(liNode).data("value",prepend+ele+" ");
$(liNode).addClass("account_box").append($("<div>").addClass("icon_box").append($("<span>").addClass("emoji_poss").html("#️⃣").css("float","left").css("font-size","32px")))
.append($("<div>").addClass("label_box").append($("<span>").addClass("dn").append($("<h3>").html(prepend+ele))));
}
node.append(liNode);
}
});
@ -184,7 +182,7 @@ return;
}
if(extractNewInputs(node,startKey).length > 1 && extractNewInputs(node,startKey).indexOf(endKey) == -1) {
if(config.arrayname) {
api.get("search?q="+encodeURIComponent(extractNewInputs(node,startKey))+"&resolve=false&limit=5",function(matchedData) {
api.search("q="+encodeURIComponent(extractNewInputs(node,startKey))+"&resolve=false&limit=5",function(matchedData) {
matchedData = matchedData[config.arrayname];
if(matchedData.length) {
if(hasDropDown()){

0
assets/js/autosize/LICENSE Normal file → Executable file
View File

0
assets/js/autosize/autosize.js Normal file → Executable file
View File

0
assets/js/blurhash.js Normal file → Executable file
View File

0
assets/js/clipboard.js/LICENSE Normal file → Executable file
View File

0
assets/js/clipboard.js/clipboard.min.js vendored Normal file → Executable file
View File

0
assets/js/cookieconsent/cookieconsent.min.js vendored Normal file → Executable file
View File

0
assets/js/cookieconsent/licence Normal file → Executable file
View File

0
assets/js/emojipicker/LICENSE Normal file → Executable file
View File

0
assets/js/emojipicker/emojidata.js Normal file → Executable file
View File

41
assets/js/emojipicker/emojipicker.js Normal file → Executable file
View File

@ -6,15 +6,17 @@ var settings = {};
$.fn.lsxEmojiPicker = function(options) {
if(options == "destroy") {
$(this).off("click");
$(this).children().remove();
$(this).children(".lsx-emojipicker-appender").remove();
}
else {
settings = $.extend({
width: 265,
width: 280,
height: 200,
twemoji: false,
closeOnSelect: true,
onSelect: function(em){}
customEmojis: true,
onSelect: function(em){},
onClose: function(){}
}, options);
var appender = $('<div></div>')
.addClass('lsx-emojipicker-appender');
@ -29,7 +31,7 @@ var spinner = $('<div></div>')
spinnerContainer.append(spinner);
var customemojis = JSON.parse(localStorage.current_custom_emojis);
var addhide = "";
if(customemojis.length > 0) {
if(customemojis.length > 0 && settings.customEmojis) {
addhide = " hidden";
var emojiCustomContainer = $('<div></div>')
.addClass('lsx-emojipicker-emoji lsx-emoji-tab lsx-emoji-custom')
@ -61,7 +63,7 @@ var emojiFlagsContainer = $('<div></div>')
.css({'width': settings.width, 'height': settings.height});
var tabs = $('<ul></ul>')
.addClass('lsx-emojipicker-tabs');
if(customemojis.length > 0) {
if(customemojis.length > 0 && settings.customEmojis) {
var customEmoji = $('<li></li>')
.addClass('selected')
.html("&#x2A;&#x20E3")
@ -82,7 +84,7 @@ $(this).addClass('selected');
$('.lsx-emoji-tab').addClass('hidden');
emojiPeopleContainer.removeClass('hidden');
});
if(customemojis.length == 0) {
if(customemojis.length == 0 || !settings.customEmojis) {
peopleEmoji.addClass("selected");
}
var natureEmoji = $('<li></li>')
@ -148,7 +150,7 @@ $(this).addClass('selected');
$('.lsx-emoji-tab').addClass('hidden');
emojiFlagsContainer.removeClass('hidden');
});
if(customemojis.length > 0) {
if(customemojis.length > 0 && settings.customEmojis) {
tabs.append(customEmoji);
}
tabs.append(peopleEmoji)
@ -159,7 +161,7 @@ tabs.append(peopleEmoji)
.append(objectsEmoji)
.append(symbolsEmoji)
.append(flagsEmoji);
if(customemojis.length > 0) {
if(customemojis.length > 0 && settings.customEmojis) {
createCustomEmojiTab(emojiCustomContainer,container);
}
createEmojiTab('people',emojiPeopleContainer,container);
@ -172,7 +174,7 @@ createEmojiTab('symbols',emojiSymbolsContainer,container);
createEmojiTab('flags',emojiFlagsContainer,container);
//wrapper.append(spinnerContainer);
wrapper.append(tabs);
if(customemojis.length > 0) {
if(customemojis.length > 0 && settings.customEmojis) {
wrapper.append(emojiCustomContainer);
}
wrapper.append(emojiPeopleContainer)
@ -205,6 +207,7 @@ if(!$(e.target).parent().hasClass('lsx-emojipicker-tabs')
&& !$(e.target).parent().parent().hasClass('lsx-emoji-tab')){
if(container.is(':visible')){
container.hide();
settings.onClose();
} else {
container.show();
}
@ -228,6 +231,7 @@ settings.onSelect({
});
if(settings.closeOnSelect){
wrapper.hide();
settings.onClose();
}
});
container.append(emoticon);
@ -235,24 +239,35 @@ container.append(emoticon);
}
function createCustomEmojiTab(container,wrapper) {
var customemojis = JSON.parse(localStorage.current_custom_emojis);
for(var i = 0;i < customemojis.length;i++){
var selectedEmoji = customemojis[i];
var sortedemojis = new Object();
for(var i = 0;i < customemojis.length;i++) {
if(!customemojis[i].category) customemojis[i].category = __("General");
if(!sortedemojis[customemojis[i].category]) sortedemojis[customemojis[i].category] = new Array();
sortedemojis[customemojis[i].category].push(customemojis[i]);
}
for(var category in sortedemojis) {
if(sortedemojis.hasOwnProperty(category)) {
if(Object.keys(sortedemojis).length != 1 || !sortedemojis.hasOwnProperty(__("General"))) container.append($("<p>").text(category));
for(var i=0;i < sortedemojis[category].length;i++) {
var selectedEmoji = sortedemojis[category][i];
var emoticon = $('<span></span>')
.data('value',selectedEmoji.url)
.attr('title',selectedEmoji.code)
.html($("<img>").addClass("emoji").attr("src",selectedEmoji.url));
emoticon.click(function(e){
e.preventDefault();
settings.onSelect({
'name':$(this).attr('title'),
'value':$(this).data('value')
'value':$(this).attr('title')
});
if(settings.closeOnSelect){
wrapper.hide();
settings.onClose();
}
});
container.append(emoticon);
}
}
}
}
}(jQuery, window));
}

485
assets/js/halcyon/halcyonFunctions.js Normal file → Executable file
View File

@ -34,6 +34,11 @@ txt.focus();
});
}
})(jQuery);
$.extend($.expr[':'],{
blank:function(el){
return $(el).val().match(/^\s*$/);
}
});
});
function indicesOf(input,value) {
var indices = new Array();
@ -54,8 +59,8 @@ di[re[4]] = re[3];
}
return di;
}
function replaceInternalLink(){
$(".toot_article a,.profile_bio a,.follows_profile_bio a").each(function(i) {
function replaceInternalLink() {
$(".toot_article a,.profile_bio a,.follows_profile_bio a,.announcement_text a").each(function(i) {
const pltags = $(this).attr('href').match(/https?:\/\/.+..+\/tag\/([a-zA-Z\d_%]+)\/?$/);
if(pltags) $(this).attr('target','_self').attr('href','/search?q='+pltags[1]);
const mstags = $(this).attr('href').match(/https?:\/\/.+..+\/tags\/([a-zA-Z\d_%]+)\/?$/);
@ -72,22 +77,32 @@ const gsstatus = $(this).attr('href').match(/https?:\/\/.+..+\/notice\/(\d+)\/?$
if(gsstatus) $(this).attr('target','_self').attr('href',"javascript:openStatus('"+gsstatus[0]+"');void(0)");
const plstatus = $(this).attr('href').match(/https?:\/\/.+..+\/objects\/([\da-z]{8}-[\da-z]{4}-[\da-z]{4}-[\da-z]{4}-[\da-z]{12})\/?$/);
if(plstatus) $(this).attr('target','_self').attr('href',"javascript:openStatus('"+plstatus[0]+"');void(0)");
});
$(".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_-]+)/);
if(ytcom) $(this).attr('target','_self').attr('href',"javascript:openVideo('"+ytcom[2]+"');void(0)");
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/"));
if(ytbe) $(this).attr('target','_self').attr('href',"javascript:openVideo('"+ytbe[2]+"');void(0)");
const twcom = $(this).attr('href').match(/https?:\/\/(www\.)?twitter\.com\/(.*)/);
if(twcom) $(this).attr('target','_self').attr('href',"javascript:openNitter('"+twcom[2]+"');void(0)");
const igpost = $(this).attr('href').match(/https?:\/\/(www\.)?instagram\.com\/p\/([a-zA-Z\d_-]+)/);
if(igpost) $(this).attr('target','_self').attr('href',"javascript:openBibliogram('p/"+igpost[2]+"');void(0)");
const igacc = $(this).attr('href').match(/https?:\/\/(www\.)?instagram\.com\/([a-zA-Z\d_\.]+)/);
if(igacc) $(this).attr('target','_self').attr('href',"javascript:openBibliogram('u/"+igacc[2]+"');void(0)");
const fbcom = $(this).attr('href').match(/https?:\/\/(www\.)?facebook\.com\/(.*)/);
if(fbcom) $(this).attr('target','_self').attr('href',"javascript:openNoFB('"+fbcom[2]+"');void(0)");
if(server_setting_unshorten && checkURLshortener($(this).attr('href'))) {
var linkrand = Math.round(Math.random()*1000000);
$(this).attr("data-random",linkrand);
$.ajax("/unshorten.php?url="+encodeURIComponent($(this).attr('href'))).done(function(data) {
$(".toot_article a,.profile_bio a,.follows_profile_bio a").filter("[data-random="+linkrand+"]").attr("href",data);
$(".toot_article a,.profile_bio a,.follows_profile_bio a").filter("[data-random="+linkrand+"]").children().eq(1).text(data.split("//")[0]);
link = data.replace("https://","");
link = link.replace("http://","");
if(link.length > 30) $(".toot_article a,.profile_bio a,.follows_profile_bio a").filter("[data-random="+linkrand+"]").children().eq(1).addClass("ellipsis");
else $(".toot_article a,.profile_bio a,.follows_profile_bio a").filter("[data-random="+linkrand+"]").children().eq(1).removeClass("ellipsis");
$(".toot_article a,.profile_bio a,.follows_profile_bio a").filter("[data-random="+linkrand+"]").children().eq(1).text(link.substr(0,30));
$(".toot_article a,.profile_bio a,.follows_profile_bio a").filter("[data-random="+linkrand+"]").children().eq(2).text(link.substr(30));
});
}
});
}
function getConversionedDate(key, value) {
@ -160,10 +175,10 @@ api.get("accounts/verify_credentials",function(AccountObj) {
AccountObj.display_name = htmlEscape(AccountObj.display_name);
for(var i=0;i<AccountObj.emojis.length;i++) {
AccountObj.display_name = AccountObj.display_name.replace(new RegExp(":"+AccountObj.emojis[i].shortcode+":","g"),"<img src='"+AccountObj.emojis[i].url+"' class='emoji'>");
current_filters = new Array;
}
localStorage.setItem("current_display_name",AccountObj["display_name"]);
localStorage.setItem("current_acct",AccountObj["acct"]);
localStorage.setItem("current_url","/@"+AccountObj["acct"]+"@"+current_instance+"?mid="+current_id);
localStorage.setItem("current_header",AccountObj["header"]);
localStorage.setItem("current_avatar",AccountObj["avatar"]);
localStorage.setItem("current_locked",AccountObj["locked"]);
@ -171,17 +186,14 @@ localStorage.setItem("current_statuses_count",AccountObj["statuses_count"]);
localStorage.setItem("current_following_count",AccountObj["following_count"]);
localStorage.setItem("current_followers_count",AccountObj["followers_count"]);
localStorage.setItem("current_follow_loaded","false");
localStorage.setItem("current_filters","[]");
current_display_name = localStorage.getItem("current_display_name");
current_acct = localStorage.getItem("current_acct");
current_url = localStorage.getItem("current_url");
current_header = localStorage.getItem("current_header");
current_avatar = localStorage.getItem("current_avatar");
current_locked = localStorage.getItem("current_locked");
current_statuses_count = localStorage.getItem("current_statuses_count");
current_following_count = localStorage.getItem("current_following_count");
current_followers_count = localStorage.getItem("current_followers_count");
current_filters = JSON.parse(localStorage.getItem("current_filters"));
current_search_history = JSON.parse(localStorage.getItem("current_search_history"));
setCurrentProfile();
});
@ -219,14 +231,18 @@ localStorage.setItem("current_muted_accts",JSON.stringify(mutes));
current_muted_accts = mutes;
});
api.get("instance",function(data) {
if(data.max_toot_chars) {
if(!data.max_toot_chars) data.max_toot_chars = 500;
if(!data.poll_limits) {
data.poll_limits = new Object();
data.poll_limits.max_options = 4;
data.poll_limits.max_option_chars = 25;
data.poll_limits.min_expiration = 300;
data.poll_limits.max_expiration = 2629746;
}
localStorage.setItem("current_instance_charlimit",data.max_toot_chars);
current_instance_charlimit = data.max_toot_chars;
}
else {
localStorage.setItem("current_instance_charlimit",500);
current_instance_charlimit = 500;
}
localStorage.setItem("current_instance_poll_limits",JSON.stringify(data.poll_limits));
current_instance_poll_limits = data.poll_limits;
});
api.get("custom_emojis",function(data) {
var emojis = new Array();
@ -234,6 +250,7 @@ for(i=0;i<data.length;i++) {
var emoji = new Object();
emoji.code = data[i].shortcode;
emoji.url = data[i].url;
if(data[i].category) emoji.category = data[i].category;
emojis.push(emoji);
}
localStorage.setItem("current_custom_emojis",JSON.stringify(emojis));
@ -255,7 +272,6 @@ api_user_token: authtoken
});
current_display_name = localStorage.getItem("current_display_name");
current_acct = localStorage.getItem("current_acct");
current_url = localStorage.getItem("current_url");
current_header = localStorage.getItem("current_header");
current_avatar = localStorage.getItem("current_avatar");
current_locked = localStorage.getItem("current_locked");
@ -264,6 +280,7 @@ current_following_count = localStorage.getItem("current_following_count");
current_followers_count = localStorage.getItem("current_followers_count");
current_following_accts = localStorage.getItem("current_following_accts");
current_instance_charlimit = localStorage.getItem("current_instance_charlimit");
current_instance_poll_limits = JSON.parse(localStorage.getItem("current_instance_poll_limits"));
current_blocked_accts = localStorage.getItem("current_blocked_accts");
current_muted_accts = localStorage.getItem("current_muted_accts");
current_filters = JSON.parse(localStorage.getItem("current_filters"));
@ -278,15 +295,15 @@ is_account_locked = " <i class='fa fa-lock'></i>";
}
$(".js_current_profile_displayname").html(current_display_name);
$(".js_current_profile_username").html(current_acct+is_account_locked);
$(".js_current_profile_link").attr("href", current_url);
$(".js_current_profile_link").attr("href","/@"+current_acct+"@"+current_instance+"?mid="+current_id);
$(".js_current_header_image").attr("src", current_header);
$(".js_current_profile_image").attr("src", current_avatar);
$(".js_current_toots_count").text(current_statuses_count);
$(".js_current_following_count").text(current_following_count);
$(".js_current_followers_count").text(current_followers_count);
$(".current_toots_count_link").attr("href",current_url);
$(".current_following_count_link").attr("href",current_url);
$(".current_followers_count_link").attr("href",current_url);
$(".current_toots_count_link").attr("href","/@"+current_acct+"@"+current_instance+"?mid="+current_id);
$(".current_following_count_link").attr("href","/@"+current_acct+"@"+current_instance+"/following?mid="+current_id);
$(".current_followers_count_link").attr("href","/@"+current_acct+"@"+current_instance+"/followers?mid="+current_id);
if($(window).width() < 1200) {
responsive_design = true;
$(".left_column").append($("<div>").attr("class","responsive_left").append($(".right_column").children()));
@ -308,6 +325,8 @@ localStorage.setItem("setting_desktop_notifications","false");
if(localStorage.setting_who_to_follow == "true") {
setWhoToFollow();
}
setTrendingHashtags();
if(!localStorage.hide_firefox_download || localStorage.hide_firefox_download != "true") $("#widget_ffdl").show();
replace_emoji();
}
function putMessage(Message) {
@ -388,7 +407,7 @@ setWhoToFollow();
}
}
function addFollowProfile(id,account) {
api.get('search',[{name:'q',data:"@"+account},{name:'resolve',data:'true'}], function(search) {
api.search('q='+encodeURIComponent("@"+account)+"&limit=1&resolve=true",function(search) {
search.accounts[0].display_name = htmlEscape(search.accounts[0].display_name);
for(i=0;i<search.accounts[0].emojis.length;i++) {
search.accounts[0].display_name = search.accounts[0].display_name.replace(new RegExp(":"+search.accounts[0].emojis[i].shortcode+":","g"),"<img src='"+search.accounts[0].emojis[i].url+"' class='emoji'>");
@ -408,13 +427,40 @@ $('.what_to_follow_'+id+' .label_box > .follow_button').attr('data',search.accou
follow_loaded++;
});
}
function setTrendingHashtags() {
api.get("trends",function(data) {
if(data.length == 0) $("#trends_icon").removeClass("fa-circle-o-notch").removeClass("fa-spin").addClass("fa-hashtag").addClass("fa-stack-1x").after($("<i>").addClass("fa").addClass("fa-ban").addClass("fa-stack-2x"));
else {
for(var i=0;i<5;i++) {
if(i < data.length) {
var ht_toots = 0;
var ht_users = 0;
for(var a=0;a<data[i].history.length;a++) {
ht_toots += parseInt(data[i].history[a].uses);
ht_users += parseInt(data[i].history[a].accounts);
}
$(".trending_hashtags .trending_"+i+" a").attr("href","/search?q="+data[i].name);
$(".trending_hashtags .trending_"+i+" .dn").text("#"+data[i].name);
$(".trending_hashtags .trending_"+i+" .un").text(ht_toots+" "+__("toots by")+" "+ht_users+" "+__("users"));
}
else {
$(".trending_hashtags .trending_"+i).remove();
}
}
$(".trends_loading").hide();
$(".trending_hashtags").show();
}
},function() {
$("#trends_icon").removeClass("fa-circle-o-notch").removeClass("fa-spin").addClass("fa-hashtag").addClass("fa-stack-1x").after($("<i>").addClass("fa").addClass("fa-ban").addClass("fa-stack-2x"));
});
}
function checkEmojiSupport() {
var ctx = document.createElement("canvas").getContext("2d");
ctx.fillText("😗",-2,4);
return ctx.getImageData(0,0,1,1).data[3] > 0;
}
function openStatus(link) {
api.get("search?q="+link,function(response) {
api.search("q="+encodeURIComponent(link)+"&resolve=true",function(response) {
if(response.statuses.length > 0) {
var data = response.statuses[0];
if(data.account.acct.indexOf("@") == -1) {
@ -427,19 +473,81 @@ window.location.href = "/404";
}
});
}
function embedMedia(source,element,watchid) {
if(element.children(".media_views").length == 0) {
let media_views = `<div class='media_views' sid="${element.parent().parent().parent().attr("sid")}" media_length='1' style="border:0;border-radius:0">`;
function openVideo(video) {
if(localStorage.setting_redirect_invidious == "true") window.open("https://"+server_setting_invidious+"/watch?v="+video,"_blank");
else if(localStorage.setting_redirect_invidious == "false") window.open("https://www.youtube.com/watch?v="+video,"_blank");
else {
$("#js-overlay_content_wrap .temporary_object").empty();
$('#js-overlay_content_wrap').addClass('view');
$('#js-overlay_content_wrap').addClass('black_08');
$('.overlay_redirect_invidious').data("video",video);
$('.overlay_redirect_invidious').removeClass('invisible');
}
}
function openNitter(path) {
if(localStorage.setting_redirect_nitter == "true") window.open("https://"+server_setting_nitter+"/"+path,"_blank");
else if(localStorage.setting_redirect_nitter == "false") window.open("https://twitter.com/"+path,"_blank");
else {
$("#js-overlay_content_wrap .temporary_object").empty();
$('#js-overlay_content_wrap').addClass('view');
$('#js-overlay_content_wrap').addClass('black_08');
$('.overlay_redirect_nitter').data("path",path);
$('.overlay_redirect_nitter').removeClass('invisible');
}
}
function openBibliogram(path) {
if(localStorage.setting_redirect_bibliogram == "true") window.open("https://"+server_setting_bibliogram+"/"+path,"_blank");
else if(localStorage.setting_redirect_bibliogram == "false") window.open("https://www.instagram.com/"+path,"_blank");
else {
$("#js-overlay_content_wrap .temporary_object").empty();
$('#js-overlay_content_wrap').addClass('view');
$('#js-overlay_content_wrap').addClass('black_08');
$('.overlay_redirect_bibliogram').data("path",path);
$('.overlay_redirect_bibliogram').removeClass('invisible');
}
}
function openNoFB(path) {
if(localStorage.setting_redirect_nofb == "true") window.open("https://nofb.pw/?p="+encodeURIComponent("https://www.facebook.com/"+path),"_blank");
else if(localStorage.setting_redirect_nofb == "false") window.open("https://www.facebook.com/"+path,"_blank");
else {
$("#js-overlay_content_wrap .temporary_object").empty();
$('#js-overlay_content_wrap').addClass('view');
$('#js-overlay_content_wrap').addClass('black_08');
$('.overlay_redirect_nofb').data("path",path);
$('.overlay_redirect_nofb').removeClass('invisible');
}
}
function checkStatusLinks(text) {
$("<span>"+text+"</span>").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 = `<div class='media_views' media_length='1' style="border:0;border-radius:0">`;
if(source == "youtube" && server_setting_youplay == true && localStorage.setting_play_youplay == "true") {
media_views += (`
<div class="media_attachment" otype="video/gifv" mediacount="0">
<iframe src="/media/youplay.php?id=${watchid}" frameborder="0" allowfullscreen></iframe>
</div>`);
}
else if( source == "youtube" && localStorage.setting_play_invidious == "true") {
else if(source == "youtube" && localStorage.setting_play_invidious == "true") {
media_views += (`
<div class="media_attachment" otype="video/gifv" mediacount="0">
<iframe src="https://www.invidio.us/embed/${watchid}" frameborder="0" allowfullscreen></iframe>
<iframe src="/media/invidious.php?server=${server_setting_invidious}&id=${watchid}" frameborder="0" allowfullscreen></iframe>
</div>`);
}
else if(source == "vimeo" && server_setting_vimeo == true && localStorage.setting_play_vimeo == "true") {
@ -455,19 +563,96 @@ media_views += (`
</div>`);
}
media_views += "</div>";
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") {
textarea.autoCompleteToken({instance:1,startkey:"@",endkey:" ",arrayname:"accounts",resultname:"acct"});
textarea.autoCompleteToken({instance:2,startkey:"#",endkey:" ",arrayname:"hashtags"});
textarea.autoCompleteToken({instance:2,startkey:"#",endkey:" ",arrayname:"hashtags",resultname:"name"});
textarea.autoCompleteToken({instance:3,startkey:":",endkey:";",source:actEmojiData,resultname:"name",callback:function() {
textarea.trigger({"type":"keyup","key":":"});
}});
}
}
function submitStatusArray(params,callback) {
function submitStatusArray(params,callback,invidious="unset",nitter="unset",bibliogram="unset",nofb="unset") {
const ytcom = params.status.first().val().match(/https?:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z\d_-]+)/);
const ytbe = params.status.first().val().match(/https?:\/\/(www\.)?youtu\.be\/([a-zA-Z\d_-]+)/);
const twcom = params.status.first().val().match(/https?:\/\/(www\.)?twitter\.com\/(.*)/);
const igpost = params.status.first().val().match(/https?:\/\/(www\.)?instagram\.com\/p\/([a-zA-Z\d_-]+)/);
const igacc = params.status.first().val().match(/https?:\/\/(www\.)?instagram\.com\/([a-zA-Z\d_\.]+)/);
const fbcom = params.status.first().val().match(/https?:\/\/(www\.)?facebook\.com\/(.*)/);
if((ytcom || ytbe) && localStorage.setting_rewrite_invidious == "unset" && invidious == "unset") {
$("#js-overlay_content_wrap .temporary_object").empty();
$('#js-overlay_content_wrap').addClass('view');
$('#js-overlay_content_wrap').addClass('black_08');
$('.overlay_rewrite_invidious').data("params",params);
$('.overlay_rewrite_invidious').data("callback",callback);
$('.overlay_rewrite_invidious').data("nitter",nitter);
$('.overlay_rewrite_invidious').data("bibliogram",bibliogram);
$('.overlay_rewrite_invidious').data("nofb",nofb);
$('.overlay_rewrite_invidious').removeClass('invisible');
}
else if(twcom && localStorage.setting_rewrite_nitter == "unset" && nitter == "unset") {
$("#js-overlay_content_wrap .temporary_object").empty();
$('#js-overlay_content_wrap').addClass('view');
$('#js-overlay_content_wrap').addClass('black_08');
$('.overlay_rewrite_nitter').data("params",params);
$('.overlay_rewrite_nitter').data("callback",callback);
$('.overlay_rewrite_nitter').data("invidious",invidious);
$('.overlay_rewrite_nitter').data("bibliogram",bibliogram);
$('.overlay_rewrite_nitter').data("nofb",nofb);
$('.overlay_rewrite_nitter').removeClass('invisible');
}
else if((igpost || igacc) && localStorage.setting_rewrite_bibliogram == "unset" && bibliogram == "unset") {
$("#js-overlay_content_wrap .temporary_object").empty();
$('#js-overlay_content_wrap').addClass('view');
$('#js-overlay_content_wrap').addClass('black_08');
$('.overlay_rewrite_bibliogram').data("params",params);
$('.overlay_rewrite_bibliogram').data("callback",callback);
$('.overlay_rewrite_bibliogram').data("invidious",invidious);
$('.overlay_rewrite_bibliogram').data("nitter",nitter);
$('.overlay_rewrite_bibliogram').data("nofb",nofb);
$('.overlay_rewrite_bibliogram').removeClass('invisible');
}
else if(fbcom && localStorage.setting_rewrite_nofb == "unset" && nofb == "unset") {
$("#js-overlay_content_wrap .temporary_object").empty();
$('#js-overlay_content_wrap').addClass('view');
$('#js-overlay_content_wrap').addClass('black_08');
$('.overlay_rewrite_nofb').data("params",params);
$('.overlay_rewrite_nofb').data("callback",callback);
$('.overlay_rewrite_nofb').data("invidious",invidious);
$('.overlay_rewrite_nofb').data("nitter",nitter);
$('.overlay_rewrite_nofb').data("bibliogram",bibliogram);
$('.overlay_rewrite_nofb').removeClass('invisible');
}
if(ytcom && (localStorage.setting_rewrite_invidious == "true" || invidious == "true")) {
params.status.first().val(params.status.first().val().replace(/https?:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z\d_-]+)/,"https://"+server_setting_invidious+"/watch?v=$2"));
submitStatusArray(params,callback,invidious,nitter,bibliogram,nofb);
}
else if(ytbe && (localStorage.setting_rewrite_invidious == "true" || invidious == "true")) {
params.status.first().val(params.status.first().val().replace(/https?:\/\/(www\.)?youtu\.be\/([a-zA-Z\d_-]+)/,"https://"+server_setting_invidious+"/watch?v=$2"));
submitStatusArray(params,callback,invidious,nitter,bibliogram,nofb);
}
else if(twcom && (localStorage.setting_rewrite_nitter == "true" || nitter == "true")) {
params.status.first().val(params.status.first().val().replace(/https?:\/\/(www\.)?twitter\.com\/(.*)/,"https://"+server_setting_nitter+"/$2"));
submitStatusArray(params,callback,invidious,nitter,bibliogram,nofb);
}
else if(igpost && (localStorage.setting_rewrite_bibliogram == "true" || bibliogram == "true")) {
params.status.first().val(params.status.first().val().replace(/https?:\/\/(www\.)?instagram\.com\/p\/([a-zA-Z\d_-]+)/,"https://"+server_setting_bibliogram+"/p/$2"));
submitStatusArray(params,callback,invidious,nitter,bibliogram,nofb);
}
else if(igacc && (localStorage.setting_rewrite_bibliogram == "true" || bibliogram == "true")) {
params.status.first().val(params.status.first().val().replace(/https?:\/\/(www\.)?instagram\.com\/([a-zA-Z\d_\.]+)/,"https://"+server_setting_bibliogram+"/u/$2"));
submitStatusArray(params,callback,invidious,nitter,bibliogram,nofb);
}
else if(fbcom && (localStorage.setting_rewrite_nofb == "true" || nofb == "true")) {
params.status.first().val(params.status.first().val().replace(/https?:\/\/(www\.)?facebook\.com\/(.*)/,"https://nofb.pw/?p=https%3A%2F%2Fwww.facebook.com%2F$2"));
submitStatusArray(params,callback,invidious,nitter,bibliogram,nofb);
}
else if(((!ytcom && !ytbe) || localStorage.setting_rewrite_invidious == "false" || invidious == "false") && (!twcom || localStorage.setting_rewrite_nitter == "false" || nitter == "false") && ((!igpost && !igacc) || localStorage.setting_rewrite_bibliogram == "false" || bibliogram == "false") && (!fbcom || localStorage.setting_rewrite_nofb == "false" || nofb == "false")) submitStatusArrayNow(params,callback,invidious,nitter,bibliogram,nofb);
}
function submitStatusArrayNow(params,callback,invidious,nitter,bibliogram,nofb) {
var statuses = params.status;
params.status = params.status.first().val();
api.post("statuses",params,function(data) {
@ -481,7 +666,221 @@ nparams.status = statuses;
nparams.visibility = params.visibility;
nparams.spoiler_text = params.spoiler_text;
nparams.in_reply_to_id = data.id;
submitStatusArray(nparams,callback);
submitStatusArray(nparams,callback,invidious,nitter,bibliogram,nofb);
}
});
}
function checkURLshortener(link) {
var short = true;
if(link.indexOf("https://") != -1 || link.indexOf("http://") != -1) {
if(link.indexOf("://www.") != -1) short = false;
link = link.replace("https://","");
link = link.replace("http://","");
var short_handle = link.split("/");
var domain = link.split(".");
if(domain.length == 2) var sld = domain[0];
else var sld = domain[1];
if(sld.length < 1 || sld.length > 7) short = false;
if(short_handle.length != 2) short = false;
else if(!short_handle[1].match(/^[a-zA-Z0-9_-]+$/)) short = false;
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.emojis.length;i++) {
status.content = status.content.replace(new RegExp(":"+status.emojis[i].shortcode+":","g"),"<img src='"+status.emojis[i].url+"' class='emoji'>");
}
status.account.display_name = htmlEscape(status.account.display_name);
for(var i=0;i<status.account.emojis.length;i++) {
status.account.display_name = status.account.display_name.replace(new RegExp(":"+status.account.emojis[i].shortcode+":","g"),"<img src='"+status.account.emojis[i].url+"' class='emoji'>");
}
for(var i=0;i<status.mentions.length;i++) {
if(status.mentions[i].acct.indexOf("@") == -1) status.content = status.content.replace(new RegExp('href="'+status.mentions[i].url+'"',"g"),'href="/@'+status.mentions[i].acct+'@'+current_instance+'?mid='+status.mentions[i].id+'" data-mid="'+status.mentions[i].id+'"');
else status.content = status.content.replace(new RegExp('href="'+status.mentions[i].url+'"',"g"),'href="/@'+status.mentions[i].acct+'?mid='+status.mentions[i].id+'" data-mid="'+status.mentions[i].id+'"');
}
if(!status.mentions.find(function(account) {
return account.id == this;
},status.account.id)) {
var writtenby = new Object();
writtenby.id = status.account.id;
writtenby.username = status.account.username;
writtenby.url = status.account.url;
writtenby.acct = status.account.acct;
status.mentions.push(writtenby);
}
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;
status.halcyon.datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, status.created_at));
status.halcyon.attr_datetime = getConversionedDate(null, status.created_at);
status.halcyon.alert_text = "";
status.halcyon.article_option = "";
status.halcyon.media_views = "";
status.halcyon.poll_object = "";
status.halcyon.preview_object = "";
if(status.spoiler_text && localStorage.setting_show_content_warning == "false") {
status.halcyon.alert_text = "<span>"+status.spoiler_text+"</span><button class='cw_button'>"+__('SHOW MORE')+"</button>",
status.halcyon.article_option = "content_warning";
}
else if(status.spoiler_text && localStorage.setting_show_content_warning == "true")
status.halcyon.alert_text = "<span>"+status.spoiler_text+"</span><button class='cw_button'>"+__('SHOW LESS')+"</button>";
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:400px'";
status.halcyon.reblog_button = (`<div class="toot_reaction">
<button class="boost_button" tid="${status.id}" reblogged="${status.reblogged}">
<i class="fa fa-fw fa-retweet"></i>
<span class="reaction_count boost_count">${status.reblogs_count}</span>
</button>
</div>`);
}
else {
status.halcyon.footer_width = "";
status.halcyon.reblog_button = "";
}
if(status.account.acct == current_acct) {
status.halcyon.own_toot_buttons = (`<li><a class="delete_button" tid="${status.id}">${__('Delete Toot')}</a></li>`);
if(status.pinned == true) status.halcyon.own_toot_buttons += (`<li><a class="unpin_button" tid="${status.id}">${__('Unpin Toot')}</a></li>`);
else status.halcyon.own_toot_buttons += (`<li><a class="pin_button" tid="${status.id}">${__('Pin Toot')}</a></li>`);
}
else {
status.halcyon.own_toot_buttons = (`<li><a class="mute_button" mid="${status.account.id}" sid="${status.id}">${__('Mute')} @${status.account.username}</a></li>
<li><a class="block_button" mid="${status.account.id}" sid="${status.id}">${__('Block')} @${status.account.username}</a></li>
<li><a class="addlist_button" mid="${status.account.id}" sid="${status.id}" display_name="${status.account.display_name}">${__('Add to list')} @${status.account.username}</a></li>
<li><a class="report_button" mid="${status.account.id}" sid="${status.id}" display_name="${status.account.display_name}">${__('Report this Toot')}</a></li>`);
if(localStorage.setting_show_admin && localStorage.setting_show_admin == "true") {
status.halcyon.own_toot_buttons += (`</ul><ul><li><a href="https://${current_instance}/admin/accounts/${status.account.id}" target="_blank" class="admin_user_button">${__('Open user as admin')}</a></li>
<li><a href="https://${current_instance}/admin/accounts/${status.account.id}/statuses/${status.id}" target="_blank" class="admin_post_button">${__('Open post as admin')}</a></li>`);
}
}
status.halcyon.account_state_icons = "";
if(status.account.locked == true) status.halcyon.account_state_icons += " <i class='fa fa-lock'></i>";
if(status.account.bot == true) status.halcyon.account_state_icons += " <img src='/assets/images/robot.svg' class='emoji'>";
status.halcyon.reactions = "";
if(status.pleroma && status.pleroma.emoji_reactions) status.halcyon.reactions = (`<div class="status_reactions">${parse_reactions(status.pleroma.emoji_reactions)}</div>`);
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<status.account.emojis.length;i++) {
status.account.display_name = status.account.display_name.replace(new RegExp(":"+status.account.emojis[i].shortcode+":","g"),"<img src='"+status.account.emojis[i].url+"' class='emoji'>");
}
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;
}
function renderTimeline(statuses,show_replies,level) {
for(let i in statuses) {
var filterstatus = false;
for(var a=0;a<current_filters.length;a++) {
if(((level == "timelines/home" || level.indexOf("timelines/list/") != -1) && current_filters[a].context.indexOf("home") != -1 && current_filters[a].irreversible == false) || (!(level == "timelines/home" || level.indexOf("timelines/list/") != -1) && current_filters[a].context.indexOf("public") != -1)) {
if(current_filters[a].whole_word == false) {
if(statuses[i].content.match(new RegExp(current_filters[a].phrase))) filterstatus = true;
}
else {
if(statuses[i].content.match(new RegExp("[^a-zA-Z1-9]"+current_filters[a].phrase+"[^a-zA-Z1-9]"))) filterstatus = true;
}
}
}
if(filterstatus == false && !(show_replies == "false" && statuses[i].in_reply_to_id) && !(localStorage.setting_show_bots == "false" && statuses[i].account.bot == true && !level.match(/accounts\/\d+\/statuses/)) && !(statuses[i].visibility == "direct" && level == "timelines/home")) {
timeline_template(statuses[i]).appendTo("#js-timeline");
if(statuses[i].in_reply_to_id && level === "timelines/home" | level === "timelines/public") {
if(localStorage.setting_thread_view == "true") {
(function(this_id) {
api.get('statuses/'+statuses[i].id+"/context", function(context) {
for(var b=0;b<context.ancestors.length;b++) {
var filterreplystatus = false;
for(var a=0;a<current_filters.length;a++) {
if(current_filters[a].context.indexOf("thread") != -1) {
if(current_filters[a].whole_word == false) {
if(context.ancestors[b].content.match(new RegExp(current_filters[a].phrase))) filterreplystatus = true;
}
else {
if(context.ancestors[b].content.match(new RegExp("[^a-zA-Z1-9]"+current_filters[a].phrase+"[^a-zA-Z1-9]"))) filterreplystatus = true;
}
}
}
if(filterreplystatus == false) {
$("#js-timeline .toot_entry[sid='"+context.ancestors[b].id+"']").remove();
$("#js-timeline .toot_entry[sid='"+this_id+"']").before(context_template(context.ancestors[b], 'ancestors_status default_padding'));
timeline_hide_status.push(context.ancestors[b].id);
replace_emoji();
}
}
});
})(statuses[i].id);
}
}
}
}
}
function prepareAnnouncement(announcement) {
for(i=0;i<announcement.emojis.length;i++) {
announcement.content = announcement.content.replace(new RegExp(":"+announcement.emojis[i].shortcode+":","g"),"<img src='"+announcement.emojis[i].url+"' class='emoji'>");
}
for(var i=0;i<announcement.mentions.length;i++) {
if(announcement.mentions[i].acct.indexOf("@") == -1) announcement.content = announcement.content.replace(new RegExp('href="'+announcement.mentions[i].url+'"',"g"),'href="/@'+announcement.mentions[i].acct+'@'+current_instance+'?mid='+announcement.mentions[i].id+'" data-mid="'+announcement.mentions[i].id+'"');
else announcement.content = announcement.content.replace(new RegExp('href="'+announcement.mentions[i].url+'"',"g"),'href="/@'+announcement.mentions[i].acct+'?mid='+announcement.mentions[i].id+'" data-mid="'+announcement.mentions[i].id+'"');
}
return announcement;
}
function parse_reactions(reaction_data) {
var reactions = (`<div class="emoreact_wrap">`);
for(var i=0;i<reaction_data.length;i++) {
var is_active = "";
if(reaction_data[i].me) is_active = " active";
var emoji;
if(reaction_data[i].url) emoji = (`<span><img class="emoji" src="${reaction_data[i].url}"></span>`);
else emoji = (`<span class="emoji_poss">${reaction_data[i].name}</span>`);
reactions += (`<span class="emoreact${is_active}" emoji="${reaction_data[i].name}">${emoji}<span class="emoreact_count">${reaction_data[i].count}</span></span>`);
}
reactions += (`<span class="emoreact_add"><i class="fa fa-smile-o"></i></span>`);
reactions += (`</div>`);
return reactions;
}
function enableReactionPicker(that) {
$(that).find(".emoreact_add").click(function() {
$(this).off("click");
(function(that) {
$(that).lsxEmojiPicker({
closeOnSelect:true,
twemoji:!checkEmojiSupport(),
onSelect:function(emoji) {
api.put("announcements/"+$(that).closest(".announcement").attr("aid")+"/reactions/"+emoji.value,function() {});
},
onClose:function() {
$(that).lsxEmojiPicker("destroy");
setTimeout(function() {enableReactionPicker($(that).closest(".announcement"))},0);
}
}).click();
})(this);
});
}
function addZero(num) {
if(num < 10) return "0"+num;
else return num;
}

0
assets/js/halcyon/halcyonLists.js Normal file → Executable file
View File

197
assets/js/halcyon/halcyonSettings.js Normal file → Executable file
View File

@ -10,6 +10,30 @@ $("#setting_post_sensitive")[0].checked = true;
if(localStorage.setting_compose_autocomplete == "true") {
$("#setting_compose_autocomplete")[0].checked = true;
}
if(localStorage.setting_rewrite_invidious == "true") {
$("#setting_rewrite_invidious")[0].checked = true;
}
if(localStorage.setting_rewrite_invidious != "unset") {
$("#setting_rewrite_invidious_reset").show();
}
if(localStorage.setting_rewrite_nitter == "true") {
$("#setting_rewrite_nitter")[0].checked = true;
}
if(localStorage.setting_rewrite_nitter != "unset") {
$("#setting_rewrite_nitter_reset").show();
}
if(localStorage.setting_rewrite_bibliogram == "true") {
$("#setting_rewrite_bibliogram")[0].checked = true;
}
if(localStorage.setting_rewrite_bibliogram != "unset") {
$("#setting_rewrite_bibliogram_reset").show();
}
if(localStorage.setting_rewrite_nofb == "true") {
$("#setting_rewrite_nofb")[0].checked = true;
}
if(localStorage.setting_rewrite_nofb != "unset") {
$("#setting_rewrite_nofb_reset").show();
}
if(localStorage.setting_who_to_follow == "true") {
$("#setting_who_to_follow")[0].checked = true;
}
@ -41,6 +65,74 @@ localStorage.setItem("setting_compose_autocomplete","false");
putMessage(__("Autocomplete disabled"));
}
});
$("#setting_rewrite_invidious").change(function() {
$("#setting_rewrite_invidious_reset").fadeIn();
if(this.checked) {
localStorage.setItem("setting_rewrite_invidious","true");
putMessage(__("YouTube links rewritten to Invidious"));
}
else {
localStorage.setItem("setting_rewrite_invidious","false");
putMessage(__("Youtube links not rewritten anymore"));
}
});
$("#setting_rewrite_invidious_reset").click(function() {
localStorage.setItem("setting_rewrite_invidious","unset");
$("#setting_rewrite_invidious_reset").fadeOut();
$("#setting_rewrite_invidious")[0].checked = false;
putMessage(__("Youtube link rewrite reset to default"));
});
$("#setting_rewrite_nitter").change(function() {
$("#setting_rewrite_nitter_reset").fadeIn();
if(this.checked) {
localStorage.setItem("setting_rewrite_nitter","true");
putMessage(__("Twitter links rewritten to Nitter"));
}
else {
localStorage.setItem("setting_rewrite_nitter","false");
putMessage(__("Twitter links not rewritten anymore"));
}
});
$("#setting_rewrite_nitter_reset").click(function() {
localStorage.setItem("setting_rewrite_nitter","unset");
$("#setting_rewrite_nitter_reset").fadeOut();
$("#setting_rewrite_nitter")[0].checked = false;
putMessage(__("Twitter link rewrite reset to default"));
});
$("#setting_rewrite_bibliogram").change(function() {
$("#setting_rewrite_bibliogram_reset").fadeIn();
if(this.checked) {
localStorage.setItem("setting_rewrite_bibliogram","true");
putMessage(__("Instagram links rewritten to Bibliogram"));
}
else {
localStorage.setItem("setting_rewrite_bibliogram","false");
putMessage(__("Instagram links not rewritten anymore"));
}
});
$("#setting_rewrite_bibliogram_reset").click(function() {
localStorage.setItem("setting_rewrite_bibliogram","unset");
$("#setting_rewrite_bibliogram_reset").fadeOut();
$("#setting_rewrite_bibliogram")[0].checked = false;
putMessage(__("Instagram link rewrite reset to default"));
});
$("#setting_rewrite_nofb").change(function() {
$("#setting_rewrite_nofb_reset").fadeIn();
if(this.checked) {
localStorage.setItem("setting_rewrite_nofb","true");
putMessage(__("Facebook links rewritten to NoFB"));
}
else {
localStorage.setItem("setting_rewrite_nofb","false");
putMessage(__("Facebook links not rewritten anymore"));
}
});
$("#setting_rewrite_nofb_reset").click(function() {
localStorage.setItem("setting_rewrite_nofb","unset");
$("#setting_rewrite_nofb_reset").fadeOut();
$("#setting_rewrite_nofb")[0].checked = false;
putMessage(__("Facebook link rewrite reset to default"));
});
$(document).on('change',".local_instance_wrap input[name='local_instance']", function(e) {
if($(this).val()) {
localStorage.setItem("setting_local_instance","https://"+$(this).val());
@ -223,6 +315,9 @@ $("#setting_full_height")[0].checked = true;
if(localStorage.setting_thread_view == "true") {
$("#setting_thread_view")[0].checked = true;
}
if(localStorage.setting_show_admin == "true") {
$("#setting_show_admin")[0].checked = true;
}
});
$(document).on('change',".post_streaming_wrap input[name='post_streaming']:checked", function(e) {
localStorage.setItem("setting_post_stream", $(this).val());
@ -366,6 +461,16 @@ localStorage.setItem("setting_thread_view","false");
putMessage(__("Threads shown in chronological order"));
}
});
$("#setting_show_admin").change(function() {
if(this.checked) {
localStorage.setItem("setting_show_admin","true");
putMessage(__("Administrator options shown"));
}
else {
localStorage.setItem("setting_show_admin","false");
putMessage(__("Administrator options hidden"));
}
});
}
else if(window.location.pathname == "/settings/filters") {
$('#js-settings_nav_filters').toggleClass('view');
@ -443,6 +548,30 @@ $("#setting_play_invidious")[0].checked = true;
if(localStorage.setting_play_vimeo == "true" && $("#setting_play_vimeo").length == 1) {
$("#setting_play_vimeo")[0].checked = true;
}
if(localStorage.setting_redirect_invidious == "true") {
$("#setting_redirect_invidious")[0].checked = true;
}
if(localStorage.setting_redirect_invidious != "unset") {
$("#setting_redirect_invidious_reset").show();
}
if(localStorage.setting_redirect_nitter == "true") {
$("#setting_redirect_nitter")[0].checked = true;
}
if(localStorage.setting_redirect_nitter != "unset") {
$("#setting_redirect_nitter_reset").show();
}
if(localStorage.setting_redirect_bibliogram == "true") {
$("#setting_redirect_bibliogram")[0].checked = true;
}
if(localStorage.setting_redirect_bibliogram != "unset") {
$("#setting_redirect_bibliogram_reset").show();
}
if(localStorage.setting_redirect_nofb == "true") {
$("#setting_redirect_nofb")[0].checked = true;
}
if(localStorage.setting_redirect_nofb != "unset") {
$("#setting_redirect_nofb_reset").show();
}
});
$("#setting_play_gif").change(function() {
if(this.checked) {
@ -514,6 +643,74 @@ localStorage.setItem("setting_play_vimeo","false");
putMessage(__("Vimeo embeds disabled"));
}
});
$("#setting_redirect_invidious").change(function() {
$("#setting_redirect_invidious_reset").fadeIn();
if(this.checked) {
localStorage.setItem("setting_redirect_invidious","true");
putMessage(__("YouTube links redirected to Invidious"));
}
else {
localStorage.setItem("setting_redirect_invidious","false");
putMessage(__("Youtube links not redirected anymore"));
}
});
$("#setting_redirect_invidious_reset").click(function() {
localStorage.setItem("setting_redirect_invidious","unset");
$("#setting_redirect_invidious_reset").fadeOut();
$("#setting_redirect_invidious")[0].checked = false;
putMessage(__("Youtube link redirect reset to default"));
});
$("#setting_redirect_nitter").change(function() {
$("#setting_redirect_nitter_reset").fadeIn();
if(this.checked) {
localStorage.setItem("setting_redirect_nitter","true");
putMessage(__("Twitter links redirected to Nitter"));
}
else {
localStorage.setItem("setting_redirect_nitter","false");
putMessage(__("Twitter links not redirected anymore"));
}
});
$("#setting_redirect_nitter_reset").click(function() {
localStorage.setItem("setting_redirect_nitter","unset");
$("#setting_redirect_nitter_reset").fadeOut();
$("#setting_redirect_nitter")[0].checked = false;
putMessage(__("Twitter link redirect reset to default"));
});
$("#setting_redirect_bibliogram").change(function() {
$("#setting_redirect_bibliogram_reset").fadeIn();
if(this.checked) {
localStorage.setItem("setting_redirect_bibliogram","true");
putMessage(__("Instagram links redirected to Bibliogram"));
}
else {
localStorage.setItem("setting_redirect_bibliogram","false");
putMessage(__("Instagram links not redirected anymore"));
}
});
$("#setting_redirect_bibliogram_reset").click(function() {
localStorage.setItem("setting_redirect_bibliogram","unset");
$("#setting_redirect_bibliogram_reset").fadeOut();
$("#setting_redirect_bibliogram")[0].checked = false;
putMessage(__("Instagram link redirect reset to default"));
});
$("#setting_redirect_nofb").change(function() {
$("#setting_redirect_nofb_reset").fadeIn();
if(this.checked) {
localStorage.setItem("setting_redirect_nofb","true");
putMessage(__("Facebook links redirected to NoFB"));
}
else {
localStorage.setItem("setting_redirect_nofb","false");
putMessage(__("Facebook links not redirected anymore"));
}
});
$("#setting_redirect_nofb_reset").click(function() {
localStorage.setItem("setting_redirect_nofb","unset");
$("#setting_redirect_nofb_reset").fadeOut();
$("#setting_redirect_nofb")[0].checked = false;
putMessage(__("Facebook link redirect reset to default"));
});
}
else if(window.location.pathname == "/settings/blocks") {
$('#js-settings_nav_blocks').toggleClass('view');

0
assets/js/halcyon/halcyonSharebox.js Normal file → Executable file
View File

1807
assets/js/halcyon/halcyonTemplates.js Normal file → Executable file

File diff suppressed because it is too large Load Diff

589
assets/js/halcyon/halcyonUI.js Normal file → Executable file
View File

@ -100,44 +100,132 @@ $(this).html('<i class="fa fa-fw fa-user-plus"></i><span>'+__('Follow')+'</span>
putMessage(__("Unblocked this user"));
return false;
});
$(document).on('click','.boost_button', function(e) {
$(document).on('click','.boost_button',function(e) {
e.stopPropagation();
if($(this).attr('reblogged') !== 'true'){
api.post("statuses/"+$(this).attr('tid')+"/reblog", function (data) {
api.post("statuses/"+$(this).attr('tid')+"/reblog",function(data) {
});
$(this).attr('reblogged', "true");
$(this).toggleClass('active');
$(this).attr('reblogged',"true");
$(this).addClass('active');
$(".js_current_toots_count").html(++localStorage.current_statuses_count);
} else {
api.post("statuses/"+$(this).attr('tid')+"/unreblog", function (data) {
}
else {
api.post("statuses/"+$(this).attr('tid')+"/unreblog",function(data) {
});
$(this).attr('reblogged', "hold");
$(this).toggleClass('active');
$(this).attr('reblogged',"null");
$(this).removeClass('active');
$(".js_current_toots_count").html(--localStorage.current_statuses_count);
$(this).mouseout(function(e) {
$(this).attr('reblogged', "null");
});
}
return false;
});
$(document).on('click','.fav_button', function(e) {
$(document).on('click','.fav_button',function(e) {
e.stopPropagation();
if($(this).attr('favourited') !== 'true'){
api.post("statuses/"+$(this).attr('tid')+"/favourite", function (data) {
api.post("statuses/"+$(this).attr('tid')+"/favourite",function(data) {
});
$(this).attr('favourited', "true");
$(this).toggleClass('active');
} else {
api.post("statuses/"+$(this).attr('tid')+"/unfavourite", function (data) {
});
$(this).attr('favourited', "hold");
$(this).toggleClass('active');
$(this).mouseout(function(e) {
$(this).attr('favourited', "null");
$(this).attr('favourited',"true");
$(this).addClass('active');
}
else {
api.post("statuses/"+$(this).attr('tid')+"/unfavourite",function(data) {
});
$(this).attr('favourited',"null");
$(this).removeClass('active');
}
return false;
});
$(document).on('click','.bookmark_button',function(e) {
e.stopPropagation();
if($(this).attr('bookmarked') !== 'true') {
api.post("statuses/"+$(this).attr('tid')+"/bookmark",function(data) {
});
$(this).attr('bookmarked',"true");
$(this).addClass('active');
}
else {
api.post("statuses/"+$(this).attr('tid')+"/unbookmark",function(data) {
});
$(this).attr('bookmarked',"null");
$(this).removeClass('active');
}
return false;
});
$(document).on('click','.announcement .emoreact',function(e) {
e.stopPropagation();
if($(this).hasClass('active')) {
(function(that) {
api.delete("announcements/"+$(that).closest('.announcement').attr("aid")+"/reactions/"+$(that).attr("emoji"),function(data) {
$(that).removeClass('active');
});
})(this);
}
else {
(function(that) {
api.put("announcements/"+$(that).closest('.announcement').attr("aid")+"/reactions/"+$(that).attr("emoji"),function(data) {
$(that).addClass('active');
});
})(this);
}
return false;
});
$(document).on('click','.status_reactions .emoreact',function(e) {
e.stopPropagation();
if($(this).hasClass('active')) {
(function(that) {
if($(that).closest('.toot_detail.main_status').length == 1) var sid = $(that).closest('.toot_detail.main_status').attr("sid");
else var sid = $(that).closest('.toot_entry').attr("sid");
api.delete("pleroma/statuses/"+sid+"/reactions/"+$(that).attr("emoji"),function(status) {
$(".toot_entry[sid="+sid+"]").find(".status_reactions").children().remove();
$(".toot_entry[sid="+sid+"]").find(".status_reactions").append(parse_reactions(status.pleroma.emoji_reactions));
$(".toot_detail.main_status[sid="+sid+"]").find(".status_reactions").children().remove();
$(".toot_detail.main_status[sid="+sid+"]").find(".status_reactions").append(parse_reactions(status.pleroma.emoji_reactions));
replace_emoji();
});
})(this);
}
else {
(function(that) {
if($(that).closest('.toot_detail.main_status').length == 1) var sid = $(that).closest('.toot_detail.main_status').attr("sid");
else var sid = $(that).closest('.toot_entry').attr("sid");
api.put("pleroma/statuses/"+sid+"/reactions/"+$(that).attr("emoji"),function(status) {
$(".toot_entry[sid="+sid+"]").find(".status_reactions").children().remove();
$(".toot_entry[sid="+sid+"]").find(".status_reactions").append(parse_reactions(status.pleroma.emoji_reactions));
$(".toot_detail.main_status[sid="+sid+"]").find(".status_reactions").children().remove();
$(".toot_detail.main_status[sid="+sid+"]").find(".status_reactions").append(parse_reactions(status.pleroma.emoji_reactions));
replace_emoji();
});
})(this);
}
return false;
});
$(document).on('click','.status_reactions .emoreact_add',function(e) {
e.stopPropagation();
});
$(document).on('click','.status_reactions .emoreact_add:not(.active)',function() {
$(this).addClass("active");
(function(that) {
if($(that).closest('.toot_detail.main_status').length == 1) var sid = $(that).closest('.toot_detail.main_status').attr("sid");
else var sid = $(that).closest('.toot_entry').attr("sid");
$(that).lsxEmojiPicker({
closeOnSelect:true,
customEmojis:false,
twemoji:!checkEmojiSupport(),
onSelect:function(emoji) {
api.put("pleroma/statuses/"+sid+"/reactions/"+emoji.value,function(status) {
$(".toot_entry[sid="+sid+"]").find(".status_reactions").children().remove();
$(".toot_entry[sid="+sid+"]").find(".status_reactions").append(parse_reactions(status.pleroma.emoji_reactions));
$(".toot_detail.main_status[sid="+sid+"]").find(".status_reactions").children().remove();
$(".toot_detail.main_status[sid="+sid+"]").find(".status_reactions").append(parse_reactions(status.pleroma.emoji_reactions));
replace_emoji();
});
},
onClose:function() {
$(that).lsxEmojiPicker("destroy");
setTimeout(function() {$(that).removeClass("active")},0);
}
}).click();
})(this);
});
$(document).on('click','.delete_button', function(e) {
const sid = $(this).attr('tid');
e.stopPropagation();
@ -250,7 +338,7 @@ article.addClass('content_warning');
}
return false;
});
$(document).on('click','.sensitive_alart', function(e) {
$(document).on('click','.sensitive_alert', function(e) {
e.stopPropagation();
$(this).toggleClass('invisible');
return false;
@ -285,50 +373,7 @@ var load_options = [];
}
api.get(level, load_options, function(statuses) {
timeline_hide_status = new Array;
for(let i in statuses) {
var filterstatus = false;
for(var a=0;a<current_filters.length;a++) {
if(((level == "timelines/home" || level.indexOf("timelines/list/") != -1) && current_filters[a].context.indexOf("home") != -1 && current_filters[a].irreversible == false) || (!(level == "timelines/home" || level.indexOf("timelines/list/") != -1) && current_filters[a].context.indexOf("public") != -1)) {
if(current_filters[a].whole_word == false) {
if(statuses[i].content.match(new RegExp(current_filters[a].phrase))) filterstatus = true;
}
else {
if(statuses[i].content.match(new RegExp("[^a-zA-Z1-9]"+current_filters[a].phrase+"[^a-zA-Z1-9]"))) filterstatus = true;
}
}
}
if(filterstatus == false && !(show_replies == "false" && statuses[i].in_reply_to_id) && !(localStorage.setting_show_bots == "false" && statuses[i].account.bot == true && !level.match(/accounts\/\d+\/statuses/)) && !(statuses[i].visibility == "direct" && level == "timelines/home")) {
timeline_template(statuses[i]).appendTo("#js-timeline");
if(statuses[i].in_reply_to_id && level === "timelines/home" | level === "timelines/public") {
if(localStorage.setting_thread_view == "true") {
(function(this_id) {
api.get('statuses/'+statuses[i].id+"/context", function(context) {
console.log(this_id);
for(var b=0;b<context.ancestors.length;b++) {
var filterreplystatus = false;
for(var a=0;a<current_filters.length;a++) {
if(current_filters[a].context.indexOf("thread") != -1) {
if(current_filters[a].whole_word == false) {
if(context.ancestors[b].content.match(new RegExp(current_filters[a].phrase))) filterreplystatus = true;
}
else {
if(context.ancestors[b].content.match(new RegExp("[^a-zA-Z1-9]"+current_filters[a].phrase+"[^a-zA-Z1-9]"))) filterreplystatus = true;
}
}
}
if(filterreplystatus == false) {
$("#js-timeline .toot_entry[sid='"+context.ancestors[b].id+"']").remove();
$("#js-timeline .toot_entry[sid='"+this_id+"']").before(context_template(context.ancestors[b], 'ancestors_status default_padding'));
timeline_hide_status.push(context.ancestors[b].id);
replace_emoji();
}
}
});
})(statuses[i].id);
}
}
}
}
renderTimeline(statuses,show_replies,level);
links = getLinkFromXHRHeader(responce_headers);
replaceInternalLink();
replace_emoji();
@ -341,53 +386,11 @@ $(window).scroll(function () {
if ( $(window).scrollTop()+window.innerHeight >= $(document).height()-700 ) {
if (!isSyncing) {
isSyncing = true;
load_options.unshift( {name:"max_id",data:links['next'].match(/max_id=(.+)&?/)[1]} );
if(links && links['next']) {
load_options.unshift({name:"max_id",data:links['next'].match(/max_id=(.+)&?/)[1]});
api.get(level, load_options, function(statuses) {
if (statuses.length) {
for(let i in statuses) {
var filterstatus = false;
for(var a=0;a<current_filters.length;a++) {
if(((level == "timelines/home" || level.indexOf("timelines/list/") != -1) && current_filters[a].context.indexOf("home") != -1 && current_filters[a].irreversible == false) || (!(level == "timelines/home" || level.indexOf("timelines/list/") != -1) && current_filters[a].context.indexOf("public") != -1)) {
if(current_filters[a].whole_word == false) {
if(statuses[i].content.match(new RegExp(current_filters[a].phrase))) filterstatus = true;
}
else {
if(statuses[i].content.match(new RegExp("[^a-zA-Z1-9]"+current_filters[a].phrase+"[^a-zA-Z1-9]"))) filterstatus = true;
}
}
}
if(filterstatus == false && timeline_hide_status.indexOf(statuses[i].id) == -1 && !(show_replies == "false" && statuses[i].in_reply_to_id) && !(localStorage.setting_show_bots == "false" && statuses[i].account.bot == true && !level.match(/accounts\/\d+\/statuses/)) && !(statuses[i].visibility == "direct" && level == "timelines/home")) {
timeline_template(statuses[i]).appendTo("#js-timeline");
if(statuses[i].in_reply_to_id && level === "timelines/home" | level === "timelines/public") {
if(localStorage.setting_thread_view == "true") {
(function(this_id) {
api.get('statuses/'+statuses[i].id+"/context", function(context) {
console.log(this_id);
for(var b=0;b<context.ancestors.length;b++) {
var filterreplystatus = false;
for(var a=0;a<current_filters.length;a++) {
if(current_filters[a].context.indexOf("thread") != -1) {
if(current_filters[a].whole_word == false) {
if(context.ancestors[b].content.match(new RegExp(current_filters[a].phrase))) filterreplystatus = true;
}
else {
if(context.ancestors[b].content.match(new RegExp("[^a-zA-Z1-9]"+current_filters[a].phrase+"[^a-zA-Z1-9]"))) filterreplystatus = true;
}
}
}
if(filterreplystatus == false) {
$("#js-timeline .toot_entry[sid='"+context.ancestors[b].id+"']").remove();
$("#js-timeline .toot_entry[sid='"+this_id+"']").before(context_template(context.ancestors[b], 'ancestors_status default_padding'));
timeline_hide_status.push(context.ancestors[b].id);
replace_emoji();
}
}
});
})(statuses[i].id);
}
}
}
}
renderTimeline(statuses,show_replies,level);
links = getLinkFromXHRHeader(responce_headers);
replaceInternalLink();
replace_emoji();
@ -399,9 +402,112 @@ isSyncing = true;
}
});
load_options.shift();
}
else {
$('.timeline_footer > i').css({"display":"none"});
$('.timeline_footer').append('<img style="width: 30%;opacity: .3;" src="/assets/images/halcyon.png">');
isSyncing = true;
}
};
};
});
startStreaming(level,load_options,show_replies);
}
function setDirectTimeline() {
var show_replies = localStorage.setting_show_replies;
let isSyncing = true;
var load_options = [];
var statuses = new Array();
var requests = 0;
api.get("conversations",load_options,function(conversations) {
links = getLinkFromXHRHeader(responce_headers);
for(var a=0;a<conversations.length;a++) {
if(conversations[a].last_status.account.id != current_id) statuses.push(conversations[a].last_status);
requests++;
api.get("statuses/"+conversations[a].last_status.id+"/context",load_options,function(contexts) {
requests--;
for(var b=0;b<contexts.ancestors.length;b++) {
if(contexts.ancestors[b].account.id != current_id && contexts.ancestors[b].visibility == "direct") statuses.push(contexts.ancestors[b]);
}
for(var b=0;b<contexts.descendants.length;b++) {
if(contexts.descendants[b].account.id != current_id && contexts.descendants[b].visibility == "direct") statuses.push(contexts.descendants[b]);
}
if(requests == 0) {
statuses.sort(function(one,two) {
var dateone = Date.parse(one.created_at);
var datetwo = Date.parse(two.created_at);
return datetwo-dateone;
});
timeline_hide_status = new Array;
renderTimeline(statuses,show_replies,"timelines/direct");
replaceInternalLink();
replace_emoji();
if (!statuses.length) {
$('#js-timeline_footer > i').css({"display":"none"});
}
isSyncing = false;
}
});
}
});
$(window).scroll(function () {
if ( $(window).scrollTop()+window.innerHeight >= $(document).height()-700 ) {
if (!isSyncing) {
isSyncing = true;
var statuses = new Array();
if(links && links['next']) {
load_options.unshift({name:"max_id",data:links['next'].match(/max_id=(.+)&?/)[1]});
api.get("conversations",load_options,function(conversations) {
links = getLinkFromXHRHeader(responce_headers);
if(conversations.length) {
for(var a=0;a<conversations.length;a++) {
if(conversations[a].last_status.account.id != current_id) statuses.push(conversations[a].last_status);
requests++;
api.get("statuses/"+conversations[a].last_status.id+"/context",load_options,function(contexts) {
requests--;
for(var b=0;b<contexts.ancestors.length;b++) {
if(contexts.ancestors[b].account.id != current_id && contexts.ancestors[b].visibility == "direct") statuses.push(contexts.ancestors[b]);
}
for(var b=0;b<contexts.descendants.length;b++) {
if(contexts.descendants[b].account.id != current_id && contexts.descendants[b].visibility == "direct") statuses.push(contexts.descendants[b]);
}
if(requests == 0) {
statuses.sort(function(one,two) {
var dateone = Date.parse(one.created_at);
var datetwo = Date.parse(two.created_at);
return datetwo-dateone;
});
timeline_hide_status = new Array;
renderTimeline(statuses,show_replies,"timelines/direct");
replaceInternalLink();
replace_emoji();
if (!statuses.length) {
$('#js-timeline_footer > i').css({"display":"none"});
}
isSyncing = false;
}
});
}
}
else {
$('.timeline_footer > i').css({"display":"none"});
$('.timeline_footer').append('<img style="width: 30%;opacity: .3;" src="/assets/images/halcyon.png">');
isSyncing = true;
}
});
load_options.shift();
}
else {
$('.timeline_footer > i').css({"display":"none"});
$('.timeline_footer').append('<img style="width: 30%;opacity: .3;" src="/assets/images/halcyon.png">');
isSyncing = true;
}
};
};
});
startStreaming("timelines/direct",load_options,show_replies);
}
function startStreaming(level,load_options,show_replies) {
$(function() {
if(level === "timelines/home") {
var streamscope = "user",
@ -436,6 +542,7 @@ if(userstream.event === "update") {
if(streaming_option === "manual") {
if(!$('.toot_entry[sid="'+userstream.payload.id+'"]').length) {
var filterstatus = false;
if(scope == "direct" && userstream.payload.account.id == current_id) filterstatus = true;
for(var a=0;a<current_filters.length;a++) {
if(((level == "timelines/home" || level.indexOf("timelines/list/") != -1) && current_filters[a].context.indexOf("home") != -1 && current_filters[a].irreversible == false) || (!(level == "timelines/home" || level.indexOf("timelines/list/") != -1) && current_filters[a].context.indexOf("public") != -1)) {
if(current_filters[a].whole_word == false) {
@ -459,6 +566,7 @@ else if (streaming_option === "auto") {
var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
if(!$('.toot_entry[sid="'+userstream.payload.id+'"]').length) {
var filterstatus = false;
if(scope == "direct" && userstream.payload.account.id == current_id) filterstatus = true;
for(var a=0;a<current_filters.length;a++) {
if(((level == "timelines/home" || level.indexOf("timelines/list/") != -1) && current_filters[a].context.indexOf("home") != -1 && current_filters[a].irreversible == false) || (!(level == "timelines/home" || level.indexOf("timelines/list/") != -1) && current_filters[a].context.indexOf("public") != -1)) {
if(current_filters[a].whole_word == false) {
@ -510,6 +618,7 @@ var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
if(scrollTop == 0) {
if(!$('.toot_entry[sid="'+userstream.payload.id+'"]').length) {
var filterstatus = false;
if(scope == "direct" && userstream.payload.account.id == current_id) filterstatus = true;
for(var a=0;a<current_filters.length;a++) {
if(((level == "timelines/home" || level.indexOf("timelines/list/") != -1) && current_filters[a].context.indexOf("home") != -1 && current_filters[a].irreversible == false) || (!(level == "timelines/home" || level.indexOf("timelines/list/") != -1) && current_filters[a].context.indexOf("public") != -1)) {
if(current_filters[a].whole_word == false) {
@ -923,7 +1032,7 @@ load_options.shift();
});
};
function setUserSearch(query) {
api.get('search', [{name:'q',data:query},{name:'resolve',data:'true'}], function(search) {
api.search('q='+encodeURIComponent(query)+"&resolve=true",function(search) {
for(let i in search.accounts) {
follows_template(search.accounts[i]).appendTo("#js-follows_profile");;
}
@ -1015,19 +1124,34 @@ if (statuses.length) {
$('#js_profile_recent_images span').text(`${statuses[0].account.statuses_count} ${__('Photos and toots')}`);
$('#js_profile_recent_images a').attr('href', $("#media_link").attr('href'));
for (i in statuses) {
if(statuses[i].sensitive) {
if(statuses[i].sensitive && localStorage.setting_show_nsfw == "false") {
if(statuses[i].media_attachments[0].blurhash) var imgurl = getBlurImage(statuses[i].media_attachments[0].blurhash);
else if(statuses[i].pleroma) var imgurl = "https://"+current_instance+"/images/avi.png";
else var imgurl = "https://"+current_instance+"/avatars/original/missing.png";
}
else {
if(statuses[i].media_attachments[0].remote_url != null) statuses[i].media_attachments[0].url = statuses[i].media_attachments[0].remote_url;
if(statuses[i].media_attachments[0].type == "image") var imgurl = statuses[i].media_attachments[0].url;
else if(statuses[i].media_attachments[0].type == "video" || statuses[i].media_attachments[0].type == "gifv") var imgurl = statuses[i].media_attachments[0].preview_url;
else var imgurl = "https://"+current_instance+"/avatars/original/missing.png";
}
if(statuses[i].media_attachments[0].type == "image")
$(`<div class="profile_recent_images_item media_attachment" otype="image" sid="${statuses[i].id}" oid="${statuses[i].media_attachments[0].id}" url="${imgurl}" mediacount="0">
<img src="${imgurl}">
</div>`).appendTo('#js_profile_recent_images_box');
else
$(`<div class="profile_recent_images_item media_attachment">
<img src="${imgurl}">
</div>`).appendTo('#js_profile_recent_images_box');
}
else {
if(statuses[i].media_attachments[0].remote_url != null) statuses[i].media_attachments[0].url = statuses[i].media_attachments[0].remote_url;
if(statuses[i].media_attachments[0].type == "image")
$(`<div class="profile_recent_images_item media_attachment" otype="image" sid="${statuses[i].id}" oid="${statuses[i].media_attachments[0].id}" url="${statuses[i].media_attachments[0].url}" mediacount="0">
<img src="${statuses[i].media_attachments[0].url}">
</div>`).appendTo('#js_profile_recent_images_box');
else {
if((statuses[i].media_attachments[0].type == "video" || statuses[i].media_attachments[0].type == "gifv") && statuses[i].media_attachments[0].preview_url != statuses[i].media_attachments[0].url) var imgurl = statuses[i].media_attachments[0].preview_url;
else if(statuses[i].pleroma) var imgurl = "https://"+current_instance+"/images/avi.png";
else var imgurl = "https://"+current_instance+"/avatars/original/missing.png";
$(`<div class="profile_recent_images_item media_attachment">
<img src="${imgurl}">
</div>`).appendTo('#js_profile_recent_images_box');
}
}
};
}
});
@ -1061,8 +1185,28 @@ if ( current_count ) {
$('#header .header_nav_list .notification_badge').removeClass('invisible');
$('#header .header_nav_list .notification_badge').text( current_count );
}
api.stream("user", function(userstream) {
if(userstream.event === "update" & location.pathname !== "/") {
api.stream("user",function(userstream) {
if(userstream.event == "filters_changed") {
api.get("filters",function(data) {
localStorage.setItem("current_filters",JSON.stringify(data));
current_filters = data;
});
}
else if(userstream.event == "announcement.reaction") {
if($(".announcement[aid="+userstream.payload.announcement_id+"]").find(".emoreact[emoji="+userstream.payload.name+"]").length == 1) {
if(userstream.payload.count == 0) $(".announcement[aid="+userstream.payload.announcement_id+"]").find(".emoreact[emoji="+userstream.payload.name+"]").remove();
else $(".announcement[aid="+userstream.payload.announcement_id+"]").find(".emoreact[emoji="+userstream.payload.name+"]").find(".emoreact_count").text(userstream.payload.count);
}
else {
var emoji;
if(userstream.payload.url) emoji = (`<span><img class="emoji" src="${userstream.payload.url}"></span>`);
else emoji = (`<span class="emoji_poss">${userstream.payload.name}</span>`);
var reaction = (`<span class="emoreact" emoji="${userstream.payload.name}">${emoji}<span class="emoreact_count">${userstream.payload.count}</span></span>`);
$(".announcement[aid="+userstream.payload.announcement_id+"]").find(".emoreact_add").before(reaction);
replace_emoji();
}
}
else if(userstream.event === "update" & location.pathname !== "/") {
$('#header .header_nav_list .home_badge').removeClass('invisible');
}
else if(userstream.event === "notification" & location.pathname !== "/notifications") {
@ -1080,6 +1224,7 @@ userstream.payload.account.display_name = userstream.payload.account.username;
switch(userstream.payload.type) {
case "favourite":pushNotification(__("New favourite"),userstream.payload.account.display_name+" "+__("favourited your toot"));break;
case "reblog":pushNotification(__("New boost"),userstream.payload.account.display_name+" "+__("boosted your toot"));break;
case "pleroma:emoji_reaction":pushNotification(__("New reaction"),userstream.payload.account.display_name+" "+__("reacted to 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;
@ -1171,7 +1316,7 @@ $(document).on('click','.player',function(e) {
e.stopPropagation();
});
$(document).on('click','.toot_entry', function(e) {
setOverlayStatus($(this).attr('sid'));
if($(this).attr('sid')) setOverlayStatus($(this).attr('sid'));
});
})
function setOverlayMedia(sid,mediacount) {
@ -1193,7 +1338,7 @@ replace_emoji();
});
}
$(function() {
$(document).on('click','.media_attachment[otype="image"]', function(e) {
$(document).on('click','.media_attachment.with_overlay', function(e) {
e.stopPropagation();
setOverlayMedia($(this).attr('sid'),$(this).attr('mediacount'));
$('.media_detail .toot_entry .media_views').addClass('invisible');
@ -1342,6 +1487,28 @@ $('#'+place+'_status_form .character_count').text(textLen);
}
});
}
if($('#'+place+'_status_form .poll_days').val() != "" || $('#'+place+'_status_form .poll_hours').val() != "" || $('#'+place+'_status_form .poll_mins').val() != "") {
if($('#'+place+'_status_form .poll_days').val()*86400+$('#'+place+'_status_form .poll_hours').val()*3600+$('#'+place+'_status_form .poll_mins').val()*60 > current_instance_poll_limits.max_expiration) {
is_ready = true;
var pl_days = Math.floor(current_instance_poll_limits.max_expiration/86400);
var pl_hours = Math.floor(current_instance_poll_limits.max_expiration/3600-pl_days*24);
var pl_minutes = Math.floor(current_instance_poll_limits.max_expiration/60-pl_hours*60-pl_days*1440);
$('#'+place+'_status_form .poll_time_warning').removeClass("invisible").text(__("The maximum poll time limit is:")+" "+pl_days+" "+__("Days")+", "+pl_hours+" "+__("Hours")+" "+__("and")+" "+pl_minutes+" "+__("Minutes"));
}
else if($('#'+place+'_status_form .poll_days').val()*86400+$('#'+place+'_status_form .poll_hours').val()*3600+$('#'+place+'_status_form .poll_mins').val()*60 < current_instance_poll_limits.min_expiration) {
is_ready = true;
var pl_days = Math.floor(current_instance_poll_limits.min_expiration/86400);
var pl_hours = Math.floor(current_instance_poll_limits.min_expiration/3600-pl_days*24);
var pl_minutes = Math.floor(current_instance_poll_limits.min_expiration/60-pl_hours*60-pl_days*1440);
var plt_days = "";
var plt_hours = "";
if(pl_days > 0) plt_days = pl_days+" "+__("Days")+", "+pl_hours+" "+__("Hours")+" "+__("and")+" ";
else if(pl_hours > 0) plt_hours = pl_hours+" "+__("Hours")+" "+__("and")+" ";
$('#'+place+'_status_form .poll_time_warning').removeClass("invisible").text(__("The minimum poll time limit is:")+" "+plt_days+plt_hours+pl_minutes+" "+__("Minutes"));
}
else $('#'+place+'_status_form .poll_time_warning').addClass("invisible");
}
else $('#'+place+'_status_form .poll_time_warning').addClass("invisible");
}
if($('#'+place+'_status_form .status_poll_editor').hasClass("invisible")) {
if(is_ready) $('#'+place+'_status_form').addClass('ready');
@ -1355,6 +1522,12 @@ else $('#'+place+'_status_form').removeClass('ready');
else $('#'+place+'_status_form').addClass('ready');
}
});
$(document).on('change keyup','#'+place+'_status_form .poll_field',function() {
if($('#'+place+'_status_form .poll_field:blank').length == 0 && $('#'+place+'_status_form .poll_field').length < current_instance_poll_limits.max_options)
$('#'+place+'_status_form .poll_field:last').after(
$("<input>").addClass("disallow_enter").addClass("textfield").addClass("poll_field").attr("name","options[]").attr("type","text").attr("maxlength",current_instance_poll_limits.max_option_chars)).after(" ").after(
$("<i>").addClass("fa").addClass("fa-circle-o")).after($("<br>"));
});
$(document).on('click','#'+place+'_status_form .status_CW', function(e) {
$('#'+place+'_status_form .status_spoiler').toggleClass('invisible');
$('#'+place+'_status_form .status_textarea').toggleClass('status_has_cw');
@ -1475,9 +1648,11 @@ $('#'+place+'_status_form .media_attachments_preview').removeClass("over");
$('#'+place+'_status_form .media_attachments_preview').removeClass("moving");
});
$(document).on('click','#'+place+'_status_form .submit_status_label', function(e) {
setTimeout(function() {
$('#'+place+'_status_form').addClass('ready');
$('#'+place+'_status_form .status_textarea').addClass('disallow_select');
$('#'+place+'_status_form .character_count').html('<i class="fa fa-circle-o-notch fa-spin" aria-hidden="true"></i>');
},0);
const form = document.forms[place+"_status_form"];
if(!Object.keys(image_uploads[place]).length || !$('#'+place+'_status_form .status_poll_editor').hasClass("invisible")) {
const params = {
@ -1488,8 +1663,6 @@ visibility : form.privacy_option.value
}
if(place == "reply") params.in_reply_to_id = $('#reply_status_form').attr('sid');
else if(place == "single_reply") params.in_reply_to_id = $('#single_reply_status_form').attr('tid');
console.log(params);
console.log(place);
if(!$('#'+place+'_status_form .status_poll_editor').hasClass("invisible")) {
params.poll = new Object;
params.poll.options = new Array;
@ -1575,6 +1748,9 @@ enableAutoComplete($('#'+place+'_status_form .status_top .status_spoiler'));
enableAutoComplete($('#'+place+'_status_form .status_textarea textarea'));
$('#'+place+'_status_form .status_bottom').removeClass('invisible');
$('#'+place+'_status_form .submit_status_label').addClass('active_submit_button');
$('#'+place+'_status_form .poll_field').attr("maxlength",current_instance_poll_limits.max_option_chars);
$('#'+place+'_status_form .poll_days').attr("max",Math.floor(current_instance_poll_limits.max_expiration/86400));
$('#'+place+'_status_form .poll_days').attr("placeholder","0-"+Math.floor(current_instance_poll_limits.max_expiration/86400));
const textCount = $('#'+place+'_status_form textarea').val().length + $('#'+place+'_status_form .status_spoiler').val().length;
let textLen = (current_instance_charlimit - textCount);
$('#'+place+'_status_form .character_count').html(textLen);
@ -1652,6 +1828,10 @@ replyto += "@"+mentions[i].acct+" ";
}
}
$('#reply_status_form textarea').val(replyto);
if($("#reply_status_form .status_spoiler:blank").length == 0) {
$('#reply_status_form .status_spoiler').removeClass('invisible');
$('#reply_status_form .status_textarea').addClass('status_has_cw');
}
delete image_uploads.reply;
image_uploads.reply = new Object();
openStatusEditor("reply");
@ -1704,6 +1884,11 @@ $('#single_reply_status_form .expand_privacy_menu_button > i').attr('class', "fa
$('#single_reply_status_form').attr('tid',sid);
$('.single_reply_status .single_reply_status_header span').addClass("emoji_poss").html(__("Reply to")+" "+display_name);
$('#single_reply_status_form textarea').val(replyto);
$('#single_reply_status_form .status_spoiler').val($(this).attr("content_warning"));
if($(this).attr("content_warning") != "") {
$('#single_reply_status_form .status_spoiler').removeClass('invisible');
$('#single_reply_status_form .status_textarea').addClass('status_has_cw');
}
openStatusEditor("single_reply")
api.get('statuses/'+sid+'/', function(status) {
timeline_template(status).appendTo(".single_reply_status .status_preview");
@ -1712,7 +1897,7 @@ replace_emoji();
});
initStatusEditor("single_reply");
$(document).on('click', function(e) {
if(!$(e.target).closest('#header_status_form').length) {
if(!$(e.target).closest('#header_status_form').length && !$(e.target).closest('.close_button').length) {
$('#header_status_form .submit_status_label').removeClass('active_submit_button');
$('#header_status_form .expand_privacy_menu').addClass('invisible');
$('#header_status_form .status_textarea textarea').removeClass('focus');
@ -1937,6 +2122,14 @@ $('#js-overlay_content_wrap .overlay_confirm').addClass('invisible');
$('#js-overlay_content_wrap .overlay_prompt').addClass('invisible');
$('#js-overlay_content_wrap .overlay_addlist').addClass('invisible');
$('#js-overlay_content_wrap .overlay_filter').addClass('invisible');
$('#js-overlay_content_wrap .overlay_redirect_invidious').addClass('invisible');
$('#js-overlay_content_wrap .overlay_redirect_nitter').addClass('invisible');
$('#js-overlay_content_wrap .overlay_redirect_bibliogram').addClass('invisible');
$('#js-overlay_content_wrap .overlay_redirect_nofb').addClass('invisible');
$('#js-overlay_content_wrap .overlay_rewrite_invidious').addClass('invisible');
$('#js-overlay_content_wrap .overlay_rewrite_nitter').addClass('invisible');
$('#js-overlay_content_wrap .overlay_rewrite_bibliogram').addClass('invisible');
$('#js-overlay_content_wrap .overlay_rewrite_nofb').addClass('invisible');
$('#js-overlay_content .temporary_object, #js-overlay_content .parmanent_object').removeClass('visible');
$('#js-overlay_content_wrap .overlay_status.submit_status_label').removeClass('active_submit_button');
$('#js-overlay_content_wrap .single_reply_status .submit_status_label').removeClass('active_submit_button');
@ -1966,10 +2159,13 @@ $("#enable_follow").click(function() {
localStorage.setItem("setting_who_to_follow","true");
setWhoToFollow(true);
});
$("#hide_ffdl").click(function() {
localStorage.hide_firefox_download = "true";
$("#widget_ffdl").slideUp();
});
$("#search_form").focus(function() {
if($("#search_form").val() == "") searchlocalfill();
else searchremotefill($("#search_form").val());
$(".header_search_suggestions").removeClass("invisible");
}).keyup(function() {
if($("#search_form").val() == "") searchlocalfill();
else searchremotefill($("#search_form").val());
@ -1981,6 +2177,86 @@ $(".search_form").submit(function(e) {
e.preventDefault();
searchredirect($("#search_form").val());
});
$('.overlay_redirect_invidious_yes').click(function() {
$('.close_button').click();
window.open("https://"+server_setting_invidious+"/watch?v="+$(".overlay_redirect_invidious").data("video"),"_blank");
if($("#redirect_invidious_permanent")[0].checked) localStorage.setting_redirect_invidious = "true";
});
$('.overlay_redirect_invidious_no').click(function() {
$('.close_button').click();
window.open("https://www.youtube.com/watch?v="+$(".overlay_redirect_invidious").data("video"),"_blank");
if($("#redirect_invidious_permanent")[0].checked) localStorage.setting_redirect_invidious = "false";
});
$('.overlay_redirect_nitter_yes').click(function() {
$('.close_button').click();
window.open("https://"+server_setting_nitter+"/"+$(".overlay_redirect_nitter").data("path"),"_blank");
if($("#redirect_nitter_permanent")[0].checked) localStorage.setting_redirect_nitter = "true";
});
$('.overlay_redirect_nitter_no').click(function() {
$('.close_button').click();
window.open("https://twitter.com/"+$(".overlay_redirect_nitter").data("path"),"_blank");
if($("#redirect_nitter_permanent")[0].checked) localStorage.setting_redirect_nitter = "false";
});
$('.overlay_redirect_bibliogram_yes').click(function() {
$('.close_button').click();
window.open("https://"+server_setting_bibliogram+"/"+$(".overlay_redirect_bibliogram").data("path"),"_blank");
if($("#redirect_bibliogram_permanent")[0].checked) localStorage.setting_redirect_bibliogram = "true";
});
$('.overlay_redirect_bibliogram_no').click(function() {
$('.close_button').click();
window.open("https://www.instagram.com/"+$(".overlay_redirect_bibliogram").data("path"),"_blank");
if($("#redirect_bibliogram_permanent")[0].checked) localStorage.setting_redirect_bibliogram = "false";
});
$('.overlay_redirect_nofb_yes').click(function() {
$('.close_button').click();
window.open("https://nofb.pw/?p="+encodeURIComponent("https://www.facebook.com/"+$(".overlay_redirect_nofb").data("path")),"_blank");
if($("#redirect_nofb_permanent")[0].checked) localStorage.setting_redirect_nofb = "true";
});
$('.overlay_redirect_nofb_no').click(function() {
$('.close_button').click();
window.open("https://www.facebook.com/"+$(".overlay_redirect_nofb").data("path"),"_blank");
if($("#redirect_nofb_permanent")[0].checked) localStorage.setting_redirect_nofb = "false";
});
$('.overlay_rewrite_invidious_yes').click(function() {
$('.close_button').click();
submitStatusArray($(".overlay_rewrite_invidious").data("params"),$(".overlay_rewrite_invidious").data("callback"),"true",$(".overlay_rewrite_invidious").data("nitter"),$(".overlay_rewrite_invidious").data("bibliogram"),$(".overlay_rewrite_invidious").data("nofb"));
if($("#rewrite_invidious_permanent")[0].checked) localStorage.setting_rewrite_invidious = "true";
});
$('.overlay_rewrite_invidious_no').click(function() {
$('.close_button').click();
submitStatusArray($(".overlay_rewrite_invidious").data("params"),$(".overlay_rewrite_invidious").data("callback"),"false",$(".overlay_rewrite_invidious").data("nitter"),$(".overlay_rewrite_invidious").data("bibliogram"),$(".overlay_rewrite_invidious").data("nofb"));
if($("#rewrite_invidious_permanent")[0].checked) localStorage.setting_rewrite_invidious = "false";
});
$('.overlay_rewrite_nitter_yes').click(function() {
$('.close_button').click();
submitStatusArray($(".overlay_rewrite_nitter").data("params"),$(".overlay_rewrite_nitter").data("callback"),$(".overlay_rewrite_nitter").data("invidious"),"true",$(".overlay_rewrite_nitter").data("bibliogram"),$(".overlay_rewrite_nitter").data("bibliogram"));
if($("#rewrite_nitter_permanent")[0].checked) localStorage.setting_rewrite_nitter = "true";
});
$('.overlay_rewrite_nitter_no').click(function() {
$('.close_button').click();
submitStatusArray($(".overlay_rewrite_nitter").data("params"),$(".overlay_rewrite_nitter").data("callback"),$(".overlay_rewrite_nitter").data("invidious"),"false",$(".overlay_rewrite_nitter").data("bibliogram"),$(".overlay_rewrite_nitter").data("bibliogram"));
if($("#rewrite_nitter_permanent")[0].checked) localStorage.setting_rewrite_nitter = "false";
});
$('.overlay_rewrite_bibliogram_yes').click(function() {
$('.close_button').click();
submitStatusArray($(".overlay_rewrite_bibliogram").data("params"),$(".overlay_rewrite_bibliogram").data("callback"),$(".overlay_rewrite_bibliogram").data("invidious"),$(".overlay_rewrite_bibliogram").data("nitter"),"true",$(".overlay_rewrite_bibliogram").data("nofb"));
if($("#rewrite_bibliogram_permanent")[0].checked) localStorage.setting_rewrite_bibliogram = "true";
});
$('.overlay_rewrite_bibliogram_no').click(function() {
$('.close_button').click();
submitStatusArray($(".overlay_rewrite_bibliogram").data("params"),$(".overlay_rewrite_bibliogram").data("callback"),$(".overlay_rewrite_bibliogram").data("invidious"),$(".overlay_rewrite_bibliogram").data("nitter"),"false",$(".overlay_rewrite_bibliogram").data("nofb"));
if($("#rewrite_bibliogram_permanent")[0].checked) localStorage.setting_rewrite_bibliogram = "false";
});
$('.overlay_rewrite_nofb_yes').click(function() {
$('.close_button').click();
submitStatusArray($(".overlay_rewrite_nofb").data("params"),$(".overlay_rewrite_nofb").data("callback"),$(".overlay_rewrite_nofb").data("invidious"),$(".overlay_rewrite_nofb").data("nitter"),$(".overlay_rewrite_nofb").data("bibliogram"),"true");
if($("#rewrite_nofb_permanent")[0].checked) localStorage.setting_rewrite_nofb = "true";
});
$('.overlay_rewrite_nofb_no').click(function() {
$('.close_button').click();
submitStatusArray($(".overlay_rewrite_nofb").data("params"),$(".overlay_rewrite_nofb").data("callback"),$(".overlay_rewrite_nofb").data("invidious"),$(".overlay_rewrite_nofb").data("nitter"),$(".overlay_rewrite_nofb").data("bibliogram"),"false");
if($("#rewrite_nofb_permanent")[0].checked) localStorage.setting_rewrite_nofb = "false";
});
if($("#js-overlay_content_wrap").hasClass("view")) $(document.body).css("overflow-y","hidden");
$("#js-overlay_content_wrap").attrchange(function(attr) {
if(attr == "class" && $("#js-overlay_content_wrap").hasClass("view")) $(document.body).css("overflow-y","hidden");
@ -1999,7 +2275,6 @@ $(".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");
});
@ -2023,9 +2298,44 @@ $(".poll_"+poll_id).remove();
}
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) {
e.stopPropagation();
window.open($(this).data("url"),"_blank");
const ytcom = $(this).data("url").match(/https?:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z\d_-]+)/);
const ytbe = $(this).data("url").match(/https?:\/\/(www\.)?youtu\.be\/([a-zA-Z\d_-]+)/);
const twcom = $(this).data("url").match(/https?:\/\/(www\.)?twitter\.com\/(.*)/);
const igpost = $(this).data("url").match(/https?:\/\/(www\.)?instagram\.com\/p\/([a-zA-Z\d_-]+)/);
const igacc = $(this).data("url").match(/https?:\/\/(www\.)?instagram\.com\/([a-zA-Z\d_\.]+)/);
const fbcom = $(this).data("url").match(/https?:\/\/(www\.)?facebook\.com\/(.*)/);
if(ytcom) openVideo(ytcom[2]);
else if(ytbe) openVideo(ytbe[2]);
else if(twcom) openNitter(twcom[2]);
else if(igpost) openBibliogram("p/"+igpost[2]);
else if(igacc) openBibliogram("u/"+igacc[2]);
else if(fbcom) openNoFB(fbcom[2]);
else window.open($(this).data("url"),"_blank");
});
$(document).on('focus','.status_textarea textarea,.status_top .status_spoiler',function(e) {
global_focus_textfield = $(this).data("random");
@ -2104,10 +2414,10 @@ $("#search_form").focus();
"disable_in_input":true,
'keycode':191
});
shortcut.add("Meta+Enter",function() {
shortcut.add("Meta+Enter",function(e) {
$(".active_submit_button").click();
});
shortcut.add("Ctrl+Enter",function() {
shortcut.add("Ctrl+Enter",function(e) {
$(".active_submit_button").click();
});
shortcut.add(".",function() {
@ -2149,3 +2459,16 @@ shortcut.add("esc",function() {
$("#js-overlay_content_wrap").click();
});
});
$(document).ready(function() {
api.get("announcements",function(data) {
if(data.length > 0) {
$(".article_wrap").before($("<div>").addClass("announcement_wrap"));
for(var i=0;i<data.length;i++) {
$(".announcement_wrap").append(announcement_template(data[i]));
}
replace_emoji();
replaceInternalLink();
$(".announcement").each(function() {enableReactionPicker(this)});
}
});
});

0
assets/js/halcyon/halcyonWorker.js Normal file → Executable file
View File

0
assets/js/jquery-cookie/MIT-LICENSE.txt Normal file → Executable file
View File

0
assets/js/jquery-cookie/src/jquery.cookie.js Normal file → Executable file
View File

0
assets/js/jquery/LICENSE.txt Normal file → Executable file
View File

0
assets/js/jquery/jquery.min.js vendored Normal file → Executable file
View File

0
assets/js/mastodon.js/LICENSE Normal file → Executable file
View File

70
assets/js/mastodon.js/mastodon.js Normal file → Executable file
View File

@ -13,13 +13,15 @@ getConfig: function(key) {
return config[key];
},
get: function (endpoint) {
var queryData,callback,queryStringAppend = "?";
var queryData,callback,failback,queryStringAppend = "?";
if (typeof arguments[1] === "function") {
queryData = {};
callback = arguments[1];
if(arguments[2]) failback = arguments[2];
} else {
queryData = arguments[1];
callback = arguments[2];
if(arguments[3]) failback = arguments[3];
}
if(typeof queryData == "string") {
queryStringAppend = queryData;
@ -49,6 +51,7 @@ error: function(xhr, textStatus, errorThrown) {
if(xhr.readyState == 0) {
api.get(endpoint,queryStringAppend,callback);
}
else if(typeof failback == "function") failback();
else {
if(xhr.responseText.length > 0) {
putMessage(`[${xhr.status}] ${xhr.responseJSON['error']}`);
@ -215,14 +218,14 @@ postData = arguments[1];
callback = arguments[2];
}
$.ajax({
url: apiBase + endpoint,
url: config.instance + "/api/v2/" + endpoint,
type: "POST",
data: postData,
contentType: false,
processData: false,
headers: {"Authorization": "Bearer " + config.api_user_token},
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)
},
error: function(xhr, textStatus, errorThrown) {
@ -326,25 +329,68 @@ location.href = "/logout";
}
});
},
search: function (queryString) {
var queryData,callback,failback,queryStringAppend = "?";
if (typeof arguments[1] === "function") {
queryData = {};
callback = arguments[1];
if(arguments[2]) failback = arguments[2];
} else {
queryData = arguments[1];
callback = arguments[2];
if(arguments[3]) failback = arguments[3];
}
if(typeof queryData == "string") {
queryStringAppend = queryData;
}
else {
for (var i in queryData) {
if (queryData.hasOwnProperty(i)) {
if (typeof queryData[i] === "string") {
queryStringAppend += queryData[i] + "&";
} else if (typeof queryData[i] === "object") {
queryStringAppend += queryData[i].name + "="+ queryData[i].data + "&";
}
}
}
}
var xquerydata = queryData;
$.ajax({
url: config.instance + "/api/v2/search?" + queryString + queryStringAppend,
type: "GET",
headers: {"Authorization": "Bearer " + config.api_user_token},
success: function(data, textStatus, xhr) {
console.log("Successful GET API request to " +config.instance + "/api/v2/search");
responce_headers = xhr.getAllResponseHeaders();
callback(data,textStatus);
},
error: function(xhr, textStatus, errorThrown) {
if(xhr.readyState == 0) {
api.search(queryString,queryStringAppend,callback);
}
else if(typeof failback == "function") failback();
else {
if(xhr.responseText.length > 0) {
putMessage(`[${xhr.status}] ${xhr.responseJSON['error']}`);
if ( xhr.status === 401 ) {
location.href = "/logout";
}
}
}
}
});
},
stream: function (streamType, onData) {
var es = new WebSocket("wss://" + apiBase.substr(8) + "streaming?access_token=" + config.api_user_token + "&stream=" + streamType);
var es = new WebSocket("wss://" + apiBase.substr(8) + "streaming/?access_token=" + config.api_user_token + "&stream=" + streamType);
var listener = function(event) {
console.log("Got Data from Stream " + streamType);
if(event.data.length != 0) {
event = JSON.parse(event.data);
if(event.event == "filters_changed") {
api.get("filters",function(data) {
localStorage.setItem("current_filters",JSON.stringify(data));
current_filters = data;
});
}
else {
if(!Number.isInteger(JSON.parse(event.payload))) {
event.payload = JSON.parse(event.payload);
}
onData(event);
}
}
};
es.onmessage = listener;
es.onclose = function(event) {

0
assets/js/player/LICENSE-audio.txt Normal file → Executable file
View File

0
assets/js/player/LICENSE-soundmanager.txt Normal file → Executable file
View File

0
assets/js/player/LICENSE-youplay.txt Normal file → Executable file
View File

0
assets/js/player/audio.js Normal file → Executable file
View File

0
assets/js/player/soundmanager.js Normal file → Executable file
View File

0
assets/js/player/youplay.js Normal file → Executable file
View File

0
assets/js/pomo/LICENSE.txt Normal file → Executable file
View File

0
assets/js/pomo/pomo.js Normal file → Executable file
View File

0
assets/js/replace_emoji.js Normal file → Executable file
View File

0
assets/js/shortcut.js Normal file → Executable file
View File

0
assets/js/twemoji/LICENSE Normal file → Executable file
View File

0
assets/js/twemoji/twemoji.min.js vendored Normal file → Executable file
View File

0
authorize/.htaccess Normal file → Executable file
View File

0
authorize/mastodon-api/LICENSE Normal file → Executable file
View File

0
authorize/mastodon-api/mastodon.php Normal file → Executable file
View File

0
authorize/mastodon.php Normal file → Executable file
View File

43
bookmarks.php Executable file
View File

@ -0,0 +1,43 @@
<?php include ('header.php'); ?>
<main id="main" class="home">
<div class="article_wrap">
<aside class="left_column">
<?php include dirname(__FILE__).('/widgets/side_current_user.php'); ?>
</aside>
<article class="center_column">
<header class="timeline_header">
<ul class="header_items">
<li class="item toots view">
<a href="#">
<?=_('All')?>
</a>
</li>
</ul>
</header>
<div id="js-stream_update">
<button>
View <span></span> new Toots
</button>
</div>
<ul id="js-timeline" class="timeline">
</ul>
<footer id="js-timeline_footer" class="timeline_footer">
<i class="fa fa-spin fa-circle-o-notch" aria-hidden="true"></i>
</footer>
</article>
<aside class="right_column">
<section class="side_widgets_wrap">
<?php include dirname(__FILE__).('/widgets/side_who_to_follow.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_trending.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_firefox_addon.php'); ?>
</section>
<?php include dirname(__FILE__).('/widgets/side_footer.php'); ?>
</aside>
</div>
</main>
<script>
current_file = location.pathname;
setTimeline("bookmarks");
$('title').text('Halcyon / Bookmarks');
</script>
<?php include ('footer.php'); ?>

20
config/config.ini.sample Normal file → Executable file
View File

@ -1,23 +1,33 @@
; Register App Settings
; The URL Unshortener automatically parses links to URL Shorteners like bit.ly and displays the long version so that the user knows where a link goes
[App]
api_client_name = Your application name
api_client_website = https://example.com/
who_to_follow_provider = https://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-osa-api.cgi?{{host}}+{{user}}
who_to_follow_provider = https://vinayaka.tsia.de/cgi-bin/vinayaka-user-match-osa-api.cgi?{{host}}+{{user}}
default_language = en_US
debug_mode = false
url_unshortener = true
; Media embed settings
; YouPlay resolves YouTube MP4s on your server and sends this link to the user for privacy-friendly watching
; Vimeo embeds work in the same way as YouPlay embeds here because the official players contain too much spyware
; YouPlay Fallback uses a proprietary API of https://unblockvideos.com and can be used if your own server IP has been blocked by Google
; Invidous is a external service to watch YouTube videos in a privacy-friendly way - Halcyon can automatically rewrite links to a instance you can set here
; Nitter is a external service to view Twitter contents in a privacy-friendly way - Halcyon can automatically rewrite links to a instance you can set here
; Bibliogram is a external service to view Instagram contents in a privacy-friendly way - Halcyon can automatically rewrite links to a instance you can set here
[Media]
youplay = true
vimeo = true
youplay_fallback = true
invidious = invidious.snopyta.org
nitter = nitter.13ad.de
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
; 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]
type = socks5
domain = 127.0.0.1
port = 9050
type = none
domain =
port =
username =
password =

0
config/footerlinks.txt.sample Normal file → Executable file
View File

0
config/imprint.txt.sample Normal file → Executable file
View File

0
config/privacy.txt Normal file → Executable file
View File

0
config/terms.txt Normal file → Executable file
View File

0
data/.htaccess Normal file → Executable file
View File

4
direct.php Normal file → Executable file
View File

@ -28,6 +28,8 @@ View <span></span> new Toots
<aside class="right_column">
<section class="side_widgets_wrap">
<?php include dirname(__FILE__).('/widgets/side_who_to_follow.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_trending.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_firefox_addon.php'); ?>
</section>
<?php include dirname(__FILE__).('/widgets/side_footer.php'); ?>
</aside>
@ -35,7 +37,7 @@ View <span></span> new Toots
</main>
<script>
current_file = location.pathname;
setTimeline("timelines/direct",[],"true");
setDirectTimeline();
$('title').text('Halcyon / Direct');
</script>
<?php include ('footer.php'); ?>

0
docker/.dockerignore Normal file → Executable file
View File

0
docker/.gitignore vendored Normal file → Executable file
View File

0
docker/Dockerfile Normal file → Executable file
View File

0
docker/README.md Normal file → Executable file
View File

0
docker/etc/supervisord.conf Normal file → Executable file
View File

0
docker/locale/default Normal file → Executable file
View File

3
docker/locale/locale.gen Normal file → Executable file
View File

@ -10,4 +10,5 @@ cs_CZ.UTF-8 UTF-8
fr_FR.UTF-8 UTF-8
nl_NL.UTF-8 UTF-8
ca_ES.UTF-8 UTF-8
ar_DZ.UTF-8 UTF-8
ar_DZ.UTF-8 UTF-8
es_ES.UTF-8 UTF-8

0
docker/usr/local/etc/php-fpm.d/50-clear-env.conf Normal file → Executable file
View File

0
docker/usr/local/etc/php-fpm.d/50-no-access-log.conf Normal file → Executable file
View File

0
docker/usr/local/etc/php-fpm.d/50-socket.conf Normal file → Executable file
View File

0
docker/usr/local/etc/php/conf.d/00-best-practices.ini Normal file → Executable file
View File

0
docker/usr/local/etc/php/conf.d/00-performance.ini Normal file → Executable file
View File

0
docker/usr/local/etc/php/conf.d/00-security.ini Normal file → Executable file
View File

2
federated.php Normal file → Executable file
View File

@ -22,6 +22,8 @@
<aside class="right_column">
<section class="side_widgets_wrap">
<?php include dirname(__FILE__).('/widgets/side_who_to_follow.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_trending.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_firefox_addon.php'); ?>
</section>
<?php include dirname(__FILE__).('/widgets/side_footer.php'); ?>
</aside>

8
footer.php Normal file → Executable file
View File

@ -15,6 +15,14 @@ include dirname(__FILE__).('/widgets/overlay_copy_link.php');
include dirname(__FILE__).('/widgets/overlay_confirm.php');
include dirname(__FILE__).('/widgets/overlay_prompt.php');
include dirname(__FILE__).('/widgets/overlay_addlist.php');
include dirname(__FILE__).('/widgets/overlay_redirect_invidious.php');
include dirname(__FILE__).('/widgets/overlay_redirect_nitter.php');
include dirname(__FILE__).('/widgets/overlay_redirect_bibliogram.php');
include dirname(__FILE__).('/widgets/overlay_redirect_nofb.php');
include dirname(__FILE__).('/widgets/overlay_rewrite_invidious.php');
include dirname(__FILE__).('/widgets/overlay_rewrite_nitter.php');
include dirname(__FILE__).('/widgets/overlay_rewrite_bibliogram.php');
include dirname(__FILE__).('/widgets/overlay_rewrite_nofb.php');
if($_SERVER["REQUEST_URI"] == "/settings/filters") include dirname(__FILE__).('/widgets/overlay_filter.php');
?>
</div>

9
header.php Normal file → Executable file
View File

@ -73,6 +73,10 @@ resetApp();
}
server_setting_youplay = <?=$config["Media"]["youplay"] ? "true" : "false"?>;
server_setting_vimeo = <?=$config["Media"]["vimeo"] ? "true" : "false"?>;
server_setting_unshorten = <?=$config["App"]["url_unshortener"] ? "true" : "false"?>;
server_setting_invidious = <?=$config["Media"]["invidious"] ? "'".$config["Media"]["invidious"]."'" : "'invidiou.sh'"?>;
server_setting_nitter = <?=$config["Media"]["nitter"] ? "'".$config["Media"]["nitter"]."'" : "'nitter.13ad.de'"?>;
server_setting_bibliogram = <?=$config["Media"]["bibliogram"] ? "'".$config["Media"]["bibliogram"]."'" : "'bibliogram.dsrev.ru'"?>;
</script>
</head>
<body>
@ -121,7 +125,7 @@ server_setting_vimeo = <?=$config["Media"]["vimeo"] ? "true" : "false"?>;
<ul class="header_nav_list">
<li class="header_nav_item search_form_wrap">
<form class="search_form" action="/search" method="GET">
<input id="search_form" class="search_form_input" placeholder="<?=_('Search Mastodon')?>" type="text" name="q" accesskey="/">
<input id="search_form" class="search_form_input" placeholder="<?=_('Search Mastodon')?>" type="text" name="q" accesskey="/" autocomplete="off">
<span class="search_form_submit">
<button type="submit">
<i class="fa fa-fw fa-search"></i>
@ -150,6 +154,9 @@ server_setting_vimeo = <?=$config["Media"]["vimeo"] ? "true" : "false"?>;
<a href="/direct"><?=_('Direct')?></a>
</li>
<li>
<a href="/bookmarks"><?=_('Bookmarks')?></a>
</li>
<li>
<a href="/settings"><?=_('Settings')?></a>
</li>
<li>

2
home.php Normal file → Executable file
View File

@ -22,6 +22,8 @@ View <span></span> new Toots
<aside class="right_column">
<section class="side_widgets_wrap">
<?php include dirname(__FILE__).('/widgets/side_who_to_follow.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_trending.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_firefox_addon.php'); ?>
</section>
<?php include dirname(__FILE__).('/widgets/side_footer.php'); ?>
</aside>

0
index.php Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More