Commit 264a0152 authored by JM Oupah's avatar JM Oupah

Revert "V1.4.0 Wookmpark embarqué dans ZCM"

This reverts commit 4b2948e1
parent 1e22f40e
......@@ -139,8 +139,6 @@ figcaption.spip_doc_intitules {margin-left:50%;min-width:200px;-webkit-transform
.page_plan .main a {text-decoration:none;}
.page_plan .main a:hover {text-decoration:underline;}
.wookmark {position:relative;}
/* Nom de l'organisation du modèle identité extra*/
.schema.organization .organization__nom a {text-decoration:none;}
......
[(#REM)
Affichage type grille
Exemple d'insertion : <INCLURE{fond=inclure/liste/wookmark,env,ajax} />
Les paramètres :
- titre : titre de la liste (défaut '')
- par : critère de classement (défaut num titre)
- senstri : sens du classement (défaut 0 = normal)
- nb_collones : nombre de collones dans la grille (défaut 3)
- nb : nombre d'item à afficher dans la liste (défaut 999999)
- afficher_date_article : afficher la date de l'article (defaut oui)
- balise_titre_figcaption : balise du titre des vignettes (dafaut h2)
- afficher_soustitre_figcaption : afficher le soustitre de l'article (dafaut oui)
- afficher_intro_figcaption : afficher l'intro de l'article (dafaut oui)
- couper_titre_figcaption : nb de caractères du titre (defaut 35)
- couper_intro_figcaption : nb de caractères de l'intro (defaut 250)
- pagination (défaut 999999)
- masquer_pagination : oui/non (défaut non)
- modele_pagination (défaut page_precedent_suivant)
- label_precedent/label_suivant : texte liens de pagination
- message_aucun : texte si pas de réponse
Autres paramètres : voir inclure/vignette-article
][(#SET{balise_titre,#ENV{balise_titre,h2}})
][(#SET{tri,#ENV{tri,num titre}})
][(#SET{senstri,#ENV{senstri,0}})
][(#SET{nb_collones,#ENV{nb_collones,3}})
][(#SET{nb,#ENV{nb,999999}})
][(#SET{pagination,#ENV{pagination,999999}})
][(#SET{balise_titre_figcaption,#ENV{balise_titre_figcaption,h3}})
][(#SET{couper_titre_figcaption,#ENV{couper_titre_figcaption,35}})
][(#SET{couper_intro_figcaption,#ENV{couper_intro_figcaption,250}})
][(#SET{message_aucun, [(#ENV{message_aucun}|is_null|?{<:info_aucun_article:>, #ENV{message_aucun}})]})]
[(#REM)
Agenda : les événements à venir (= du secteur)
]<B_articles>
<div class="liste articles">
#ANCRE_PAGINATION
[<#GET{balise_titre}>(#ENV{titre})</#GET{balise_titre}>]
<ul class="liste-items wookmark grille">
<BOUCLE_articles(ARTICLES)
{id_rubrique?}
{id_parent?}
{recherche?}
{id_mot?}
{tri #GET{tri}}
{inverse #GET{senstri}}
{pagination #GET{pagination}}
>
<li class="item" itemscope itemtype="http://schema.org/Article"><a href="#URL_ARTICLE" itemprop="url">
<figure><INCLURE{fond=inclure/vignette-article,
id_article,
microdatas=oui,
largeur_image,
hauteur_image,
largeur_image_breakpoints} />
<figcaption>
[(#ENV{afficher_date_article}|non)
<p class="date_article">[<time pubdate="pubdate" datetime="[(#DATE|date_iso)]"><i class="icon-calendar"></i> (#DATE|affdate_jourcourt)</time>]</p>
]
[<[(#GET{balise_titre_figcaption})] itemprop="name">(#TITRE|couper{#GET{couper_titre_figcaption}})</#GET{balise_titre_figcaption}>]
[(#ENV{afficher_soustitre_figcaption}|non) [<div class="soustitre entry-content">(#SOUSTITRE|couper{#GET{couper_titre_figcaption}})</div>] ]
[(#ENV{afficher_intro_figcaption}|non) [<div class="introduction entry-content">(#INTRODUCTION{#GET{couper_intro_figcaption}})</div>] ]
</figcaption>
</figure>
</a></li>
</BOUCLE_articles>
</ul>
[(#ENV{masquer_pagination}|!={oui}|oui)
[<div class="pagination">
(#PAGINATION{
#ENV{modele_pagination,page_precedent_suivant},
label_precedent=#ENV{label_precedent},
label_suivant=#ENV{label_suivant}
})
</div>]
]
</div>
</B_articles>
[<p class="aucun-resultat">(#GET{message_aucun})</p>]
<//B_articles>
<INCLURE{fond=javascript/wookmark-appel} />
\ No newline at end of file
/*!
* imagesLoaded PACKAGED v4.1.0
* JavaScript is all like "You images are done yet or what?"
* MIT License
*/
/**
* EvEmitter v1.0.1
* Lil' event emitter
* MIT License
*/
/* jshint unused: true, undef: true, strict: true */
( function( global, factory ) {
// universal module definition
/* jshint strict: false */ /* globals define, module */
if ( typeof define == 'function' && define.amd ) {
// AMD - RequireJS
define( 'ev-emitter/ev-emitter',factory );
} else if ( typeof module == 'object' && module.exports ) {
// CommonJS - Browserify, Webpack
module.exports = factory();
} else {
// Browser globals
global.EvEmitter = factory();
}
}( this, function() {
function EvEmitter() {}
var proto = EvEmitter.prototype;
proto.on = function( eventName, listener ) {
if ( !eventName || !listener ) {
return;
}
// set events hash
var events = this._events = this._events || {};
// set listeners array
var listeners = events[ eventName ] = events[ eventName ] || [];
// only add once
if ( listeners.indexOf( listener ) == -1 ) {
listeners.push( listener );
}
return this;
};
proto.once = function( eventName, listener ) {
if ( !eventName || !listener ) {
return;
}
// add event
this.on( eventName, listener );
// set once flag
// set onceEvents hash
var onceEvents = this._onceEvents = this._onceEvents || {};
// set onceListeners array
var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || [];
// set flag
onceListeners[ listener ] = true;
return this;
};
proto.off = function( eventName, listener ) {
var listeners = this._events && this._events[ eventName ];
if ( !listeners || !listeners.length ) {
return;
}
var index = listeners.indexOf( listener );
if ( index != -1 ) {
listeners.splice( index, 1 );
}
return this;
};
proto.emitEvent = function( eventName, args ) {
var listeners = this._events && this._events[ eventName ];
if ( !listeners || !listeners.length ) {
return;
}
var i = 0;
var listener = listeners[i];
args = args || [];
// once stuff
var onceListeners = this._onceEvents && this._onceEvents[ eventName ];
while ( listener ) {
var isOnce = onceListeners && onceListeners[ listener ];
if ( isOnce ) {
// remove listener
// remove before trigger to prevent recursion
this.off( eventName, listener );
// unset once flag
delete onceListeners[ listener ];
}
// trigger listener
listener.apply( this, args );
// get next listener
i += isOnce ? 0 : 1;
listener = listeners[i];
}
return this;
};
return EvEmitter;
}));
/*!
* imagesLoaded v4.1.0
* JavaScript is all like "You images are done yet or what?"
* MIT License
*/
( function( window, factory ) { 'use strict';
// universal module definition
/*global define: false, module: false, require: false */
if ( typeof define == 'function' && define.amd ) {
// AMD
define( [
'ev-emitter/ev-emitter'
], function( EvEmitter ) {
return factory( window, EvEmitter );
});
} else if ( typeof module == 'object' && module.exports ) {
// CommonJS
module.exports = factory(
window,
require('ev-emitter')
);
} else {
// browser global
window.imagesLoaded = factory(
window,
window.EvEmitter
);
}
})( window,
// -------------------------- factory -------------------------- //
function factory( window, EvEmitter ) {
var $ = window.jQuery;
var console = window.console;
// -------------------------- helpers -------------------------- //
// extend objects
function extend( a, b ) {
for ( var prop in b ) {
a[ prop ] = b[ prop ];
}
return a;
}
// turn element or nodeList into an array
function makeArray( obj ) {
var ary = [];
if ( Array.isArray( obj ) ) {
// use object if already an array
ary = obj;
} else if ( typeof obj.length == 'number' ) {
// convert nodeList to array
for ( var i=0; i < obj.length; i++ ) {
ary.push( obj[i] );
}
} else {
// array of single index
ary.push( obj );
}
return ary;
}
// -------------------------- imagesLoaded -------------------------- //
/**
* @param {Array, Element, NodeList, String} elem
* @param {Object or Function} options - if function, use as callback
* @param {Function} onAlways - callback function
*/
function ImagesLoaded( elem, options, onAlways ) {
// coerce ImagesLoaded() without new, to be new ImagesLoaded()
if ( !( this instanceof ImagesLoaded ) ) {
return new ImagesLoaded( elem, options, onAlways );
}
// use elem as selector string
if ( typeof elem == 'string' ) {
elem = document.querySelectorAll( elem );
}
this.elements = makeArray( elem );
this.options = extend( {}, this.options );
if ( typeof options == 'function' ) {
onAlways = options;
} else {
extend( this.options, options );
}
if ( onAlways ) {
this.on( 'always', onAlways );
}
this.getImages();
if ( $ ) {
// add jQuery Deferred object
this.jqDeferred = new $.Deferred();
}
// HACK check async to allow time to bind listeners
setTimeout( function() {
this.check();
}.bind( this ));
}
ImagesLoaded.prototype = Object.create( EvEmitter.prototype );
ImagesLoaded.prototype.options = {};
ImagesLoaded.prototype.getImages = function() {
this.images = [];
// filter & find items if we have an item selector
this.elements.forEach( this.addElementImages, this );
};
/**
* @param {Node} element
*/
ImagesLoaded.prototype.addElementImages = function( elem ) {
// filter siblings
if ( elem.nodeName == 'IMG' ) {
this.addImage( elem );
}
// get background image on element
if ( this.options.background === true ) {
this.addElementBackgroundImages( elem );
}
// find children
// no non-element nodes, #143
var nodeType = elem.nodeType;
if ( !nodeType || !elementNodeTypes[ nodeType ] ) {
return;
}
var childImgs = elem.querySelectorAll('img');
// concat childElems to filterFound array
for ( var i=0; i < childImgs.length; i++ ) {
var img = childImgs[i];
this.addImage( img );
}
// get child background images
if ( typeof this.options.background == 'string' ) {
var children = elem.querySelectorAll( this.options.background );
for ( i=0; i < children.length; i++ ) {
var child = children[i];
this.addElementBackgroundImages( child );
}
}
};
var elementNodeTypes = {
1: true,
9: true,
11: true
};
ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) {
var style = getComputedStyle( elem );
if ( !style ) {
// Firefox returns null if in a hidden iframe https://bugzil.la/548397
return;
}
// get url inside url("...")
var reURL = /url\((['"])?(.*?)\1\)/gi;
var matches = reURL.exec( style.backgroundImage );
while ( matches !== null ) {
var url = matches && matches[2];
if ( url ) {
this.addBackground( url, elem );
}
matches = reURL.exec( style.backgroundImage );
}
};
/**
* @param {Image} img
*/
ImagesLoaded.prototype.addImage = function( img ) {
var loadingImage = new LoadingImage( img );
this.images.push( loadingImage );
};
ImagesLoaded.prototype.addBackground = function( url, elem ) {
var background = new Background( url, elem );
this.images.push( background );
};
ImagesLoaded.prototype.check = function() {
var _this = this;
this.progressedCount = 0;
this.hasAnyBroken = false;
// complete if no images
if ( !this.images.length ) {
this.complete();
return;
}
function onProgress( image, elem, message ) {
// HACK - Chrome triggers event before object properties have changed. #83
setTimeout( function() {
_this.progress( image, elem, message );
});
}
this.images.forEach( function( loadingImage ) {
loadingImage.once( 'progress', onProgress );
loadingImage.check();
});
};
ImagesLoaded.prototype.progress = function( image, elem, message ) {
this.progressedCount++;
this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded;
// progress event
this.emitEvent( 'progress', [ this, image, elem ] );
if ( this.jqDeferred && this.jqDeferred.notify ) {
this.jqDeferred.notify( this, image );
}
// check if completed
if ( this.progressedCount == this.images.length ) {
this.complete();
}
if ( this.options.debug && console ) {
console.log( 'progress: ' + message, image, elem );
}
};
ImagesLoaded.prototype.complete = function() {
var eventName = this.hasAnyBroken ? 'fail' : 'done';
this.isComplete = true;
this.emitEvent( eventName, [ this ] );
this.emitEvent( 'always', [ this ] );
if ( this.jqDeferred ) {
var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve';
this.jqDeferred[ jqMethod ]( this );
}
};
// -------------------------- -------------------------- //
function LoadingImage( img ) {
this.img = img;
}
LoadingImage.prototype = Object.create( EvEmitter.prototype );
LoadingImage.prototype.check = function() {
// If complete is true and browser supports natural sizes,
// try to check for image status manually.
var isComplete = this.getIsImageComplete();
if ( isComplete ) {
// report based on naturalWidth
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );
return;
}
// If none of the checks above matched, simulate loading on detached element.
this.proxyImage = new Image();
this.proxyImage.addEventListener( 'load', this );
this.proxyImage.addEventListener( 'error', this );
// bind to image as well for Firefox. #191
this.img.addEventListener( 'load', this );
this.img.addEventListener( 'error', this );
this.proxyImage.src = this.img.src;
};
LoadingImage.prototype.getIsImageComplete = function() {
return this.img.complete && this.img.naturalWidth !== undefined;
};
LoadingImage.prototype.confirm = function( isLoaded, message ) {
this.isLoaded = isLoaded;
this.emitEvent( 'progress', [ this, this.img, message ] );
};
// ----- events ----- //
// trigger specified handler for event type
LoadingImage.prototype.handleEvent = function( event ) {
var method = 'on' + event.type;
if ( this[ method ] ) {
this[ method ]( event );
}
};
LoadingImage.prototype.onload = function() {
this.confirm( true, 'onload' );
this.unbindEvents();
};
LoadingImage.prototype.onerror = function() {
this.confirm( false, 'onerror' );
this.unbindEvents();
};
LoadingImage.prototype.unbindEvents = function() {
this.proxyImage.removeEventListener( 'load', this );
this.proxyImage.removeEventListener( 'error', this );
this.img.removeEventListener( 'load', this );
this.img.removeEventListener( 'error', this );
};
// -------------------------- Background -------------------------- //
function Background( url, element ) {
this.url = url;
this.element = element;
this.img = new Image();
}
// inherit LoadingImage prototype
Background.prototype = Object.create( LoadingImage.prototype );
Background.prototype.check = function() {
this.img.addEventListener( 'load', this );
this.img.addEventListener( 'error', this );
this.img.src = this.url;
// check if image is already complete
var isComplete = this.getIsImageComplete();
if ( isComplete ) {
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );
this.unbindEvents();
}
};
Background.prototype.unbindEvents = function() {
this.img.removeEventListener( 'load', this );
this.img.removeEventListener( 'error', this );
};
Background.prototype.confirm = function( isLoaded, message ) {
this.isLoaded = isLoaded;
this.emitEvent( 'progress', [ this, this.element, message ] );
};
// -------------------------- jQuery -------------------------- //
ImagesLoaded.makeJQueryPlugin = function( jQuery ) {
jQuery = jQuery || window.jQuery;
if ( !jQuery ) {
return;
}
// set local variable
$ = jQuery;
// $().imagesLoaded()
$.fn.imagesLoaded = function( options, callback ) {
var instance = new ImagesLoaded( this, options, callback );
return instance.jqDeferred.promise( $(this) );
};
};
// try making plugin
ImagesLoaded.makeJQueryPlugin();
// -------------------------- -------------------------- //
return ImagesLoaded;
});
[(#REM)
Appel du script Wookmark
Exemple d'insertion : <INCLURE{fond=javascript/wookmark-appel} />
Les paramètres :
- cible : bloc sur lequel doit s'appliquer le script (défaut #wookmark)
- offset : espacement entre les blocs (défaut 50)
][(#SET{cible,#ENV{cible,.wookmark}})
][(#SET{autoResize,#ENV{autoResize,true}})
][(#SET{offset,#ENV{offset,50}})
]<script type="text/javascript">
/*<![CDATA[*/
;(function($){
$('#GET{cible}').imagesLoaded(function() {
var wookmark = new Wookmark('#GET{cible}', {
// Prepare layout options.
autoResize: #GET{autoResize}, // This will auto-update the layout when the browser window is resized.
offset: #GET{offset}, // Optional, the distance between grid items
});
});
})(jQuery);
/*]]>*/
</script>
\ No newline at end of file
/*!
Wookmark plugin
@name wookmark.js
@author Christoph Ono (chri@sto.ph or @gbks)
@author Sebastian Helzle (me@helzle.it or @sebobo)
@version 2.1.2
@date 05/05/2016
@category jQuery plugin
@copyright (c) 2009-2016 Christoph Ono (www.wookmark.com)
@license Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
*/
/*global define, window, jQuery*/
/*jslint plusplus: true, bitwise: true */
(function ($) {
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
} else {
factory();
}
}(function () {
// Wookmark default options
// ------------------------
var defaultOptions = {
align: 'center',
autoResize: true,
comparator: null,
direction: undefined,
ignoreInactiveItems: true,
inactiveClass: 'wookmark-inactive',
itemSelector: undefined,
itemWidth: 0,
fillEmptySpace: false,
flexibleWidth: 0,
offset: 5,
outerOffset: 0,
onLayoutChanged: undefined,
placeholderClass: 'wookmark-placeholder',
possibleFilters: [],
resizeDelay: 50,
verticalOffset: undefined
};
// Helper functions
// ----------------
// Bind function to set the context for the Wookmark instance function
function __bind(fn, me) {
return function () {
return fn.apply(me, arguments);
};
}
// Function for executing css writes to dom on the next animation frame if supported
var executeNextFrame = window.requestAnimationFrame || function (callback) { callback(); };
// Update multiple css values on an object
function setCSS(el, properties) {
var key;
for (key in properties) {
if (properties.hasOwnProperty(key)) {
el.style[key] = properties[key];
}
}
}
// Update the css properties of multiple elements at the same time
// befor the browsers next animation frame.
// The parameter `data` has to be an array containing objects, each
// with the element and the desired css properties.
function bulkUpdateCSS(data, callback) {
executeNextFrame(function () {
var i, item;
for (i = 0; i < data.length; i++) {
item = data[i];
setCSS(item.el, item.css);
}
// Run optional callback
if (typeof callback === 'function') {
executeNextFrame(callback);
}
});
}
// Remove whitespace around filter names
function cleanFilterName(filterName) {
return filterName.replace(/^\s+|\s+$/g, '').toLowerCase();
}
// Remove listener from an element (IE8 compatible)
function removeEventListener(el, eventName, handler) {
if (window.jQuery) {
$(el).off(eventName, handler);
} else if (el.removeEventListener) {
el.removeEventListener(eventName, handler);
} else {
el.detachEvent('on' + eventName, handler);
}
}
// Add listener to an element (IE8 compatible)
function addEventListener(el, eventName, handler) {
removeEventListener(el, eventName, handler);
if (window.jQuery) {
$(el).on(eventName, handler);
} else if (el.addEventListener) {
el.addEventListener(eventName, handler);
} else {
el.attachEvent('on' + eventName, function () {