mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-19 13:05:57 +08:00
This commit refactors how the search index is built. The docsSearch service is now defined by a provider, which returns a different implementation of the service depending upon whether the current browser supports WebWorkers or now. * **WebWorker supported**: The index is then built and stored in a new worker. The service posts and receives messages to and from this worker to make queries on the search index. * **WebWorker no supported**: The index is built locally but with a 500ms delay so that the initial page can render before the browser is blocked as the index is built. Also the way that the current app is identified has been modified so we can slim down the js data files (pages-data.js) to again improve startup time. Closes #9204 Closes #9203
241 lines
11 KiB
HTML
241 lines
11 KiB
HTML
<!doctype html>
|
|
<html lang="en" ng-app="docsApp" ng-controller="DocsController">
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
<meta name="Description"
|
|
content="AngularJS is what HTML would have been, had it been designed for building web-apps.
|
|
Declarative templates with data-binding, MVC, dependency injection and great
|
|
testability story all implemented with pure client-side JavaScript!">
|
|
<meta name="fragment" content="!">
|
|
<title ng-bind-template="AngularJS: {{ currentArea.name }}: {{ currentPage.name || 'Error: Page not found'}}">AngularJS</title>
|
|
|
|
<script type="text/javascript">
|
|
// dynamically add base tag as well as css and javascript files.
|
|
// we can't add css/js the usual way, because some browsers (FF) eagerly prefetch resources
|
|
// before the base attribute is added, causing 404 and terribly slow loading of the docs app.
|
|
(function() {
|
|
var indexFile = (location.pathname.match(/\/(index[^\.]*\.html)/) || ['', ''])[1],
|
|
rUrl = /(#!\/|api|guide|misc|tutorial|error|index[^\.]*\.html).*$/,
|
|
baseUrl = location.href.replace(rUrl, indexFile),
|
|
production = location.hostname === 'docs.angularjs.org',
|
|
headEl = document.getElementsByTagName('head')[0],
|
|
sync = true;
|
|
|
|
addTag('base', {href: baseUrl});
|
|
|
|
|
|
{% for stylesheet in doc.stylesheets %}addTag('link', {rel: 'stylesheet', href: '{$ stylesheet $}', type: 'text/css'});
|
|
{% endfor %}
|
|
|
|
{% for script in doc.scripts %}addTag('script', {src: '{$ script $}' }, sync);
|
|
{% endfor %}
|
|
|
|
function addTag(name, attributes, sync) {
|
|
var el = document.createElement(name),
|
|
attrName;
|
|
|
|
for (attrName in attributes) {
|
|
el.setAttribute(attrName, attributes[attrName]);
|
|
}
|
|
|
|
sync ? document.write(outerHTML(el)) : headEl.appendChild(el);
|
|
}
|
|
|
|
function outerHTML(node){
|
|
// if IE, Chrome take the internal method otherwise build one
|
|
return node.outerHTML || (
|
|
function(n){
|
|
var div = document.createElement('div'), h;
|
|
div.appendChild(n);
|
|
h = div.innerHTML;
|
|
div = null;
|
|
return h;
|
|
})(node);
|
|
}
|
|
})();
|
|
|
|
// GA asynchronous tracker
|
|
var _gaq = _gaq || [];
|
|
_gaq.push(['_setAccount', 'UA-8594346-3']);
|
|
_gaq.push(['_setDomainName', '.angularjs.org']);
|
|
|
|
(function() {
|
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|
})();
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div id="wrapper">
|
|
<header class="header header-fixed">
|
|
<section class="navbar navbar-inverse docs-navbar-primary" ng-controller="DocsSearchCtrl">
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-md-9 header-branding">
|
|
<a class="brand navbar-brand" href="http://angularjs.org">
|
|
<img class="logo" src="img/angularjs-for-header-only.svg">
|
|
</a>
|
|
<ul class="nav navbar-nav">
|
|
<li class="divider-vertical"></li>
|
|
<li><a href="http://angularjs.org"><i class="icon-home icon-white"></i> Home</a></li>
|
|
<li class="divider-vertical"></li>
|
|
<li class="dropdown">
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
|
<i class="icon-eye-open icon-white"></i> Learn <b class="caret"></b>
|
|
</a>
|
|
<ul class="dropdown-menu">
|
|
<li class="disabled"><a href="http://angularjs.org/">Why AngularJS?</a></li>
|
|
<li><a href="http://www.youtube.com/user/angularjs">Watch</a></li>
|
|
<li><a href="tutorial">Tutorial</a></li>
|
|
<li><a href="http://builtwith.angularjs.org/">Case Studies</a></li>
|
|
<li><a href="https://github.com/angular/angular-seed">Seed App project template</a></li>
|
|
<li><a href="misc/faq">FAQ</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="divider-vertical"></li>
|
|
<li class="dropdown active">
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
|
<i class="icon-book icon-white"></i> Develop <b class="caret"></b>
|
|
</a>
|
|
<ul class="dropdown-menu">
|
|
<li><a href="tutorial">Tutorial</a></li>
|
|
<li><a href="guide">Developer Guide</a></li>
|
|
<li><a href="api">API Reference</a></li>
|
|
<li><a href="error">Error Reference</a></li>
|
|
<li><a href="misc/contribute">Contribute</a></li>
|
|
<li><a href="http://code.angularjs.org/">Download</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="divider-vertical"></li>
|
|
<li class="dropdown">
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
|
<i class="icon-comment icon-white"></i> Discuss <b class="caret"></b>
|
|
</a>
|
|
<ul class="dropdown-menu">
|
|
<li><a href="http://blog.angularjs.org">Blog</a></li>
|
|
<li><a href="http://groups.google.com/group/angular">Mailing List</a></li>
|
|
<li><a href="http://webchat.freenode.net/?channels=angularjs&uio=d4">Chat Room</a></li>
|
|
<li class="divider"></li>
|
|
<li><a href="https://twitter.com/#!/angularjs">Twitter</a></li>
|
|
<li><a href="https://plus.google.com/110323587230527980117">Google+</a></li>
|
|
<li class="divider"></li>
|
|
<li><a href="https://github.com/angular/angular.js">GitHub</a></li>
|
|
<li><a href="https://github.com/angular/angular.js/issues">Issue Tracker</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="divider-vertical"></li>
|
|
</ul>
|
|
</div>
|
|
<form ng-class="{focus:focus}" class="navbar-search col-md-3 docs-search" ng-submit="submit()">
|
|
<span class="glyphicon glyphicon-search search-icon"></span>
|
|
<input type="text"
|
|
name="as_q"
|
|
class="search-query"
|
|
placeholder="Click or press / to search"
|
|
ng-focus="focus=true"
|
|
ng-blur="focus=false"
|
|
ng-change="search(q)"
|
|
ng-model="q"
|
|
docs-search-input
|
|
autocomplete="off" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div class="search-results-container" ng-show="hasResults">
|
|
<div class="container">
|
|
<a href="" ng-click="hideResults()" class="search-close">
|
|
<span class="glyphicon glyphicon-remove search-close-icon"></span> Close
|
|
</a>
|
|
<div class="search-results-frame">
|
|
<div ng-repeat="(key, value) in results" class="search-results-group" ng-class="colClassName + ' col-group-' + key">
|
|
<h4 class="search-results-group-heading">{{ key }}</h4>
|
|
<div class="search-results">
|
|
<div ng-repeat="item in value" class="search-result">
|
|
- <a ng-click="hideResults()" ng-href="{{ item.path }}">{{ item.name }}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<section class="sup-header">
|
|
<div class="container main-grid main-header-grid">
|
|
<div class="grid-left">
|
|
<div ng-controller="DocsVersionsCtrl" class="picker version-picker">
|
|
<select ng-options="v as ('v' + v.version + (v.isSnapshot ? ' (snapshot)' : '')) group by getGroupName(v) for v in docs_versions"
|
|
ng-model="docs_version"
|
|
ng-change="jumpToDocsVersion(docs_version)"
|
|
class="docs-version-jump">
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="grid-right">
|
|
<ul class="nav-breadcrumb">
|
|
<li ng-repeat="crumb in breadcrumb" class="nav-breadcrumb-entry naked-list">
|
|
<span class="divider"> /</span>
|
|
<a ng-href="{{crumb.url}}">{{crumb.name}}</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</header>
|
|
|
|
<section role="main" class="container main-body">
|
|
<div class="main-grid main-body-grid">
|
|
<div class="grid-left">
|
|
<a class="btn toc-toggle visible-xs" ng-click="toc=!toc">Show / Hide Table of Contents</a>
|
|
<div class="side-navigation" ng-show="toc==true">
|
|
<ul class="nav-list naked-list">
|
|
<li ng-repeat="navGroup in currentArea.navGroups track by navGroup.name" class="nav-index-group">
|
|
<a href="{{ navGroup.href }}" ng-class="navClass(navGroup)" class="nav-index-group-heading">{{ navGroup.name }}</a>
|
|
<ul class="aside-nav">
|
|
<li ng-repeat="navItem in navGroup.navItems" ng-class="navClass(navItem)" class="nav-index-listing">
|
|
<a ng-if="navItem.extra.href" ng-class="navClass(navItem.extra)" href="{{navItem.extra.href}}">
|
|
{{navItem.extra.text}}<i ng-if="navItem.extra.icon" class="icon-{{navItem.extra.icon}}"></i>
|
|
</a>
|
|
<a tabindex="2" ng-class="linkClass(navItem)" href="{{navItem.href}}">{{navItem.name}}</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<a href="" ng-click="toc=false" class="toc-close visible-xs">
|
|
<span class="glyphicon glyphicon-remove toc-close-icon"></span> Close
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<div class="grid-right">
|
|
<div id="loading" ng-show="loading">Loading...</div>
|
|
<div ng-hide="loading" ng-include="partialPath" autoscroll></div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<footer class="footer">
|
|
<div class="container">
|
|
<p class="pull-right"><a back-to-top>Back to top</a></p>
|
|
|
|
<p>
|
|
Super-powered by Google ©2010-2014
|
|
( <a id="version"
|
|
ng-href="https://github.com/angular/angular.js/blob/master/CHANGELOG.md#{{versionNumber}}"
|
|
ng-bind-template="v{{version}}">
|
|
</a>
|
|
)
|
|
</p>
|
|
<p>
|
|
Code licensed under the
|
|
<a href="https://github.com/angular/angular.js/blob/master/LICENSE" target="_blank">The
|
|
MIT License</a>. Documentation licensed under <a
|
|
href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.
|
|
</p>
|
|
</div>
|
|
</footer>
|
|
</div>
|
|
</body>
|
|
</html>
|