Added filters,filters for all bots and added a icon for bots

This commit is contained in:
nipos 2018-11-25 19:14:16 +01:00
parent 497d735f0c
commit 04ac8d810e
20 changed files with 662 additions and 158 deletions

View File

@ -52,6 +52,7 @@ RewriteBase /settings
RewriteRule ^settings/?$ settings_general\.php [NC,L]
RewriteRule ^settings/profile/?$ settings_profile\.php [NC,L]
RewriteRule ^settings/appearance/?$ settings_appearance\.php [NC,L]
RewriteRule ^settings/filters/?$ settings_filters\.php [NC,L]
# User
RewriteBase /

View File

@ -95,6 +95,10 @@ r ^/settings/appearance/?$
to /settings_appearance.php
}
rewrite {
r ^/settings/filters/?$
to /settings_filters.php
}
rewrite {
r ^/@(.+)@(.+).([a-z]+)/?$
to /user.php?user=@{1}@{2}.{3}
}

View File

@ -25,6 +25,7 @@ We moved our instances list to a wiki page: https://notabug.org/halcyon-suite/ha
or read our new wiki pages to install it manually: https://notabug.org/halcyon-suite/halcyon/wiki
## Blog
- Release of Version 2.1.5 - Added support for filter,added possibility to filter all bots,it's now easier to detect bots
- Release of Version 2.1.4 - Added custom profile fields,verified links,custom profile link settings and improved regular expressions for links
- Release of Version 2.1.3 - Added a autocomplete feature for usernames,hashtags and emojis,fixed a bug in the emoji picker (didn't open sometimes)
- Release of Version 2.1.2 - Added toot to @someone button to profiles,remove blocked and muted people from who to follow,improved German translation

View File

@ -539,7 +539,7 @@ box-sizing: border-box;
font-size: 14px;
border-radius: 3px;
}
.overlay_confirm_controls,.overlay_prompt_controls {
.overlay_simple_controls {
height:31px;
}
.overlay_addlist_item {
@ -2459,6 +2459,18 @@ box-shadow: inset 0 0 0 4px #ffffff;
outline: none;
border-color: #189EFC;
}
input.checkbox[type=checkbox] {display:none}
input.checkbox[type=checkbox] + label:before {
font-family: FontAwesome;
display: inline-block;
letter-spacing: 5px;
color: #189EFC;
font-size:30px;
vertical-align:sub;
margin-bottom:5px;
}
input.checkbox[type=checkbox] + label:before {content: "\f0c8"}
input.checkbox[type=checkbox]:checked + label:before {content: "\f14a"}
.uploadbtn:before {
position:absolute;
left:0;

1
assets/images/robot.svg Normal file
View File

@ -0,0 +1 @@
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m196 182c8.277344 0 15-6.722656 15-15s-6.722656-15-15-15-15 6.722656-15 15 6.722656 15 15 15zm0 0" fill="#657786"/><path d="m497 422h-15v-45c0-8.289062-6.710938-15-15-15-66.242188 0-114.152344 0-166 0v-30h105c8.289062 0 16-6.710938 16-15v-240c0-8.289062-7.710938-15-16-15h-135v-47c0-8.289062-6.710938-15-15-15s-15 6.710938-15 15v47h-135c-8.289062 0-15 6.710938-15 15v240c0 8.289062 6.710938 15 15 15h105v30c-51.882812 0-99.808594 0-166 0-8.289062 0-15 6.710938-15 15v45h-15c-8.289062 0-15 6.710938-15 15v60c0 8.289062 6.710938 15 15 15s15-6.710938 15-15v-45h30v45c0 8.289062 6.710938 15 15 15s15-6.710938 15-15v-60c0-8.289062-6.710938-15-15-15h-15v-30h60v105c0 8.289062 6.710938 15 15 15h241c8.289062 0 15-6.710938 15-15v-105h61v30h-15c-8.289062 0-15 6.710938-15 15v60c0 8.289062 6.710938 15 15 15s15-6.710938 15-15v-45h30v45c0 8.289062 6.710938 15 15 15s15-6.710938 15-15v-60c0-8.289062-6.710938-15-15-15zm-301 30c-8.285156 0-15-6.714844-15-15s6.714844-15 15-15 15 6.714844 15 15-6.714844 15-15 15zm120-330c24.8125 0 45 20.1875 45 45s-20.1875 45-45 45-45-20.1875-45-45 20.1875-45 45-45zm-120 0c24.8125 0 45 20.1875 45 45s-20.1875 45-45 45-45-20.1875-45-45 20.1875-45 45-45zm-30 150c-8.289062 0-15-6.710938-15-15s6.710938-15 15-15h180c8.289062 0 15 6.710938 15 15s-6.710938 15-15 15zm90 180c-8.285156 0-15-6.714844-15-15s6.714844-15 15-15 15 6.714844 15 15-6.714844 15-15 15zm60 0c-8.285156 0-15-6.714844-15-15s6.714844-15 15-15 15 6.714844 15 15-6.714844 15-15 15zm0 0" fill="#657786"/><path d="m316 182c8.277344 0 15-6.722656 15-15s-6.722656-15-15-15-15 6.722656-15 15 6.722656 15 15 15zm0 0" fill="#657786"/></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -145,33 +145,36 @@ value.search(/^\d{4}-\d{2}-\d{2}/g) === -1)
return value;
return new Date(value);
}
function getRelativeDatetime(current_time, posted_time) {
function getRelativeDatetime(current_time,posted_time,withdot = true,future = false) {
const calendar = [__("Jan"),__("Feb"),__("Mar"),__("Apr"),__("May"),__("Jun"),__("Jul"),__("Aug"),__("Sep"),__("Oct"),__("Nov"),__("Dec")];
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 ="&middot; " + elapsedTime + "s";
posted_time = getConversionedDate(null, posted_time_original).getTime();
if(future) var elapsedTime = Math.ceil((posted_time-current_time)/1000);
else var elapsedTime = Math.ceil((current_time-posted_time)/1000);
var dot = "";
if(withdot) dot = "&middot; ";
if(elapsedTime < 60) {
const datetime = dot + elapsedTime + "s";
return datetime;
}
else if (elapsedTime < 120) {
const datetime ="&middot; 1m";
const datetime = dot+"1m";
return datetime;
}
else if (elapsedTime < (60*60)) {
const datetime ="&middot; " + (Math.floor(elapsedTime / 60) < 10 ? " " : "") + Math.floor(elapsedTime / 60) + "m";
const datetime = dot + (Math.floor(elapsedTime / 60) < 10 ? " " : "") + Math.floor(elapsedTime / 60) + "m";
return datetime;
}
else if (elapsedTime < (120*60)) {
const datetime ="&middot; 1h";
const datetime = dot+"1h";
return datetime;
}
else if (elapsedTime < (24*60*60)) {
const datetime ="&middot; " + (Math.floor(elapsedTime / 3600) < 10 ? " " : "") + Math.floor(elapsedTime / 3600) + "h";
const datetime = dot + (Math.floor(elapsedTime / 3600) < 10 ? " " : "") + Math.floor(elapsedTime / 3600) + "h";
return datetime;
}
else {
const datetime ="&middot; " + calendar[posted_time_original.getMonth()] + " " + posted_time_original.getDate();
const datetime = dot + calendar[posted_time_original.getMonth()] + " " + posted_time_original.getDate();
return datetime;
}
}
@ -284,6 +287,10 @@ emojis.push(emoji);
}
localStorage.setItem("current_custom_emojis",JSON.stringify(emojis));
});
api.get("filters",function(data) {
localStorage.setItem("current_filters",JSON.stringify(data));
current_filters = data;
});
$.cookie("session","true",{path:'/'});
}
function refreshApp() {
@ -311,6 +318,7 @@ current_following_accts = localStorage.getItem("current_following_accts");
current_instance_charlimit = localStorage.getItem("current_instance_charlimit");
current_blocked_accts = localStorage.getItem("current_blocked_accts");
current_muted_accts = localStorage.getItem("current_muted_accts");
current_filters = JSON.parse(localStorage.getItem("current_filters"));
$(function() {setCurrentProfile()});
}
function setCurrentProfile() {

View File

@ -64,41 +64,7 @@ localStorage.setItem("setting_who_to_follow","false");
putMessage(__("Who to follow disabled"));
}
});
$('.selectbox').each(function() {
var $this = $(this),
numberOfOptions = $(this).children('option').length;
$this.addClass('s-hidden');
$this.wrap('<div class="select"></div>');
$this.after('<div class="halcyon_button styledselect"></div>');
var $styledSelect = $this.next('div.styledselect');
var $selectText = $("<span>").css("margin","auto").text($this.children('option[selected]').eq(0).text()+" ⏷");
$styledSelect.append($selectText);
var $list = $('<ul/>',{'class':'options'}).insertAfter($styledSelect);
for(var i=0;i<numberOfOptions;i++) {
$('<li/>',{text:$this.children('option').eq(i).text(),rel:$this.children('option').eq(i).val()}).appendTo($list);
}
var $listItems = $list.children('li');
$styledSelect.click(function(e) {
e.stopPropagation();
if($(this).hasClass("active")) {
xthis = $(this);
$(this).next('ul.options').slideUp(function() {xthis.removeClass('active')});
}
else {
$(this).addClass('active').next('ul.options').slideDown();
}
});
$listItems.click(function(e) {
e.stopPropagation();
$selectText.text($(this).text()+" ⏷");
$this.val($(this).attr('rel'));
$this.change();
$list.slideUp(function() {$styledSelect.removeClass('active')});
});
$(document).click(function() {
$list.slideUp(function() {$styledSelect.removeClass('active')});
});
});
$('.selectbox').each(function() {selectbox(this)});
}
else if(window.location.pathname == "/settings/profile") {
$('#js-settings_nav_profile').toggleClass('view');
@ -236,9 +202,6 @@ $("#service_worker_box").hide();
if(localStorage.setting_service_worker == "true") {
$("#setting_service_worker")[0].checked = true;
}
if(localStorage.setting_show_replies == "true") {
$("#setting_show_replies")[0].checked = true;
}
if(localStorage.setting_show_content_warning == "true") {
$("#setting_show_content_warning")[0].checked = true;
}
@ -334,16 +297,6 @@ localStorage.setItem("setting_service_worker","false");
putMessage(__("Notifications when tab is closed disabled"));
}
});
$("#setting_show_replies").change(function() {
if(this.checked) {
localStorage.setItem("setting_show_replies","true");
putMessage(__("Replies shown"));
}
else {
localStorage.setItem("setting_show_replies","false");
putMessage(__("Replies hidden"));
}
});
$("#setting_show_content_warning").change(function() {
if(this.checked) {
localStorage.setItem("setting_show_content_warning","true");
@ -365,3 +318,165 @@ putMessage(__("NSFW content hidden"));
}
});
}
else if(window.location.pathname == "/settings/filters") {
$('#js-settings_nav_filters').toggleClass('view');
$(function() {
if(localStorage.setting_show_replies == "true") {
$("#setting_show_replies")[0].checked = true;
}
if(localStorage.setting_show_bots == "true") {
$("#setting_show_bots")[0].checked = true;
}
});
$("#setting_show_replies").change(function() {
if(this.checked) {
localStorage.setItem("setting_show_replies","true");
putMessage(__("Replies shown"));
}
else {
localStorage.setItem("setting_show_replies","false");
putMessage(__("Replies hidden"));
}
});
$("#setting_show_bots").change(function() {
if(this.checked) {
localStorage.setItem("setting_show_bots","true");
putMessage(__("Toots of bots shown"));
}
else {
localStorage.setItem("setting_show_bots","false");
putMessage(__("Toots of bots hidden"));
}
});
$(document).ready(function() {$('.selectbox').each(function() {selectbox(this)})});
$("#setting_add_filter").click(function(e) {
e.stopPropagation();
$("#js-overlay_content_wrap .temporary_object").empty();
$('#js-overlay_content_wrap').addClass('view');
$('#js-overlay_content_wrap').addClass('black_08');
$('.overlay_filter').removeClass('invisible');
$('.overlay_filter_ok').off("click");
$('.overlay_filter_ok').click(function() {
var addwholeword = "";
if($("#filter_whole_word")[0].checked == false) addwholeword = "&whole_word=0";
api.post("filters",$("#addfilter").serialize()+addwholeword,function() {
$('.close_button').click();
putMessage(__("Filter created"));
loadfilters();
});
});
});
$(document).ready(function() {
loadfilters();
});
}
function selectbox($this) {
var $this = $($this);
var numberOfOptions = $this.children('option').length;
$this.addClass('s-hidden');
$this.wrap('<div class="select"></div>');
$this.after('<div class="halcyon_button styledselect"></div>');
var $styledSelect = $this.next('div.styledselect');
var $selectText = $("<span>").css("margin","auto").text($this.children('option[selected]').eq(0).text()+" ⏷");
$styledSelect.append($selectText);
var $list = $('<ul/>',{'class':'options'}).insertAfter($styledSelect);
for(var i=0;i<numberOfOptions;i++) {
$('<li/>',{text:$this.children('option').eq(i).text(),rel:$this.children('option').eq(i).val()}).appendTo($list);
}
$this.closest("form").on("reset",function(e) {
$selectText.text($this.children('option[selected]').eq(0).text()+" ⏷");
})
var $listItems = $list.children('li');
$styledSelect.click(function(e) {
e.stopPropagation();
if($(this).hasClass("active")) {
xthis = $(this);
$(this).next('ul.options').slideUp(function() {xthis.removeClass('active')});
}
else {
$(this).addClass('active').next('ul.options').slideDown();
}
});
$listItems.click(function(e) {
e.stopPropagation();
$this.val($(this).attr('rel'));
$selectText.text($(this).text()+" ⏷");
$this.change();
$list.slideUp(function() {$styledSelect.removeClass('active')});
});
$(document).click(function() {
$list.slideUp(function() {$styledSelect.removeClass('active')});
});
}
function loadfilters() {
$("#savestate").removeClass("fa-check").addClass("fa-spin").addClass("fa-circle-o-notch");
$("#filterlist").empty();
api.get("filters",function(data) {
for(var i=0;i<data.length;i++) {
var scope = new Array();
var expires_in = "";
if(data[i].context.indexOf("home") != -1) scope.push(__("Home"));
if(data[i].context.indexOf("notifications") != -1) scope.push(__("Notifications"));
if(data[i].context.indexOf("public") != -1) scope.push(__("Public"));
if(data[i].context.indexOf("thread") != -1) scope.push(__("Thread"));
if(data[i].expires_at == null) expires_in = __("Never");
else expires_in = getRelativeDatetime(new Date(),getConversionedDate(null,data[i].expires_at),false,true)
$("#filterlist").append(
$("<tr>").append(
$("<td>").text(data[i].phrase)).append(
$("<td>").css("border-left","1px solid #189EFC").css("border-right","1px solid #189EFC").text(scope)).append(
$("<td>").text(expires_in)).append(
$("<td>").css("border-left","1px solid #189EFC").css("padding-top","5px").css("padding-bottom","5px").append(
$("<a>").attr("href","javascript:void(0)").css("color","#189EFC").css("margin-right","5px").data("id",data[i].id).append(
$("<i>").addClass("fa").addClass("fa-lg").addClass("fa-pencil")).click(function(e) {
e.stopPropagation();
var fid = $(this).data("id");
$("#savestate").removeClass("fa-check").addClass("fa-spin").addClass("fa-circle-o-notch");
api.get("filters/"+fid,function(data) {
var fid = data.id;
$("#filtertext").val(data.phrase);
if(data.context.indexOf("home") != -1) $("#checkbox_home")[0].checked = true;
if(data.context.indexOf("notifications") != -1) $("#checkbox_notifications")[0].checked = true;
if(data.context.indexOf("public") != -1) $("#checkbox_public")[0].checked = true;
if(data.context.indexOf("thread") != -1) $("#checkbox_thread")[0].checked = true;
if(data.irreversible) $("#filter_irreversible")[0].checked = true;
if(data.whole_word) $("#filter_whole_word")[0].checked = true;
$(".select span").text(__("Don't change")+" ⏷");
$("#js-overlay_content_wrap .temporary_object").empty();
$('#js-overlay_content_wrap').addClass('view');
$('#js-overlay_content_wrap').addClass('black_08');
$('.overlay_filter').removeClass('invisible');
$("#savestate").removeClass("fa-spin").removeClass("fa-circle-o-notch").addClass("fa-check");
$('.overlay_filter_ok').off("click");
$('.overlay_filter_ok').click(function() {
var addwholeword = "";
if($("#filter_whole_word")[0].checked == false) addwholeword = "&whole_word=0";
api.put("filters/"+fid,$("#addfilter").serialize()+addwholeword,function() {
$('.close_button').click();
putMessage(__("Filter updated"));
loadfilters();
});
});
});
})).append(
$("<a>").attr("href","javascript:void(0)").css("color","#189EFC").data("id",data[i].id).append(
$("<i>").addClass("fa").addClass("fa-lg").addClass("fa-trash")).click(function(e) {
e.stopPropagation();
var fid = $(this).data("id");
$("#js-overlay_content_wrap .temporary_object").empty();
$('#js-overlay_content_wrap').addClass('view');
$('#js-overlay_content_wrap').addClass('black_08');
$('.overlay_confirm').removeClass('invisible');
$('.overlay_confirm_text').text(__("Are you sure that you want to delete this filter?"));
$('.overlay_confirm_yes').click(function() {
$('.close_button').click();
api.delete("filters/"+fid,function(data) {
putMessage(__("Your filter has been deleted"));
loadfilters();
});
});
}))));
}
$("#savestate").removeClass("fa-spin").removeClass("fa-circle-o-notch").addClass("fa-check");
});
}

