Cleanup on PDoc templates.

This commit is contained in:
Andrew Dupont 2009-09-15 18:27:35 -05:00
parent 5ccf8cbefd
commit 19615e7a00
13 changed files with 1421 additions and 2372 deletions

View File

@ -1,332 +1,439 @@
if (typeof PDoc === "undefined") window.PDoc = {};
//= require <prototype>
// Poor-man's history manager. Polls for changes to the hash.
(function() {
var PREVIOUS_HASH = null;
Event.observe(window, "load", function() {
var hash = window.location.hash;
if (hash && hash !== PREVIOUS_HASH) {
document.fire("hash:changed",
{ previous: PREVIOUS_HASH, current: hash });
PREVIOUS_HASH = hash;
if (!Prototype || Prototype.Version.indexOf('1.6') !== 0) {
throw "This script requires Prototype >= 1.6.";
}
Object.isDate = function(object) {
return object instanceof Date;
};
/**
* class Cookie
* Creates a cookie.
**/
var Cookie = Class.create({
/**
* new Cookie(name, value[, expires])
*
* - name (String): The name of the cookie.
* - value (String): The value of the cookie.
* - expires (Number | Date): Exact date (or number of days from now) that
* the cookie will expire.
**/
initialize: function(name, value, expires) {
expires = expires || "";
if (Object.isNumber(expires)) {
var days = expires;
expires = new Date();
expires.setTime(expires.getTime() + (days * 24 * 60 * 60 * 1000));
}
window.setTimeout(arguments.callee, 100);
});
})();
if (Object.isDate(expires))
expires = expires.toGMTString();
// Place a "frame" around the element described by the hash.
// Update the frame when the hash changes.
PDoc.highlightSelected = function() {
if (!window.location.hash) return;
element = $(window.location.hash.substr(1));
if (element) PDoc.highlight(element.up('li, div'));
};
if (!Object.isUndefined(expires) && expires !== "")
expires = "; expires=" + expires;
this.name = name;
this.value = value;
this.expires = expires;
document.cookie = name + "=" + value + expires + "; path=/";
},
toString: function() {
return this.value;
},
inspect: function() {
return "#<Cookie #{name}:#{value}>".interpolate(this);
}
});
document.observe("hash:changed", PDoc.highlightSelected);
/**
* Cookie
**/
Object.extend(Cookie, {
/**
* Cookie.set(name, value, expires)
*
* Alias of [[Cookie#initialize]].
**/
set: function(name, value, expires) {
return new Cookie(name, value, expires);
},
/**
* Cookie.get(name)
*
* Returns the value of the cookie with the given name.
* - name (String): The name of the cookie to retrieve.
**/
get: function(name) {
var c = document.cookie.split(';');
for (var i = 0, cookie; i < c.length; i++) {
cookie = c[i].split('=');
if (cookie[0].strip() === name)
return cookie[1].strip();
}
return null;
},
/**
* Cookie.unset(name)
*
* Deletes a cookie.
* - name (String): The name of the cookie to delete.
*
**/
unset: function(name) {
return Cookie.set(name, "", -1);
}
});
PDoc.highlight = function(element) {
var self = arguments.callee;
if (!self.frame) {
self.frame = new Element('div', { 'class': 'highlighter' });
document.body.appendChild(self.frame);
Cookie.erase = Cookie.unset;
if (typeof PDoc === 'undefined') {
window.PDoc = {
Sidebar: {}
};
}
// HISTORY MANAGER (sort of)
// Polls for changes to the hash.
(function() {
var PREVIOUS_HASH = null;
function poll() {
var hash = window.location.hash;
if (hash && hash !== PREVIOUS_HASH) {
document.fire('hash:changed', {
previous: PREVIOUS_HASH, current: hash
});
}
PREVIOUS_HASH = hash;
window.setTimeout(arguments.callee, 100);
}
var frame = self.frame;
Event.observe(window, 'load', poll);
})();
Object.extend(PDoc, {
highlightSelected: function() {
if (!window.location.hash) return;
var element = $(window.location.hash.substr(1));
if (element) this.highlight(element.up('li, div'));
},
element.getOffsetParent().appendChild(frame);
highlight: function(element) {
var self = arguments.callee;
if (!self.frame) {
self.frame = new Element('div', { 'class': 'highlighter' });
document.body.appendChild(self.frame);
}
var frame = self.frame;
element.getOffsetParent().appendChild(frame);
var offset = element.positionedOffset();
var w = parseFloat(element.getStyle('width')),
h = parseFloat(element.getStyle('height'));
frame.setStyle({
position: 'absolute',
top: (offset.top - 15) + 'px',
left: (offset.left - 12) + 'px',
width: (w + 20) + 'px',
height: (h + 30) + 'px'
});
// Defer this call because Safari hasn't yet scrolled the viewport.
(function() {
var frameOffset = frame.viewportOffset(frame);
if (frameOffset.top < 0) {
$('page').scrollTop += (frameOffset.top - 10);
}
}).defer();
}
});
Object.extend(PDoc.Sidebar, {
getActiveTab: function() {
var activeTab = $('sidebar_tabs').down('.active');
if (!activeTab) return null;
var href = activeTab.readAttribute('href');
return href.endsWith('menu_pane') ? 'menu_pane' : 'search_pane';
},
var offset = element.positionedOffset();
var w = parseFloat(element.getStyle('width')),
h = parseFloat(element.getStyle('height'));
frame.setStyle({
position: 'absolute',
top: (offset.top - 15) + 'px',
left: (offset.left - 12) + 'px',
width: (w + 20) + 'px',
height: (h + 30) + 'px'
});
// Remember the state of the sidebar so it can be restored on the next page.
serialize: function() {
var state = $H({
activeTab: PDoc.Sidebar.getActiveTab(),
menuScrollOffset: $('menu_pane').scrollTop,
searchScrollOffset: $('search_results').scrollTop,
searchValue: $('search').getValue()
});
return escape(state.toJSON());
},
// Defer this call because Safari hasn't yet scrolled the viewport.
(function() {
var frameOffset = frame.viewportOffset(frame);
if (frameOffset.top < 0) {
window.scrollBy(0, frameOffset.top - 10);
}
}).defer();
};
// Restore the tree to a certain point based on a cookie.
restore: function(state) {
try {
state = unescape(state).evalJSON();
var filterer = $('search').retrieve('filterer');
filterer.setSearchValue(state.searchValue);
(function() {
$('menu_pane').scrollTop = state.menuScrollOffset;
$('search_results').scrollTop = state.searchScrollOffset;
}).defer();
} catch(error) {
console.log(error);
if (!(error instanceof SyntaxError)) throw error;
}
}
});
// Live API search.
var Filterer = Class.create({
PDoc.Sidebar.Filterer = Class.create({
initialize: function(element, options) {
this.element = $(element);
this.options = Object.extend({
interval: 0.1,
resultsElement: '.search-results'
}, options || {});
this.options = Object.extend(
Object.clone(PDoc.Sidebar.Filterer.DEFAULT_OPTIONS),
options || {}
);
this.element.writeAttribute("autocomplete", "off");
// The browser's "helpful" auto-complete gets in the way.
this.element.writeAttribute("autocomplete", "off");
this.element.setValue('');
// Hitting "enter" should do nothing.
this.element.up('form').observe("submit", Event.stop);
// // The Safari-only "search" input type is prettier
// if (Prototype.Browser.WebKit)
// this.element.type = "search";
this.menu = this.options.menu;
this.menu = this.options.menu;
this.links = this.menu.select('a');
this.resultsElement = this.options.resultsElement;
this.resultsElement.setStyle({
overflowX: 'hidden'
});
this.events = {
filter: this.filter.bind(this),
keydown: this.keydown.bind(this)
this.observers = {
filter: this.filter.bind(this),
keydown: this.keydown.bind(this),
keyup: this.keyup.bind(this)
};
this.menu.setStyle({ opacity: 0.9 });
this.addObservers();
this.element.value = '';
this.addObservers();
},
addObservers: function() {
this.element.observe('keyup', this.events.filter);
this.element.observe('keyup', this.observers.filter);
},
// Called whenever the list of results needs to update as a result of a
// changed search key.
filter: function(event) {
if (this._timer) window.clearTimeout(this._timer);
// Clear the text box on ESC
// Clear the text box on ESC.
if (event.keyCode && event.keyCode === Event.KEY_ESC) {
this.element.value = '';
this.element.setValue('');
}
if ([Event.KEY_UP, Event.KEY_DOWN, Event.KEY_RETURN].include(event.keyCode))
if (PDoc.Sidebar.Filterer.INTERCEPT_KEYS.include(event.keyCode))
return;
// If there's nothing in the text box, clear the results list.
var value = $F(this.element).strip().toLowerCase();
if (value === "") {
this.onEmpty();
if (value === '') {
this.emptyResults();
this.hideResults();
return;
}
var urls = this.findURLs(value);
var urls = this.findURLs(value);
this.buildResults(urls);
},
keydown: function(event) {
if (![Event.KEY_UP, Event.KEY_DOWN, Event.KEY_RETURN].include(event.keyCode))
setSearchValue: function(value) {
this.element.setValue(value);
if (value.strip() === "") {
PDoc.Sidebar.Tabs.setActiveTab(0);
return;
// ignore if any modifier keys are present
if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey)
return;
event.stop();
var highlighted = this.resultsElement.down('.highlighted');
if (event.keyCode === Event.KEY_RETURN) {
// Follow the highlighted item.
if (!highlighted) return;
window.location.href = highlighted.down('a').href;
} else {
var direction = (Event.KEY_DOWN === event.keyCode) ? 1 : -1;
highlighted = this.moveHighlight(direction);
}
if ([Event.KEY_UP, Event.KEY_DOWN].include(event.keyCode) &&
!Prototype.Browser.WebKit) {
// If up/down key is held down, list should keep scrolling.
// Safari does this automatically because it fires the keydown
// event over and over.
this._timer = window.setTimeout(this.scrollList.bind(this, direction), 1000);
}
this.buildResults(this.findURLs(value));
},
moveHighlight: function(direction) {
var highlighted = this.resultsElement.down('.highlighted');
// move the focus
if (!highlighted) {
// if there is none, highlight the first result
var highlighted = this.resultsElement.down('li').addClassName('highlighted');
} else {
var method = (direction === 1) ? 'next' : 'previous';
highlighted.removeClassName('highlighted');
var adjacent = highlighted[method]('li');
if (!adjacent) {
adjacent = method == 'next' ? this.resultsElement.down('li') :
this.resultsElement.down('li:last-of-type');
}
adjacent.addClassName('highlighted');
highlighted = adjacent;
// Given a key, finds all the PDoc objects that match.
findURLs: function(str) {
var results = [];
for (var name in PDoc.elements) {
if (name.toLowerCase().include(str.toLowerCase()))
results.push(PDoc.elements[name]);
}
// Adjust the scroll offset of the container so that the highlighted
// item is always in view.
var distanceToBottom = highlighted.offsetTop + highlighted.offsetHeight;
if (distanceToBottom > this.resultsElement.offsetHeight + this.resultsElement.scrollTop) {
// item is too low
this.resultsElement.scrollTop = distanceToBottom - this.resultsElement.offsetHeight;
} else if (highlighted.offsetTop < this.resultsElement.scrollTop) {
// item is too high
this.resultsElement.scrollTop = highlighted.offsetTop;
}
return highlighted;
return results;
},
scrollList: function(direction) {
this.moveHighlight(direction);
this._timer = window.setTimeout(this.scrollList.bind(this, direction), 100);
buildResults: function(results) {
this.emptyResults();
results.each( function(result) {
var li = this._buildResult(result);
this.resultsElement.appendChild(li);
}, this);
this.showResults();
},
_buildResult: function(obj) {
var li = new Element('li', { 'class': 'menu-item' });
var a = new Element('a', {
'class': obj.type.gsub(/\s/, '_'),
'href': PDoc.pathPrefix + this._fixPath(obj.path)
}).update(obj.name);
li.appendChild(a);
return li;
},
emptyResults: function() {
this.resultsElement.update();
},
hideResults: function() {
PDoc.Sidebar.Tabs.setActiveTab(0);
//this.resultsElement.hide();
document.stopObserving('keydown', this.observers.keydown);
document.stopObserving('keyup', this.observers.keyup);
},
showResults: function() {
PDoc.Sidebar.Tabs.setActiveTab(1);
//this.resultsElement.show();
document.stopObserving('keydown', this.observers.keydown);
this.element.stopObserving('keyup', this.observers.keyup);
this.element.observe('keydown', this.observers.keydown);
document.observe('keyup', this.observers.keyup);
},
// Given a path with any number of `../`s in front of it, remove them all.
// TODO: Fix this a better way.
_fixPath: function(path) {
return path.replace('../', '');
},
},
buildResults: function(urls) {
this.resultsElement.update();
var ul = this.resultsElement;
urls.each( function(url) {
var a = new Element('a', {
'class': url.type.gsub(/\s/, '_'),
href: PDoc.pathPrefix + this._fixPath(url.path)
}).update(url.name);
var li = new Element('li', { 'class': 'menu-item' });
li.appendChild(a);
ul.appendChild(li);
}, this);
this.showResults();
},
findURLs: function(str) {
var results = [];
for (var i in PDoc.elements) {
if (i.toLowerCase().include(str)) results.push(PDoc.elements[i]);
keydown: function(event) {
if (!PDoc.Sidebar.Filterer.INTERCEPT_KEYS.include(event.keyCode))
return;
// Also ignore if any modifier keys are present.
if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey)
return;
event.stop();
if (event.keyCode === Event.KEY_RETURN) {
// Follow the highlighted item, unless there is none.
if (!this.highlighted) return;
var a = this.highlighted.down('a');
if (a) {
window.location.href = a.href;
}
} else if ([Event.KEY_UP, Event.KEY_DOWN].include(event.keyCode)) {
// Is an arrow key.
var direction = (Event.KEY_DOWN === event.keyCode) ? 1 : -1;
this.highlighted = this.moveHighlight(direction);
if (!Prototype.Browser.WebKit) {
// If up/down key is held down, list should keep scrolling.
// WebKit does this automatically because it fires the keydown
// event over and over.
this._scrollTimer = window.setTimeout(
this.scrollList.bind(this, direction), 1000);
}
}
return results;
},
onEmpty: function() {
this.hideResults();
},
showResults: function() {
this.resultsElement.show();
document.stopObserving("keydown", this.events.keydown);
document.observe("keydown", this.events.keydown);
},
hideResults: function() {
this.resultsElement.hide();
document.stopObserving("keydown", this.events.keydown);
}
});
document.observe('dom:loaded', function() {
new Filterer($('search'), {
menu: $('api_menu'),
resultsElement: $('search_results')
});
});
Event.observe(window, 'load', function() {
var menu = $('menu');
var OFFSET = menu.viewportOffset().top;
Event.observe(window, 'scroll', function() {
var sOffset = document.viewport.getScrollOffsets();
if (sOffset.top > OFFSET) {
menu.addClassName('fixed');
} else menu.removeClassName('fixed');
});
});
(function() {
function menuButtonMouseOver(event) {
var menuButton = $('api_menu_button');
var target = event.element();
if (target === menuButton || target.descendantOf(menuButton)) {
$('api_menu').show();
keyup: function(event) {
if (this._scrollTimer) {
window.clearTimeout(this._scrollTimer);
}
}
},
function menuButtonMouseOut(event) {
var menuButton = $('api_menu_button');
var menu = $('api_menu');
var target = event.element(), related = event.relatedTarget || event.toElement;
if (related && (related === menu || related.descendantOf(menu))) return;
menu.hide();
}
function menuMouseOut(event) {
var menu = $('api_menu'), related = event.relatedTarget || event.toElement;
if (related && !related.descendantOf(menu)) {
arguments.callee.timer = Element.hide.delay(0.5, menu);
moveHighlight: function(direction) {
if (!this.highlighted) {
// If there is none, highlight the first result.
this.highlighted =
this.resultsElement.down('li').addClassName('highlighted');
} else {
window.clearTimeout(arguments.callee.timer);
var method = (direction === 1) ? 'next' : 'previous';
this.highlighted.removeClassName('highlighted');
var adjacent = this.highlighted[method]('li');
// If there isn't an adjacent one, we're at the top or bottom
// of the list. Flip it.
if (!adjacent) {
adjacent = method == 'next' ? this.resultsElement.down('li') :
this.resultsElement.down('li:last-of-type');
}
adjacent.addClassName('highlighted');
this.highlighted = adjacent;
}
}
function menuItemMouseOver(event) {
var element = event.element();
if (element.tagName.toLowerCase() === 'a') {
element.addClassName('highlighted');
}
}
function menuItemMouseOut(event) {
var element = event.element();
if (element.tagName.toLowerCase() === 'a') {
element.removeClassName('highlighted');
}
}
var MENU_ITEMS;
document.observe('dom:loaded', function() {
MENU_ITEMS = $$('.api-box .menu-item a');
$('api_menu_button').observe('mouseenter', menuButtonMouseOver);
$('api_menu_button').observe('mouseleave', menuButtonMouseOut );
var h = this.highlighted, r = this.resultsElement;
$('api_menu').observe('mouseleave', menuMouseOut);
if (Prototype.Browser.IE) {
$('api_menu').observe('mouseover', menuItemMouseOver);
$('api_menu').observe('mouseout', menuItemMouseOut);
var distanceToBottom = h.offsetTop + h.offsetHeight;
if (distanceToBottom > (r.offsetHeight + r.scrollTop)) {
// Item is below the visible frame.
r.scrollTop = distanceToBottom - r.offsetHeight;
} else if (h.offsetTop < r.scrollTop) {
// Item is above the visible frame.
r.scrollTop = h.offsetTop;
}
});
})();
return this.highlighted;
},
scrollList: function(direction) {
this.moveHighlight(direction);
this._scrollTimer = window.setTimeout(
this.scrollList.bind(this, direction), 100);
}
});
Object.extend(PDoc.Sidebar.Filterer, {
INTERCEPT_KEYS: [Event.KEY_UP, Event.KEY_DOWN, Event.KEY_RETURN],
DEFAULT_OPTIONS: {
interval: 0.1,
resultsElement: '.search-results'
}
});
Form.GhostedField = Class.create({
initialize: function(element, title, options) {
options = options || {};
this.element = $(element);
this.title = title;
options = options || {};
this.isGhosted = true;
if (options.cloak) {
// Wrap the native getValue function so that it never returns the
// ghosted value. This is optional because it presumes the ghosted
// value isn't valid input for the field.
this.element.getValue = this.element.getValue.wrap(this.wrappedGetValue.bind(this));
}
}
this.addObservers();
this.onBlur();
},
@ -384,6 +491,35 @@ Form.GhostedField = Class.create({
}
});
document.observe("dom:loaded", function() {
new Form.GhostedField($('search'), "Search");
document.observe('hash:changed', PDoc.highlightSelected.bind(PDoc));
document.observe('dom:loaded', function() {
PDoc.Sidebar.Tabs = new Control.Tabs($('sidebar_tabs'));
var searchField = $('search');
if (searchField) {
var filterer = new PDoc.Sidebar.Filterer(searchField, {
menu: $('api_menu'),
resultsElement: $('search_results')
});
searchField.store('filterer', filterer);
}
// Prevent horizontal scrolling in scrollable sidebar areas.
$$('.scrollable').invoke('observe', 'scroll', function() {
this.scrollLeft = 0;
});
var sidebarState = Cookie.get('sidebar_state');
if (sidebarState) {
PDoc.Sidebar.restore(sidebarState);
}
new Form.GhostedField(searchField, searchField.getAttribute('title'),
{ cloak: true });
});
Event.observe(window, 'unload', function() {
Cookie.set('sidebar_state', PDoc.Sidebar.serialize());
});

View File

@ -1,251 +0,0 @@
/* Unobtrustive Code Highlighter By Dan Webb 11/2005
Version: 0.4
Usage:
Add a script tag for this script and any stylesets you need to use
to the page in question, add correct class names to CODE elements,
define CSS styles for elements. That's it!
Known to work on:
IE 5.5+ PC
Firefox/Mozilla PC/Mac
Opera 7.23 + PC
Safari 2
Known to degrade gracefully on:
IE5.0 PC
Note: IE5.0 fails due to the use of lookahead in some stylesets. To avoid script errors
in older browsers use expressions that use lookahead in string format when defining stylesets.
This script is inspired by star-light by entirely cunning Dean Edwards
http://dean.edwards.name/star-light/.
*/
// replace callback support for safari.
if ("a".replace(/a/, function() {return "b"}) != "b") (function(){
var default_replace = String.prototype.replace;
String.prototype.replace = function(search,replace){
// replace is not function
if(typeof replace != "function"){
return default_replace.apply(this,arguments)
}
var str = "" + this;
var callback = replace;
// search string is not RegExp
if(!(search instanceof RegExp)){
var idx = str.indexOf(search);
return (
idx == -1 ? str :
default_replace.apply(str,[search,callback(search, idx, str)])
)
}
var reg = search;
var result = [];
var lastidx = reg.lastIndex;
var re;
while((re = reg.exec(str)) != null){
var idx = re.index;
var args = re.concat(idx, str);
result.push(
str.slice(lastidx,idx),
callback.apply(null,args).toString()
);
if(!reg.global){
lastidx += RegExp.lastMatch.length;
break
}else{
lastidx = reg.lastIndex;
}
}
result.push(str.slice(lastidx));
return result.join("")
}
})();
var CodeHighlighter = { styleSets : new Array };
CodeHighlighter.addStyle = function(name, rules) {
// using push test to disallow older browsers from adding styleSets
if ([].push) this.styleSets.push({
name : name,
rules : rules,
ignoreCase : arguments[2] || false
})
function setEvent() {
// set highlighter to run on load (use LowPro if present)
if (typeof Event != 'undefined' && typeof Event.onReady == 'function')
return Event.onReady(CodeHighlighter.init.bind(CodeHighlighter));
var old = window.onload;
if (typeof window.onload != 'function') {
window.onload = function() { CodeHighlighter.init() };
} else {
window.onload = function() {
old();
CodeHighlighter.init();
}
}
}
// only set the event when the first style is added
if (this.styleSets.length==1) setEvent();
}
CodeHighlighter.init = function() {
if (!document.getElementsByTagName) return;
if ("a".replace(/a/, function() {return "b"}) != "b") return; // throw out Safari versions that don't support replace function
// throw out older browsers
var codeEls = document.getElementsByTagName("CODE");
// collect array of all pre elements
codeEls.filter = function(f) {
var a = new Array;
for (var i = 0; i < this.length; i++) if (f(this[i])) a[a.length] = this[i];
return a;
}
var rules = new Array;
rules.toString = function() {
// joins regexes into one big parallel regex
var exps = new Array;
for (var i = 0; i < this.length; i++) exps.push(this[i].exp);
return exps.join("|");
}
function addRule(className, rule) {
// add a replace rule
var exp = (typeof rule.exp != "string")?String(rule.exp).substr(1, String(rule.exp).length-2):rule.exp;
// converts regex rules to strings and chops of the slashes
rules.push({
className : className,
exp : "(" + exp + ")",
length : (exp.match(/(^|[^\\])\([^?]/g) || "").length + 1, // number of subexps in rule
replacement : rule.replacement || null
});
}
function parse(text, ignoreCase) {
// main text parsing and replacement
return text.replace(new RegExp(rules, (ignoreCase)?"gi":"g"), function() {
var i = 0, j = 1, rule;
while (rule = rules[i++]) {
if (arguments[j]) {
// if no custom replacement defined do the simple replacement
if (!rule.replacement) return "<span class=\"" + rule.className + "\">" + arguments[0] + "</span>";
else {
// replace $0 with the className then do normal replaces
var str = rule.replacement.replace("$0", rule.className);
for (var k = 1; k <= rule.length - 1; k++) str = str.replace("$" + k, arguments[j + k]);
return str;
}
} else j+= rule.length;
}
});
}
function highlightCode(styleSet) {
// clear rules array
var parsed;
rules.length = 0;
// get stylable elements by filtering out all code elements without the correct className
var stylableEls = codeEls.filter(function(item) {return (item.className.indexOf(styleSet.name)>=0)});
// add style rules to parser
for (var className in styleSet.rules) addRule(className, styleSet.rules[className]);
// replace for all elements
for (var i = 0; i < stylableEls.length; i++) {
// EVIL hack to fix IE whitespace badness if it's inside a <pre>
if (/MSIE/.test(navigator.appVersion) && stylableEls[i].parentNode.nodeName == 'PRE') {
stylableEls[i] = stylableEls[i].parentNode;
parsed = stylableEls[i].innerHTML.replace(/(<code[^>]*>)([^<]*)<\/code>/i, function() {
return arguments[1] + parse(arguments[2], styleSet.ignoreCase) + "</code>"
});
parsed = parsed.replace(/\n( *)/g, function() {
var spaces = "";
for (var i = 0; i < arguments[1].length; i++) spaces+= "&nbsp;";
return "\n" + spaces;
});
parsed = parsed.replace(/\t/g, "&nbsp;&nbsp;&nbsp;&nbsp;");
parsed = parsed.replace(/\n(<\/\w+>)?/g, "<br />$1").replace(/<br \/>[\n\r\s]*<br \/>/g, "<p><br></p>");
} else parsed = parse(stylableEls[i].innerHTML, styleSet.ignoreCase);
stylableEls[i].innerHTML = parsed;
}
}
// run highlighter on all stylesets
for (var i=0; i < this.styleSets.length; i++) {
highlightCode(this.styleSets[i]);
}
};
CodeHighlighter.addStyle("css", {
comment : {
exp : /\/\*[^*]*\*+([^\/][^*]*\*+)*\//
},
keywords : {
exp : /@\w[\w\s]*/
},
selectors : {
exp : "([\\w-:\\[.#][^{};>]*)(?={)"
},
properties : {
exp : "([\\w-]+)(?=\\s*:)"
},
units : {
exp : /([0-9])(em|en|px|%|pt)\b/,
replacement : "$1<span class=\"$0\">$2</span>"
},
urls : {
exp : /url\([^\)]*\)/
}
});
CodeHighlighter.addStyle("html", {
comment : {
exp: /&lt;!\s*(--([^-]|[\r\n]|-[^-])*--\s*)&gt;/
},
tag : {
exp: /(&lt;\/?)([a-zA-Z]+\s?)/,
replacement: "$1<span class=\"$0\">$2</span>"
},
string : {
exp : /'[^']*'|"[^"]*"/
},
attribute : {
exp: /\b([a-zA-Z-:]+)(=)/,
replacement: "<span class=\"$0\">$1</span>$2"
},
doctype : {
exp: /&lt;!DOCTYPE([^&]|&[^g]|&g[^t])*&gt;/
}
});
CodeHighlighter.addStyle("javascript",{
comment : {
exp : /(\/\/[^\n]*(\n|$))|(\/\*[^*]*\*+([^\/][^*]*\*+)*\/)/
},
brackets : {
exp : /\(|\)/
},
regex : {
exp : /\/(.*?)[g|s|m]?\/[;|\n]/
},
string : {
exp : /'(?:\.|(\\\')|[^\''])*'|"(?:\.|(\\\")|[^\""])*"/
},
keywords : {
exp : /\b(arguments|break|case|continue|default|delete|do|else|false|for|function|if|in|instanceof|new|null|return|switch|this|true|typeof|var|void|while|with)\b/
},
global : {
exp : /\b(toString|valueOf|window|element|prototype|constructor|document|escape|unescape|parseInt|parseFloat|setTimeout|clearTimeout|setInterval|clearInterval|NaN|isNaN|Infinity|alert|prompt|confirm)\b/
}
});

File diff suppressed because it is too large Load Diff

View File

@ -1,98 +1,123 @@
/*
* API STYLES
*/
/* The "section" class implicitly needs a clearfix; adding it here for convenience. */
.clearfix:after,
.section:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
.clearfix, .section {
display: inline-block;
}
html[xmlns] .clearfix,
html[xmlns] .section {
display: block;
}
* html .clearfix,
* html .section {
height: 1%;
}
span.replaced { visibility: hidden; }
span.hidden { display: none; }
/* tag styles */
pre {
body {
font-family: Verdana, sans-serif;
font-size: 82.5%;
line-height: 1.5em;
margin: 0;
padding: 0;
}
body * {
margin: 0;
padding: 0;
}
h1, h2, h3, h4, h5, h6 {
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
}
pre {
white-space: pre-wrap; /* CSS 3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}
a img {
border: 0;
}
ul, li {
list-style-type: none;
}
ol, ul {
margin: 0 0 15px;
}
code {
font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", monospace;
font-family: "Panic Sans", "Bitstream Vera Sans Mono", Monaco, Consolas, Andale Mono, monospace;
font-size: 12px;
}
/* masthead */
div#masthead {
background: url(../images/header-stripe-small.png) repeat-x top left;
height: 76px;
#page a.img,
#page a.img:link,
#page a.img:visited {
border: 0;
}
div#masthead div#masthead_content {
margin: 0 auto;
width: 835px;
position: relative;
}
div#masthead h1#logo {
background: url(../images/header-logo-small.png) no-repeat 0 1px;
width: 118px;
height: 76px;
position: relative;
left: 60px;
}
/* footer */
div#footer {
width: 960px;
.content {
padding-left: 120px;
margin: 0 auto;
}
div.about {
margin-top: 20px;
padding-top: 20px;
width: 835px;
margin-left: 120px;
border-top: 1px solid #aaa;
color: #aaa;
}
div.about a,
div.about a:link {
color: #aaa;
text-decoration: underline;
border: 0;
}
div.copyright,
div.credits {
width: 360px;
float: left;
}
div.copyright .cc {
width: 115px;
margin-right: 5px;
text-align: center;
float: left;
}
div.copyright .copyright-about {
width: 235px;
float: left;
}
div.credits {
margin-left: 115px;
}
.page-title span.type {
display: block;
text-transform: uppercase;
font-size: 14px;
color: #aaa;
letter-spacing: 0;
#page {
margin: 0;
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 241px;
overflow-y: scroll;
overflow-x: auto;
}
h2.page-title {
margin-top: 0;
line-height: 100%;
/* MASTHEAD */
.masthead {
margin-top: 50px;
height: 75px;
padding: 1px 0;
background: url(../images/header-stripe-small.png) repeat-x;
}
h1.logo {
width: 236px;
height: 150px;
background: url(../images/header-logo-small.png) no-repeat;
}
h1.logo a {
text-decoration: none;
}
/* BREADCRUMBS */
ul.breadcrumbs {
margin-left: 120px;
padding-left: 120px;
list-style-type: none;
}
ul.breadcrumbs li {
@ -101,114 +126,248 @@ ul.breadcrumbs {
margin-right: 10px;
margin-left: 0;
}
/* PAGE CONTENT */
.page-content {
width: 715px;
margin: 30px 0 0;
}
.page-content h2.page-title {
margin: 0 0 15px 120px;
line-height: 100%;
font-size: 27px;
letter-spacing: -1px;
color: #444;
}
.page-introduction {
margin-left: 120px;
margin-bottom: 25px;
}
.page-content a,
.page-content a:link {
color: #036;
border-bottom: 1px solid #036;
text-decoration: none;
}
.page-content a:visited {
border-bottom: 1px solid #bbb;
}
.page-content ul,
.page-content ol {
margin: 10px 0;
}
.page-content li {
margin: 5px 0 8px 20px;
list-style-type: disc;
}
.page-content p {
margin: 0 0 0.8em;
}
.page-content code {
background-color: #f0f0f0;
border: 1px solid #ccc;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
padding: 0 3px;
}
.page-content pre {
color: #333;
background-color: #f0f0ff;
border: 1px solid #dde;
padding: 3px 5px;
margin: 0 0 1em;
}
.page-content pre code {
background-color: transparent;
border: 0;
padding: 0;
line-height: 100%;
}
.page-content code {
}
.page-content h1 {
font-size: 27px;
color: #000;
margin: 1.0em 0 0.6em;
}
.page-content h2 {
font-size: 23px;
color: #000;
margin: 1.0em 0 0.6em;
}
.page-content h3 {
font-size: 20px;
color: #000;
margin: 1.0em 0 0.6em;
}
.page-content h4 {
font-size: 17px;
color: #555;
margin: 1.0em 0 0.6em;
}
.page-content h5 {
font-size: 15px;
color: #2a2a2a;
margin: 1.0em 0 0.6em;
}
.page-content h6 {
font-size: 14px;
color: #000;
margin: 1.0em 0 0.6em;
}
/* PAGE SECTIONS */
.section {
margin: 10px 0 15px;
}
.section-title {
width: 110px;
float: left;
margin-right: 10px;
padding-right: 0;
text-align: right;
overflow: hidden;
}
.section-title h3 {
color: #999;
font-size: 14px;
line-height: 110%;
margin-top: 3px;
padding-right: 10px;
padding-bottom: 5px;
}
.section-content {
width: 595px;
float: left;
}
/* API STYLES */
.page-title .type {
display: block;
text-transform: uppercase;
font-size: 14px;
color: #aaa;
}
ul.section-list {
list-style-type: none;
margin-top: 0;
}
ul.section-list li {
list-style-type: none;
margin: 0 0 15px;
}
ul.section-list li h4 {
margin-top: 0;
}
ul.method-list {
margin-top: 0;
}
ul.method-list li {
margin-top: 0;
float: left;
margin-right: 5px;
margin-left: 0;
list-style-type: none;
}
ul.method-list li {
float: left;
margin: 0 5px 3px 0;
list-style-type: none;
padding-bottom: 0;
}
ul.method-list li a,
ul.method-list li a:link {
text-decoration: none;
border: 0;
}
ul.method-details-list {
margin-top: 0;
}
ul.method-details-list li.method-description {
margin-top: 0;
margin-bottom: 3.0em;
margin-left: 0;
li.method-description {
margin: 0 0 2.0em;
list-style-type: none;
}
ul.method-details-list li h4 {
.method-description h4 {
margin: 0 0 0.6em;
line-height: 90%;
}
.method-description p {
margin: 0.8em 0;
}
ul.method-details-list li pre {
margin-top: 0;
}
ul.method-details-list li pre code {
font-size: 13px;
}
ul.method-details-list li code {
font-size: 12px;
}
h4.inherited {
padding-top: 5px;
clear: left;
font-style: italic;
font-weight: bold;
font-size: 14px;
}
.method-description h4 .method-permalink a {
.method-description .method-permalink a {
color: #aaa;
text-decoration: none;
border: 0;
border-bottom: 0;
font-size: 14px;
}
h4.inherited {
clear: left;
font-size: 15px;
font-style: italic;
}
pre.syntax {
margin-bottom: 5px;
}
ul.argument-list {
margin-top: -5px;
list-style-type: disc;
margin-left: 20px;
font-size: 12px;
padding: 0;
margin: 0;
}
ul.argument-list li {
list-style-type: disc;
font-size: 90%;
margin-bottom: 0;
line-height: 140%;
margin-top: 0px;
margin-bottom: 5px;
}
ul.argument-list li code {
font-size: 11px;
}
ul.section-list {
margin-top: 0;
}
ul.section-list li {
margin-top: 0;
margin-left: 0;
list-style-type: none;
}
ul.section-list li h4 {
margin-top: 0;
ul.argument-list .argument-name {
background-color: #eeffee;
border-color: #6b6;
}
/* Aliases */
.alias,
.related-to {
font-style: italic;
}
.alias code,
.related-to code {
font-style: normal;
}
/* Section icons */
/* SECTION ICONS */
.page-content .section .section-title h3 {
padding-right: 24px;
@ -272,187 +431,6 @@ ul.section-list {
background-image: url(../images/superclass.png);
}
/* search box */
.search-results {
position: absolute;
background-color: #fff;
height: 200px;
width: 233px;
overflow: auto;
overflow-y: scroll;
overflow-x: hidden;
margin: 7px -11px 0;
border: 1px solid #999;
top: 28px;
}
* html .search-results {
left: 486px;
top: 30px;
}
/* search result types */
.menu-item a,
.menu-item a:link {
display: block;
padding: 3px 10px 3px 28px;
background-position: 6px 50%;
background-repeat: no-repeat;
text-align: left;
text-decoration: none;
color: #333;
border-top: 1px solid #fff;
border-bottom: 1px solid #fff;
white-space: nowrap;
}
.menu-item a:hover,
.menu-item a.highlighted,
#menu .highlighted a {
border-top: 1px solid #69f;
border-bottom: 1px solid #69f;
background-color: #f0f0ff;
}
.menu-item a.section {
font-weight: bold;
background-image: url(../images/section.png);
}
.menu-item a.class_method,
.menu-item a.instance_method {
background-image: url(../images/method.png);
}
.menu-item a.class {
background-image: url(../images/class.png);
}
.menu-item a.constructor {
background-image: url(../images/constructor.png);
}
.menu-item a.class_property {
background-image: url(../images/class_property.png);
}
.menu-item a.instance_property {
background-image: url(../images/instance_property.png);
}
.menu-item a.namespace {
background-image: url(../images/namespace.png);
}
.menu-item a.utility {
background-image: url(../images/utility.png);
}
/* halo around selected method */
.highlighter {
border: 3px solid #69f;
z-index: -1;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
}
/* MENU */
div#menu {
width: 960px;
margin: 0 auto;
position: relative;
}
#menu .api-box h2 a,
#menu .search-box {
width: 213px;
height: 25px;
line-height: 25px;
padding: 5px 10px;
margin-right: 5px;
text-align: center;
float: right;
}
* html #menu .api-box h2 a,
* html #menu .search-box {
height: 30px;
line-height: 30px;
}
#menu .api-box {
}
#menu .api-box h2 a {
font-size: 14px;
font-weight: normal;
font-family: Verdana, sans-serif;
display: block;
background-color: #cde0fb;
border: 1px solid #669;
border-top: 0;
text-decoration: none;
color: #222;
}
#menu .api-box .menu-items {
position: absolute;
background-color: #fff;
height: 200px;
width: 233px;
overflow: auto;
overflow-y: scroll;
overflow-x: hidden;
top: 35px;
border: 1px solid #999;
right: 5px;
}
* html #menu .api-box .menu-items {
right: 10px;
top: 37px;
}
#menu .api-box ul,
#menu .api-box li {
margin: 0;
padding: 0;
}
#menu .api-box .menu-item a {
}
#menu .search-box {
background-color: #cee8c3;
border: 1px solid #696;
border-top: 0;
}
#menu .search-box input {
width: 150px;
padding: 3px 10px;
margin-top: 2px;
border: 1px solid #999;
border-radius: 10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
}
#menu #search.ghosted {
color: #aaa;
text-align: left;
}
/* notes */
p.note,
@ -460,7 +438,7 @@ p.alias,
p.related-to {
font-size: 11px;
line-height: 14px;
padding: 5px 5px 5px 60px;
padding: 5px 20px 5px 60px;
background-repeat: no-repeat;
background-position: 20px 50%;
border: 1px solid #000;
@ -484,4 +462,233 @@ p.related-to {
border-color: #c9c;
}
/* halo around selected method */
.highlighter {
border: 3px solid #69f;
z-index: -1;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
}
/* SIDEBAR */
#sidebar {
position: fixed;
top: 0;
bottom: 0;
left: 0;
width: 240px;
background: #fff;
font-size: 13px;
}
#sidebar form.search-ribbon {
margin: 0;
height: 24px;
border-right: 1px solid #636363;
padding: 4px 0 3px;
border-bottom: 1px solid #587e93;
background: url(../images/search-background.png) repeat-x 0 0;
text-align: center;
}
/* Keep these around for `Control.Tabs`. */
.sidebar-tabs { display: none; }
.menu-items ul {
margin: 0;
}
.menu-items ul li {
list-style-type: none;
padding-left: 0;
margin-left: 0;
}
.menu-items ul .menu-item a {
padding-left: 38px;
background-position: 16px 50%;
}
.menu-items ul ul .menu-item a {
padding-left: 48px;
background-position: 26px 50%;
}
.menu-items ul ul ul .menu-item a {
padding-left: 58px;
background-position: 36px 50%;
}
.menu-items ul ul ul ul .menu-item a {
padding-left: 68px;
background-position: 46px 50%;
}
.menu-item a,
.menu-item a:link {
display: block;
padding: 3px 10px 3px 28px;
background-position: 6px 50%;
background-repeat: no-repeat;
text-align: left;
text-decoration: none;
color: #333;
border-top: 1px solid #fff;
border-bottom: 1px solid #fff;
white-space: nowrap;
}
.menu-item a:hover,
.menu-item a.highlighted,
#sidebar .highlighted a {
border-top: 1px solid #69f;
border-bottom: 1px solid #69f;
background-color: #f0f0ff;
}
.menu-item a.class_method,
.menu-item a.instance_method {
background-image: url(../images/method.png);
}
.menu-item a.class {
background-image: url(../images/class.png);
}
.menu-item a.constructor {
background-image: url(../images/constructor.png);
}
.menu-item a.class_property {
background-image: url(../images/class_property.png);
}
.menu-item a.instance_property {
background-image: url(../images/instance_property.png);
}
.menu-item a.namespace {
background-image: url(../images/namespace.png);
}
.menu-item a.mixin {
background-image: url(../images/mixin.png);
}
.menu-item a.utility {
background-image: url(../images/utility.png);
}
.menu-item a.section {
margin: 0;
background-image: url(../images/section.png);
}
#api_menu .menu-item a.section {
height: 22px;
font-weight: normal;
color: #a5a5a5;
margin-top: 0;
margin-bottom: 0;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
background: url(../images/section-background.png) repeat-x 0 0;
}
.menu-section {
margin-bottom: 1.0em;
}
#menu_pane {
position: absolute;
top: 32px;
bottom: 0;
left: 0;
width: 239px;
border-right: 1px solid #636363;
overflow-y: scroll;
overflow-x: hidden;
}
#search_pane {
width: 239px;
border-right: 1px solid #636363;
position: absolute;
top: 32px;
bottom: 0;
left: 0;
}
#search_results {
margin: 0;
padding: 0;
overflow-y: scroll;
overflow-x: hidden;
position: absolute;
top: 0;
bottom: 0;
width: 239px;
}
#search {
width: 200px;
padding: 2px 3px;
}
input.ghosted {
font-style: italic;
color: #aaa;
}
/* FOOTER */
#footer {
color: #bbb;
width: 595px;
margin-left: 120px;
margin-top: 30px;
}
#footer .content {
border-top: 1px solid #ccc;
margin: 0;
padding: 30px 0;
}
#footer a,
#footer a:link {
color: #999;
}
.cc {
float: left;
width: 360px;
}
.cc span {
float: left;
width: 110px;
margin-right: 10px;
text-align: center;
padding-top: 6px;
}
.cc p {
float: left;
width: 180px;
}
.credits {
float: left;
width: 235px;
}

