registerStylesheet(__DIR__ . '/showmore_dyn.css'); } function showmore_dyn_footer(App $a, &$b) { DI::page()->registerFooterScript(__DIR__ . '/showmore_dyn.js'); } function showmore_dyn_settings_post(){ if(! local_user()) return; if (isset($_POST['showmore_dyn-submit'])){ $limitHeight = $_POST['showmore_dyn_height']; DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $limitHeight); /* $str=file_get_contents('addon/showmore_dyn/showmore_dyn.css'); $str=preg_replace("/(max-height: )\d+(px;)/i", "max-height: " . $limitHeight . "px;" ,$str); file_put_contents('addon/showmore_dyn/showmore_dyn.css', $str); $str=file_get_contents('addon/showmore_dyn/showmore_dyn.js'); $str=preg_replace('/if \(\$item.height\(\) \< \d+\) \{/i', 'if ($item.height() < ' . $limitHeight . ') {' ,$str); file_put_contents('addon/showmore_dyn/showmore_dyn2.js', $str);*/ } } function showmore_dyn_settings(&$a,&$o) { if(! local_user()) return; $limitHeight = DI::pConfig()->get(local_user(), 'showmore_dyn', 'limitHeight' ); if ($limitHeight=='') { $limitHeight = 250; DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $limitHeight); } $t = Renderer::getMarkupTemplate("settings.tpl", "addon/showmore_dyn/"); $o .= Renderer::replaceMacros($t, [ '$submit' => DI::l10n()->t('Save Settings'), '$title' => "Showmore Dynamic", '$label' => DI::l10n()->t('Limit Height'), '$limitHeight' => $limitHeight, ]); } function showmore_dyn_script() { $limitHeight = DI::pConfig()->get(local_user(), 'showmore_dyn', 'limitHeight' ); DI::page()['htmlhead'] .= ''; }