mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-19 02:03:39 +00:00
Merge pull request #1066 from MrPetovan/task/9568-showmore_dyn-improvements
[showmore_dyn] Various addon improvements
This commit is contained in:
commit
559c85775e
4 changed files with 34 additions and 23 deletions
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -17,14 +17,24 @@ msgstr ""
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: showmore_dyn.php:62
|
#: showmore_dyn.php:59
|
||||||
msgid "Save Settings"
|
msgid "Save Settings"
|
||||||
msgstr ""
|
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"
|
msgid "Limit Height"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: showmore_dyn.php:73
|
#: showmore_dyn.php:61
|
||||||
msgid "Show more ..."
|
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 ""
|
msgstr ""
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,16 +57,16 @@ function showmore_dyn_settings(App &$a, &$o)
|
||||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/showmore_dyn/');
|
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/showmore_dyn/');
|
||||||
$o .= Renderer::replaceMacros($t, [
|
$o .= Renderer::replaceMacros($t, [
|
||||||
'$submit' => DI::l10n()->t('Save Settings'),
|
'$submit' => DI::l10n()->t('Save Settings'),
|
||||||
'$title' => 'Showmore Dynamic',
|
'$header' => DI::l10n()->t('Show More 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, DI::l10n()->t('The maximal pixel height of posts before the Show More link is added, 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>
|
||||||
var postLimitHeight = $limitHeight;
|
var postLimitHeight = $limitHeight;
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
<div class="settings-block">
|
<span id="settings_showmore_dyn_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose('settings_showmore_dyn_expanded'); openClose('settings_showmore_dyn_inflated');">
|
||||||
<h3 class="settings-heading">{{$title}}</h3>
|
<h3>{{$header}}</h3>
|
||||||
|
</span>
|
||||||
|
<div id="settings_showmore_dyn_expanded" class="settings-block" style="display: none;">
|
||||||
|
<span class="fakelink" onclick="openClose('settings_showmore_dyn_expanded'); openClose('settings_showmore_dyn_inflated');">
|
||||||
|
<h3>{{$header}}</h3>
|
||||||
|
</span>
|
||||||
{{include file="field_input.tpl" field=$limitHeight}}
|
{{include file="field_input.tpl" field=$limitHeight}}
|
||||||
|
|
||||||
<div class="settings-submit-wrapper">
|
<div class="settings-submit-wrapper">
|
||||||
|
|
Loading…
Reference in a new issue