Merge branch 'master' of github.com:sstephenson/prototype
6
Rakefile
@ -73,9 +73,9 @@ module PrototypeHelper
|
||||
rm_rf DOC_DIR
|
||||
|
||||
PDoc::Runner.new(temp_path, {
|
||||
:output => DOC_DIR,
|
||||
:templates => File.join(TEMPLATES_DIR, "html"),
|
||||
:index_page => 'README.markdown'
|
||||
:output => DOC_DIR,
|
||||
:index_page => 'README.markdown',
|
||||
:syntax_highlighter => :pygments
|
||||
}).run
|
||||
|
||||
rm_rf temp_path
|
||||
|
@ -121,7 +121,7 @@ Ajax.Response = Class.create({
|
||||
},
|
||||
|
||||
/**
|
||||
* Ajax.Response.getResponseHeader(name) -> String
|
||||
* Ajax.Response#getResponseHeader(name) -> String
|
||||
*
|
||||
* Returns the value of the requested header if present; throws an error
|
||||
* otherwise. This is just a wrapper around the `XmlHttpRequest` method of
|
||||
@ -132,7 +132,7 @@ Ajax.Response = Class.create({
|
||||
},
|
||||
|
||||
/**
|
||||
* Ajax.Response.getAllResponseHeaders() -> String
|
||||
* Ajax.Response#getAllResponseHeaders() -> String
|
||||
*
|
||||
* Returns a string containing all headers separated by line breaks; throws
|
||||
* an error if no headers exist. This is just a wrapper around the
|
||||
|
@ -1,6 +1,6 @@
|
||||
/** section: DOM, related to: Element
|
||||
* $(id) -> Element
|
||||
* $(id...) -> [Element]...
|
||||
* $(id...) -> [Element...]
|
||||
* - id (String | Element): A DOM node or a string that references a node's
|
||||
* ID.
|
||||
*
|
||||
@ -2278,8 +2278,8 @@ Element.addMethods = function(methods) {
|
||||
Element.cache = { };
|
||||
};
|
||||
|
||||
/** section: DOM
|
||||
* document.viewport
|
||||
/**
|
||||
* document.viewport
|
||||
*
|
||||
* The `document.viewport` namespace contains methods that return information
|
||||
* about the viewport — the rectangle that represents the portion of a web
|
||||
|
@ -621,6 +621,7 @@
|
||||
* ...and then to remove:
|
||||
*
|
||||
* $('foo').stopObserving('click', this.boundHandlerMethod); // <== Right
|
||||
*
|
||||
**/
|
||||
function stopObserving(element, eventName, handler) {
|
||||
element = $(element);
|
||||
@ -744,7 +745,7 @@
|
||||
});
|
||||
|
||||
/** section: DOM
|
||||
* document
|
||||
* document
|
||||
*
|
||||
* Prototype extends the built-in `document` object with several convenience
|
||||
* methods related to events.
|
||||
|
@ -248,7 +248,7 @@ Form.Methods = {
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/** section: DOM
|
||||
/**
|
||||
* Form.Element
|
||||
*
|
||||
* Utilities for dealing with form controls in the DOM.
|
||||
@ -359,7 +359,7 @@ Form.Element.Methods = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Form.Element#activate(element) -> Element
|
||||
* Form.Element.activate(@element) -> Element
|
||||
*
|
||||
* Gives focus to a form control and selects its contents if it is a text
|
||||
* input.
|
||||
@ -479,7 +479,7 @@ Form.Element.Serializers = {
|
||||
* Abstract
|
||||
**/
|
||||
|
||||
/** section: DOM
|
||||
/**
|
||||
* class Abstract.TimedObserver
|
||||
*
|
||||
* An abstract DOM element observer class, subclasses of which can be used to periodically
|
||||
@ -528,7 +528,7 @@ Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
|
||||
}
|
||||
});
|
||||
|
||||
/** section: DOM
|
||||
/**
|
||||
* class Form.Element.Observer < Abstract.TimedObserver
|
||||
*
|
||||
* An [[Abstract.TimedObserver]] subclass that watches for changes to a form field's value.
|
||||
@ -551,7 +551,7 @@ Form.Element.Observer = Class.create(Abstract.TimedObserver, {
|
||||
}
|
||||
});
|
||||
|
||||
/** section: DOM
|
||||
/**
|
||||
* class Form.Observer < Abstract.TimedObserver
|
||||
*
|
||||
* An [[Abstract.TimedObserver]] subclass that watches for changes to a form.
|
||||
@ -577,7 +577,7 @@ Form.Observer = Class.create(Abstract.TimedObserver, {
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/** section: DOM
|
||||
/**
|
||||
* class Abstract.EventObserver
|
||||
**/
|
||||
Abstract.EventObserver = Class.create({
|
||||
@ -619,7 +619,7 @@ Abstract.EventObserver = Class.create({
|
||||
}
|
||||
});
|
||||
|
||||
/** section: DOM
|
||||
/**
|
||||
* class Form.Element.EventObserver < Abstract.EventObserver
|
||||
**/
|
||||
Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
|
||||
@ -628,7 +628,7 @@ Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
|
||||
}
|
||||
});
|
||||
|
||||
/** section: DOM
|
||||
/**
|
||||
* class Form.EventObserver < Abstract.EventObserver
|
||||
**/
|
||||
Form.EventObserver = Class.create(Abstract.EventObserver, {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/** related to: Prototype.Selector
|
||||
/** section: DOM, related to: Prototype.Selector
|
||||
* $$(expression...) -> [Element...]
|
||||
*
|
||||
* Returns all elements in the document that match the provided CSS selectors.
|
||||
|
@ -82,14 +82,14 @@
|
||||
* inadequate, there's a provision for customization. `Template`'s
|
||||
* constructor accepts an optional second argument that is a regular expression
|
||||
* object to match the replaceable symbols in the template string. Let's put
|
||||
* together a template that uses a syntax similar to the ubiquitous `<&= %>`
|
||||
* together a template that uses a syntax similar to the now ubiquitous `{{ }}`
|
||||
* constructs:
|
||||
*
|
||||
* // matches symbols like '<&= field %>'
|
||||
* var syntax = /(^|.|\r|\n)(\<%=\s*(\w+)\s*%\>)/;
|
||||
* // matches symbols like '{{ field }}'
|
||||
* var syntax = /(^|.|\r|\n)(\{{\s*(\w+)\s*}})/;
|
||||
*
|
||||
* var t = new Template(
|
||||
* '<div>Name: <b><&= name %></b>, Age: <b><&=age%></b></div>',
|
||||
* '<div>Name: <b>{{ name }}</b>, Age: <b>{{ age }}</b></div>',
|
||||
* syntax);
|
||||
* t.evaluate( {name: 'John Smith', age: 26} );
|
||||
* // -> <div>Name: <b>John Smith</b>, Age: <b>26</b></div>
|
||||
|
Before Width: | Height: | Size: 733 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 857 B |
Before Width: | Height: | Size: 599 B |
Before Width: | Height: | Size: 981 B |
Before Width: | Height: | Size: 584 B |
Before Width: | Height: | Size: 786 B |
Before Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 778 B |
Before Width: | Height: | Size: 853 B |
Before Width: | Height: | Size: 613 B |
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 970 B |
Before Width: | Height: | Size: 599 B |
Before Width: | Height: | Size: 343 B |
Before Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 946 B |
Before Width: | Height: | Size: 764 B |
Before Width: | Height: | Size: 764 B |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 630 B |
@ -1,525 +0,0 @@
|
||||
//= require <prototype>
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
if (Object.isDate(expires))
|
||||
expires = expires.toGMTString();
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
});
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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'));
|
||||
},
|
||||
|
||||
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';
|
||||
},
|
||||
|
||||
// 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());
|
||||
},
|
||||
|
||||
// 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.
|
||||
PDoc.Sidebar.Filterer = Class.create({
|
||||
initialize: function(element, options) {
|
||||
this.element = $(element);
|
||||
this.options = Object.extend(
|
||||
Object.clone(PDoc.Sidebar.Filterer.DEFAULT_OPTIONS),
|
||||
options || {}
|
||||
);
|
||||
|
||||
// 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);
|
||||
|
||||
this.menu = this.options.menu;
|
||||
this.links = this.menu.select('a');
|
||||
|
||||
this.resultsElement = this.options.resultsElement;
|
||||
|
||||
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();
|
||||
},
|
||||
|
||||
addObservers: function() {
|
||||
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) {
|
||||
// Clear the text box on ESC.
|
||||
if (event.keyCode && event.keyCode === Event.KEY_ESC) {
|
||||
this.element.setValue('');
|
||||
}
|
||||
|
||||
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.emptyResults();
|
||||
this.hideResults();
|
||||
return;
|
||||
}
|
||||
|
||||
var urls = this.findURLs(value);
|
||||
this.buildResults(urls);
|
||||
},
|
||||
|
||||
setSearchValue: function(value) {
|
||||
this.element.setValue(value);
|
||||
if (value.strip() === "") {
|
||||
PDoc.Sidebar.Tabs.setActiveTab(0);
|
||||
return;
|
||||
}
|
||||
this.buildResults(this.findURLs(value));
|
||||
},
|
||||
|
||||
// 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]);
|
||||
}
|
||||
return results;
|
||||
},
|
||||
|
||||
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('../', '');
|
||||
},
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
keyup: function(event) {
|
||||
if (this._scrollTimer) {
|
||||
window.clearTimeout(this._scrollTimer);
|
||||
}
|
||||
},
|
||||
|
||||
moveHighlight: function(direction) {
|
||||
if (!this.highlighted) {
|
||||
// If there is none, highlight the first result.
|
||||
this.highlighted =
|
||||
this.resultsElement.down('li').addClassName('highlighted');
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
var h = this.highlighted, r = this.resultsElement;
|
||||
|
||||
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;
|
||||
|
||||
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();
|
||||
},
|
||||
|
||||
wrappedGetValue: function($proceed) {
|
||||
var value = $proceed();
|
||||
return value === this.title ? "" : value;
|
||||
},
|
||||
|
||||
addObservers: function() {
|
||||
this.element.observe('focus', this.onFocus.bind(this));
|
||||
this.element.observe('blur', this.onBlur.bind(this));
|
||||
|
||||
var form = this.element.up('form');
|
||||
if (form) {
|
||||
form.observe('submit', this.onSubmit.bind(this));
|
||||
}
|
||||
|
||||
// Firefox's bfcache means that form fields need to be re-initialized
|
||||
// when you hit the "back" button to return to the page.
|
||||
if (Prototype.Browser.Gecko) {
|
||||
window.addEventListener('pageshow', this.onBlur.bind(this), false);
|
||||
}
|
||||
},
|
||||
|
||||
onFocus: function() {
|
||||
if (this.isGhosted) {
|
||||
this.element.setValue('');
|
||||
this.setGhosted(false);
|
||||
}
|
||||
},
|
||||
|
||||
onBlur: function() {
|
||||
var value = this.element.getValue();
|
||||
if (value.blank() || value == this.title) {
|
||||
this.setGhosted(true);
|
||||
} else {
|
||||
this.setGhosted(false);
|
||||
}
|
||||
},
|
||||
|
||||
setGhosted: function(isGhosted) {
|
||||
this.isGhosted = isGhosted;
|
||||
this.element[isGhosted ? 'addClassName' : 'removeClassName']('ghosted');
|
||||
if (isGhosted) {
|
||||
this.element.setValue(this.title);
|
||||
}
|
||||
},
|
||||
|
||||
// Hook into the enclosing form's `onsubmit` event so that we clear any
|
||||
// ghosted text before the form is sent.
|
||||
onSubmit: function() {
|
||||
if (this.isGhosted) {
|
||||
this.element.setValue('');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
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());
|
||||
});
|
963
templates/html/assets/javascripts/controls.js
vendored
@ -1,963 +0,0 @@
|
||||
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||||
// (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
|
||||
// (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
|
||||
// Contributors:
|
||||
// Richard Livsey
|
||||
// Rahul Bhargava
|
||||
// Rob Wills
|
||||
//
|
||||
// script.aculo.us is freely distributable under the terms of an MIT-style license.
|
||||
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
||||
|
||||
// Autocompleter.Base handles all the autocompletion functionality
|
||||
// that's independent of the data source for autocompletion. This
|
||||
// includes drawing the autocompletion menu, observing keyboard
|
||||
// and mouse events, and similar.
|
||||
//
|
||||
// Specific autocompleters need to provide, at the very least,
|
||||
// a getUpdatedChoices function that will be invoked every time
|
||||
// the text inside the monitored textbox changes. This method
|
||||
// should get the text for which to provide autocompletion by
|
||||
// invoking this.getToken(), NOT by directly accessing
|
||||
// this.element.value. This is to allow incremental tokenized
|
||||
// autocompletion. Specific auto-completion logic (AJAX, etc)
|
||||
// belongs in getUpdatedChoices.
|
||||
//
|
||||
// Tokenized incremental autocompletion is enabled automatically
|
||||
// when an autocompleter is instantiated with the 'tokens' option
|
||||
// in the options parameter, e.g.:
|
||||
// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
|
||||
// will incrementally autocomplete with a comma as the token.
|
||||
// Additionally, ',' in the above example can be replaced with
|
||||
// a token array, e.g. { tokens: [',', '\n'] } which
|
||||
// enables autocompletion on multiple tokens. This is most
|
||||
// useful when one of the tokens is \n (a newline), as it
|
||||
// allows smart autocompletion after linebreaks.
|
||||
|
||||
if(typeof Effect == 'undefined')
|
||||
throw("controls.js requires including script.aculo.us' effects.js library");
|
||||
|
||||
var Autocompleter = { }
|
||||
Autocompleter.Base = Class.create({
|
||||
baseInitialize: function(element, update, options) {
|
||||
element = $(element)
|
||||
this.element = element;
|
||||
this.update = $(update);
|
||||
this.hasFocus = false;
|
||||
this.changed = false;
|
||||
this.active = false;
|
||||
this.index = 0;
|
||||
this.entryCount = 0;
|
||||
this.oldElementValue = this.element.value;
|
||||
|
||||
if(this.setOptions)
|
||||
this.setOptions(options);
|
||||
else
|
||||
this.options = options || { };
|
||||
|
||||
this.options.paramName = this.options.paramName || this.element.name;
|
||||
this.options.tokens = this.options.tokens || [];
|
||||
this.options.frequency = this.options.frequency || 0.4;
|
||||
this.options.minChars = this.options.minChars || 1;
|
||||
this.options.onShow = this.options.onShow ||
|
||||
function(element, update){
|
||||
if(!update.style.position || update.style.position=='absolute') {
|
||||
update.style.position = 'absolute';
|
||||
Position.clone(element, update, {
|
||||
setHeight: false,
|
||||
offsetTop: element.offsetHeight
|
||||
});
|
||||
}
|
||||
Effect.Appear(update,{duration:0.15});
|
||||
};
|
||||
this.options.onHide = this.options.onHide ||
|
||||
function(element, update){ new Effect.Fade(update,{duration:0.15}) };
|
||||
|
||||
if(typeof(this.options.tokens) == 'string')
|
||||
this.options.tokens = new Array(this.options.tokens);
|
||||
// Force carriage returns as token delimiters anyway
|
||||
if (!this.options.tokens.include('\n'))
|
||||
this.options.tokens.push('\n');
|
||||
|
||||
this.observer = null;
|
||||
|
||||
this.element.setAttribute('autocomplete','off');
|
||||
|
||||
Element.hide(this.update);
|
||||
|
||||
Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this));
|
||||
Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this));
|
||||
},
|
||||
|
||||
show: function() {
|
||||
if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
|
||||
if(!this.iefix &&
|
||||
(Prototype.Browser.IE) &&
|
||||
(Element.getStyle(this.update, 'position')=='absolute')) {
|
||||
new Insertion.After(this.update,
|
||||
'<iframe id="' + this.update.id + '_iefix" '+
|
||||
'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
|
||||
'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
|
||||
this.iefix = $(this.update.id+'_iefix');
|
||||
}
|
||||
if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
|
||||
},
|
||||
|
||||
fixIEOverlapping: function() {
|
||||
Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
|
||||
this.iefix.style.zIndex = 1;
|
||||
this.update.style.zIndex = 2;
|
||||
Element.show(this.iefix);
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.stopIndicator();
|
||||
if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update);
|
||||
if(this.iefix) Element.hide(this.iefix);
|
||||
},
|
||||
|
||||
startIndicator: function() {
|
||||
if(this.options.indicator) Element.show(this.options.indicator);
|
||||
},
|
||||
|
||||
stopIndicator: function() {
|
||||
if(this.options.indicator) Element.hide(this.options.indicator);
|
||||
},
|
||||
|
||||
onKeyPress: function(event) {
|
||||
if(this.active)
|
||||
switch(event.keyCode) {
|
||||
case Event.KEY_TAB:
|
||||
case Event.KEY_RETURN:
|
||||
this.selectEntry();
|
||||
Event.stop(event);
|
||||
case Event.KEY_ESC:
|
||||
this.hide();
|
||||
this.active = false;
|
||||
Event.stop(event);
|
||||
return;
|
||||
case Event.KEY_LEFT:
|
||||
case Event.KEY_RIGHT:
|
||||
return;
|
||||
case Event.KEY_UP:
|
||||
this.markPrevious();
|
||||
this.render();
|
||||
Event.stop(event);
|
||||
return;
|
||||
case Event.KEY_DOWN:
|
||||
this.markNext();
|
||||
this.render();
|
||||
Event.stop(event);
|
||||
return;
|
||||
}
|
||||
else
|
||||
if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
|
||||
(Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
|
||||
|
||||
this.changed = true;
|
||||
this.hasFocus = true;
|
||||
|
||||
if(this.observer) clearTimeout(this.observer);
|
||||
this.observer =
|
||||
setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
this.changed = false;
|
||||
this.hasFocus = true;
|
||||
this.getUpdatedChoices();
|
||||
},
|
||||
|
||||
onHover: function(event) {
|
||||
var element = Event.findElement(event, 'LI');
|
||||
if(this.index != element.autocompleteIndex)
|
||||
{
|
||||
this.index = element.autocompleteIndex;
|
||||
this.render();
|
||||
}
|
||||
Event.stop(event);
|
||||
},
|
||||
|
||||
onClick: function(event) {
|
||||
var element = Event.findElement(event, 'LI');
|
||||
this.index = element.autocompleteIndex;
|
||||
this.selectEntry();
|
||||
this.hide();
|
||||
},
|
||||
|
||||
onBlur: function(event) {
|
||||
// needed to make click events working
|
||||
setTimeout(this.hide.bind(this), 250);
|
||||
this.hasFocus = false;
|
||||
this.active = false;
|
||||
},
|
||||
|
||||
render: function() {
|
||||
if(this.entryCount > 0) {
|
||||
for (var i = 0; i < this.entryCount; i++)
|
||||
this.index==i ?
|
||||
Element.addClassName(this.getEntry(i),"selected") :
|
||||
Element.removeClassName(this.getEntry(i),"selected");
|
||||
if(this.hasFocus) {
|
||||
this.show();
|
||||
this.active = true;
|
||||
}
|
||||
} else {
|
||||
this.active = false;
|
||||
this.hide();
|
||||
}
|
||||
},
|
||||
|
||||
markPrevious: function() {
|
||||
if(this.index > 0) this.index--
|
||||
else this.index = this.entryCount-1;
|
||||
this.getEntry(this.index).scrollIntoView(true);
|
||||
},
|
||||
|
||||
markNext: function() {
|
||||
if(this.index < this.entryCount-1) this.index++
|
||||
else this.index = 0;
|
||||
this.getEntry(this.index).scrollIntoView(false);
|
||||
},
|
||||
|
||||
getEntry: function(index) {
|
||||
return this.update.firstChild.childNodes[index];
|
||||
},
|
||||
|
||||
getCurrentEntry: function() {
|
||||
return this.getEntry(this.index);
|
||||
},
|
||||
|
||||
selectEntry: function() {
|
||||
this.active = false;
|
||||
this.updateElement(this.getCurrentEntry());
|
||||
},
|
||||
|
||||
updateElement: function(selectedElement) {
|
||||
if (this.options.updateElement) {
|
||||
this.options.updateElement(selectedElement);
|
||||
return;
|
||||
}
|
||||
var value = '';
|
||||
if (this.options.select) {
|
||||
var nodes = $(selectedElement).select('.' + this.options.select) || [];
|
||||
if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
|
||||
} else
|
||||
value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
|
||||
|
||||
var bounds = this.getTokenBounds();
|
||||
if (bounds[0] != -1) {
|
||||
var newValue = this.element.value.substr(0, bounds[0]);
|
||||
var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/);
|
||||
if (whitespace)
|
||||
newValue += whitespace[0];
|
||||
this.element.value = newValue + value + this.element.value.substr(bounds[1]);
|
||||
} else {
|
||||
this.element.value = value;
|
||||
}
|
||||
this.oldElementValue = this.element.value;
|
||||
this.element.focus();
|
||||
|
||||
if (this.options.afterUpdateElement)
|
||||
this.options.afterUpdateElement(this.element, selectedElement);
|
||||
},
|
||||
|
||||
updateChoices: function(choices) {
|
||||
if(!this.changed && this.hasFocus) {
|
||||
this.update.innerHTML = choices;
|
||||
Element.cleanWhitespace(this.update);
|
||||
Element.cleanWhitespace(this.update.down());
|
||||
|
||||
if(this.update.firstChild && this.update.down().childNodes) {
|
||||
this.entryCount =
|
||||
this.update.down().childNodes.length;
|
||||
for (var i = 0; i < this.entryCount; i++) {
|
||||
var entry = this.getEntry(i);
|
||||
entry.autocompleteIndex = i;
|
||||
this.addObservers(entry);
|
||||
}
|
||||
} else {
|
||||
this.entryCount = 0;
|
||||
}
|
||||
|
||||
this.stopIndicator();
|
||||
this.index = 0;
|
||||
|
||||
if(this.entryCount==1 && this.options.autoSelect) {
|
||||
this.selectEntry();
|
||||
this.hide();
|
||||
} else {
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
addObservers: function(element) {
|
||||
Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
|
||||
Event.observe(element, "click", this.onClick.bindAsEventListener(this));
|
||||
},
|
||||
|
||||
onObserverEvent: function() {
|
||||
this.changed = false;
|
||||
this.tokenBounds = null;
|
||||
if(this.getToken().length>=this.options.minChars) {
|
||||
this.getUpdatedChoices();
|
||||
} else {
|
||||
this.active = false;
|
||||
this.hide();
|
||||
}
|
||||
this.oldElementValue = this.element.value;
|
||||
},
|
||||
|
||||
getToken: function() {
|
||||
var bounds = this.getTokenBounds();
|
||||
return this.element.value.substring(bounds[0], bounds[1]).strip();
|
||||
},
|
||||
|
||||
getTokenBounds: function() {
|
||||
if (null != this.tokenBounds) return this.tokenBounds;
|
||||
var value = this.element.value;
|
||||
if (value.strip().empty()) return [-1, 0];
|
||||
var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue);
|
||||
var offset = (diff == this.oldElementValue.length ? 1 : 0);
|
||||
var prevTokenPos = -1, nextTokenPos = value.length;
|
||||
var tp;
|
||||
for (var index = 0, l = this.options.tokens.length; index < l; ++index) {
|
||||
tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1);
|
||||
if (tp > prevTokenPos) prevTokenPos = tp;
|
||||
tp = value.indexOf(this.options.tokens[index], diff + offset);
|
||||
if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp;
|
||||
}
|
||||
return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]);
|
||||
}
|
||||
});
|
||||
|
||||
Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) {
|
||||
var boundary = Math.min(newS.length, oldS.length);
|
||||
for (var index = 0; index < boundary; ++index)
|
||||
if (newS[index] != oldS[index])
|
||||
return index;
|
||||
return boundary;
|
||||
};
|
||||
|
||||
Ajax.Autocompleter = Class.create(Autocompleter.Base, {
|
||||
initialize: function(element, update, url, options) {
|
||||
this.baseInitialize(element, update, options);
|
||||
this.options.asynchronous = true;
|
||||
this.options.onComplete = this.onComplete.bind(this);
|
||||
this.options.defaultParams = this.options.parameters || null;
|
||||
this.url = url;
|
||||
},
|
||||
|
||||
getUpdatedChoices: function() {
|
||||
this.startIndicator();
|
||||
|
||||
var entry = encodeURIComponent(this.options.paramName) + '=' +
|
||||
encodeURIComponent(this.getToken());
|
||||
|
||||
this.options.parameters = this.options.callback ?
|
||||
this.options.callback(this.element, entry) : entry;
|
||||
|
||||
if(this.options.defaultParams)
|
||||
this.options.parameters += '&' + this.options.defaultParams;
|
||||
|
||||
new Ajax.Request(this.url, this.options);
|
||||
},
|
||||
|
||||
onComplete: function(request) {
|
||||
this.updateChoices(request.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
// The local array autocompleter. Used when you'd prefer to
|
||||
// inject an array of autocompletion options into the page, rather
|
||||
// than sending out Ajax queries, which can be quite slow sometimes.
|
||||
//
|
||||
// The constructor takes four parameters. The first two are, as usual,
|
||||
// the id of the monitored textbox, and id of the autocompletion menu.
|
||||
// The third is the array you want to autocomplete from, and the fourth
|
||||
// is the options block.
|
||||
//
|
||||
// Extra local autocompletion options:
|
||||
// - choices - How many autocompletion choices to offer
|
||||
//
|
||||
// - partialSearch - If false, the autocompleter will match entered
|
||||
// text only at the beginning of strings in the
|
||||
// autocomplete array. Defaults to true, which will
|
||||
// match text at the beginning of any *word* in the
|
||||
// strings in the autocomplete array. If you want to
|
||||
// search anywhere in the string, additionally set
|
||||
// the option fullSearch to true (default: off).
|
||||
//
|
||||
// - fullSsearch - Search anywhere in autocomplete array strings.
|
||||
//
|
||||
// - partialChars - How many characters to enter before triggering
|
||||
// a partial match (unlike minChars, which defines
|
||||
// how many characters are required to do any match
|
||||
// at all). Defaults to 2.
|
||||
//
|
||||
// - ignoreCase - Whether to ignore case when autocompleting.
|
||||
// Defaults to true.
|
||||
//
|
||||
// It's possible to pass in a custom function as the 'selector'
|
||||
// option, if you prefer to write your own autocompletion logic.
|
||||
// In that case, the other options above will not apply unless
|
||||
// you support them.
|
||||
|
||||
Autocompleter.Local = Class.create(Autocompleter.Base, {
|
||||
initialize: function(element, update, array, options) {
|
||||
this.baseInitialize(element, update, options);
|
||||
this.options.array = array;
|
||||
},
|
||||
|
||||
getUpdatedChoices: function() {
|
||||
this.updateChoices(this.options.selector(this));
|
||||
},
|
||||
|
||||
setOptions: function(options) {
|
||||
this.options = Object.extend({
|
||||
choices: 10,
|
||||
partialSearch: true,
|
||||
partialChars: 2,
|
||||
ignoreCase: true,
|
||||
fullSearch: false,
|
||||
selector: function(instance) {
|
||||
var ret = []; // Beginning matches
|
||||
var partial = []; // Inside matches
|
||||
var entry = instance.getToken();
|
||||
var count = 0;
|
||||
|
||||
for (var i = 0; i < instance.options.array.length &&
|
||||
ret.length < instance.options.choices ; i++) {
|
||||
|
||||
var elem = instance.options.array[i];
|
||||
var foundPos = instance.options.ignoreCase ?
|
||||
elem.toLowerCase().indexOf(entry.toLowerCase()) :
|
||||
elem.indexOf(entry);
|
||||
|
||||
while (foundPos != -1) {
|
||||
if (foundPos == 0 && elem.length != entry.length) {
|
||||
ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
|
||||
elem.substr(entry.length) + "</li>");
|
||||
break;
|
||||
} else if (entry.length >= instance.options.partialChars &&
|
||||
instance.options.partialSearch && foundPos != -1) {
|
||||
if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
|
||||
partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" +
|
||||
elem.substr(foundPos, entry.length) + "</strong>" + elem.substr(
|
||||
foundPos + entry.length) + "</li>");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foundPos = instance.options.ignoreCase ?
|
||||
elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
|
||||
elem.indexOf(entry, foundPos + 1);
|
||||
|
||||
}
|
||||
}
|
||||
if (partial.length)
|
||||
ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
|
||||
return "<ul>" + ret.join('') + "</ul>";
|
||||
}
|
||||
}, options || { });
|
||||
}
|
||||
});
|
||||
|
||||
// AJAX in-place editor and collection editor
|
||||
// Full rewrite by Christophe Porteneuve <tdd@tddsworld.com> (April 2007).
|
||||
|
||||
// Use this if you notice weird scrolling problems on some browsers,
|
||||
// the DOM might be a bit confused when this gets called so do this
|
||||
// waits 1 ms (with setTimeout) until it does the activation
|
||||
Field.scrollFreeActivate = function(field) {
|
||||
setTimeout(function() {
|
||||
Field.activate(field);
|
||||
}, 1);
|
||||
}
|
||||
|
||||
Ajax.InPlaceEditor = Class.create({
|
||||
initialize: function(element, url, options) {
|
||||
this.url = url;
|
||||
this.element = element = $(element);
|
||||
this.prepareOptions();
|
||||
this._controls = { };
|
||||
arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!!
|
||||
Object.extend(this.options, options || { });
|
||||
if (!this.options.formId && this.element.id) {
|
||||
this.options.formId = this.element.id + '-inplaceeditor';
|
||||
if ($(this.options.formId))
|
||||
this.options.formId = '';
|
||||
}
|
||||
if (this.options.externalControl)
|
||||
this.options.externalControl = $(this.options.externalControl);
|
||||
if (!this.options.externalControl)
|
||||
this.options.externalControlOnly = false;
|
||||
this._originalBackground = this.element.getStyle('background-color') || 'transparent';
|
||||
this.element.title = this.options.clickToEditText;
|
||||
this._boundCancelHandler = this.handleFormCancellation.bind(this);
|
||||
this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this);
|
||||
this._boundFailureHandler = this.handleAJAXFailure.bind(this);
|
||||
this._boundSubmitHandler = this.handleFormSubmission.bind(this);
|
||||
this._boundWrapperHandler = this.wrapUp.bind(this);
|
||||
this.registerListeners();
|
||||
},
|
||||
checkForEscapeOrReturn: function(e) {
|
||||
if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return;
|
||||
if (Event.KEY_ESC == e.keyCode)
|
||||
this.handleFormCancellation(e);
|
||||
else if (Event.KEY_RETURN == e.keyCode)
|
||||
this.handleFormSubmission(e);
|
||||
},
|
||||
createControl: function(mode, handler, extraClasses) {
|
||||
var control = this.options[mode + 'Control'];
|
||||
var text = this.options[mode + 'Text'];
|
||||
if ('button' == control) {
|
||||
var btn = document.createElement('input');
|
||||
btn.type = 'submit';
|
||||
btn.value = text;
|
||||
btn.className = 'editor_' + mode + '_button';
|
||||
if ('cancel' == mode)
|
||||
btn.onclick = this._boundCancelHandler;
|
||||
this._form.appendChild(btn);
|
||||
this._controls[mode] = btn;
|
||||
} else if ('link' == control) {
|
||||
var link = document.createElement('a');
|
||||
link.href = '#';
|
||||
link.appendChild(document.createTextNode(text));
|
||||
link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler;
|
||||
link.className = 'editor_' + mode + '_link';
|
||||
if (extraClasses)
|
||||
link.className += ' ' + extraClasses;
|
||||
this._form.appendChild(link);
|
||||
this._controls[mode] = link;
|
||||
}
|
||||
},
|
||||
createEditField: function() {
|
||||
var text = (this.options.loadTextURL ? this.options.loadingText : this.getText());
|
||||
var fld;
|
||||
if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) {
|
||||
fld = document.createElement('input');
|
||||
fld.type = 'text';
|
||||
var size = this.options.size || this.options.cols || 0;
|
||||
if (0 < size) fld.size = size;
|
||||
} else {
|
||||
fld = document.createElement('textarea');
|
||||
fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows);
|
||||
fld.cols = this.options.cols || 40;
|
||||
}
|
||||
fld.name = this.options.paramName;
|
||||
fld.value = text; // No HTML breaks conversion anymore
|
||||
fld.className = 'editor_field';
|
||||
if (this.options.submitOnBlur)
|
||||
fld.onblur = this._boundSubmitHandler;
|
||||
this._controls.editor = fld;
|
||||
if (this.options.loadTextURL)
|
||||
this.loadExternalText();
|
||||
this._form.appendChild(this._controls.editor);
|
||||
},
|
||||
createForm: function() {
|
||||
var ipe = this;
|
||||
function addText(mode, condition) {
|
||||
var text = ipe.options['text' + mode + 'Controls'];
|
||||
if (!text || condition === false) return;
|
||||
ipe._form.appendChild(document.createTextNode(text));
|
||||
};
|
||||
this._form = $(document.createElement('form'));
|
||||
this._form.id = this.options.formId;
|
||||
this._form.addClassName(this.options.formClassName);
|
||||
this._form.onsubmit = this._boundSubmitHandler;
|
||||
this.createEditField();
|
||||
if ('textarea' == this._controls.editor.tagName.toLowerCase())
|
||||
this._form.appendChild(document.createElement('br'));
|
||||
if (this.options.onFormCustomization)
|
||||
this.options.onFormCustomization(this, this._form);
|
||||
addText('Before', this.options.okControl || this.options.cancelControl);
|
||||
this.createControl('ok', this._boundSubmitHandler);
|
||||
addText('Between', this.options.okControl && this.options.cancelControl);
|
||||
this.createControl('cancel', this._boundCancelHandler, 'editor_cancel');
|
||||
addText('After', this.options.okControl || this.options.cancelControl);
|
||||
},
|
||||
destroy: function() {
|
||||
if (this._oldInnerHTML)
|
||||
this.element.innerHTML = this._oldInnerHTML;
|
||||
this.leaveEditMode();
|
||||
this.unregisterListeners();
|
||||
},
|
||||
enterEditMode: function(e) {
|
||||
if (this._saving || this._editing) return;
|
||||
this._editing = true;
|
||||
this.triggerCallback('onEnterEditMode');
|
||||
if (this.options.externalControl)
|
||||
this.options.externalControl.hide();
|
||||
this.element.hide();
|
||||
this.createForm();
|
||||
this.element.parentNode.insertBefore(this._form, this.element);
|
||||
if (!this.options.loadTextURL)
|
||||
this.postProcessEditField();
|
||||
if (e) Event.stop(e);
|
||||
},
|
||||
enterHover: function(e) {
|
||||
if (this.options.hoverClassName)
|
||||
this.element.addClassName(this.options.hoverClassName);
|
||||
if (this._saving) return;
|
||||
this.triggerCallback('onEnterHover');
|
||||
},
|
||||
getText: function() {
|
||||
return this.element.innerHTML;
|
||||
},
|
||||
handleAJAXFailure: function(transport) {
|
||||
this.triggerCallback('onFailure', transport);
|
||||
if (this._oldInnerHTML) {
|
||||
this.element.innerHTML = this._oldInnerHTML;
|
||||
this._oldInnerHTML = null;
|
||||
}
|
||||
},
|
||||
handleFormCancellation: function(e) {
|
||||
this.wrapUp();
|
||||
if (e) Event.stop(e);
|
||||
},
|
||||
handleFormSubmission: function(e) {
|
||||
var form = this._form;
|
||||
var value = $F(this._controls.editor);
|
||||
this.prepareSubmission();
|
||||
var params = this.options.callback(form, value) || '';
|
||||
if (Object.isString(params))
|
||||
params = params.toQueryParams();
|
||||
params.editorId = this.element.id;
|
||||
if (this.options.htmlResponse) {
|
||||
var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions);
|
||||
Object.extend(options, {
|
||||
parameters: params,
|
||||
onComplete: this._boundWrapperHandler,
|
||||
onFailure: this._boundFailureHandler
|
||||
});
|
||||
new Ajax.Updater({ success: this.element }, this.url, options);
|
||||
} else {
|
||||
var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
|
||||
Object.extend(options, {
|
||||
parameters: params,
|
||||
onComplete: this._boundWrapperHandler,
|
||||
onFailure: this._boundFailureHandler
|
||||
});
|
||||
new Ajax.Request(this.url, options);
|
||||
}
|
||||
if (e) Event.stop(e);
|
||||
},
|
||||
leaveEditMode: function() {
|
||||
this.element.removeClassName(this.options.savingClassName);
|
||||
this.removeForm();
|
||||
this.leaveHover();
|
||||
this.element.style.backgroundColor = this._originalBackground;
|
||||
this.element.show();
|
||||
if (this.options.externalControl)
|
||||
this.options.externalControl.show();
|
||||
this._saving = false;
|
||||
this._editing = false;
|
||||
this._oldInnerHTML = null;
|
||||
this.triggerCallback('onLeaveEditMode');
|
||||
},
|
||||
leaveHover: function(e) {
|
||||
if (this.options.hoverClassName)
|
||||
this.element.removeClassName(this.options.hoverClassName);
|
||||
if (this._saving) return;
|
||||
this.triggerCallback('onLeaveHover');
|
||||
},
|
||||
loadExternalText: function() {
|
||||
this._form.addClassName(this.options.loadingClassName);
|
||||
this._controls.editor.disabled = true;
|
||||
var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
|
||||
Object.extend(options, {
|
||||
parameters: 'editorId=' + encodeURIComponent(this.element.id),
|
||||
onComplete: Prototype.emptyFunction,
|
||||
onSuccess: function(transport) {
|
||||
this._form.removeClassName(this.options.loadingClassName);
|
||||
var text = transport.responseText;
|
||||
if (this.options.stripLoadedTextTags)
|
||||
text = text.stripTags();
|
||||
this._controls.editor.value = text;
|
||||
this._controls.editor.disabled = false;
|
||||
this.postProcessEditField();
|
||||
}.bind(this),
|
||||
onFailure: this._boundFailureHandler
|
||||
});
|
||||
new Ajax.Request(this.options.loadTextURL, options);
|
||||
},
|
||||
postProcessEditField: function() {
|
||||
var fpc = this.options.fieldPostCreation;
|
||||
if (fpc)
|
||||
$(this._controls.editor)['focus' == fpc ? 'focus' : 'activate']();
|
||||
},
|
||||
prepareOptions: function() {
|
||||
this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions);
|
||||
Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks);
|
||||
[this._extraDefaultOptions].flatten().compact().each(function(defs) {
|
||||
Object.extend(this.options, defs);
|
||||
}.bind(this));
|
||||
},
|
||||
prepareSubmission: function() {
|
||||
this._saving = true;
|
||||
this.removeForm();
|
||||
this.leaveHover();
|
||||
this.showSaving();
|
||||
},
|
||||
registerListeners: function() {
|
||||
this._listeners = { };
|
||||
var listener;
|
||||
$H(Ajax.InPlaceEditor.Listeners).each(function(pair) {
|
||||
listener = this[pair.value].bind(this);
|
||||
this._listeners[pair.key] = listener;
|
||||
if (!this.options.externalControlOnly)
|
||||
this.element.observe(pair.key, listener);
|
||||
if (this.options.externalControl)
|
||||
this.options.externalControl.observe(pair.key, listener);
|
||||
}.bind(this));
|
||||
},
|
||||
removeForm: function() {
|
||||
if (!this._form) return;
|
||||
this._form.remove();
|
||||
this._form = null;
|
||||
this._controls = { };
|
||||
},
|
||||
showSaving: function() {
|
||||
this._oldInnerHTML = this.element.innerHTML;
|
||||
this.element.innerHTML = this.options.savingText;
|
||||
this.element.addClassName(this.options.savingClassName);
|
||||
this.element.style.backgroundColor = this._originalBackground;
|
||||
this.element.show();
|
||||
},
|
||||
triggerCallback: function(cbName, arg) {
|
||||
if ('function' == typeof this.options[cbName]) {
|
||||
this.options[cbName](this, arg);
|
||||
}
|
||||
},
|
||||
unregisterListeners: function() {
|
||||
$H(this._listeners).each(function(pair) {
|
||||
if (!this.options.externalControlOnly)
|
||||
this.element.stopObserving(pair.key, pair.value);
|
||||
if (this.options.externalControl)
|
||||
this.options.externalControl.stopObserving(pair.key, pair.value);
|
||||
}.bind(this));
|
||||
},
|
||||
wrapUp: function(transport) {
|
||||
this.leaveEditMode();
|
||||
// Can't use triggerCallback due to backward compatibility: requires
|
||||
// binding + direct element
|
||||
this._boundComplete(transport, this.element);
|
||||
}
|
||||
});
|
||||
|
||||
Object.extend(Ajax.InPlaceEditor.prototype, {
|
||||
dispose: Ajax.InPlaceEditor.prototype.destroy
|
||||
});
|
||||
|
||||
Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, {
|
||||
initialize: function($super, element, url, options) {
|
||||
this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions;
|
||||
$super(element, url, options);
|
||||
},
|
||||
|
||||
createEditField: function() {
|
||||
var list = document.createElement('select');
|
||||
list.name = this.options.paramName;
|
||||
list.size = 1;
|
||||
this._controls.editor = list;
|
||||
this._collection = this.options.collection || [];
|
||||
if (this.options.loadCollectionURL)
|
||||
this.loadCollection();
|
||||
else
|
||||
this.checkForExternalText();
|
||||
this._form.appendChild(this._controls.editor);
|
||||
},
|
||||
|
||||
loadCollection: function() {
|
||||
this._form.addClassName(this.options.loadingClassName);
|
||||
this.showLoadingText(this.options.loadingCollectionText);
|
||||
var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
|
||||
Object.extend(options, {
|
||||
parameters: 'editorId=' + encodeURIComponent(this.element.id),
|
||||
onComplete: Prototype.emptyFunction,
|
||||
onSuccess: function(transport) {
|
||||
var js = transport.responseText.strip();
|
||||
if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
|
||||
throw 'Server returned an invalid collection representation.';
|
||||
this._collection = eval(js);
|
||||
this.checkForExternalText();
|
||||
}.bind(this),
|
||||
onFailure: this.onFailure
|
||||
});
|
||||
new Ajax.Request(this.options.loadCollectionURL, options);
|
||||
},
|
||||
|
||||
showLoadingText: function(text) {
|
||||
this._controls.editor.disabled = true;
|
||||
var tempOption = this._controls.editor.firstChild;
|
||||
if (!tempOption) {
|
||||
tempOption = document.createElement('option');
|
||||
tempOption.value = '';
|
||||
this._controls.editor.appendChild(tempOption);
|
||||
tempOption.selected = true;
|
||||
}
|
||||
tempOption.update((text || '').stripScripts().stripTags());
|
||||
},
|
||||
|
||||
checkForExternalText: function() {
|
||||
this._text = this.getText();
|
||||
if (this.options.loadTextURL)
|
||||
this.loadExternalText();
|
||||
else
|
||||
this.buildOptionList();
|
||||
},
|
||||
|
||||
loadExternalText: function() {
|
||||
this.showLoadingText(this.options.loadingText);
|
||||
var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
|
||||
Object.extend(options, {
|
||||
parameters: 'editorId=' + encodeURIComponent(this.element.id),
|
||||
onComplete: Prototype.emptyFunction,
|
||||
onSuccess: function(transport) {
|
||||
this._text = transport.responseText.strip();
|
||||
this.buildOptionList();
|
||||
}.bind(this),
|
||||
onFailure: this.onFailure
|
||||
});
|
||||
new Ajax.Request(this.options.loadTextURL, options);
|
||||
},
|
||||
|
||||
buildOptionList: function() {
|
||||
this._form.removeClassName(this.options.loadingClassName);
|
||||
this._collection = this._collection.map(function(entry) {
|
||||
return 2 === entry.length ? entry : [entry, entry].flatten();
|
||||
});
|
||||
var marker = ('value' in this.options) ? this.options.value : this._text;
|
||||
var textFound = this._collection.any(function(entry) {
|
||||
return entry[0] == marker;
|
||||
}.bind(this));
|
||||
this._controls.editor.update('');
|
||||
var option;
|
||||
this._collection.each(function(entry, index) {
|
||||
option = document.createElement('option');
|
||||
option.value = entry[0];
|
||||
option.selected = textFound ? entry[0] == marker : 0 == index;
|
||||
option.appendChild(document.createTextNode(entry[1]));
|
||||
this._controls.editor.appendChild(option);
|
||||
}.bind(this));
|
||||
this._controls.editor.disabled = false;
|
||||
Field.scrollFreeActivate(this._controls.editor);
|
||||
}
|
||||
});
|
||||
|
||||
//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! ****
|
||||
//**** This only exists for a while, in order to let ****
|
||||
//**** users adapt to the new API. Read up on the new ****
|
||||
//**** API and convert your code to it ASAP! ****
|
||||
|
||||
Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) {
|
||||
if (!options) return;
|
||||
function fallback(name, expr) {
|
||||
if (name in options || expr === undefined) return;
|
||||
options[name] = expr;
|
||||
};
|
||||
fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' :
|
||||
options.cancelLink == options.cancelButton == false ? false : undefined)));
|
||||
fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' :
|
||||
options.okLink == options.okButton == false ? false : undefined)));
|
||||
fallback('highlightColor', options.highlightcolor);
|
||||
fallback('highlightEndColor', options.highlightendcolor);
|
||||
};
|
||||
|
||||
Object.extend(Ajax.InPlaceEditor, {
|
||||
DefaultOptions: {
|
||||
ajaxOptions: { },
|
||||
autoRows: 3, // Use when multi-line w/ rows == 1
|
||||
cancelControl: 'link', // 'link'|'button'|false
|
||||
cancelText: 'cancel',
|
||||
clickToEditText: 'Click to edit',
|
||||
externalControl: null, // id|elt
|
||||
externalControlOnly: false,
|
||||
fieldPostCreation: 'activate', // 'activate'|'focus'|false
|
||||
formClassName: 'inplaceeditor-form',
|
||||
formId: null, // id|elt
|
||||
highlightColor: '#ffff99',
|
||||
highlightEndColor: '#ffffff',
|
||||
hoverClassName: '',
|
||||
htmlResponse: true,
|
||||
loadingClassName: 'inplaceeditor-loading',
|
||||
loadingText: 'Loading...',
|
||||
okControl: 'button', // 'link'|'button'|false
|
||||
okText: 'ok',
|
||||
paramName: 'value',
|
||||
rows: 1, // If 1 and multi-line, uses autoRows
|
||||
savingClassName: 'inplaceeditor-saving',
|
||||
savingText: 'Saving...',
|
||||
size: 0,
|
||||
stripLoadedTextTags: false,
|
||||
submitOnBlur: false,
|
||||
textAfterControls: '',
|
||||
textBeforeControls: '',
|
||||
textBetweenControls: ''
|
||||
},
|
||||
DefaultCallbacks: {
|
||||
callback: function(form) {
|
||||
return Form.serialize(form);
|
||||
},
|
||||
onComplete: function(transport, element) {
|
||||
// For backward compatibility, this one is bound to the IPE, and passes
|
||||
// the element directly. It was too often customized, so we don't break it.
|
||||
new Effect.Highlight(element, {
|
||||
startcolor: this.options.highlightColor, keepBackgroundImage: true });
|
||||
},
|
||||
onEnterEditMode: null,
|
||||
onEnterHover: function(ipe) {
|
||||
ipe.element.style.backgroundColor = ipe.options.highlightColor;
|
||||
if (ipe._effect)
|
||||
ipe._effect.cancel();
|
||||
},
|
||||
onFailure: function(transport, ipe) {
|
||||
alert('Error communication with the server: ' + transport.responseText.stripTags());
|
||||
},
|
||||
onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls.
|
||||
onLeaveEditMode: null,
|
||||
onLeaveHover: function(ipe) {
|
||||
ipe._effect = new Effect.Highlight(ipe.element, {
|
||||
startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor,
|
||||
restorecolor: ipe._originalBackground, keepBackgroundImage: true
|
||||
});
|
||||
}
|
||||
},
|
||||
Listeners: {
|
||||
click: 'enterEditMode',
|
||||
keydown: 'checkForEscapeOrReturn',
|
||||
mouseover: 'enterHover',
|
||||
mouseout: 'leaveHover'
|
||||
}
|
||||
});
|
||||
|
||||
Ajax.InPlaceCollectionEditor.DefaultOptions = {
|
||||
loadingCollectionText: 'Loading options...'
|
||||
};
|
||||
|
||||
// Delayed observer, like Form.Element.Observer,
|
||||
// but waits for delay after last key input
|
||||
// Ideal for live-search fields
|
||||
|
||||
Form.Element.DelayedObserver = Class.create({
|
||||
initialize: function(element, delay, callback) {
|
||||
this.delay = delay || 0.5;
|
||||
this.element = $(element);
|
||||
this.callback = callback;
|
||||
this.timer = null;
|
||||
this.lastValue = $F(this.element);
|
||||
Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
|
||||
},
|
||||
delayedListener: function(event) {
|
||||
if(this.lastValue == $F(this.element)) return;
|
||||
if(this.timer) clearTimeout(this.timer);
|
||||
this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
|
||||
this.lastValue = $F(this.element);
|
||||
},
|
||||
onTimerEvent: function() {
|
||||
this.timer = null;
|
||||
this.callback(this.element, $F(this.element));
|
||||
}
|
||||
});
|
1120
templates/html/assets/javascripts/effects.js
vendored
4874
templates/html/assets/javascripts/prototype.js
vendored
@ -1,506 +0,0 @@
|
||||
/**
|
||||
* @author Ryan Johnson <http://syntacticx.com/>
|
||||
* @copyright 2008 PersonalGrid Corporation <http://personalgrid.com/>
|
||||
* @package LivePipe UI
|
||||
* @license MIT
|
||||
* @url http://livepipe.net/core
|
||||
* @require prototype.js
|
||||
*/
|
||||
|
||||
if(typeof(Control) == 'undefined')
|
||||
Control = {};
|
||||
|
||||
var $proc = function(proc){
|
||||
return typeof(proc) == 'function' ? proc : function(){return proc};
|
||||
};
|
||||
|
||||
var $value = function(value){
|
||||
return typeof(value) == 'function' ? value() : value;
|
||||
};
|
||||
|
||||
Object.Event = {
|
||||
extend: function(object){
|
||||
object._objectEventSetup = function(event_name){
|
||||
this._observers = this._observers || {};
|
||||
this._observers[event_name] = this._observers[event_name] || [];
|
||||
};
|
||||
object.observe = function(event_name,observer){
|
||||
if(typeof(event_name) == 'string' && typeof(observer) != 'undefined'){
|
||||
this._objectEventSetup(event_name);
|
||||
if(!this._observers[event_name].include(observer))
|
||||
this._observers[event_name].push(observer);
|
||||
}else
|
||||
for(var e in event_name)
|
||||
this.observe(e,event_name[e]);
|
||||
};
|
||||
object.stopObserving = function(event_name,observer){
|
||||
this._objectEventSetup(event_name);
|
||||
if(event_name && observer)
|
||||
this._observers[event_name] = this._observers[event_name].without(observer);
|
||||
else if(event_name)
|
||||
this._observers[event_name] = [];
|
||||
else
|
||||
this._observers = {};
|
||||
};
|
||||
object.observeOnce = function(event_name,outer_observer){
|
||||
var inner_observer = function(){
|
||||
outer_observer.apply(this,arguments);
|
||||
this.stopObserving(event_name,inner_observer);
|
||||
}.bind(this);
|
||||
this._objectEventSetup(event_name);
|
||||
this._observers[event_name].push(inner_observer);
|
||||
};
|
||||
object.notify = function(event_name){
|
||||
this._objectEventSetup(event_name);
|
||||
var collected_return_values = [];
|
||||
var args = $A(arguments).slice(1);
|
||||
try{
|
||||
for(var i = 0; i < this._observers[event_name].length; ++i)
|
||||
collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args) || null);
|
||||
}catch(e){
|
||||
if(e == $break)
|
||||
return false;
|
||||
else
|
||||
throw e;
|
||||
}
|
||||
return collected_return_values;
|
||||
};
|
||||
if(object.prototype){
|
||||
object.prototype._objectEventSetup = object._objectEventSetup;
|
||||
object.prototype.observe = object.observe;
|
||||
object.prototype.stopObserving = object.stopObserving;
|
||||
object.prototype.observeOnce = object.observeOnce;
|
||||
object.prototype.notify = function(event_name){
|
||||
if(object.notify){
|
||||
var args = $A(arguments).slice(1);
|
||||
args.unshift(this);
|
||||
args.unshift(event_name);
|
||||
object.notify.apply(object,args);
|
||||
}
|
||||
this._objectEventSetup(event_name);
|
||||
var args = $A(arguments).slice(1);
|
||||
var collected_return_values = [];
|
||||
try{
|
||||
if(this.options && this.options[event_name] && typeof(this.options[event_name]) == 'function')
|
||||
collected_return_values.push(this.options[event_name].apply(this,args) || null);
|
||||
for(var i = 0; i < this._observers[event_name].length; ++i)
|
||||
collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args) || null);
|
||||
}catch(e){
|
||||
if(e == $break)
|
||||
return false;
|
||||
else
|
||||
throw e;
|
||||
}
|
||||
return collected_return_values;
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* Begin Core Extensions */
|
||||
|
||||
//Element.observeOnce
|
||||
Element.addMethods({
|
||||
observeOnce: function(element,event_name,outer_callback){
|
||||
var inner_callback = function(){
|
||||
outer_callback.apply(this,arguments);
|
||||
Element.stopObserving(element,event_name,inner_callback);
|
||||
};
|
||||
Element.observe(element,event_name,inner_callback);
|
||||
}
|
||||
});
|
||||
|
||||
//mouseenter, mouseleave
|
||||
//from http://dev.rubyonrails.org/attachment/ticket/8354/event_mouseenter_106rc1.patch
|
||||
Object.extend(Event, (function() {
|
||||
var cache = Event.cache;
|
||||
|
||||
function getEventID(element) {
|
||||
if (element._prototypeEventID) return element._prototypeEventID[0];
|
||||
arguments.callee.id = arguments.callee.id || 1;
|
||||
return element._prototypeEventID = [++arguments.callee.id];
|
||||
}
|
||||
|
||||
function getDOMEventName(eventName) {
|
||||
if (eventName && eventName.include(':')) return "dataavailable";
|
||||
//begin extension
|
||||
if(!Prototype.Browser.IE){
|
||||
eventName = {
|
||||
mouseenter: 'mouseover',
|
||||
mouseleave: 'mouseout'
|
||||
}[eventName] || eventName;
|
||||
}
|
||||
//end extension
|
||||
return eventName;
|
||||
}
|
||||
|
||||
function getCacheForID(id) {
|
||||
return cache[id] = cache[id] || { };
|
||||
}
|
||||
|
||||
function getWrappersForEventName(id, eventName) {
|
||||
var c = getCacheForID(id);
|
||||
return c[eventName] = c[eventName] || [];
|
||||
}
|
||||
|
||||
function createWrapper(element, eventName, handler) {
|
||||
var id = getEventID(element);
|
||||
var c = getWrappersForEventName(id, eventName);
|
||||
if (c.pluck("handler").include(handler)) return false;
|
||||
|
||||
var wrapper = function(event) {
|
||||
if (!Event || !Event.extend ||
|
||||
(event.eventName && event.eventName != eventName))
|
||||
return false;
|
||||
|
||||
Event.extend(event);
|
||||
handler.call(element, event);
|
||||
};
|
||||
|
||||
//begin extension
|
||||
if(!(Prototype.Browser.IE) && ['mouseenter','mouseleave'].include(eventName)){
|
||||
wrapper = wrapper.wrap(function(proceed,event) {
|
||||
var rel = event.relatedTarget;
|
||||
var cur = event.currentTarget;
|
||||
if(rel && rel.nodeType == Node.TEXT_NODE)
|
||||
rel = rel.parentNode;
|
||||
if(rel && rel != cur && !rel.descendantOf(cur))
|
||||
return proceed(event);
|
||||
});
|
||||
}
|
||||
//end extension
|
||||
|
||||
wrapper.handler = handler;
|
||||
c.push(wrapper);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
function findWrapper(id, eventName, handler) {
|
||||
var c = getWrappersForEventName(id, eventName);
|
||||
return c.find(function(wrapper) { return wrapper.handler == handler });
|
||||
}
|
||||
|
||||
function destroyWrapper(id, eventName, handler) {
|
||||
var c = getCacheForID(id);
|
||||
if (!c[eventName]) return false;
|
||||
c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
|
||||
}
|
||||
|
||||
function destroyCache() {
|
||||
for (var id in cache)
|
||||
for (var eventName in cache[id])
|
||||
cache[id][eventName] = null;
|
||||
}
|
||||
|
||||
if (window.attachEvent) {
|
||||
window.attachEvent("onunload", destroyCache);
|
||||
}
|
||||
|
||||
return {
|
||||
observe: function(element, eventName, handler) {
|
||||
element = $(element);
|
||||
var name = getDOMEventName(eventName);
|
||||
|
||||
var wrapper = createWrapper(element, eventName, handler);
|
||||
if (!wrapper) return element;
|
||||
|
||||
if (element.addEventListener) {
|
||||
element.addEventListener(name, wrapper, false);
|
||||
} else {
|
||||
element.attachEvent("on" + name, wrapper);
|
||||
}
|
||||
|
||||
return element;
|
||||
},
|
||||
|
||||
stopObserving: function(element, eventName, handler) {
|
||||
element = $(element);
|
||||
var id = getEventID(element), name = getDOMEventName(eventName);
|
||||
|
||||
if (!handler && eventName) {
|
||||
getWrappersForEventName(id, eventName).each(function(wrapper) {
|
||||
element.stopObserving(eventName, wrapper.handler);
|
||||
});
|
||||
return element;
|
||||
|
||||
} else if (!eventName) {
|
||||
Object.keys(getCacheForID(id)).each(function(eventName) {
|
||||
element.stopObserving(eventName);
|
||||
});
|
||||
return element;
|
||||
}
|
||||
|
||||
var wrapper = findWrapper(id, eventName, handler);
|
||||
if (!wrapper) return element;
|
||||
|
||||
if (element.removeEventListener) {
|
||||
element.removeEventListener(name, wrapper, false);
|
||||
} else {
|
||||
element.detachEvent("on" + name, wrapper);
|
||||
}
|
||||
|
||||
destroyWrapper(id, eventName, handler);
|
||||
|
||||
return element;
|
||||
},
|
||||
|
||||
fire: function(element, eventName, memo) {
|
||||
element = $(element);
|
||||
if (element == document && document.createEvent && !element.dispatchEvent)
|
||||
element = document.documentElement;
|
||||
|
||||
var event;
|
||||
if (document.createEvent) {
|
||||
event = document.createEvent("HTMLEvents");
|
||||
event.initEvent("dataavailable", true, true);
|
||||
} else {
|
||||
event = document.createEventObject();
|
||||
event.eventType = "ondataavailable";
|
||||
}
|
||||
|
||||
event.eventName = eventName;
|
||||
event.memo = memo || { };
|
||||
|
||||
if (document.createEvent) {
|
||||
element.dispatchEvent(event);
|
||||
} else {
|
||||
element.fireEvent(event.eventType, event);
|
||||
}
|
||||
|
||||
return Event.extend(event);
|
||||
}
|
||||
};
|
||||
})());
|
||||
|
||||
Object.extend(Event, Event.Methods);
|
||||
|
||||
Element.addMethods({
|
||||
fire: Event.fire,
|
||||
observe: Event.observe,
|
||||
stopObserving: Event.stopObserving
|
||||
});
|
||||
|
||||
Object.extend(document, {
|
||||
fire: Element.Methods.fire.methodize(),
|
||||
observe: Element.Methods.observe.methodize(),
|
||||
stopObserving: Element.Methods.stopObserving.methodize()
|
||||
});
|
||||
|
||||
//mouse:wheel
|
||||
(function(){
|
||||
function wheel(event){
|
||||
var delta;
|
||||
// normalize the delta
|
||||
if(event.wheelDelta) // IE & Opera
|
||||
delta = event.wheelDelta / 120;
|
||||
else if (event.detail) // W3C
|
||||
delta =- event.detail / 3;
|
||||
if(!delta)
|
||||
return;
|
||||
var custom_event = Event.element(event).fire('mouse:wheel',{
|
||||
delta: delta
|
||||
});
|
||||
if(custom_event.stopped){
|
||||
Event.stop(event);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
document.observe('mousewheel',wheel);
|
||||
document.observe('DOMMouseScroll',wheel);
|
||||
})();
|
||||
|
||||
/* End Core Extensions */
|
||||
|
||||
//from PrototypeUI
|
||||
var IframeShim = Class.create({
|
||||
initialize: function() {
|
||||
this.element = new Element('iframe',{
|
||||
style: 'position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none',
|
||||
src: 'javascript:void(0);',
|
||||
frameborder: 0
|
||||
});
|
||||
$(document.body).insert(this.element);
|
||||
},
|
||||
hide: function() {
|
||||
this.element.hide();
|
||||
return this;
|
||||
},
|
||||
show: function() {
|
||||
this.element.show();
|
||||
return this;
|
||||
},
|
||||
positionUnder: function(element) {
|
||||
var element = $(element);
|
||||
var offset = element.cumulativeOffset();
|
||||
var dimensions = element.getDimensions();
|
||||
this.element.setStyle({
|
||||
left: offset[0] + 'px',
|
||||
top: offset[1] + 'px',
|
||||
width: dimensions.width + 'px',
|
||||
height: dimensions.height + 'px',
|
||||
zIndex: element.getStyle('zIndex') - 1
|
||||
}).show();
|
||||
return this;
|
||||
},
|
||||
setBounds: function(bounds) {
|
||||
for(prop in bounds)
|
||||
bounds[prop] += 'px';
|
||||
this.element.setStyle(bounds);
|
||||
return this;
|
||||
},
|
||||
destroy: function() {
|
||||
if(this.element)
|
||||
this.element.remove();
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @author Ryan Johnson <http://syntacticx.com/>
|
||||
* @copyright 2008 PersonalGrid Corporation <http://personalgrid.com/>
|
||||
* @package LivePipe UI
|
||||
* @license MIT
|
||||
* @url http://livepipe.net/control/tabs
|
||||
* @require prototype.js, livepipe.js
|
||||
*/
|
||||
|
||||
/*global window, document, Prototype, $, $A, $H, $break, Class, Element, Event, Control */
|
||||
|
||||
if(typeof(Prototype) == "undefined") {
|
||||
throw "Control.Tabs requires Prototype to be loaded."; }
|
||||
if(typeof(Object.Event) == "undefined") {
|
||||
throw "Control.Tabs requires Object.Event to be loaded."; }
|
||||
|
||||
Control.Tabs = Class.create({
|
||||
initialize: function(tab_list_container,options){
|
||||
if(!$(tab_list_container)) {
|
||||
throw "Control.Tabs could not find the element: " + tab_list_container; }
|
||||
this.activeContainer = false;
|
||||
this.activeLink = false;
|
||||
this.containers = $H({});
|
||||
this.links = [];
|
||||
Control.Tabs.instances.push(this);
|
||||
this.options = {
|
||||
beforeChange: Prototype.emptyFunction,
|
||||
afterChange: Prototype.emptyFunction,
|
||||
hover: false,
|
||||
linkSelector: 'li a',
|
||||
setClassOnContainer: false,
|
||||
activeClassName: 'active',
|
||||
defaultTab: 'first',
|
||||
autoLinkExternal: true,
|
||||
targetRegExp: /#(.+)$/,
|
||||
showFunction: Element.show,
|
||||
hideFunction: Element.hide
|
||||
};
|
||||
Object.extend(this.options,options || {});
|
||||
(typeof(this.options.linkSelector == 'string') ?
|
||||
$(tab_list_container).select(this.options.linkSelector) :
|
||||
this.options.linkSelector($(tab_list_container))
|
||||
).findAll(function(link){
|
||||
return (/^#/).exec((Prototype.Browser.WebKit ? decodeURIComponent(link.href) : link.href).replace(window.location.href.split('#')[0],''));
|
||||
}).each(function(link){
|
||||
this.addTab(link);
|
||||
}.bind(this));
|
||||
this.containers.values().each(Element.hide);
|
||||
if(this.options.defaultTab == 'first') {
|
||||
this.setActiveTab(this.links.first());
|
||||
} else if(this.options.defaultTab == 'last') {
|
||||
this.setActiveTab(this.links.last());
|
||||
} else {
|
||||
this.setActiveTab(this.options.defaultTab); }
|
||||
var targets = this.options.targetRegExp.exec(window.location);
|
||||
if(targets && targets[1]){
|
||||
targets[1].split(',').each(function(target){
|
||||
this.setActiveTab(this.links.find(function(link){
|
||||
return link.key == target;
|
||||
}));
|
||||
}.bind(this));
|
||||
}
|
||||
if(this.options.autoLinkExternal){
|
||||
$A(document.getElementsByTagName('a')).each(function(a){
|
||||
if(!this.links.include(a)){
|
||||
var clean_href = a.href.replace(window.location.href.split('#')[0],'');
|
||||
if(clean_href.substring(0,1) == '#'){
|
||||
if(this.containers.keys().include(clean_href.substring(1))){
|
||||
$(a).observe('click',function(event,clean_href){
|
||||
this.setActiveTab(clean_href.substring(1));
|
||||
}.bindAsEventListener(this,clean_href));
|
||||
}
|
||||
}
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
},
|
||||
addTab: function(link){
|
||||
this.links.push(link);
|
||||
link.key = link.getAttribute('href').replace(window.location.href.split('#')[0],'').split('#').last().replace(/#/,'');
|
||||
var container = $(link.key);
|
||||
if(!container) {
|
||||
throw "Control.Tabs: #" + link.key + " was not found on the page."; }
|
||||
this.containers.set(link.key,container);
|
||||
link[this.options.hover ? 'onmouseover' : 'onclick'] = function(link){
|
||||
if(window.event) {
|
||||
Event.stop(window.event); }
|
||||
this.setActiveTab(link);
|
||||
return false;
|
||||
}.bind(this,link);
|
||||
},
|
||||
setActiveTab: function(link){
|
||||
if(!link && typeof(link) == 'undefined') {
|
||||
return; }
|
||||
if(typeof(link) == 'string'){
|
||||
this.setActiveTab(this.links.find(function(_link){
|
||||
return _link.key == link;
|
||||
}));
|
||||
}else if(typeof(link) == 'number'){
|
||||
this.setActiveTab(this.links[link]);
|
||||
}else{
|
||||
if(this.notify('beforeChange',this.activeContainer,this.containers.get(link.key)) === false) {
|
||||
return; }
|
||||
if(this.activeContainer) {
|
||||
this.options.hideFunction(this.activeContainer); }
|
||||
this.links.each(function(item){
|
||||
(this.options.setClassOnContainer ? $(item.parentNode) : item).removeClassName(this.options.activeClassName);
|
||||
}.bind(this));
|
||||
(this.options.setClassOnContainer ? $(link.parentNode) : link).addClassName(this.options.activeClassName);
|
||||
this.activeContainer = this.containers.get(link.key);
|
||||
this.activeLink = link;
|
||||
this.options.showFunction(this.containers.get(link.key));
|
||||
this.notify('afterChange',this.containers.get(link.key));
|
||||
}
|
||||
},
|
||||
next: function(){
|
||||
this.links.each(function(link,i){
|
||||
if(this.activeLink == link && this.links[i + 1]){
|
||||
this.setActiveTab(this.links[i + 1]);
|
||||
throw $break;
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
previous: function(){
|
||||
this.links.each(function(link,i){
|
||||
if(this.activeLink == link && this.links[i - 1]){
|
||||
this.setActiveTab(this.links[i - 1]);
|
||||
throw $break;
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
first: function(){
|
||||
this.setActiveTab(this.links.first());
|
||||
},
|
||||
last: function(){
|
||||
this.setActiveTab(this.links.last());
|
||||
}
|
||||
});
|
||||
Object.extend(Control.Tabs,{
|
||||
instances: [],
|
||||
findByTabId: function(id){
|
||||
return Control.Tabs.instances.find(function(tab){
|
||||
return tab.links.find(function(link){
|
||||
return link.key == id;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
Object.Event.extend(Control.Tabs);
|
@ -1,694 +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;
|
||||
}
|
||||
|
||||
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: "Panic Sans", "Bitstream Vera Sans Mono", Monaco, Consolas, Andale Mono, monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#page a.img,
|
||||
#page a.img:link,
|
||||
#page a.img:visited {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-left: 120px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
#page {
|
||||
margin: 0;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: 241px;
|
||||
overflow-y: scroll;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
|
||||
/* 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 {
|
||||
float: left;
|
||||
list-style-type: none;
|
||||
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 {
|
||||
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;
|
||||
}
|
||||
|
||||
li.method-description {
|
||||
margin: 0 0 2.0em;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.method-description h4 {
|
||||
margin: 0 0 0.6em;
|
||||
line-height: 90%;
|
||||
}
|
||||
|
||||
.method-description p {
|
||||
margin: 0.8em 0;
|
||||
}
|
||||
|
||||
|
||||
.method-description .method-permalink a {
|
||||
color: #aaa;
|
||||
text-decoration: none;
|
||||
border-bottom: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
h4.inherited {
|
||||
clear: left;
|
||||
font-size: 15px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
pre.syntax {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
ul.argument-list {
|
||||
font-size: 12px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
ul.argument-list li {
|
||||
line-height: 140%;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
ul.argument-list li code {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
ul.argument-list .argument-name {
|
||||
background-color: #eeffee;
|
||||
border-color: #6b6;
|
||||
}
|
||||
|
||||
|
||||
/* SECTION ICONS */
|
||||
|
||||
.page-content .section .section-title h3 {
|
||||
padding-right: 24px;
|
||||
background-position: right 0;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.section-constructor .section-title h3 {
|
||||
background-image: url(../images/constructor.png);
|
||||
}
|
||||
|
||||
.section-method-list .section-title h3 {
|
||||
background-image: url(../images/method.png);
|
||||
}
|
||||
|
||||
.section-klass_methods .section-title h3 {
|
||||
background-image: url(../images/class_method.png);
|
||||
}
|
||||
|
||||
.section-klass_properties .section-title h3 {
|
||||
background-image: url(../images/class_property.png);
|
||||
}
|
||||
|
||||
.section-instance_methods .section-title h3 {
|
||||
background-image: url(../images/instance_method.png);
|
||||
}
|
||||
|
||||
.section-instance_properties .section-title h3 {
|
||||
background-image: url(../images/instance_property.png);
|
||||
}
|
||||
|
||||
.section-mixins .section-title h3 {
|
||||
background-image: url(../images/mixin.png);
|
||||
}
|
||||
|
||||
.section-classes .section-title h3 {
|
||||
background-image: url(../images/class.png);
|
||||
}
|
||||
|
||||
.section-namespaces .section-title h3 {
|
||||
background-image: url(../images/namespace.png);
|
||||
}
|
||||
|
||||
.section-sections .section-title h3 {
|
||||
background-image: url(../images/section.png);
|
||||
}
|
||||
|
||||
.section-utilities .section-title h3 {
|
||||
background-image: url(../images/utility.png);
|
||||
}
|
||||
|
||||
.section-description .section-title h3 {
|
||||
background-image: url(../images/description.png);
|
||||
}
|
||||
|
||||
.section-subclasses .section-title h3 {
|
||||
background-image: url(../images/subclass.png);
|
||||
}
|
||||
|
||||
.section-superclass .section-title h3 {
|
||||
background-image: url(../images/superclass.png);
|
||||
}
|
||||
|
||||
/* notes */
|
||||
|
||||
p.note,
|
||||
p.alias,
|
||||
p.related-to {
|
||||
font-size: 11px;
|
||||
line-height: 14px;
|
||||
padding: 5px 20px 5px 60px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 20px 50%;
|
||||
border: 1px solid #000;
|
||||
}
|
||||
|
||||
p.note {
|
||||
background-color: #f0f0f4;
|
||||
background-image: url(../images/information.png);
|
||||
border-color: #69c;
|
||||
}
|
||||
|
||||
p.alias {
|
||||
background-color: #fff6de;
|
||||
background-image: url(../images/alias.png);
|
||||
border-color: #cc9;
|
||||
}
|
||||
|
||||
p.related-to {
|
||||
background-color: #f4f0f4;
|
||||
background-image: url(../images/related_to.png);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,32 +0,0 @@
|
||||
module PDoc
|
||||
module Generators
|
||||
module Html
|
||||
module Helpers
|
||||
module BaseHelper
|
||||
end
|
||||
|
||||
module LinkHelper
|
||||
end
|
||||
|
||||
module CodeHelper
|
||||
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
|
@ -1,24 +0,0 @@
|
||||
<% @title = "Home" %>
|
||||
|
||||
<div class="page-introduction">
|
||||
<%= @index_page_content %>
|
||||
</div> <!-- .section -->
|
||||
|
||||
<div class="section section-sections">
|
||||
<div class="section-title">
|
||||
<h3>Sections</h3>
|
||||
</div> <!-- .section-title -->
|
||||
|
||||
<div class="section-content">
|
||||
<ul class="section-list">
|
||||
<% @root.sections.each do |section| %>
|
||||
<li>
|
||||
<h4>
|
||||
<a href="<%= path_to_section(section) %>"><%= section.name %></a>
|
||||
</h4>
|
||||
<p><%= htmlize(section.short_description) %></p>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div> <!-- .section-content -->
|
||||
</div> <!-- .section -->
|
@ -1,6 +0,0 @@
|
||||
if (!window.PDoc) window.PDoc = {};
|
||||
PDoc.elements = {
|
||||
<%= @root.map { |e, i|
|
||||
"'#{e.full_name}': { 'name': '#{e.full_name}', 'type': '#{e.type}', 'path': '#{path_to(e)}' }" }.join(",\n")
|
||||
%>
|
||||
};
|
@ -1,86 +0,0 @@
|
||||
<!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" %>
|
||||
<%= 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 -->
|
||||
|
||||
|
||||
<div id="page">
|
||||
<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 %>
|
||||
|
||||
</div> <!-- #main -->
|
||||
|
||||
<div id="footer">
|
||||
<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">
|
||||
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> <!-- .content -->
|
||||
</div> <!-- #footer -->
|
||||
|
||||
</div> <!-- #page -->
|
||||
</body>
|
||||
</html>
|
@ -1,171 +0,0 @@
|
||||
<% d = @doc_instance %>
|
||||
|
||||
<% @title = "#{d.full_name} #{d.type}" %>
|
||||
|
||||
<%= include "partials/breadcrumbs", :object => d %>
|
||||
|
||||
<h2 class="page-title <%= class_names_for(d) %>">
|
||||
<span class="type"><%= d.type %> </span><%= d.full_name %>
|
||||
</h2>
|
||||
|
||||
<% # Does it have a description? %>
|
||||
|
||||
<% if d.description && !d.description.empty? %>
|
||||
<div class="section section-description">
|
||||
|
||||
<div class="section-title">
|
||||
<h3>Description</h3>
|
||||
</div> <!-- .section-title -->
|
||||
|
||||
<div class="section-content">
|
||||
<%= htmlize(d.description) %>
|
||||
</div> <!-- .section-content -->
|
||||
|
||||
</div> <!--.section -->
|
||||
<% end %>
|
||||
|
||||
<% # Is it a CLASS? %>
|
||||
<% if d.is_a?(Documentation::Klass) %>
|
||||
|
||||
<% if d.superklass %>
|
||||
<div class="section section-superclass">
|
||||
<div class="section-title">
|
||||
<h3>Superclass</h3>
|
||||
</div> <!-- .section-title -->
|
||||
|
||||
<div class="section-content">
|
||||
<p><%= auto_link_code(d.superklass, false) %></p>
|
||||
</div> <!-- .section-content -->
|
||||
</div> <!-- .section -->
|
||||
<% end %>
|
||||
|
||||
<% unless d.subklasses.empty? %>
|
||||
<div class="section section-subclasses">
|
||||
<div class="section-title">
|
||||
<h3>Subclasses</h3>
|
||||
</div> <!-- .section-title -->
|
||||
|
||||
<div class="section-content">
|
||||
<p><%= d.subklasses.map { |s| auto_link_code(s, false) }.join(', ') %></p>
|
||||
</div> <!-- .section-content -->
|
||||
</div> <!-- .section -->
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% # Does it have MIXINS? %>
|
||||
<% unless d.mixins.compact.empty? %>
|
||||
<div class="section section-mixins">
|
||||
<div class="section-title">
|
||||
<h3>Includes</h3>
|
||||
</div> <!-- .section-title -->
|
||||
|
||||
<div class="section-content">
|
||||
<p><%= d.mixins.map { |m| auto_link_code(m, false) }.join(', ') %></p>
|
||||
</div> <!-- .section-content -->
|
||||
</div> <!-- .section -->
|
||||
<% end %>
|
||||
|
||||
<% # Are there related utilities? %>
|
||||
<% unless d.related_utilities.empty? %>
|
||||
<div class="section section-utilities">
|
||||
<div class="section-title">
|
||||
<h3>Related utilities</h3>
|
||||
</div> <!-- .section-title -->
|
||||
|
||||
<div class="section-content">
|
||||
<p><%= d.related_utilities.map { |u| auto_link_code(u, false) }.join(', ') %></p>
|
||||
</div> <!-- .section-content -->
|
||||
</div> <!-- .section -->
|
||||
<% end %>
|
||||
|
||||
<% # List its methods. %>
|
||||
<% unless d.all_methods.empty? && d.mixins.empty? %>
|
||||
<div class="section section-method-list">
|
||||
<div class="section-title">
|
||||
<h3>Methods</h3>
|
||||
</div> <!-- .section-title -->
|
||||
|
||||
<div class="section-content">
|
||||
<ul class="method-list">
|
||||
<% d.all_methods.each do |method| %>
|
||||
<li><%= auto_link_code(method, true, :class => class_names_for(method)) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<% unless d.mixins.compact.empty? %>
|
||||
<% d.mixins.each do |mixin| %>
|
||||
<h4 class="inherited">Inherited from <%= auto_link(mixin) %></h4>
|
||||
<ul class="method-list">
|
||||
<% mixin.all_methods.each do |method| %>
|
||||
<li><%= auto_link_code(method, true, :class => class_names_for(method)) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
</div> <!-- .section-content -->
|
||||
|
||||
</div> <!-- .section -->
|
||||
<% end %>
|
||||
|
||||
<% if d.is_a?(Documentation::Klass) && d.constructor %>
|
||||
<div class="section section-constructor">
|
||||
<div class="section-title">
|
||||
<h3>Constructor</h3>
|
||||
</div> <!-- .section-title -->
|
||||
|
||||
<div class="section-content">
|
||||
<pre id="<%= dom_id(d.constructor) %>" class="syntax"><code><%= d.constructor.ebnf_expressions.join("\n").strip %></code></pre>
|
||||
<% unless d.constructor.arguments.empty? %>
|
||||
<ul class="argument-list">
|
||||
<% d.constructor.arguments.each do |arg| %>
|
||||
<li>
|
||||
<code><%= arg.name %></code>
|
||||
<% unless arg.types.empty? %>
|
||||
(<%= arg.types.map { |t| auto_link_code(t, false) }.join(' | ') %>)
|
||||
<% end %>
|
||||
<%= ' – ' + inline_htmlize(arg.description) unless arg.description.empty? %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul> <!-- .argument-list -->
|
||||
<% end %>
|
||||
|
||||
|
||||
<p><%= htmlize(d.constructor.description) %></p>
|
||||
|
||||
</div> <!-- .section-content -->
|
||||
|
||||
</div> <!-- .section -->
|
||||
<% end %>
|
||||
|
||||
|
||||
<%
|
||||
types = {
|
||||
:constants => "Constants",
|
||||
:klass_methods => "Class methods",
|
||||
:klass_properties => "Class properties",
|
||||
:instance_methods => "Instance methods",
|
||||
:instance_properties => "Instance properties"
|
||||
}
|
||||
%>
|
||||
|
||||
<% types.each do |method, title| %>
|
||||
<% methods = d.send(method) %>
|
||||
<% unless methods.empty? %>
|
||||
<div class="section section-<%= method.to_s %>">
|
||||
|
||||
<div class="section-title">
|
||||
<h3><%= title %></h3>
|
||||
</div> <!-- .section-title -->
|
||||
|
||||
<div class="section-content">
|
||||
<ul class="method-details-list">
|
||||
<%= include "partials/short_description", :collection => methods %>
|
||||
</ul>
|
||||
|
||||
</div> <!-- .section-content -->
|
||||
</div> <!-- .section -->
|
||||
<% end %>
|
||||
<% end %>
|
@ -1,6 +0,0 @@
|
||||
<ul class="breadcrumbs clearfix">
|
||||
<li><a href="<%= path_prefix %>index.html">Home</a> →</li>
|
||||
<% unless object.is_a?(Documentation::Section) %>
|
||||
<li><a href="<%= path_to(object.section) %>"><%= object.section.name %></a> →</li>
|
||||
<% end %>
|
||||
</ul>
|
@ -1,48 +0,0 @@
|
||||
<li class="method-description">
|
||||
<h4 id="<%= dom_id(object) %>"><%= object.name %>
|
||||
<span class="method-permalink"><a href="<%= path_to(object) %>">#</a></span></h4>
|
||||
|
||||
<% if object.signature %>
|
||||
<%= method_synopsis(object) %>
|
||||
<% end %>
|
||||
|
||||
<% if object.is_a?(Documentation::Method) %>
|
||||
<% unless object.arguments.empty? %>
|
||||
<ul class="argument-list">
|
||||
<% object.arguments.each do |arg| %>
|
||||
<li>
|
||||
<code class="argument-name"><%= arg.name %></code>
|
||||
<% unless arg.types.empty? %>
|
||||
<span class="argument-types">(<%= arg.types.map { |t| auto_link_code(t, false) }.join(' | ') %>)</span>
|
||||
<% end %>
|
||||
<%= ' – ' + inline_htmlize(arg.description) unless arg.description.empty? %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul> <!-- .argument-list -->
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= htmlize(object.description) %>
|
||||
|
||||
<% # Does it have an alias? %>
|
||||
<% unless object.aliases.empty? %>
|
||||
<p class="alias aliases">Aliased as: <%= object.aliases.map { |a| auto_link_code(a, false) }.join(', ') %></p>
|
||||
<% end %>
|
||||
|
||||
<% # Is it an alias of something else? %>
|
||||
<% if object.alias? %>
|
||||
<p class="alias alias-of">Alias of: <%= auto_link_code(object.alias_of, false) %></p>
|
||||
<% end %>
|
||||
|
||||
<% # Is it related to something? %>
|
||||
<% if object.is_a?(Documentation::Utility) && object.related_to %>
|
||||
<p class="related-to">Related to:
|
||||
<%= auto_link_code(object.related_to, false) %></p>
|
||||
<% end %>
|
||||
|
||||
<% # Is it methodized? %>
|
||||
<% if object.is_a?(Documentation::Method) && object.methodized? %>
|
||||
<p class="note">This method can be called <em>either</em> as an instance method <em>or</em> as a generic method. If calling as a generic, pass the instance in as the first argument.</p>
|
||||
<% end %>
|
||||
|
||||
</li>
|
@ -1,99 +0,0 @@
|
||||
<% @title = "#{@doc_instance.full_name}" %>
|
||||
<% section = @doc_instance %>
|
||||
|
||||
<%= include "partials/breadcrumbs", :object => section %>
|
||||
|
||||
<h2 class="page-title">
|
||||
<span class="type">Section </span><%= section.name %>
|
||||
</h2>
|
||||
|
||||
<div class="section section-description">
|
||||
|
||||
<div class="section-title">
|
||||
<h3>Description</h3>
|
||||
</div> <!-- .section-title -->
|
||||
|
||||
<div class="section-content">
|
||||
<%= htmlize(section.description) %>
|
||||
</div> <!-- .section-content -->
|
||||
|
||||
</div> <!--.section -->
|
||||
|
||||
<% # Iterate over the items in this section. %>
|
||||
|
||||
<% utilities = section.utilities %>
|
||||
<% unless utilities.empty? %>
|
||||
|
||||
<div class="section section-utilities">
|
||||
<div class="section-title">
|
||||
<h3>Utilities</h3>
|
||||
</div> <!-- .section-title -->
|
||||
|
||||
<div class="section-content">
|
||||
<ul class="method-list">
|
||||
<% utilities.each do |utility| %>
|
||||
<li><%= auto_link_code(utility) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div> <!-- .section-content -->
|
||||
</div> <!-- .section -->
|
||||
|
||||
<% end %>
|
||||
|
||||
<% namespaces = section.namespaces %>
|
||||
<% unless namespaces.empty? %>
|
||||
|
||||
<div class="section section-namespaces">
|
||||
<div class="section-title">
|
||||
<h3>Namespaces</h3>
|
||||
</div> <!-- .section-title -->
|
||||
|
||||
<div class="section-content">
|
||||
<ul class="method-details-list">
|
||||
<% namespaces.each do |namespace| %>
|
||||
<li class="method-description">
|
||||
<h4>
|
||||
<a href="<%= path_to(namespace) %>"><%= namespace.full_name %></a>
|
||||
</h4>
|
||||
|
||||
<% unless namespace.short_description.nil? %>
|
||||
<p><%= htmlize(namespace.short_description) %></p>
|
||||
<% end %>
|
||||
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div> <!-- .section-content -->
|
||||
</div> <!-- .section -->
|
||||
|
||||
<% end %>
|
||||
|
||||
<% klasses = section.klasses %>
|
||||
<% unless klasses.empty? %>
|
||||
|
||||
<div class="section section-classes">
|
||||
|
||||
<div class="section-title">
|
||||
<h3>Classes</h3>
|
||||
</div> <!-- .section-title -->
|
||||
|
||||
<div class="section-content">
|
||||
<ul class="method-details-list">
|
||||
<% klasses.each do |klass| %>
|
||||
<li class="method-description">
|
||||
<h4>
|
||||
<a href="<%= path_to(klass) %>"><%= klass.full_name %></a>
|
||||
</h4>
|
||||
|
||||
<% unless klass.short_description.nil? %>
|
||||
<p><%= htmlize(klass.short_description) %></p>
|
||||
<% end %>
|
||||
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div> <!-- .section-content -->
|
||||
|
||||
</div> <!--.section -->
|
||||
|
||||
<% end %>
|
@ -1,21 +0,0 @@
|
||||
<% d = @doc_instance %>
|
||||
|
||||
<% @title = "#{@doc_instance.full_name} utility" %>
|
||||
|
||||
<%= include "partials/breadcrumbs", :object => d %>
|
||||
|
||||
<h2 class="page-title">
|
||||
<span class="type">utility </span><%= @doc_instance.name %>
|
||||
</h2>
|
||||
|
||||
<div class="section">
|
||||
<div class="section-title">
|
||||
<h3>Description</h3>
|
||||
</div> <!-- .section-title -->
|
||||
|
||||
<div class="section-content">
|
||||
<ul class="method-details-list">
|
||||
<%= include "partials/short_description", :collection => [@doc_instance] %>
|
||||
</ul>
|
||||
</div> <!-- .section-content -->
|
||||
</div> <!-- .section -->
|
2
vendor/pdoc
vendored
@ -1 +1 @@
|
||||
Subproject commit 147250bd65eed627e32ca5a70b57fe4f7803ab4b
|
||||
Subproject commit e4290279a1d42bc02b09b234291a2d05c0134a43
|