From 068546b84ea820ea250d7d702c7e4628e2a3ee56 Mon Sep 17 00:00:00 2001 From: nipos Date: Fri, 1 Mar 2019 16:17:03 +0100 Subject: [PATCH] Switch between pictures,full-height pictures in timeline,remove duplicated threads,many small bugfixes --- README.md | 1 + assets/css/style.css | 24 +++++++- assets/js/halcyon/halcyonSettings.js | 26 ++++++++ assets/js/halcyon/halcyonTemplates.js | 39 ++++++++---- assets/js/halcyon/halcyonUI.js | 85 +++++++++++++++++++-------- authorize/mastodon.php | 3 +- login/auth.php | 2 + login/login.php | 2 +- media/ytclass.php | 7 ++- settings_appearance.php | 22 +++++++ version.txt | 2 +- 11 files changed, 171 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 7491a8c..e185ef2 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ We moved our instances list to a wiki page: https://notabug.org/halcyon-suite/ha or read our new documentation pages to install it manually: https://www.halcyon.social/documentation.php?page=install ## Blog +- Release of Version 2.2.4 - Easily switch between pictures in overlay,show pictures in full height in timeline,duplicated threads removed,many smaller bugfixes - Release of Version 2.2.3 - Fixed login with Pleroma,fixed compatibility with Pawoo (older Mastodon),added support for prefers-color-scheme,some more fixes - Our new information website [halcyon.social](https://www.halcyon.social) came online - Release of Version 2.2.2 - Fix autocomplete,fix double scrollbars in overlay,add emojis at cursor position,confirm when closing compose window,add czech translation diff --git a/assets/css/style.css b/assets/css/style.css index 8bcdf78..ad401b0 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -872,6 +872,10 @@ position: relative; box-sizing: border-box; border: 1px solid #DCDFE1; } +.media_views.media_full_height { +height:auto; +min-height:336px; +} .media_views .media_attachment { overflow: hidden; width: 100%; @@ -955,6 +959,21 @@ height: calc( 100% / 3 ); .media_views[media_length="4"] .media_attachments_right .media_attachment[mediacount="3"] { padding-bottom: 0; } +.media_backward,.media_forward { +color:#CCCCCC; +position:absolute; +top:50%; +cursor:pointer; +} +.media_backward { +left:-50px; +} +.media_forward { +right:-50px; +} +.media_backward:hover,.media_forward:hover { +color:#FFFFFF; +} .timeline .notice_entry { padding: 10px 12px 10px 70px; font-size: 14px; @@ -2258,7 +2277,6 @@ padding: 12px; .toot_entry.descendants_status .toot_entry_body::after { content: ""; display: block; -border: 2px solid #76BFEC; position: absolute; border-radius: 2px; position: absolute; @@ -2266,6 +2284,10 @@ left: 62px; height: calc(100% - 57px); top: 68px; } +.toot_entry.ancestors_status .toot_entry_body::after, +.toot_entry.descendants_status.direct_answer .toot_entry_body::after { +border: 2px solid #76BFEC; +} .toot_entry.ancestors_status.default_padding .toot_entry_body::after, .toot_entry.descendants_status.default_padding .toot_entry_body::after { left: 35px; diff --git a/assets/js/halcyon/halcyonSettings.js b/assets/js/halcyon/halcyonSettings.js index 227253d..c8e7479 100644 --- a/assets/js/halcyon/halcyonSettings.js +++ b/assets/js/halcyon/halcyonSettings.js @@ -207,6 +207,12 @@ $("#setting_show_content_warning")[0].checked = true; if(localStorage.setting_show_nsfw == "true") { $("#setting_show_nsfw")[0].checked = true; } +if(localStorage.setting_full_height == "true") { +$("#setting_full_height")[0].checked = true; +} +if(localStorage.setting_thread_view == "true") { +$("#setting_thread_view")[0].checked = true; +} }); $(document).on('change',".post_streaming_wrap input[name='post_streaming']:checked", function(e) { localStorage.setItem("setting_post_stream", $(this).val()); @@ -330,6 +336,26 @@ localStorage.setItem("setting_show_nsfw","false"); putMessage(__("NSFW content hidden")); } }); +$("#setting_full_height").change(function() { +if(this.checked) { +localStorage.setItem("setting_full_height","true"); +putMessage(__("Pictures shown in full height")); +} +else { +localStorage.setItem("setting_full_height","false"); +putMessage(__("Pictures shown in default height")); +} +}); +$("#setting_thread_view").change(function() { +if(this.checked) { +localStorage.setItem("setting_thread_view","true"); +putMessage(__("Threads shown in thread view")); +} +else { +localStorage.setItem("setting_thread_view","false"); +putMessage(__("Threads shown in chronological order")); +} +}); } else if(window.location.pathname == "/settings/filters") { $('#js-settings_nav_filters').toggleClass('view'); diff --git a/assets/js/halcyon/halcyonTemplates.js b/assets/js/halcyon/halcyonTemplates.js index cfc3045..d04eac6 100644 --- a/assets/js/halcyon/halcyonTemplates.js +++ b/assets/js/halcyon/halcyonTemplates.js @@ -1,18 +1,24 @@ function mediaattachments_template(status) { let media_views = ""; var border = ""; +var mvfullheight = ""; +var dsplength = status.media_attachments.length; if(status.media_attachments[0].remote_url != null) { status.media_attachments[0].url = status.media_attachments[0].remote_url; } if(status.media_attachments[0].type === "video" && localStorage.setting_play_video != "false") border = ' style="border:0;border-radius:0"'; +if(localStorage.setting_full_height == "true") { +mvfullheight = " media_full_height"; +dsplength = "1"; +} if(status.media_attachments[0].url === "/files/original/missing.png") { return ""; } else if(!status.sensitive || localStorage.setting_show_nsfw == "true") { -media_views = `
`; +media_views = `
`; } else { -media_views = `
+media_views = `
${__('Sensitive content')} ${__('Click to view')} @@ -1202,7 +1208,7 @@ const html=$(`
- + ${status.reblog.account.display_name} @@ -1341,21 +1347,34 @@ html.find(".toot_article").append(media_views); return html } } -function media_template(status, mediaURL) { -if ( !status ) { +function media_template(status,media) { +if(!status) { const html = (`
- +
`); return $(html) -} else { +} +else { +var pictures = new Array; +var hidebackward = ""; +var hideforward =""; +for(var i=0;i +html = (`
- + + +
${status_template} diff --git a/assets/js/halcyon/halcyonUI.js b/assets/js/halcyon/halcyonUI.js index fe4ff7c..544d4c9 100644 --- a/assets/js/halcyon/halcyonUI.js +++ b/assets/js/halcyon/halcyonUI.js @@ -281,7 +281,7 @@ if(load_options === undefined) { var load_options = []; } api.get(level, load_options, function(statuses) { -let reply_sources = {}; +timeline_hide_status = new Array; for(let i in statuses) { var filterstatus = false; for(var a=0;a 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 .character_count').html(current_instance_charlimit); +const textCount = $('#single_reply_status_form textarea').val().length + $('#single_reply_status_form .status_spoiler').val().length; +let textLen = (current_instance_charlimit - textCount); +$('#single_reply_status_form .character_count').html(textLen); $('#single_reply_status_emoji').lsxEmojiPicker({ closeOnSelect:true, twemoji:!checkEmojiSupport(), @@ -2126,6 +2149,18 @@ $("#js-overlay_content_wrap").attrchange(function(attr) { if(attr == "class" && $("#js-overlay_content_wrap").hasClass("view")) $(document.body).css("overflow-y","hidden"); else $(document.body).css("overflow-y","auto"); }); +$(document).on("click",".media_detail .media_backward",function() { +$(".media_detail").attr("cid",$(".media_detail").attr("cid")-1); +if($(".media_detail").attr("cid") == 0) $(".media_detail .media_backward").fadeOut(); +$(".media_detail .media_forward").fadeIn(); +$(".media_detail .media_box img").attr("src",JSON.parse($(".media_detail").attr("pictures"))[$(".media_detail").attr("cid")]); +}); +$(document).on("click",".media_detail .media_forward",function() { +$(".media_detail").attr("cid",parseInt($(".media_detail").attr("cid"))+1); +if($(".media_detail").attr("cid") == JSON.parse($(".media_detail").attr("pictures")).length-1) $(".media_detail .media_forward").fadeOut(); +$(".media_detail .media_backward").fadeIn(); +$(".media_detail .media_box img").attr("src",JSON.parse($(".media_detail").attr("pictures"))[$(".media_detail").attr("cid")]); +}); shortcut.add("n",function() { $("#creat_status").click(); },{ diff --git a/authorize/mastodon.php b/authorize/mastodon.php index e3a7163..b6bdd53 100644 --- a/authorize/mastodon.php +++ b/authorize/mastodon.php @@ -19,7 +19,8 @@ $this->instances[$domain] = $res['html']; file_put_contents($this->datadir."/".substr($domain,8).".txt",json_encode(array("client_id" => $res['html']['client_id'],"client_secret" => $res['html']['client_secret']))); } else { -throw new Exception("Invalid instance"); +header("Location: /login/?cause=domain"); +die(); } } public function selectInstance($domain) { diff --git a/login/auth.php b/login/auth.php index 1372b10..cc55129 100644 --- a/login/auth.php +++ b/login/auth.php @@ -44,6 +44,8 @@ localStorage.setItem('setting_show_replies', 'true'); localStorage.setItem('setting_show_bots', 'true'); localStorage.setItem('setting_show_content_warning', 'false'); localStorage.setItem('setting_show_nsfw', 'false'); +localStorage.setItem('setting_full_height', 'false'); +localStorage.setItem('setting_thread_view', 'true'); localStorage.setItem('setting_compose_autocomplete', 'true'); localStorage.setItem('setting_play_gif','true'); localStorage.setItem('setting_play_video','true'); diff --git a/login/login.php b/login/login.php index 51693b6..086fbe8 100644 --- a/login/login.php +++ b/login/login.php @@ -209,7 +209,7 @@ var cause = " span').text('This instance does not exsist.'); +$('.session_aleart > span').text('This instance does not exist.'); } }); $(document).on('click','.login_form_main', function(e) { diff --git a/media/ytclass.php b/media/ytclass.php index 3646492..4b7c641 100644 --- a/media/ytclass.php +++ b/media/ytclass.php @@ -59,7 +59,7 @@ private $itag_ext = array( function __construct(){ $this->cache_dir = dirname(__FILE__).'/.cache'; $this->cookie_dir = sys_get_temp_dir(); -if(!file_exists($this->cache_dir)) { +if(!file_exists($this->cache_dir) && is_writeable(dirname(__FILE__))) { mkdir($this->cache_dir,0755); } } @@ -95,7 +95,7 @@ $vInfo['ChannelName'] = $videoData['author']; $vInfo['ChannelId'] = $videoData['ucid']; $vInfo['Thumbnail'] = str_replace('default', 'maxresdefault', $videoData['thumbnail_url']); $vInfo['Duration'] = $videoData['length_seconds']; -$vInfo['Rating'] = $videoData['avg_rating']; +//$vInfo['Rating'] = $videoData['avg_rating']; } if (isset($videoData['url_encoded_fmt_stream_map']) && isset($videoData['adaptive_fmts'])) { $draft1 = explode(',',$videoData['url_encoded_fmt_stream_map']); @@ -177,6 +177,7 @@ return unserialize(file_get_contents($cache_player)); $js_code = $this->curlGet($playerLink); $instructions = $this->sig_js_decode($js_code); if($instructions){ +if(file_exists($this->cache_dir) && is_writeable($this->cache_dir)) file_put_contents($cache_player, serialize($instructions)); return $instructions; } @@ -252,4 +253,4 @@ return $r[0]; } return ''; } -} \ No newline at end of file +} diff --git a/settings_appearance.php b/settings_appearance.php index a339ee7..5ed6a3b 100644 --- a/settings_appearance.php +++ b/settings_appearance.php @@ -101,6 +101,28 @@
+
+

+
+
+
+ +
+ +
+
+
+
+

+
+
+
+ +
+ +
+
+
-
diff --git a/version.txt b/version.txt index 5859406..530cdd9 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.2.3 +2.2.4