Compare commits

...

5 commits

Author SHA1 Message Date
Kazhnuz
2bbb9f3773 fix: soucis de padding sur categories 2023-05-20 15:05:12 +02:00
Kazhnuz
481850aefe feat: ajout d'un viewer
Fixes #28
2023-05-20 15:03:13 +02:00
Kazhnuz
61bc6ca27b fix: center unique image on articles 2023-05-20 14:53:05 +02:00
Kazhnuz
f92bdca3da feat: better preview
Fixes #48
2023-05-20 14:48:22 +02:00
Kazhnuz
3fcc5dfedf feat: ajout recherche dans sidebar
Fixes #37
2023-05-20 12:36:21 +02:00
19 changed files with 10275 additions and 10 deletions

View file

@ -5,12 +5,17 @@
<article class="article container-article" id="post-<?php the_ID(); ?>">
<?php if ($haveTitle) { ?>
<h1 class="page-title"><?php the_title(); ?></h1>
<p class="align-right"><span class="btn-small btn-secondary"> <?php echo reading_time(); ?> </span></p>
<?php $category = get_the_category();
$category_parent_id = $category[0]->category_parent;
if ( get_term( $category_parent_id, 'category' )->slug != "3-gallerie" ) {?>
<p class="align-right pr-half"><span class="btn-small btn-secondary"> <?php echo reading_time(); ?> </span></p>
<?php }?>
<?php } else { ?>
<h1 class="sr-only"><?php the_title(); ?></h1>
<?php } ?>
<div class="article-entry mb-1">
<div id="myarticle" class="article-entry mb-1">
<?php the_content(); ?>
</div>
</article>

View file

@ -29,7 +29,16 @@
?></div>
<div><time><span class="btn-small btn-info small-text"><?php the_time('d/m/Y') ?></span></time></div>
</div>
<div class="comment-text"><?php comments_number('Pas de commentaire', 'Un commentaire', '% commentaires' );?></div>
<div class="comment-text">
<?php $category = get_the_category();
$category_parent_id = $category[0]->category_parent;
if ( get_term( $category_parent_id, 'category' )->slug != "3-gallerie" ) {
echo reading_time();
} else {
echo image_number();
}
?>
</div>
</div>
</div>
</div>

View file

@ -1,3 +1,7 @@
<div class="mb-1 d-none d-block-sm bg-light-2">
<?php include(TEMPLATEPATH . '/components/searchform.php'); ?>
</div>
<?php include(TEMPLATEPATH . '/components/sidebar/last-articles.php'); ?>
<?php include(TEMPLATEPATH . '/components/sidebar/categories.php'); ?>
<?php include(TEMPLATEPATH . '/components/sidebar/tags.php'); ?>

View file

