Configuring plugins

Configuring plugins

Hi,

I have a plug-in that requires a bit of code to configure.  I use it multiple times with the same configuration, and I don't want to clutter my script each time with the configuration.  The following works fine, however, I wonder if there is a more jQuery way of doing it.  Thank you

  1. <script type="text/javascript">
  2. $(function() {
  3. $("textarea.tinymce").tinymce(tinymce_setup());
  4. });

  5. function tinymce_setup()
  6. {
  7. return({
  8. // Location of TinyMCE script
  9. script_url : "lib/js/tinymce/jscripts/tiny_mce/tiny_mce.js",
  10. // General options
  11. theme : "advanced",
  12. plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
  13. // Theme options
  14. theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
  15. theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
  16. theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
  17. theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
  18. theme_advanced_toolbar_location : "top",
  19. theme_advanced_toolbar_align : "left",
  20. theme_advanced_statusbar_location : "bottom",
  21. theme_advanced_resizing : true,
  22. // Example content CSS (should be your site CSS)
  23. content_css : "css/example.css",
  24. // Drop lists for link/image/media/template dialogs
  25. template_external_list_url : "lists/template_list.js",
  26. external_link_list_url : "lists/link_list.js",
  27. external_image_list_url : "lists/image_list.js",
  28. media_external_list_url : "lists/media_list.js",
  29. // Replace values for the template plugin
  30. template_replace_values : {
  31. username : "Some User",
  32. staffid : "991234"
  33. }
  34. });
  35. }
</script>