diff options
author | friendica <info@friendica.com> | 2014-11-17 23:48:03 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-11-17 23:48:03 -0800 |
commit | db3015e34ed3827e68d8debc70321ed6df5dc699 (patch) | |
tree | 776e7bf5b437e381e68f7f220d343d585a7cd88d | |
parent | 7b39fac5f07cd2e85e4e978de8b259d40c03a173 (diff) | |
download | volse-hubzilla-db3015e34ed3827e68d8debc70321ed6df5dc699.tar.gz volse-hubzilla-db3015e34ed3827e68d8debc70321ed6df5dc699.tar.bz2 volse-hubzilla-db3015e34ed3827e68d8debc70321ed6df5dc699.zip |
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)
-rw-r--r-- | mod/channel.php | 7 | ||||
-rw-r--r-- | mod/network.php | 9 | ||||
-rw-r--r-- | mod/settings.php | 11 | ||||
-rw-r--r-- | view/js/main.js | 20 | ||||
-rwxr-xr-x | view/tpl/settings_display.tpl | 2 |
5 files changed, 31 insertions, 18 deletions
diff --git a/mod/channel.php b/mod/channel.php index b91b6bcef..54b25ad8b 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -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(), diff --git a/mod/network.php b/mod/network.php index c79ff8d6a..522622f03 100644 --- a/mod/network.php +++ b/mod/network.php @@ -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(), diff --git a/mod/settings.php b/mod/settings.php index 725825b34..ab6638ccb 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -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')), + )); diff --git a/view/js/main.js b/view/js/main.js index 9b5c1b1b2..8939f4a09 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -207,6 +207,7 @@ var loadingPage = true; var pageHasMoreContent = true; var updateCountsOnly = false; + var divmore_height = 400; $(function() { $.ajaxSetup({cache: false}); @@ -591,27 +592,14 @@ function updateConvItems(mode,data) { function collapseHeight() { - var isListMode = false; - $(".wall-item-listbody").each(function() { - isListMode = true; - if($(this).height() > 210) { + $(".wall-item-body").each(function() { + if($(this).height() > divmore_height + 10) { if(! $(this).hasClass('divmore')) { - $(this).divgrow({ initialHeight: 200, moreText: aStr['divgrowmore'], lessText: aStr['divgrowless'], showBrackets: false }); + $(this).divgrow({ initialHeight: divmore_height, 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'); - } - } - } - }); } function liveUpdate() { diff --git a/view/tpl/settings_display.tpl b/view/tpl/settings_display.tpl index 8e870ba0e..8bf4dc0cc 100755 --- a/view/tpl/settings_display.tpl +++ b/view/tpl/settings_display.tpl @@ -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}} |