View File

@ -1,415 +0,0 @@
/* The "section" class implicitly needs a clearfix; adding it here for convenience. */
.clearfix:after,
.section:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
.clearfix, .section {
display: inline-block;
}
html[xmlns] .clearfix,
html[xmlns] .section {
display: block;
}
* html .clearfix,
* html .section {
height: 1%;
}
span.replaced { visibility: hidden; }
span.hidden { display: none; }
body {
font-family: Verdana, sans-serif;
font-size: 82.5%;
line-height: 1.5em;
margin: 0;
padding: 0;
}
body * {
margin: 0;
padding: 0;
}
h1, h2, h3, h4, h5, h6 {
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
}
h4 {
font-size: 17px;
color: #555;
margin: 1.0em 0 0.6em;
}
h5 {
font-size: 15px;
color: #2a2a2a;
margin: 1.0em 0 0.6em;
}
h6 {
font-size: 14px;
color: #000;
margin: 1.0em 0 0.6em;
}
a img {
border: 0;
}
ul, li {
list-style-type: none;
}
ol, ul {
margin: 0 0 15px;
}
#page a.img,
#page a.img:link,
#page a.img:visited {
border: none;
}
/* Link bar */
div#links {
margin: 0 auto;
width: 835px;
padding: 16px 0;
height: 16px;
overflow: hidden;
}
div#links_wrapper {
background: #fff;
}
div#links li {
display: inline;
}
div#links li a {
color: #666;
}
div#links li.selected a {
color: #000;
font-weight: bold;
text-decoration: none;
}
ul#internal_links {
float: left;
}
ul#internal_links li {
margin-right: 25px;
}
ul#external_links {
float: right;
}
ul#external_links li {
margin-left: 25px;
padding-left: 21px;
}
li#scripty_link {
background: url(http://prototype.conio.net/new/images/link-logo-scripty.png) no-repeat center left;
}
li#rails_link {
background: url(http://prototype.conio.net/new/images/link-logo-rails.png) no-repeat center left;
}
p a, p a:link,
h1 a, h1 a:link,
h2 a, h2 a:link,
h3 a, h3 a:link,
h4 a, h4 a:link,
h5 a, h5 a:link,
h6 a, h6 a:link {
color: #036;
border-bottom: 1px solid #036;
text-decoration: none;
}
p a:visited {
border-bottom: 1px solid #666;
}
code {
font-family: "Panic Sans", "Bitstream Vera Sans Mono", Monaco, Consolas, Andale Mono, monospace;
font-size: 13px;
}
p code,
li code {
background-color: #f0f0f0;
border: 1px solid #ccc;
border-radius: 3px;
-webkit-border-radius: 3px;
padding: 0 3px;
}
pre code {
background-color: transparent;
border: 0;
padding: 0;
}
#page {
margin: 0 auto;
padding-bottom: 100px; /* FIXME: Temporary as pages are built */
}
/* top */
.related-links {
width: 835px;
font-size: 0.9em;
margin: 0 auto 10px;
padding: 10px 0 0;
}
.related-links a {
color: #000;
text-decoration: none;
}
.related-links ul {
list-style-type: none;
}
.related-links ul.internal {
float: left;
width: 355px;
}
.related-links ul.internal li {
text-align: center;
}
.related-links ul.external {
float: right;
width: 295px;
}
.related-links li {
float: left;
padding: 0 15px;
width: 85px;
margin-right: 5px;
}
.related-links li.last {
margin-right: 0;
}
.related-links ul.external li.scripty {
padding: 0 8px 0 22px;
background: url(../images/icon-scripty.png) no-repeat;
margin-right: 65px;
}
.related-links ul.external li.rails {
padding: 0 8px 0 22px;
background: url(../images/icon-rails.png) no-repeat;
}
.banner {
height: 152px;
padding: 1px 0;
background: url(../images/header-stripe.png) repeat-x;
}
.banner-content {
width: 835px;
margin: 0 auto;
}
.banner h1 {
width: 236px;
height: 150px;
background: url(../images/header-logo.png) no-repeat;
}
.banner h1 span {
display: none;
}
.banner-small {
height: 75px;
padding: 1px 0;
background: url(../images/header-stripe-small.png) repeat-x;
}
.banner-small h1 {
width: 118px;
height: 75px;
background: url(../images/header-logo-small.png) no-repeat;
margin-left: 60px;
}
.banner-small h1 span {
display: none;
}
/* PAGE CONTENT */
.page-content {
width: 955px;
margin: 30px auto 0;
}
.page-content .page-title {
margin-left: 120px;
margin-bottom: 15px;
font-size: 27px;
letter-spacing: -1px;
color: #444;
}
.page-content .page-introduction {
margin-left: 120px;
margin-bottom: 25px;
}
.page-content .section {
width: 955px;
margin: 10px 0 20px;
}
.page-content .section .section-title {
width: 110px;
margin-right: 10px;
padding-right: 0;
float: left;
text-align: right;
overflow: hidden;
}
.page-content .section .section-title h3 {
color: #999;
font-size: 14px;
line-height: 110%;
padding-right: 10px;
padding-bottom: 5px;
}
.page-content .section .section-content {
width: 835px;
float: left;
}
.page-content a,
.page-content a:link {
color: #036;
border-bottom: 1px solid #036;
text-decoration: none;
}
.page-content a:visited {
border-bottom: 1px solid #bbb;
}
.page-content ul,
.page-content ol {
margin: 10px 0;
}
.page-content li {
margin: 5px 0 8px 20px;
list-style-type: disc;
}
.page-content p {
margin: 0 0 0.8em;
}
.page-content pre {
color: #333;
background-color: #f0f0ff;
border: 1px solid #dde;
padding: 3px 5px;
margin: 0 0 1em;
}
.page-content .two-column {
}
.page-content .two-column-left,
.page-content .two-column-right {
width: 475px;
margin-right: 5px;
float: left;
}
.page-content .two-column-right {
margin-right: 0;
}
.page-content .two-column .section {
width: 475px;
}
.page-content .two-column .section-content {
width: 345px;
padding-right: 10px;
}
.smallcaps {
font-size: 0.85em;
text-transform: uppercase;
letter-spacing: 1px;
}
/* MASTHEAD */
div#masthead {
margin-top: 50px;
background: url(../images/header-stripe-small.png) repeat-x top left;
height: 76px;
}
div#masthead div#masthead_content {
margin: 0 auto;
width: 835px;
position: relative;
}
div#masthead h1#logo {
background: url(../images/header-logo-small.png) no-repeat 0 1px;
width: 118px;
height: 76px;
position: relative;
left: 60px;
}
div#masthead a {
text-decoration: none;
}