View File

@ -133,10 +133,9 @@ var own_toot_buttons = (`<li><a class="mute_button" mid="${status.account.id}" s
<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>`);
}
var is_account_locked = "";
if(status.account.locked == true) {
is_account_locked = " <i class='fa fa-lock'></i>";
}
var account_state_icons = "";
if(status.account.locked == true) account_state_icons += " <i class='fa fa-lock'></i>";
if(status.account.bot == true) account_state_icons += " <img src='/assets/images/robot.svg' class='emoji'>";
const html=(`
<li sid="${status.id}" class="toot_entry">
<div class="toot_entry_body">
@ -153,7 +152,7 @@ const html=(`
${status.account.display_name}
</span>
<span class="username">
@${status.account.acct}${is_account_locked}
@${status.account.acct}${account_state_icons}
</span>
<time datetime="${status_attr_datetime}">${status_datetime}</time>
</a>
@ -273,10 +272,9 @@ var own_toot_buttons = (`<li><a class="mute_button" mid="${status.reblog.account
<li><a class="addlist_button" mid="${status.reblog.account.id}" sid="${status.reblog.id}" display_name="${status.reblog.account.display_name}">${__('Add to list')} @${status.reblog.account.username}</a></li>
<li><a class="report_button" mid="${status.reblog.account.id}" sid="${status.reblog.id}" display_name="${status.reblog.account.display_name}">${__('Report this Toot')}</a></li>`);
}
var is_account_locked = "";
if(status.reblog.account.locked == true) {
is_account_locked = " <i class='fa fa-lock'></i>";
}
var account_state_icons = "";
if(status.reblog.account.locked == true) account_state_icons += " <i class='fa fa-lock'></i>";
if(status.reblog.account.bot == true) account_state_icons += " <img src='/assets/images/robot.svg' class='emoji'>";
const html = (`
<li sid="${status.id}" class="toot_entry">
<div class="boost_author_box">
@ -298,7 +296,7 @@ const html = (`
${status.reblog.account.display_name}
</span>
<span class="username">
@${status.reblog.account.acct}${is_account_locked}
@${status.reblog.account.acct}${account_state_icons}
</span>
<time datetime="${status_attr_datetime}">${status_datetime}</time>
</a>
@ -412,10 +410,9 @@ var own_toot_buttons = (`<li><a class="mute_button" mid="${status.account.id}" s
<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>`);
}
var is_account_locked = "";
if(status.account.locked == true) {
is_account_locked = " <i class='fa fa-lock'></i>";
}
var account_state_icons = "";
if(status.account.locked == true) account_state_icons += " <i class='fa fa-lock'></i>";
if(status.account.bot == true) account_state_icons += " <img src='/assets/images/robot.svg' class='emoji'>";
const html = (`
<li sid="${status.id}" class="toot_entry">
<div class="pinned_notice_box">
@ -435,7 +432,7 @@ const html = (`
${status.account.display_name}
</span>
<span class="username">
@${status.account.acct}${is_account_locked}
@${status.account.acct}${account_state_icons}
</span>
<time datetime="${status_attr_datetime}">${status_datetime}</time>
</a>
@ -513,10 +510,9 @@ NotificationObj.status.account.display_name = htmlEscape(NotificationObj.status.
for(i=0;i<NotificationObj.status.account.emojis.length;i++) {
NotificationObj.status.account.display_name = NotificationObj.status.account.display_name.replace(new RegExp(":"+NotificationObj.status.account.emojis[i].shortcode+":","g"),"<img src='"+NotificationObj.status.account.emojis[i].url+"' class='emoji'>");
}
var is_account_locked = "";
if(NotificationObj.status.account.locked == true) {
is_account_locked = " <i class='fa fa-lock'></i>";
}
var account_state_icons = "";
if(NotificationObj.status.account.locked == true) account_state_icons += " <i class='fa fa-lock'></i>";
if(NotificationObj.status.account.bot == true) account_state_icons += " <img src='/assets/images/robot.svg' class='emoji'>";
const html = (`
<li sid="${NotificationObj.status.id}" class="notice_entry fav favourite toot_entry">
<div class="notice_author_box">
@ -539,7 +535,7 @@ const html = (`
${NotificationObj.status.account.display_name}
</span>
<span class="username">
@${NotificationObj.status.account.acct}${is_account_locked}
@${NotificationObj.status.account.acct}${account_state_icons}
</span>
</a>
</div>
@ -561,10 +557,9 @@ for(i=0;i<NotificationObj.status.account.emojis.length;i++) {
NotificationObj.status.account.display_name = NotificationObj.status.account.display_name.replace(new RegExp(":"+NotificationObj.status.account.emojis[i].shortcode+":","g"),"<img src='"+NotificationObj.status.account.emojis[i].url+"' class='emoji'>");
}
const sid= NotificationObj.status.id;
var is_account_locked = "";
if(NotificationObj.status.account.locked == true) {
is_account_locked = " <i class='fa fa-lock'></i>";
}
var account_state_icons = "";
if(NotificationObj.status.account.locked == true) account_state_icons += " <i class='fa fa-lock'></i>";
if(NotificationObj.status.account.bot == true) account_state_icons += " <img src='/assets/images/robot.svg' class='emoji'>";
html = (`
<li sid="${NotificationObj.status.id}" class="notice_entry bos boost toot_entry">
<div class="notice_author_box">
@ -587,7 +582,7 @@ html = (`
${NotificationObj.status.account.display_name}
</span>
<span class="username">
@${NotificationObj.status.account.acct}${is_account_locked}
@${NotificationObj.status.account.acct}${account_state_icons}
</span>
</a>
</div>
@ -677,10 +672,9 @@ var own_toot_buttons = (`<li><a class="mute_button" mid="${NotificationObj.statu
<li><a class="addlist_button" mid="${NotificationObj.status.account.id}" sid="${NotificationObj.status.id}" display_name="${NotificationObj.status.account.display_name}">${__('Add to list')} @${NotificationObj.status.account.username}</a></li>
<li><a class="report_button" mid="${NotificationObj.status.account.id}" sid="${NotificationObj.status.id}" display_name="${NotificationObj.account.display_name}">${__('Report this Toot')}</a></li>`);
}
var is_account_locked = "";
if(NotificationObj.status.account.locked == true) {
is_account_locked = " <i class='fa fa-lock'></i>";
}
var account_state_icons = "";
if(NotificationObj.status.account.locked == true) account_state_icons += " <i class='fa fa-lock'></i>";
if(NotificationObj.status.account.bot == true) account_state_icons += " <img src='/assets/images/robot.svg' class='emoji'>";
const html=(`
<li sid="${NotificationObj.status.id}" class="toot_entry">
<div class="toot_entry_body">
@ -697,7 +691,7 @@ const html=(`
${NotificationObj.status.account.display_name}
</span>
<span class="username">
@${NotificationObj.status.account.acct}${is_account_locked}
@${NotificationObj.status.account.acct}${account_state_icons}
</span>
<time datetime="${toot_attr_datetime}">${toot_datetime}</time>
</a>
@ -775,10 +769,9 @@ AccountObj.display_name = htmlEscape(AccountObj.display_name);
for(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'>");
}
var is_account_locked = "";
if(AccountObj.locked == true) {
is_account_locked = " <i class='fa fa-lock'></i>";
}
var account_state_icons = "";
if(AccountObj.locked == true) account_state_icons += " <i class='fa fa-lock'></i>";
if(AccountObj.bot == true) account_state_icons += " <img src='/assets/images/robot.svg' class='emoji'>";
var html = (`
<div class="follows_profile_box" mid="${AccountObj.id}">
<div class="follows_profile_header">
@ -798,7 +791,7 @@ var html = (`
${AccountObj.display_name}
</h2>
<span class="js_follows_profile_username">
@${AccountObj.acct}${is_account_locked}
@${AccountObj.acct}${account_state_icons}
</span>
</a>
</div>
@ -891,10 +884,9 @@ var own_toot_buttons = (`<li><a class="mute_button" mid="${status.account.id}" s
<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>`);
}
var is_account_locked = "";
if(status.account.locked == true) {
is_account_locked = " <i class='fa fa-lock'></i>";
}
var account_state_icons = "";
if(status.account.locked == true) account_state_icons += " <i class='fa fa-lock'></i>";
if(status.account.bot == true) account_state_icons += " <img src='/assets/images/robot.svg' class='emoji'>";
const html=(`
<div sid="${status.id}" class="toot_detail ${class_options}">
<div class="toot_detail_body">
@ -907,7 +899,7 @@ const html=(`
${status.account.display_name}
</span>
<span class="username">
@${status.account.acct}${is_account_locked}
@${status.account.acct}${account_state_icons}
</span>
</a>
<div class="expand_button_wrap">
@ -1104,10 +1096,9 @@ var own_toot_buttons = (`<li><a class="mute_button" mid="${status.reblog.account
<li><a class="addlist_button" mid="${status.reblog.account.id}" sid="${status.reblog.id}" display_name="${status.reblog.account.display_name}">${__('Add to list')} @${status.reblog.account.username}</a></li>
<li><a class="report_button" mid="${status.reblog.account.id}" sid="${status.reblog.id}" display_name="${status.reblog.account.display_name}">${__('Report this Toot')}</a></li>`);
}
var is_account_locked = "";
if(status.reblog.account.locked == true) {
is_account_locked = " <i class='fa fa-lock'></i>";
}
var account_state_icons = "";
if(status.reblog.account.locked == true) account_state_icons += " <i class='fa fa-lock'></i>";
if(status.reblog.account.bot == true) account_state_icons += " <img src='/assets/images/robot.svg' class='emoji'>";
const html=(`
<div sid="${status.reblog.id}" class="toot_detail ${class_options}">
<div class="toot_detail_body">
@ -1120,7 +1111,7 @@ const html=(`
${status.reblog.account.display_name}
</span>
<span class="username">
@${status.reblog.account.acct}${is_account_locked}
@${status.reblog.account.acct}${account_state_icons}
</span>
</a>
<div class="expand_button_wrap">
@ -1354,10 +1345,9 @@ var own_toot_buttons = (`<li><a class="mute_button" mid="${status.account.id}" s
<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>`);
}
var is_account_locked = "";
if(status.account.locked == true) {
is_account_locked = " <i class='fa fa-lock'></i>";
}
var account_state_icons = "";
if(status.account.locked == true) account_state_icons += " <i class='fa fa-lock'></i>";
if(status.account.bot == true) account_state_icons += " <img src='/assets/images/robot.svg' class='emoji'>";
const html=(`
<div sid="${status.id}" class="toot_entry ${class_options}">
<div class="toot_entry_body">
@ -1371,7 +1361,7 @@ const html=(`
${status.account.display_name}
</span>
<span class="username">
@${status.account.acct}${is_account_locked}
@${status.account.acct}${account_state_icons}
</span>
<time datetime="${status_attr_datetime}">${status_datetime}</time>
</a>
@ -1490,10 +1480,9 @@ var own_toot_buttons = (`<li><a class="mute_button" mid="${status.reblog.account
<li><a class="addlist_button" mid="${status.reblog.account.id}" sid="${status.reblog.id}" display_name="${status.reblog.account.display_name}">${__('Add to list')} @${status.reblog.account.username}</a></li>
<li><a class="report_button" mid="${status.reblog.account.id}" sid="${status.reblog.id}" display_name="${status.reblog.account.display_name}">${__('Report this Toot')}</a></li>`);
}
var is_account_locked = "";
if(status.reblog.account.locked == true) {
is_account_locked = " <i class='fa fa-lock'></i>";
}
var account_state_icons = "";
if(status.reblog.account.locked == true) account_state_icons += " <i class='fa fa-lock'></i>";
if(status.reblog.account.bot == true) account_state_icons += " <img src='/assets/images/robot.svg' class='emoji'>";
const html=(`
<div sid="${status.id}" class="toot_entry ${class_options}">
<div class="boost_author_box">
@ -1512,7 +1501,7 @@ const html=(`
${status.reblog.account.display_name}
</span>
<span class="username">
@${status.reblog.account.acct}${is_account_locked}
@${status.reblog.account.acct}${account_state_icons}
</span>
</a>
<time datetime="${status_attr_datetime}">${status_datetime}</time>

View File

@ -283,14 +283,38 @@ var load_options = [];
api.get(level, load_options, function(statuses) {
let reply_sources = {};
for(let i in statuses) {
if(!(show_replies == "false" && statuses[i].in_reply_to_id) && !(statuses[i].visibility == "direct" && level == "timelines/home")) {
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(!reply_sources[statuses[i].in_reply_to_id] & !$(".toot_entry[sid='"+statuses[i].in_reply_to_id+"']").length) {
reply_sources[statuses[i].in_reply_to_id] = statuses[i].id;
api.get('statuses/'+statuses[i].in_reply_to_id, function(in_reply_statuses) {
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(in_reply_statuses.content.match(new RegExp(current_filters[a].phrase))) filterreplystatus = true;
}
else {
if(in_reply_statuses.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='"+reply_sources[in_reply_statuses.id]+"']").before(context_template(in_reply_statuses, 'ancestors_status default_padding'));
replace_emoji();
}
});
}
}
@ -313,14 +337,38 @@ api.get(level, load_options, function(statuses) {
if (statuses.length) {
let reply_sources = {};
for(let i in statuses) {
if(!(show_replies == "false" && statuses[i].in_reply_to_id) && !(statuses[i].visibility == "direct" && level == "timelines/home")) {
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(!reply_sources[statuses[i].in_reply_to_id] & !$(".toot_entry[sid='"+statuses[i].in_reply_to_id+"']").length) {
reply_sources[statuses[i].in_reply_to_id] = statuses[i].id;
api.get('statuses/'+statuses[i].in_reply_to_id, function(in_reply_statuses) {
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(in_reply_statuses.content.match(new RegExp(current_filters[a].phrase))) filterreplystatus = true;
}
else {
if(in_reply_statuses.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='"+reply_sources[in_reply_statuses.id]+"']").before(context_template(in_reply_statuses, 'ancestors_status default_padding'));
replace_emoji();
}
});
}
}
@ -373,7 +421,18 @@ const streaming_option = localStorage.getItem("setting_post_stream");
if(userstream.event === "update") {
if(streaming_option === "manual") {
if(!$('.toot_entry[sid="'+userstream.payload.id+'"]').length) {
if(!(show_replies == "false" && userstream.payload.in_reply_to_id) && !(userstream.payload.visibility == "direct" && scope == "home")) {
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(userstream.payload.content.match(new RegExp(current_filters[a].phrase))) filterstatus = true;
}
else {
if(userstream.payload.content.match(new RegExp("[^a-zA-Z1-9]"+current_filters[a].phrase+"[^a-zA-Z1-9]"))) filterstatus = true;
}
}
}
if(filterstatus == false && !(show_replies == "false" && userstream.payload.in_reply_to_id) && !(localStorage.setting_show_bots == "false" && userstream.payload.account.bot == true && !level.match(/accounts\/\d+\/statuses/)) && !(userstream.payload.visibility == "direct" && level == "timelines/home")) {
$('#js-stream_update').css({'display':'block','height':'auto','padding':'10px'});
statuses.unshift(userstream.payload);
$('#js-stream_update > button > span').text(statuses.length);
@ -384,7 +443,18 @@ $('#header .header_nav_list .'+scope+'_badge').removeClass('invisible');
}
else if (streaming_option === "auto") {
if(!$('.toot_entry[sid="'+userstream.payload.id+'"]').length) {
if(!(show_replies == "false" && userstream.payload.in_reply_to_id) && !(userstream.payload.visibility == "direct" && scope == "home")) {
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(userstream.payload.content.match(new RegExp(current_filters[a].phrase))) filterstatus = true;
}
else {
if(userstream.payload.content.match(new RegExp("[^a-zA-Z1-9]"+current_filters[a].phrase+"[^a-zA-Z1-9]"))) filterstatus = true;
}
}
}
if(filterstatus == false && !(show_replies == "false" && userstream.payload.in_reply_to_id) && !(localStorage.setting_show_bots == "false" && userstream.payload.account.bot == true && !level.match(/accounts\/\d+\/statuses/)) && !(userstream.payload.visibility == "direct" && level == "timelines/home")) {
timeline_template(userstream.payload).prependTo("#js-timeline");
replaceInternalLink();
replace_emoji();
@ -392,9 +462,22 @@ if(level === "timelines/home" | level === "timelines/public") {
if(userstream.payload.in_reply_to_id & !$(".toot_entry[sid='"+userstream.in_reply_to_id+"']").length) {
let reply_source = userstream.payload.id;
api.get('statuses/'+userstream.payload.in_reply_to_id, function(in_reply_statuses) {
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(in_reply_statuses.content.match(new RegExp(current_filters[a].phrase))) filterreplystatus = true;
}
else {
if(in_reply_statuses.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='"+reply_source+"']").before(context_template(in_reply_statuses, 'ancestors_status default_padding'));
replaceInternalLink();
replace_emoji();
}
});
}
}
@ -405,7 +488,18 @@ else if(streaming_option == "ontop") {
var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
if(scrollTop == 0) {
if(!$('.toot_entry[sid="'+userstream.payload.id+'"]').length) {
if(!(show_replies == "false" && userstream.payload.in_reply_to_id) && !(userstream.payload.visibility == "direct" && scope == "home")) {
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(userstream.payload.content.match(new RegExp(current_filters[a].phrase))) filterstatus = true;
}
else {
if(userstream.payload.content.match(new RegExp("[^a-zA-Z1-9]"+current_filters[a].phrase+"[^a-zA-Z1-9]"))) filterstatus = true;
}
}
}
if(filterstatus == false && !(show_replies == "false" && userstream.payload.in_reply_to_id) && !(localStorage.setting_show_bots == "false" && userstream.payload.account.bot == true && !level.match(/accounts\/\d+\/statuses/)) && !(userstream.payload.visibility == "direct" && level == "timelines/home")) {
timeline_template(userstream.payload).prependTo("#js-timeline");
replaceInternalLink();
replace_emoji();
@ -413,9 +507,22 @@ if(level === "timelines/home" | level === "timelines/public") {
if(userstream.payload.in_reply_to_id & !$(".toot_entry[sid='"+userstream.in_reply_to_id+"']").length) {
let reply_source = userstream.payload.id;
api.get('statuses/'+userstream.payload.in_reply_to_id, function(in_reply_statuses) {
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(in_reply_statuses.content.match(new RegExp(current_filters[a].phrase))) filterreplystatus = true;
}
else {
if(in_reply_statuses.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='"+reply_source+"']").before(context_template(in_reply_statuses, 'ancestors_status default_padding'));
replaceInternalLink();
replace_emoji();
}
});
}
}
@ -499,8 +606,21 @@ if ( level === "timelines/home" | level === "timelines/public" ) {
if (statuses[i].in_reply_to_id) {
const reply_source = statuses[i].id;
api.get('statuses/'+statuses[i].in_reply_to_id, function(in_reply_statuses) {
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(in_reply_statuses.content.match(new RegExp(current_filters[a].phrase))) filterreplystatus = true;
}
else {
if(in_reply_statuses.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='"+reply_source+"']").before(context_template(in_reply_statuses, 'ancestors_status default_padding'));
replace_emoji();
}
});
}
}
@ -520,14 +640,38 @@ const loadstatus = instance + "timelines/public"
api.getOther(loadstatus, load_options, function(statuses) {
let reply_sources = {};
for(let i in statuses) {
if(!(show_replies == "false" && statuses[i].in_reply_to_id)) {
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)) {
timeline_template(statuses[i]).appendTo("#js-timeline");
if(statuses[i].in_reply_to_id ) {
if(!reply_sources[statuses[i].in_reply_to_id]) {
reply_sources[statuses[i].in_reply_to_id] = statuses[i].id;
api.getOther(instance + 'statuses/'+statuses[i].in_reply_to_id, function(in_reply_statuses) {
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(in_reply_statuses.content.match(new RegExp(current_filters[a].phrase))) filterreplystatus = true;
}
else {
if(in_reply_statuses.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='"+reply_sources[in_reply_statuses.id]+"']").before(context_template(in_reply_statuses, 'ancestors_status default_padding'));
replace_emoji();
}
});
}
}
@ -551,14 +695,38 @@ api.getOther(loadstatus, load_options, function(statuses) {
if(statuses.length) {
let reply_sources = {};
for(let i in statuses) {
if(!(show_replies == "false" && statuses[i].in_reply_to_id)) {
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)) {
timeline_template(statuses[i]).appendTo("#js-timeline");
if(statuses[i].in_reply_to_id ) {
if(!reply_sources[statuses[i].in_reply_to_id]) {
reply_sources[statuses[i].in_reply_to_id] = statuses[i].id;
api.getOther(instance+'statuses/'+statuses[i].in_reply_to_id, function(in_reply_statuses) {
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(in_reply_statuses.content.match(new RegExp(current_filters[a].phrase))) filterreplystatus = true;
}
else {
if(in_reply_statuses.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='"+reply_sources[in_reply_statuses.id]+"']").before(context_template(in_reply_statuses, 'ancestors_status default_padding'));
replace_emoji();
}
});
}
}
@ -587,8 +755,21 @@ if (load_options === undefined) {
var load_options = [];
}
api.get('notifications', load_options, function(NotificationObj) {
for (let i in NotificationObj) {
notifications_template(NotificationObj[i]).appendTo("#js-timeline");
for(let i in NotificationObj) {
var filterstatus = false;
if(NotificationObj[i].type == "mention") {
for(var a=0;a<current_filters.length;a++) {
if(current_filters[a].context.indexOf("notifications") != -1 && current_filters[a].irreversible == false) {
if(current_filters[a].whole_word == false) {
if(NotificationObj[i].status.content.match(new RegExp(current_filters[a].phrase))) filterstatus = true;
}
else {
if(NotificationObj[i].status.content.match(new RegExp("[^a-zA-Z1-9]"+current_filters[a].phrase+"[^a-zA-Z1-9]"))) filterstatus = true;
}
}
}
}
if(filterstatus == false) notifications_template(NotificationObj[i]).appendTo("#js-timeline");
};
links = getLinkFromXHRHeader(responce_headers);
replaceInternalLink();
@ -606,7 +787,20 @@ load_options.unshift( {name:"max_id",data:links['next'].match(/max_id=(.+)&?/)[1
api.get('notifications', load_options, function(NotificationObj) {
if (NotificationObj.length) {
for (let i in NotificationObj) {
notifications_template(NotificationObj[i]).appendTo("#js-timeline");
var filterstatus = false;
if(NotificationObj[i].type == "mention") {
for(var a=0;a<current_filters.length;a++) {
if(current_filters[a].context.indexOf("notifications") != -1 && current_filters[a].irreversible == false) {
if(current_filters[a].whole_word == false) {
if(NotificationObj[i].status.content.match(new RegExp(current_filters[a].phrase))) filterstatus = true;
}
else {
if(NotificationObj[i].status.content.match(new RegExp("[^a-zA-Z1-9]"+current_filters[a].phrase+"[^a-zA-Z1-9]"))) filterstatus = true;
}
}
}
}
if(filterstatus == false) notifications_template(NotificationObj[i]).appendTo("#js-timeline");
};
links = getLinkFromXHRHeader(responce_headers);
replaceInternalLink();
@ -628,7 +822,20 @@ if (userstream.event === "notification") {
const streaming_option = localStorage.getItem("setting_post_stream");
if ( streaming_option === "manual" ) {
} else if ( streaming_option === "auto" ) {
notifications_template(userstream.payload).prependTo("#js-timeline");
var filterstatus = false;
if(userstream.payload.type == "mention") {
for(var a=0;a<current_filters.length;a++) {
if(current_filters[a].context.indexOf("notifications") != -1 && current_filters[a].irreversible == false) {
if(current_filters[a].whole_word == false) {
if(userstream.payload.status.content.match(new RegExp(current_filters[a].phrase))) filterstatus = true;
}
else {
if(userstream.payload.status.content.match(new RegExp("[^a-zA-Z1-9]"+current_filters[a].phrase+"[^a-zA-Z1-9]"))) filterstatus = true;
}
}
}
}
if(filterstatus == false) notifications_template(userstream.payload).prependTo("#js-timeline");
replaceInternalLink();
replace_emoji();
}
@ -714,17 +921,16 @@ AccountObj.display_name = AccountObj.display_name.replace(new RegExp(":"+Account
const calendar = [__("Jan"),__("Feb"),__("Mar"),__("Apr"),__("May"),__("Jun"),__("Jul"),__("Aug"),__("Sep"),__("Oct"),__("Nov"),__("Dec")];
var creation_date = new Date(AccountObj.created_at);
creation_date = calendar[creation_date.getUTCMonth()]+" "+creation_date.getUTCFullYear();
var is_account_locked = "";
if(AccountObj.locked == true) {
is_account_locked = " <i class='fa fa-lock'></i>";
}
var account_state_icons = "";
if(AccountObj.locked == true) account_state_icons += " <i class='fa fa-lock'></i>";
if(AccountObj.bot == true) account_state_icons += " <img src='/assets/images/robot.svg' class='emoji'>";
$("#js_header_image").attr('src', AccountObj.header);
$("#js_profile_image").attr('src', AccountObj.avatar);
$("#js_toots_count").text(AccountObj.statuses_count);
$("#js_following_count").text(AccountObj.following_count);
$("#js_followers_count").text(AccountObj.followers_count);
$("#js_profile_displayname").addClass("emoji_poss").html(AccountObj.display_name);
$("#js_profile_username").html(AccountObj.acct+is_account_locked);
$("#js_profile_username").html(AccountObj.acct+account_state_icons);
$("#js_profile_bio").addClass("emoji_poss").html(AccountObj.note);
$("#js_profile_bio .emojione").removeClass("emojione").addClass("emoji");
$('#js_profile_public_link a').attr('href',AccountObj.url);
@ -863,13 +1069,35 @@ replace_emoji();
api.get('statuses/'+sid+'/context', function(status) {
if (status.ancestors.length) {
status.ancestors.reverse();
for ( let i in status.ancestors ) {
context_template(status.ancestors[i], 'ancestors_status').prependTo("#js-overlay_content .temporary_object .toot_detail_wrap");
for(let i in status.ancestors) {
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(status.ancestors[i].content.match(new RegExp(current_filters[a].phrase))) filterreplystatus = true;
}
else {
if(status.ancestors[i].content.match(new RegExp("[^a-zA-Z1-9]"+current_filters[a].phrase+"[^a-zA-Z1-9]"))) filterreplystatus = true;
}
}
if (status.descendants.length) {
for ( let i in status.descendants) {
context_template(status.descendants[i], 'descendants_status').appendTo("#js-overlay_content .temporary_object .toot_detail_wrap");
}
if(filterreplystatus == false) context_template(status.ancestors[i], 'ancestors_status').prependTo("#js-overlay_content .temporary_object .toot_detail_wrap");
}
}
if(status.descendants.length) {
for(let i in status.descendants) {
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(status.descendants[i].content.match(new RegExp(current_filters[a].phrase))) filterreplystatus = true;
}
else {
if(status.descendants[i].content.match(new RegExp("[^a-zA-Z1-9]"+current_filters[a].phrase+"[^a-zA-Z1-9]"))) filterreplystatus = true;
}
}
}
if(filterreplystatus == false) context_template(status.descendants[i], 'descendants_status').appendTo("#js-overlay_content .temporary_object .toot_detail_wrap");
}
}
replaceInternalLink();
@ -1805,6 +2033,7 @@ $('#js-overlay_content_wrap .overlay_copy_link').addClass('invisible');
$('#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 .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');
@ -1816,11 +2045,14 @@ $('#js-overlay_content_wrap .overlay_confirm_yes').off('click');
$('#js-overlay_content_wrap .overlay_prompt_ok').off('click');
$('#js-overlay_content_wrap .overlay_prompt_text').val("");
$('#js-overlay_content_wrap .overlay_addlist_body').empty();
if ( current_file === "/user" ) {
$('#js-overlay_content_wrap #addfilter').trigger("reset");
if(window.current_file) {
if(current_file === "/user") {
history.pushState(null, null, "/"+location.pathname.split("/")[1]+location.search);
} else {
history.pushState(null, null, current_file);
}
}
});
})
$(function() {

View File

@ -329,15 +329,23 @@ 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 listener = function (event) {
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) {

View File

@ -6,13 +6,16 @@
<div class="temporary_object">
</div>
<div class="parmanent_object">
<?php include dirname(__FILE__).('/widgets/overlay_create_status.php'); ?>
<?php include dirname(__FILE__).('/widgets/overlay_single_reply.php'); ?>
<?php include dirname(__FILE__).('/widgets/overlay_report_status.php'); ?>
<?php include dirname(__FILE__).('/widgets/overlay_copy_link.php'); ?>
<?php include dirname(__FILE__).('/widgets/overlay_confirm.php'); ?>
<?php include dirname(__FILE__).('/widgets/overlay_prompt.php'); ?>
<?php include dirname(__FILE__).('/widgets/overlay_addlist.php'); ?>
<?php
include dirname(__FILE__).('/widgets/overlay_create_status.php');
include dirname(__FILE__).('/widgets/overlay_single_reply.php');
include dirname(__FILE__).('/widgets/overlay_report_status.php');
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');
if($_SERVER["REQUEST_URI"] == "/settings/filters") include dirname(__FILE__).('/widgets/overlay_filter.php');
?>
</div>
<button class="close_button"><i class="fa fa-times" aria-hidden="true"></i></button>
</div>

View File

@ -40,6 +40,7 @@ localStorage.setItem('setting_desktop_notifications', 'true');
localStorage.setItem('setting_service_worker', 'false');
localStorage.setItem('setting_who_to_follow', 'false');
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_compose_autocomplete', 'true');

View File

@ -67,6 +67,7 @@ rewrite ^/search/users/?$ /search_user.php break;
rewrite ^/settings/?$ /settings_general.php break;
rewrite ^/settings/profile/?$ /settings_profile.php break;
rewrite ^/settings/appearance/?$ /settings_appearance.php break;
rewrite ^/settings/filters/?$ /settings_filters.php break;
# User
rewrite ^/@(.+)@(.+)\.([a-z]+)/?$ /user.php?user=@$1@$2\.$3 break;

View File

@ -77,17 +77,6 @@
</div>
</div>-->
<div style="float:left;width:50%;text-align:right;margin-top:16px">
<h3><?=_('Show replies')?></h3>
</div>
<div class="show_replies_wrap" style="float:left;width:50%">
<div class="switch">
<input type="checkbox" id="setting_show_replies">
<div class="switch-btn">
<span></span>
</div>
</div>
</div>
<div style="float:left;width:50%;text-align:right;margin-top:16px">
<h3><?=_('Show all CW content')?></h3>
</div>
<div class="show_content_warning_wrap" style="float:left;width:50%">

66
settings_filters.php Normal file
View File

@ -0,0 +1,66 @@
<?php include ('header.php'); ?>
<main id="main">
<?php include dirname(__FILE__).('/widgets/settings_header.php'); ?>
<div class="article_wrap">
<aside class="left_column">
<?php include dirname(__FILE__).('/widgets/side_current_user.php'); ?>
<?php include dirname(__FILE__).('/widgets/side_footer.php'); ?>
</aside>
<article class="center_column">
<header class="timeline_header">
<ul class="header_items">
<li class="item toots view"><?=_('Filter settings')?></li>
</ul>
</header>
<div class="timeline">
<div style="float:left;width:50%;text-align:right;margin-top:16px">
<h3><?=_('Show replies')?></h3>
</div>
<div class="show_replies_wrap" style="float:left;width:50%">
<div class="switch">
<input type="checkbox" id="setting_show_replies">
<div class="switch-btn">
<span></span>
</div>
</div>
</div>
<div style="float:left;width:50%;text-align:right;margin-top:16px">
<h3><?=_('Show toots of bots')?></h3>
</div>
<div class="show_bots_wrap" style="float:left;width:50%">
<div class="switch">
<input type="checkbox" id="setting_show_bots">
<div class="switch-btn">
<span></span>
</div>
</div>
</div>
<div style="float:left;width:50%;text-align:right;margin-top:16px">
<h3><?=_('Add new filter')?></h3>
</div>
<div class="header_wrap" style="float:left;width:50%">
<button class="halcyon_button" id="setting_add_filter" style="width:calc(75% - 2px);margin:10px;padding:0;height:28px;position:relative">
<span style="margin:auto"><?=_('Create a filter')?></span>
</button>
</div>
<table style="width:100%;text-align:center" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th style="border-bottom:1px solid #189EFC;padding-top:5px;padding-bottom:5px"><?=_('Word or phrase to filter')?></th>
<th style="border:1px solid #189EFC;border-top:0"><?=_('Filter in the following timelines')?></th>
<th style="border-bottom:1px solid #189EFC"><?=_('Expires in')?></th>
<th style="border-bottom:1px solid #189EFC;border-left:1px solid #189EFC"></th>
</tr>
</thead>
<tbody id="filterlist"></tbody>
</table>
<span style="visibility:hidden">-</span>
</div>
<footer id="js-timeline_footer" class="timeline_footer">
<i id="savestate" class="fa fa-spin fa-circle-o-notch" aria-hidden="true"></i>
</footer>
</article>
</div>
</main>
<script src="/assets/js/halcyon/halcyonSettings.js"></script>
<?php include ('footer.php'); ?>

View File

@ -1 +1 @@
2.1.4
2.1.5

View File

@ -4,7 +4,7 @@
</header>
<div class="overlay_simple_body">
<div class="overlay_confirm_text" style="margin-bottom:10px"></div>
<div class="overlay_confirm_controls">
<div class="overlay_simple_controls">
<button class="overlay_confirm_yes toot_button" style="float:right"><div class="toot_button_label"><i class="fa fa-fw fa-check"></i><span><?=_('Yes')?></span></div></button>
<a href="javascript:$('.close_button').click();void(0)" class="overlay_confirm_cancel halcyon_link" style="float:right;margin-top:5px;margin-right:10px"><i class="fa fa-times"></i> <?=_('Cancel')?></a>
</div>

View File

@ -0,0 +1,68 @@
<div class="overlay_simple overlay_filter invisible">
<header class="overlay_simple_header">
<span><?=_('Filter')?></span>
</header>
<div class="overlay_simple_body">
<form id="addfilter">
<input type="hidden" id="filterid" name="id">
<div class="overlay_filter_label" style="margin-bottom:10px;text-align:right;margin-top:6px;float:left;width:50%"><?=_('Word or phrase to filter')?>&nbsp;&nbsp;&nbsp;</div>
<div style="margin-bottom:10px;float:left;width:50%">
<input type="text" name="phrase" class="overlay_filter_word textfield" style="margin:0;width:100%" id="filtertext">
</div>
<div class="overlay_filter_label" style="margin-bottom:10px;text-align:right;margin-top:6px;float:left;width:50%"><?=_('Expires in')?>&nbsp;&nbsp;&nbsp;</div>
<div style="margin-bottom:10px;float:left;width:50%">
<select name="expires_in" class="selectbox">
<option value selected><?=_('Never')?></option>
<option value="1800">30 <?=_('minutes')?></option>
<option value="3600">1 <?=_('hour')?></option>
<option value="21600">6 <?=_('hours')?></option>
<option value="43200">12 <?=_('hours')?></option>
<option value="86400">1 <?=_('day')?></option>
<option value="604800">1 <?=_('week')?></option>
</select>
</div>
<div class="overlay_filter_label" style="margin-bottom:10px;width:100%;text-align:center"><?=_('Filter in the following timelines')?></div>
<div style="margin-bottom:10px;float:left;width:50%">
<input type="checkbox" class="checkbox" name="context[]" value="home" id="checkbox_home">
<label for="checkbox_home"><?=_('Home')?></label><br/>
<input type="checkbox" class="checkbox" name="context[]" value="notifications" id="checkbox_notifications">
<label for="checkbox_notifications"><?=_('Notifications')?></label>
</div>
<div style="margin-bottom:10px;float:left;width:50%">
<input type="checkbox" class="checkbox" name="context[]" value="public" id="checkbox_public">
<label for="checkbox_public"><?=_('Public')?></label><br/>
<input type="checkbox" class="checkbox" name="context[]" value="thread" id="checkbox_thread">
<label for="checkbox_thread"><?=_('Thread')?></label>
</div>
<div style="margin-bottom:20px;width:100%">
<div class="switch" style="margin:0;float:left">
<input type="checkbox" name="irreversible" value="1" id="filter_irreversible">
<div class="switch-btn">
<span></span>
</div>
</div>
<label for="filter_irreversible" style="margin-left:5px;vertical-align:sub"><?=_('Filter posts irreversible')?></label>
</div>
<div style="margin-bottom:10px;width:100%">
<div class="switch" style="margin:0;float:left">
<input type="checkbox" name="whole_word" value="1" id="filter_whole_word">
<div class="switch-btn">
<span></span>
</div>
</div>
<label for="whole_word" style="margin-left:5px;vertical-align:sub"><?=_('Whole word')?></label>
</div>
</form>
<span style="visibility:hidden">-</span>
<div class="overlay_simple_controls">
<button class="overlay_filter_ok toot_button" style="float:right"><div class="toot_button_label"><i class="fa fa-fw fa-check"></i><span><?=_('Ok')?></span></div></button>
<a href="javascript:$('.close_button').click();void(0)" class="overlay_filter_cancel halcyon_link" style="float:right;margin-top:5px;margin-right:10px"><i class="fa fa-times"></i> <?=_('Cancel')?></a>
</div>
</div>
</div>
<style>
.select {
width:calc(100% - 2px);
margin:-10px;
}
</style>

View File

@ -7,7 +7,7 @@
<div style="margin-bottom:10px">
<input type="text" class="overlay_prompt_input textfield" style="margin:0;width:100%">
</div>
<div class="overlay_prompt_controls">
<div class="overlay_simple_controls">
<button class="overlay_prompt_yes toot_button" style="float:right"><div class="toot_button_label"><i class="fa fa-fw fa-check"></i><span><?=_('Ok')?></span></div></button>
<a href="javascript:$('.close_button').click();void(0)" class="overlay_prompt_cancel halcyon_link" style="float:right;margin-top:5px;margin-right:10px"><i class="fa fa-times"></i> <?=_('Cancel')?></a>
</div>

View File

@ -20,6 +20,11 @@
<h2><?=_('APPEARANCE')?></h2>
</a>
</li>
<li id="js-settings_nav_filters" class="header_nav_item settings_filters">
<a href="/settings/filters">
<h2><?=_('FILTERS')?></h2>
</a>
</li>
</ul>
</div>
</div>