Commit f8cd822e authored by Malcolm Blaney's avatar Malcolm Blaney

Reader module changes for more channel support, including storing

channel order and unread settings per user. Multi-author feeds can
now be split amongst different channels based on author. The channel
options are displayed for the author as a tooltip when hovering over
their name. Channel unread count or status is displayed in the
channel select in the control bar and updates as feed notifications
are received.
parent f7fa27ea
Pipeline #43205255 passed with stage
in 1 minute and 17 seconds
......@@ -878,7 +878,7 @@ button.ui-button::-moz-focus-inner {
.ui-tooltip {
padding: 8px;
position: absolute;
z-index: 9999;
z-index: 99;
max-width: 300px;
}
body .ui-tooltip {
......
......@@ -14,7 +14,7 @@ minify_js() {
"@licstart The following is the entire license notice" \
"for the JavaScript code in this page." \
"" \
"Copyright (C) 2018 Malcolm Blaney" \
"Copyright (C) 2019 Malcolm Blaney" \
"" \
"This program is free software: you can redistribute it and/or modify" \
"it under the terms of the GNU Affero General Public License as" \
......
......@@ -476,6 +476,8 @@ class Post extends Base {
$site_style = ['"",".post .thumb","width","20px"',
'"",".post .thumb","border-radius","2px"',
'"",".post .options > *","padding","5px"',
'"",".post .dobrado-editable","min-height","0"',
'"",".post .dobrado-editable","padding","5px"',
'"",".post .navigation .next","float","right"',
'"",".post-reposted-by","font-size","0.8em"',
'"",".post-web-actions","padding-top","10px"',
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3,7 +3,7 @@
// @licstart The following is the entire license notice
// for the JavaScript code in this page.
//
// Copyright (C) 2018 Malcolm Blaney
// Copyright (C) 2019 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -36,7 +36,8 @@ function checkboxradio(id,name,display,fn){if($('#'+id).length===0){return;}
var label=$('#'+id).labels().html();if(display){label+=' '+name;}
else{$('label[for='+id+']').addClass('ui-button-icon-only');}
$('#'+id).checkboxradio({icon:false,label:label}).click(fn);}
currentPage=$('#page-select').val();let display=$('.dobrado-mobile').is(':hidden');$('.control-button.home').button({icon:'ui-icon-home',showLabel:display}).click(dobrado.home);$('.control-button.indieauth-home').button({icon:'ui-icon-home',showLabel:display}).click(indieauthHome);$('.control-button.account-button').button({icon:'ui-icon-person',showLabel:display}).click(showAccount);$('.account-menu-wrapper .menu li').each(function(){$(this).click(dobrado.account.option);});$('.control-button.message-button').button({icon:'ui-icon-comment',showLabel:display}).click(message);$('.control-button.notification-button').button({icon:'ui-icon-star',showLabel:display}).click(notification);$('#control-tools').prop('checked',false);checkboxradio('control-tools','tools',display,tools);$('.control-button.site').button({icon:'ui-icon-gear',showLabel:display}).click(site);$('.control-button.page').button({icon:'ui-icon-document',showLabel:display}).click(page);$('#page-select').selectmenu({change:pageSelect});$('#reset-page-select').button({icon:'ui-icon-closethick',showLabel:false}).click(resetPageSelect);$('#page-input').keypress(pageSubmit).click(dobrado.clear);$('.control-button.add').button({icon:'ui-icon-plus',showLabel:display}).click(add);$('.add-menu-wrapper .menu li').each(function(){$(this).click(dobrado.addModule);});$('#control-edit').prop('checked',false);checkboxradio('control-edit','edit',display,edit);$('#control-layout').prop('checked',false);checkboxradio('control-layout','layout',display,layout);$('.control-button.copy').button({icon:'ui-icon-copy',showLabel:display}).click(copy);$('#copy-input').keypress(copySubmit).click(dobrado.clear);$('.control .menu').menu();$('.arrow-border').css('border-color','transparent transparent '+
currentPage=$('#page-select').val();let display=$('.dobrado-mobile').is(':hidden');$('.control-button.home').button({icon:'ui-icon-home',showLabel:display}).click(dobrado.home);$('.control-button.indieauth-home').button({icon:'ui-icon-home',showLabel:display}).click(indieauthHome);$('.control-button.account-button').button({icon:'ui-icon-person',showLabel:display}).click(showAccount);$('.account-menu-wrapper .menu li').each(function(){$(this).click(dobrado.account.option);});$('.control-button.message-button').button({icon:'ui-icon-comment',showLabel:display}).click(message);$('.control-button.notification-button').button({icon:'ui-icon-star',showLabel:display}).click(notification);$('#control-tools').prop('checked',false);checkboxradio('control-tools','tools',display,tools);$('.control-button.site').button({icon:'ui-icon-gear',showLabel:display}).click(site);$('.control-button.page').button({icon:'ui-icon-document',showLabel:display}).click(page);$.widget('custom.pageselectmenu',$.ui.selectmenu,{_renderItem:function(ul,item){var li=$('<li>');var wrapper=$('<div>',{text:item.label});if(item.element.attr('data-class')==='true'){li.addClass('reader-unread-true');}
return li.append(wrapper).appendTo(ul);}});$('#page-select').pageselectmenu({change:pageSelect});$('#reset-page-select').button({icon:'ui-icon-closethick',showLabel:false}).click(resetPageSelect);$('#page-input').keypress(pageSubmit).click(dobrado.clear);$('.control-button.add').button({icon:'ui-icon-plus',showLabel:display}).click(add);$('.add-menu-wrapper .menu li').each(function(){$(this).click(dobrado.addModule);});$('#control-edit').prop('checked',false);checkboxradio('control-edit','edit',display,edit);$('#control-layout').prop('checked',false);checkboxradio('control-layout','layout',display,layout);$('.control-button.copy').button({icon:'ui-icon-copy',showLabel:display}).click(copy);$('#copy-input').keypress(copySubmit).click(dobrado.clear);$('.control .menu').menu();$('.arrow-border').css('border-color','transparent transparent '+
dobrado.arrowBorderColor+' transparent');$('.arrow').css('border-color','transparent transparent '+
dobrado.arrowBackgroundColor+' transparent');$('.notification-dialog').dialog({show:true,autoOpen:false,width:450,height:500,position:{my:'top',at:'top+50',of:window},title:'Notifications',create:dobrado.fixedDialog});setTimeout(function(){$('.control').show('fade');},500);$('#notification-tabs').tabs();showNotifications();dobrado.notify('system',dobrado.control.notifications);dobrado.notify('feed',dobrado.control.notifications);dobrado.notify('comment',dobrado.control.notifications);dobrado.notify('tag',dobrado.control.notifications);dobrado.notify('star',dobrado.control.notifications);dobrado.notify('share',dobrado.control.notifications);dobrado.notify('invite',dobrado.control.notifications);});function showNotifications(){function addToGroup(){dobrado.log('Adding notification.','info');$.post('/php/request.php',{request:'notification',action:'addToGroup',url:location.href,token:dobrado.token},function(response){if(dobrado.checkResponseError(response,'add notification')){return false;}
var notification=JSON.parse(response);var group='.notifications-'+notification.type+'-group';$(group).append(notification.group).show();$('.remove-notification-group').button({icon:'ui-icon-closethick',showLabel:false}).click(removeFromGroup);$('#add-notification').remove();});return false;}
......@@ -155,7 +156,7 @@ else if($('.reader').length!==0){currentPage=ui.item.value;dobrado.reader.channe
else{dobrado.changePage(ui.item.value);}}
function pageSubmit(event){if(event.keyCode!==13){return;}
event.preventDefault();dobrado.changePage($(this).val());return false;}
function resetPageSelect(){$('#page-select').val(currentPage).selectmenu('refresh');$('#page-select-button').show();$('#page-input').hide();$('#reset-page-select').hide();return false;}
function resetPageSelect(){$('#page-select').val(currentPage).pageselectmenu('refresh');$('#page-select-button').show();$('#page-input').hide();$('#reset-page-select').hide();return false;}
dobrado.control.notifications=function(action){if(notificationsRequested){return;}
notificationsRequested=true;$.post('/php/request.php',{request:'notification',action:'new',url:location.href,token:dobrado.token},function(response){if(dobrado.checkResponseError(response,'notifications callback')){return;}
var notification=JSON.parse(response);if(notification.content!==''){if($('.notifications').length===0){$('<div></div>').addClass('notifications').appendTo('body');}
......
......@@ -2,7 +2,7 @@
// @licstart The following is the entire license notice
// for the JavaScript code in this page.
//
// Copyright (C) 2018 Malcolm Blaney
// Copyright (C) 2019 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -128,7 +128,17 @@ if (!this.dobrado.control) {
showLabel: display }).click(site);
$('.control-button.page').button({ icon: 'ui-icon-document',
showLabel: display }).click(page);
$('#page-select').selectmenu({ change: pageSelect });
$.widget('custom.pageselectmenu', $.ui.selectmenu, {
_renderItem: function(ul, item) {
var li = $('<li>');
var wrapper = $('<div>', { text: item.label });
if (item.element.attr('data-class') === 'true') {
li.addClass('reader-unread-true');
}
return li.append(wrapper).appendTo(ul);
}
});
$('#page-select').pageselectmenu({ change: pageSelect });
$('#reset-page-select').button({ icon: 'ui-icon-closethick',
showLabel: false }).click(resetPageSelect);
$('#page-input').keypress(pageSubmit).click(dobrado.clear);
......@@ -1158,7 +1168,7 @@ if (!this.dobrado.control) {
}
function resetPageSelect() {
$('#page-select').val(currentPage).selectmenu('refresh');
$('#page-select').val(currentPage).pageselectmenu('refresh');
$('#page-select-button').show();
$('#page-input').hide();
$('#reset-page-select').hide();
......
<?php
// Dobrado Content Management System
// Copyright (C) 2018 Malcolm Blaney
// Copyright (C) 2019 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -178,7 +178,7 @@ function discover_endpoint($us_url, $rels) {
$mysqli = connect_db();
// Check if there's an existing photo to avoid caching it again.
$us_photo = '';
$url = $mysqli->escape_string($us_url);
$url = $mysqli->escape_string(trim($us_url, ' /'));
$query = 'SELECT photo FROM nickname WHERE url = "' . $url . '"';
if ($mysqli_result = $mysqli->query($query)) {
if ($nickname = $mysqli_result->fetch_assoc()) {
......@@ -348,7 +348,7 @@ function parse_hcard($author, $name_only = false) {
$mysqli = connect_db();
if (isset($author['type']) && in_array('h-card', $author['type'])) {
if (isset($author['properties']['url'][0])) {
$us_author_url = $author['properties']['url'][0];
$us_author_url = trim($author['properties']['url'][0], ' /');
if (stripos($us_author_url, 'http') !== 0) {
$us_author_url = 'http://' . $us_author_url;
}
......@@ -367,7 +367,7 @@ function parse_hcard($author, $name_only = false) {
}
// A second author in an h-card is assumed to be a repost author.
if (isset($author['properties']['url'][1])) {
$us_repost_url = $author['properties']['url'][1];
$us_repost_url = trim($author['properties']['url'][1], ' /');
if (stripos($us_repost_url, 'http') !== 0) {
$us_repost_url = 'http://' . $us_repost_url;
}
......
......@@ -670,11 +670,9 @@ class SimplePie_Parser
}
if ($use_content && isset($entry['properties']['content'][0]['html'])) {
// e-content['value'] is the same as p-name when they are on the same
// element. Use this to replace title with a strip_tags version so
// that alt text from images is not included in the title.
// element, so in this case no title is displayed for the entry.
if ($entry['properties']['content'][0]['value'] === $title) {
$title = strip_tags($entry['properties']['content'][0]['html']);
$item['title'] = array(array('data' => $title));
$item['title'] = array(array('data' => ''));
}
$description .= $entry['properties']['content'][0]['html'];
}
......
......@@ -634,7 +634,7 @@ class SimplePie_Sanitize
private function resize_image($src, $image) {
$name = '';
$type = '';
$regex = '/\/([a-z0-9_-]{1,200})\.([a-z0-9]{1,10})$/i';
$regex = '/\/([a-z0-9_\.-]{1,200})\.([a-z0-9]{1,10})$/i';
if (preg_match($regex, $src, $match)) {
$name = strtolower($match[1]);
$type = strtolower($match[2]);
......
<?php
// Dobrado Content Management System
// Copyright (C) 2018 Malcolm Blaney
// Copyright (C) 2019 Malcolm Blaney
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
......@@ -511,13 +511,19 @@ class Control extends Base {
}
}
}
// Add an option so that page-input can be displayed instead of the select.
if ($options !== '') {
if (!$selected) {
// Show the current page at the top of the select for display purposes.
$options = '<option value="" selected="selected">' . $this->user->page .
'</option>' . $options;
}
// TODO: Indieauth login currently doesn't allow search via page-input.
if ($this->user->group === $this->Substitute('indieauth-group')) {
return '<form id="control-page-form">' .
'<select id="page-select">' . $options . '</select></form>';
}
// Add an option so that page-input can be displayed instead of select.
$options .= '<option value="">other...</option>';
// When input is toggled allow resetting to select menu by adding a reset
// button with the page input.
......@@ -531,6 +537,9 @@ class Control extends Base {
'</form>';
}
// If using indieauth login don't display page-input when there are no
// options available.
if ($this->user->group === $this->Substitute('indieauth-group')) return '';
return '<form id="control-page-form">' .
'<input id="page-input" class="control-input" ' .
'type="text" name="page" value="change page..." maxlength="200">' .
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment