Warning: Invalid argument supplied for foreach() in /mnt/116/sda/4/f/marbrouck/plugins/auto/couteau_suisse/outils/decoration.php on line 149
barre_outils_edition = {"nameSpace":"edition","previewAutoRefresh":false,"onEnter":{"keepDefault":false,"selectionType":"return","replaceWith":"\n"} ,"onShiftEnter":{"keepDefault":false,"replaceWith":"\n_ "} ,"onCtrlEnter":{"keepDefault":false,"replaceWith":"\n\n"} ,"onTab":{"keepDefault":false,"replaceWith":" "} ,"markupSet":[{"name":"Transformer en {{{intertitre}}}","key":"H","className":"outil_header1","openWith":"\n{{{","closeWith":"}}}\n","selectionType":"line"} ,{"name":"Mettre en {{gras}}","key":"B","className":"outil_bold","replaceWith":function(h){ return espace_si_accolade(h, '{{', '}}');},"selectionType":"word"} ,{"name":"Mettre en {italique}","key":"I","className":"outil_italic","replaceWith":function(h){ return espace_si_accolade(h, '{', '}');},"selectionType":"word"} ,{"name":"Barrer le texte","className":"outil_stroke_through","openWith":"","closeWith":"","selectionType":"word"} ,{"name":"Appliquer au texte une « décoration » personnalisée","className":"cs_decoration_drop","replaceWith":"","dropMenu":[] } ,{"name":"Mettre en liste","className":"outil_liste_ul","replaceWith":function(h){ return outil_liste(h, '*');},"selectionType":"line","forceMultiline":true,"dropMenu":[{"id":"liste_ol","name":"Mettre en liste numérotée","className":"outil_liste_ol","replaceWith":function(h){ return outil_liste(h, '#');},"display":true,"selectionType":"line","forceMultiline":true} ,{"id":"indenter","name":"Indenter une liste","className":"outil_indenter","replaceWith":function(h){return outil_indenter(h);},"display":true,"selectionType":"line","forceMultiline":true} ,{"id":"desindenter","name":"Désindenter une liste","className":"outil_desindenter","replaceWith":function(h){return outil_desindenter(h);},"display":true,"selectionType":"line","forceMultiline":true} ] } ,{"separator":"---------------"} ,{"name":"Transformer en [lien hypertexte->http://...]","key":"L","className":"outil_link","openWith":"[","closeWith":"->[![Veuillez indiquer l'adresse de votre lien (vous pouvez indiquer une adresse Internet sous la forme http://www.monsite.com, une adresse courriel, ou simplement indiquer le numéro d'un article de ce site.]!]]"} ,{"name":"Transformer en [[Note de bas de page]]","className":"outil_notes","openWith":"[[","closeWith":"]]","selectionType":"word"} ,{"separator":"---------------"} ,{"name":"Citer un message","key":"Q","className":"outil_quote","openWith":"\n","closeWith":"\n","selectionType":"word"} ,{"name":"Entourer de « guillemets »","className":"outil_guillemets","openWith":"«","closeWith":"»","lang":["fr","eo","cpf","ar","es"] ,"selectionType":"word"} ,{"name":"Entourer de “guillemets de second niveau”","className":"outil_guillemets_simples","openWith":"“","closeWith":"”","lang":["fr","eo","cpf","ar","es"] ,"selectionType":"word"} ,{"name":"Entourer de « guillemets »","className":"outil_guillemets_de","openWith":"„","closeWith":"“","lang":["bg","de","pl","hr","src"] ,"selectionType":"word"} ,{"name":"Entourer de “guillemets de second niveau”","className":"outil_guillemets_de_simples","openWith":"‚","closeWith":"‘","lang":["bg","de","pl","hr","src"] ,"selectionType":"word"} ,{"name":"Entourer de « guillemets »","className":"outil_guillemets_simples","openWith":"“","closeWith":"”","lang_not":["fr","eo","cpf","ar","es","bg","de","pl","hr","src"] ,"selectionType":"word"} ,{"name":"Entourer de “guillemets de second niveau”","className":"outil_guillemets_uniques","openWith":"‘","closeWith":"’","lang_not":["fr","eo","cpf","ar","es","bg","de","pl","hr","src"] ,"selectionType":"word"} ,{"separator":"---------------"} ,{"name":"Insérer des caractères spécifiques","className":"outil_caracteres","dropMenu":[{"id":"A_grave","name":"Insérer un A accent grave majuscule","className":"outil_a_maj_grave","replaceWith":"À","display":true,"lang":["fr","eo","cpf"] } ,{"id":"E_aigu","name":"Insérer un E accent aigu majuscule","className":"outil_e_maj_aigu","replaceWith":"É","display":true,"lang":["fr","eo","cpf"] } ,{"id":"E_grave","name":"Insérer un E majuscule accent grave","className":"outil_e_maj_grave","replaceWith":"È","display":true,"lang":["fr","eo","cpf"] } ,{"id":"aelig","name":"Insérer un E dans l'A","className":"outil_aelig","replaceWith":"æ","display":true,"lang":["fr","eo","cpf"] } ,{"id":"AElig","name":"Insérer un E dans l'A majuscule","className":"outil_aelig_maj","replaceWith":"Æ","display":true,"lang":["fr","eo","cpf"] } ,{"id":"oe","name":"Insérer un E dans l'O","className":"outil_oe","replaceWith":"œ","display":true,"lang":["fr"] } ,{"id":"OE","name":"Insérer un E dans l'O majuscule","className":"outil_oe_maj","replaceWith":"Œ","display":true,"lang":["fr"] } ,{"id":"Ccedil","name":"Insérer un C cédille majuscule","className":"outil_ccedil_maj","replaceWith":"Ç","display":true,"lang":["fr","eo","cpf"] } ,{"id":"uppercase","name":"Passer en majuscules","className":"outil_uppercase","replaceWith":function(markitup) { return markitup.selection.toUpperCase() },"display":true,"lang":["fr","en"] } ,{"id":"lowercase","name":"Passer en minuscules","className":"outil_lowercase","replaceWith":function(markitup) { return markitup.selection.toLowerCase() },"display":true,"lang":["fr","en"] } ] } ,{"name":"Insérer une frimousse ","className":"cs_smileys_drop","replaceWith":"","dropMenu":[{"id":"smiley_pleure_de_rire","name":"Insérer une frimousse :’-))","className":"smiley_pleure_de_rire","replaceWith":":’-))","display":true} ,{"id":"smiley_triste","name":"Insérer une frimousse :’-(","className":"smiley_triste","replaceWith":":’-(","display":true} ,{"id":"smiley_mort_de_rire","name":"Insérer une frimousse :-))","className":"smiley_mort_de_rire","replaceWith":":-))","display":true} ,{"id":"smiley_en_colere","name":"Insérer une frimousse :-((","className":"smiley_en_colere","replaceWith":":-((","display":true} ,{"id":"smiley_clin_d-oeil","name":"Insérer une frimousse ;-)","className":"smiley_clin_d-oeil","replaceWith":";-)","display":true} ,{"id":"smiley_sourire","name":"Insérer une frimousse :-)","className":"smiley_sourire","replaceWith":":-)","display":true} ,{"id":"smiley_pas_content","name":"Insérer une frimousse :-(","className":"smiley_pas_content","replaceWith":":-(","display":true} ,{"id":"smiley_diable","name":"Insérer une frimousse :->","className":"smiley_diable","replaceWith":":->","display":true} ,{"id":"smiley_rouge","name":"Insérer une frimousse |-)","className":"smiley_rouge","replaceWith":"|-)","display":true} ,{"id":"smiley_rigolo","name":"Insérer une frimousse :o)","className":"smiley_rigolo","replaceWith":":o)","display":true} ,{"id":"smiley_lunettes","name":"Insérer une frimousse B-)","className":"smiley_lunettes","replaceWith":"B-)","display":true} ,{"id":"smiley_tire_la_langue","name":"Insérer une frimousse :-P","className":"smiley_tire_la_langue","replaceWith":":-P","display":true} ,{"id":"smiley_bof","name":"Insérer une frimousse :-|","className":"smiley_bof","replaceWith":":-|","display":true} ,{"id":"smiley_mouais","name":"Insérer une frimousse :-/","className":"smiley_mouais","replaceWith":":-/","display":true} ,{"id":"smiley_surpris","name":"Insérer une frimousse :-O","className":"smiley_surpris","replaceWith":":-O","display":true} ] } ] } // remplace ou cree -* ou -** ou -# ou -## function outil_liste(h, c) { if ((s = h.selection) && (r = s.match(/^-([*#]+) (.*)$/))) { r[1] = r[1].replace(/[#*]/g, c); s = '-'+r[1]+' '+r[2]; } else { s = '-' + c + ' '+s; } return s; } // indente des -* ou -# function outil_indenter(h) { if (s = h.selection) { if (s.substr(0,2)=='-*') { s = '-**' + s.substr(2); } else if (s.substr(0,2)=='-#') { s = '-##' + s.substr(2); } else { s = '-* ' + s; } } return s; } // desindente des -* ou -** ou -# ou -## function outil_desindenter(h){ if (s = h.selection) { if (s.substr(0,3)=='-**') { s = '-*' + s.substr(3); } else if (s.substr(0,3)=='-* ') { s = s.substr(3); } else if (s.substr(0,3)=='-##') { s = '-#' + s.substr(3); } else if (s.substr(0,3)=='-# ') { s = s.substr(3); } } return s; } // ajouter un espace avant, apres un {qqc} pour ne pas que // gras {{}} suivi de italique {} donnent {{{}}}, mais { {{}} } function espace_si_accolade(h, openWith, closeWith){ if (s = h.selection) { // accolade dans la selection if (s.charAt(0)=='{') { return openWith + ' ' + s + ' ' + closeWith; } // accolade avant la selection else if (c = h.textarea.selectionStart) { if (h.textarea.value.charAt(c-1) == '{') { return ' ' + openWith + s + closeWith + ' '; } } } return openWith + s + closeWith; } function outil_decoration(sel, racc, balise, defaut) { if(sel) { r='<'+racc+'>'+sel+''; return balise=='span'?r.replace(/(\n\n|\r\n\r\n|\r\r)/g,'$1<'+racc+'>'):r; } return defaut; } barre_outils_forum = {"nameSpace":"forum","previewAutoRefresh":false,"onEnter":{"keepDefault":false,"selectionType":"return","replaceWith":"\n"} ,"onShiftEnter":{"keepDefault":false,"replaceWith":"\n_ "} ,"onCtrlEnter":{"keepDefault":false,"replaceWith":"\n\n"} ,"onTab":{"keepDefault":false,"replaceWith":" "} ,"markupSet":[{"name":"Transformer en {{{intertitre}}}","key":"H","className":"outil_header1","openWith":"\n{{{","closeWith":"}}}\n","selectionType":"line"} ,{"name":"Mettre en {{gras}}","key":"B","className":"outil_bold","replaceWith":function(h){ return espace_si_accolade(h, '{{', '}}');},"selectionType":"word"} ,{"name":"Mettre en {italique}","key":"I","className":"outil_italic","replaceWith":function(h){ return espace_si_accolade(h, '{', '}');},"selectionType":"word"} ,{"name":"Barrer le texte","className":"outil_stroke_through","openWith":"","closeWith":"","selectionType":"word"} ,{"name":"Appliquer au texte une « décoration » personnalisée","className":"cs_decoration_drop","replaceWith":"","dropMenu":[] } ,{"name":"Mettre en liste","className":"outil_liste_ul","replaceWith":function(h){ return outil_liste(h, '*');},"selectionType":"line","forceMultiline":true,"dropMenu":[{"id":"liste_ol","name":"Mettre en liste numérotée","className":"outil_liste_ol","replaceWith":function(h){ return outil_liste(h, '#');},"display":false,"selectionType":"line","forceMultiline":true} ,{"id":"indenter","name":"Indenter une liste","className":"outil_indenter","replaceWith":function(h){return outil_indenter(h);},"display":false,"selectionType":"line","forceMultiline":true} ,{"id":"desindenter","name":"Désindenter une liste","className":"outil_desindenter","replaceWith":function(h){return outil_desindenter(h);},"display":false,"selectionType":"line","forceMultiline":true} ] } ,{"separator":"---------------"} ,{"name":"Transformer en [lien hypertexte->http://...]","key":"L","className":"outil_link","openWith":"[","closeWith":"->[![Veuillez indiquer l'adresse de votre lien (vous pouvez indiquer une adresse Internet sous la forme http://www.monsite.com, une adresse courriel, ou simplement indiquer le numéro d'un article de ce site.]!]]"} ,{"name":"Transformer en [[Note de bas de page]]","className":"outil_notes","openWith":"[[","closeWith":"]]","selectionType":"word"} ,{"separator":"---------------"} ,{"name":"Citer un message","key":"Q","className":"outil_quote","openWith":"\n","closeWith":"\n","selectionType":"word"} ,{"name":"Entourer de « guillemets »","className":"outil_guillemets","openWith":"«","closeWith":"»","lang":["fr","eo","cpf","ar","es"] ,"selectionType":"word"} ,{"name":"Entourer de “guillemets de second niveau”","className":"outil_guillemets_simples","openWith":"“","closeWith":"”","lang":["fr","eo","cpf","ar","es"] ,"selectionType":"word"} ,{"name":"Entourer de « guillemets »","className":"outil_guillemets_de","openWith":"„","closeWith":"“","lang":["bg","de","pl","hr","src"] ,"selectionType":"word"} ,{"name":"Entourer de “guillemets de second niveau”","className":"outil_guillemets_de_simples","openWith":"‚","closeWith":"‘","lang":["bg","de","pl","hr","src"] ,"selectionType":"word"} ,{"name":"Entourer de « guillemets »","className":"outil_guillemets_simples","openWith":"“","closeWith":"”","lang_not":["fr","eo","cpf","ar","es","bg","de","pl","hr","src"] ,"selectionType":"word"} ,{"name":"Entourer de “guillemets de second niveau”","className":"outil_guillemets_uniques","openWith":"‘","closeWith":"’","lang_not":["fr","eo","cpf","ar","es","bg","de","pl","hr","src"] ,"selectionType":"word"} ,{"separator":"---------------"} ,{"name":"Insérer des caractères spécifiques","className":"outil_caracteres","dropMenu":[{"id":"A_grave","name":"Insérer un A accent grave majuscule","className":"outil_a_maj_grave","replaceWith":"À","display":true,"lang":["fr","eo","cpf"] } ,{"id":"E_aigu","name":"Insérer un E accent aigu majuscule","className":"outil_e_maj_aigu","replaceWith":"É","display":true,"lang":["fr","eo","cpf"] } ,{"id":"E_grave","name":"Insérer un E majuscule accent grave","className":"outil_e_maj_grave","replaceWith":"È","display":true,"lang":["fr","eo","cpf"] } ,{"id":"aelig","name":"Insérer un E dans l'A","className":"outil_aelig","replaceWith":"æ","display":true,"lang":["fr","eo","cpf"] } ,{"id":"AElig","name":"Insérer un E dans l'A majuscule","className":"outil_aelig_maj","replaceWith":"Æ","display":true,"lang":["fr","eo","cpf"] } ,{"id":"oe","name":"Insérer un E dans l'O","className":"outil_oe","replaceWith":"œ","display":true,"lang":["fr"] } ,{"id":"OE","name":"Insérer un E dans l'O majuscule","className":"outil_oe_maj","replaceWith":"Œ","display":true,"lang":["fr"] } ,{"id":"Ccedil","name":"Insérer un C cédille majuscule","className":"outil_ccedil_maj","replaceWith":"Ç","display":true,"lang":["fr","eo","cpf"] } ,{"id":"uppercase","name":"Passer en majuscules","className":"outil_uppercase","replaceWith":function(markitup) { return markitup.selection.toUpperCase() },"display":false,"lang":["fr","en"] } ,{"id":"lowercase","name":"Passer en minuscules","className":"outil_lowercase","replaceWith":function(markitup) { return markitup.selection.toLowerCase() },"display":false,"lang":["fr","en"] } ] } ,{"name":"Insérer une frimousse ","className":"cs_smileys_drop","replaceWith":"","dropMenu":[{"id":"smiley_pleure_de_rire","name":"Insérer une frimousse :’-))","className":"smiley_pleure_de_rire","replaceWith":":’-))","display":true} ,{"id":"smiley_triste","name":"Insérer une frimousse :’-(","className":"smiley_triste","replaceWith":":’-(","display":true} ,{"id":"smiley_mort_de_rire","name":"Insérer une frimousse :-))","className":"smiley_mort_de_rire","replaceWith":":-))","display":true} ,{"id":"smiley_en_colere","name":"Insérer une frimousse :-((","className":"smiley_en_colere","replaceWith":":-((","display":true} ,{"id":"smiley_clin_d-oeil","name":"Insérer une frimousse ;-)","className":"smiley_clin_d-oeil","replaceWith":";-)","display":true} ,{"id":"smiley_sourire","name":"Insérer une frimousse :-)","className":"smiley_sourire","replaceWith":":-)","display":true} ,{"id":"smiley_pas_content","name":"Insérer une frimousse :-(","className":"smiley_pas_content","replaceWith":":-(","display":true} ,{"id":"smiley_diable","name":"Insérer une frimousse :->","className":"smiley_diable","replaceWith":":->","display":true} ,{"id":"smiley_rouge","name":"Insérer une frimousse |-)","className":"smiley_rouge","replaceWith":"|-)","display":true} ,{"id":"smiley_rigolo","name":"Insérer une frimousse :o)","className":"smiley_rigolo","replaceWith":":o)","display":true} ,{"id":"smiley_lunettes","name":"Insérer une frimousse B-)","className":"smiley_lunettes","replaceWith":"B-)","display":true} ,{"id":"smiley_tire_la_langue","name":"Insérer une frimousse :-P","className":"smiley_tire_la_langue","replaceWith":":-P","display":true} ,{"id":"smiley_bof","name":"Insérer une frimousse :-|","className":"smiley_bof","replaceWith":":-|","display":true} ,{"id":"smiley_mouais","name":"Insérer une frimousse :-/","className":"smiley_mouais","replaceWith":":-/","display":true} ,{"id":"smiley_surpris","name":"Insérer une frimousse :-O","className":"smiley_surpris","replaceWith":":-O","display":true} ] } ] } // remplace ou cree -* ou -** ou -# ou -## function outil_liste(h, c) { if ((s = h.selection) && (r = s.match(/^-([*#]+) (.*)$/))) { r[1] = r[1].replace(/[#*]/g, c); s = '-'+r[1]+' '+r[2]; } else { s = '-' + c + ' '+s; } return s; } // indente des -* ou -# function outil_indenter(h) { if (s = h.selection) { if (s.substr(0,2)=='-*') { s = '-**' + s.substr(2); } else if (s.substr(0,2)=='-#') { s = '-##' + s.substr(2); } else { s = '-* ' + s; } } return s; } // desindente des -* ou -** ou -# ou -## function outil_desindenter(h){ if (s = h.selection) { if (s.substr(0,3)=='-**') { s = '-*' + s.substr(3); } else if (s.substr(0,3)=='-* ') { s = s.substr(3); } else if (s.substr(0,3)=='-##') { s = '-#' + s.substr(3); } else if (s.substr(0,3)=='-# ') { s = s.substr(3); } } return s; } // ajouter un espace avant, apres un {qqc} pour ne pas que // gras {{}} suivi de italique {} donnent {{{}}}, mais { {{}} } function espace_si_accolade(h, openWith, closeWith){ if (s = h.selection) { // accolade dans la selection if (s.charAt(0)=='{') { return openWith + ' ' + s + ' ' + closeWith; } // accolade avant la selection else if (c = h.textarea.selectionStart) { if (h.textarea.value.charAt(c-1) == '{') { return ' ' + openWith + s + closeWith + ' '; } } } return openWith + s + closeWith; } function outil_decoration(sel, racc, balise, defaut) { if(sel) { r='<'+racc+'>'+sel+''; return balise=='span'?r.replace(/(\n\n|\r\n\r\n|\r\r)/g,'$1<'+racc+'>'):r; } return defaut; } ;(function($){ // 2 fonctions pour appeler le porte plume reutilisables pour d'autres plugins // on envoie dedans la selection jquery qui doit etre effectuee // ce qui evite des appels direct a markitup, aucazou on change de lib un jour $.fn.barre_outils = function(nom, settings) { options = { lang:'fr' }; $.extend(options, settings); return $(this) .not('.markItUpEditor, .no_barre') .markItUp(eval('barre_outils_' + nom), {lang:options.lang}); }; $.fn.barre_previsualisation = function(settings) { options = { previewParserPath:"index.php?action=porte_plume_previsu", // ici une url relative pour prive/public textEditer:"Éditer", textVoir:"Voir" }; $.extend(options, settings); return $(this) .not('.pp_previsualisation, .no_previsualisation') .previsu_spip(options); }; $(window).load(function(){ // ajoute les barres d'outils markitup function barrebouilles(){ // fonction generique appliquee aux classes CSS : // inserer_barre_forum, inserer_barre_edition, inserer_previsualisation $('.formulaire_spip textarea.inserer_barre_forum').barre_outils('forum'); $('.formulaire_spip textarea.inserer_barre_edition').barre_outils('edition'); $('.formulaire_spip textarea.inserer_previsualisation').barre_previsualisation(); // fonction specifique aux formulaires de SPIP : // barre de forum $('textarea.textarea_forum').barre_outils('forum'); $('.formulaire_forum textarea[name=texte]').barre_outils('forum'); // barre d'edition et onglets de previsualisation $('.formulaire_spip textarea[name=texte]') .barre_outils('edition') .barre_previsualisation(); } barrebouilles(); onAjaxLoad(barrebouilles); }); })(jQuery);