forked from spip/porte_plume
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
2.2 KiB
64 lines
2.2 KiB
#CACHE{7*24*3600} |
|
#HTTP_HEADER{Content-Type: text/javascript; charset=#CHARSET} |
|
|
|
[(#REM) chargement des definitions des barres d'outils |
|
<script>] |
|
[(#VAL|porte_plume_creer_json_markitup)] |
|
|
|
|
|
;(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:'[(#ENV{lang})]' |
|
}; |
|
$.extend(options, settings); |
|
|
|
return $(this) |
|
.not('.markItUpEditor, .no_barre') |
|
.markItUp(eval('barre_outils_' + nom), {lang:options.lang}) |
|
.parent().find('.markItUpButton a').attr('tabindex', -1) // ne pas tabuler les boutons |
|
.end(); |
|
}; |
|
|
|
$.fn.barre_previsualisation = function(settings) { |
|
options = { |
|
previewParserPath:"index.php?action=porte_plume_previsu", // ici une url relative pour prive/public |
|
textEditer:"<:barreoutils:editer:>", |
|
textVoir:"<:barreoutils:voir:>" |
|
}; |
|
$.extend(options, settings); |
|
|
|
return $(this) |
|
.not('.pp_previsualisation, .no_previsualisation') |
|
.previsu_spip(options) |
|
.parent().find('.markItUpTabs a').attr('tabindex', -1) // ne pas tabuler les onglets |
|
.end(); |
|
}; |
|
|
|
$(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'); |
|
[(#CONFIG{forums_afficher_barre}|=={non}|non) |
|
$('.formulaire_forum textarea[(#VAL{91}|chr)]name=texte[(#VAL{93}|chr)]').barre_outils('forum');] |
|
// barre d'edition et onglets de previsualisation |
|
$('.formulaire_spip[(#CONFIG{forums_afficher_barre}|=={non}|?{':not(#formulaire_forum)',''})] textarea[name=texte]') |
|
.barre_outils('edition') |
|
.barre_previsualisation(); |
|
} |
|
barrebouilles(); |
|
onAjaxLoad(barrebouilles); |
|
|
|
}); |
|
})(jQuery);
|
|
|