added site files
This commit is contained in:
parent
a6f70a6c78
commit
329148c253
253 changed files with 30486 additions and 0 deletions
55
EnlighterJS/Source/Util/Metainit.js
Normal file
55
EnlighterJS/Source/Util/Metainit.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
---
|
||||
description: Automatical element highlighting using meta tag options
|
||||
|
||||
license: MIT-style X11 License
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS]
|
||||
...
|
||||
*/
|
||||
window.addEvent('domready', function(){
|
||||
// metadata config available ? -> autoinit
|
||||
var m = EJS.Dom.getElement('meta[name="EnlighterJS"]');
|
||||
|
||||
// check instance
|
||||
if (!m){
|
||||
return;
|
||||
}
|
||||
|
||||
// create new options object
|
||||
var options = {
|
||||
language: m.get('data-language') || 'generic',
|
||||
theme: m.get('data-theme') || 'Enlighter',
|
||||
indent: m.get('data-indent').toInt() || -1,
|
||||
hover: m.get('data-hover') || 'hoverEnabled',
|
||||
rawButton: (m.get('data-rawcodebutton')==='true'),
|
||||
windowButton: (m.get('data-windowbutton')==='true'),
|
||||
infoButton: (m.get('data-infobutton')==='true'),
|
||||
showLinenumbers: (m.get('data-linenumbers')!=='false')
|
||||
};
|
||||
|
||||
// selector available ? if not, match all pre-tags
|
||||
var blockSelector = m.get('data-selector-block') || 'pre';
|
||||
|
||||
// selector available ? if not, match all pre-tags
|
||||
var inlineSelector = m.get('data-selector-inline') || 'code';
|
||||
|
||||
// highlight all matching block tags
|
||||
if (blockSelector != 'NULL'){
|
||||
options.renderer = 'Block';
|
||||
EJS.Util.Helper(EJS.Dom.getElements(blockSelector), options);
|
||||
}
|
||||
|
||||
// highlight all matching inline tags
|
||||
if (inlineSelector != 'NULL'){
|
||||
options.renderer = 'Inline';
|
||||
options.grouping = false;
|
||||
EJS.Util.Helper(EJS.Dom.getElements(inlineSelector), options);
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue