Update css

Better top nav
Add some option for add website link in top nav and contact page in footer
This commit is contained in:
Knah Tsaeb 2024-12-06 16:31:26 +01:00
parent 9603ff163c
commit 0363f92cc0
6 changed files with 76 additions and 102 deletions

View file

@ -1,4 +1,6 @@
description="For each link, add thumbshot image and favicon" 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_URL="Thumshot service URL"
parameter.ExternalThumbshot_KEY="Thumbshot key (key are hash with hash_hmac('sha1', $url, $key))" 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"

View file

@ -31,6 +31,33 @@ function myShaarli_init($conf) {
$conf->set('thumbnails.mode', 'full'); $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' => '<i class="fa fa-home" aria-hidden="true"></i> Site',
];
$data['buttons_toolbar'][] = $button;
}
return $data;
}
/** /**
* Add externalThumbshot icon to link_plugin when rendering linklist. * 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']); $value['thumbnail'] = $thumUrl . $hmac . urlencode($value['url']);
if (empty($value['favicon'])) { if (empty($value['favicon'])) {
if (!empty($key)) { if (!empty($key)) {
$hmac = 'type=fav&amp;hmac=' . hash_hmac('sha1', $value['url'], $key) . '&amp;url='; $hmac = 'type=fav&amp;hmac=' . hash_hmac('sha1', $value['url'], $key) . '&amp;url=';
@ -146,8 +172,10 @@ function hook_myShaarli_render_daily($data, $conf) {
* Hook render_footer. * Hook render_footer.
*/ */
function hook_myShaarli_render_footer($data) { function hook_myShaarli_render_footer($data) {
if (file_exists('contact.php')) { $data['text'][] = ' <br>Theme and plugin <a href="https://forge.leslibres.org/Knah-Tsaeb/MyShaarli">MyShaarli</a> by <a title="About" href="https://knah-tsaeb.org/about">Knah Tsaeb</a>';
$data['text'][] = '<br><a href="contact.php">Contact</a>'; $conf = new ConfigManager();
if ($conf->get('plugins.ContactPage_URL')) {
$data['text'][] = ' · <a href="' . $conf->get('plugins.ContactPage_URL') . '">/contact</a>';
} }
$data['js_files'][] = PluginManager::$PLUGINS_PATH . '/myShaarli/myShaarli.js'; $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/myShaarli/myShaarli.js';
@ -173,13 +201,13 @@ function hook_myShaarli_render_editlink($data) {
} }
/** /**
Améliore la sortie print * Améliore la sortie print
@author Tatane http://www.tatane.info/index.php/print_rn * @author Tatane http://www.tatane.info/index.php/print_rn
@author http://www.blog.cactuscrew.com/77-print_rn.html * @author http://www.blog.cactuscrew.com/77-print_rn.html
@param $data (array) tableau ou variable à examiner * @param $data (array) tableau ou variable à examiner
@param $name (string) nom a afficher * @param $name (string) nom a afficher
@return false affiche les clef valeur du tableau $data * @return false affiche les clef valeur du tableau $data
@example n_print($array, 'Tableau de valeur'); * @example n_print($array, 'Tableau de valeur');
*/ */
function n_print($data, $name = '') { function n_print($data, $name = '') {
$aBackTrace = debug_backtrace(); $aBackTrace = debug_backtrace();

View file

@ -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"] { [data-theme="dark"] {
--background-color: #171414; --background-color: #171414;
--text-color: #fffbfb; --text-color: #fffbfb;
--text-color-inverse: #171414; --text-color-inverse: #171414;
.linklist-pages { .linklist-pages {
color: var(--text-color); color: var(--text-color);
} }
@ -383,3 +323,12 @@ button:hover {
.pinned-link { .pinned-link {
color: var(--error) !important; color: var(--error) !important;
} }
.head-logo {
vertical-align: middle;
display: inline;
}
.pure-menu-link {
display: inline-block;
}

View file

@ -18,6 +18,7 @@
<link type="text/css" rel="stylesheet" href="{$root_path}/data/user.css#" /> <link type="text/css" rel="stylesheet" href="{$root_path}/data/user.css#" />
{/if} {/if}
<link type="text/css" rel="stylesheet" href="{$asset_path}/css/myShaarli.css?v={$version_hash}#" /> <link type="text/css" rel="stylesheet" href="{$asset_path}/css/myShaarli.css?v={$version_hash}#" />
<link type="text/css" rel="stylesheet" href="https://theme.knah-tsaeb.org/kt-scheme.css" />
<link rel="search" type="application/opensearchdescription+xml" href="{$base_path}/open-search#" <link rel="search" type="application/opensearchdescription+xml" href="{$base_path}/open-search#"
title="Shaarli search - {$shaarlititle}" /> title="Shaarli search - {$shaarlititle}" />
{if="$template === 'linklist' && ! empty($links) && count($links) === 1"} {if="$template === 'linklist' && ! empty($links) && count($links) === 1"}

View file

@ -11,7 +11,6 @@
&middot; &middot;
{'The personal, minimalist, super-fast, database free, bookmarking service'|t} {'by the Shaarli community'|t} &middot; {'The personal, minimalist, super-fast, database free, bookmarking service'|t} {'by the Shaarli community'|t} &middot;
<a href="https://demo.shaarli.org/doc/html/index.html" rel="nofollow">{'Documentation'|t}</a> <a href="https://demo.shaarli.org/doc/html/index.html" rel="nofollow">{'Documentation'|t}</a>
<br>Theme <a href="https://forge.leslibres.org/Knah-Tsaeb/MyShaarli">MyShaarli </a>by Knah Tsaeb
{loop="$plugins_footer.text"} {loop="$plugins_footer.text"}
{$value} {$value}
{/loop} {/loop}

View file

@ -3,7 +3,7 @@
<div class="pure-menu"> <div class="pure-menu">
<header role="banner"> <header role="banner">
<a href="{$titleLink}" class="pure-menu-link shaarli-title" id="shaarli-title-mobile"> <a href="{$titleLink}" class="pure-menu-link shaarli-title" id="shaarli-title-mobile">
<img src="{$asset_path}/img/favicon_16.png#" width="16" height="16" class="head-logo" alt="logo" /> <img src="{$asset_path}/img/favicon_32.png#" width="16" height="16" class="head-logo" alt="logo" />
{$shaarlititle} {$shaarlititle}
</a> </a>
</header> </header>
@ -13,34 +13,12 @@
<div class="pure-u-1"> <div class="pure-u-1">
<div class="pure-menu menu-transform pure-menu-horizontal pure-g"> <div class="pure-menu menu-transform pure-menu-horizontal pure-g">
<ul class="pure-menu-list pure-u-lg-5-6 pure-u-1"> <ul class="pure-menu-list pure-u-lg-5-6 pure-u-1">
<li><img src="{$asset_path}/img/logo_myShaarli.png#" class="head-logo" alt="logo" width="120px" height="45px"/></li>
<li class="pure-menu-item pure-u-0 pure-u-lg-visible"> <li class="pure-menu-item pure-u-0 pure-u-lg-visible">
<img src="{$asset_path}/img/logo_myShaarli.png#" width="120" height="45" class="head-logo" alt="logo" />
<a href="{$titleLink}" class="pure-menu-link shaarli-title" id="shaarli-title-desktop"> <a href="{$titleLink}" class="pure-menu-link shaarli-title" id="shaarli-title-desktop">
<img src="{$asset_path}/img/favicon_16.png#" width="16" height="16" class="head-logo" alt="logo" />
{$shaarlititle} {$shaarlititle}
</a> </a>
</li> </li>
{if="$is_logged_in || $openshaarli"}
<li class="pure-menu-item">
<a href="{$base_path}/admin/add-shaare" class="pure-menu-link" id="shaarli-menu-shaare">
<i class="fa fa-plus" aria-hidden="true"></i> {'Shaare'|t}
</a>
</li>
<li class="pure-menu-item" id="shaarli-menu-tools">
<a href="{$base_path}/admin/tools" class="pure-menu-link">{'Tools'|t}</a>
</li>
{/if}
<li class="pure-menu-item" id="shaarli-menu-tags">
<a href="{$base_path}/tags/cloud" class="pure-menu-link">{'Tag cloud'|t}</a>
</li>
{if="$thumbnails_enabled"}
<li class="pure-menu-item" id="shaarli-menu-picwall">
<a href="{$base_path}/picture-wall?{function="ltrim($searchcrits, '&')"}" class="pure-menu-link">{'Picture wall'|t}</a>
</li>
{/if}
<li class="pure-menu-item" id="shaarli-menu-daily">
<a href="{$base_path}/daily" class="pure-menu-link">{'Daily'|t}</a>
</li>
{loop="$plugins_header.buttons_toolbar"} {loop="$plugins_header.buttons_toolbar"}
<li class="pure-menu-item shaarli-menu-plugin"> <li class="pure-menu-item shaarli-menu-plugin">
<a <a
@ -52,6 +30,30 @@
</a> </a>
</li> </li>
{/loop} {/loop}
{if="$is_logged_in || $openshaarli"}
<li class="pure-menu-item">
<a href="{$base_path}/admin/add-shaare" class="pure-menu-link" id="shaarli-menu-shaare">
<i class="fa fa-plus" aria-hidden="true"></i> {'Shaare'|t}
</a>
</li>
<li class="pure-menu-item" id="shaarli-menu-tools">
<a href="{$base_path}/admin/tools" class="pure-menu-link">
<i class="fa fa-cog" aria-hidden="true"></i> {'Tools'|t}
</a>
</li>
{/if}
<li class="pure-menu-item" id="shaarli-menu-tags">
<a href="{$base_path}/tags/cloud" class="pure-menu-link">
<i class="fa fa-cloud" aria-hidden="true"></i> {'Tag cloud'|t}
</a>
</li>
{if="$thumbnails_enabled"}
<li class="pure-menu-item" id="shaarli-menu-picwall">
<a href="{$base_path}/picture-wall?{function="ltrim($searchcrits, '&')"}" class="pure-menu-link">
<i class="fa fa-picture-o" aria-hidden="true"></i> {'Picture wall'|t}
</a>
</li>
{/if}
<li class="pure-menu-item pure-u-lg-0 shaarli-menu-mobile" id="shaarli-menu-mobile-rss"> <li class="pure-menu-item pure-u-lg-0 shaarli-menu-mobile" id="shaarli-menu-mobile-rss">
<a href="{$base_path}/feed/{$feed_type}?{$searchcrits}" class="pure-menu-link">{'RSS Feed'|t}</a> <a href="{$base_path}/feed/{$feed_type}?{$searchcrits}" class="pure-menu-link">{'RSS Feed'|t}</a>
</li> </li>
@ -67,14 +69,7 @@
</ul> </ul>
<div class="header-buttons pure-u-lg-1-6 pure-u-0 pure-u-lg-visible"> <div class="header-buttons pure-u-lg-1-6 pure-u-0 pure-u-lg-visible">
<ul class="pure-menu-list"> <ul class="pure-menu-list">
<li class="pure-menu-item" id="shaarli-menu-desktop-search"> <li class="pure-menu-item">
<a href="#" class="pure-menu-link subheader-opener"
data-open-id="search"
id="search-button" aria-label="{'Search'|t}" title="{'Search'|t}">
<i class="fa fa-search" aria-hidden="true"></i>
</a>
</li>
<li class="pure-menu-item" id="shaarli-menu-desktop-rss">
<a href="#" class="pure-menu-link" title="Toggle Dark/Light theme" aria-label="Toggle Dark/Light theme" onclick="switchTheme();"> <a href="#" class="pure-menu-link" title="Toggle Dark/Light theme" aria-label="Toggle Dark/Light theme" onclick="switchTheme();">
<i class="fa fa-moon-o" aria-hidden="true"></i> <i class="fa fa-moon-o" aria-hidden="true"></i>
</a> </a>