git-object-browser 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/Gemfile +13 -0
- data/Guardfile +11 -0
- data/LICENSE +22 -0
- data/README.md +18 -0
- data/Rakefile +2 -0
- data/bin/git-object-browser +5 -0
- data/git-object-browser.gemspec +18 -0
- data/htdocs/css/angular-ui.min.css +1 -0
- data/htdocs/css/bootstrap-responsive.css +1058 -0
- data/htdocs/css/bootstrap-responsive.min.css +9 -0
- data/htdocs/css/bootstrap.css +5389 -0
- data/htdocs/css/bootstrap.min.css +699 -0
- data/htdocs/css/font-awesome-ie7.css +645 -0
- data/htdocs/css/font-awesome.css +303 -0
- data/htdocs/css/main.css +22 -0
- data/htdocs/font/fontawesome-webfont.eot +0 -0
- data/htdocs/font/fontawesome-webfont.svg +255 -0
- data/htdocs/font/fontawesome-webfont.ttf +0 -0
- data/htdocs/font/fontawesome-webfont.woff +0 -0
- data/htdocs/img/glyphicons-halflings-white.png +0 -0
- data/htdocs/img/glyphicons-halflings.png +0 -0
- data/htdocs/index.html +114 -0
- data/htdocs/js/main.js +286 -0
- data/htdocs/js/vendor/angular-bootstrap-prettify.min.js +41 -0
- data/htdocs/js/vendor/angular-bootstrap.min.js +9 -0
- data/htdocs/js/vendor/angular-cookies.min.js +7 -0
- data/htdocs/js/vendor/angular-loader.min.js +7 -0
- data/htdocs/js/vendor/angular-resource.min.js +10 -0
- data/htdocs/js/vendor/angular-sanitize.min.js +13 -0
- data/htdocs/js/vendor/angular-ui-ieshiv.min.js +7 -0
- data/htdocs/js/vendor/angular-ui.min.js +7 -0
- data/htdocs/js/vendor/angular.js +14401 -0
- data/htdocs/js/vendor/angular.min.js +158 -0
- data/htdocs/js/vendor/bootstrap.js +2027 -0
- data/htdocs/js/vendor/bootstrap.min.js +6 -0
- data/htdocs/js/vendor/html5shiv.js +5 -0
- data/htdocs/js/vendor/jquery-1.8.2.min.js +2 -0
- data/htdocs/templates/directory.html +25 -0
- data/htdocs/templates/file.html +6 -0
- data/htdocs/templates/git.html +1 -0
- data/htdocs/templates/index.html +44 -0
- data/htdocs/templates/index_entry.html +54 -0
- data/htdocs/templates/info_refs.html +27 -0
- data/htdocs/templates/loading.html +1 -0
- data/htdocs/templates/notfound.html +7 -0
- data/htdocs/templates/object.html +54 -0
- data/htdocs/templates/objects.html +16 -0
- data/htdocs/templates/pack_file.html +15 -0
- data/htdocs/templates/pack_index.html +38 -0
- data/htdocs/templates/packed_object.html +111 -0
- data/htdocs/templates/packed_refs.html +27 -0
- data/htdocs/templates/ref.html +12 -0
- data/lib/git-object-browser.rb +37 -0
- data/lib/git-object-browser/dumper.rb +62 -0
- data/lib/git-object-browser/index_dumper.rb +77 -0
- data/lib/git-object-browser/main.rb +63 -0
- data/lib/git-object-browser/models/bindata.rb +68 -0
- data/lib/git-object-browser/models/directory.rb +61 -0
- data/lib/git-object-browser/models/git_object.rb +127 -0
- data/lib/git-object-browser/models/index.rb +77 -0
- data/lib/git-object-browser/models/index_entry.rb +95 -0
- data/lib/git-object-browser/models/index_reuc_extension.rb +31 -0
- data/lib/git-object-browser/models/index_tree_extension.rb +52 -0
- data/lib/git-object-browser/models/info_refs.rb +32 -0
- data/lib/git-object-browser/models/pack_file.rb +40 -0
- data/lib/git-object-browser/models/pack_index.rb +146 -0
- data/lib/git-object-browser/models/packed_object.rb +239 -0
- data/lib/git-object-browser/models/packed_refs.rb +39 -0
- data/lib/git-object-browser/models/plain_file.rb +24 -0
- data/lib/git-object-browser/models/ref.rb +32 -0
- data/lib/git-object-browser/object_dumper.rb +31 -0
- data/lib/git-object-browser/server/git_servlet.rb +209 -0
- data/lib/git-object-browser/server/main.rb +31 -0
- data/lib/git-object-browser/version.rb +3 -0
- data/spec/fixtures/generate_worktree.sh +103 -0
- data/spec/fixtures/git/indexes/001 +0 -0
- data/spec/fixtures/git/indexes/002-empty-tree-extension +0 -0
- data/spec/fixtures/git/plain_file +1 -0
- data/spec/fixtures/json/blob.json +9 -0
- data/spec/fixtures/json/merge-a.json +48 -0
- data/spec/fixtures/json/test3-tag.json +36 -0
- data/spec/fixtures/json/tree.json +20 -0
- data/spec/fixtures/worktree/_git/COMMIT_EDITMSG +1 -0
- data/spec/fixtures/worktree/_git/HEAD +1 -0
- data/spec/fixtures/worktree/_git/ORIG_HEAD +1 -0
- data/spec/fixtures/worktree/_git/config +11 -0
- data/spec/fixtures/worktree/_git/description +1 -0
- data/spec/fixtures/worktree/_git/hooks/applypatch-msg.sample +15 -0
- data/spec/fixtures/worktree/_git/hooks/commit-msg.sample +24 -0
- data/spec/fixtures/worktree/_git/hooks/post-update.sample +8 -0
- data/spec/fixtures/worktree/_git/hooks/pre-applypatch.sample +14 -0
- data/spec/fixtures/worktree/_git/hooks/pre-commit.sample +50 -0
- data/spec/fixtures/worktree/_git/hooks/pre-rebase.sample +169 -0
- data/spec/fixtures/worktree/_git/hooks/prepare-commit-msg.sample +36 -0
- data/spec/fixtures/worktree/_git/hooks/update.sample +128 -0
- data/spec/fixtures/worktree/_git/ignore +3 -0
- data/spec/fixtures/worktree/_git/index +0 -0
- data/spec/fixtures/worktree/_git/info/exclude +6 -0
- data/spec/fixtures/worktree/_git/info/refs +1 -0
- data/spec/fixtures/worktree/_git/logs/HEAD +10 -0
- data/spec/fixtures/worktree/_git/logs/refs/heads/branch-a +3 -0
- data/spec/fixtures/worktree/_git/logs/refs/heads/branch-b +2 -0
- data/spec/fixtures/worktree/_git/logs/refs/heads/master +4 -0
- data/spec/fixtures/worktree/_git/objects/00/cb8bfeb5b8ce906d39698e4e33b38341f5448f +1 -0
- data/spec/fixtures/worktree/_git/objects/07/31f9d4b6fa0475872be6a8ca263096f1d201cf +2 -0
- data/spec/fixtures/worktree/_git/objects/1d/3dc60b5a117054e43741d51e599ff31bb15f9f +0 -0
- data/spec/fixtures/worktree/_git/objects/26/4e42b1fef5bcb55acec162fdd5a068d79ae551 +0 -0
- data/spec/fixtures/worktree/_git/objects/28/3c06ddf1b31c14bb221d41173299e133b7753d +0 -0
- data/spec/fixtures/worktree/_git/objects/37/d1632d3f1159dad9cfb58e6c34312ab4355c49 +0 -0
- data/spec/fixtures/worktree/_git/objects/3a/2bf444f105c19b13ba5e75e884e10715e95a91 +0 -0
- data/spec/fixtures/worktree/_git/objects/40/a061aaf0cd0555449671a11993e4fed11f91a4 +2 -0
- data/spec/fixtures/worktree/_git/objects/53/2a1874c26cd19bd4d66e03218ab73e63de4357 +3 -0
- data/spec/fixtures/worktree/_git/objects/5b/719b165fde1964fb5a08adaf3b6e4f57ca1ff5 +0 -0
- data/spec/fixtures/worktree/_git/objects/61/cae34206bb889bae43ffdd22c17217485178bf +0 -0
- data/spec/fixtures/worktree/_git/objects/6c/444ac15f1e3c2a6869bd36ca7e58c39512106f +2 -0
- data/spec/fixtures/worktree/_git/objects/93/b714995d24c52180195876058a49c7d7fea0ad +0 -0
- data/spec/fixtures/worktree/_git/objects/96/25401ac3e19ef10868c140a76b719ac3f08fcf +0 -0
- data/spec/fixtures/worktree/_git/objects/b9/29ed2ab14f7489d5238a06d10d2f2c229a4ab4 +0 -0
- data/spec/fixtures/worktree/_git/objects/be/e0d26d33c284ee065e38bd7e81ae4bdc870f89 +4 -0
- data/spec/fixtures/worktree/_git/objects/c3/6491256978d26c08cd7aa97eee0f5631f96659 +0 -0
- data/spec/fixtures/worktree/_git/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 +0 -0
- data/spec/fixtures/worktree/_git/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b +0 -0
- data/spec/fixtures/worktree/_git/objects/e5/b6d4317cefa946d77fc91539f1f1e48b60836f +0 -0
- data/spec/fixtures/worktree/_git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
- data/spec/fixtures/worktree/_git/objects/info/packs +2 -0
- data/spec/fixtures/worktree/_git/objects/pack/pack-f1c1717e9264c12310c7bd3e7dcdd28924000ff6.idx +0 -0
- data/spec/fixtures/worktree/_git/objects/pack/pack-f1c1717e9264c12310c7bd3e7dcdd28924000ff6.pack +0 -0
- data/spec/fixtures/worktree/_git/packed-refs +2 -0
- data/spec/fixtures/worktree/_git/refs/heads/branch-a +1 -0
- data/spec/fixtures/worktree/_git/refs/heads/branch-b +1 -0
- data/spec/fixtures/worktree/_git/refs/heads/master +1 -0
- data/spec/fixtures/worktree/_git/refs/tags/simple-tag +1 -0
- data/spec/fixtures/worktree/_git/refs/tags/test3-tag +1 -0
- data/spec/fixtures/worktree/sample-a.txt +1 -0
- data/spec/fixtures/worktree/sample.txt +1 -0
- data/spec/fixtures/worktree/subdir/sample-sub.txt +0 -0
- data/spec/git-object-browser/main_spec.rb +31 -0
- data/spec/git-object-browser/models/bindata_spec.rb +144 -0
- data/spec/git-object-browser/models/git_object_spec.rb +49 -0
- data/spec/git-object-browser/models/index_spec.rb +42 -0
- data/spec/git-object-browser/models/index_tree_extension_spec.rb +58 -0
- data/spec/git-object-browser/models/plain_file_spec.rb +11 -0
- data/spec/spec_helper.rb +19 -0
- metadata +260 -0
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/htdocs/index.html
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
|
3
|
+
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
4
|
+
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
|
5
|
+
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
|
6
|
+
<head>
|
7
|
+
<meta charset="utf-8">
|
8
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
9
|
+
<title></title>
|
10
|
+
<meta name="description" content="">
|
11
|
+
<meta name="viewport" content="width=device-width">
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/bootstrap.min.css">
|
14
|
+
<style>
|
15
|
+
body {
|
16
|
+
padding-top: 60px;
|
17
|
+
padding-bottom: 40px;
|
18
|
+
}
|
19
|
+
</style>
|
20
|
+
<link rel="stylesheet" href="css/bootstrap-responsive.min.css">
|
21
|
+
<link rel="stylesheet" href="css/main.css">
|
22
|
+
<link rel="stylesheet" href="css/angular-ui.min.css">
|
23
|
+
<link rel="stylesheet" href="css/font-awesome.css">
|
24
|
+
|
25
|
+
<!--[if lt IE 9]>
|
26
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
27
|
+
<script>window.html5 || document.write('<script src="js/vendor/html5shiv.js"><\/script>')</script>
|
28
|
+
<![endif]-->
|
29
|
+
</head>
|
30
|
+
<body data-ng-app="GitObjectBrowser">
|
31
|
+
<!--[if lt IE 7]>
|
32
|
+
<p class="chromeframe">You are using an outdated browser. <a href="http://browsehappy.com/">Upgrade your browser today</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to better experience this site.</p>
|
33
|
+
<![endif]-->
|
34
|
+
|
35
|
+
<!-- This code is taken from http://twitter.github.com/bootstrap/examples/hero.html -->
|
36
|
+
|
37
|
+
<div class="navbar navbar-inverse navbar-fixed-top">
|
38
|
+
<div class="navbar-inner">
|
39
|
+
<div class="container">
|
40
|
+
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
41
|
+
<span class="icon-bar"></span>
|
42
|
+
<span class="icon-bar"></span>
|
43
|
+
<span class="icon-bar"></span>
|
44
|
+
</a>
|
45
|
+
<a class="brand" href="/"><i class="icon-comment icon-white"></i> GOB</a>
|
46
|
+
<div class="nav-collapse collapse">
|
47
|
+
<ul class="nav">
|
48
|
+
<li class="active"><a href="/">Home</a></li>
|
49
|
+
<li class="dropdown">
|
50
|
+
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Documents <b class="caret"></b></a>
|
51
|
+
<ul class="dropdown-menu">
|
52
|
+
<li><a href="http://git-scm.com/book/en/Git-Internals-Git-Objects">Git Internals - Git Objects</a></li>
|
53
|
+
<li><a href="http://github.com/git/git/blob/master//Documentation/technical/index-format.txt">index-format.txt</a></li>
|
54
|
+
<li><a href="https://github.com/git/git/blob/master/Documentation/technical/pack-format.txt">pack-format.txt</a></li>
|
55
|
+
<li><a href="http://git-scm.com/docs/git-check-ref-format">git-check-ref-format(1) Manual Page</a></li>
|
56
|
+
<li><a href="http://git-scm.com/docs/gitrevisions.html">gitrevisions(7) Manual Page</a></li>
|
57
|
+
</ul>
|
58
|
+
</li>
|
59
|
+
<li class="dropdown">
|
60
|
+
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Sources <b class="caret"></b></a>
|
61
|
+
<ul class="dropdown-menu">
|
62
|
+
<li><a href="https://github.com/git/git">Git</a></li>
|
63
|
+
<li><a href="https://github.com/libgit2/libgit2">libgit2</a></li>
|
64
|
+
<li><a href="https://github.com/mojombo/grit">Grit (Ruby)</a></li>
|
65
|
+
<li><a href="https://github.com/jelmer/dulwich">Dulwich (Python)</a></li>
|
66
|
+
<li><a href="https://github.com/bobtfish/git-pureperl">Git::PurePerl (Perl)</a></li>
|
67
|
+
<li><a href="https://github.com/christkv/node-git">node-git (node.js)</a></li>
|
68
|
+
|
69
|
+
<li class="divider"></li>
|
70
|
+
<li><a href="https://github.com/koseki/git-object-browser">git-object-browser</a></li>
|
71
|
+
|
72
|
+
</ul>
|
73
|
+
</li>
|
74
|
+
</ul>
|
75
|
+
</div><!--/.nav-collapse -->
|
76
|
+
</div>
|
77
|
+
</div>
|
78
|
+
</div>
|
79
|
+
|
80
|
+
<div class="container">
|
81
|
+
<div class="row">
|
82
|
+
<div class="span3">
|
83
|
+
<ul class="nav nav-list">
|
84
|
+
<li class="nav-header">Git Object Browser</li>
|
85
|
+
<li class=""><a href="/#/.git/"><i data-entry-icon="'directory'"></i>.git</a></li>
|
86
|
+
<li class=""><a href="/#/.git/objects"><i data-entry-icon="'directory'"></i> objects</a></li>
|
87
|
+
<li class=""><a href="/#/.git/objects/pack"><i data-entry-icon="'directory'"></i> pack</a></li>
|
88
|
+
<li class=""><a href="/#/.git/refs"><i data-entry-icon="'directory'"></i> refs</a></li>
|
89
|
+
<li class=""><a href="/#/.git/HEAD"><i data-entry-icon="'ref'"></i> HEAD</a></li>
|
90
|
+
<li class=""><a href="/#/.git/index"><i data-entry-icon="'index'"></i> index</a></li>
|
91
|
+
</ul>
|
92
|
+
</div>
|
93
|
+
|
94
|
+
<div class="span9">
|
95
|
+
<div data-ng-view></div>
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
<footer>
|
100
|
+
<hr>
|
101
|
+
</footer>
|
102
|
+
|
103
|
+
</div> <!-- /container -->
|
104
|
+
|
105
|
+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
|
106
|
+
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.8.2.min.js"><\/script>')</script>
|
107
|
+
<script src="js/vendor/bootstrap.min.js"></script>
|
108
|
+
<script src="js/vendor/angular.js"></script>
|
109
|
+
<script src="js/vendor/angular-resource.min.js"></script>
|
110
|
+
<script src="js/vendor/angular-ui.min.js"></script>
|
111
|
+
|
112
|
+
<script src="js/main.js"></script>
|
113
|
+
</body>
|
114
|
+
</html>
|
data/htdocs/js/main.js
ADDED
@@ -0,0 +1,286 @@
|
|
1
|
+
|
2
|
+
angular.module('GitServices', ['ngResource'])
|
3
|
+
.factory('GitResource', function($resource) {
|
4
|
+
var resource = $resource('/.git/:path');
|
5
|
+
return resource;
|
6
|
+
})
|
7
|
+
.factory('PackedObjectResource', function($resource) {
|
8
|
+
var resource = $resource('/.git/:path?offset=:offset');
|
9
|
+
return resource;
|
10
|
+
});
|
11
|
+
|
12
|
+
angular.module('GitObjectBrowser', ['GitServices'])
|
13
|
+
.config(function($routeProvider) {
|
14
|
+
$routeProvider = angular.extend($routeProvider, {
|
15
|
+
|
16
|
+
// AngularJS doesn't support regular expressions in routes.
|
17
|
+
// http://stackoverflow.com/questions/12685085/angularjs-route-how-to-match-star-as-a-path
|
18
|
+
'whenPath': function(path, depth, route) {
|
19
|
+
for (var i = 1; i <= depth; i++) {
|
20
|
+
path += '/:path' + i;
|
21
|
+
this.when(path, route);
|
22
|
+
}
|
23
|
+
return this;
|
24
|
+
}
|
25
|
+
});
|
26
|
+
|
27
|
+
$routeProvider.
|
28
|
+
whenPath('/.git', 10, {controller:GitCtrl, templateUrl:'templates/git.html'}).
|
29
|
+
otherwise({redirectTo:'/.git/'});
|
30
|
+
})
|
31
|
+
|
32
|
+
.directive('entryIcon', function($parse) {
|
33
|
+
return function(scope, element, attrs) {
|
34
|
+
var icons = {
|
35
|
+
'directory': 'icon-folder-open',
|
36
|
+
'ref': 'icon-map-marker',
|
37
|
+
'info_refs': 'icon-map-marker',
|
38
|
+
'packed_refs': 'icon-map-marker',
|
39
|
+
'index': 'icon-list',
|
40
|
+
'file': 'icon-file',
|
41
|
+
'object': 'icon-comment',
|
42
|
+
'blob': 'icon-file',
|
43
|
+
'tree': 'icon-folder-open',
|
44
|
+
'commit': 'icon-ok',
|
45
|
+
'tag': 'icon-tag',
|
46
|
+
'ofs_delta': 'icon-arrow-up',
|
47
|
+
'ref_delta': 'icon-arrow-down'
|
48
|
+
};
|
49
|
+
|
50
|
+
var entryType = ($parse(attrs.entryIcon))(scope);
|
51
|
+
element.addClass(icons[entryType]);
|
52
|
+
}
|
53
|
+
})
|
54
|
+
|
55
|
+
.directive('modeIcon', function($parse) {
|
56
|
+
return function(scope, element, attrs) {
|
57
|
+
var mode = ($parse(attrs.modeIcon))(scope);
|
58
|
+
var iconClass;
|
59
|
+
if (120000 <= mode) {
|
60
|
+
iconClass = 'icon-share-alt';
|
61
|
+
} else if (100000 <= mode) {
|
62
|
+
iconClass = 'icon-file';
|
63
|
+
} else {
|
64
|
+
iconClass = 'icon-folder-open';
|
65
|
+
}
|
66
|
+
element.addClass(iconClass);
|
67
|
+
}
|
68
|
+
})
|
69
|
+
|
70
|
+
.directive('refHref', function($parse) {
|
71
|
+
return function(scope, element, attrs) {
|
72
|
+
var entry = ($parse(attrs.refHref))(scope);
|
73
|
+
var href = "";
|
74
|
+
var sha1 = null;
|
75
|
+
|
76
|
+
if (typeof(entry) == 'string') {
|
77
|
+
sha1 = entry;
|
78
|
+
} else if (entry && entry.sha1) {
|
79
|
+
sha1 = entry.sha1;
|
80
|
+
}
|
81
|
+
|
82
|
+
if (sha1 !== null) {
|
83
|
+
href = '#/.git/objects/' + sha1.substr(0, 2) + '/' + sha1.substr(2);
|
84
|
+
} else if (entry && entry.ref) {
|
85
|
+
href = '#/.git/' + entry.ref;
|
86
|
+
}
|
87
|
+
|
88
|
+
element.attr('href', href);
|
89
|
+
}
|
90
|
+
})
|
91
|
+
|
92
|
+
.filter('unixtime', function($filter) {
|
93
|
+
return function(input, format) {
|
94
|
+
return ($filter('date'))(input * 1000, format);
|
95
|
+
}
|
96
|
+
});
|
97
|
+
|
98
|
+
function GitCtrl($scope, $location, $routeParams, GitResource, PackedObjectResource) {
|
99
|
+
$scope.template = 'templates/loading.html';
|
100
|
+
var path = '';
|
101
|
+
for (var i = 1; i <= 10; i++) {
|
102
|
+
if ($routeParams['path' + i]) {
|
103
|
+
if (i > 1) path += '/';
|
104
|
+
path += $routeParams['path' + i];
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
$scope.objectTable = function(entries) {
|
109
|
+
var rows = [];
|
110
|
+
var hash = {};
|
111
|
+
|
112
|
+
angular.forEach(entries, function(entry) {
|
113
|
+
hash[entry.basename] = entry;
|
114
|
+
})
|
115
|
+
|
116
|
+
var hex = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];
|
117
|
+
for (var i = 0; i < 16; i++) {
|
118
|
+
var cols = [];
|
119
|
+
for (var j = 0; j < 16; j++) {
|
120
|
+
if (hash[hex[i] + hex[j]]) {
|
121
|
+
cols[j] = hash[hex[i] + hex[j]];
|
122
|
+
} else {
|
123
|
+
cols[j] = {'basename': hex[i] + hex[j], 'type': 'empty'};
|
124
|
+
}
|
125
|
+
}
|
126
|
+
rows[i] = cols;
|
127
|
+
}
|
128
|
+
return rows;
|
129
|
+
}
|
130
|
+
|
131
|
+
$scope.findIndexEntry = function(sha1) {
|
132
|
+
var entries = $scope.object.entries;
|
133
|
+
var entry = null;
|
134
|
+
angular.forEach(entries, function(value) {
|
135
|
+
if (value.sha1 == sha1) {
|
136
|
+
entry = value;
|
137
|
+
return;
|
138
|
+
}
|
139
|
+
});
|
140
|
+
return entry;
|
141
|
+
};
|
142
|
+
|
143
|
+
$scope.indexEntryKeys = function(version) {
|
144
|
+
var keys = [
|
145
|
+
'ctime',
|
146
|
+
'cnano',
|
147
|
+
'mtime',
|
148
|
+
'mnano',
|
149
|
+
'dev',
|
150
|
+
'ino',
|
151
|
+
'object_type',
|
152
|
+
'unix_permission',
|
153
|
+
'uid',
|
154
|
+
'gid',
|
155
|
+
'size',
|
156
|
+
'sha1',
|
157
|
+
'path'
|
158
|
+
]
|
159
|
+
|
160
|
+
if (version == 2) {
|
161
|
+
keys = keys.concat([
|
162
|
+
'assume_valid_flag',
|
163
|
+
'extended_flag',
|
164
|
+
'stage',
|
165
|
+
]);
|
166
|
+
} else {
|
167
|
+
keys = keys.concat([
|
168
|
+
'skip_worktree',
|
169
|
+
'intent_to_add',
|
170
|
+
]);
|
171
|
+
}
|
172
|
+
keys.push('name_length');
|
173
|
+
|
174
|
+
return keys;
|
175
|
+
};
|
176
|
+
|
177
|
+
$scope.resourceLoaded = function(json) {
|
178
|
+
$scope.workingdir = json.workingdir;
|
179
|
+
$scope.root = json.root;
|
180
|
+
if (json.path == "") {
|
181
|
+
$scope.path = ".git";
|
182
|
+
} else {
|
183
|
+
$scope.path = ".git/" + json.path;
|
184
|
+
}
|
185
|
+
$scope.object = json.object;
|
186
|
+
$scope.keys = $scope.indexEntryKeys($scope.object.version);
|
187
|
+
var template;
|
188
|
+
if (json.path == "objects") {
|
189
|
+
template = "objects";
|
190
|
+
$scope.objectTable = $scope.objectTable($scope.object.entries);
|
191
|
+
} else if (json.type == "index" && $routeParams.sha1) {
|
192
|
+
template = "index_entry";
|
193
|
+
$scope.entry = $scope.findIndexEntry($routeParams.sha1);
|
194
|
+
} else if (json.type == "packed_refs" && $routeParams.ref) {
|
195
|
+
template = json.type;
|
196
|
+
var entries = [];
|
197
|
+
angular.forEach($scope.object.entries, function(entry) {
|
198
|
+
if (entry.ref == $routeParams.ref) {
|
199
|
+
entries.push(entry);
|
200
|
+
$scope.limited = true;
|
201
|
+
}
|
202
|
+
});
|
203
|
+
$scope.object.entries = entries;
|
204
|
+
} else {
|
205
|
+
template = json.type;
|
206
|
+
}
|
207
|
+
|
208
|
+
$scope.template = 'templates/' + template + '.html';
|
209
|
+
};
|
210
|
+
|
211
|
+
$scope.resourceError = function(path) {
|
212
|
+
return function(response) {
|
213
|
+
if (response.status == 404) {
|
214
|
+
$scope.resourceNotFound(path);
|
215
|
+
} else {
|
216
|
+
$scope.template = 'templates/error.html';
|
217
|
+
}
|
218
|
+
};
|
219
|
+
};
|
220
|
+
|
221
|
+
$scope.resourceNotFound = function(path) {
|
222
|
+
$scope.path = path;
|
223
|
+
if (path.indexOf('refs/') == 0) {
|
224
|
+
$location.url('/.git/packed-refs?ref=' + path);
|
225
|
+
} else {
|
226
|
+
$scope.template = 'templates/notfound.html';
|
227
|
+
}
|
228
|
+
};
|
229
|
+
|
230
|
+
if (path.match(/^objects\/pack\/pack-[0-9a-f]{40}\.pack$/) && $routeParams.offset) {
|
231
|
+
PackedObjectResource.get({path: path, offset:$routeParams.offset}, $scope.resourceLoaded, $scope.resourceError(path));
|
232
|
+
} else {
|
233
|
+
GitResource.get({path: path}, $scope.resourceLoaded, $scope.resourceError(path));
|
234
|
+
}
|
235
|
+
|
236
|
+
}
|
237
|
+
|
238
|
+
function PackFileCtrl($scope, $location, $routeParams) {
|
239
|
+
$scope.indexUrl = $scope.path.replace(/.pack$/, '.idx');
|
240
|
+
}
|
241
|
+
|
242
|
+
function PackIndexCtrl($scope, $location, $routeParams) {
|
243
|
+
|
244
|
+
$scope.orderByOffset = function() {
|
245
|
+
$scope.object.entries = $scope.object.entries.sort(function(a, b) {
|
246
|
+
var x = a.offset - b.offset;
|
247
|
+
if (x == 0) {
|
248
|
+
return a.index - b.index;
|
249
|
+
}
|
250
|
+
return x;
|
251
|
+
});
|
252
|
+
return false;
|
253
|
+
}
|
254
|
+
|
255
|
+
$scope.orderByIndex = function() {
|
256
|
+
$scope.object.entries = $scope.object.entries.sort(function(a, b) {
|
257
|
+
return a.index - b.index;
|
258
|
+
})
|
259
|
+
return false;
|
260
|
+
}
|
261
|
+
|
262
|
+
$scope.packUrl = $scope.path.replace(/.idx$/, '.pack');
|
263
|
+
|
264
|
+
angular.forEach($scope.object.entries, function(entry, i) {
|
265
|
+
entry.index = i;
|
266
|
+
});
|
267
|
+
|
268
|
+
angular.forEach($scope.object.fanout, function(fanout, i) {
|
269
|
+
function toHex(num) {
|
270
|
+
var hex = num.toString(16);
|
271
|
+
return hex.length < 2 ? '0' + hex : hex;
|
272
|
+
}
|
273
|
+
|
274
|
+
if ($scope.object.entries[fanout]) {
|
275
|
+
var entry = $scope.object.entries[fanout];
|
276
|
+
if (! entry.fanoutMin) {
|
277
|
+
entry.fanoutMin = toHex(i);
|
278
|
+
} else {
|
279
|
+
entry.fanoutMax = toHex(i);
|
280
|
+
}
|
281
|
+
} else {
|
282
|
+
$scope.object.entries[fanout] = { fanoutMin: toHex(i) };
|
283
|
+
}
|
284
|
+
});
|
285
|
+
|
286
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
/*
|
2
|
+
AngularJS v1.0.2
|
3
|
+
(c) 2010-2012 Google, Inc. http://angularjs.org
|
4
|
+
License: MIT
|
5
|
+
*/
|
6
|
+
(function(q,k,I){'use strict';function G(c){return c.replace(/\&/g,"&").replace(/\</g,"<").replace(/\>/g,">").replace(/"/g,""")}function D(c,e){var b=k.element("<pre>"+e+"</pre>");c.html("");c.append(b.contents());return c}var t={},w={value:{}},L={"angular.js":"http://code.angularjs.org/angular-"+k.version.full+".min.js","angular-resource.js":"http://code.angularjs.org/angular-resource-"+k.version.full+".min.js","angular-sanitize.js":"http://code.angularjs.org/angular-sanitize-"+k.version.full+
|
7
|
+
".min.js","angular-cookies.js":"http://code.angularjs.org/angular-cookies-"+k.version.full+".min.js"};t.jsFiddle=function(c,e,b){return{terminal:!0,link:function(x,a,r){function d(a,b){return'<input type="hidden" name="'+a+'" value="'+e(b)+'">'}var H={html:"",css:"",js:""};k.forEach(r.jsFiddle.split(" "),function(a,b){var d=a.split(".")[1];H[d]+=d=="html"?b==0?"<div ng-app"+(r.module?'="'+r.module+'"':"")+">\n"+c(a,2):"\n\n\n <\!-- CACHE FILE: "+a+' --\>\n <script type="text/ng-template" id="'+
|
8
|
+
a+'">\n'+c(a,4)+" <\/script>\n":c(a)+"\n"});H.html+="</div>\n";D(a,'<form class="jsfiddle" method="post" action="http://jsfiddle.net/api/post/library/pure/" target="_blank">'+d("title","AngularJS Example: ")+d("css",'</style> <\!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ --\> \n<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">\n'+b.angular+(r.resource?b.resource:"")+"<style>\n"+H.css)+d("html",H.html)+d("js",H.js)+'<button class="btn btn-primary"><i class="icon-white icon-pencil"></i> Edit Me</button></form>')}}};
|
9
|
+
t.code=function(){return{restrict:"E",terminal:!0}};t.prettyprint=["reindentCode",function(c){return{restrict:"C",terminal:!0,compile:function(e){e.html(q.prettyPrintOne(c(e.html()),I,!0))}}}];t.ngSetText=["getEmbeddedTemplate",function(c){return{restrict:"CA",priority:10,compile:function(e,b){D(e,G(c(b.ngSetText)))}}}];t.ngHtmlWrap=["reindentCode","templateMerge",function(c,e){return{compile:function(b,c){var a={head:"",module:"",body:b.text()};k.forEach((c.ngHtmlWrap||"").split(" "),function(b){if(b){var b=
|
10
|
+
L[b]||b,d=b.split(/\./).pop();d=="css"?a.head+='<link rel="stylesheet" href="'+b+'" type="text/css">\n':d=="js"?a.head+='<script src="'+b+'"><\/script>\n':a.module='="'+b+'"'}});D(b,G(e("<!doctype html>\n<html ng-app{{module}}>\n <head>\n{{head:4}} </head>\n <body>\n{{body:4}} </body>\n</html>",a)))}}}];t.ngSetHtml=["getEmbeddedTemplate",function(c){return{restrict:"CA",priority:10,compile:function(e,b){D(e,c(b.ngSetHtml))}}}];t.ngEvalJavascript=["getEmbeddedTemplate",function(c){return{compile:function(e,
|
11
|
+
b){var x=c(b.ngEvalJavascript);try{q.execScript?q.execScript(x||'""'):q.eval(x)}catch(a){q.console?q.console.log(x,"\n",a):q.alert(a)}}}}];t.ngEmbedApp=["$templateCache","$browser","$rootScope","$location",function(c,e,b,x){return{terminal:!0,link:function(a,r,d){a=[];a.push(["$provide",function(a){a.value("$templateCache",c);a.value("$anchorScroll",k.noop);a.value("$browser",e);a.provider("$location",function(){this.$get=["$rootScope",function(a){b.$on("$locationChangeSuccess",function(b,d,c){a.$broadcast("$locationChangeSuccess",
|
12
|
+
d,c)});return x}];this.html5Mode=k.noop});a.decorator("$timeout",["$rootScope","$delegate",function(a,b){return k.extend(function(d,c){return c&&c>50?setTimeout(function(){a.$apply(d)},c):b.apply(this,arguments)},b)}]);a.decorator("$rootScope",["$delegate",function(a){b.$watch(function(){a.$digest()});return a}])}]);d.ngEmbedApp&&a.push(d.ngEmbedApp);r.bind("click",function(a){a.target.attributes.getNamedItem("ng-click")&&a.preventDefault()});k.bootstrap(r,a)}}}];w.reindentCode=function(){return function(c,
|
13
|
+
e){if(!c)return c;for(var b=c.split(/\r?\n/),x=" ".substr(0,e||0),a;b.length&&b[0].match(/^\s*$/);)b.shift();for(;b.length&&b[b.length-1].match(/^\s*$/);)b.pop();var r=999;for(a=0;a<b.length;a++){var d=b[0],k=d.match(/^\s*/)[0];if(k!==d&&k.length<r)r=k.length}for(a=0;a<b.length;a++)b[a]=x+b[a].substring(r);b.push("");return b.join("\n")}};w.templateMerge=["reindentCode",function(c){return function(e,b){return e.replace(/\{\{(\w+)(?:\:(\d+))?\}\}/g,function(e,a,k){e=b[a];k&&(e=c(e,k));return e==
|
14
|
+
I?"":e})}}];w.getEmbeddedTemplate=["reindentCode",function(c){return function(e){e=document.getElementById(e);return!e?null:c(k.element(e).html(),0)}}];k.module("bootstrapPrettify",[]).directive(t).factory(w);q.PR_SHOULD_USE_CONTINUATION=!0;(function(){function c(a){function b(i){var a=i.charCodeAt(0);if(a!==92)return a;var l=i.charAt(1);return(a=k[l])?a:"0"<=l&&l<="7"?parseInt(i.substring(1),8):l==="u"||l==="x"?parseInt(i.substring(2),16):i.charCodeAt(1)}function A(i){if(i<32)return(i<16?"\\x0":
|
15
|
+
"\\x")+i.toString(16);i=String.fromCharCode(i);return i==="\\"||i==="-"||i==="]"||i==="^"?"\\"+i:i}function M(i){var a=i.substring(1,i.length-1).match(/\\u[0-9A-Fa-f]{4}|\\x[0-9A-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\s\S]|-|[^-\\]/g),i=[],l=a[0]==="^",f=["["];l&&f.push("^");for(var l=l?1:0,g=a.length;l<g;++l){var j=a[l];if(/\\[bdsw]/i.test(j))f.push(j);else{var j=b(j),h;l+2<g&&"-"===a[l+1]?(h=b(a[l+2]),l+=2):h=j;i.push([j,h]);h<65||j>122||(h<65||j>90||i.push([Math.max(65,j)|32,Math.min(h,90)|
|
16
|
+
32]),h<97||j>122||i.push([Math.max(97,j)&-33,Math.min(h,122)&-33]))}}i.sort(function(i,a){return i[0]-a[0]||a[1]-i[1]});a=[];g=[];for(l=0;l<i.length;++l)j=i[l],j[0]<=g[1]+1?g[1]=Math.max(g[1],j[1]):a.push(g=j);for(l=0;l<a.length;++l)j=a[l],f.push(A(j[0])),j[1]>j[0]&&(j[1]+1>j[0]&&f.push("-"),f.push(A(j[1])));f.push("]");return f.join("")}function c(i){for(var a=i.source.match(RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)",
|
17
|
+
"g")),f=a.length,b=[],g=0,j=0;g<f;++g){var h=a[g];h==="("?++j:"\\"===h.charAt(0)&&(h=+h.substring(1))&&(h<=j?b[h]=-1:a[g]=A(h))}for(g=1;g<b.length;++g)-1===b[g]&&(b[g]=++d);for(j=g=0;g<f;++g)h=a[g],h==="("?(++j,b[j]||(a[g]="(?:")):"\\"===h.charAt(0)&&(h=+h.substring(1))&&h<=j&&(a[g]="\\"+b[h]);for(g=0;g<f;++g)"^"===a[g]&&"^"!==a[g+1]&&(a[g]="");if(i.ignoreCase&&e)for(g=0;g<f;++g)h=a[g],i=h.charAt(0),h.length>=2&&i==="["?a[g]=M(h):i!=="\\"&&(a[g]=h.replace(/[a-zA-Z]/g,function(a){a=a.charCodeAt(0);
|
18
|
+
return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var d=0,e=!1,m=!1,p=0,f=a.length;p<f;++p){var n=a[p];if(n.ignoreCase)m=!0;else if(/[a-z]/i.test(n.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){e=!0;m=!1;break}}for(var k={b:8,t:9,n:10,v:11,f:12,r:13},o=[],p=0,f=a.length;p<f;++p){n=a[p];if(n.global||n.multiline)throw Error(""+n);o.push("(?:"+c(n)+")")}return RegExp(o.join("|"),m?"gi":"g")}function e(a,b){function A(a){switch(a.nodeType){case 1:if(M.test(a.className))break;
|
19
|
+
for(var f=a.firstChild;f;f=f.nextSibling)A(f);f=a.nodeName.toLowerCase();if("br"===f||"li"===f)c[m]="\n",e[m<<1]=d++,e[m++<<1|1]=a;break;case 3:case 4:f=a.nodeValue,f.length&&(f=b?f.replace(/\r\n?/g,"\n"):f.replace(/[ \t\r\n]+/g," "),c[m]=f,e[m<<1]=d,d+=f.length,e[m++<<1|1]=a)}}var M=/(?:^|\s)nocode(?:\s|$)/,c=[],d=0,e=[],m=0;A(a);return{sourceCode:c.join("").replace(/\n$/,""),spans:e}}function b(a,b,c,d){b&&(a={sourceCode:b,basePos:a},c(a),d.push.apply(d,a.decorations))}function k(a,d){var A={},
|
20
|
+
e;(function(){for(var b=a.concat(d),m=[],p={},f=0,n=b.length;f<n;++f){var k=b[f],o=k[3];if(o)for(var i=o.length;--i>=0;)A[o.charAt(i)]=k;k=k[1];o=""+k;p.hasOwnProperty(o)||(m.push(k),p[o]=null)}m.push(/[\0-\uffff]/);e=c(m)})();var r=d.length,N=function(a){for(var c=a.basePos,B=[c,"pln"],f=0,k=a.sourceCode.match(e)||[],v={},o=0,i=k.length;o<i;++o){var u=k[o],l=v[u],s=void 0,g;if(typeof l==="string")g=!1;else{var j=A[u.charAt(0)];if(j)s=u.match(j[1]),l=j[0];else{for(g=0;g<r;++g)if(j=d[g],s=u.match(j[1])){l=
|
21
|
+
j[0];break}s||(l="pln")}if((g=l.length>=5&&"lang-"===l.substring(0,5))&&!(s&&typeof s[1]==="string"))g=!1,l="src";g||(v[u]=l)}j=f;f+=u.length;if(g){g=s[1];var h=u.indexOf(g),E=h+g.length;s[2]&&(E=u.length-s[2].length,h=E-g.length);l=l.substring(5);b(c+j,u.substring(0,h),N,B);b(c+j+h,g,t(l,g),B);b(c+j+E,u.substring(E),N,B)}else B.push(c+j,l)}a.decorations=B};return N}function a(a){var b=[],c=[];a.tripleQuotedStrings?b.push(["str",/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,
|
22
|
+
null,"'\""]):a.multiLineStrings?b.push(["str",/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):b.push(["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]);a.verbatimStrings&&c.push(["str",/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var d=a.hashComments;d&&(a.cStyleComments?(d>1?b.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):b.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,
|
23
|
+
null,"#"]),c.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):b.push(["com",/^#[^\r\n]*/,null,"#"]));a.cStyleComments&&(c.push(["com",/^\/\/[^\r\n]*/,null]),c.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null]));a.regexLiterals&&c.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*(/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/)")]);
|
24
|
+
(d=a.types)&&c.push(["typ",d]);a=(""+a.keywords).replace(/^ | $/g,"");a.length&&c.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),null]);b.push(["pln",/^\s+/,null," \r\n\t\u00a0"]);c.push(["lit",/^@[a-z_$][a-z_$@0-9]*/i,null],["typ",/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],["pln",/^[a-z_$][a-z_$@0-9]*/i,null],["lit",/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],["pln",/^\\[\s\S]?/,null],["pun",/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);
|
25
|
+
return k(b,c)}function r(a,b,c){function d(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("br"===a.nodeName)e(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)d(a);break;case 3:case 4:if(c){var b=a.nodeValue,f=b.match(r);if(f){var B=b.substring(0,f.index);a.nodeValue=B;(b=b.substring(f.index+f[0].length))&&a.parentNode.insertBefore(m.createTextNode(b),a.nextSibling);e(a);B||a.parentNode.removeChild(a)}}}}function e(a){function b(a,f){var c=f?a.cloneNode(!1):
|
26
|
+
a,h=a.parentNode;if(h){var h=b(h,1),d=a.nextSibling;h.appendChild(c);for(var i=d;i;i=d)d=i.nextSibling,h.appendChild(i)}return c}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),c;(c=a.parentNode)&&c.nodeType===1;)a=c;f.push(a)}for(var k=/(?:^|\s)nocode(?:\s|$)/,r=/\r\n?|\n/,m=a.ownerDocument,p=m.createElement("li");a.firstChild;)p.appendChild(a.firstChild);for(var f=[p],n=0;n<f.length;++n)d(f[n]);b===(b|0)&&f[0].setAttribute("value",b);var v=m.createElement("ol");v.className=
|
27
|
+
"linenums";for(var b=Math.max(0,b-1|0)||0,n=0,o=f.length;n<o;++n)p=f[n],p.className="L"+(n+b)%10,p.firstChild||p.appendChild(m.createTextNode("\u00a0")),v.appendChild(p);a.appendChild(v)}function d(a,b){for(var c=b.length;--c>=0;){var d=b[c];J.hasOwnProperty(d)?F.console&&console.warn("cannot override language handler %s",d):J[d]=a}}function t(a,b){if(!a||!J.hasOwnProperty(a))a=/^\s*</.test(b)?"default-markup":"default-code";return J[a]}function D(a){var b=a.langExtension;try{var c=e(a.sourceNode,
|
28
|
+
a.pre),d=c.sourceCode;a.sourceCode=d;a.spans=c.spans;a.basePos=0;t(b,d)(a);var k=/\bMSIE\s(\d+)/.exec(navigator.userAgent),k=k&&+k[1]<=8,b=/\n/g,r=a.sourceCode,q=r.length,c=0,m=a.spans,p=m.length,d=0,f=a.decorations,n=f.length,v=0;f[n]=q;var o,i;for(i=o=0;i<n;)f[i]!==f[i+2]?(f[o++]=f[i++],f[o++]=f[i++]):i+=2;n=o;for(i=o=0;i<n;){for(var u=f[i],l=f[i+1],s=i+2;s+2<=n&&f[s+1]===l;)s+=2;f[o++]=u;f[o++]=l;i=s}f.length=o;var g=a.sourceNode,j;if(g)j=g.style.display,g.style.display="none";try{for(;d<p;){var h=
|
29
|
+
m[d+2]||q,E=f[v+2]||q,s=Math.min(h,E),C=m[d+1],K;if(C.nodeType!==1&&(K=r.substring(c,s))){k&&(K=K.replace(b,"\r"));C.nodeValue=K;var x=C.ownerDocument,w=x.createElement("span");w.className=f[v+1];var z=C.parentNode;z.replaceChild(w,C);w.appendChild(C);c<h&&(m[d+1]=C=x.createTextNode(r.substring(s,h)),z.insertBefore(C,w.nextSibling))}c=s;c>=h&&(d+=2);c>=E&&(v+=2)}}finally{if(g)g.style.display=j}}catch(y){F.console&&console.log(y&&y.stack?y.stack:y)}}var F=q,z=["break,continue,do,else,for,if,return,while"],
|
30
|
+
y=[[z,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],w=[y,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],
|
31
|
+
G=[y,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],O=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],y=[y,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],
|
32
|
+
P=[z,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],Q=[z,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],z=[z,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
|
33
|
+
L=/\S/,S=a({keywords:[w,O,y,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+P,Q,z],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),J={};d(S,["default-code"]);d(k([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",
|
34
|
+
/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);d(k([["pln",/^[\s]+/,null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],
|
35
|
+
["pun",/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);d(k([],[["atv",/^[\s\S]+/]]),["uq.val"]);d(a({keywords:w,hashComments:!0,cStyleComments:!0,types:R}),["c","cc","cpp","cxx","cyc","m"]);d(a({keywords:"null,true,false"}),["json"]);d(a({keywords:O,hashComments:!0,cStyleComments:!0,
|
36
|
+
verbatimStrings:!0,types:R}),["cs"]);d(a({keywords:G,cStyleComments:!0}),["java"]);d(a({keywords:z,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);d(a({keywords:P,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py"]);d(a({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl",
|
37
|
+
"pl","pm"]);d(a({keywords:Q,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);d(a({keywords:y,cStyleComments:!0,regexLiterals:!0}),["js"]);d(a({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);d(k([],[["str",/^[\s\S]+/]]),["regex"]);var T=F.PR={createSimpleLexer:k,
|
38
|
+
registerLangHandler:d,sourceDecorator:a,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:F.prettyPrintOne=function(a,b,c){var d=document.createElement("div");d.innerHTML="<pre>"+a+"</pre>";d=d.firstChild;c&&r(d,c,!0);D({langExtension:b,numberLines:c,sourceNode:d,pre:1});return d.innerHTML},prettyPrint:F.prettyPrint=
|
39
|
+
function(a){function b(){var s;for(var c=F.PR_SHOULD_USE_CONTINUATION?m.now()+250:Infinity;p<d.length&&m.now()<c;p++){var g=d[p],j=g.className;if(v.test(j)&&!o.test(j)){for(var h=!1,e=g.parentNode;e;e=e.parentNode)if(l.test(e.tagName)&&e.className&&v.test(e.className)){h=!0;break}if(!h){g.className+=" prettyprinted";var j=j.match(n),k;if(h=!j){for(var h=g,e=I,q=h.firstChild;q;q=q.nextSibling)var t=q.nodeType,e=t===1?e?h:q:t===3?L.test(q.nodeValue)?h:e:e;h=(k=e===h?I:e)&&u.test(k.tagName)}h&&(j=k.className.match(n));
|
40
|
+
j&&(j=j[1]);s=i.test(g.tagName)?1:(h=(h=g.currentStyle)?h.whiteSpace:document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(g,null).getPropertyValue("white-space"):0)&&"pre"===h.substring(0,3),h=s;(e=(e=g.className.match(/\blinenums\b(?::(\d+))?/))?e[1]&&e[1].length?+e[1]:!0:!1)&&r(g,e,h);f={langExtension:j,sourceNode:g,numberLines:e,pre:h};D(f)}}}p<d.length?setTimeout(b,250):a&&a()}for(var c=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),
|
41
|
+
document.getElementsByTagName("xmp")],d=[],e=0;e<c.length;++e)for(var k=0,q=c[e].length;k<q;++k)d.push(c[e][k]);var c=null,m=Date;m.now||(m={now:function(){return+new Date}});var p=0,f,n=/\blang(?:uage)?-([\w.]+)(?!\S)/,v=/\bprettyprint\b/,o=/\bprettyprinted\b/,i=/pre|xmp/i,u=/^code$/i,l=/^(?:pre|code|xmp)$/i;b()}};typeof define==="function"&&define.amd&&define("google-code-prettify",[],function(){return T})})()})(window,window.angular);angular.element(document).find("head").append('<style type="text/css">.com{color:#93a1a1;}.lit{color:#195f91;}.pun,.opn,.clo{color:#93a1a1;}.fun{color:#dc322f;}.str,.atv{color:#D14;}.kwd,.linenums .tag{color:#1e347b;}.typ,.atn,.dec,.var{color:teal;}.pln{color:#48484c;}.prettyprint{padding:8px;background-color:#f7f7f9;border:1px solid #e1e1e8;}.prettyprint.linenums{-webkit-box-shadow:inset 40px 0 0 #fbfbfc,inset 41px 0 0 #ececf0;-moz-box-shadow:inset 40px 0 0 #fbfbfc,inset 41px 0 0 #ececf0;box-shadow:inset 40px 0 0 #fbfbfc,inset 41px 0 0 #ececf0;}ol.linenums{margin:0 0 0 33px;}ol.linenums li{padding-left:12px;color:#bebec5;line-height:18px;text-shadow:0 1px 0 #fff;}</style>');
|