diff options
Diffstat (limited to '3rdparty/js/angular-1.0.2/docs/js')
-rw-r--r-- | 3rdparty/js/angular-1.0.2/docs/js/docs.js | 520 | ||||
-rw-r--r-- | 3rdparty/js/angular-1.0.2/docs/js/jquery.js | 9404 | ||||
-rw-r--r-- | 3rdparty/js/angular-1.0.2/docs/js/jquery.min.js | 4 |
3 files changed, 9928 insertions, 0 deletions
diff --git a/3rdparty/js/angular-1.0.2/docs/js/docs.js b/3rdparty/js/angular-1.0.2/docs/js/docs.js new file mode 100644 index 000000000..436651e79 --- /dev/null +++ b/3rdparty/js/angular-1.0.2/docs/js/docs.js @@ -0,0 +1,520 @@ +var docsApp = { + controller: {}, + directive: {}, + serviceFactory: {} +}; + + +docsApp.directive.focused = function($timeout) { + return function(scope, element, attrs) { + element[0].focus(); + element.bind('focus', function() { + scope.$apply(attrs.focused + '=true'); + }); + element.bind('blur', function() { + // have to use $timeout, so that we close the drop-down after the user clicks, + // otherwise when the user clicks we process the closing before we process the click. + $timeout(function() { + scope.$eval(attrs.focused + '=false'); + }); + }); + scope.$eval(attrs.focused + '=true') + } +}; + + +docsApp.directive.code = function() { + return { restrict:'E', terminal: true }; +}; + + +docsApp.directive.sourceEdit = function(getEmbeddedTemplate) { + return { + template: '<button ng-click="fiddle($event)" class="btn btn-primary pull-right"><i class="icon-pencil icon-white"></i> Edit</button>\n', + scope: true, + controller: function($scope, $attrs, openJsFiddle) { + var sources = { + module: $attrs.sourceEdit, + deps: read($attrs.sourceEditDeps), + html: read($attrs.sourceEditHtml), + css: read($attrs.sourceEditCss), + js: read($attrs.sourceEditJs), + unit: read($attrs.sourceEditUnit), + scenario: read($attrs.sourceEditScenario) + }; + $scope.fiddle = function(e) { + e.stopPropagation(); + openJsFiddle(sources); + } + } + } + + function read(text) { + var files = []; + angular.forEach(text ? text.split(' ') : [], function(refId) { + files.push({name: refId.split('-')[0], content: getEmbeddedTemplate(refId)}); + }); + return files; + } +}; + + +docsApp.directive.docTutorialNav = function(templateMerge) { + var pages = [ + '', + 'step_00', 'step_01', 'step_02', 'step_03', 'step_04', + 'step_05', 'step_06', 'step_07', 'step_08', 'step_09', + 'step_10', 'step_11', 'the_end' + ]; + return { + compile: function(element, attrs) { + var seq = 1 * attrs.docTutorialNav, + props = { + seq: seq, + prev: pages[seq], + next: pages[2 + seq], + diffLo: seq ? (seq - 1): '0~1', + diffHi: seq + }; + + element.addClass('btn-group'); + element.addClass('tutorial-nav'); + element.append(templateMerge( + '<li class="btn btn-primary"><a href="tutorial/{{prev}}"><i class="icon-step-backward"></i> Previous</a></li>\n' + + '<li class="btn btn-primary"><a href="http://angular.github.com/angular-phonecat/step-{{seq}}/app"><i class="icon-play"></i> Live Demo</a></li>\n' + + '<li class="btn btn-primary"><a href="https://github.com/angular/angular-phonecat/compare/step-{{diffLo}}...step-{{diffHi}}"><i class="icon-search"></i> Code Diff</a></li>\n' + + '<li class="btn btn-primary"><a href="tutorial/{{next}}">Next <i class="icon-step-forward"></i></a></li>', props)); + } + }; +}; + + +docsApp.directive.docTutorialReset = function() { + function tab(name, command, id, step) { + return '' + + ' <div class=\'tab-pane well\' title="' + name + '" value="' + id + '">\n' + + ' <ol>\n' + + ' <li><p>Reset the workspace to step ' + step + '.</p>' + + ' <pre>' + command + '</pre></li>\n' + + ' <li><p>Refresh your browser or check the app out on <a href="http://angular.github.com/angular-phonecat/step-' + step + '/app">Angular\'s server</a>.</p></li>\n' + + ' </ol>\n' + + ' </div>\n'; + } + + return { + compile: function(element, attrs) { + var step = attrs.docTutorialReset; + element.html( + '<div ng-hide="show">' + + '<p><a href="" ng-click="show=true;$event.stopPropagation()">Workspace Reset Instructions ā¤</a></p>' + + '</div>\n' + + '<div class="tabbable" ng-show="show" ng-model="$cookies.platformPreference">\n' + + tab('Git on Mac/Linux', 'git checkout -f step-' + step, 'gitUnix', step) + + tab('Git on Windows', 'git checkout -f step-' + step, 'gitWin', step) + + tab('Snapshots on Mac/Linux', './goto_step.sh ' + step, 'snapshotUnix', step) + + tab('Snapshots on on Windows', './goto_step.bat ' + step, 'snapshotWin', step) + + '</div>\n'); + } + }; +} + + +docsApp.serviceFactory.angularUrls = function($document) { + var urls = {}; + + angular.forEach($document.find('script'), function(script) { + var match = script.src.match(/^.*\/(angular[^\/]*\.js)$/); + if (match) { + urls[match[1].replace(/(\-\d.*)?(\.min)?\.js$/, '.js')] = match[0]; + } + }); + + return urls; +} + + +docsApp.serviceFactory.formPostData = function($document) { + return function(url, fields) { + var form = angular.element('<form style="display: none;" method="post" action="' + url + '" target="_blank"></form>'); + angular.forEach(fields, function(value, name) { + var input = angular.element('<input type="hidden" name="' + name + '">'); + input.attr('value', value); + form.append(input); + }); + $document.find('body').append(form); + form[0].submit(); + form.remove(); + }; +}; + + +docsApp.serviceFactory.openJsFiddle = function(templateMerge, getEmbeddedTemplate, formPostData, angularUrls) { + var HTML = '<div ng-app=\"{{module}}\">\n{{html:2}}</div>', + CSS = '</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ --> \n' + + '{{head:0}}<style>\nā.ng-invalid { border: 1px solid red; }ā\n{{css}}', + SCRIPT = '{{script}}', + SCRIPT_CACHE = '\n\n<!-- {{name}} -->\n<script type="text/ng-template" id="{{name}}">\n{{content:2}}</script>'; + + return function(content) { + var prop = { + module: content.module, + html: '', + css: '', + script: '' + }; + + prop.head = templateMerge('<script src="{{url}}"></script>', {url: angularUrls['angular.js']}); + + angular.forEach(content.html, function(file, index) { + if (index) { + prop.html += templateMerge(SCRIPT_CACHE, file); + } else { + prop.html += file.content; + } + }); + + angular.forEach(content.js, function(file, index) { + prop.script += file.content; + }); + + angular.forEach(content.css, function(file, index) { + prop.css += file.content; + }); + + formPostData("http://jsfiddle.net/api/post/library/pure/", { + title: 'AngularJS Example', + html: templateMerge(HTML, prop), + js: templateMerge(SCRIPT, prop), + css: templateMerge(CSS, prop) + }); + }; +}; + + +docsApp.serviceFactory.sections = function sections() { + var sections = { + guide: [], + api: [], + tutorial: [], + misc: [], + cookbook: [], + getPage: function(sectionId, partialId) { + var pages = sections[sectionId]; + + partialId = partialId || 'index'; + + for (var i = 0, ii = pages.length; i < ii; i++) { + if (pages[i].id == partialId) { + return pages[i]; + } + } + return null; + } + }; + + angular.forEach(NG_PAGES, function(page) { + page.url = page.section + '/' + page.id; + if (page.id == 'angular.Module') { + page.partialUrl = 'partials/api/angular.IModule.html'; + } else { + page.partialUrl = 'partials/' + page.url + '.html'; + } + + sections[page.section].push(page); + }); + + return sections; +}; + + +docsApp.controller.DocsController = function($scope, $location, $window, $cookies, sections) { + var OFFLINE_COOKIE_NAME = 'ng-offline', + DOCS_PATH = /^\/(api)|(guide)|(cookbook)|(misc)|(tutorial)/, + INDEX_PATH = /^(\/|\/index[^\.]*.html)$/, + GLOBALS = /^angular\.([^\.]+)$/, + MODULE = /^((?:(?!^angular\.)[^\.])+)$/, + MODULE_MOCK = /^angular\.mock\.([^\.]+)$/, + MODULE_DIRECTIVE = /^((?:(?!^angular\.)[^\.])+)\.directive:([^\.]+)$/, + MODULE_DIRECTIVE_INPUT = /^((?:(?!^angular\.)[^\.])+)\.directive:input\.([^\.]+)$/, + MODULE_FILTER = /^((?:(?!^angular\.)[^\.])+)\.filter:([^\.]+)$/, + MODULE_SERVICE = /^((?:(?!^angular\.)[^\.])+)\.([^\.]+?)(Provider)?$/, + MODULE_TYPE = /^((?:(?!^angular\.)[^\.])+)\..+\.([A-Z][^\.]+)$/, + URL = { + module: 'guide/module', + directive: 'guide/directive', + input: 'api/ng.directive:input', + filter: 'guide/dev_guide.templates.filters', + service: 'guide/dev_guide.services', + type: 'guide/types' + }; + + + /********************************** + Publish methods + ***********************************/ + + $scope.navClass = function(page1, page2) { + return { + last: this.$last, + active: page1 && this.currentPage == page1 || page2 && this.currentPage == page2 + }; + } + + $scope.submitForm = function() { + $scope.bestMatch && $location.path($scope.bestMatch.page.url); + }; + + $scope.afterPartialLoaded = function() { + var currentPageId = $location.path(); + $scope.partialTitle = $scope.currentPage.shortName; + $window._gaq.push(['_trackPageview', currentPageId]); + loadDisqus(currentPageId); + }; + + /** stores a cookie that is used by apache to decide which manifest ot send */ + $scope.enableOffline = function() { + //The cookie will be good for one year! + var date = new Date(); + date.setTime(date.getTime()+(365*24*60*60*1000)); + var expires = "; expires="+date.toGMTString(); + var value = angular.version.full; + document.cookie = OFFLINE_COOKIE_NAME + "="+value+expires+"; path=" + $location.path; + + //force the page to reload so server can serve new manifest file + window.location.reload(true); + }; + + + + /********************************** + Watches + ***********************************/ + + var SECTION_NAME = { + api: 'API Reference', + guide: 'Developer Guide', + misc: 'Miscellaneous', + tutorial: 'Tutorial', + cookbook: 'Examples' + }; + $scope.$watch(function() {return $location.path(); }, function(path) { + // ignore non-doc links which are used in examples + if (DOCS_PATH.test(path)) { + var parts = path.split('/'), + sectionId = parts[1], + partialId = parts[2], + sectionName = SECTION_NAME[sectionId] || sectionId, + page = sections.getPage(sectionId, partialId); + + $scope.currentPage = sections.getPage(sectionId, partialId); + + if (!$scope.currentPage) { + $scope.partialTitle = 'Error: Page Not Found!'; + } + + updateSearch(); + + + // Update breadcrumbs + var breadcrumb = $scope.breadcrumb = [], + match; + + if (partialId) { + breadcrumb.push({ name: sectionName, url: sectionId }); + if (partialId == 'angular.Module') { + breadcrumb.push({ name: 'angular.Module' }); + } else if (match = partialId.match(GLOBALS)) { + breadcrumb.push({ name: partialId }); + } else if (match = partialId.match(MODULE)) { + breadcrumb.push({ name: match[1] }); + } else if (match = partialId.match(MODULE_FILTER)) { + breadcrumb.push({ name: match[1], url: sectionId + '/' + match[1] }); + breadcrumb.push({ name: match[2] }); + } else if (match = partialId.match(MODULE_DIRECTIVE)) { + breadcrumb.push({ name: match[1], url: sectionId + '/' + match[1] }); + breadcrumb.push({ name: match[2] }); + } else if (match = partialId.match(MODULE_DIRECTIVE_INPUT)) { + breadcrumb.push({ name: match[1], url: sectionId + '/' + match[1] }); + breadcrumb.push({ name: 'input', url: URL.input }); + breadcrumb.push({ name: match[2] }); + } else if (match = partialId.match(MODULE_TYPE)) { + breadcrumb.push({ name: match[1], url: sectionId + '/' + match[1] }); + breadcrumb.push({ name: match[2] }); + } else if (match = partialId.match(MODULE_SERVICE)) { + breadcrumb.push({ name: match[1], url: sectionId + '/' + match[1] }); + breadcrumb.push({ name: match[2] + (match[3] || '') }); + } else if (match = partialId.match(MODULE_MOCK)) { + breadcrumb.push({ name: 'angular.mock.' + match[1] }); + } else { + breadcrumb.push({ name: page.shortName }); + } + } else { + breadcrumb.push({ name: sectionName }); + } + } + }); + + $scope.$watch('search', updateSearch); + + + + /********************************** + Initialize + ***********************************/ + + $scope.versionNumber = angular.version.full; + $scope.version = angular.version.full + " " + angular.version.codeName; + $scope.subpage = false; + $scope.offlineEnabled = ($cookies[OFFLINE_COOKIE_NAME] == angular.version.full); + $scope.futurePartialTitle = null; + $scope.loading = 0; + $scope.URL = URL; + $scope.$cookies = $cookies; + + $cookies.platformPreference = $cookies.platformPreference || 'gitUnix'; + + if (!$location.path() || INDEX_PATH.test($location.path())) { + $location.path('/api').replace(); + } + // bind escape to hash reset callback + angular.element(window).bind('keydown', function(e) { + if (e.keyCode === 27) { + $scope.$apply(function() { + $scope.subpage = false; + }); + } + }); + + /********************************** + Private methods + ***********************************/ + + function updateSearch() { + var cache = {}, + pages = sections[$location.path().split('/')[1]], + modules = $scope.modules = [], + otherPages = $scope.pages = [], + search = $scope.search, + bestMatch = {page: null, rank:0}; + + angular.forEach(pages, function(page) { + var match, + id = page.id; + + if (!(match = rank(page, search))) return; + + if (match.rank > bestMatch.rank) { + bestMatch = match; + } + + if (page.id == 'index') { + //skip + } else if (page.section != 'api') { + otherPages.push(page); + } else if (id == 'angular.Module') { + module('ng').types.push(page); + } else if (match = id.match(GLOBALS)) { + module('ng').globals.push(page); + } else if (match = id.match(MODULE)) { + module(match[1]); + } else if (match = id.match(MODULE_FILTER)) { + module(match[1]).filters.push(page); + } else if (match = id.match(MODULE_DIRECTIVE)) { + module(match[1]).directives.push(page); + } else if (match = id.match(MODULE_DIRECTIVE_INPUT)) { + module(match[1]).directives.push(page); + } else if (match = id.match(MODULE_SERVICE)) { + module(match[1]).service(match[2])[match[3] ? 'provider' : 'instance'] = page; + } else if (match = id.match(MODULE_TYPE)) { + module(match[1]).types.push(page); + } else if (match = id.match(MODULE_MOCK)) { + module('ngMock').globals.push(page); + } + + }); + + $scope.bestMatch = bestMatch; + + /*************/ + + function module(name) { + var module = cache[name]; + if (!module) { + module = cache[name] = { + name: name, + url: 'api/' + name, + globals: [], + directives: [], + services: [], + service: function(name) { + var service = cache[this.name + ':' + name]; + if (!service) { + service = {name: name}; + cache[this.name + ':' + name] = service; + this.services.push(service); + } + return service; + }, + types: [], + filters: [] + } + modules.push(module); + } + return module; + } + + function rank(page, terms) { + var ranking = {page: page, rank:0}, + keywords = page.keywords, + title = page.shortName.toLowerCase(); + + terms && angular.forEach(terms.toLowerCase().split(' '), function(term) { + var index; + + if (ranking) { + if (keywords.indexOf(term) == -1) { + ranking = null; + } else { + ranking.rank ++; // one point for each term found + if ((index = title.indexOf(term)) != -1) { + ranking.rank += 20 - index; // ten points if you match title + } + } + } + }); + return ranking; + } + } + + + function loadDisqus(currentPageId) { + // http://docs.disqus.com/help/2/ + window.disqus_shortname = 'angularjs-next'; + window.disqus_identifier = currentPageId; + window.disqus_url = 'http://docs.angularjs.org' + currentPageId; + + if ($location.host() == 'localhost') { + return; // don't display disqus on localhost, comment this out if needed + //window.disqus_developer = 1; + } + + // http://docs.disqus.com/developers/universal/ + (function() { + var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; + dsq.src = 'http://angularjs.disqus.com/embed.js'; + (document.getElementsByTagName('head')[0] || + document.getElementsByTagName('body')[0]).appendChild(dsq); + })(); + + angular.element(document.getElementById('disqus_thread')).html(''); + } +} + + +angular.module('docsApp', ['ngResource', 'ngCookies', 'ngSanitize', 'bootstrap', 'bootstrapPrettify']). + config(function($locationProvider) { + $locationProvider.html5Mode(true).hashPrefix('!'); + }). + factory(docsApp.serviceFactory). + directive(docsApp.directive). + controller(docsApp.controller); diff --git a/3rdparty/js/angular-1.0.2/docs/js/jquery.js b/3rdparty/js/angular-1.0.2/docs/js/jquery.js new file mode 100644 index 000000000..3774ff986 --- /dev/null +++ b/3rdparty/js/angular-1.0.2/docs/js/jquery.js @@ -0,0 +1,9404 @@ +/*! + * jQuery JavaScript Library v1.7.2 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Wed Mar 21 12:46:34 2012 -0700 + */ +(function( window, undefined ) { + +// Use the correct document accordingly with window argument (sandbox) +var document = window.document, + navigator = window.navigator, + location = window.location; +var jQuery = (function() { + +// Define a local copy of jQuery +var jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$, + + // A central reference to the root jQuery(document) + rootjQuery, + + // A simple way to check for HTML strings or ID strings + // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) + quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, + + // Check if a string has a non-whitespace character in it + rnotwhite = /\S/, + + // Used for trimming whitespace + trimLeft = /^\s+/, + trimRight = /\s+$/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, + + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, + rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + + // Useragent RegExp + rwebkit = /(webkit)[ \/]([\w.]+)/, + ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, + rmsie = /(msie) ([\w.]+)/, + rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, + + // Matches dashed string for camelizing + rdashAlpha = /-([a-z]|[0-9])/ig, + rmsPrefix = /^-ms-/, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return ( letter + "" ).toUpperCase(); + }, + + // Keep a UserAgent string for use with jQuery.browser + userAgent = navigator.userAgent, + + // For matching the engine and version of the browser + browserMatch, + + // The deferred used on DOM ready + readyList, + + // The ready event handler + DOMContentLoaded, + + // Save a reference to some core methods + toString = Object.prototype.toString, + hasOwn = Object.prototype.hasOwnProperty, + push = Array.prototype.push, + slice = Array.prototype.slice, + trim = String.prototype.trim, + indexOf = Array.prototype.indexOf, + + // [[Class]] -> type pairs + class2type = {}; + +jQuery.fn = jQuery.prototype = { + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem, ret, doc; + + // Handle $(""), $(null), or $(undefined) + if ( !selector ) { + return this; + } + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + } + + // The body element only exists once, optimize finding it + if ( selector === "body" && !context && document.body ) { + this.context = document; + this[0] = document.body; + this.selector = selector; + this.length = 1; + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + // Are we dealing with HTML string or an ID? + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = quickExpr.exec( selector ); + } + + // Verify a match, and that no context was specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + doc = ( context ? context.ownerDocument || context : document ); + + // If a single string is passed in and it's a single tag + // just do a createElement and skip the rest + ret = rsingleTag.exec( selector ); + + if ( ret ) { + if ( jQuery.isPlainObject( context ) ) { + selector = [ document.createElement( ret[1] ) ]; + jQuery.fn.attr.call( selector, context, true ); + + } else { + selector = [ doc.createElement( ret[1] ) ]; + } + + } else { + ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); + selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; + } + + return jQuery.merge( this, selector ); + + // HANDLE: $("#id") + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The current version of jQuery being used + jquery: "1.7.2", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return slice.call( this, 0 ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems, name, selector ) { + // Build a new jQuery matched element set + var ret = this.constructor(); + + if ( jQuery.isArray( elems ) ) { + push.apply( ret, elems ); + + } else { + jQuery.merge( ret, elems ); + } + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + ret.context = this.context; + + if ( name === "find" ) { + ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; + } else if ( name ) { + ret.selector = this.selector + "." + name + "(" + selector + ")"; + } + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Attach the listeners + jQuery.bindReady(); + + // Add the callback + readyList.add( fn ); + + return this; + }, + + eq: function( i ) { + i = +i; + return i === -1 ? + this.slice( i ) : + this.slice( i, i + 1 ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ), + "slice", slice.call(arguments).join(",") ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + // Either a released hold or an DOMready/load event and not yet ready + if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready, 1 ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.fireWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger( "ready" ).off( "ready" ); + } + } + }, + + bindReady: function() { + if ( readyList ) { + return; + } + + readyList = jQuery.Callbacks( "once memory" ); + + // Catch cases where $(document).ready() is called after the + // browser event has already occurred. + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + return setTimeout( jQuery.ready, 1 ); + } + + // Mozilla, Opera and webkit nightlies currently support this event + if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", jQuery.ready, false ); + + // If IE event model is used + } else if ( document.attachEvent ) { + // ensure firing before onload, + // maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", DOMContentLoaded ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", jQuery.ready ); + + // If IE and not a frame + // continually check to see if the document is ready + var toplevel = false; + + try { + toplevel = window.frameElement == null; + } catch(e) {} + + if ( document.documentElement.doScroll && toplevel ) { + doScrollCheck(); + } + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert |