Improved copy link function,better RexExp for emojicodes,hashtag streaming,delete event now supported

This commit is contained in:
nipos 2018-07-20 14:27:29 +02:00
parent 2b8c2b4e33
commit eaf77f5c45
8 changed files with 48 additions and 16 deletions

View File

@ -10,7 +10,7 @@ Follow our Mastodon account and never miss an important update: [@halcyon@social
## Instances
These instances are publicly accessible and usable by everyone, no matter which Mastodon instance you use.
- https://itter.photog.social - 1.2.4
- https://itter.photog.social - 1.2.5
- https://halcyon.uelfte.club - 1.2.4
- https://social.dev-wiki.de - 1.2.2
- https://halcyon.toromino.de - 1.2.2
@ -21,6 +21,7 @@ These instances are publicly accessible and usable by everyone, no matter which
You have your own Halcyon instance and want it to be listed here? Create an issue with the link and we will add it to the list.
## Blog
- Release of Version 1.2.5 - Copy links with one click,emojicodes now always detected,streaming in hashtag search,delete event now supported
- Release of Version 1.2.4 - Updated Twemoji,custom emojis in names and bios,links to profiles in pleroma now always work,pinned posts now supported
- Release of Version 1.2.3 - All emojis do now work,fixed some bugs in the Nginx example config,fixed Windows-only design bug,improved text field performance
- Release of Version 1.2.2 - Added an emoji picker,improved performance (emoji rendering),desktop notifications on notifications page work now

View File

@ -123,27 +123,27 @@ var posted_time_original = posted_time,
posted_time = getConversionedDate(null, posted_time_original).getTime(),
elapsedTime = Math.ceil((current_time-posted_time)/1000);
if (elapsedTime < 60) {
const datetime ="" + elapsedTime + "s";
const datetime ="・" + elapsedTime + "s";
return datetime;
}
else if (elapsedTime < 120) {
const datetime ="1m";
const datetime ="・1m";
return datetime;
}
else if (elapsedTime < (60*60)) {
const datetime ="" + (Math.floor(elapsedTime / 60) < 10 ? " " : "") + Math.floor(elapsedTime / 60) + "m";
const datetime ="・" + (Math.floor(elapsedTime / 60) < 10 ? " " : "") + Math.floor(elapsedTime / 60) + "m";
return datetime;
}
else if (elapsedTime < (120*60)) {
const datetime ="1h";
const datetime ="・1h";
return datetime;
}
else if (elapsedTime < (24*60*60)) {
const datetime ="" + (Math.floor(elapsedTime / 3600) < 10 ? " " : "") + Math.floor(elapsedTime / 3600) + "h";
const datetime ="・" + (Math.floor(elapsedTime / 3600) < 10 ? " " : "") + Math.floor(elapsedTime / 3600) + "h";
return datetime;
}
else {
const datetime ="" + calendar[posted_time_original.getMonth()] + " " + posted_time_original.getDate();
const datetime ="・" + calendar[posted_time_original.getMonth()] + " " + posted_time_original.getDate();
return datetime;
}
}
@ -382,6 +382,6 @@ follow_loaded++;
}
function checkEmojiSupport() {
var ctx = document.createElement("canvas").getContext("2d");
ctx.fillText("😗",-2,4);
ctx.fillText("😗",-2,4);
return ctx.getImageData(0,0,1,1).data[3] > 0;
}

View File

@ -144,7 +144,7 @@ ${status.account.display_name}
</button>
<div class="expand_menu invisible disallow_select">
<ul>
<li><a class="copylink_button" url="${status.url}" >Copy link to Toot</a></li>
<li><a class="copylink_button" url="${status.url}">Copy link to Toot</a></li>
<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>
${own_toot_buttons}

View File

@ -235,16 +235,22 @@ load_options.shift();
};
});
$(function() {
if ( level === "timelines/home" ) {
if(level === "timelines/home") {
var streamscope = "user",
scope = "home";
} else if ( level === "timelines/public" & load_options.length) {
}
else if(level === "timelines/public" & load_options.length) {
var streamscope = "public:local",
scope = "local";
} else if ( level === "timelines/public" & !load_options.length) {
}
else if(level === "timelines/public" & !load_options.length) {
var streamscope = "public",
scope = "federated";
}
else if(level.indexOf("timelines/tag/") != -1) {
var streamscope = "hashtag&tag="+level.substr(14),
scope = "";
}
let statuses = [];
const original_title = $('title').text();
if(streamscope) {
@ -259,6 +265,9 @@ statuses.unshift(userstream.payload);
$('#js-stream_update > button > span').text(statuses.length);
$('title').text("("+statuses.length+") "+original_title);
$('#header .header_nav_list .'+scope+'_badge').removeClass('invisible');
}
else if(userstream.event === "delete") {
}
}
}
@ -1329,6 +1338,24 @@ media_array.unshift(postMedia.id);
})
$(function() {
$(document).on('click','.copylink_button', function(e) {
if(ClipboardJS.isSupported()) {
var cbelem = $("<button>").attr("data-clipboard-text",$(this).attr("url"));
var clipboard = new ClipboardJS(cbelem[0]);
clipboard.on('success',function(e) {
putMessage("Link successfully copied!");
e.clearSelection();
});
clipboard.on('error',function(e) {
$("#js-overlay_content_wrap .temporary_object").empty();
$('#js-overlay_content_wrap').addClass('view');
$('#js-overlay_content_wrap').addClass('black_08');
$('.overlay_copy_link').removeClass('invisible');
$('.overlay_copy_link_form input').val($(this).attr('url'));
return false;
});
cbelem.click();
}
else {
e.stopPropagation();
$("#js-overlay_content_wrap .temporary_object").empty();
$('#js-overlay_content_wrap').addClass('view');
@ -1336,6 +1363,7 @@ $('#js-overlay_content_wrap').addClass('black_08');
$('.overlay_copy_link').removeClass('invisible');
$('.overlay_copy_link_form input').val($(this).attr('url'));
return false;
}
});
})
$(function() {

View File

@ -294,8 +294,10 @@ onData(event);
}
};
es.onmessage = listener;
es.onclose = function() {
es.onclose = function(event) {
if(event.target.readyState == 0) {
api.stream(streamType,onData);
}
};
}
};

View File

@ -1492,7 +1492,7 @@ const emoji_dict = {
};
function replace_emoji() {
$('.emoji_poss').each(function(){
const emojis = $(this).html().match(/(:.+?:)|✅/g);
const emojis = $(this).html().match(/(:[a-zA-Z_-]+?:)|✅/g);
for(let i in emojis) {
var emoji = emojis[i].replace(/-/g,"_");
if(emoji_dict[emoji.substr(1,emoji.length-2)]) {
@ -1505,7 +1505,7 @@ $(this).removeClass('emoji_poss');
});
}
function replaced_emoji_return(original) {
const emojis = original.match(/(:.+?:)/g);
const emojis = original.match(/(:[a-zA-Z_-]+?:)/g);
for(let i in emojis) {
var emoji = emojis[i].replace(/-/g,"_");
if(emoji_dict[emoji.substr(1,emoji.length-2)]) {

View File

@ -25,6 +25,7 @@ error_reporting(E_ALL);
<script src="/assets/js/halcyon/halcyonTemplates.js"></script>
<script src="/assets/js/halcyon/halcyonUI.js"></script>
<script src="//cdn.staticfile.org/twemoji/11.0.0/2/twemoji.min.js"></script>
<script src="//cdn.staticfile.org/clipboard.js/2.0.1/clipboard.min.js"></script>
<script>
if(!localStorage.getItem("current_id") | !localStorage.getItem("current_instance") | !localStorage.getItem("current_authtoken")) {
location.href = "/login";

View File

@ -1 +1 @@
1.2.4
1.2.5