View File

@ -1,13 +0,0 @@
body.grid {
width: 955px;
margin: auto;
}
body.grid div#page {
overflow: hidden;
background: url(../images/grid.png);
}
body.grid div#page * {
opacity: .9;
}

View File

@ -1,116 +0,0 @@
/* See license.txt for terms of usage */
.firebugHighlight {
z-index: 2147483647;
position: absolute;
background-color: #3875d7;
}
.firebugLayoutBoxParent {
z-index: 2147483647;
position: absolute;
border-right: 1px dashed #BBBBBB;
border-bottom: 1px dashed #BBBBBB;
}
.firebugRulerH {
position: absolute;
top: -15px;
left: 0;
width: 100%;
height: 14px;
background: url(chrome://firebug/skin/rulerH.png) repeat-x;
border-top: 1px solid #BBBBBB;
border-right: 1px dashed #BBBBBB;
border-bottom: 1px solid #000000;
}
.firebugRulerV {
position: absolute;
top: 0;
left: -15px;
width: 14px;
height: 100%;
background: url(chrome://firebug/skin/rulerV.png) repeat-y;
border-left: 1px solid #BBBBBB;
border-right: 1px solid #000000;
border-bottom: 1px dashed #BBBBBB;
}
.overflowRulerX > .firebugRulerV {
left: 0;
}
.overflowRulerY > .firebugRulerH {
top: 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
.firebugLayoutBoxOffset {
z-index: 2147483647;
position: absolute;
opacity: 0.8;
}
.firebugLayoutBoxMargin {
background-color: #EDFF64;
}
.firebugLayoutBoxBorder {
background-color: #666666;
}
.firebugLayoutBoxPadding {
background-color: SlateBlue;
}
.firebugLayoutBoxContent {
background-color: SkyBlue;
}
/*.firebugHighlightGroup .firebugLayoutBox {
background-color: transparent;
}
.firebugHighlightBox {
background-color: Blue !important;
}*/
.firebugLayoutLine {
z-index: 2147483647;
background-color: #000000;
opacity: 0.4;
}
.firebugLayoutLineLeft,
.firebugLayoutLineRight {
position: fixed;
width: 1px;
height: 100%;
}
.firebugLayoutLineTop,
.firebugLayoutLineBottom {
position: absolute;
width: 100%;
height: 1px;
}
.firebugLayoutLineTop {
margin-top: -1px;
border-top: 1px solid #999999;
}
.firebugLayoutLineRight {
border-right: 1px solid #999999;
}
.firebugLayoutLineBottom {
border-bottom: 1px solid #999999;
}
.firebugLayoutLineLeft {
margin-left: -1px;
border-left: 1px solid #999999;
}

View File

@ -1,443 +0,0 @@
/* @group Tags */
body {
font-family: Verdana, sans-serif;
}
form {
margin: 0;
padding: 0;
}
a {
color: #036;
text-decoration: none;
}
p a {
border-bottom: 1px solid #999;
padding: 0 1px;
}
p a:hover {
background-color: #036;
color: #fff;
border-bottom: 1px solid #036;
}
h1, h2, h3, h4, h5, h6 {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: 0;
padding: 0;
}
pre {
padding: 0;
}
code {
font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", monospace;
font-size: 11px;
}
/* @end */
/* @group Masthead */
div#masthead {
background: url(../images/header-stripe-small.png) repeat-x top left;
height: 76px;
}
div#masthead div#masthead_content {
margin: 0 auto;
width: 835px;
position: relative;
}
div#masthead h1#logo {
background: url(../images/header-logo-small.png) no-repeat 0 1px;
width: 118px;
height: 76px;
position: relative;
left: 60px;
}
/* @end */
/* @group Main */
#main {
width: 840px;
margin: 20px auto;
position: relative;
}
#main h2 {
color: #444;
font-size: 22px;
padding-left: 69px;
margin-top: 0;
}
#main h2 span {
color: #ccc;
display: block;
text-transform: uppercase;
font-size: 13px;
margin-bottom: -10px;
padding-left: 2px;
}
#main h2 a {
color: #444;
text-decoration: none;
}
#main h2 a:hover {
color: #222;
border-bottom: 1px solid #999;
}
#main h4, h5, h6 {
padding-left: 4px;
}
#main li h4,
#main li h5,
#main li h6 {
padding-left: 0;
}
#main h4.inherited {
color: #888 !important;
}
#main .section {
overflow: hidden;
padding-left: 65px;
padding-bottom: 0;
margin: 5px 0 0;
}
#main .section h3 {
position: absolute;
left: -85px;
width: 110px;
text-align: right;
font-size: 13px;
padding-top: 3px;
color: #999;
line-height: 100%;
min-height: 30px;
}
#main .section h4 {
font-size: 15px;
color: #444;
margin: 0 0 0.3em;
}
#main .section h4.inherited {
color: #888;
}
#main .section h4.inherited a {
color: #49B;
}
#main p {
margin: 0 0 1.1em;
}
#main pre {
background-color: #000;
color: #fff;
padding: 5px 10px;
margin: 0 0 5px;
}
#main pre.syntax {
background-color: #f5f5f5;
color: #000;
padding: 3px 5px;
}
#main .section p.purpose {
background-color: #CDE0FB;
padding: 3px 5px;
}
#main .section p {
padding: 0 5px;
}
#main ul, #main ol {
padding-left: 5px;
margin: 0 0 10px;
}
#main ul, #main ul li {
list-style-type: none;
}
#main #excerpt p {
color: #000;
border-left: 3px solid #bbb;
padding: 0;
margin-left: -10px;
font-size: 94%;
padding-left: 10px;
}
#main .meta {
position: absolute;
width: 108px;
left: -60px;
text-align: right;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
font-weight: bold;
color: #888;
}
/* @end */
/* @group Method List */
ul.method-list li {
display: inline;
border-top: 1px solid #ccc;
}
ul.method-list li a {
background-color: #eee;
padding: 2px 3px;
border: 1px solid #ccc;
}
ul.method-list li a:hover {
background-color: #ddd;
}
/* @end */
/* @group Menu */
#menu {
width: 840px;
margin: 0 auto;
position: relative;
height: 25px;
}
#menu div {
width: 234px;
float: right;
margin: 0 3px;
}
#menu div.search-box {
width: 222px;
background-color: #cee8c3;
font-size: 13px;
height: 25px;
line-height: 25px;
padding: 2px 6px;
}
#menu div.search-box label {
color: #555;
}
#menu div.search-box input {
border: 1px solid #bbb;
padding: 2px;
width: 163px;
}
#menu h2 {
font-size: 13px;
font-weight: normal;
}
#menu h2 a {
height: 25px;
line-height: 25px;
display: block;
text-align: center;
background-color: #CDE0FB;
font-family: Verdana, sans-serif;
padding: 2px 6px;
}
#menu h2 a:hover {
background-color: #a4c8fb;
}
#menu #api_menu,
#menu #search_results {
border: 1px solid #ddd;
background: #fff;
position: absolute;
width: 232px;
top: 26px;
z-index: 1500;
max-height: 200px;
overflow: auto;
}
#menu #api_menu {
right: 3px;
}
#menu #search_results {
right: 243px;
}
#menu .menu-items li {
background-color: #fff;
}
#menu .menu-items li a {
display: block;
color: #333;
background-color: #fff;
padding: 2px 6px;
border-top: 1px solid #fff;
border-bottom: 1px solid #fff;
}
#menu .menu-items li a:hover,
#menu .menu-items li.highlighted a {
background-color: #CDE0FB;
border-top-color: #a4c8fb;
border-bottom-color: #a4c8fb;
}
#menu .menu-items ul {
margin: 0;
padding: 0;
}
#menu .menu-items li a {
background-repeat: no-repeat;
background-position: 6px 3px;
padding: 3px 5px 3px 30px;
font-size: 12px;
}
#menu .menu-items li a.class {
background-image: url(../images/class.png);
}
#menu .menu-items li a.namespace {
background-image: url(../images/namespace.png);
}
#menu .menu-items li a.mixin {
background-image: url(../images/mixin.png);
}
#menu .menu-items li a.section {
text-transform: uppercase;
color: #777;
background-image: url(../images/section.png);
}
#menu .menu-items li a.class_method,
#menu .menu-items li a.instance_method,
#menu .menu-items li a.utility {
background-image: url(../images/method.png);
}
#menu .menu-items li a.class_property,
#menu .menu-items li a.instance_property {
background-image: url(../images/property.png);
}
#menu .menu-items li a.constructor {
background-image: url(../images/constructor.png);
}
#menu .menu-items li a.constant {
background-image: url(../images/constant.png);
}
/* @end */
/* @group Section Headings (H3s) */
.section h3 {
padding-right: 25px;
background-repeat: no-repeat;
background-position: right 4px;
}
.section-superclass h3 {
background-image: url(../images/class.png);
}
.section-method-list h3,
.section-instance_methods h3,
.section-klass_methods h3 {
background-image: url(../images/method.png);
}
.section-klass_properties h3,
.section-instance_properties h3 {
background-image: url(../images/property.png);
}
.section-constructor h3 {
background-image: url(../images/constructor.png);
}
.section-constants h3 {
background-image: url(../images/constant.png);
}
.section-mixins h3 {
background-image: url(../images/mixin.png);
}
/* @end */
/* @group Method Details List */
ul.method-details-list li {
border: 2px solid #fff;
}
ul.method-details-list li.highlighted {
border: 2px solid #CDE0FB;
}
/* @end */
/* floating menu */
#menu.fixed {
position: fixed;
top: 0;
z-index: 1000;
left: 232px;
}

