diff --git a/templates/html/assets/javascripts/application.js b/templates/html/assets/javascripts/application.js index d6b720a..a6f503a 100644 --- a/templates/html/assets/javascripts/application.js +++ b/templates/html/assets/javascripts/application.js @@ -1,332 +1,439 @@ -if (typeof PDoc === "undefined") window.PDoc = {}; +//= require -// Poor-man's history manager. Polls for changes to the hash. -(function() { - var PREVIOUS_HASH = null; - - Event.observe(window, "load", function() { - var hash = window.location.hash; - if (hash && hash !== PREVIOUS_HASH) { - document.fire("hash:changed", - { previous: PREVIOUS_HASH, current: hash }); - PREVIOUS_HASH = hash; +if (!Prototype || Prototype.Version.indexOf('1.6') !== 0) { + throw "This script requires Prototype >= 1.6."; +} + +Object.isDate = function(object) { + return object instanceof Date; +}; + +/** + * class Cookie + * Creates a cookie. +**/ +var Cookie = Class.create({ + /** + * new Cookie(name, value[, expires]) + * + * - name (String): The name of the cookie. + * - value (String): The value of the cookie. + * - expires (Number | Date): Exact date (or number of days from now) that + * the cookie will expire. + **/ + initialize: function(name, value, expires) { + expires = expires || ""; + if (Object.isNumber(expires)) { + var days = expires; + expires = new Date(); + expires.setTime(expires.getTime() + (days * 24 * 60 * 60 * 1000)); } - window.setTimeout(arguments.callee, 100); - }); -})(); + if (Object.isDate(expires)) + expires = expires.toGMTString(); -// Place a "frame" around the element described by the hash. -// Update the frame when the hash changes. -PDoc.highlightSelected = function() { - if (!window.location.hash) return; - element = $(window.location.hash.substr(1)); - if (element) PDoc.highlight(element.up('li, div')); -}; + if (!Object.isUndefined(expires) && expires !== "") + expires = "; expires=" + expires; + + this.name = name; + this.value = value; + this.expires = expires; + + document.cookie = name + "=" + value + expires + "; path=/"; + }, + + toString: function() { + return this.value; + }, + + inspect: function() { + return "#".interpolate(this); + } +}); -document.observe("hash:changed", PDoc.highlightSelected); +/** + * Cookie +**/ +Object.extend(Cookie, { + /** + * Cookie.set(name, value, expires) + * + * Alias of [[Cookie#initialize]]. + **/ + set: function(name, value, expires) { + return new Cookie(name, value, expires); + }, + + /** + * Cookie.get(name) + * + * Returns the value of the cookie with the given name. + * - name (String): The name of the cookie to retrieve. + **/ + get: function(name) { + var c = document.cookie.split(';'); + + for (var i = 0, cookie; i < c.length; i++) { + cookie = c[i].split('='); + if (cookie[0].strip() === name) + return cookie[1].strip(); + } + + return null; + }, + + /** + * Cookie.unset(name) + * + * Deletes a cookie. + * - name (String): The name of the cookie to delete. + * + **/ + unset: function(name) { + return Cookie.set(name, "", -1); + } +}); -PDoc.highlight = function(element) { - var self = arguments.callee; - if (!self.frame) { - self.frame = new Element('div', { 'class': 'highlighter' }); - document.body.appendChild(self.frame); +Cookie.erase = Cookie.unset; + + + +if (typeof PDoc === 'undefined') { + window.PDoc = { + Sidebar: {} + }; +} + +// HISTORY MANAGER (sort of) +// Polls for changes to the hash. + +(function() { + var PREVIOUS_HASH = null; + + function poll() { + var hash = window.location.hash; + if (hash && hash !== PREVIOUS_HASH) { + document.fire('hash:changed', { + previous: PREVIOUS_HASH, current: hash + }); + } + PREVIOUS_HASH = hash; + window.setTimeout(arguments.callee, 100); } - var frame = self.frame; + Event.observe(window, 'load', poll); +})(); + +Object.extend(PDoc, { + highlightSelected: function() { + if (!window.location.hash) return; + var element = $(window.location.hash.substr(1)); + if (element) this.highlight(element.up('li, div')); + }, - element.getOffsetParent().appendChild(frame); + highlight: function(element) { + var self = arguments.callee; + if (!self.frame) { + self.frame = new Element('div', { 'class': 'highlighter' }); + document.body.appendChild(self.frame); + } + + var frame = self.frame; + element.getOffsetParent().appendChild(frame); + + var offset = element.positionedOffset(); + var w = parseFloat(element.getStyle('width')), + h = parseFloat(element.getStyle('height')); + + frame.setStyle({ + position: 'absolute', + top: (offset.top - 15) + 'px', + left: (offset.left - 12) + 'px', + width: (w + 20) + 'px', + height: (h + 30) + 'px' + }); + + // Defer this call because Safari hasn't yet scrolled the viewport. + (function() { + var frameOffset = frame.viewportOffset(frame); + if (frameOffset.top < 0) { + $('page').scrollTop += (frameOffset.top - 10); + } + }).defer(); + } +}); + +Object.extend(PDoc.Sidebar, { + getActiveTab: function() { + var activeTab = $('sidebar_tabs').down('.active'); + if (!activeTab) return null; + + var href = activeTab.readAttribute('href'); + return href.endsWith('menu_pane') ? 'menu_pane' : 'search_pane'; + }, - var offset = element.positionedOffset(); - var w = parseFloat(element.getStyle('width')), - h = parseFloat(element.getStyle('height')); - - frame.setStyle({ - position: 'absolute', - top: (offset.top - 15) + 'px', - left: (offset.left - 12) + 'px', - width: (w + 20) + 'px', - height: (h + 30) + 'px' - }); + // Remember the state of the sidebar so it can be restored on the next page. + serialize: function() { + var state = $H({ + activeTab: PDoc.Sidebar.getActiveTab(), + menuScrollOffset: $('menu_pane').scrollTop, + searchScrollOffset: $('search_results').scrollTop, + searchValue: $('search').getValue() + }); + + return escape(state.toJSON()); + }, - // Defer this call because Safari hasn't yet scrolled the viewport. - (function() { - var frameOffset = frame.viewportOffset(frame); - if (frameOffset.top < 0) { - window.scrollBy(0, frameOffset.top - 10); - } - }).defer(); - -}; + // Restore the tree to a certain point based on a cookie. + restore: function(state) { + try { + state = unescape(state).evalJSON(); + var filterer = $('search').retrieve('filterer'); + filterer.setSearchValue(state.searchValue); + + (function() { + $('menu_pane').scrollTop = state.menuScrollOffset; + $('search_results').scrollTop = state.searchScrollOffset; + }).defer(); + } catch(error) { + console.log(error); + if (!(error instanceof SyntaxError)) throw error; + } + } +}); + + // Live API search. -var Filterer = Class.create({ +PDoc.Sidebar.Filterer = Class.create({ initialize: function(element, options) { this.element = $(element); - this.options = Object.extend({ - interval: 0.1, - resultsElement: '.search-results' - }, options || {}); + this.options = Object.extend( + Object.clone(PDoc.Sidebar.Filterer.DEFAULT_OPTIONS), + options || {} + ); - this.element.writeAttribute("autocomplete", "off"); + // The browser's "helpful" auto-complete gets in the way. + this.element.writeAttribute("autocomplete", "off"); + this.element.setValue(''); + + // Hitting "enter" should do nothing. this.element.up('form').observe("submit", Event.stop); - // // The Safari-only "search" input type is prettier - // if (Prototype.Browser.WebKit) - // this.element.type = "search"; - - this.menu = this.options.menu; + this.menu = this.options.menu; this.links = this.menu.select('a'); this.resultsElement = this.options.resultsElement; - this.resultsElement.setStyle({ - overflowX: 'hidden' - }); - this.events = { - filter: this.filter.bind(this), - keydown: this.keydown.bind(this) + this.observers = { + filter: this.filter.bind(this), + keydown: this.keydown.bind(this), + keyup: this.keyup.bind(this) }; this.menu.setStyle({ opacity: 0.9 }); - this.addObservers(); - - this.element.value = ''; + this.addObservers(); }, addObservers: function() { - this.element.observe('keyup', this.events.filter); + this.element.observe('keyup', this.observers.filter); }, - + + // Called whenever the list of results needs to update as a result of a + // changed search key. filter: function(event) { - if (this._timer) window.clearTimeout(this._timer); - - // Clear the text box on ESC + // Clear the text box on ESC. if (event.keyCode && event.keyCode === Event.KEY_ESC) { - this.element.value = ''; + this.element.setValue(''); } - if ([Event.KEY_UP, Event.KEY_DOWN, Event.KEY_RETURN].include(event.keyCode)) + if (PDoc.Sidebar.Filterer.INTERCEPT_KEYS.include(event.keyCode)) return; - + + // If there's nothing in the text box, clear the results list. var value = $F(this.element).strip().toLowerCase(); - if (value === "") { - this.onEmpty(); + if (value === '') { + this.emptyResults(); + this.hideResults(); return; } - var urls = this.findURLs(value); + var urls = this.findURLs(value); this.buildResults(urls); }, - keydown: function(event) { - if (![Event.KEY_UP, Event.KEY_DOWN, Event.KEY_RETURN].include(event.keyCode)) + setSearchValue: function(value) { + this.element.setValue(value); + if (value.strip() === "") { + PDoc.Sidebar.Tabs.setActiveTab(0); return; - - // ignore if any modifier keys are present - if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey) - return; - - event.stop(); - - var highlighted = this.resultsElement.down('.highlighted'); - if (event.keyCode === Event.KEY_RETURN) { - // Follow the highlighted item. - if (!highlighted) return; - window.location.href = highlighted.down('a').href; - } else { - var direction = (Event.KEY_DOWN === event.keyCode) ? 1 : -1; - highlighted = this.moveHighlight(direction); - } - - - if ([Event.KEY_UP, Event.KEY_DOWN].include(event.keyCode) && - !Prototype.Browser.WebKit) { - // If up/down key is held down, list should keep scrolling. - // Safari does this automatically because it fires the keydown - // event over and over. - this._timer = window.setTimeout(this.scrollList.bind(this, direction), 1000); } + this.buildResults(this.findURLs(value)); }, - moveHighlight: function(direction) { - var highlighted = this.resultsElement.down('.highlighted'); - // move the focus - if (!highlighted) { - // if there is none, highlight the first result - var highlighted = this.resultsElement.down('li').addClassName('highlighted'); - } else { - var method = (direction === 1) ? 'next' : 'previous'; - highlighted.removeClassName('highlighted'); - var adjacent = highlighted[method]('li'); - if (!adjacent) { - adjacent = method == 'next' ? this.resultsElement.down('li') : - this.resultsElement.down('li:last-of-type'); - } - adjacent.addClassName('highlighted'); - highlighted = adjacent; + // Given a key, finds all the PDoc objects that match. + findURLs: function(str) { + var results = []; + for (var name in PDoc.elements) { + if (name.toLowerCase().include(str.toLowerCase())) + results.push(PDoc.elements[name]); } - - // Adjust the scroll offset of the container so that the highlighted - // item is always in view. - var distanceToBottom = highlighted.offsetTop + highlighted.offsetHeight; - if (distanceToBottom > this.resultsElement.offsetHeight + this.resultsElement.scrollTop) { - // item is too low - this.resultsElement.scrollTop = distanceToBottom - this.resultsElement.offsetHeight; - } else if (highlighted.offsetTop < this.resultsElement.scrollTop) { - // item is too high - this.resultsElement.scrollTop = highlighted.offsetTop; - } - - return highlighted; + return results; }, - scrollList: function(direction) { - this.moveHighlight(direction); - this._timer = window.setTimeout(this.scrollList.bind(this, direction), 100); + buildResults: function(results) { + this.emptyResults(); + + results.each( function(result) { + var li = this._buildResult(result); + this.resultsElement.appendChild(li); + }, this); + this.showResults(); + }, + + _buildResult: function(obj) { + var li = new Element('li', { 'class': 'menu-item' }); + var a = new Element('a', { + 'class': obj.type.gsub(/\s/, '_'), + 'href': PDoc.pathPrefix + this._fixPath(obj.path) + }).update(obj.name); + + li.appendChild(a); + return li; + }, + + emptyResults: function() { + this.resultsElement.update(); + }, + + hideResults: function() { + PDoc.Sidebar.Tabs.setActiveTab(0); + //this.resultsElement.hide(); + document.stopObserving('keydown', this.observers.keydown); + document.stopObserving('keyup', this.observers.keyup); + }, + + showResults: function() { + PDoc.Sidebar.Tabs.setActiveTab(1); + //this.resultsElement.show(); + document.stopObserving('keydown', this.observers.keydown); + this.element.stopObserving('keyup', this.observers.keyup); + this.element.observe('keydown', this.observers.keydown); + document.observe('keyup', this.observers.keyup); }, // Given a path with any number of `../`s in front of it, remove them all. // TODO: Fix this a better way. _fixPath: function(path) { return path.replace('../', ''); - }, + }, - buildResults: function(urls) { - this.resultsElement.update(); - var ul = this.resultsElement; - urls.each( function(url) { - var a = new Element('a', { - 'class': url.type.gsub(/\s/, '_'), - href: PDoc.pathPrefix + this._fixPath(url.path) - }).update(url.name); - var li = new Element('li', { 'class': 'menu-item' }); - li.appendChild(a); - ul.appendChild(li); - }, this); - this.showResults(); - }, - - - findURLs: function(str) { - var results = []; - for (var i in PDoc.elements) { - if (i.toLowerCase().include(str)) results.push(PDoc.elements[i]); + keydown: function(event) { + if (!PDoc.Sidebar.Filterer.INTERCEPT_KEYS.include(event.keyCode)) + return; + + // Also ignore if any modifier keys are present. + if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey) + return; + + event.stop(); + + if (event.keyCode === Event.KEY_RETURN) { + // Follow the highlighted item, unless there is none. + if (!this.highlighted) return; + var a = this.highlighted.down('a'); + if (a) { + window.location.href = a.href; + } + } else if ([Event.KEY_UP, Event.KEY_DOWN].include(event.keyCode)) { + // Is an arrow key. + var direction = (Event.KEY_DOWN === event.keyCode) ? 1 : -1; + this.highlighted = this.moveHighlight(direction); + + if (!Prototype.Browser.WebKit) { + // If up/down key is held down, list should keep scrolling. + // WebKit does this automatically because it fires the keydown + // event over and over. + this._scrollTimer = window.setTimeout( + this.scrollList.bind(this, direction), 1000); + } } - return results; }, - onEmpty: function() { - this.hideResults(); - }, - - showResults: function() { - this.resultsElement.show(); - document.stopObserving("keydown", this.events.keydown); - document.observe("keydown", this.events.keydown); - }, - - hideResults: function() { - this.resultsElement.hide(); - document.stopObserving("keydown", this.events.keydown); - } -}); - -document.observe('dom:loaded', function() { - new Filterer($('search'), { - menu: $('api_menu'), - resultsElement: $('search_results') - }); -}); - - -Event.observe(window, 'load', function() { - var menu = $('menu'); - var OFFSET = menu.viewportOffset().top; - - Event.observe(window, 'scroll', function() { - var sOffset = document.viewport.getScrollOffsets(); - if (sOffset.top > OFFSET) { - menu.addClassName('fixed'); - } else menu.removeClassName('fixed'); - }); -}); - -(function() { - function menuButtonMouseOver(event) { - var menuButton = $('api_menu_button'); - var target = event.element(); - if (target === menuButton || target.descendantOf(menuButton)) { - $('api_menu').show(); + keyup: function(event) { + if (this._scrollTimer) { + window.clearTimeout(this._scrollTimer); } - } + }, - function menuButtonMouseOut(event) { - var menuButton = $('api_menu_button'); - var menu = $('api_menu'); - var target = event.element(), related = event.relatedTarget || event.toElement; - - if (related && (related === menu || related.descendantOf(menu))) return; - menu.hide(); - } - - function menuMouseOut(event) { - var menu = $('api_menu'), related = event.relatedTarget || event.toElement; - if (related && !related.descendantOf(menu)) { - arguments.callee.timer = Element.hide.delay(0.5, menu); + moveHighlight: function(direction) { + if (!this.highlighted) { + // If there is none, highlight the first result. + this.highlighted = + this.resultsElement.down('li').addClassName('highlighted'); } else { - window.clearTimeout(arguments.callee.timer); + var method = (direction === 1) ? 'next' : 'previous'; + this.highlighted.removeClassName('highlighted'); + var adjacent = this.highlighted[method]('li'); + // If there isn't an adjacent one, we're at the top or bottom + // of the list. Flip it. + if (!adjacent) { + adjacent = method == 'next' ? this.resultsElement.down('li') : + this.resultsElement.down('li:last-of-type'); + } + adjacent.addClassName('highlighted'); + this.highlighted = adjacent; } - } - - function menuItemMouseOver(event) { - var element = event.element(); - if (element.tagName.toLowerCase() === 'a') { - element.addClassName('highlighted'); - } - } - - function menuItemMouseOut(event) { - var element = event.element(); - if (element.tagName.toLowerCase() === 'a') { - element.removeClassName('highlighted'); - } - } - - var MENU_ITEMS; - - document.observe('dom:loaded', function() { - MENU_ITEMS = $$('.api-box .menu-item a'); - $('api_menu_button').observe('mouseenter', menuButtonMouseOver); - $('api_menu_button').observe('mouseleave', menuButtonMouseOut ); + var h = this.highlighted, r = this.resultsElement; - $('api_menu').observe('mouseleave', menuMouseOut); - - if (Prototype.Browser.IE) { - $('api_menu').observe('mouseover', menuItemMouseOver); - $('api_menu').observe('mouseout', menuItemMouseOut); + var distanceToBottom = h.offsetTop + h.offsetHeight; + if (distanceToBottom > (r.offsetHeight + r.scrollTop)) { + // Item is below the visible frame. + r.scrollTop = distanceToBottom - r.offsetHeight; + } else if (h.offsetTop < r.scrollTop) { + // Item is above the visible frame. + r.scrollTop = h.offsetTop; } - }); -})(); + + return this.highlighted; + }, + + scrollList: function(direction) { + this.moveHighlight(direction); + this._scrollTimer = window.setTimeout( + this.scrollList.bind(this, direction), 100); + } +}); + +Object.extend(PDoc.Sidebar.Filterer, { + INTERCEPT_KEYS: [Event.KEY_UP, Event.KEY_DOWN, Event.KEY_RETURN], + DEFAULT_OPTIONS: { + interval: 0.1, + resultsElement: '.search-results' + } +}); + Form.GhostedField = Class.create({ initialize: function(element, title, options) { + options = options || {}; + this.element = $(element); this.title = title; - options = options || {}; - this.isGhosted = true; if (options.cloak) { + // Wrap the native getValue function so that it never returns the // ghosted value. This is optional because it presumes the ghosted // value isn't valid input for the field. this.element.getValue = this.element.getValue.wrap(this.wrappedGetValue.bind(this)); - } + } this.addObservers(); + this.onBlur(); }, @@ -384,6 +491,35 @@ Form.GhostedField = Class.create({ } }); -document.observe("dom:loaded", function() { - new Form.GhostedField($('search'), "Search"); + +document.observe('hash:changed', PDoc.highlightSelected.bind(PDoc)); +document.observe('dom:loaded', function() { + PDoc.Sidebar.Tabs = new Control.Tabs($('sidebar_tabs')); + + var searchField = $('search'); + + if (searchField) { + var filterer = new PDoc.Sidebar.Filterer(searchField, { + menu: $('api_menu'), + resultsElement: $('search_results') + }); + searchField.store('filterer', filterer); + } + + // Prevent horizontal scrolling in scrollable sidebar areas. + $$('.scrollable').invoke('observe', 'scroll', function() { + this.scrollLeft = 0; + }); + + var sidebarState = Cookie.get('sidebar_state'); + if (sidebarState) { + PDoc.Sidebar.restore(sidebarState); + } + + new Form.GhostedField(searchField, searchField.getAttribute('title'), + { cloak: true }); +}); + +Event.observe(window, 'unload', function() { + Cookie.set('sidebar_state', PDoc.Sidebar.serialize()); }); \ No newline at end of file diff --git a/templates/html/assets/javascripts/code_highlighter.js b/templates/html/assets/javascripts/code_highlighter.js deleted file mode 100644 index 4caa49c..0000000 --- a/templates/html/assets/javascripts/code_highlighter.js +++ /dev/null @@ -1,251 +0,0 @@ -/* Unobtrustive Code Highlighter By Dan Webb 11/2005 - Version: 0.4 - - Usage: - Add a script tag for this script and any stylesets you need to use - to the page in question, add correct class names to CODE elements, - define CSS styles for elements. That's it! - - Known to work on: - IE 5.5+ PC - Firefox/Mozilla PC/Mac - Opera 7.23 + PC - Safari 2 - - Known to degrade gracefully on: - IE5.0 PC - - Note: IE5.0 fails due to the use of lookahead in some stylesets. To avoid script errors - in older browsers use expressions that use lookahead in string format when defining stylesets. - - This script is inspired by star-light by entirely cunning Dean Edwards - http://dean.edwards.name/star-light/. -*/ - -// replace callback support for safari. -if ("a".replace(/a/, function() {return "b"}) != "b") (function(){ - var default_replace = String.prototype.replace; - String.prototype.replace = function(search,replace){ - // replace is not function - if(typeof replace != "function"){ - return default_replace.apply(this,arguments) - } - var str = "" + this; - var callback = replace; - // search string is not RegExp - if(!(search instanceof RegExp)){ - var idx = str.indexOf(search); - return ( - idx == -1 ? str : - default_replace.apply(str,[search,callback(search, idx, str)]) - ) - } - var reg = search; - var result = []; - var lastidx = reg.lastIndex; - var re; - while((re = reg.exec(str)) != null){ - var idx = re.index; - var args = re.concat(idx, str); - result.push( - str.slice(lastidx,idx), - callback.apply(null,args).toString() - ); - if(!reg.global){ - lastidx += RegExp.lastMatch.length; - break - }else{ - lastidx = reg.lastIndex; - } - } - result.push(str.slice(lastidx)); - return result.join("") - } -})(); - -var CodeHighlighter = { styleSets : new Array }; - -CodeHighlighter.addStyle = function(name, rules) { - // using push test to disallow older browsers from adding styleSets - if ([].push) this.styleSets.push({ - name : name, - rules : rules, - ignoreCase : arguments[2] || false - }) - - function setEvent() { - // set highlighter to run on load (use LowPro if present) - if (typeof Event != 'undefined' && typeof Event.onReady == 'function') - return Event.onReady(CodeHighlighter.init.bind(CodeHighlighter)); - - var old = window.onload; - - if (typeof window.onload != 'function') { - window.onload = function() { CodeHighlighter.init() }; - } else { - window.onload = function() { - old(); - CodeHighlighter.init(); - } - } - } - - // only set the event when the first style is added - if (this.styleSets.length==1) setEvent(); -} - -CodeHighlighter.init = function() { - if (!document.getElementsByTagName) return; - if ("a".replace(/a/, function() {return "b"}) != "b") return; // throw out Safari versions that don't support replace function - // throw out older browsers - - var codeEls = document.getElementsByTagName("CODE"); - // collect array of all pre elements - codeEls.filter = function(f) { - var a = new Array; - for (var i = 0; i < this.length; i++) if (f(this[i])) a[a.length] = this[i]; - return a; - } - - var rules = new Array; - rules.toString = function() { - // joins regexes into one big parallel regex - var exps = new Array; - for (var i = 0; i < this.length; i++) exps.push(this[i].exp); - return exps.join("|"); - } - - function addRule(className, rule) { - // add a replace rule - var exp = (typeof rule.exp != "string")?String(rule.exp).substr(1, String(rule.exp).length-2):rule.exp; - // converts regex rules to strings and chops of the slashes - rules.push({ - className : className, - exp : "(" + exp + ")", - length : (exp.match(/(^|[^\\])\([^?]/g) || "").length + 1, // number of subexps in rule - replacement : rule.replacement || null - }); - } - - function parse(text, ignoreCase) { - // main text parsing and replacement - return text.replace(new RegExp(rules, (ignoreCase)?"gi":"g"), function() { - var i = 0, j = 1, rule; - while (rule = rules[i++]) { - if (arguments[j]) { - // if no custom replacement defined do the simple replacement - if (!rule.replacement) return "" + arguments[0] + ""; - else { - // replace $0 with the className then do normal replaces - var str = rule.replacement.replace("$0", rule.className); - for (var k = 1; k <= rule.length - 1; k++) str = str.replace("$" + k, arguments[j + k]); - return str; - } - } else j+= rule.length; - } - }); - } - - function highlightCode(styleSet) { - // clear rules array - var parsed; - rules.length = 0; - - // get stylable elements by filtering out all code elements without the correct className - var stylableEls = codeEls.filter(function(item) {return (item.className.indexOf(styleSet.name)>=0)}); - - // add style rules to parser - for (var className in styleSet.rules) addRule(className, styleSet.rules[className]); - - - // replace for all elements - for (var i = 0; i < stylableEls.length; i++) { - // EVIL hack to fix IE whitespace badness if it's inside a
-			if (/MSIE/.test(navigator.appVersion) && stylableEls[i].parentNode.nodeName == 'PRE') {
-				stylableEls[i] = stylableEls[i].parentNode;
-				
-				parsed = stylableEls[i].innerHTML.replace(/(]*>)([^<]*)<\/code>/i, function() {
-					return arguments[1] + parse(arguments[2], styleSet.ignoreCase) + ""
-				});
-				parsed = parsed.replace(/\n( *)/g, function() { 
-					var spaces = "";
-					for (var i = 0; i < arguments[1].length; i++) spaces+= " ";
-					return "\n" + spaces;  
-				});
-				parsed = parsed.replace(/\t/g, "    ");
-				parsed = parsed.replace(/\n(<\/\w+>)?/g, "
$1").replace(/
[\n\r\s]*
/g, "


"); - - } else parsed = parse(stylableEls[i].innerHTML, styleSet.ignoreCase); - - stylableEls[i].innerHTML = parsed; - } - } - - // run highlighter on all stylesets - for (var i=0; i < this.styleSets.length; i++) { - highlightCode(this.styleSets[i]); - } -}; - -CodeHighlighter.addStyle("css", { - comment : { - exp : /\/\*[^*]*\*+([^\/][^*]*\*+)*\// - }, - keywords : { - exp : /@\w[\w\s]*/ - }, - selectors : { - exp : "([\\w-:\\[.#][^{};>]*)(?={)" - }, - properties : { - exp : "([\\w-]+)(?=\\s*:)" - }, - units : { - exp : /([0-9])(em|en|px|%|pt)\b/, - replacement : "$1$2" - }, - urls : { - exp : /url\([^\)]*\)/ - } -}); - -CodeHighlighter.addStyle("html", { - comment : { - exp: /<!\s*(--([^-]|[\r\n]|-[^-])*--\s*)>/ - }, - tag : { - exp: /(<\/?)([a-zA-Z]+\s?)/, - replacement: "$1$2" - }, - string : { - exp : /'[^']*'|"[^"]*"/ - }, - attribute : { - exp: /\b([a-zA-Z-:]+)(=)/, - replacement: "$1$2" - }, - doctype : { - exp: /<!DOCTYPE([^&]|&[^g]|&g[^t])*>/ - } -}); - -CodeHighlighter.addStyle("javascript",{ - comment : { - exp : /(\/\/[^\n]*(\n|$))|(\/\*[^*]*\*+([^\/][^*]*\*+)*\/)/ - }, - brackets : { - exp : /\(|\)/ - }, - regex : { - exp : /\/(.*?)[g|s|m]?\/[;|\n]/ - }, - string : { - exp : /'(?:\.|(\\\')|[^\''])*'|"(?:\.|(\\\")|[^\""])*"/ - }, - keywords : { - exp : /\b(arguments|break|case|continue|default|delete|do|else|false|for|function|if|in|instanceof|new|null|return|switch|this|true|typeof|var|void|while|with)\b/ - }, - global : { - exp : /\b(toString|valueOf|window|element|prototype|constructor|document|escape|unescape|parseInt|parseFloat|setTimeout|clearTimeout|setInterval|clearInterval|NaN|isNaN|Infinity|alert|prompt|confirm)\b/ - } -}); diff --git a/templates/html/assets/javascripts/prototype.js b/templates/html/assets/javascripts/prototype.js index a0114e0..9fe6e12 100644 --- a/templates/html/assets/javascripts/prototype.js +++ b/templates/html/assets/javascripts/prototype.js @@ -1,4 +1,4 @@ -/* Prototype JavaScript framework, version 1.6.0.3 +/* Prototype JavaScript framework, version 1.6.1 * (c) 2005-2009 Sam Stephenson * * Prototype is freely distributable under the terms of an MIT-style license. @@ -7,38 +7,42 @@ *--------------------------------------------------------------------------*/ var Prototype = { - Version: '1.6.0.4_rc0', + Version: '1.6.1', - Browser: { - IE: !!(window.attachEvent && - navigator.userAgent.indexOf('Opera') === -1), - Opera: navigator.userAgent.indexOf('Opera') > -1, - WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, - Gecko: navigator.userAgent.indexOf('Gecko') > -1 && - navigator.userAgent.indexOf('KHTML') === -1, - MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) - }, + Browser: (function(){ + var ua = navigator.userAgent; + var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]'; + return { + IE: !!window.attachEvent && !isOpera, + Opera: isOpera, + WebKit: ua.indexOf('AppleWebKit/') > -1, + Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1, + MobileSafari: /Apple.*Mobile.*Safari/.test(ua) + } + })(), BrowserFeatures: { XPath: !!document.evaluate, SelectorsAPI: !!document.querySelector, ElementExtensions: (function() { - if (window.HTMLElement && window.HTMLElement.prototype) - return true; - if (window.Element && window.Element.prototype) - return true; + var constructor = window.Element || window.HTMLElement; + return !!(constructor && constructor.prototype); })(), SpecificElementExtensions: (function() { if (typeof window.HTMLDivElement !== 'undefined') return true; var div = document.createElement('div'); - if (div['__proto__'] && div['__proto__'] !== - document.createElement('form')['__proto__']) { - return true; + var form = document.createElement('form'); + var isSupported = false; + + if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) { + isSupported = true; } - return false; + div = form = null; + + return isSupported; })() }, @@ -75,6 +79,7 @@ var Try = { /* Based on Alex Arnell's inheritance implementation. */ var Class = (function() { + function subclass() {}; function create() { var parent = null, properties = $A(arguments); if (Object.isFunction(properties[0])) @@ -89,7 +94,6 @@ var Class = (function() { klass.subclasses = []; if (parent) { - var subclass = function() {}; subclass.prototype = parent.prototype; klass.prototype = new subclass; parent.subclasses.push(klass); @@ -143,10 +147,7 @@ var Class = (function() { })(); (function() { - function getClass(object) { - return Object.prototype.toString.call(object) - .match(/^\[object\s(.*)\]$/)[1]; - } + var _toString = Object.prototype.toString; function extend(destination, source) { for (var property in source) @@ -219,7 +220,7 @@ var Class = (function() { } function isArray(object) { - return getClass(object) === "Array"; + return _toString.call(object) == "[object Array]"; } @@ -232,11 +233,11 @@ var Class = (function() { } function isString(object) { - return getClass(object) === "String"; + return _toString.call(object) == "[object String]"; } function isNumber(object) { - return getClass(object) === "Number"; + return _toString.call(object) == "[object Number]"; } function isUndefined(object) { @@ -394,8 +395,10 @@ var PeriodicalExecuter = Class.create({ try { this.currentlyExecuting = true; this.execute(); - } finally { this.currentlyExecuting = false; + } catch(e) { + this.currentlyExecuting = false; + throw e; } } } @@ -473,7 +476,7 @@ Object.extend(String.prototype, (function() { } function stripTags() { - return this.replace(/<\/?[^>]+>/gi, ''); + return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi, ''); } function stripScripts() { @@ -493,18 +496,14 @@ Object.extend(String.prototype, (function() { } function escapeHTML() { - escapeHTML.text.data = this; - return escapeHTML.div.innerHTML; + return this.replace(/&/g,'&').replace(//g,'>'); } function unescapeHTML() { - var div = new Element('div'); - div.innerHTML = this.stripTags(); - return div.childNodes[0] ? (div.childNodes.length > 1 ? - $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) : - div.childNodes[0].nodeValue) : ''; + return this.stripTags().replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&'); } + function toQueryParams(separator) { var match = this.strip().match(/([^?#]*)(#.*)?$/); if (!match) return { }; @@ -557,17 +556,23 @@ Object.extend(String.prototype, (function() { } function underscore() { - return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); + return this.replace(/::/g, '/') + .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2') + .replace(/([a-z\d])([A-Z])/g, '$1_$2') + .replace(/-/g, '_') + .toLowerCase(); } function dasherize() { - return this.gsub(/_/,'-'); + return this.replace(/_/g, '-'); } function inspect(useDoubleQuotes) { - var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) { - var character = String.specialChar[match[0]]; - return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16); + var escapedString = this.replace(/[\x00-\x1f\\]/g, function(character) { + if (character in String.specialChar) { + return String.specialChar[character]; + } + return '\\u00' + character.charCodeAt().toPaddedString(2, 16); }); if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; return "'" + escapedString.replace(/'/g, '\\\'') + "'"; @@ -578,7 +583,7 @@ Object.extend(String.prototype, (function() { } function unfilterJSON(filter) { - return this.sub(filter || Prototype.JSONFilter, '#{1}'); + return this.replace(filter || Prototype.JSONFilter, '$1'); } function isJSON() { @@ -626,7 +631,7 @@ Object.extend(String.prototype, (function() { sub: sub, scan: scan, truncate: truncate, - strip: strip, + strip: String.prototype.trim ? String.prototype.trim : strip, stripTags: stripTags, stripScripts: stripScripts, extractScripts: extractScripts, @@ -656,22 +661,6 @@ Object.extend(String.prototype, (function() { }; })()); -if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, { - escapeHTML: function() { - return this.replace(/&/g,'&').replace(//g,'>'); - }, - unescapeHTML: function() { - return this.stripTags().replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&'); - } -}); - -Object.extend(String.prototype.escapeHTML, { - div: document.createElement('div'), - text: document.createTextNode('') -}); - -String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text); - var Template = Class.create({ initialize: function(template, pattern) { this.template = template.toString(); @@ -679,11 +668,11 @@ var Template = Class.create({ }, evaluate: function(object) { - if (Object.isFunction(object.toTemplateReplacements)) + if (object && Object.isFunction(object.toTemplateReplacements)) object = object.toTemplateReplacements(); return this.template.gsub(this.pattern, function(match) { - if (object == null) return ''; + if (object == null) return (match[1] + ''); var before = match[1] || ''; if (before == '\\') return match[2]; @@ -694,7 +683,7 @@ var Template = Class.create({ if (match == null) return before; while (match != null) { - var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1]; + var comp = match[1].startsWith('[') ? match[2].replace(/\\\\]/g, ']') : match[1]; ctx = ctx[comp]; if (null == ctx || '' == match[3]) break; expr = expr.substring('[' == match[3] ? match[1].length : match[0].length); @@ -913,6 +902,14 @@ var Enumerable = (function() { return '#'; } + + + + + + + + return { each: each, eachSlice: eachSlice, @@ -948,24 +945,12 @@ var Enumerable = (function() { })(); function $A(iterable) { if (!iterable) return []; - if (iterable.toArray) return iterable.toArray(); + if ('toArray' in Object(iterable)) return iterable.toArray(); var length = iterable.length || 0, results = new Array(length); while (length--) results[length] = iterable[length]; return results; } -if (Prototype.Browser.WebKit) { - $A = function(iterable) { - if (!iterable) return []; - if (!(typeof iterable === 'function' && typeof iterable.length === - 'number' && typeof iterable.item === 'function') && iterable.toArray) - return iterable.toArray(); - var length = iterable.length || 0, results = new Array(length); - while (length--) results[length] = iterable[length]; - return results; - }; -} - function $w(string) { if (!Object.isString(string)) return []; string = string.strip(); @@ -974,6 +959,7 @@ function $w(string) { Array.from = $A; + (function() { var arrayProto = Array.prototype, slice = arrayProto.slice, @@ -1024,10 +1010,6 @@ Array.from = $A; return (inline !== false ? this : this.toArray())._reverse(); } - function reduce() { - return this.length > 1 ? this : this[0]; - } - function uniq(sorted) { return this.inject([], function(array, value, index) { if (0 == index || (sorted ? array.last() != value : !array.include(value))) @@ -1042,6 +1024,7 @@ Array.from = $A; }); } + function clone() { return slice.call(this, 0); } @@ -1106,7 +1089,6 @@ Array.from = $A; flatten: flatten, without: without, reverse: reverse, - reduce: reduce, uniq: uniq, intersect: intersect, clone: clone, @@ -1326,6 +1308,8 @@ var ObjectRange = Class.create(Enumerable, (function() { }; })()); + + var Ajax = { getTransport: function() { return Try.these( @@ -1337,6 +1321,7 @@ var Ajax = { activeRequestCount: 0 }; + Ajax.Responders = { responders: [], @@ -1540,7 +1525,7 @@ Ajax.Request = Class.create(Ajax.Base, { getHeader: function(name) { try { return this.transport.getResponseHeader(name) || null; - } catch (e) { return null } + } catch (e) { return null; } }, evalResponse: function() { @@ -1559,6 +1544,14 @@ Ajax.Request = Class.create(Ajax.Base, { Ajax.Request.Events = ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; + + + + + + + + Ajax.Response = Class.create({ initialize: function(request){ this.request = request; @@ -1580,6 +1573,7 @@ Ajax.Response = Class.create({ }, status: 0, + statusText: '', getStatus: Ajax.Request.prototype.getStatus, @@ -1632,6 +1626,7 @@ Ajax.Response = Class.create({ } } }); + Ajax.Updater = Class.create(Ajax.Request, { initialize: function($super, container, url, options) { this.container = { @@ -1667,6 +1662,7 @@ Ajax.Updater = Class.create(Ajax.Request, { } } }); + Ajax.PeriodicalUpdater = Class.create(Ajax.Base, { initialize: function($super, container, url, options) { $super(options); @@ -1755,12 +1751,28 @@ if (!Node.ELEMENT_NODE) { (function(global) { + + var SETATTRIBUTE_IGNORES_NAME = (function(){ + var elForm = document.createElement("form"); + var elInput = document.createElement("input"); + var root = document.documentElement; + elInput.setAttribute("name", "test"); + elForm.appendChild(elInput); + root.appendChild(elForm); + var isBuggy = elForm.elements + ? (typeof elForm.elements.test == "undefined") + : null; + root.removeChild(elForm); + elForm = elInput = null; + return isBuggy; + })(); + var element = global.Element; global.Element = function(tagName, attributes) { attributes = attributes || { }; tagName = tagName.toLowerCase(); var cache = Element.cache; - if (Prototype.Browser.IE && attributes.name) { + if (SETATTRIBUTE_IGNORES_NAME && attributes.name) { tagName = '<' + tagName + ' name="' + attributes.name + '">'; delete attributes.name; return Element.writeAttribute(document.createElement(tagName), attributes); @@ -1805,15 +1817,89 @@ Element.Methods = { return element; }, - update: function(element, content) { - element = $(element); - if (content && content.toElement) content = content.toElement(); - if (Object.isElement(content)) return element.update().insert(content); - content = Object.toHTML(content); - element.innerHTML = content.stripScripts(); - content.evalScripts.bind(content).defer(); - return element; - }, + update: (function(){ + + var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){ + var el = document.createElement("select"), + isBuggy = true; + el.innerHTML = ""; + if (el.options && el.options[0]) { + isBuggy = el.options[0].nodeName.toUpperCase() !== "OPTION"; + } + el = null; + return isBuggy; + })(); + + var TABLE_ELEMENT_INNERHTML_BUGGY = (function(){ + try { + var el = document.createElement("table"); + if (el && el.tBodies) { + el.innerHTML = "test"; + var isBuggy = typeof el.tBodies[0] == "undefined"; + el = null; + return isBuggy; + } + } catch (e) { + return true; + } + })(); + + var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING = (function () { + var s = document.createElement("script"), + isBuggy = false; + try { + s.appendChild(document.createTextNode("")); + isBuggy = !s.firstChild || + s.firstChild && s.firstChild.nodeType !== 3; + } catch (e) { + isBuggy = true; + } + s = null; + return isBuggy; + })(); + + function update(element, content) { + element = $(element); + + if (content && content.toElement) + content = content.toElement(); + + if (Object.isElement(content)) + return element.update().insert(content); + + content = Object.toHTML(content); + + var tagName = element.tagName.toUpperCase(); + + if (tagName === 'SCRIPT' && SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING) { + element.text = content; + return element; + } + + if (SELECT_ELEMENT_INNERHTML_BUGGY || TABLE_ELEMENT_INNERHTML_BUGGY) { + if (tagName in Element._insertionTranslations.tags) { + while (element.firstChild) { + element.removeChild(element.firstChild); + } + Element._getContentFromAnonymousElement(tagName, content.stripScripts()) + .each(function(node) { + element.appendChild(node) + }); + } + else { + element.innerHTML = content.stripScripts(); + } + } + else { + element.innerHTML = content.stripScripts(); + } + + content.evalScripts.bind(content).defer(); + return element; + } + + return update; + })(), replace: function(element, content) { element = $(element); @@ -1898,7 +1984,7 @@ Element.Methods = { }, ancestors: function(element) { - return $(element).recursivelyCollect('parentNode'); + return Element.recursivelyCollect(element, 'parentNode'); }, descendants: function(element) { @@ -1919,16 +2005,17 @@ Element.Methods = { }, previousSiblings: function(element) { - return $(element).recursivelyCollect('previousSibling'); + return Element.recursivelyCollect(element, 'previousSibling'); }, nextSiblings: function(element) { - return $(element).recursivelyCollect('nextSibling'); + return Element.recursivelyCollect(element, 'nextSibling'); }, siblings: function(element) { element = $(element); - return element.previousSiblings().reverse().concat(element.nextSiblings()); + return Element.previousSiblings(element).reverse() + .concat(Element.nextSiblings(element)); }, match: function(element, selector) { @@ -1940,22 +2027,22 @@ Element.Methods = { up: function(element, expression, index) { element = $(element); if (arguments.length == 1) return $(element.parentNode); - var ancestors = element.ancestors(); + var ancestors = Element.ancestors(element); return Object.isNumber(expression) ? ancestors[expression] : Selector.findElement(ancestors, expression, index); }, down: function(element, expression, index) { element = $(element); - if (arguments.length == 1) return element.firstDescendant(); - return Object.isNumber(expression) ? element.descendants()[expression] : + if (arguments.length == 1) return Element.firstDescendant(element); + return Object.isNumber(expression) ? Element.descendants(element)[expression] : Element.select(element, expression)[index || 0]; }, previous: function(element, expression, index) { element = $(element); if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element)); - var previousSiblings = element.previousSiblings(); + var previousSiblings = Element.previousSiblings(element); return Object.isNumber(expression) ? previousSiblings[expression] : Selector.findElement(previousSiblings, expression, index); }, @@ -1963,67 +2050,44 @@ Element.Methods = { next: function(element, expression, index) { element = $(element); if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element)); - var nextSiblings = element.nextSiblings(); + var nextSiblings = Element.nextSiblings(element); return Object.isNumber(expression) ? nextSiblings[expression] : Selector.findElement(nextSiblings, expression, index); }, - select: function() { - var args = $A(arguments), element = $(args.shift()); + select: function(element) { + var args = Array.prototype.slice.call(arguments, 1); return Selector.findChildElements(element, args); }, - adjacent: function() { - var args = $A(arguments), element = $(args.shift()); + adjacent: function(element) { + var args = Array.prototype.slice.call(arguments, 1); return Selector.findChildElements(element.parentNode, args).without(element); }, identify: function(element) { element = $(element); - var id = element.readAttribute('id'); + var id = Element.readAttribute(element, 'id'); if (id) return id; do { id = 'anonymous_element_' + Element.idCounter++ } while ($(id)); - element.writeAttribute('id', id); + Element.writeAttribute(element, 'id', id); return id; }, - readAttribute: (function(){ - - var iframeGetAttributeThrowsError = (function(){ - var el = document.createElement('iframe'), - isBuggy = false; - - document.documentElement.appendChild(el); - try { - el.getAttribute('type', 2); - } catch(e) { - isBuggy = true; + readAttribute: function(element, name) { + element = $(element); + if (Prototype.Browser.IE) { + var t = Element._attributeTranslations.read; + if (t.values[name]) return t.values[name](element, name); + if (t.names[name]) name = t.names[name]; + if (name.include(':')) { + return (!element.attributes || !element.attributes[name]) ? null : + element.attributes[name].value; } - document.documentElement.removeChild(el); - el = null; - return isBuggy; - })(); - - return function(element, name) { - element = $(element); - if (iframeGetAttributeThrowsError && - name === 'type' && - element.tagName.toUpperCase() == 'IFRAME') { - return element.getAttribute('type'); - } - if (Prototype.Browser.IE) { - var t = Element._attributeTranslations.read; - if (t.values[name]) return t.values[name](element, name); - if (t.names[name]) name = t.names[name]; - if (name.include(':')) { - return (!element.attributes || !element.attributes[name]) ? null : - element.attributes[name].value; - } - } - return element.getAttribute(name); } - })(), + return element.getAttribute(name); + }, writeAttribute: function(element, name, value) { element = $(element); @@ -2046,11 +2110,11 @@ Element.Methods = { }, getHeight: function(element) { - return $(element).getDimensions().height; + return Element.getDimensions(element).height; }, getWidth: function(element) { - return $(element).getDimensions().width; + return Element.getDimensions(element).width; }, classNames: function(element) { @@ -2066,7 +2130,7 @@ Element.Methods = { addClassName: function(element, className) { if (!(element = $(element))) return; - if (!element.hasClassName(className)) + if (!Element.hasClassName(element, className)) element.className += (element.className ? ' ' : '') + className; return element; }, @@ -2080,8 +2144,8 @@ Element.Methods = { toggleClassName: function(element, className) { if (!(element = $(element))) return; - return element[element.hasClassName(className) ? - 'removeClassName' : 'addClassName'](className); + return Element[Element.hasClassName(element, className) ? + 'removeClassName' : 'addClassName'](element, className); }, cleanWhitespace: function(element) { @@ -2117,7 +2181,7 @@ Element.Methods = { scrollTo: function(element) { element = $(element); - var pos = element.cumulativeOffset(); + var pos = Element.cumulativeOffset(element); window.scrollTo(pos[0], pos[1]); return element; }, @@ -2165,7 +2229,7 @@ Element.Methods = { getDimensions: function(element) { element = $(element); - var display = element.getStyle('display'); + var display = Element.getStyle(element, 'display'); if (display != 'none' && display != null) // Safari bug return {width: element.offsetWidth, height: element.offsetHeight}; @@ -2256,9 +2320,9 @@ Element.Methods = { absolutize: function(element) { element = $(element); - if (element.getStyle('position') == 'absolute') return element; + if (Element.getStyle(element, 'position') == 'absolute') return element; - var offsets = element.positionedOffset(); + var offsets = Element.positionedOffset(element); var top = offsets[1]; var left = offsets[0]; var width = element.clientWidth; @@ -2279,7 +2343,7 @@ Element.Methods = { relativize: function(element) { element = $(element); - if (element.getStyle('position') == 'relative') return element; + if (Element.getStyle(element, 'position') == 'relative') return element; element.style.position = 'relative'; var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); @@ -2348,14 +2412,14 @@ Element.Methods = { }, arguments[2] || { }); source = $(source); - var p = source.viewportOffset(); + var p = Element.viewportOffset(source); element = $(element); var delta = [0, 0]; var parent = null; if (Element.getStyle(element, 'position') == 'absolute') { - parent = element.getOffsetParent(); - delta = parent.viewportOffset(); + parent = Element.getOffsetParent(element); + delta = Element.viewportOffset(parent); } if (parent == document.body) { @@ -2510,41 +2574,92 @@ else if (Prototype.Browser.IE) { return element; }; - Element._attributeTranslations = { - read: { - names: { - 'class': 'className', - 'for': 'htmlFor' - }, - values: { - _getAttr: function(element, attribute) { - return element.getAttribute(attribute, 2); - }, - _getAttrNode: function(element, attribute) { - var node = element.getAttributeNode(attribute); - return node ? node.value : ""; - }, - _getEv: function(element, attribute) { - attribute = element.getAttribute(attribute); + Element._attributeTranslations = (function(){ - if (!attribute) return null; - attribute = attribute.toString(); - attribute = attribute.split('{')[1]; - attribute = attribute.split('}')[0]; - return attribute.strip(); + var classProp = 'className'; + var forProp = 'for'; + + var el = document.createElement('div'); + + el.setAttribute(classProp, 'x'); + + if (el.className !== 'x') { + el.setAttribute('class', 'x'); + if (el.className === 'x') { + classProp = 'class'; + } + } + el = null; + + el = document.createElement('label'); + el.setAttribute(forProp, 'x'); + if (el.htmlFor !== 'x') { + el.setAttribute('htmlFor', 'x'); + if (el.htmlFor === 'x') { + forProp = 'htmlFor'; + } + } + el = null; + + return { + read: { + names: { + 'class': classProp, + 'className': classProp, + 'for': forProp, + 'htmlFor': forProp }, - _flag: function(element, attribute) { - return $(element).hasAttribute(attribute) ? attribute : null; - }, - style: function(element) { - return element.style.cssText.toLowerCase(); - }, - title: function(element) { - return element.title; + values: { + _getAttr: function(element, attribute) { + return element.getAttribute(attribute); + }, + _getAttr2: function(element, attribute) { + return element.getAttribute(attribute, 2); + }, + _getAttrNode: function(element, attribute) { + var node = element.getAttributeNode(attribute); + return node ? node.value : ""; + }, + _getEv: (function(){ + + var el = document.createElement('div'); + el.onclick = Prototype.emptyFunction; + var value = el.getAttribute('onclick'); + var f; + + if (String(value).indexOf('{') > -1) { + f = function(element, attribute) { + attribute = element.getAttribute(attribute); + if (!attribute) return null; + attribute = attribute.toString(); + attribute = attribute.split('{')[1]; + attribute = attribute.split('}')[0]; + return attribute.strip(); + }; + } + else if (value === '') { + f = function(element, attribute) { + attribute = element.getAttribute(attribute); + if (!attribute) return null; + return attribute.strip(); + }; + } + el = null; + return f; + })(), + _flag: function(element, attribute) { + return $(element).hasAttribute(attribute) ? attribute : null; + }, + style: function(element) { + return element.style.cssText.toLowerCase(); + }, + title: function(element) { + return element.title; + } } } } - }; + })(); Element._attributeTranslations.write = { names: Object.extend({ @@ -2572,8 +2687,8 @@ else if (Prototype.Browser.IE) { (function(v) { Object.extend(v, { - href: v._getAttr, - src: v._getAttr, + href: v._getAttr2, + src: v._getAttr2, type: v._getAttr, action: v._getAttrNode, disabled: v._flag, @@ -2664,29 +2779,7 @@ else if (Prototype.Browser.WebKit) { }; } -if (Prototype.Browser.IE || Prototype.Browser.Opera) { - Element.Methods.update = function(element, content) { - element = $(element); - - if (content && content.toElement) content = content.toElement(); - if (Object.isElement(content)) return element.update().insert(content); - - content = Object.toHTML(content); - var tagName = element.tagName.toUpperCase(); - - if (tagName in Element._insertionTranslations.tags) { - $A(element.childNodes).each(function(node) { element.removeChild(node) }); - Element._getContentFromAnonymousElement(tagName, content.stripScripts()) - .each(function(node) { element.appendChild(node) }); - } - else element.innerHTML = content.stripScripts(); - - content.evalScripts.bind(content).defer(); - return element; - }; -} - -if ('outerHTML' in document.createElement('div')) { +if ('outerHTML' in document.documentElement) { Element.Methods.replace = function(element, content) { element = $(element); @@ -2754,12 +2847,13 @@ Element._insertionTranslations = { }; (function() { - Object.extend(this.tags, { - THEAD: this.tags.TBODY, - TFOOT: this.tags.TBODY, - TH: this.tags.TD + var tags = Element._insertionTranslations.tags; + Object.extend(tags, { + THEAD: tags.TBODY, + TFOOT: tags.TBODY, + TH: tags.TD }); -}).call(Element._insertionTranslations); +})(); Element.Methods.Simulated = { hasAttribute: function(element, attribute) { @@ -2786,8 +2880,49 @@ Object.extend(Element, Element.Methods); })(document.createElement('div')) Element.extend = (function() { - if (Prototype.BrowserFeatures.SpecificElementExtensions) + + function checkDeficiency(tagName) { + if (typeof window.Element != 'undefined') { + var proto = window.Element.prototype; + if (proto) { + var id = '_' + (Math.random()+'').slice(2); + var el = document.createElement(tagName); + proto[id] = 'x'; + var isBuggy = (el[id] !== 'x'); + delete proto[id]; + el = null; + return isBuggy; + } + } + return false; + } + + function extendElementWith(element, methods) { + for (var property in methods) { + var value = methods[property]; + if (Object.isFunction(value) && !(property in element)) + element[property] = value.methodize(); + } + } + + var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY = checkDeficiency('object'); + + if (Prototype.BrowserFeatures.SpecificElementExtensions) { + if (HTMLOBJECTELEMENT_PROTOTYPE_BUGGY) { + return function(element) { + if (element && typeof element._extendedByPrototype == 'undefined') { + var t = element.tagName; + if (t && (/^(?:object|applet|embed)$/i.test(t))) { + extendElementWith(element, Element.Methods); + extendElementWith(element, Element.Methods.Simulated); + extendElementWith(element, Element.Methods.ByTag[t.toUpperCase()]); + } + } + return element; + } + } return Prototype.K; + } var Methods = { }, ByTag = Element.Methods.ByTag; @@ -2796,15 +2931,11 @@ Element.extend = (function() { element.nodeType != 1 || element == window) return element; var methods = Object.clone(Methods), - tagName = element.tagName.toUpperCase(), property, value; + tagName = element.tagName.toUpperCase(); if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]); - for (property in methods) { - value = methods[property]; - if (Object.isFunction(value) && !(property in element)) - element[property] = value.methodize(); - } + extendElementWith(element, methods); element._extendedByPrototype = Prototype.emptyFunction; return element; @@ -2987,9 +3118,9 @@ Element.addMethods({ if (!(element = $(element))) return; if (arguments.length === 2) { - element.getStorage().update(key); + Element.getStorage(element).update(key); } else { - element.getStorage().set(key, value); + Element.getStorage(element).set(key, value); } return element; @@ -3005,6 +3136,20 @@ Element.addMethods({ } return value; + }, + + clone: function(element, deep) { + if (!(element = $(element))) return; + var clone = element.cloneNode(deep); + clone._prototypeUID = void 0; + if (deep) { + var descendants = Element.select(clone, '*'), + i = descendants.length; + while (i--) { + descendants[i]._prototypeUID = void 0; + } + } + return Element.extend(clone); } }); /* Portions of the Selector class are derived from Jack Slocum's DomQuery, @@ -3147,7 +3292,7 @@ var Selector = Class.create({ case 'selectorsAPI': if (root !== document) { var oldId = root.id, id = $(root).identify(); - id = id.replace(/[\.:]/g, "\\$0"); + id = id.replace(/([\.:])/g, "\\$1"); e = "#" + id + " " + e; } @@ -3395,11 +3540,31 @@ Object.extend(Selector, { return nodes; }, - unmark: function(nodes) { - for (var i = 0, node; node = nodes[i]; i++) - node._countedByPrototype = undefined; - return nodes; - }, + unmark: (function(){ + + var PROPERTIES_ATTRIBUTES_MAP = (function(){ + var el = document.createElement('div'), + isBuggy = false, + propName = '_countedByPrototype', + value = 'x' + el[propName] = value; + isBuggy = (el.getAttribute(propName) === value); + el = null; + return isBuggy; + })(); + + return PROPERTIES_ATTRIBUTES_MAP ? + function(nodes) { + for (var i = 0, node; node = nodes[i]; i++) + node.removeAttribute('_countedByPrototype'); + return nodes; + } : + function(nodes) { + for (var i = 0, node; node = nodes[i]; i++) + node._countedByPrototype = void 0; + return nodes; + } + })(), index: function(parentNode, reverse, ofType) { parentNode._countedByPrototype = Prototype.emptyFunction; @@ -3741,12 +3906,6 @@ if (Prototype.Browser.IE) { for (var i = 0, node; node = b[i]; i++) if (node.tagName !== "!") a.push(node); return a; - }, - - unmark: function(nodes) { - for (var i = 0, node; node = nodes[i]; i++) - node.removeAttribute('_countedByPrototype'); - return nodes; } }); } @@ -3792,13 +3951,18 @@ Form.Methods = { }, getElements: function(form) { - return $A($(form).getElementsByTagName('*')).inject([], - function(elements, child) { - if (Form.Element.Serializers[child.tagName.toLowerCase()]) - elements.push(Element.extend(child)); - return elements; - } - ); + var elements = $(form).getElementsByTagName('*'), + element, + arr = [ ], + serializers = Form.Element.Serializers; + for (var i = 0; element = elements[i]; i++) { + arr.push(element); + } + return arr.inject([], function(elements, child) { + if (serializers[child.tagName.toLowerCase()]) + elements.push(Element.extend(child)); + return elements; + }) }, getInputs: function(form, typeName, name) { @@ -3838,7 +4002,7 @@ Form.Methods = { }).sortBy(function(element) { return element.tabIndex }).first(); return firstByIndex ? firstByIndex : elements.find(function(element) { - return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); + return /^(?:input|select|textarea)$/i.test(element.tagName); }); }, @@ -3924,7 +4088,7 @@ Form.Element.Methods = { try { element.focus(); if (element.select && (element.tagName.toLowerCase() != 'input' || - !['button', 'reset', 'submit'].include(element.type))) + !(/^(?:button|reset|submit)$/i.test(element.type)))) element.select(); } catch (e) { } return element; @@ -4118,6 +4282,10 @@ Form.EventObserver = Class.create(Abstract.EventObserver, { cache: {} }; + var docEl = document.documentElement; + var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl + && 'onmouseleave' in docEl; + var _isButton; if (Prototype.Browser.IE) { var buttonMap = { 0: 1, 1: 4, 2: 2 }; @@ -4270,7 +4438,7 @@ Form.EventObserver = Class.create(Abstract.EventObserver, { } var respondersForEvent = registry.get(eventName); - if (Object.isUndefined()) { + if (Object.isUndefined(respondersForEvent)) { respondersForEvent = []; registry.set(eventName, respondersForEvent); } @@ -4290,7 +4458,7 @@ Form.EventObserver = Class.create(Abstract.EventObserver, { handler.call(element, event); }; } else { - if (!Prototype.Browser.IE && + if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED && (eventName === "mouseenter" || eventName === "mouseleave")) { if (eventName === "mouseenter" || eventName === "mouseleave") { responder = function(event) { @@ -4338,7 +4506,7 @@ Form.EventObserver = Class.create(Abstract.EventObserver, { var _getDOMEventName = Prototype.K; - if (!Prototype.Browser.IE) { + if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) { _getDOMEventName = function(eventName) { var translations = { mouseenter: "mouseover", mouseleave: "mouseout" }; return eventName in translations ? translations[eventName] : eventName; diff --git a/templates/html/assets/stylesheets/api.css b/templates/html/assets/stylesheets/api.css index 41c4278..c0b304c 100644 --- a/templates/html/assets/stylesheets/api.css +++ b/templates/html/assets/stylesheets/api.css @@ -1,98 +1,123 @@ -/* - * API STYLES - */ +/* The "section" class implicitly needs a clearfix; adding it here for convenience. */ + +.clearfix:after, +.section:after { + content: "."; + display: block; + clear: both; + visibility: hidden; + line-height: 0; + height: 0; +} + +.clearfix, .section { + display: inline-block; +} + +html[xmlns] .clearfix, +html[xmlns] .section { + display: block; +} + +* html .clearfix, +* html .section { + height: 1%; +} + +span.replaced { visibility: hidden; } +span.hidden { display: none; } -/* tag styles */ -pre { +body { + font-family: Verdana, sans-serif; + font-size: 82.5%; + line-height: 1.5em; + margin: 0; padding: 0; } + body * { + margin: 0; + padding: 0; + } + +h1, h2, h3, h4, h5, h6 { + font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; +} + +pre { + white-space: pre-wrap; /* CSS 3 */ + white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ +} + +a img { + border: 0; +} + +ul, li { + list-style-type: none; +} + +ol, ul { + margin: 0 0 15px; +} + code { - font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", monospace; + font-family: "Panic Sans", "Bitstream Vera Sans Mono", Monaco, Consolas, Andale Mono, monospace; font-size: 12px; } -/* masthead */ -div#masthead { - background: url(../images/header-stripe-small.png) repeat-x top left; - height: 76px; +#page a.img, +#page a.img:link, +#page a.img:visited { + border: 0; } - div#masthead div#masthead_content { - margin: 0 auto; - width: 835px; - position: relative; - } - - div#masthead h1#logo { - background: url(../images/header-logo-small.png) no-repeat 0 1px; - width: 118px; - height: 76px; - position: relative; - left: 60px; - } - -/* footer */ -div#footer { - width: 960px; +.content { + padding-left: 120px; margin: 0 auto; } - div.about { - margin-top: 20px; - padding-top: 20px; - width: 835px; - margin-left: 120px; - border-top: 1px solid #aaa; - color: #aaa; - } - - div.about a, - div.about a:link { - color: #aaa; - text-decoration: underline; - border: 0; - } - - div.copyright, - div.credits { - width: 360px; - float: left; - } - - div.copyright .cc { - width: 115px; - margin-right: 5px; - text-align: center; - float: left; - } - - div.copyright .copyright-about { - width: 235px; - float: left; - } - - div.credits { - margin-left: 115px; - } - - -.page-title span.type { - display: block; - text-transform: uppercase; - font-size: 14px; - color: #aaa; - letter-spacing: 0; +#page { + margin: 0; + position: fixed; + top: 0; + bottom: 0; + right: 0; + left: 241px; + overflow-y: scroll; + overflow-x: auto; } -h2.page-title { - margin-top: 0; - line-height: 100%; + +/* MASTHEAD */ + +.masthead { + margin-top: 50px; + height: 75px; + padding: 1px 0; + background: url(../images/header-stripe-small.png) repeat-x; } +h1.logo { + width: 236px; + height: 150px; + background: url(../images/header-logo-small.png) no-repeat; +} + + h1.logo a { + text-decoration: none; + } + +/* BREADCRUMBS */ + ul.breadcrumbs { margin-left: 120px; + padding-left: 120px; + list-style-type: none; } ul.breadcrumbs li { @@ -101,114 +126,248 @@ ul.breadcrumbs { margin-right: 10px; margin-left: 0; } + + +/* PAGE CONTENT */ + +.page-content { + width: 715px; + margin: 30px 0 0; +} + + .page-content h2.page-title { + margin: 0 0 15px 120px; + line-height: 100%; + font-size: 27px; + letter-spacing: -1px; + color: #444; + } + + .page-introduction { + margin-left: 120px; + margin-bottom: 25px; + } + + .page-content a, + .page-content a:link { + color: #036; + border-bottom: 1px solid #036; + text-decoration: none; + } + + .page-content a:visited { + border-bottom: 1px solid #bbb; + } + + .page-content ul, + .page-content ol { + margin: 10px 0; + } + + .page-content li { + margin: 5px 0 8px 20px; + list-style-type: disc; + } + + .page-content p { + margin: 0 0 0.8em; + } + + .page-content code { + background-color: #f0f0f0; + border: 1px solid #ccc; + border-radius: 3px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + padding: 0 3px; + } + + .page-content pre { + color: #333; + background-color: #f0f0ff; + border: 1px solid #dde; + padding: 3px 5px; + margin: 0 0 1em; + } + + .page-content pre code { + background-color: transparent; + border: 0; + padding: 0; + line-height: 100%; + } + + + .page-content code { + + } + + .page-content h1 { + font-size: 27px; + color: #000; + margin: 1.0em 0 0.6em; + } + + .page-content h2 { + font-size: 23px; + color: #000; + margin: 1.0em 0 0.6em; + } + + .page-content h3 { + font-size: 20px; + color: #000; + margin: 1.0em 0 0.6em; + } + + .page-content h4 { + font-size: 17px; + color: #555; + margin: 1.0em 0 0.6em; + } + + .page-content h5 { + font-size: 15px; + color: #2a2a2a; + margin: 1.0em 0 0.6em; + } + + .page-content h6 { + font-size: 14px; + color: #000; + margin: 1.0em 0 0.6em; + } + +/* PAGE SECTIONS */ + +.section { + margin: 10px 0 15px; +} + + .section-title { + width: 110px; + float: left; + margin-right: 10px; + padding-right: 0; + text-align: right; + overflow: hidden; + } + + .section-title h3 { + color: #999; + font-size: 14px; + line-height: 110%; + margin-top: 3px; + padding-right: 10px; + padding-bottom: 5px; + } + + .section-content { + width: 595px; + float: left; + } +/* API STYLES */ +.page-title .type { + display: block; + text-transform: uppercase; + font-size: 14px; + color: #aaa; +} + + +ul.section-list { + list-style-type: none; + margin-top: 0; +} + + ul.section-list li { + list-style-type: none; + margin: 0 0 15px; + } + + ul.section-list li h4 { + margin-top: 0; + } + ul.method-list { margin-top: 0; } - - ul.method-list li { - margin-top: 0; - float: left; - margin-right: 5px; - margin-left: 0; - list-style-type: none; - } + ul.method-list li { + float: left; + margin: 0 5px 3px 0; + list-style-type: none; + padding-bottom: 0; + } + ul.method-list li a, ul.method-list li a:link { text-decoration: none; border: 0; } - + ul.method-details-list { margin-top: 0; } - - ul.method-details-list li.method-description { - margin-top: 0; - margin-bottom: 3.0em; - margin-left: 0; + + li.method-description { + margin: 0 0 2.0em; list-style-type: none; } - - ul.method-details-list li h4 { + + .method-description h4 { margin: 0 0 0.6em; line-height: 90%; } + + .method-description p { + margin: 0.8em 0; + } - ul.method-details-list li pre { - margin-top: 0; - } - - ul.method-details-list li pre code { - font-size: 13px; - } - - ul.method-details-list li code { - font-size: 12px; - } - - h4.inherited { - padding-top: 5px; - clear: left; - font-style: italic; - font-weight: bold; - font-size: 14px; - } - -.method-description h4 .method-permalink a { + + .method-description .method-permalink a { color: #aaa; text-decoration: none; - border: 0; + border-bottom: 0; font-size: 14px; } +h4.inherited { + clear: left; + font-size: 15px; + font-style: italic; +} + +pre.syntax { + margin-bottom: 5px; +} + ul.argument-list { - margin-top: -5px; - list-style-type: disc; - margin-left: 20px; + font-size: 12px; + padding: 0; + margin: 0; } ul.argument-list li { - list-style-type: disc; - font-size: 90%; - margin-bottom: 0; + line-height: 140%; + margin-top: 0px; + margin-bottom: 5px; } ul.argument-list li code { font-size: 11px; } -ul.section-list { - margin-top: 0; -} - - ul.section-list li { - margin-top: 0; - margin-left: 0; - list-style-type: none; - } - - ul.section-list li h4 { - margin-top: 0; + ul.argument-list .argument-name { + background-color: #eeffee; + border-color: #6b6; } - - -/* Aliases */ - -.alias, -.related-to { - font-style: italic; -} - - .alias code, - .related-to code { - font-style: normal; - } -/* Section icons */ + +/* SECTION ICONS */ .page-content .section .section-title h3 { padding-right: 24px; @@ -272,187 +431,6 @@ ul.section-list { background-image: url(../images/superclass.png); } -/* search box */ - -.search-results { - position: absolute; - background-color: #fff; - height: 200px; - width: 233px; - overflow: auto; - overflow-y: scroll; - overflow-x: hidden; - margin: 7px -11px 0; - border: 1px solid #999; - top: 28px; -} - - * html .search-results { - left: 486px; - top: 30px; - } - - -/* search result types */ - -.menu-item a, -.menu-item a:link { - display: block; - padding: 3px 10px 3px 28px; - background-position: 6px 50%; - background-repeat: no-repeat; - text-align: left; - text-decoration: none; - color: #333; - border-top: 1px solid #fff; - border-bottom: 1px solid #fff; - white-space: nowrap; - -} - - .menu-item a:hover, - .menu-item a.highlighted, - #menu .highlighted a { - border-top: 1px solid #69f; - border-bottom: 1px solid #69f; - background-color: #f0f0ff; - } - - -.menu-item a.section { - font-weight: bold; - background-image: url(../images/section.png); -} - -.menu-item a.class_method, -.menu-item a.instance_method { - background-image: url(../images/method.png); -} - -.menu-item a.class { - background-image: url(../images/class.png); -} - -.menu-item a.constructor { - background-image: url(../images/constructor.png); -} - -.menu-item a.class_property { - background-image: url(../images/class_property.png); -} - -.menu-item a.instance_property { - background-image: url(../images/instance_property.png); -} - -.menu-item a.namespace { - background-image: url(../images/namespace.png); -} - -.menu-item a.utility { - background-image: url(../images/utility.png); -} - - -/* halo around selected method */ - -.highlighter { - border: 3px solid #69f; - z-index: -1; - -webkit-border-radius: 15px; - -moz-border-radius: 15px; - border-radius: 15px; -} - -/* MENU */ - -div#menu { - width: 960px; - margin: 0 auto; - position: relative; -} - - #menu .api-box h2 a, - #menu .search-box { - width: 213px; - height: 25px; - line-height: 25px; - padding: 5px 10px; - margin-right: 5px; - text-align: center; - float: right; - } - - * html #menu .api-box h2 a, - * html #menu .search-box { - height: 30px; - line-height: 30px; - } - - #menu .api-box { - } - - #menu .api-box h2 a { - font-size: 14px; - font-weight: normal; - font-family: Verdana, sans-serif; - display: block; - background-color: #cde0fb; - border: 1px solid #669; - border-top: 0; - text-decoration: none; - color: #222; - } - - #menu .api-box .menu-items { - position: absolute; - background-color: #fff; - height: 200px; - width: 233px; - overflow: auto; - overflow-y: scroll; - overflow-x: hidden; - top: 35px; - border: 1px solid #999; - right: 5px; - } - - * html #menu .api-box .menu-items { - right: 10px; - top: 37px; - } - - #menu .api-box ul, - #menu .api-box li { - margin: 0; - padding: 0; - } - - #menu .api-box .menu-item a { - } - - #menu .search-box { - background-color: #cee8c3; - border: 1px solid #696; - border-top: 0; - } - - #menu .search-box input { - width: 150px; - padding: 3px 10px; - margin-top: 2px; - border: 1px solid #999; - border-radius: 10px; - -webkit-border-radius: 10px; - -moz-border-radius: 10px; - } - -#menu #search.ghosted { - color: #aaa; - text-align: left; -} - - /* notes */ p.note, @@ -460,7 +438,7 @@ p.alias, p.related-to { font-size: 11px; line-height: 14px; - padding: 5px 5px 5px 60px; + padding: 5px 20px 5px 60px; background-repeat: no-repeat; background-position: 20px 50%; border: 1px solid #000; @@ -484,4 +462,233 @@ p.related-to { border-color: #c9c; } +/* halo around selected method */ + +.highlighter { + border: 3px solid #69f; + z-index: -1; + -webkit-border-radius: 15px; + -moz-border-radius: 15px; + border-radius: 15px; +} + + +/* SIDEBAR */ + +#sidebar { + position: fixed; + top: 0; + bottom: 0; + left: 0; + width: 240px; + background: #fff; + font-size: 13px; +} + +#sidebar form.search-ribbon { + margin: 0; + height: 24px; + border-right: 1px solid #636363; + padding: 4px 0 3px; + border-bottom: 1px solid #587e93; + background: url(../images/search-background.png) repeat-x 0 0; + text-align: center; +} + +/* Keep these around for `Control.Tabs`. */ +.sidebar-tabs { display: none; } + +.menu-items ul { + margin: 0; +} + + .menu-items ul li { + list-style-type: none; + padding-left: 0; + margin-left: 0; + } + + .menu-items ul .menu-item a { + padding-left: 38px; + background-position: 16px 50%; + } + + .menu-items ul ul .menu-item a { + padding-left: 48px; + background-position: 26px 50%; + } + + .menu-items ul ul ul .menu-item a { + padding-left: 58px; + background-position: 36px 50%; + } + + .menu-items ul ul ul ul .menu-item a { + padding-left: 68px; + background-position: 46px 50%; + } + + + + .menu-item a, + .menu-item a:link { + display: block; + padding: 3px 10px 3px 28px; + background-position: 6px 50%; + background-repeat: no-repeat; + text-align: left; + text-decoration: none; + color: #333; + border-top: 1px solid #fff; + border-bottom: 1px solid #fff; + white-space: nowrap; + } + + .menu-item a:hover, + .menu-item a.highlighted, + #sidebar .highlighted a { + border-top: 1px solid #69f; + border-bottom: 1px solid #69f; + background-color: #f0f0ff; + } + + .menu-item a.class_method, + .menu-item a.instance_method { + background-image: url(../images/method.png); + } + + .menu-item a.class { + background-image: url(../images/class.png); + } + + .menu-item a.constructor { + background-image: url(../images/constructor.png); + } + + .menu-item a.class_property { + background-image: url(../images/class_property.png); + } + + .menu-item a.instance_property { + background-image: url(../images/instance_property.png); + } + + .menu-item a.namespace { + background-image: url(../images/namespace.png); + } + + .menu-item a.mixin { + background-image: url(../images/mixin.png); + } + + .menu-item a.utility { + background-image: url(../images/utility.png); + } + + .menu-item a.section { + margin: 0; + background-image: url(../images/section.png); + } + + #api_menu .menu-item a.section { + height: 22px; + font-weight: normal; + color: #a5a5a5; + margin-top: 0; + margin-bottom: 0; + border-top: 1px solid #000; + border-bottom: 1px solid #000; + background: url(../images/section-background.png) repeat-x 0 0; + } + +.menu-section { + margin-bottom: 1.0em; +} + +#menu_pane { + position: absolute; + top: 32px; + bottom: 0; + left: 0; + width: 239px; + border-right: 1px solid #636363; + overflow-y: scroll; + overflow-x: hidden; +} + +#search_pane { + width: 239px; + border-right: 1px solid #636363; + position: absolute; + top: 32px; + bottom: 0; + left: 0; +} + + #search_results { + margin: 0; + padding: 0; + overflow-y: scroll; + overflow-x: hidden; + position: absolute; + top: 0; + bottom: 0; + width: 239px; + } + +#search { + width: 200px; + padding: 2px 3px; +} + +input.ghosted { + font-style: italic; + color: #aaa; +} + + +/* FOOTER */ + +#footer { + color: #bbb; + width: 595px; + margin-left: 120px; + margin-top: 30px; +} + + #footer .content { + border-top: 1px solid #ccc; + margin: 0; + padding: 30px 0; + } + + #footer a, + #footer a:link { + color: #999; + } + + .cc { + float: left; + width: 360px; + } + + .cc span { + float: left; + width: 110px; + margin-right: 10px; + text-align: center; + padding-top: 6px; + } + + .cc p { + float: left; + width: 180px; + } + + .credits { + float: left; + width: 235px; + } + + diff --git a/templates/html/assets/stylesheets/core.css b/templates/html/assets/stylesheets/core.css deleted file mode 100644 index 6378bfa..0000000 --- a/templates/html/assets/stylesheets/core.css +++ /dev/null @@ -1,415 +0,0 @@ -/* The "section" class implicitly needs a clearfix; adding it here for convenience. */ - -.clearfix:after, -.section:after { - content: "."; - display: block; - clear: both; - visibility: hidden; - line-height: 0; - height: 0; -} - -.clearfix, .section { - display: inline-block; -} - -html[xmlns] .clearfix, -html[xmlns] .section { - display: block; -} - -* html .clearfix, -* html .section { - height: 1%; -} - -span.replaced { visibility: hidden; } -span.hidden { display: none; } - - -body { - font-family: Verdana, sans-serif; - font-size: 82.5%; - line-height: 1.5em; - margin: 0; - padding: 0; -} - - body * { - margin: 0; - padding: 0; - } - - -h1, h2, h3, h4, h5, h6 { - font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; -} - -h4 { - font-size: 17px; - color: #555; - margin: 1.0em 0 0.6em; -} - -h5 { - font-size: 15px; - color: #2a2a2a; - margin: 1.0em 0 0.6em; -} - -h6 { - font-size: 14px; - color: #000; - margin: 1.0em 0 0.6em; -} - -a img { - border: 0; -} - -ul, li { - list-style-type: none; -} - -ol, ul { - margin: 0 0 15px; -} - -#page a.img, -#page a.img:link, -#page a.img:visited { - border: none; -} - -/* Link bar */ - -div#links { - margin: 0 auto; - width: 835px; - padding: 16px 0; - height: 16px; - overflow: hidden; -} - -div#links_wrapper { - background: #fff; -} - -div#links li { - display: inline; -} - -div#links li a { - color: #666; -} - -div#links li.selected a { - color: #000; - font-weight: bold; - text-decoration: none; -} - -ul#internal_links { - float: left; -} - -ul#internal_links li { - margin-right: 25px; -} - -ul#external_links { - float: right; -} - -ul#external_links li { - margin-left: 25px; - padding-left: 21px; -} - -li#scripty_link { - background: url(http://prototype.conio.net/new/images/link-logo-scripty.png) no-repeat center left; -} - -li#rails_link { - background: url(http://prototype.conio.net/new/images/link-logo-rails.png) no-repeat center left; -} - - - -p a, p a:link, -h1 a, h1 a:link, -h2 a, h2 a:link, -h3 a, h3 a:link, -h4 a, h4 a:link, -h5 a, h5 a:link, -h6 a, h6 a:link { - color: #036; - border-bottom: 1px solid #036; - text-decoration: none; -} - - p a:visited { - border-bottom: 1px solid #666; - } - -code { - font-family: "Panic Sans", "Bitstream Vera Sans Mono", Monaco, Consolas, Andale Mono, monospace; - font-size: 13px; -} - -p code, -li code { - background-color: #f0f0f0; - border: 1px solid #ccc; - border-radius: 3px; - -webkit-border-radius: 3px; - padding: 0 3px; -} - -pre code { - background-color: transparent; - border: 0; - padding: 0; -} - - -#page { - margin: 0 auto; - padding-bottom: 100px; /* FIXME: Temporary as pages are built */ -} - - -/* top */ - -.related-links { - width: 835px; - font-size: 0.9em; - margin: 0 auto 10px; - padding: 10px 0 0; -} - - .related-links a { - color: #000; - text-decoration: none; - } - - .related-links ul { - list-style-type: none; - } - - .related-links ul.internal { - float: left; - width: 355px; - } - - .related-links ul.internal li { - text-align: center; - } - - .related-links ul.external { - float: right; - width: 295px; - } - - .related-links li { - float: left; - padding: 0 15px; - width: 85px; - margin-right: 5px; - } - - .related-links li.last { - margin-right: 0; - } - - .related-links ul.external li.scripty { - padding: 0 8px 0 22px; - background: url(../images/icon-scripty.png) no-repeat; - margin-right: 65px; - } - - .related-links ul.external li.rails { - padding: 0 8px 0 22px; - background: url(../images/icon-rails.png) no-repeat; - } - - -.banner { - height: 152px; - padding: 1px 0; - background: url(../images/header-stripe.png) repeat-x; -} - - .banner-content { - width: 835px; - margin: 0 auto; - } - - .banner h1 { - width: 236px; - height: 150px; - background: url(../images/header-logo.png) no-repeat; - } - - .banner h1 span { - display: none; - } - -.banner-small { - height: 75px; - padding: 1px 0; - background: url(../images/header-stripe-small.png) repeat-x; -} - - .banner-small h1 { - width: 118px; - height: 75px; - background: url(../images/header-logo-small.png) no-repeat; - margin-left: 60px; - } - - .banner-small h1 span { - display: none; - } - - -/* PAGE CONTENT */ - -.page-content { - width: 955px; - margin: 30px auto 0; -} - - .page-content .page-title { - margin-left: 120px; - margin-bottom: 15px; - font-size: 27px; - letter-spacing: -1px; - color: #444; - } - - .page-content .page-introduction { - margin-left: 120px; - margin-bottom: 25px; - } - -.page-content .section { - width: 955px; - margin: 10px 0 20px; -} - - .page-content .section .section-title { - width: 110px; - margin-right: 10px; - padding-right: 0; - float: left; - text-align: right; - overflow: hidden; - } - - .page-content .section .section-title h3 { - color: #999; - font-size: 14px; - line-height: 110%; - padding-right: 10px; - padding-bottom: 5px; - } - - .page-content .section .section-content { - width: 835px; - float: left; - } - -.page-content a, -.page-content a:link { - color: #036; - border-bottom: 1px solid #036; - text-decoration: none; -} - - .page-content a:visited { - border-bottom: 1px solid #bbb; - } - -.page-content ul, -.page-content ol { - margin: 10px 0; -} - -.page-content li { - margin: 5px 0 8px 20px; - list-style-type: disc; -} - -.page-content p { - margin: 0 0 0.8em; -} - -.page-content pre { - color: #333; - background-color: #f0f0ff; - border: 1px solid #dde; - padding: 3px 5px; - margin: 0 0 1em; -} - -.page-content .two-column { - -} - - .page-content .two-column-left, - .page-content .two-column-right { - width: 475px; - margin-right: 5px; - float: left; - } - - .page-content .two-column-right { - margin-right: 0; - } - - .page-content .two-column .section { - width: 475px; - } - - .page-content .two-column .section-content { - width: 345px; - padding-right: 10px; - } - - - -.smallcaps { - font-size: 0.85em; - text-transform: uppercase; - letter-spacing: 1px; -} - - -/* MASTHEAD */ - -div#masthead { - margin-top: 50px; - background: url(../images/header-stripe-small.png) repeat-x top left; - height: 76px; -} - -div#masthead div#masthead_content { - margin: 0 auto; - width: 835px; - position: relative; -} - -div#masthead h1#logo { - background: url(../images/header-logo-small.png) no-repeat 0 1px; - width: 118px; - height: 76px; - position: relative; - left: 60px; -} - -div#masthead a { - text-decoration: none; -} - diff --git a/templates/html/assets/stylesheets/grid.css b/templates/html/assets/stylesheets/grid.css deleted file mode 100644 index 08824c5..0000000 --- a/templates/html/assets/stylesheets/grid.css +++ /dev/null @@ -1,13 +0,0 @@ -body.grid { - width: 955px; - margin: auto; -} - -body.grid div#page { - overflow: hidden; - background: url(../images/grid.png); -} - -body.grid div#page * { - opacity: .9; -} diff --git a/templates/html/assets/stylesheets/highlighter.css b/templates/html/assets/stylesheets/highlighter.css deleted file mode 100644 index 8ce358f..0000000 --- a/templates/html/assets/stylesheets/highlighter.css +++ /dev/null @@ -1,116 +0,0 @@ -/* See license.txt for terms of usage */ - -.firebugHighlight { - z-index: 2147483647; - position: absolute; - background-color: #3875d7; -} - -.firebugLayoutBoxParent { - z-index: 2147483647; - position: absolute; - border-right: 1px dashed #BBBBBB; - border-bottom: 1px dashed #BBBBBB; -} - -.firebugRulerH { - position: absolute; - top: -15px; - left: 0; - width: 100%; - height: 14px; - background: url(chrome://firebug/skin/rulerH.png) repeat-x; - border-top: 1px solid #BBBBBB; - border-right: 1px dashed #BBBBBB; - border-bottom: 1px solid #000000; -} - -.firebugRulerV { - position: absolute; - top: 0; - left: -15px; - width: 14px; - height: 100%; - background: url(chrome://firebug/skin/rulerV.png) repeat-y; - border-left: 1px solid #BBBBBB; - border-right: 1px solid #000000; - border-bottom: 1px dashed #BBBBBB; -} - -.overflowRulerX > .firebugRulerV { - left: 0; -} - -.overflowRulerY > .firebugRulerH { - top: 0; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -.firebugLayoutBoxOffset { - z-index: 2147483647; - position: absolute; - opacity: 0.8; -} - -.firebugLayoutBoxMargin { - background-color: #EDFF64; -} - -.firebugLayoutBoxBorder { - background-color: #666666; -} - -.firebugLayoutBoxPadding { - background-color: SlateBlue; -} - -.firebugLayoutBoxContent { - background-color: SkyBlue; -} - -/*.firebugHighlightGroup .firebugLayoutBox { - background-color: transparent; -} - -.firebugHighlightBox { - background-color: Blue !important; -}*/ - -.firebugLayoutLine { - z-index: 2147483647; - background-color: #000000; - opacity: 0.4; -} - -.firebugLayoutLineLeft, -.firebugLayoutLineRight { - position: fixed; - width: 1px; - height: 100%; -} - -.firebugLayoutLineTop, -.firebugLayoutLineBottom { - position: absolute; - width: 100%; - height: 1px; -} - -.firebugLayoutLineTop { - margin-top: -1px; - border-top: 1px solid #999999; -} - -.firebugLayoutLineRight { - border-right: 1px solid #999999; -} - -.firebugLayoutLineBottom { - border-bottom: 1px solid #999999; -} - -.firebugLayoutLineLeft { - margin-left: -1px; - border-left: 1px solid #999999; -} diff --git a/templates/html/assets/stylesheets/main.css b/templates/html/assets/stylesheets/main.css deleted file mode 100644 index b83efd6..0000000 --- a/templates/html/assets/stylesheets/main.css +++ /dev/null @@ -1,443 +0,0 @@ -/* @group Tags */ - -body { - font-family: Verdana, sans-serif; -} - -form { - margin: 0; - padding: 0; -} - -a { - color: #036; - text-decoration: none; -} - - p a { - border-bottom: 1px solid #999; - padding: 0 1px; - } - - p a:hover { - background-color: #036; - color: #fff; - border-bottom: 1px solid #036; - } - -h1, h2, h3, h4, h5, h6 { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - margin: 0; - padding: 0; -} - -pre { - padding: 0; -} - -code { - font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", monospace; - font-size: 11px; -} - - -/* @end */ - -/* @group Masthead */ - -div#masthead { - background: url(../images/header-stripe-small.png) repeat-x top left; - height: 76px; -} - -div#masthead div#masthead_content { - margin: 0 auto; - width: 835px; - position: relative; -} - -div#masthead h1#logo { - background: url(../images/header-logo-small.png) no-repeat 0 1px; - width: 118px; - height: 76px; - position: relative; - left: 60px; -} - - - -/* @end */ - -/* @group Main */ - -#main { - width: 840px; - margin: 20px auto; - position: relative; -} - - #main h2 { - color: #444; - font-size: 22px; - padding-left: 69px; - margin-top: 0; - } - - #main h2 span { - color: #ccc; - display: block; - text-transform: uppercase; - font-size: 13px; - margin-bottom: -10px; - padding-left: 2px; - } - - #main h2 a { - color: #444; - text-decoration: none; - } - - #main h2 a:hover { - color: #222; - border-bottom: 1px solid #999; - } - - #main h4, h5, h6 { - padding-left: 4px; - } - - #main li h4, - #main li h5, - #main li h6 { - padding-left: 0; - } - - #main h4.inherited { - color: #888 !important; - } - - - #main .section { - overflow: hidden; - padding-left: 65px; - padding-bottom: 0; - margin: 5px 0 0; - } - - #main .section h3 { - position: absolute; - left: -85px; - width: 110px; - text-align: right; - font-size: 13px; - padding-top: 3px; - color: #999; - line-height: 100%; - min-height: 30px; - } - - #main .section h4 { - font-size: 15px; - color: #444; - margin: 0 0 0.3em; - } - - #main .section h4.inherited { - color: #888; - } - - #main .section h4.inherited a { - color: #49B; - } - - #main p { - margin: 0 0 1.1em; - } - - #main pre { - background-color: #000; - color: #fff; - padding: 5px 10px; - margin: 0 0 5px; - } - - #main pre.syntax { - background-color: #f5f5f5; - color: #000; - padding: 3px 5px; - } - -#main .section p.purpose { - background-color: #CDE0FB; - padding: 3px 5px; -} - -#main .section p { - padding: 0 5px; -} - -#main ul, #main ol { - padding-left: 5px; - margin: 0 0 10px; -} - -#main ul, #main ul li { - list-style-type: none; -} - - -#main #excerpt p { - color: #000; - border-left: 3px solid #bbb; - padding: 0; - margin-left: -10px; - font-size: 94%; - padding-left: 10px; -} - -#main .meta { - position: absolute; - width: 108px; - left: -60px; - text-align: right; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 14px; - font-weight: bold; - color: #888; -} - - - -/* @end */ - -/* @group Method List */ - -ul.method-list li { - display: inline; - border-top: 1px solid #ccc; -} - - ul.method-list li a { - background-color: #eee; - padding: 2px 3px; - border: 1px solid #ccc; - } - - ul.method-list li a:hover { - background-color: #ddd; - } - - - -/* @end */ - -/* @group Menu */ - -#menu { - width: 840px; - margin: 0 auto; - position: relative; - height: 25px; -} - -#menu div { - width: 234px; - float: right; - margin: 0 3px; -} - - #menu div.search-box { - width: 222px; - background-color: #cee8c3; - font-size: 13px; - height: 25px; - line-height: 25px; - padding: 2px 6px; - } - - #menu div.search-box label { - color: #555; - } - - #menu div.search-box input { - border: 1px solid #bbb; - padding: 2px; - width: 163px; - } - - -#menu h2 { - font-size: 13px; - font-weight: normal; -} - - #menu h2 a { - height: 25px; - line-height: 25px; - display: block; - text-align: center; - background-color: #CDE0FB; - font-family: Verdana, sans-serif; - padding: 2px 6px; - } - - #menu h2 a:hover { - background-color: #a4c8fb; - } - - #menu #api_menu, - #menu #search_results { - border: 1px solid #ddd; - background: #fff; - position: absolute; - width: 232px; - top: 26px; - z-index: 1500; - max-height: 200px; - overflow: auto; - } - - #menu #api_menu { - right: 3px; - } - - #menu #search_results { - right: 243px; - } - - - #menu .menu-items li { - background-color: #fff; - } - - #menu .menu-items li a { - display: block; - color: #333; - background-color: #fff; - padding: 2px 6px; - border-top: 1px solid #fff; - border-bottom: 1px solid #fff; - } - - #menu .menu-items li a:hover, - #menu .menu-items li.highlighted a { - background-color: #CDE0FB; - border-top-color: #a4c8fb; - border-bottom-color: #a4c8fb; - } - - - #menu .menu-items ul { - margin: 0; - padding: 0; - } - -#menu .menu-items li a { - background-repeat: no-repeat; - background-position: 6px 3px; - padding: 3px 5px 3px 30px; - font-size: 12px; -} - - #menu .menu-items li a.class { - background-image: url(../images/class.png); - } - - #menu .menu-items li a.namespace { - background-image: url(../images/namespace.png); - } - - #menu .menu-items li a.mixin { - background-image: url(../images/mixin.png); - } - - #menu .menu-items li a.section { - text-transform: uppercase; - color: #777; - background-image: url(../images/section.png); - } - - #menu .menu-items li a.class_method, - #menu .menu-items li a.instance_method, - #menu .menu-items li a.utility { - background-image: url(../images/method.png); - } - - #menu .menu-items li a.class_property, - #menu .menu-items li a.instance_property { - background-image: url(../images/property.png); - } - - #menu .menu-items li a.constructor { - background-image: url(../images/constructor.png); - } - - #menu .menu-items li a.constant { - background-image: url(../images/constant.png); - } - - -/* @end */ - -/* @group Section Headings (H3s) */ - -.section h3 { - padding-right: 25px; - background-repeat: no-repeat; - background-position: right 4px; -} - -.section-superclass h3 { - background-image: url(../images/class.png); -} - -.section-method-list h3, -.section-instance_methods h3, -.section-klass_methods h3 { - background-image: url(../images/method.png); -} - -.section-klass_properties h3, -.section-instance_properties h3 { - background-image: url(../images/property.png); -} - -.section-constructor h3 { - background-image: url(../images/constructor.png); -} - -.section-constants h3 { - background-image: url(../images/constant.png); -} - -.section-mixins h3 { - background-image: url(../images/mixin.png); -} - - -/* @end */ - - - -/* @group Method Details List */ - -ul.method-details-list li { - border: 2px solid #fff; -} - -ul.method-details-list li.highlighted { - border: 2px solid #CDE0FB; -} - -/* @end */ - - -/* floating menu */ - -#menu.fixed { - position: fixed; - top: 0; - z-index: 1000; - left: 232px; -} - diff --git a/templates/html/assets/stylesheets/screen.css b/templates/html/assets/stylesheets/screen.css deleted file mode 100644 index 4fe5077..0000000 --- a/templates/html/assets/stylesheets/screen.css +++ /dev/null @@ -1,244 +0,0 @@ - - -/* Masthead */ - -div#masthead { - background: url(http://prototype.conio.net/new/images/header-stripe.png) repeat-x top left; - height: 152px; -} - -div#masthead div#masthead_content { - margin: 0 auto; - width: 835px; - position: relative; -} - -div#masthead h1#logo { - background: url(http://prototype.conio.net/new/images/header-logo.png) no-repeat 0 1px; - width: 236px; - height: 152px; -} - -div#masthead div#pitch { - position: absolute; - background: url(http://prototype.conio.net/new/images/header-copy.png) no-repeat 0 1px; - top: 0; - left: 300px; - width: 535px; - height: 152px; -} - -div#masthead h1#logo *, -div#masthead div#pitch * { - display: none; -} - - -/* Buttons */ - -div#buttons, div#more { - overflow: hidden; - width: 840px; - margin: -1px auto 0 auto; - padding: 0 0 0 5px; -} - -div#more { - margin-top: 35px; -} - -div#buttons li { - display: block; - float: left; - border-top: 1px solid #929fb3; - margin: 0 5px 0 0; - width: 175px; - height: 100px; -} - -div#more li { - height: 50px; -} - -div#buttons li a { - display: block; - position: relative; - width: 175px; - height: 100px; - text-decoration: none; - background: #cde0fb no-repeat center 30px; -} - -div#buttons li a:hover { - background-color: #a4c8fb; -} - -div#buttons li a span.title { - display: none; -} - -div#buttons li a span.description { - position: absolute; - display: block; - width: 175px; - top: 55px; - text-align: center; - color: #666; -} - -div#more li a span.title { - position: absolute; - display: block; - width: 175px; - top: 15px; - text-align: center; - color: #666; -} - -div#buttons li a:hover span.description { - color: #333; -} - -div#buttons li#download_button { - width: 295px; -} - -div#buttons li#download_button a, -div#buttons li#download_button a span.description { - width: 295px; -} - -div#buttons li#download_button a { - background-color: #cee8c3; - background-image: url(http://prototype.conio.net/new/images/button-download.png); -} - -div#buttons li#download_button a:hover { - background-color: #a4e289; -} - -div#buttons li#learn_button a { - background-image: url(http://prototype.conio.net/new/images/button-learn.png); -} - -div#buttons li#discuss_button a { - background-image: url(http://prototype.conio.net/new/images/button-discuss.png); -} - -div#buttons li#contribute_button a { - background-image: url(http://prototype.conio.net/new/images/button-contribute.png); -} - -div#more { - position: relative; - height: 400px; - margin: 15px 60px; - color: #444; -} - - div#more .column { - display: block; - float: left; - margin: 0 5px 0 0; - padding-left: 5px; - min-height: 300px; - } - - div#more h3 { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - letter-spacing: -1px; - font-weight: bold; - color: #444; - font-size: 18px; - margin: 0 0 5px; - } - -.column { - width: 175px; -} - -.wide-column { - width: 295px; -} - -.medium-column { - width: 235px; -} - -.main-column { - width: 530px; -} - -.sidebar-column { - width: 290px; -} - -div#more { - width: 840px; - margin: 25px auto 0; -} - -/*#buttons_wrapper { - background-color: #0E4FAF; -} - -#page { - background-color: #292929; -} -*/ - -div#more div.main-column p { - font-size: 16px; - margin-right: 10px; -} - -div#more h3.tagline { - height: 23px; - background: url(../images/tagline.png) no-repeat top left; - width: 530px; -} - - div#more h3.tagline span { display: none; } - -.view-master { - text-align: center; - font-family: Verdana; - color: #ccc; - font-size: 18px; - padding: 35px 0; - margin: 10px 0; -} - -.using-prototype { - border-top: 2px solid #ddd; - border-bottom: 2px solid #ddd; - margin: 25px 10px 10px 0; - padding: 5px 0; -} - -.sidebar-column h4 { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 14px; - font-weight: bold; - margin: 0; -} - -.sidebar-column p { - margin-bottom: 15px; -} - -ol, ol li { - list-style-type: decimal; - line-height: 160%; -} - - ol li { - margin: 0 0 2px; - } - -ol, ul { - margin: 0 0 15px; - padding-left: 0; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -} - diff --git a/templates/html/helpers.rb b/templates/html/helpers.rb index 1769b9d..15e09f1 100644 --- a/templates/html/helpers.rb +++ b/templates/html/helpers.rb @@ -12,8 +12,21 @@ module PDoc end module MenuHelper + def menu(obj) + class_names = menu_class_name(obj) + li_class_names = obj.type == "section" ? "menu-section" : "" + html = <<-EOS + + EOS + unless obj.children.empty? + html << content_tag(:ul, obj.children.map { |n|menu(n) }.join("\n"), :class => li_class_names) + end + content_tag(:li, html, :class => class_names) + end end end end end -end +end \ No newline at end of file diff --git a/templates/html/index.erb b/templates/html/index.erb index b2b1e37..2f548a4 100644 --- a/templates/html/index.erb +++ b/templates/html/index.erb @@ -21,4 +21,4 @@ <% end %> - \ No newline at end of file + \ No newline at end of file diff --git a/templates/html/layout.erb b/templates/html/layout.erb index 5ee9e43..6e6aed8 100644 --- a/templates/html/layout.erb +++ b/templates/html/layout.erb @@ -1,50 +1,61 @@ - + - - - Prototype API documentation | <%= @title %> - - - <%= javascript_include_tag "prototype", "effects", "controls" %> - <%= javascript_include_tag "application", "code_highlighter" %> + + + Prototype API documentation | <%= @title %> + + + <%= javascript_include_tag "prototype" %> + <%= javascript_include_tag "application", "code_highlighter", "tabs" %> + <%= javascript_include_tag "item_index" %> + + <%= stylesheet_link_tag "api" %> + + + + + + + - <%= javascript_include_tag "item_index" %> - - <%= stylesheet_link_tag "core", "api" %> - - - -
- - - - - +
<%= @content_for_layout %> @@ -52,28 +63,24 @@
- -
- + + diff --git a/templates/html/partials/short_description.erb b/templates/html/partials/short_description.erb index 73d3fab..c4ad784 100644 --- a/templates/html/partials/short_description.erb +++ b/templates/html/partials/short_description.erb @@ -11,9 +11,9 @@
    <% object.arguments.each do |arg| %>
  • - <%= arg.name %> + <%= arg.name %> <% unless arg.types.empty? %> - (<%= arg.types.map { |t| auto_link_code(t, false) }.join(' | ') %>) + (<%= arg.types.map { |t| auto_link_code(t, false) }.join(' | ') %>) <% end %> <%= ' – ' + inline_htmlize(arg.description) unless arg.description.empty? %>