====== InlineJS Plugin ====== ---- plugin ---- description: Allow inline JavaScript and StyleSheet in wiki pages author : S.Sahara email : sahara.satoshi@gmail.com type : syntax, action, helper lastupdate : 2019-10-05 compatible : 2014-09-29, 2015-08-10, 2016-06-26, 2017-02-19 depends : conflicts : similar : tags : javascript, style downloadurl: https://github.com/ssahara/dw-plugin-inlinejs/archive/master.zip bugtracker : https://github.com/ssahara/dw-plugin-inlinejs/issues sourcerepo : https://github.com/ssahara/dw-plugin-inlinejs/ donationurl: screenshot_img : ---- ===== Installation ===== Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually. Even though this plugin installed successfully, you may need [[#Configuration and Settings|additional configuration]] in the configuration manager in order to make the plugin effective (except Macro syntax). Please see [[#Configuration and Settings]] section below. ===== Examples/Usage ===== This plugin was initially developed to incorporate some JavaScript Chart/Plot in a DokuWiki page. In such case, you may need to 1) load several library files in section of HTML, 2) prepare chart box or canvas, and 3) write inline JavaScript to produce a chart. The inlineJS plugin enables step 1) and 3) inside your DW page by "%%%%" and "%%%%" tag markup, respectively. For example, to draw a X-Y graph using [[http://www.jqplot.com|jqPlot]] -- a plotting and charting plugin for the jQuery JavaScript framework, the DW page source looks like: # Step 1: load several library files in section /js/jquery.jqplot.css # css # /js/jquery.min.js (not required since DokuWiki 2012-01-25 Angua uses jQuery) /js/jquery.jqplot.min.js # js

Figure. line chart example

// Step 3 : inline JavaScript to produce a chart // ! do not forget to replace "$.jqplot" to "jQuery.jqplot" var data = [[0,0.0],[1,1.0],[2,1.414],[5,2.236],[7,2.646],[11,3.317]]; jQuery.jqplot('chartbox', [data]);
===== Syntax ===== ==== PRELOAD tag ==== JavaScript and Stylesheet preloader in section of HTML. /path/to/javascript.js /path/to/stylesheet.css HTML output:\\ * Those files will be loaded only for specific pages, instead for all pages. * one line for one file to be loaded. * use "#" for comment * external .js or .css using URL * If '''' used, filename(s) to be loaded in section are displayed in the DW page. ==== JS tag ==== Inline JavaScript embedder in section of HTML. ... or ... HTML output:\\ * DokuWiki (conf/userscript.js) supports a "site-wide" JavaScript solution. Please refer [[:devel:javascript]] for detail. * This plugin provides a "per-page" solution for inline JavaScript. * Your JavaScript between '''' and '''' is enclosed inside CDATA section in accordance with the guidance in [[:devel:javascript]]. ==== CSS tag ==== ... HTML output:\\ ===== Configuration and Settings ===== By default, both "%%%%" and "%%%%" markup in the page will be **ignored** if [[:config:htmlok]] is disabled in the configuration manager. The "''follow_htmlok''" option of this plugin is available to these markup effective independently from [[:config:htmlok]]. The default value of "follow_htmlok" = ''**1**''. Note that if embedding HTML using the "%%%%" tag is allowed, users who can edit a page is also able to write inline JavaScript in the page without this plugin. ^ :!: This is a security risk when used on a freely accessible site because it enables Cross Site Scripting attacks! Prior to use this plugin, you are strongly recommended to refer [[:config:htmlok]], [[:security#plugin_security]] and [[:wiki:syntax#embedding_html_and_php|syntax]] pages.^ ===== Development ===== === Change Log === {{rss>https://github.com/ssahara/dw-plugin-inlinejs/commits/master.atom date 5}} === ToDo === no plan... ===== Known Bugs and Issues ===== ===== FAQ ===== ===== Discussion =====