site-tpe/EnlighterJS/Resources/ExampleData/Example2-jsinit.phtml
2025-05-16 18:49:08 +02:00

49 lines
1.4 KiB
PHTML

<!-- Initialize EnlighterJS using the Helper Utility -->
<script type="text/javascript">
window.addEvent('domready', function(){
// Global EnlighterJS initialization for block code (selector: pre) and inline code (selector: code.special) with some options
// EnlighterJS.Util.Init(blockSelector:String, inlineSelector:String, options:Object)
EnlighterJS.Util.Init('pre', 'code.special', {
// reindent code -> replace tab with 2 spaces
indent: 2,
// show all buttons
infoButton: true,
windowButton: true,
rawButton: true,
// special hover class
hover: 'myHoverClass',
// default language
language: 'php',
// default theme
theme: 'classic',
// toolbar labels
toolbar: {
rawTitle: 'RAW Code',
windowTitle: 'New Window',
infoTitle: 'EnlighterJS'
}
});
});
</script>
<div class="alert alert-success" role="alert">Level: <strong>Beginner</strong></div>
<h3>Some Examples</h3>
<h4>jQuery Code (Javascript) - highlighted by EnlighterJS</h4>
<pre data-enlighter-language="jquery" data-enlighter-highlight="5">
$('#loading-example-btn').click(function () {
var btn = $(this)
btn.button('loading')
$.ajax(...).always(function () {
btn.button('reset')
});
});
</pre>
<h4>Inline Code</h4>
<p>EnlighterJS also supports <code class="special" >$content = print_r(array(1,2,3), true);</code> (since version 2.0).</p>