Added custom profile fields,added support for verified links,added custom field settings

This commit is contained in:
nipos 2018-11-16 19:14:32 +01:00
parent 79b79e784e
commit ca3c83dced
14 changed files with 113 additions and 23 deletions

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.4 - Added custom profile fields,verified links and custom profile link settings
- 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
- Release of Version 2.1.1 - Profile settings can be changed again,fixed various Firefox-only bugs,Removed error if browser sends no language

View File

@ -96,6 +96,7 @@ border-bottom-color:#000000;
.copy_link_input {
border: 1px solid #000;
background-color: #132030;
color:#FFFFFF;
}
.relationship_button {
border:1px solid #189EFC;
@ -416,6 +417,8 @@ color:#fff;
#main .article_wrap .left_column .profile_section_wrap > .profile_username {
color:#657786;
}
#main .article_wrap .left_column .profile_section_wrap > .profile_bio a,
#main .article_wrap .left_column .profile_section_wrap .profile_field_value a,
.profile_with_icon > a {
color:#189EFC;
}

View File

@ -1966,7 +1966,8 @@ line-height: normal;
color: rgb(20, 23, 26);
margin-bottom: 8px;
}
#main .article_wrap .left_column .profile_section_wrap > .profile_username {
#main .article_wrap .left_column .profile_section_wrap > .profile_username,
#main .article_wrap .left_column .profile_section_wrap .profile_field_header {
color: rgb(101, 119, 134);
font-size: 14px;
font-weight: 300;
@ -1977,16 +1978,24 @@ font-size: 10px;
display: inline-block;
margin-left: 8px;
}
#main .article_wrap .left_column .profile_section_wrap > .profile_bio {
#main .article_wrap .left_column .profile_section_wrap > .profile_bio,
#main .article_wrap .left_column .profile_section_wrap .profile_field_value {
font-size: 14px;
font-weight: 400;
line-height: 20px;
margin-bottom: 10px;
word-wrap: break-word;
}
#main .article_wrap .left_column .profile_section_wrap > .profile_bio a {
#main .article_wrap .left_column .profile_section_wrap > .profile_bio a,
#main .article_wrap .left_column .profile_section_wrap .profile_field_value a {
color: #2588D0;
}
#main .article_wrap .left_column .profile_section_wrap .profile_field:last-child {
margin-bottom:15px;
}
#main .article_wrap .left_column .profile_section_wrap .profile_field_verified {
margin-right:2px;
color:#1DA1F2;
}
.profile_with_icon > a,.profile_with_icon > span {
font-size: 13px;
font-weight: 300;

View File

@ -38,35 +38,37 @@ function replaceInternalLink(){
$(".h-card > a").each(function(i) {
$(this).attr('href',getRelativeURL($(this).attr('href')));
});
$(".toot_article a").each(function(i) {
const pltags = $(this).attr('href').match(/https:\/\/.+..+\/tag\/(.+)\/?/);
$(".toot_article a,.profile_bio,.follows_profile_bio").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\/(.+)\/?/);
const mstags = $(this).attr('href').match(/https:\/\/.+..+\/tags\/([a-zA-Z\d_%]+)\/?$/);
if(mstags) {
$(this).attr('target','_self').attr('href','/search?q='+mstags[1]);
}
const plusers = $(this).attr('href').match(/https:\/\/.+..+\/users\/([a-zA-Z\d_]+)(\/statuses\/\d+)?/);
if(plusers && plusers[2] == undefined) {
const plusers = $(this).attr('href').match(/https:\/\/.+..+\/users\/([a-zA-Z\d_]+)(\/statuses\/\d+)\/?$/);
if(plusers) {
$(this).attr('target','_self').attr('href','/@'+plusers[1]+'@'+$(this).attr('href').split("/")[2]);
}
else if(plusers && plusers[2] != undefined) {
$(this).attr('target','_self').attr('href',"javascript:openStatus('"+plusers[0]+"');void(0)");
}
const msusers = $(this).attr('href').match(/https:\/\/.+..+\/@([a-zA-Z\d_]+)(\/\d+)?/);
if(msusers && msusers[2] == undefined) {
const msusers = $(this).attr('href').match(/https:\/\/.+..+\/@([a-zA-Z\d_]+)\/?$/);
if(msusers) {
$(this).attr('target','_self').attr('href','/@'+msusers[1]+'@'+$(this).attr('href').split("/")[2]);
}
else if(msusers && msusers[2] != undefined) {
$(this).attr('target','_self').attr('href',"javascript:openStatus('"+msusers[0]+"');void(0)");
const msstatus = $(this).attr('href').match(/https:\/\/.+..+\/@([a-zA-Z\d_]+)(\/\d+)\/?$/);
if(msstatus) {
$(this).attr('target','_self').attr('href',"javascript:openStatus('"+msstatus[0]+"');void(0)");
}
const gsstatus = $(this).attr('href').match(/https:\/\/.+..+\/notice\/(\d+)?/);
const msstatus2 = $(this).attr('href').match(/https:\/\/.+..+\/users\/([a-zA-Z\d_]+)\/?$/);
if(msstatus2) {
$(this).attr('target','_self').attr('href',"javascript:openStatus('"+msstatus2[0]+"');void(0)");
}
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 && plstatus[1] != undefined) {
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)");
}
if(localStorage.setting_link_previews == "true") {

View File

@ -114,6 +114,19 @@ $(".about_me_wrap textarea[name='about_me']").val(AccountObj["note"]);
if(AccountObj["locked"] == true) {
$("#setting_lock_account")[0].checked = true;
}
if(AccountObj.source && AccountObj.source.fields) {
for(var i=0;i<AccountObj.source.fields.length;i++) {
$("#setting_field_"+i+"_name").val(AccountObj.source.fields[i].name);
$("#setting_field_"+i+"_value").val(AccountObj.source.fields[i].value);
}
}
else {
for(var i=0;i<AccountObj.fields.length;i++) {
$("#setting_field_"+i+"_name").val(AccountObj.fields[i].name);
$("#setting_field_"+i+"_value").val(AccountObj.fields[i].value);
}
}
$("#verifylink").val('<a rel="me" href="'+AccountObj["url"]+'">Mastodon</a>');
$("#savestate").removeClass("fa-spin").removeClass("fa-circle-o-notch").addClass("fa-check");
});
});
@ -149,7 +162,7 @@ localStorage.current_avatar = current_avatar;
$(".js_current_profile_image").attr("src",current_avatar);
$("#savestate").removeClass("fa-spin").removeClass("fa-circle-o-notch").addClass("fa-check");
putMessage(__("Uploaded new avatar"));
})
});
}
});
$("#setting_header").change(function() {
@ -181,7 +194,19 @@ api.patch("accounts/update_credentials",formdata,function() {
$("#savestate").removeClass("fa-spin").removeClass("fa-circle-o-notch").addClass("fa-check");
putMessage(__(msgtext));
});
})
});
$(document).on('change',".setting_field",function(e) {
$("#savestate").removeClass("fa-check").addClass("fa-spin").addClass("fa-circle-o-notch");
var formdata = new FormData();
for(var i=0;i<4;i++) {
formdata.append('fields_attributes['+i+'][name]',$("#setting_field_"+i+"_name").val());
formdata.append('fields_attributes['+i+'][value]',$("#setting_field_"+i+"_value").val());
}
api.patch("accounts/update_credentials",formdata,function() {
$("#savestate").removeClass("fa-spin").removeClass("fa-circle-o-notch").addClass("fa-check");
putMessage(__("Changed custom profile field"));
});
});
}
else if(window.location.pathname == "/settings/appearance") {
$('#js-settings_nav_appearance').toggleClass('view');

View File

@ -729,6 +729,14 @@ $("#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);
$('#js_profile_joined_date span span').text(__("Joined at")+" "+creation_date);
for(var i=0;i<AccountObj.fields.length;i++) {
if(AccountObj.fields[i].verified_at != null) var verified = $("<i>").addClass("fa fa-check-circle").addClass("profile_field_verified");
else var verified = "";
$("#js_profile_fields").append(
$("<div>").addClass("profile_field").append(
$("<span>").addClass("profile_field_header").addClass("emoji_poss").text(AccountObj.fields[i].name).prepend(verified)).append($("<br>")).append(
$("<span>").addClass("profile_field_value").addClass("emoji_poss").html(AccountObj.fields[i].value)));
}
console.log(AccountObj.id);
console.log(current_id);
if(AccountObj.acct.indexOf("@") != -1) {

View File

@ -16,7 +16,7 @@
<div style="float:left;width:50%;text-align:right;margin-top:16px">
<h3><?=_('Display name')?></h3>
</div>
<div class="display_name_wrap" style="float:left;width:50%">
<div class="display_name_wrap" style="float:left;width:50%">
<input name="display_name" type="text" class="disallow_enter textfield" id="setting_display_name" maxlength="30">
</div>
<div style="float:left;width:50%;text-align:right;margin-top:16px">
@ -54,6 +54,42 @@
</div>
<span style="visibility:hidden">-</span>
</div>
<header class="timeline_header" style="border-radius:0;border-top-width:0">
<ul class="header_items">
<li class="item toots view"><?=_('Custom profile fields')?></li>
</ul>
</header>
<div class="timeline">
<div style="float:left;width:50%;text-align:right">
<input name="field_0_name" type="text" class="disallow_enter textfield setting_field" id="setting_field_0_name" placeholder="<?=('Name')?>">
</div>
<div class="field_0_wrap" style="float:left;width:50%">
<input name="field_0_value" type="text" class="disallow_enter textfield setting_field" id="setting_field_0_value" placeholder="<?=('Value')?>">
</div>
<div style="float:left;width:50%;text-align:right">
<input name="field_1_name" type="text" class="disallow_enter textfield setting_field" id="setting_field_1_name" placeholder="<?=('Name')?>">
</div>
<div class="field_1_wrap" style="float:left;width:50%">
<input name="field_1_value" type="text" class="disallow_enter textfield setting_field" id="setting_field_1_value" placeholder="<?=('Value')?>">
</div>
<div style="float:left;width:50%;text-align:right">
<input name="field_2_name" type="text" class="disallow_enter textfield setting_field" id="setting_field_2_name" placeholder="<?=('Name')?>">
</div>
<div class="field_2_wrap" style="float:left;width:50%">
<input name="field_2_value" type="text" class="disallow_enter textfield setting_field" id="setting_field_2_value" placeholder="<?=('Value')?>">
</div>
<div style="float:left;width:50%;text-align:right">
<input name="field_3_name" type="text" class="disallow_enter textfield setting_field" id="setting_field_3_name" placeholder="<?=('Name')?>">
</div>
<div class="field_3_wrap" style="float:left;width:50%">
<input name="field_3_value" type="text" class="disallow_enter textfield setting_field" id="setting_field_3_value" placeholder="<?=('Value')?>">
</div>
<div style="width:75%;margin:auto">
<p style="margin-bottom:5px">To verify that the links in your custom fields really belong to you, you can add the link below to your website. The link text can be changed to whatever you want.</p>
<input class="copy_link_input" id="verifylink" type="text" value="" readonly>
</div>
<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>

View File

@ -14,6 +14,7 @@
@<a id="js_profile_username" href="#"></a><span class="profile_followed_by invisible"><?=_('FOLLOWS YOU')?></span>
</h2>
<p id="js_profile_bio" class="profile_bio"></p>
<div id="js_profile_fields" class="profile_fields"></div>
<div id="js_profile_public_link" class="profile_with_icon invisible" style="margin-bottom:5px">
<a target="_blank"><i class="fa fa-fw fa-link" aria-hidden="true"></i><span><?=_('Open public profile')?></span></a>
</div>

View File

@ -14,6 +14,7 @@
@<a id="js_profile_username" href="#"></a>
</h2>
<p id="js_profile_bio" class="profile_bio"></p>
<div id="js_profile_fields" class="profile_fields"></div>
<div id="js_profile_public_link" class="profile_with_icon invisible" style="margin-bottom:5px">
<a target="_blank"><i class="fa fa-fw fa-link" aria-hidden="true"></i><span><?=_('Open public profile')?></span></a>
</div>

View File

@ -14,6 +14,7 @@
@<a id="js_profile_username" href="#"></a>
</h2>
<p id="js_profile_bio" class="profile_bio"></p>
<div id="js_profile_fields" class="profile_fields"></div>
<div id="js_profile_public_link" class="profile_with_icon invisible" style="margin-bottom:5px">
<a target="_blank"><i class="fa fa-fw fa-link" aria-hidden="true"></i><span><?=_('Open public profile')?></span></a>
</div>

View File

@ -14,6 +14,7 @@
@<a id="js_profile_username" href="#"></a>
</h2>
<p id="js_profile_bio" class="profile_bio"></p>
<div id="js_profile_fields" class="profile_fields"></div>
<div id="js_profile_public_link" class="profile_with_icon invisible" style="margin-bottom:5px">
<a target="_blank"><i class="fa fa-fw fa-link" aria-hidden="true"></i><span><?=_('Open public profile')?></span></a>
</div>

View File

@ -14,6 +14,7 @@
@<a id="js_profile_username" href="#"></a>
</h2>
<p id="js_profile_bio" class="profile_bio"></p>
<div id="js_profile_fields" class="profile_fields"></div>
<div id="js_profile_public_link" class="profile_with_icon invisible" style="margin-bottom:5px">
<a target="_blank"><i class="fa fa-fw fa-link" aria-hidden="true"></i><span><?=_('Open public profile')?></span></a>
</div>

View File

@ -14,6 +14,7 @@
@<a id="js_profile_username" href="#"></a>
</h2>
<p id="js_profile_bio" class="profile_bio"></p>
<div id="js_profile_fields" class="profile_fields"></div>
<div id="js_profile_public_link" class="profile_with_icon invisible" style="margin-bottom:5px">
<a target="_blank"><i class="fa fa-fw fa-link" aria-hidden="true"></i><span><?=_('Open public profile')?></span></a>
</div>

View File

@ -1 +1 @@
2.1.3
2.1.4