/* * boutonstexte.js (c) toggg http://toggg.com 2006 -- licence LGPL */ // on dépend de jQuery if (typeof jQuery == 'function') (function($){ $(function(){ var boutons = $(''); if (!$("img.textsizeup").length && boutonstexte.txtSizeUp) { $('') .appendTo(boutons); } if (!$("img.textsizedown").length && boutonstexte.txtSizeDown) { $('') .appendTo(boutons); } if (!$("img.textonly").length && boutonstexte.txtOnly) { $('') .appendTo(boutons); } if (boutons.html()) { $(boutonstexte.selector).before(boutons); } $("img.textsizeup,button.textsizeup") .click(function(e) { boutonstexte.fontBigger($(this).is('button') ? this : null); e.stopPropagation(); }) .attr({'alt':boutonstexte.txtSizeUp, 'title':boutonstexte.txtSizeUp}); $("img.textsizedown,button.textsizedown") .click(function(e) { boutonstexte.fontSmaller($(this).is('button') ? this : null); e.stopPropagation(); }) .attr({'alt':boutonstexte.txtSizeDown, 'title':boutonstexte.txtSizeDown}); $("img.textonly,button.textonly") .click(function(e) { boutonstexte.texteOnly($(this).is('button') ? this : null); e.stopPropagation(); }) .attr({'alt':boutonstexte.txtOnly, 'title':boutonstexte.txtOnly}); }); })(jQuery); // le prototype boutons du contenu function boutonsTexte(options) { this.rate = 1.2; this.selector = "#contenu .texte"; for (opt in options) { this[opt] = options[opt]; } } boutonsTexte.prototype.texteOnly = function(elt) { var that = this; var texte = jQuery(elt).parent().next(); jQuery("body").toggleClass('onlytext_wrapper'); if (this['backTextOnly']) { texte.removeClass("onlytext"); jQuery(elt).attr({ 'title': that.txtOnly, 'alt': that.txtOnly }). parent().insertBefore(jQuery("#marktextonly")).after(texte); jQuery("#marktextonly").remove(); jQuery('body').children().show(); this.backTextOnly = false; return; } texte.addClass("onlytext"); jQuery(texte[texte.length-1]).after('