This commit is contained in:
2019-09-25 15:05:50 +02:00
parent af7ca72760
commit 40af43681e
14 changed files with 3496 additions and 456 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+24 -20
View File
@@ -15,25 +15,29 @@ var paths = {
source: src_dir
};
gulp.task('watch', function() {
gulp.watch(watch_dir, ['build']);
});
function watch() {
return gulp.watch(watch_dir, build);
}
gulp.task('build', function() {
gulp.src(paths.source)
.pipe(sourcemaps.init())
.pipe(sass({outputStyle: 'compact', precision: 10})
.on('error', sass.logError)
)
.pipe(sourcemaps.write())
.pipe(autoprefixer())
.pipe(gulp.dest(dest_dir))
.pipe(csscomb())
.pipe(cleancss())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(dest_dir));
});
function build() {
return gulp.src(paths.source)
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'compact',
precision: 10
}).on('error', sass.logError)
)
.pipe(sourcemaps.write())
.pipe(autoprefixer())
.pipe(gulp.dest(dest_dir))
.pipe(csscomb())
.pipe(cleancss())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(dest_dir));
}
gulp.task('default', ['build']);
exports.watch = watch;
exports.build = build;
exports.default = build;
-149
View File
@@ -1,149 +0,0 @@
var $link_txt = $('#text_figli p > a');
var $link_list = $('.list-projets a');
function ajax_txt($href,$this, this_id) {
var $link_txt = $('#text_figli > p');
var idlink_txt = $link_txt.attr("id");
var search_id =$link_txt.find('#' + this_id);
$.ajax({
url : $href, // La ressource ciblée
type : 'GET', // Le type de la requête HTTP
dataType:'html',
success: function(data) {
$(data).find('.card').addClass(this_id).insertAfter(search_id);
var $card = $('#text_figli .card .card-image > a');
$card.click(function(e) {
e.preventDefault();
var $this = $(this);
var $href = $this.attr("href");
var this_id = $this.parent('.card-image').attr("id");
if ($this.parent('.card-image').hasClass('views')) {
$('#'+this_id+' #item').remove();
$this.parent('.card-image').removeClass("views");
}else{
$.ajax({
url : $href, // La ressource ciblée
type : 'GET', // Le type de la requête HTTP
dataType:'html',
success: function(data) {
$(data).find('#item').insertAfter($this);
$(window).on('resize', function(x){
var x = $this.offset();
var x = $this.offset();
var Wwindow = $('#text_figli').width();
var Wcard = $this.parents('.card').width();
var xcard = $this.offset().left;
var marginR = Wwindow - (Wcard + xcard);
console.log('x.left resize =',x.left);
$this.parent('.card-image').find('#item').css('margin-left', -x.left+8);
$this.parents('.card').css('margin-right', marginR);
});
var x = $this.offset();
var Wwindow = $('#text_figli').width();
var Wcard = $this.parents('.card').width();
var xcard = $this.offset().left;
var marginR = Wwindow - (Wcard + xcard);
// si la distance entre l'image précédente et la bord droit du text est supérieur ou égale
// a un card
// alors soustrai xcard a la marg calculer de this.
// sinon tu ne change rien
console.log('marginR', marginR);
// console.log('x.left',x.left);
// console.log('marginR',marginR.right);
$this.parent('.card-image').find('#item').css('margin-left', -x.left+8);
$this.parents('.card').css('margin-right', marginR);
}
});
$this.parent('.card-image').addClass('views');
}
});
}
});
}
function ajax_liste($href,$this, this_id) {
var $link_txt = $('#text_figli > p');
var idlink_txt = $link_txt.attr("id");
var search_id =$link_txt.find('#' + this_id);
console.log('$href',$href);
var url = $href.split("/");
var id = url[url.length - 2];
var projetc_name = url[url.length - 1];
console.log('projetc_name',projetc_name);
$.ajax({
url : '/projets/' + id, // La ressource ciblée
type : 'GET', // Le type de la requête HTTP
dataType:'html',
success: function(data) {
$(data).find('.card').addClass(this_id).insertAfter(search_id);
},
complete: function(){
// Handle the complete event
setTimeout( function(){
$.ajax({
url : '/projets/' + id + '/' + projetc_name, // La ressource ciblée
type : 'GET', // Le type de la requête HTTP
dataType:'html',
success: function(data) {
var $link_item = $('#text_figli > p > .card');
var idlink_txt = $link_txt.attr("id");
var search_id =$link_item.find('#' + projetc_name);
console.log('search_id',id);
$(data).find('#item').insertAfter(search_id);
console.log('complete2');
},
})
}, 2000);
}
});
}
function deploy() {
$link_txt.click(function(e){
e.preventDefault();
var $this = $(this);
var $href = $this.attr("href");
var this_id = $this.attr("id");
if ($this.hasClass('open')) {
$('.card.'+this_id).remove();
$this.removeClass("open");
}else{
ajax_txt($href, $this, this_id);
$this.addClass('open');
}
});
$link_list.click(function(e){
e.preventDefault();
var $this = $(this);
var $href = $this.attr("href");
var this_id = $this.attr("id");
if ($this.hasClass('open')) {
$('.card.'+this_id).remove();
$this.removeClass("open");
}else{
ajax_liste($href, $this, this_id);
$this.addClass('open');
}
});
}
jQuery(document).ready(function($){
deploy();
});
+147 -47
View File
@@ -1,59 +1,159 @@
var isTouch = window.DocumentTouch && document instanceof DocumentTouch;
function click_link() {
function scrollHeader() {
// Has scrolled class on header
var zvalue = $(document).scrollTop();
if ( zvalue > 75 )
$("#header").addClass("scrolled");
else
$("#header").removeClass("scrolled");
}
$link = $('#text_figli p > a');
function parallaxBackground() {
$('.parallax').css('background-positionY', ($(window).scrollTop() * 0.3) + 'px');
}
$link.click(function(e) {
e.preventDefault();
jQuery(document).ready(function($){
var $this = $(this);
$href = $this.attr("href");
url = $href.split("/");
page = url[1];
cat = url[2];
project_name = url[3];
scrollHeader();
if ($this.hasClass('open')) {
$this.removeClass('open');
$('#item_list.'+ cat).remove();
} else {
// Scroll Events
if (!isTouch){
$(document).scroll(function() {
scrollHeader();
parallaxBackground();
});
};
// Touch scroll
$(document).on({
'touchmove': function(e) {
scrollHeader(); // Replace this with your code.
$.ajax({
url : '/' + page + '/' + cat, // La ressource ciblée
type : 'GET', // Le type de la requête HTTP
dataType:'html',
success: function(data) {
$(data).find('#item_list').addClass(cat).insertAfter($this);
$this.addClass('open');
},
complete: function(data) {
console.log('cat', cat);
click_img(e, $this, $href, url, page, cat, project_name);
}
});
}
});
};
function click_list() {
var $link = $('.list-projets li > a');
$link.click(function(e) {
e.preventDefault();
var $this = $(this);
$href = $this.attr("href");
url = $href.split("/");
page = url[1];
cat = url[2];
project_name = url[3];
var $link_txt = $('#text_figli a#'+cat);
var $link_item = $('#item_list.'+cat);
var $link_card = $('.card > #'+project_name + ' a');
if ($link_txt.hasClass('open') && $link_card.parent().hasClass('open') ) {
console.log('anchor');
anchor($href);
}else if ($link_txt.hasClass('open')) {
$.ajax({
url : '/' + page + '/' + cat + '/' + project_name, // La ressource ciblée
type : 'GET', // Le type de la requête HTTP
dataType:'html',
success: function(data) {
$(data).find('#item').addClass(cat).insertAfter($link_card);
$link_card.parent().addClass('open');
},
});
} else {
$.ajax({
url : '/' + page + '/' + cat, // La ressource ciblée
type : 'GET', // Le type de la requête HTTP
dataType:'html',
success: function(data) {
$(data).find('#item_list').addClass(cat).insertAfter($link_txt);
$link_txt.addClass('open');
anchor($href);
$('.card a').click(function (e) {
e.preventDefault()
})
click_img(e, $this, $href, url, page, cat, project_name)
},
complete: function(data) {
console.log('cat', cat);
var $link_card = $('.card > #'+project_name + ' a');
setTimeout( function(){
console.log('project_name', project_name);
console.log('$link_card', $link_card);
if ($link_card.hasClass('open')) {
}else {
anchor($href);
$.ajax({
url : '/' + page + '/' + cat + '/' + project_name, // La ressource ciblée
type : 'GET', // Le type de la requête HTTP
dataType:'html',
success: function(data) {
$(data).find('#item').addClass(cat).insertAfter($link_card);
$link_card.parent().addClass('open');
},
});
}
}, 1500);
}
});
}
});
}
function click_img(e, $this, $href, url, page, cat, project_name) {
// $link_img = $('.card .card-image > a');
$('section.' + cat +' .card-image > a').click(function(e) {
var $this = $(this);
$href = $this.attr("href");
url = $href.split("/");
page = url[1];
cat = url[2];
project_name = url[3];
e.preventDefault();
if ($this.parent().hasClass('open')) {
$this.parent().removeClass('open');
$($this.parent().find('#item.'+ cat)).remove();
} else {
$.ajax({
url : '/' + page + '/' + cat + '/' + project_name, // La ressource ciblée
type : 'GET', // Le type de la requête HTTP
dataType:'html',
success: function(data) {
$(data).find('#item').addClass(cat).insertAfter($this);
$this.parent().addClass('open');
},
});
}
});
}
//Smooth scroll to start
$('#to-start').click(function(){
var start_y = $('#start').position().top;
var header_offset = 45;
window.scroll({ top: start_y - header_offset, left: 0, behavior: 'smooth' });
return false;
});
function anchor($href) {
//Smooth scroll to top
$('#to-top').click(function(){
window.scroll({ top: 0, left: 0, behavior: 'smooth' });
return false;
});
var aTag = $("a[href='"+ $href +"']");
$('html,body').animate({scrollTop: aTag.offset().top},'slow');
// Responsive Menu
$('#toggle').click(function () {
$(this).toggleClass('active');
$('#overlay').toggleClass('open');
$('body').toggleClass('mobile-nav-open');
});
// Tree Menu
$(".tree").treemenu({delay:300});
}
$(document).ready(function($){
click_link();
click_list();
});
File diff suppressed because it is too large Load Diff
+1
View File
@@ -47,6 +47,7 @@
"merge": "^1.2.1",
"minimatch": "^3.0.4",
"normalize.css": "^8.0.1",
"npm": "^6.11.3",
"path": "^0.12.7",
"util": "^0.12.1",
"utils": "^0.3.1",
@@ -4,11 +4,11 @@
@include font-face($playfair, $file-italic, $family-italic, $category);//2
// font-size
$txt-figli: 3.5rem;
$txt-figli: 2.5rem;
// line-height
$Flhome: 4rem;
$Flhome: 3rem;
$marg: 0.5rem;
$margI: 1rem;
$Wi: 80%;
@@ -20,7 +20,6 @@ form {
}
#grav-login {
> form {
margin: 2rem auto 0;
max-width: 350px;
@@ -7,37 +7,21 @@ html, body, header{
body{
#start{
width: calc( #{$Wi} - #{$marg} );
width: $Wi50;
margin: $marg auto auto $marg;
#text_figli{
p {
a{
position: relative;
// &::after{
// display: block;
// content: '';
// position: absolute;
// top: 0;
// left: 0;
// transform: translate(-25%,-65%);
// z-index: 999;
// }
// &:hover{
// &::after{
// content: url('/user/themes/figureslibres/images/ovale.svg');
// width: 100%;
// height: 100%;
// top: 0;
// left: 0;
// }
// }
&.marg{
margin-right: $marg;
}
}
}
#item_list{
width: 80vw;
.card{
width: calc((100% / 3) - ( #{$marg} * 2) );
width: calc((100% / 5) - ( #{$marg} * 2) );
height: auto;
// overflow: hidden;
display: inline-block;
@@ -45,7 +29,10 @@ body{
line-height: 0;
margin-right: $marg;
position: relative;
margin-top: $marg;
margin-top: $marg;
a{
display: block;
}
.card-header{
display: none;
& > *{
@@ -70,10 +57,24 @@ body{
}
#item{
width: calc( 307% - #{$marg} );
// margin-left: -50vw;
.content-title{
margin: 30px auto;
a{
display: block;
}
}
.e-content{
margin: 30px auto;
p{
font-size: 1rem;
line-height: 1rem;
}
}
}
}
}
}
}
&:not(.home){
#start{
@@ -13,7 +13,7 @@ header{
.home{
p{
font-size: $txt-figli;
line-height: $Flhome;
line-height: 3rem;
}
#text_figli{
strong{
@@ -22,7 +22,8 @@
{% block javascripts %}
{% do assets.addJs('jquery', 101) %}
{% do assets.addJs('theme://js/script_k.js', {group:'bottom'}) %}
{% do assets.addJs('theme://js/site.js', {group:'bottom'}) %}
{% endblock %}
{{ assets.js()|raw }}
@@ -5,7 +5,7 @@
<div class="card">
{% set image = page.media.images|first %}
{% if image %}
<div id="{{ macro.pageLinkName(page.title) }}" class="card-image">
<div id="{{ page.folder }}" class="card-image">
<a href="{{ page.url }}">{{ image.html("", "Projet") }}</a>
</div>
{% endif %}