// comme article-texte-10 pour le texte de l'article 10
// ou meta-valeur-meta
var cray =
- c.match(/\b\w+-(\w+)-\d(?:-\w+)+\b/) // numeros_lien-type-2-3-article (table-champ-cles)
- || c.match(/\b\w+-(\w+)-\d+\b/) // article-texte-10 (inclu dans le precedent, mais bon)
- || c.match(/\b\meta-valeur-(\w+)\b/) // meta-valeur-xx
- ;
+ c.match(/\b\w+-(\w+)-\d(?:-\w+)+\b/) // numeros_lien-type-2-3-article (table-champ-cles)
+ || c.match(/\b\w+-(\w+)-\d+\b/) // article-texte-10 (inclu dans le precedent, mais bon)
+ || c.match(/\b\meta-valeur-(\w+)\b/) // meta-valeur-xx
+ ;
var boite = !cray ? '' : this.mkimg(type, ' (' + cray[1] + ')');
'h': $(this).height(),
'ww': (window.innerWidth ? window.innerWidth : (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.offsetWidth)),
'wh': (window.innerHeight ? window.innerHeight : (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.offsetHeight)),
- 'em': $(this).px('fontSize'), // eviter un bug MSIE sur fontSize
+ 'em': $(this).css('fontSize'), // Bug de jquery resolu : http://bugs.jquery.com/ticket/760
'class': me.className,
'color': $(this).css('color'),
- 'font-size': $(this).px('fontSize'),
+ 'font-size': $(this).css('fontSize'),
'font-family': $(this).css('fontFamily'),
'font-weight': $(this).css('fontWeight'),
'line-height': $(this).css('lineHeight'),
.addClass('crayon-has')
.find('>.crayon-icones')
.attr('rel','crayon_'+id_crayon);
- if ($.browser.msie) $(me).css({'zoom':1});
+ // Detection IE sur sa capacite a gerer zoom :
+ // http://www.sitepoint.com/detect-css3-property-browser-support/
+ if (document.createElement("detect").style.zoom === "") {
+ $(me).css({'zoom':1});
+ }
var pos = $(me).offset();
$('<div class="crayon-html" id="crayon_'+id_crayon+'"></div>')
.css({
// active un crayon qui vient d'etre charge
$.fn.activatecrayon = function(percent) {
+ var focus = false;
this
.crayon()
.click(function(e){
d[$('input.crayon-id', crayon).val()]
)
.iconecrayon();
+
+ // Invalider des préchargements ajax
+ if (typeof jQuery.spip == 'object' && typeof jQuery.spip.preloaded_urls == 'object') {
+ jQuery.spip.preloaded_urls = {};
+ }
+
// Declencher le onAjaxLoad normal de SPIP
if (typeof jQuery.spip == 'object' && typeof jQuery.spip.triggerAjaxLoad == 'function') {
jQuery.spip.triggerAjaxLoad(tous.get());
e.cancelBubble = true;
})
// focus par defaut (crayons sans textarea/text, mais uniquement menus ou fichiers)
- .find('input:visible:first').focus().end()
+ .find('input:visible:not(:disabled):not([readonly]):first').focus().end()
.find("textarea.crayon-active,input.crayon-active[type=text]")
.each(function(n){
- // focus pour commencer a taper son texte directement dans le champ
+ // focus pour commencer a taper son texte directement dans le champ
+ // sur le premier textarea non readonly ni disabled
// on essaie de positionner la selection (la saisie) au niveau du clic
// ne pas le faire sur un input de [type=file]
if (n==0) {
- this.focus();
+ if(!$(this).is(':disabled, [readonly]')){
+ this.focus();
+ focus = true;
+ }
// premiere approximation, en fonction de la hauteur du clic
var position = parseInt(percent * this.textLength);
this.selectionStart=position;
this.selectionEnd=position;
- }
+ }else if(!focus && !$(this).is(':disabled, [readonly]'))
+ this.focus();
})
.end()
.keydown(function(e){
// demarrer les crayons
if ((typeof crayons_init_dynamique == 'undefined') || (crayons_init_dynamique==false)) {
+
+ // compat jQuery 1.9
+ if (typeof $.fn.live == 'undefined') {
+ $.fn.live = function( types, data, fn ) {
+ $( this.context ).on( types, this.selector, data, fn );
+ return this;
+ };
+ }
$('.crayon:not(.crayon-init)')
.live('mouseover touchstart', function(e) {
$(this)