View File

@ -1,244 +0,0 @@
/* Masthead */
div#masthead {
background: url(http://prototype.conio.net/new/images/header-stripe.png) repeat-x top left;
height: 152px;
}
div#masthead div#masthead_content {
margin: 0 auto;
width: 835px;
position: relative;
}
div#masthead h1#logo {
background: url(http://prototype.conio.net/new/images/header-logo.png) no-repeat 0 1px;
width: 236px;
height: 152px;
}
div#masthead div#pitch {
position: absolute;
background: url(http://prototype.conio.net/new/images/header-copy.png) no-repeat 0 1px;
top: 0;
left: 300px;
width: 535px;
height: 152px;
}
div#masthead h1#logo *,
div#masthead div#pitch * {
display: none;
}
/* Buttons */
div#buttons, div#more {
overflow: hidden;
width: 840px;
margin: -1px auto 0 auto;
padding: 0 0 0 5px;
}
div#more {
margin-top: 35px;
}
div#buttons li {
display: block;
float: left;
border-top: 1px solid #929fb3;
margin: 0 5px 0 0;
width: 175px;
height: 100px;
}
div#more li {
height: 50px;
}
div#buttons li a {
display: block;
position: relative;
width: 175px;
height: 100px;
text-decoration: none;
background: #cde0fb no-repeat center 30px;
}
div#buttons li a:hover {
background-color: #a4c8fb;
}
div#buttons li a span.title {
display: none;
}
div#buttons li a span.description {
position: absolute;
display: block;
width: 175px;
top: 55px;
text-align: center;
color: #666;
}
div#more li a span.title {
position: absolute;
display: block;
width: 175px;
top: 15px;
text-align: center;
color: #666;
}
div#buttons li a:hover span.description {
color: #333;
}
div#buttons li#download_button {
width: 295px;
}
div#buttons li#download_button a,
div#buttons li#download_button a span.description {
width: 295px;
}
div#buttons li#download_button a {
background-color: #cee8c3;
background-image: url(http://prototype.conio.net/new/images/button-download.png);
}
div#buttons li#download_button a:hover {
background-color: #a4e289;
}
div#buttons li#learn_button a {
background-image: url(http://prototype.conio.net/new/images/button-learn.png);
}
div#buttons li#discuss_button a {
background-image: url(http://prototype.conio.net/new/images/button-discuss.png);
}
div#buttons li#contribute_button a {
background-image: url(http://prototype.conio.net/new/images/button-contribute.png);
}
div#more {
position: relative;
height: 400px;
margin: 15px 60px;
color: #444;
}
div#more .column {
display: block;
float: left;
margin: 0 5px 0 0;
padding-left: 5px;
min-height: 300px;
}
div#more h3 {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
letter-spacing: -1px;
font-weight: bold;
color: #444;
font-size: 18px;
margin: 0 0 5px;
}
.column {
width: 175px;
}
.wide-column {
width: 295px;
}
.medium-column {
width: 235px;
}
.main-column {
width: 530px;
}
.sidebar-column {
width: 290px;
}
div#more {
width: 840px;
margin: 25px auto 0;
}
/*#buttons_wrapper {
background-color: #0E4FAF;
}
#page {
background-color: #292929;
}
*/
div#more div.main-column p {
font-size: 16px;
margin-right: 10px;
}
div#more h3.tagline {
height: 23px;
background: url(../images/tagline.png) no-repeat top left;
width: 530px;
}
div#more h3.tagline span { display: none; }
.view-master {
text-align: center;
font-family: Verdana;
color: #ccc;
font-size: 18px;
padding: 35px 0;
margin: 10px 0;
}
.using-prototype {
border-top: 2px solid #ddd;
border-bottom: 2px solid #ddd;
margin: 25px 10px 10px 0;
padding: 5px 0;
}
.sidebar-column h4 {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
font-weight: bold;
margin: 0;
}
.sidebar-column p {
margin-bottom: 15px;
}
ol, ol li {
list-style-type: decimal;
line-height: 160%;
}
ol li {
margin: 0 0 2px;
}
ol, ul {
margin: 0 0 15px;
padding-left: 0;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

View File

@ -12,8 +12,21 @@ module PDoc
end
module MenuHelper
def menu(obj)
class_names = menu_class_name(obj)
li_class_names = obj.type == "section" ? "menu-section" : ""
html = <<-EOS
<div class='menu-item'>
#{auto_link(obj, false, :class => class_names_for(obj))}
</div>
EOS
unless obj.children.empty?
html << content_tag(:ul, obj.children.map { |n|menu(n) }.join("\n"), :class => li_class_names)
end
content_tag(:li, html, :class => class_names)
end
end
end
end
end
end
end

View File

@ -21,4 +21,4 @@
<% end %>
</ul>
</div> <!-- .section-content -->
</div> <!-- .section clearfix -->
</div> <!-- .section -->

View File

@ -1,50 +1,61 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Prototype API documentation | <%= @title %></title>
<meta name="generator" content="PDoc" />
<%= javascript_include_tag "prototype", "effects", "controls" %>
<%= javascript_include_tag "application", "code_highlighter" %>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Prototype API documentation | <%= @title %></title>
<meta name="generator" content="PDoc" />
<%= javascript_include_tag "prototype" %>
<%= javascript_include_tag "application", "code_highlighter", "tabs" %>
<%= javascript_include_tag "item_index" %>
<%= stylesheet_link_tag "api" %>
<script type="text/javascript">
PDoc.pathPrefix = '<%= path_prefix %>';
</script>
</head>
<body>
<div id="sidebar">
<ul id="sidebar_tabs" class="sidebar-tabs">
<li>
<a href="#menu_pane">Menu</a>
</li>
<li>
<a href="#search_pane">Search</a>
</li>
</ul> <!-- .sidebar-tabs -->
<form class="search-ribbon">
<label>
<span class="hidden">Search</span>
<input type="text" id="search" size="20" title="Search" />
</label>
</form>
<div class="sidebar-pane scrollable" id="menu_pane">
<ul id="api_menu" class="menu-items">
<% @root.sections.each do |section| %>
<%= menu(section) %>
<% end %>
</ul> <!--- #api_menu =-->
</div> <!-- .sidebar-pane -->
<div class="sidebar-pane" id="search_pane">
<ul id="search_results" class="search-results menu-items scrollable"></ul>
</div> <!-- .sidebar-pane -->
</div> <!-- #sidebar -->
<%= javascript_include_tag "item_index" %>
<%= stylesheet_link_tag "core", "api" %>
<script type="text/javascript">PDoc.pathPrefix = '<%= path_prefix %>';</script>
</head>
<body class="">
<div id="page">
<div id="masthead">
<div id="masthead_content">
<a href="http://prototypejs.org">
<h1 id="logo"><span class="replaced">Prototype JavaScript framework</span></h1>
</a>
</div> <!-- #masthead_content -->
</div> <!-- #masthead -->
<div id="menu" class="clearfix">
<div class="api-box">
<h2><a href="#" id="api_menu_button">Menu &darr;</a></h2>
<ul id="api_menu" class="menu-items" style="display: none">
<% @root.sections.each do |section| %>
<%= menu(section) %>
<% end %>
</ul>
</div> <!-- .api-box -->
<div class="search-box">
<form>
<label><span class="hidden">Search </span><input type="text" id="search" size="20" /></label>
</form>
<ul id="search_results" class="search-results menu-items" style="display:none"></ul>
</div> <!-- .search-box -->
</div> <!-- #menu -->
<div class="masthead">
<div class="content">
<h1 class="logo">
<a href="http://prototypejs.org"><span class="replaced">Prototype JavaScript framework</span></a>
</h1>
</div> <!-- .content -->
</div> <!-- .masthead -->
<div id="main" class="page-content">
<%= @content_for_layout %>
@ -52,28 +63,24 @@
</div> <!-- #main -->
<div id="footer">
<div class="about clearfix">
<div class="copyright clearfix">
<div class="cc">
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://creativecommons.org/images/public/somerights20.png" /></a>
</div> <!-- .cc -->
<div class="copyright-about">
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 Unported License</a>.
</div> <!-- .copyright-about -->
</div> <!-- .copyright -->
<div class="content clearfix">
<div class="cc clearfix">
<span>
<img src="http://creativecommons.org/images/public/somerights20.png"
style="border-width: 0pt;" alt="Creative Commons License"/>
</span>
<p>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 Unported License</a>.</p>
</div> <!-- .cc -->
<div class="credits">
<p>Generated by <a href="http://pdoc.org">PDoc</a>. Uses <a href="http://famfamfam.com/lab/icons/silk/" title="famfamfam.com: Silk Icons">Silk Icons</a>.</p>
Generated by <a href="http://pdoc.org">PDoc</a>. Uses <a href="http://famfamfam.com/lab/icons/silk/" title="famfamfam.com: Silk Icons">Silk Icons</a> and portions of <a href="http://github.com/280north/aristo/tree/master" title="280north's aristo at master - GitHub">Aristo</a>.
</div> <!-- .credits -->
</div> <!-- .about -->
</div> <!-- .content -->
</div> <!-- #footer -->
</div> <!-- #page -->
</body>
</div> <!-- #page -->
</body>
</html>

View File

@ -11,9 +11,9 @@
<ul class="argument-list">
<% object.arguments.each do |arg| %>
<li>
<code><%= arg.name %></code>
<code class="argument-name"><%= arg.name %></code>
<% unless arg.types.empty? %>
(<%= arg.types.map { |t| auto_link_code(t, false) }.join(' | ') %>)
<span class="argument-types">(<%= arg.types.map { |t| auto_link_code(t, false) }.join(' | ') %>)</span>
<% end %>
<%= ' &ndash; ' + inline_htmlize(arg.description) unless arg.description.empty? %>
</li>