rudamentary blocking, work in progress

This commit is contained in:
Hannes Mannerheim 2015-01-27 01:57:08 +01:00
parent 78d35d6bd5
commit a7f0100d42
5 changed files with 134 additions and 24 deletions

View File

@ -214,7 +214,7 @@ class QvitterAction extends ApiAction
div.syntax-middle span,
#user-body strong,
ul.stats,
.stream-item:not(.temp-post) ul.queet-actions li .icon:hover:before,
.stream-item:not(.temp-post) ul.queet-actions li .icon:not(.is-mine):hover:before,
.show-full-conversation,
#user-body #user-queets:hover .label,
#user-body #user-groups:hover .label,

View File

@ -315,7 +315,7 @@ button.icon.nav-search span {
}
.quitter-settings.dropdown-menu.dropped {
display:block;
}
}
.dropdown-caret {
float: left;
height: 7px;
@ -408,6 +408,24 @@ body.rtl .dropdown-menu li:not(.dropdown-caret) {
color: #FFFFFF;
text-decoration: none;
}
/* dropdown menu from ellipsis button */
.action-ellipsis-container {
position:relative;
}
.action-ellipsis-container .dropdown-menu {
display: block;
float: right;
left: -6px;
top: 24px;
right:auto;
}
.action-ellipsis-container .dropdown-menu,
.action-ellipsis-container .dropdown-menu li:not(.dropdown-caret),
.action-ellipsis-container .dropdown-menu a {
width:auto;
}
#invite-link {
font-weight:bold;
@ -1902,7 +1920,7 @@ ul.queet-actions a {
color:#ddd;
}
.queet:hover ul.queet-actions a {
.queet:hover ul.queet-actions > li > a {
color:#999;
}
.stream-item.expanded > .queet ul.queet-actions {
@ -1928,7 +1946,7 @@ ul.queet-actions li .icon {
ul.queet-actions li.action-rt-container .with-icn.done .icon:before {
color: #609928;
}
ul.queet-actions li.action-rt-container .with-icn .icon:hover:before {
ul.queet-actions li.action-rt-container .with-icn .icon:not(.is-mine):hover:before {
color: #609928;
}
ul.queet-actions li.action-fav-container .with-icn.done .icon:before {
@ -1937,7 +1955,7 @@ ul.queet-actions li.action-fav-container .with-icn.done .icon:before {
.stream-item:not(.temp-post) ul.queet-actions li.action-fav-container .with-icn .icon:hover:before {
color: #ffac33;
}
.stream-item:not(.temp-post) ul.queet-actions li.action-rt-container .with-icn .icon:hover:before {
.stream-item:not(.temp-post) ul.queet-actions li.action-rt-container .with-icn .icon:not(.is-mine):hover:before {
color: #609928;
}
@ -2005,6 +2023,11 @@ ul.queet-actions li .icon.sm-ellipsis:before {
font-size: 22px;
line-height: 28px;
}
ul.queet-actions li .icon.is-mine:before {
opacity:0.4;
cursor:default;
}
.queet.rtl .queet-content {
margin-left:0;

View File

@ -1188,18 +1188,21 @@ function showConversation(qid) {
if(obj.in_reply_to_screen_name != null) {
in_reply_to_screen_name = obj.in_reply_to_screen_name;
}
// is this mine?
var isThisMine = 'not-mine';
if(obj.user.id == window.myUserID) {
var isThisMine = 'is-mine';
}
// requeet or delete html
var requeetedClass = '';
if(obj.user.id == window.myUserID) {
var requeetHtml = '<li class="action-del-container"><a class="with-icn"><span class="icon sm-trash" title="' + window.sL.deleteVerb + '"></span></a></li>';
}
else if(obj.repeated) {
if(obj.repeated) {
var requeetHtml = '<li class="action-rt-container"><a class="with-icn done"><span class="icon sm-rt" title="' + window.sL.requeetedVerb + '"></span></a></li>';
requeetedClass = 'requeeted';
}
else {
var requeetHtml = '<li class="action-rt-container"><a class="with-icn"><span class="icon sm-rt" title="' + window.sL.requeetVerb + '"></span></a></li>';
var requeetHtml = '<li class="action-rt-container"><a class="with-icn"><span class="icon sm-rt ' + isThisMine + '" title="' + window.sL.requeetVerb + '"></span></a></li>';
}
// favorite html
var favoritedClass = '';
@ -1214,7 +1217,7 @@ function showConversation(qid) {
// actions only for logged in users
var queetActions = '';
if(typeof window.loggedIn.screen_name != 'undefined') {
queetActions = '<ul class="queet-actions"><li class="action-reply-container"><a class="with-icn"><span class="icon sm-reply" title="' + window.sL.replyVerb + '"></span></a></li>' + requeetHtml + '<li class="action-fav-container">' + favoriteHtml + '</li></ul>';
queetActions = '<ul class="queet-actions"><li class="action-reply-container"><a class="with-icn"><span class="icon sm-reply" title="' + window.sL.replyVerb + '"></span></a></li>' + requeetHtml + '<li class="action-fav-container">' + favoriteHtml + '</li><li class="action-ellipsis-container"><a class="with-icn"><span class="icon sm-ellipsis" title="' + window.sL.ellipsisMore + '"></span></a></li></ul>';
}
@ -1753,17 +1756,20 @@ function buildQueetHtml(obj, idInStream, extraClassesThisRun, requeeted_by) {
in_reply_to_screen_name = obj.in_reply_to_screen_name;
}
// is this mine?
var isThisMine = 'not-mine';
if(obj.user.id == window.myUserID) {
var isThisMine = 'is-mine';
}
// requeet html
var requeetedClass = '';
if(obj.user.id == window.myUserID) {
var requeetHtml = '<li class="action-del-container"><a class="with-icn"><span class="icon sm-trash" title="' + window.sL.deleteVerb + '"></span></a></li></i></li>';
}
else if(obj.repeated) {
if(obj.repeated) {
var requeetHtml = '<li class="action-rt-container"><a class="with-icn done"><span class="icon sm-rt" title="' + window.sL.requeetedVerb + '"></span></a></li>';
var requeetedClass = 'requeeted';
}
else {
var requeetHtml = '<li class="action-rt-container"><a class="with-icn"><span class="icon sm-rt" title="' + window.sL.requeetVerb + '"></span></a></li>';
var requeetHtml = '<li class="action-rt-container"><a class="with-icn"><span class="icon sm-rt ' + isThisMine + '" title="' + window.sL.requeetVerb + '"></span></a></li>';
}
// favorite html
var favoritedClass = '';
@ -1779,7 +1785,7 @@ function buildQueetHtml(obj, idInStream, extraClassesThisRun, requeeted_by) {
// actions only for logged in users
var queetActions = '';
if(typeof window.loggedIn.screen_name != 'undefined') {
queetActions = '<ul class="queet-actions"><li class="action-reply-container"><a class="with-icn"><span class="icon sm-reply" title="' + window.sL.replyVerb + '"></span></a></li>' + requeetHtml + '<li class="action-fav-container">' + favoriteHtml + '</li></ul>';
queetActions = '<ul class="queet-actions"><li class="action-reply-container"><a class="with-icn"><span class="icon sm-reply" title="' + window.sL.replyVerb + '"></span></a></li>' + requeetHtml + '<li class="action-fav-container">' + favoriteHtml + '</li><li class="action-ellipsis-container"><a class="with-icn"><span class="icon sm-ellipsis" title="' + window.sL.ellipsisMore + '"></span></a></li></ul>';
}
// reply-to html

View File

@ -155,6 +155,8 @@ window.l.ca.inviteAFriend = 'Convida els amics!';
window.l.ca.goToExternalProfile = 'Mostra el perfil complet';
window.l.ca.cropAndSave = 'Retalla i desa';
window.l.ca.showTerms = 'Read our Terms of Use';
window.l.ca.ellipsisMore = 'More';
window.l.ca.blockUser = 'Block {username}';
// spanish
@ -276,6 +278,8 @@ window.l.es.inviteAFriend = '¡Invita a tus amigos!';
window.l.es.goToExternalProfile = 'Ir al perfil completo';
window.l.es.cropAndSave = 'Recortar y guardar';
window.l.es.showTerms = 'Read our Terms of Use';
window.l.es.ellipsisMore = 'More';
window.l.es.blockUser = 'Block {username}';
// spanish (ahorita)
window.l.es_ahorita = new Object();
@ -402,6 +406,8 @@ window.l.pt_br.inviteAFriend = 'Convide seus amigos!';
window.l.pt_br.goToExternalProfile = 'Ir para o perfil completo';
window.l.pt_br.cropAndSave = 'Crop and save';
window.l.pt_br.showTerms = 'Read our Terms of Use';
window.l.pt_br.ellipsisMore = 'More';
window.l.pt_br.blockUser = 'Block {username}';
// galician
@ -523,6 +529,8 @@ window.l.gl.inviteAFriend = 'Convida aos teus amigos!';
window.l.gl.goToExternalProfile = 'Ir ao perfil completo';
window.l.gl.cropAndSave = 'Recortar e gardar';
window.l.gl.showTerms = 'Read our Terms of Use';
window.l.gl.ellipsisMore = 'More';
window.l.gl.blockUser = 'Block {username}';
// basque
window.l.eu = new Object();
@ -643,6 +651,8 @@ window.l.eu.inviteAFriend = 'Zure Lagunak Gonbidatu!';
window.l.eu.goToExternalProfile = 'Profil osora joan';
window.l.eu.cropAndSave = 'Crop and save';
window.l.eu.showTerms = 'Read our Terms of Use';
window.l.eu.ellipsisMore = 'More';
window.l.eu.blockUser = 'Block {username}';
// french
window.l.fr = new Object();
@ -763,6 +773,8 @@ window.l.fr.inviteAFriend = 'Invite des ami·e·s !';
window.l.fr.goToExternalProfile = 'Aller sur le profil complet';
window.l.fr.cropAndSave = 'Recadrer et enregistrer';
window.l.fr.showTerms = 'Read our Terms of Use';
window.l.fr.ellipsisMore = 'More';
window.l.fr.blockUser = 'Block {username}';
// deutsch
window.l.de = new Object();
@ -895,6 +907,8 @@ window.l.de.inviteAFriend = 'Lade deine Freunde ein!';
window.l.de.goToExternalProfile = 'Vollständiges Profil anzeigen';
window.l.de.cropAndSave = 'Zuschneiden und Abspeichern';
window.l.de.showTerms = '{site-title} Nutzungsbedingungen';
window.l.de.ellipsisMore = 'More';
window.l.de.blockUser = 'Block {username}';
// english
window.l.en = new Object();
@ -1023,6 +1037,8 @@ window.l.en.inviteAFriend = 'Invite a friend!';
window.l.en.goToExternalProfile = 'Go to full profile';
window.l.en.cropAndSave = 'Crop and save';
window.l.en.showTerms = 'Read our Terms of Use';
window.l.en.ellipsisMore = 'More';
window.l.en.blockUser = 'Block {username}';
// simplified chinese
@ -1144,6 +1160,8 @@ window.l.zh_cn.inviteAFriend = '邀请好友';
window.l.zh_cn.goToExternalProfile = '前往完整的个人档案';
window.l.zh_cn.cropAndSave = 'Crop and save';
window.l.zh_cn.showTerms = 'Read our Terms of Use';
window.l.zh_cn.ellipsisMore = 'More';
window.l.zh_cn.blockUser = 'Block {username}';
// traditional chinese
@ -1265,6 +1283,8 @@ window.l.zh_tw.inviteAFriend = '邀請你的朋友';
window.l.zh_tw.goToExternalProfile = '前往詳細個人檔案';
window.l.zh_tw.cropAndSave = 'Crop and save';
window.l.zh_tw.showTerms = 'Read our Terms of Use';
window.l.zh_tw.ellipsisMore = 'More';
window.l.zh_tw.blockUser = 'Block {username}';
// svenska
@ -1386,6 +1406,8 @@ window.l.sv.inviteAFriend = 'Bjud in dina vänner!';
window.l.sv.goToExternalProfile = 'Gå till hela profilen';
window.l.sv.cropAndSave = 'Beskär och spara';
window.l.sv.showTerms = 'Läs våra användarvillkor';
window.l.sv.ellipsisMore = 'Mer';
window.l.sv.blockUser = 'Blockera {username}';
// suomi
window.l.fi = new Object();
@ -1506,6 +1528,8 @@ window.l.fi.inviteAFriend = 'Kutsu kavereitasi!';
window.l.fi.goToExternalProfile = 'Siirry täyteen profiiliin';
window.l.fi.cropAndSave = 'Crop and save';
window.l.fi.showTerms = 'Read our Terms of Use';
window.l.fi.ellipsisMore = 'More';
window.l.fi.blockUser = 'Block {username}';
// farsi/persian
window.l.fa = new Object();
@ -1626,6 +1650,8 @@ window.l.fa.inviteAFriend = 'دعوت از دوستانتان';
window.l.fa.goToExternalProfile = 'رفتن به نمایه کامل';
window.l.fa.cropAndSave = 'Crop and save';
window.l.fa.showTerms = 'Read our Terms of Use';
window.l.fa.ellipsisMore = 'More';
window.l.fa.blockUser = 'Block {username}';
// arabic
window.l.ar = new Object();
@ -1746,6 +1772,8 @@ window.l.ar.inviteAFriend = 'دعوة أصدقائك!';
window.l.ar.goToExternalProfile = 'اذهب إلى الملف الشخصي الكامل';
window.l.ar.cropAndSave = 'قُص و احفظ.';
window.l.ar.showTerms = 'Read our Terms of Use';
window.l.ar.ellipsisMore = 'More';
window.l.ar.blockUser = 'Block {username}';
// esperanto
window.l.eo = new Object();
@ -1875,6 +1903,8 @@ window.l.eo.inviteAFriend = 'Inviti viajn amikojn!';
window.l.eo.goToExternalProfile = 'iru al plena profilon';
window.l.eo.cropAndSave = 'Tondu kaj savu';
window.l.eo.showTerms = 'Read our Terms of Use';
window.l.eo.ellipsisMore = 'More';
window.l.eo.blockUser = 'Block {username}';
// italian
window.l.it = new Object();
@ -2004,6 +2034,8 @@ window.l.it.inviteAFriend = 'Invita i tuoi amici!';
window.l.it.goToExternalProfile = 'Vai al profilo completo';
window.l.it.cropAndSave = 'ritaglia e salva';
window.l.it.showTerms = 'Read our Terms of Use';
window.l.it.ellipsisMore = 'More';
window.l.it.blockUser = 'Block {username}';
// Norwegian
window.l.no = new Object();
@ -2124,6 +2156,8 @@ window.l.no.inviteAFriend = 'Inviter venner';
window.l.no.goToExternalProfile = 'Gå til fullstendig profil';
window.l.no.cropAndSave = 'Beskjær og lagre';
window.l.no.showTerms = 'Read our Terms of Use';
window.l.no.ellipsisMore = 'More';
window.l.no.blockUser = 'Block {username}';
// asturian
window.l.ast = new Object();
@ -2244,6 +2278,8 @@ window.l.ast.inviteAFriend = '¡Convida a los collacios!';
window.l.ast.goToExternalProfile = 'Dir al perfil completu';
window.l.ast.cropAndSave = 'Recortar y guardar';
window.l.ast.showTerms = 'Read our Terms of Use';
window.l.ast.ellipsisMore = 'More';
window.l.ast.blockUser = 'Block {username}';

View File

@ -832,7 +832,7 @@ $('body').on('click','a', function(e) {
setNewCurrentStream('statusnet/tags/timeline/' + $(this).text().toLowerCase().replace('#','') + '.json',function(){},true);
}
// notices
else if ($(this).attr('href').indexOf(window.siteRootDomain + '/notice/')>-1) {
else if ($(this).attr('href').indexOf(window.siteRootDomain + '/notice/')>-1 && $(this).attr('href').indexOf(window.siteRootDomain + '/notice/delete/')==-1) {
e.preventDefault();
setNewCurrentStream('statuses/show/' + $(this).attr('href').replace('http://','').replace('https://','').replace(window.siteRootDomain + '/notice/','') + '.json',function(){},true);
}
@ -997,6 +997,48 @@ $('body').on('click','a', function(e) {
}
}
});
/* ·
·
· Open a queet menu when clicking ellipsis button
·
· · · · · · · · · · · · · */
$('body').on('click','.sm-ellipsis',function(){
// hide
if($(this).closest('.action-ellipsis-container').children('.dropdown-menu').length > 0) {
$(this).closest('.action-ellipsis-container').children('.dropdown-menu').remove();
}
// show
else {
$('.action-ellipsis-container').children('.dropdown-menu').remove(); // remove menu from other queets
var streamItemUsername = $(this).closest('.stream-item').find('.stream-item-header').find('.screen-name').text();
var streamItemUserID = $(this).closest('.stream-item').find('.stream-item-header').find('.name').attr('data-user-id');
var streamItemID = $(this).closest('.stream-item').attr('data-quitter-id');
var blockHtml = '';
var deleteHtml = '';
if(streamItemUserID != window.loggedIn.id) {
blockHtml = '<li><a class="block-user" href="' + window.siteInstanceURL + 'main/block?profileid=' + streamItemUserID + '">' + window.sL.blockUser.replace('{username}',streamItemUsername) + '</a></li>';
}
else {
deleteHtml = '<li><a class="delete-queet" href="' + window.siteInstanceURL + 'notice/delete/' + streamItemID + '">' + window.sL.deleteVerb + '</a></li>';
}
$(this).closest('.action-ellipsis-container').append('\
<ul class="dropdown-menu">\
<li class="dropdown-caret left"><span class="caret-outer"></span><span class="caret-inner"></span></li>\
' + blockHtml + '\
' + deleteHtml + '\
</ul>\
');
}
});
/* ·
@ -1217,12 +1259,13 @@ $('body').on('click','.queet',function (event) {
/* ·
·
· Collapse all open conversations on esc or when clicking the margin
· Collapse all open conversations and ellipsis menus on esc or when clicking the margin
·
· · · · · · · · · · · · · */
$('body').click(function(event){
if($(event.target).is('body')) {
$('.action-ellipsis-container').children('.dropdown-menu').remove();
$.each($('.stream-item.expanded'),function(){
expand_queet($(this), false);
});
@ -1231,6 +1274,7 @@ $('body').click(function(event){
$(document).keyup(function(e){
if(e.keyCode==27) { // esc
$('.action-ellipsis-container').children('.dropdown-menu').remove();
$.each($('.stream-item.expanded'),function(){
expand_queet($(this), false);
});
@ -1244,8 +1288,9 @@ $(document).keyup(function(e){
·
· · · · · · · · · · · · · */
$('body').on('click','.action-del-container',function(){
var this_stream_item = $(this).parent().parent().parent().parent().parent();
$('body').on('click','.action-ellipsis-container .delete-queet',function(e){
e.preventDefault();
var this_stream_item = $(this).closest('.stream-item');
// don't do anything if this is a queet being posted
if(this_stream_item.hasClass('temp-post')) {
@ -1287,9 +1332,9 @@ $('body').on('click','.action-del-container',function(){
·
· · · · · · · · · · · · · */
$('body').on('click','.action-rt-container',function(){
var this_stream_item = $(this).parent().parent().parent().parent().parent();
var this_action = $(this);
$('body').on('click','.action-rt-container .icon:not(.is-mine)',function(){
var this_stream_item = $(this).closest('.stream-item');
var this_action = $(this).closest('li');
// requeet
if(!this_action.children('.with-icn').hasClass('done')) {