public function onKunenaBbcodeEditorInit($editor) { $this->loadLanguage(); $btn = new KunenaBbCodeEditorButton('spotify', 'spotify', 'spotify', 'PLG_KUNENASPOTIFY_BTN_TITLE', 'PLG_KUNENASPOTIFY_BTN_ALT'); $btn->addWrapSelectionAction(); $editor->insertElement($btn, 'after', 'code'); $document = JFactory::getDocument(); $document->addStyleDeclaration("#Kunena #kbbcode-toolbar #spotify {\n background-image: url(\"" . JURI::base(true) . "/plugins/kunena/kunenaspotify/images/spotify.png\");\n }"); //Add JS Code for preview $document->addScriptDeclaration("window.addEvent('domready', function() {\n preview = document.id('kbbcode-preview');\n preview.addEvent('updated', function(event){\n MathJax.Hub.Queue(['Typeset',MathJax.Hub,'kbbcode-preview']);\n document.getElements('.latex').each(function(item, index) {\n item.setStyle('display', '');\n });\n });\n });"); }
public function onKunenaBbcodeEditorInit($editor) { $this->loadLanguage(); $btn = new KunenaBbCodeEditorButton('tex', 'tex', 'tex', 'PLG_KUNENATEX_BTN_TITLE', 'PLG_KUNENATEX_BTN_ALT'); $btn->addWrapSelectionAction(); $editor->insertElement($btn, 'after', 'code'); $url = $this->params->get('mathjax', 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'); // We need to add it in here already, because the BBcode parser is only loaded in a second request. $document = JFactory::getDocument(); $document->addScript($url); $document->addStyleDeclaration("#Kunena #kbbcode-toolbar #tex {\n background-image: url(\"" . JURI::base(true) . "/plugins/kunena/kunenatex/images/tex.png\");\n }"); $document->addScriptDeclaration("window.addEvent('domready', function() {\n\tpreview = document.id('kbbcode-preview');\n\n\tpreview.addEvent('updated', function(event){\n\t\t\t\tMathJax.Hub.Queue(['Typeset',MathJax.Hub,'kbbcode-preview']);\n\t\t\t\tdocument.getElements('.latex').each(function(item, index) {\n item.setStyle('display', '');\n });\n\t\t\t}\n\t\t);\n});"); }