diff --git a/showmore_dyn/lang/C/messages.po b/showmore_dyn/lang/C/messages.po index 0dc4d11c..c91cb1d0 100644 --- a/showmore_dyn/lang/C/messages.po +++ b/showmore_dyn/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-15 21:20+0100\n" +"POT-Creation-Date: 2020-12-31 09:16-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,14 +17,24 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: showmore_dyn.php:62 +#: showmore_dyn.php:59 msgid "Save Settings" msgstr "" -#: showmore_dyn.php:64 showmore_dyn.php:65 +#: showmore_dyn.php:60 +msgid "Show More Dynamic" +msgstr "" + +#: showmore_dyn.php:61 msgid "Limit Height" msgstr "" -#: showmore_dyn.php:73 -msgid "Show more ..." +#: showmore_dyn.php:61 +msgid "" +"The maximal pixel height of posts before the Show More link is added, 0 to " +"disable" +msgstr "" + +#: showmore_dyn.php:69 +msgid "Show more..." msgstr "" diff --git a/showmore_dyn/showmore_dyn.js b/showmore_dyn/showmore_dyn.js index 4b32b2d3..74803d2d 100644 --- a/showmore_dyn/showmore_dyn.js +++ b/showmore_dyn/showmore_dyn.js @@ -6,15 +6,14 @@ $(document).ready(function() { return; } - $("head").append(''); - var newStyleElement = $("head").children(':last'); - newStyleElement.html('.limit-height{max-height: ' + postLimitHeight + 'px; overflow: hidden; }'); - - handleNewWallItemBodies(); - - document.addEventListener("postprocess_liveupdate", function() { + if (postLimitHeight) { + $('head').append(''); handleNewWallItemBodies(); - }); + + document.addEventListener('postprocess_liveupdate', function() { + handleNewWallItemBodies(); + }); + } }); function handleNewWallItemBodies() { diff --git a/showmore_dyn/showmore_dyn.php b/showmore_dyn/showmore_dyn.php index 32aedb08..bf8f5608 100644 --- a/showmore_dyn/showmore_dyn.php +++ b/showmore_dyn/showmore_dyn.php @@ -41,10 +41,7 @@ function showmore_dyn_settings_post() } if (isset($_POST['showmore_dyn-submit'])) { - $limitHeight = $_POST['limitHeight']; - if ($limitHeight && is_numeric($limitHeight)) { - DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $limitHeight); - } + DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $_POST['limitHeight'] ?? 0); } } @@ -60,16 +57,16 @@ function showmore_dyn_settings(App &$a, &$o) $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/showmore_dyn/'); $o .= Renderer::replaceMacros($t, [ '$submit' => DI::l10n()->t('Save Settings'), - '$title' => 'Showmore Dynamic', - '$limitHeight' => ['limitHeight', DI::l10n()->t('Limit Height'), $limitHeight, 'The maximal height of posts when collapsed', '', '', 'number'], + '$header' => DI::l10n()->t('Show More Dynamic'), + '$limitHeight' => ['limitHeight', DI::l10n()->t('Limit Height'), $limitHeight, DI::l10n()->t('The maximal pixel height of posts before the Show More link is added, 0 to disable'), '', '', 'number'], ]); } function showmore_dyn_script() { - $limitHeight = DI::pConfig()->get(local_user(), 'showmore_dyn', 'limitHeight', 250); - $showmore_dyn_showmore_linktext = DI::l10n()->t('Show more ...'); + $limitHeight = intval(DI::pConfig()->get(local_user(), 'showmore_dyn', 'limitHeight', 250)); + $showmore_dyn_showmore_linktext = DI::l10n()->t('Show more...'); DI::page()['htmlhead'] .= << var postLimitHeight = $limitHeight; diff --git a/showmore_dyn/templates/settings.tpl b/showmore_dyn/templates/settings.tpl index 5e8bc3f1..ac37e937 100644 --- a/showmore_dyn/templates/settings.tpl +++ b/showmore_dyn/templates/settings.tpl @@ -1,5 +1,10 @@ -
-

{{$title}}

+ +

{{$header}}

+
+