@ -7,7 +7,7 @@
foreach( $parent_categories as $parent_category ) {
?>
<section class="card head-primary d-none d-block-sm">
<section class="card head-primary d-none d-flex-sm">
<h2 class="card-header"><i class="fa fa-folder" aria-hidden="true"></i> <?php echo $parent_category->name ?></h2>
<div class="menu fg-dark">
<ul>

File diff suppressed because it is too large Load diff

446
dep/viewerjs/viewer.css Normal file
View file

@ -0,0 +1,446 @@
/*!
* Viewer.js v1.11.3
* https://fengyuanchen.github.io/viewerjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2023-03-05T07:01:15.525Z
*/
.viewer-zoom-in::before, .viewer-zoom-out::before, .viewer-one-to-one::before, .viewer-reset::before, .viewer-prev::before, .viewer-play::before, .viewer-next::before, .viewer-rotate-left::before, .viewer-rotate-right::before, .viewer-flip-horizontal::before, .viewer-flip-vertical::before, .viewer-fullscreen::before, .viewer-fullscreen-exit::before, .viewer-close::before {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARgAAAAUCAYAAABWOyJDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAQPSURBVHic7Zs/iFxVFMa/0U2UaJGksUgnIVhYxVhpjDbZCBmLdAYECxsRFBTUamcXUiSNncgKQbSxsxH8gzAP3FU2jY0kKKJNiiiIghFlccnP4p3nPCdv3p9778vsLOcHB2bfveeb7955c3jvvNkBIMdxnD64a94GHMfZu3iBcRynN7zAOI7TG15gHCeeNUkr8zaxG2lbYDYsdgMbktBsP03jdQwljSXdtBhLOmtjowC9Mg9L+knSlcD8TNKpSA9lBpK2JF2VdDSR5n5J64m0qli399hNFMUlpshQii5jbXTbHGviB0nLNeNDSd9VO4A2UdB2fp+x0eCnaXxWXGA2X0au/3HgN9P4LFCjIANOJdrLr0zzZ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transparent;
display: block;
font-size: 0;
height: 20px;
line-height: 0;
width: 20px;
}
.viewer-zoom-in::before {
background-position: 0 0;
content: "Zoom In";
}
.viewer-zoom-out::before {
background-position: -20px 0;
content: "Zoom Out";
}
.viewer-one-to-one::before {
background-position: -40px 0;
content: "One to One";
}
.viewer-reset::before {
background-position: -60px 0;
content: "Reset";
}
.viewer-prev::before {
background-position: -80px 0;
content: "Previous";
}
.viewer-play::before {
background-position: -100px 0;
content: "Play";
}
.viewer-next::before {
background-position: -120px 0;
content: "Next";
}
.viewer-rotate-left::before {
background-position: -140px 0;
content: "Rotate Left";
}
.viewer-rotate-right::before {
background-position: -160px 0;
content: "Rotate Right";
}
.viewer-flip-horizontal::before {
background-position: -180px 0;
content: "Flip Horizontal";
}
.viewer-flip-vertical::before {
background-position: -200px 0;
content: "Flip Vertical";
}
.viewer-fullscreen::before {
background-position: -220px 0;
content: "Enter Full Screen";
}
.viewer-fullscreen-exit::before {
background-position: -240px 0;
content: "Exit Full Screen";
}
.viewer-close::before {
background-position: -260px 0;
content: "Close";
}
.viewer-container {
bottom: 0;
direction: ltr;
font-size: 0;
left: 0;
line-height: 0;
overflow: hidden;
position: absolute;
right: 0;
-webkit-tap-highlight-color: transparent;
top: 0;
-ms-touch-action: none;
touch-action: none;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.viewer-container::-moz-selection, .viewer-container *::-moz-selection {
background-color: transparent;
}
.viewer-container::selection,
.viewer-container *::selection {
background-color: transparent;
}
.viewer-container:focus {
outline: 0;
}
.viewer-container img {
display: block;
height: auto;
max-height: none !important;
max-width: none !important;
min-height: 0 !important;
min-width: 0 !important;
width: 100%;
}
.viewer-canvas {
bottom: 0;
left: 0;
overflow: hidden;
position: absolute;
right: 0;
top: 0;
}
.viewer-canvas > img {
height: auto;
margin: 15px auto;
max-width: 90% !important;
width: auto;
}
.viewer-footer {
bottom: 0;
left: 0;
overflow: hidden;
position: absolute;
right: 0;
text-align: center;
}
.viewer-navbar {
background-color: rgba(0, 0, 0, 50%);
overflow: hidden;
}
.viewer-list {
box-sizing: content-box;
height: 50px;
margin: 0;
overflow: hidden;
padding: 1px 0;
}
.viewer-list > li {
color: transparent;
cursor: pointer;
float: left;
font-size: 0;
height: 50px;
line-height: 0;
opacity: 0.5;
overflow: hidden;
transition: opacity 0.15s;
width: 30px;
}
.viewer-list > li:focus,
.viewer-list > li:hover {
opacity: 0.75;
}
.viewer-list > li:focus {
outline: 0;
}
.viewer-list > li + li {
margin-left: 1px;
}
.viewer-list > .viewer-loading {
position: relative;
}
.viewer-list > .viewer-loading::after {
border-width: 2px;
height: 20px;
margin-left: -10px;
margin-top: -10px;
width: 20px;
}
.viewer-list > .viewer-active,
.viewer-list > .viewer-active:focus,
.viewer-list > .viewer-active:hover {
opacity: 1;
}
.viewer-player {
background-color: #000;
bottom: 0;
cursor: none;
display: none;
left: 0;
position: absolute;
right: 0;
top: 0;
z-index: 1;
}
.viewer-player > img {
left: 0;
position: absolute;
top: 0;
}
.viewer-toolbar > ul {
display: inline-block;
margin: 0 auto 5px;
overflow: hidden;
padding: 6px 3px;
}
.viewer-toolbar > ul > li {
background-color: rgba(0, 0, 0, 50%);
border-radius: 50%;
cursor: pointer;
float: left;
height: 24px;
overflow: hidden;
transition: background-color 0.15s;
width: 24px;
}
.viewer-toolbar > ul > li:focus,
.viewer-toolbar > ul > li:hover {
background-color: rgba(0, 0, 0, 80%);
}
.viewer-toolbar > ul > li:focus {
box-shadow: 0 0 3px #fff;
outline: 0;
position: relative;
z-index: 1;
}
.viewer-toolbar > ul > li::before {
margin: 2px;
}
.viewer-toolbar > ul > li + li {
margin-left: 1px;
}
.viewer-toolbar > ul > .viewer-small {
height: 18px;
margin-bottom: 3px;
margin-top: 3px;
width: 18px;
}
.viewer-toolbar > ul > .viewer-small::before {
margin: -1px;
}
.viewer-toolbar > ul > .viewer-large {
height: 30px;
margin-bottom: -3px;
margin-top: -3px;
width: 30px;
}
.viewer-toolbar > ul > .viewer-large::before {
margin: 5px;
}
.viewer-tooltip {
background-color: rgba(0, 0, 0, 80%);
border-radius: 10px;
color: #fff;
display: none;
font-size: 12px;
height: 20px;
left: 50%;
line-height: 20px;
margin-left: -25px;
margin-top: -10px;
position: absolute;
text-align: center;
top: 50%;
width: 50px;
}
.viewer-title {
color: #ccc;
display: inline-block;
font-size: 12px;
line-height: 1.2;
margin: 5px 5%;
max-width: 90%;
min-height: 14px;
opacity: 0.8;
overflow: hidden;
text-overflow: ellipsis;
transition: opacity 0.15s;
white-space: nowrap;
}
.viewer-title:hover {
opacity: 1;
}
.viewer-button {
-webkit-app-region: no-drag;
background-color: rgba(0, 0, 0, 50%);
border-radius: 50%;
cursor: pointer;
height: 80px;
overflow: hidden;
position: absolute;
right: -40px;
top: -40px;
transition: background-color 0.15s;
width: 80px;
}
.viewer-button:focus,
.viewer-button:hover {
background-color: rgba(0, 0, 0, 80%);
}
.viewer-button:focus {
box-shadow: 0 0 3px #fff;
outline: 0;
}
.viewer-button::before {
bottom: 15px;
left: 15px;
position: absolute;
}
.viewer-fixed {
position: fixed;
}
.viewer-open {
overflow: hidden;
}
.viewer-show {
display: block;
}
.viewer-hide {
display: none;
}
.viewer-backdrop {
background-color: rgba(0, 0, 0, 50%);
}
.viewer-invisible {
visibility: hidden;
}
.viewer-move {
cursor: move;
cursor: grab;
}
.viewer-fade {
opacity: 0;
}
.viewer-in {
opacity: 1;
}
.viewer-transition {
transition: all 0.3s;
}
@keyframes viewer-spinner {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.viewer-loading::after {
animation: viewer-spinner 1s linear infinite;
border: 4px solid rgba(255, 255, 255, 10%);
border-left-color: rgba(255, 255, 255, 50%);
border-radius: 50%;
content: "";
display: inline-block;
height: 40px;
left: 50%;
margin-left: -20px;
margin-top: -20px;
position: absolute;
top: 50%;
width: 40px;
z-index: 1;
}
@media (max-width: 767px) {
.viewer-hide-xs-down {
display: none;
}
}
@media (max-width: 991px) {
.viewer-hide-sm-down {
display: none;
}
}
@media (max-width: 1199px) {
.viewer-hide-md-down {
display: none;
}
}

3235
dep/viewerjs/viewer.esm.js Normal file

File diff suppressed because it is too large Load diff

3243
dep/viewerjs/viewer.js Normal file

File diff suppressed because it is too large Load diff

9
dep/viewerjs/viewer.min.css vendored Normal file

File diff suppressed because one or more lines are too long

10
dep/viewerjs/viewer.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -7,5 +7,6 @@
<script src="<?php echo get_template_directory_uri();?>/js/trim.js"></script>
<script src="<?php echo get_template_directory_uri();?>/js/prettylinks.js"></script>
<script src="<?php echo get_template_directory_uri();?>/js/mobile-sidebar.js"></script>
<script src="<?php echo get_template_directory_uri();?>/js/viewer.js"></script>
</body>
</html>

View file

@ -20,4 +20,19 @@ function reading_time() {
return $totalreadingtime;
}
function image_number() {
$content = get_post_field( 'post_content', $post->ID );
$count = substr_count( $content, '<img' );
if ($count == 1) {
$timer = " image";
} else {
$timer = " images";
}
$imagenumber = $count . $timer;
return $imagenumber;
}
?>

View file

@ -14,11 +14,15 @@
<?php include(TEMPLATEPATH . '/components/opengraph.php'); ?>
<link rel="shortcut icon" href="<?php echo get_template_directory_uri();?>/img/favicon.png">
<!-- framework utilisés -->
<!-- Dépendances -->
<link href="<?php echo get_template_directory_uri() . "/dep/fork-awesome/css/fork-awesome.min.css"; ?>" rel="stylesheet"/>
<link href="<?php echo get_template_directory_uri() . "/dep/viewerjs/viewer.min.css"; ?>" rel="stylesheet"/>
<!-- CSS -->
<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet"/>
<!-- Viewer -->
<script src="<?php echo get_template_directory_uri();?>/dep/viewerjs/viewer.min.js"></script>
</head>
<!-- Début du vrai HTML -->

21
js/viewer.js Normal file
View file

@ -0,0 +1,21 @@
const viewer = new Viewer(document.getElementById('myarticle'), {
inline: false,
navbar: true,
title: false,
toolbar: {
zoomIn: 4,
zoomOut: 4,
oneToOne: 4,
reset: 4,
prev: 1,
play: {
show: 0,
size: 'large',
},
next: 1,
rotateLeft: 0,
rotateRight: 0,
flipHorizontal: 0,
flipVertical: 0,
},
});

View file

@ -1,9 +1,13 @@
input,
textarea {
width: 100%;
background-color: $color-background;
background-color: $color-background-alt;
border-radius: $btn-radius;
border: 0px solid rgba(0, 0, 0, 0);
padding: $lineheight_rel / 4;
line-height: $lineheight_rel;
.card & {
background-color: $color-background;
}
}

View file

@ -89,7 +89,7 @@ $comment-peek-height:0px;
line-height: $lineheight !important;
text-align:justify;
background-color:rgba(0,0,0,0.00);
color:dim(getFontColor());
color: transparentize($color-font, 0.3);
position: relative;
overflow:hidden;
@ -147,6 +147,12 @@ $comment-peek-height:0px;
width:100%;
margin:auto;
&:not(.p-img) {
position:absolute;
top:3rem;
padding:0.5rem;
}
& > img {
max-width:100%;
height:auto;

View file

@ -34,4 +34,11 @@
margin-bottom: $lineheight / 4;
}
}
}
.wp-block-image {
&.size-full,
&.size-large {
text-align: center;
}
}

View file

@ -1,5 +1,5 @@
<?php get_header(); ?> <!-- ouvrir header,php -->
<main>
<main id="skip">
<?php $haveTitle = true; ?>
<?php include(TEMPLATEPATH . '/components/article.php'); ?>

View file

@ -1704,11 +1704,13 @@ th {
input,
textarea {
width: 100%;
background-color: #FDF7E7;
background-color: #eee8d5;
border-radius: 0px;
border: 0px solid rgba(0, 0, 0, 0);
padding: 0.4em;
line-height: 1.6em; }
.card input, .card textarea {
background-color: #FDF7E7; }
/* 1. Utils
** All the utilities class of the stylesheet
@ -2792,7 +2794,7 @@ ul.social {
line-height: 1.6rem !important;
text-align: justify;
background-color: rgba(0, 0, 0, 0);
color: rgba(7, 54, 66, 0.4);
color: rgba(7, 54, 66, 0.7);
position: relative;
overflow: hidden; }
.preview-content .preview-overlay {
@ -2834,6 +2836,10 @@ ul.social {
.preview-exerpt > p {
width: 100%;
margin: auto; }
.preview-exerpt > p:not(.p-img) {
position: absolute;
top: 3rem;
padding: 0.5rem; }
.preview-exerpt > p > img {
max-width: 100%;
height: auto;
@ -3028,6 +3034,9 @@ ul.social {
display: inline-block;
margin-bottom: 0.4rem; }
.wp-block-image.size-full, .wp-block-image.size-large {
text-align: center; }
#mobile-sidebar {
position: fixed;
top: 0;