From 0363f92cc007fd2473ea377f6bc73e0b7a268322 Mon Sep 17 00:00:00 2001 From: Knah Tsaeb Date: Fri, 6 Dec 2024 16:31:26 +0100 Subject: [PATCH] Update css Better top nav Add some option for add website link in top nav and contact page in footer --- plugins/myShaarli/myShaarli.meta | 4 +- plugins/myShaarli/myShaarli.php | 48 ++++++++++++++++----- tpl/myShaarli/css/myShaarli.css | 73 +++++--------------------------- tpl/myShaarli/includes.html | 1 + tpl/myShaarli/page.footer.html | 1 - tpl/myShaarli/page.header.html | 51 ++++++++++------------ 6 files changed, 76 insertions(+), 102 deletions(-) diff --git a/plugins/myShaarli/myShaarli.meta b/plugins/myShaarli/myShaarli.meta index 8c6f7873..e355f5f2 100644 --- a/plugins/myShaarli/myShaarli.meta +++ b/plugins/myShaarli/myShaarli.meta @@ -1,4 +1,6 @@ description="For each link, add thumbshot image and favicon" -parameters="ExternalThumbshot_URL;ExternalThumbshot_KEY" +parameters="ExternalThumbshot_URL;ExternalThumbshot_KEY;WebSite_URL;ContactPage_URL" parameter.ExternalThumbshot_URL="Thumshot service URL" parameter.ExternalThumbshot_KEY="Thumbshot key (key are hash with hash_hmac('sha1', $url, $key))" +parameter.WebSite_URL="Your personal website URL" +parameter.ContactPage_URL="Your contact page URL" \ No newline at end of file diff --git a/plugins/myShaarli/myShaarli.php b/plugins/myShaarli/myShaarli.php index 54280df0..fadafa88 100644 --- a/plugins/myShaarli/myShaarli.php +++ b/plugins/myShaarli/myShaarli.php @@ -31,6 +31,33 @@ function myShaarli_init($conf) { $conf->set('thumbnails.mode', 'full'); } +/** + * Hook render_header. + * Executed on every page render. + * + * Template placeholders: + * - buttons_toolbar + * - fields_toolbar + * + * @param array $data data passed to plugin + * + * @return array altered $data. + */ +function hook_myShaarli_render_header($data) { + $conf = new ConfigManager(); + + if ($conf->get('plugins.WebSite_URL')) { + $button = [ + 'attr' => [ + 'href' => $conf->get('plugins.WebSite_URL'), + ], + 'html' => ' Site', + ]; + $data['buttons_toolbar'][] = $button; + } + return $data; +} + /** * Add externalThumbshot icon to link_plugin when rendering linklist. * @@ -70,7 +97,6 @@ function hook_myShaarli_render_linklist($data, $conf) { $value['thumbnail'] = $thumUrl . $hmac . urlencode($value['url']); - if (empty($value['favicon'])) { if (!empty($key)) { $hmac = 'type=fav&hmac=' . hash_hmac('sha1', $value['url'], $key) . '&url='; @@ -146,8 +172,10 @@ function hook_myShaarli_render_daily($data, $conf) { * Hook render_footer. */ function hook_myShaarli_render_footer($data) { - if (file_exists('contact.php')) { - $data['text'][] = '
Contact'; + $data['text'][] = '
Theme and plugin MyShaarli by Knah Tsaeb'; + $conf = new ConfigManager(); + if ($conf->get('plugins.ContactPage_URL')) { + $data['text'][] = ' · /contact'; } $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/myShaarli/myShaarli.js'; @@ -173,13 +201,13 @@ function hook_myShaarli_render_editlink($data) { } /** -Améliore la sortie print -@author Tatane http://www.tatane.info/index.php/print_rn -@author http://www.blog.cactuscrew.com/77-print_rn.html -@param $data (array) tableau ou variable à examiner -@param $name (string) nom a afficher -@return false affiche les clef valeur du tableau $data -@example n_print($array, 'Tableau de valeur'); + * Améliore la sortie print + * @author Tatane http://www.tatane.info/index.php/print_rn + * @author http://www.blog.cactuscrew.com/77-print_rn.html + * @param $data (array) tableau ou variable à examiner + * @param $name (string) nom a afficher + * @return false affiche les clef valeur du tableau $data + * @example n_print($array, 'Tableau de valeur'); */ function n_print($data, $name = '') { $aBackTrace = debug_backtrace(); diff --git a/tpl/myShaarli/css/myShaarli.css b/tpl/myShaarli/css/myShaarli.css index 34b75afc..a2ace782 100644 --- a/tpl/myShaarli/css/myShaarli.css +++ b/tpl/myShaarli/css/myShaarli.css @@ -1,68 +1,8 @@ -:root { - color-scheme: dark light; - - --primary: #cc2027; - --primary-darken: #8E161B; - --primary-lighten: #D64C52; - --primary-text-contrast: #FFF; - - --secondary: #20ccc5; - --secondary-darken: #168E89; - --secondary-lighten: #4CD6D0; - --secondary-text-contrast: #000; - - --error: #c43933; - --error-darken: #892723; - --error-lighten: #CF605B; - --error-text-contrast: #FFF; - - --info: #206ccc; - --info-darken: #164B8E; - --info-lighten: #4C89D6; - --info-text-contrast: #FFF; - - --success: #7dcc20; - --success-darken: #578E16; - --success-lighten: #97D64C; - --success-text-contrast: #000; - - --warning: #cc5e20; - --warning-darken: #8E4116; - --warning-lighten: #D67E4C; - --warning-text-contrast: #FFF; - - --background-color: light-dark(#fffbfb, #171414); - --background-color-darken: light-dark(#B2AFAF, #100E0E); - --background-color-lighten: light-dark(#FFFBFB, #454343); - - --header-background-color: light-dark(#171414, #fffbfb); - --header-background-color-darken: light-dark(#100E0E, #B2AFAF); - --header-background-color-lighten: light-dark(#454343, #FFFBFB); - - --header-text-color: light-dark(#fffbfb, #171414); - --header-text-color-secondary: #ffffffb3; - --header-text-color-disable: light-dark(#ffffff80, #454343); - - --text-color: light-dark(#171414, #fffbfb); - --text-color-secondary: #ffffffb3; - --text-color-disable: light-dark(#454343, #ffffff80); - - --text-color-inverse: light-dark(#fffbfb, #171414); - --text-color-secondary-inverse: #ffffffb3; - --text-color-disable-inverse: light-dark(#ffffff80, #454343); - - --h1-color: var(--primary); - --h2-color: #c33d35; - --h3-color: #b94f44; - --h4-color: #ae5e52; - --h5-color: #a16a61; - --h6-color: #927671; -} - [data-theme="dark"] { --background-color: #171414; --text-color: #fffbfb; --text-color-inverse: #171414; + .linklist-pages { color: var(--text-color); } @@ -382,4 +322,13 @@ button:hover { .pinned-link { color: var(--error) !important; - } \ No newline at end of file +} + +.head-logo { + vertical-align: middle; + display: inline; +} + +.pure-menu-link { + display: inline-block; +} \ No newline at end of file diff --git a/tpl/myShaarli/includes.html b/tpl/myShaarli/includes.html index a99e2071..53209964 100644 --- a/tpl/myShaarli/includes.html +++ b/tpl/myShaarli/includes.html @@ -18,6 +18,7 @@ {/if} + {if="$template === 'linklist' && ! empty($links) && count($links) === 1"} diff --git a/tpl/myShaarli/page.footer.html b/tpl/myShaarli/page.footer.html index c3a64c81..ba2952c8 100644 --- a/tpl/myShaarli/page.footer.html +++ b/tpl/myShaarli/page.footer.html @@ -11,7 +11,6 @@ · {'The personal, minimalist, super-fast, database free, bookmarking service'|t} {'by the Shaarli community'|t} · {'Documentation'|t} -
Theme MyShaarli by Knah Tsaeb {loop="$plugins_footer.text"} {$value} {/loop} diff --git a/tpl/myShaarli/page.header.html b/tpl/myShaarli/page.header.html index 13b6e177..52d7b134 100644 --- a/tpl/myShaarli/page.header.html +++ b/tpl/myShaarli/page.header.html @@ -3,7 +3,7 @@
- + {$shaarlititle}
@@ -13,13 +13,23 @@