[showmore_dyn] Add support for 0 value to disable addon
This commit is contained in:
parent
ceb4f461da
commit
39280ea6bd
|
@ -6,15 +6,14 @@ $(document).ready(function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$("head").append('<style type="text/css"></style>');
|
if (postLimitHeight) {
|
||||||
var newStyleElement = $("head").children(':last');
|
$('head').append('<style type="text/css">.limit-height{max-height: ' + postLimitHeight + 'px; overflow: hidden; }</style>');
|
||||||
newStyleElement.html('.limit-height{max-height: ' + postLimitHeight + 'px; overflow: hidden; }');
|
|
||||||
|
|
||||||
handleNewWallItemBodies();
|
|
||||||
|
|
||||||
document.addEventListener("postprocess_liveupdate", function() {
|
|
||||||
handleNewWallItemBodies();
|
handleNewWallItemBodies();
|
||||||
});
|
|
||||||
|
document.addEventListener('postprocess_liveupdate', function() {
|
||||||
|
handleNewWallItemBodies();
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleNewWallItemBodies() {
|
function handleNewWallItemBodies() {
|
||||||
|
|
|
@ -41,10 +41,7 @@ function showmore_dyn_settings_post()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['showmore_dyn-submit'])) {
|
if (isset($_POST['showmore_dyn-submit'])) {
|
||||||
$limitHeight = $_POST['limitHeight'];
|
DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $_POST['limitHeight'] ?? 0);
|
||||||
if ($limitHeight && is_numeric($limitHeight)) {
|
|
||||||
DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $limitHeight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,14 +58,14 @@ function showmore_dyn_settings(App &$a, &$o)
|
||||||
$o .= Renderer::replaceMacros($t, [
|
$o .= Renderer::replaceMacros($t, [
|
||||||
'$submit' => DI::l10n()->t('Save Settings'),
|
'$submit' => DI::l10n()->t('Save Settings'),
|
||||||
'$title' => 'Showmore Dynamic',
|
'$title' => 'Showmore Dynamic',
|
||||||
'$limitHeight' => ['limitHeight', DI::l10n()->t('Limit Height'), $limitHeight, 'The maximal height of posts when collapsed', '', '', 'number'],
|
'$limitHeight' => ['limitHeight', DI::l10n()->t('Limit Height'), $limitHeight, 'The maximal pixel height of posts, 0 to disable', '', '', 'number'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showmore_dyn_script()
|
function showmore_dyn_script()
|
||||||
{
|
{
|
||||||
$limitHeight = DI::pConfig()->get(local_user(), 'showmore_dyn', 'limitHeight', 250);
|
$limitHeight = intval(DI::pConfig()->get(local_user(), 'showmore_dyn', 'limitHeight', 250));
|
||||||
$showmore_dyn_showmore_linktext = DI::l10n()->t('Show more ...');
|
$showmore_dyn_showmore_linktext = DI::l10n()->t('Show more ...');
|
||||||
DI::page()['htmlhead'] .= <<<EOT
|
DI::page()['htmlhead'] .= <<<EOT
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Reference in a new issue