added site files
This commit is contained in:
parent
a6f70a6c78
commit
329148c253
253 changed files with 30486 additions and 0 deletions
30
EnlighterJS/Source/UI/CodeWindow.js
Normal file
30
EnlighterJS/Source/UI/CodeWindow.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
---
|
||||
name: CodeWindow
|
||||
description: Opens a new Window with the raw-sourcecode within
|
||||
|
||||
license: MIT-style X11 License
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.UI.CodeWindow]
|
||||
...
|
||||
*/
|
||||
EJS.UI.CodeWindow = (function(code){
|
||||
// code "cleanup"
|
||||
code = code.replace(/&/gim, '&').replace(/</gim, '<').replace(/>/gim, '>');
|
||||
|
||||
// open new window
|
||||
var w = window.open('', '', 'width=' + (window.screen.width -200) + ', height=' + (screen.height-300) + ', menubar=no, titlebar=no, toolbar=no, top=100, left=100, scrollbars=yes, status=no');
|
||||
|
||||
// insert code
|
||||
w.document.body.innerHTML = '<pre>' + code + '</pre>';
|
||||
w.document.title = 'EnlighterJS Sourcecode';
|
||||
});
|
||||
|
||||
|
||||
|
120
EnlighterJS/Source/UI/TabPane.js
Normal file
120
EnlighterJS/Source/UI/TabPane.js
Normal file
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
---
|
||||
name: TapPane
|
||||
description: Displays multiple code-blocks within a group
|
||||
|
||||
license: MIT-style X11 License
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.UI.TabPane]
|
||||
...
|
||||
*/
|
||||
EJS.UI.TabPane = new Class({
|
||||
|
||||
// wrapper container which contains the controls + panes
|
||||
container: null,
|
||||
|
||||
// control container - contains the tab names
|
||||
controlContainer: null,
|
||||
|
||||
// pane container - contains the tab panes
|
||||
paneContainer: null,
|
||||
|
||||
// array of tab objects
|
||||
tabs: [],
|
||||
|
||||
// current active tab
|
||||
selectedTabIndex: 0,
|
||||
|
||||
/**
|
||||
* @constructs
|
||||
* @param {String} cssClassname The class-name of the outer container
|
||||
*/
|
||||
initialize : function(cssClassname) {
|
||||
// create container
|
||||
this.container = new EJS.Dom.Element('div', {
|
||||
'class': 'EnlighterJSTabPane ' + cssClassname.toLowerCase() + 'EnlighterJSTabPane'
|
||||
});
|
||||
|
||||
// create container structure
|
||||
// <div class="EnlighterJSTabPane ...">
|
||||
// <div class="controls">
|
||||
// <ul> <li>Tab1</li> .... </ul>
|
||||
// </div>
|
||||
// <div class="pane">
|
||||
// <div>Enlighter Tab1</div>
|
||||
// <div>Enlighter Tab2</div>
|
||||
// </div>
|
||||
// </div>
|
||||
this.controlContainer = new EJS.Dom.Element('ul');
|
||||
this.paneContainer = new EJS.Dom.Element('div', {
|
||||
'class': 'pane'
|
||||
});
|
||||
var controlWrapper = new EJS.Dom.Element('div', {
|
||||
'class': 'controls'
|
||||
});
|
||||
controlWrapper.grab(this.controlContainer);
|
||||
|
||||
this.container.grab(controlWrapper);
|
||||
this.container.grab(this.paneContainer);
|
||||
},
|
||||
|
||||
selectTab: function(index){
|
||||
if (index < this.tabs.length){
|
||||
// hide current tab
|
||||
this.tabs[this.selectedTabIndex].pane.setStyle('display', 'none');
|
||||
this.tabs[this.selectedTabIndex].control.removeClass('selected');
|
||||
|
||||
// show selected tab
|
||||
this.tabs[index].pane.setStyle('display', 'block');
|
||||
this.tabs[index].control.addClass('selected');
|
||||
|
||||
// store selected index
|
||||
this.selectedTabIndex = index;
|
||||
}
|
||||
},
|
||||
|
||||
addTab: function(name){
|
||||
// create new control element
|
||||
var ctrl = new EJS.Dom.Element('li', {
|
||||
text: name
|
||||
});
|
||||
this.controlContainer.grab(ctrl);
|
||||
|
||||
// get new tab position
|
||||
var tabIndex = this.tabs.length;
|
||||
|
||||
// select event - display tab
|
||||
ctrl.addEvent('click', function(){
|
||||
this.selectTab(tabIndex);
|
||||
}.bind(this));
|
||||
|
||||
// create new tab element
|
||||
var tab = new EJS.Dom.Element('div', {
|
||||
'styles': {
|
||||
'display': 'none'
|
||||
}
|
||||
});
|
||||
this.paneContainer.grab(tab);
|
||||
|
||||
// store new tab
|
||||
this.tabs.push({
|
||||
control: ctrl,
|
||||
pane: tab
|
||||
});
|
||||
|
||||
// return created tab element
|
||||
return tab;
|
||||
},
|
||||
|
||||
getContainer: function(){
|
||||
return this.container;
|
||||
}
|
||||
|
||||
|
||||
});
|
94
EnlighterJS/Source/UI/Toolbar.js
Normal file
94
EnlighterJS/Source/UI/Toolbar.js
Normal file
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
---
|
||||
name: Toolbar
|
||||
description: Container which contains various buttons
|
||||
|
||||
license: MIT-style X11 License
|
||||
|
||||
authors:
|
||||
- Andi Dittrich
|
||||
|
||||
requires:
|
||||
- Core/1.4.5
|
||||
|
||||
provides: [EnlighterJS.UI.Toolbar]
|
||||
...
|
||||
*/
|
||||
EJS.UI.Toolbar = new Class({
|
||||
Implements: Options,
|
||||
|
||||
options: {
|
||||
toolbar: {
|
||||
rawTitle: 'Toggle RAW Code',
|
||||
windowTitle: 'Open Code in new Window',
|
||||
infoTitle: 'EnlighterJS Syntax Highlighter'
|
||||
}
|
||||
},
|
||||
|
||||
// toolbar container
|
||||
container: null,
|
||||
|
||||
initialize : function(enlighterInstance){
|
||||
// get options
|
||||
this.setOptions(enlighterInstance.options);
|
||||
|
||||
// create outer container
|
||||
this.container = new EJS.Dom.Element('div', {
|
||||
'class': 'EnlighterJSToolbar'
|
||||
});
|
||||
|
||||
// info button ?
|
||||
if (this.options.infoButton){
|
||||
// create window "button"
|
||||
this.container.grab(new EJS.Dom.Element('a', {
|
||||
'class': 'EnlighterJSInfoButton',
|
||||
title: this.options.toolbar.infoTitle,
|
||||
events: {
|
||||
// open new window on click
|
||||
click: function(){
|
||||
window.open('http://enlighterjs.andidittrich.de');
|
||||
}.bind(this)
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
// toggle button ?
|
||||
if (this.options.rawButton){
|
||||
// create toggle "button"
|
||||
this.container.grab(new EJS.Dom.Element('a', {
|
||||
'class': 'EnlighterJSRawButton',
|
||||
title: this.options.toolbar.rawTitle,
|
||||
events: {
|
||||
click: function(){
|
||||
// trigger toggle
|
||||
enlighterInstance.toggleRawCode();
|
||||
}.bind(this)
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
// code window button ?
|
||||
if (this.options.windowButton){
|
||||
// create window "button"
|
||||
this.container.grab(new EJS.Dom.Element('a', {
|
||||
'class': 'EnlighterJSWindowButton',
|
||||
title: this.options.toolbar.windowTitle,
|
||||
events: {
|
||||
// open new window on click
|
||||
click: function(){
|
||||
EJS.UI.CodeWindow(enlighterInstance.getRawCode(false));
|
||||
}.bind(this)
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
// clearfix
|
||||
this.container.grab(new EJS.Dom.Element('span', {
|
||||
'class': 'clear'
|
||||
}));
|
||||
},
|
||||
|
||||
toElement: function(){
|
||||
return this.container;
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue