allow members to set the per-item "show more" height (separately for network and matrix, display and search are system pages and therefore set at 400)

This commit is contained in:
friendica 2014-11-17 23:48:03 -08:00
parent 7b39fac5f0
commit db3015e34e
5 changed files with 32 additions and 19 deletions

View file

@ -251,9 +251,14 @@ function channel_content(&$a, $update = 0, $load = false) {
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
// because browser prefetching might change it on us. We have to deliver it with the page.
$maxheight = get_pconfig($a->profile['profile_uid'],'system','channel_divmore_height');
if(! $maxheight)
$maxheight = 400;
$o .= '<div id="live-channel"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . $a->profile['profile_uid']
. "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
. "; var netargs = '?f='; var profile_page = " . $a->pager['page']
. "; divmore_height = " . intval($maxheight) . "; </script>\r\n";
$a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
'$baseurl' => z_root(),

View file

@ -208,8 +208,15 @@ function network_content(&$a, $update = 0, $load = false) {
if($gid || $cid || $cmin || ($cmax != 99) || $star || $liked || $conv || $spam || $nouveau || $list)
$firehose = 0;
$maxheight = get_pconfig(local_user(),'system','network_divmore_height');
if(! $maxheight)
$maxheight = 400;
$o .= '<div id="live-network"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . local_user() . "; var profile_page = " . $a->pager['page'] . ";</script>";
$o .= "<script> var profile_uid = " . local_user()
. "; var profile_page = " . $a->pager['page']
. "; divmore_height = " . intval($maxheight) . "; </script>\r\n";
$a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
'$baseurl' => z_root(),

View file

@ -143,6 +143,12 @@ function settings_post(&$a) {
$channel_list_mode = ((x($_POST,'channel_list_mode')) ? intval($_POST['channel_list_mode']) : 0);
$network_list_mode = ((x($_POST,'network_list_mode')) ? intval($_POST['network_list_mode']) : 0);
$channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400);
if($channel_divmore_height < 50)
$channel_divmore_height = 50;
$network_divmore_height = ((x($_POST,'network_divmore_height')) ? intval($_POST['network_divmore_height']) : 400);
if($network_divmore_height < 50)
$network_divmore_height = 50;
$browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0);
$browser_update = $browser_update * 1000;
@ -165,6 +171,8 @@ function settings_post(&$a) {
set_pconfig(local_user(),'system','title_tosource',$title_tosource);
set_pconfig(local_user(),'system','channel_list_mode', $channel_list_mode);
set_pconfig(local_user(),'system','network_list_mode', $network_list_mode);
set_pconfig(local_user(),'system','channel_divmore_height', $channel_divmore_height);
set_pconfig(local_user(),'system','network_divmore_height', $network_divmore_height);
if ($theme == $a->channel['channel_theme']){
// call theme_post only if theme has not been changed
@ -810,6 +818,9 @@ function settings_content(&$a) {
'$expert' => feature_enabled(local_user(),'expert'),
'$channel_list_mode' => array('channel_list_mode', t('Use blog/list mode on channel page'), get_pconfig(local_user(),'system','channel_list_mode'), t('(comments displayed separately)')),
'$network_list_mode' => array('network_list_mode', t('Use blog/list mode on matrix page'), get_pconfig(local_user(),'system','network_list_mode'), t('(comments displayed separately)')),
'$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), ((get_pconfig(local_user(),'system','channel_divmore_height')) ? get_pconfig(local_user(),'system','channel_divmore_height') : 400), t('click to expand content exceeding this height')),
'$network_divmore_height' => array('network_divmore_height', t('Matrix page max height of content (in pixels)'), ((get_pconfig(local_user(),'system','network_divmore_height')) ? get_pconfig(local_user(),'system','network_divmore_height') : 400) , t('click to expand content exceeding this height')),
));

View file

@ -207,6 +207,7 @@
var loadingPage = true;
var pageHasMoreContent = true;
var updateCountsOnly = false;
var divmore_height = 400;
$(function() {
$.ajaxSetup({cache: false});
@ -591,24 +592,11 @@ function updateConvItems(mode,data) {
function collapseHeight() {
var isListMode = false;
$(".wall-item-listbody").each(function() {
isListMode = true;
if($(this).height() > 210) {
if(! $(this).hasClass('divmore')) {
$(this).divgrow({ initialHeight: 200, moreText: aStr['divgrowmore'], lessText: aStr['divgrowless'], showBrackets: false });
$(this).addClass('divmore');
}
}
});
$(".wall-item-body").each(function() {
if(! isListMode) {
if($(this).height() > 410) {
if(! $(this).hasClass('divmore')) {
$(this).divgrow({ initialHeight: 400, moreText: aStr['divgrowmore'], lessText: aStr['divgrowless'], showBrackets: false });
$(this).addClass('divmore');
}
if($(this).height() > divmore_height + 10) {
if(! $(this).hasClass('divmore')) {
$(this).divgrow({ initialHeight: divmore_height, moreText: aStr['divgrowmore'], lessText: aStr['divgrowless'], showBrackets: false });
$(this).addClass('divmore');
}
}
});

View file

@ -11,6 +11,8 @@
{{/if}}
{{include file="field_input.tpl" field=$ajaxint}}
{{include file="field_input.tpl" field=$itemspage}}
{{include file="field_input.tpl" field=$channel_divmore_height}}
{{include file="field_input.tpl" field=$network_divmore_height}}
{{include file="field_checkbox.tpl" field=$nosmile}}
{{include file="field_checkbox.tpl" field=$title_tosource}}
{{include file="field_checkbox.tpl" field=$channel_list_mode}}