├── LICENSE
├── README.md
├── dist
├── BitbucketDiffTree.crx
└── screenshot_1280x800.png
└── src
├── css
├── content.css
└── popup.css
├── icon128.png
├── icon16.png
├── icon48.png
├── images
└── vsizegrip.png
├── js
├── background.js
├── content.js
├── helpers
│ ├── hashingHelper.js
│ ├── htmlHelper.js
│ ├── localStorageHelper.js
│ ├── pullRequestHelper.js
│ └── treeHelper.js
├── models
│ ├── pullRequestModel.js
│ ├── settingsModel.js
│ └── treeNodeModel.js
├── namespaces.js
├── observers
│ ├── fileChangesObserver.js
│ └── newCommentObserver.js
└── popup.js
├── libs
├── jquery-resizable.js
├── jquery.md5.js
├── jquery.min.js
└── jstree
│ ├── 32px.png
│ ├── jstree.min.css
│ └── jstree.min.js
├── manifest.json
└── popup.html
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 minhdam
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Bitbucket Diff Tree
2 |
3 | Chrome extension to display diff tree for Bitbucket. It will bring the DiffTree back from Bitbucket Server to Bitbucket Cloud.
4 |
5 | 
6 |
7 | ## Version History
8 | ### v1.0.5:
9 | * Support showing code changes as a tree structure in the following pages:
10 | - Branches
11 | - Create pull request
12 | - View pull request
13 | * Allow enable diff tree extension permanently
14 |
15 | ### v1.0.6:
16 | * Allow minimizing the diff tree region
17 |
18 | ### v1.0.7:
19 | * Navigate to corresponding comment when clicking on the "new comment notification" area at the bottom right corner
20 | * Display diff tree when the viewer selects "ignore whitespace"
21 |
22 | ### v1.0.8:
23 | * Option to compact empty middle packages
24 | * Show diff tree on commits page
25 |
26 | ### v1.1:
27 | * Allow collapsing / expanding all folders
28 | * Fix for tab size and nasty css bug which breaks alignments
29 |
30 | ### v1.2:
31 | * Track files have been reviewed by clicking on the "..." icon on the left of the files
32 |
33 | ### v1.3:
34 | * Show new version indicator for Bitbucket Diff Tree
35 |
36 | ### v1.3.1:
37 | * Fix bug: Should navigate to the correct file based on the hash of the url (if any)
38 |
39 | ### v1.4:
40 | * Allow resizing the diff tree
41 |
42 | ### v1.5:
43 | * Allow searching files and folders in the diff tree
44 |
45 | ### v1.6:
46 | * Unset the "reviewed" status of a file if its contents changed
47 |
48 | ### v1.7
49 | * Allow filtering files by review, unreview and comment status
50 |
51 | ### v1.8.0
52 | * Grant "tabs" permission when needed to comply with Google Chrome "Use of permissions" policy
53 | https://developer.chrome.com/webstore/program_policies#permissions
54 |
55 | ## How to install
56 | - Chrome webstore: https://chrome.google.com/webstore/detail/bitbucket-diff-tree/pgpjdkejablgneeocagbncanfihkebpf
57 |
58 | ## How to set up on local for development
59 |
60 | - Open Chrome browser and access chrome extensions by chrome://extensions/
61 | - Make sure the __Developer mode__ checkbox is checked
62 | - Click on __Load unpacked extension...__ and point to the __src__ folder of this repo
63 | - Finish! You will see an __B__ icon added to the extension area
64 |
65 | ## How to run the extension on local
66 |
67 | - Open a pull request page on bitbucket
68 | - Click on __B__ icon to activate the diff tree extension
69 | - Enjoy!
70 |
--------------------------------------------------------------------------------
/dist/BitbucketDiffTree.crx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minhdam/BitbucketDiffTree/4f89efde4ea8cada380396c5f841eef048bc2a8b/dist/BitbucketDiffTree.crx
--------------------------------------------------------------------------------
/dist/screenshot_1280x800.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minhdam/BitbucketDiffTree/4f89efde4ea8cada380396c5f841eef048bc2a8b/dist/screenshot_1280x800.png
--------------------------------------------------------------------------------
/src/css/content.css:
--------------------------------------------------------------------------------
1 | #diffTreeWrapper {
2 | width: 100%;
3 | margin-top: 20px;
4 | }
5 |
6 | #diffTreeWrapper #diffTreeContainer {
7 | width: 30%;
8 | background-color: #ffffff;
9 | border-top: 1px solid #ccc;
10 | /*border-radius: 6px 0 0 6px; */
11 | }
12 |
13 | #diffTreeWrapper #diffTreeContainer.collapsed {
14 | width: 55px;
15 | }
16 |
17 | #diffTreeWrapper #treeDiff {
18 | height: 650px;
19 | overflow: auto;
20 | background-color: #f5f5f5;
21 | border-left: 1px solid #ccc;
22 | border-right: 1px solid #ccc;
23 | border-bottom: 1px solid #ccc;
24 | }
25 |
26 | #diffTreeWrapper #treeDiff .jstree-icon.jstree-themeicon {
27 | display: none;
28 | }
29 |
30 | #diffTreeWrapper treeDiff .isLeaf {
31 | font-style: normal;
32 | /*font-weight: bold;*/
33 | }
34 |
35 | #diffTreeWrapper #treeDiff .isLeaf.already-reviewed {
36 | font-weight: normal;
37 | }
38 |
39 | #diffTreeWrapper #treeDiff .count-badge {
40 | background: #f5f5f5;
41 | padding-left: 3px;
42 | }
43 |
44 | #diffTreeWrapper #treeDiff .jstree-anchor .count-badge .count {
45 | padding-left: 3px;
46 | }
47 |
48 | #diffTreeWrapper #treeDiff .jstree-anchor:hover .count-badge {
49 | background: rgb(231, 244, 249);
50 | }
51 |
52 | #diffTreeWrapper #treeDiff .jstree-anchor.jstree-clicked .count-badge {
53 | background: rgb(190, 235, 255);
54 | line-height: 20px;
55 | }
56 |
57 | #diffTreeWrapper #diffTreeContainer #treeEmpty {
58 | position:absolute;
59 | padding:10px;
60 | }
61 |
62 | #diffTreeWrapper #treeDiff .fileIcon {
63 | color: #4B6884;
64 | cursor: pointer;
65 | }
66 |
67 | #diffTreeWrapper #treeDiff li.isReviewed > a > span.fileIcon {
68 | color: #1D8832;
69 | }
70 |
71 | #diffTreeWrapper #treeDiff li.hasComment > a > span.fileIcon {
72 | color: #FDA428;
73 | }
74 |
75 | #diffTreeWrapper #treeDiff li.isReviewed > a > span.folderIcon {
76 | /* color: #1D8832 !important; */
77 | }
78 |
79 | #diffTreeWrapper #treeDiff li.isReviewed > a > span.folderIcon::before {
80 | content: "\f104";
81 | }
82 |
83 | #diffTreeWrapper #treeDiff li.isReviewed > a > span.fileIcon::before {
84 | content: "\f104";
85 | }
86 |
87 | #diffTreeWrapper #treeDiff .jstree-anchor {
88 | cursor: default;
89 | }
90 |
91 | #diffTreeWrapper .diff-tree-aside section.iterable-item.bb-udiff {
92 | margin-top: 0;
93 | }
94 |
95 | #diffTreeWrapper .diff-tree-aside .diff-container {
96 | margin-left: 0;
97 | padding-left: 0;
98 | }
99 |
100 | #diffTreeWrapper #diffTreeContainer .dt-actions {
101 | height: 40px;
102 | background-color: #f5f5f5;
103 | border-bottom: 1px solid #ccc;
104 | border-left: 1px solid #ccc;
105 | border-right: 1px solid #ccc;
106 | display: flex;
107 | flex-direction: row-reverse;
108 | }
109 |
110 | #diffTreeWrapper #diffTreeContainer .dt-actions .dt-action-group {
111 | border-left: 1px solid #ccc;
112 | padding: 0 5px;
113 | display: inline-block;
114 | float: right;
115 | }
116 |
117 | #diffTreeWrapper #diffTreeContainer .dt-actions .dt-action-group:last-child {
118 | border-left: none;
119 | }
120 |
121 | #diffTreeWrapper #diffTreeContainer .dt-actions .dt-action-item {
122 | width: 20px;
123 | line-height: 40px;
124 | color: #707070;
125 | display: inline-block;
126 | }
127 |
128 | #diffTreeWrapper #diffTreeContainer .dt-actions .dt-action-item:focus {
129 | outline: 0px solid #4C9AFF;
130 | }
131 |
132 | #diffTreeWrapper #diffTreeContainer .dt-actions .dt-action-item.selected {
133 | color: blue;
134 | }
135 |
136 | #diffTreeWrapper #diffTreeContainer .dt-actions #btnCompactEmptyFoldersToggle.dt-action-item {
137 |
138 | }
139 |
140 | #diffTreeWrapper #diffTreeContainer .dt-actions #btnCompactEmptyFoldersToggle.dt-action-item .aui-icon:before {
141 | font-size: 14px;
142 | font-weight: bold;
143 | }
144 |
145 | #diffTreeWrapper #diffTreeContainer .dt-actions .dt-action-item .aui-icon:before {
146 | font-size: 16px;
147 | }
148 |
149 | #diffTreeWrapper #diffTreeContainer #newVersionIndicator span.aui-icon:before {
150 | font-size: 14px;
151 | }
152 |
153 | #diffTreeWrapper #compare {
154 | /* tab-size: 4; */
155 | }
156 |
157 | #diffTreeWrapper #compare .refract-container .addition pre.source ins,
158 | #diffTreeWrapper #compare .refract-container .deletion pre.source del {
159 | display: inline !important;
160 | }
161 |
162 | #diffTreeWrapper #changeset-diff {
163 | margin-top: 0px !important;
164 | }
165 |
166 | /* Resizable panels */
167 | #diffTreeWrapper {
168 | display: flex;
169 | flex-direction: row;
170 | overflow: hidden;
171 |
172 | /* avoid browser level touch actions */
173 | xtouch-action: none;
174 | }
175 |
176 | #diffTreeWrapper #diffTreeContainer {
177 | flex: 0 0 auto;
178 | width: 400px;
179 | min-height: 200px;
180 | min-width: 200px;
181 | max-width: 50%;
182 | white-space: nowrap;
183 | }
184 |
185 | #diffTreeWrapper .splitter {
186 | flex: 0 0 auto;
187 | width: 10px;
188 | background: url('https://raw.githubusercontent.com/RickStrahl/jquery-resizable/master/assets/vsizegrip.png') center center no-repeat #ffffff;
189 | min-height: 200px;
190 | cursor: col-resize;
191 | }
192 |
193 | #diffTreeWrapper .splitter-horizontal {
194 | flex: 0 0 auto;
195 | height: 10px;
196 | background: url(https://raw.githubusercontent.com/RickStrahl/jquery-resizable/master/assets/hsizegrip.png) center center no-repeat #ccc;
197 | cursor: row-resize;
198 | }
199 |
200 | #diffTreeWrapper #treeDiff {
201 | flex: 0 0 auto;
202 | /* only manually resize */
203 | min-height: 200px;
204 | white-space: nowrap;
205 | }
206 |
207 | #diffTreeWrapper .splitter:hover,
208 | #diffTreeWrapper .splitter-horizontal:hover {
209 | background-color: #ccc;
210 | }
211 |
212 | #diffTreeWrapper .diff-tree-aside {
213 | flex: 1 1 auto;
214 | width: 100%;
215 | min-height: 200px;
216 | min-width: 200px;
217 | padding-left: 0 !important;
218 | }
219 |
220 | #diffTreeWrapper .bb-udiff .heading {
221 | border-top-left-radius: 0;
222 | }
223 |
224 | #diffTreeWrapper .diff-content-container {
225 | border-bottom-left-radius: 0;
226 | }
227 |
228 | #diffTreeWrapper .searchBox {
229 | padding-right: 10px;
230 | margin-top: -4px;
231 | width: 100%;
232 | }
233 |
234 | #diffTreeWrapper .searchBox #searchBox {
235 | width: 100%;
236 | position: relative;
237 | padding-right: 15px;
238 | }
239 |
240 | #diffTreeWrapper .searchBox .aui-icon {
241 | margin-left: -18px;
242 | }
243 | /* END - Resizable panels */
--------------------------------------------------------------------------------
/src/css/popup.css:
--------------------------------------------------------------------------------
1 | body { font-family: arial, Verdana, sans-serif; font-size: 12px; width: auto; overflow: visible; margin: 0; padding: 0; }
2 |
3 | .menu-item {
4 | white-space: nowrap;
5 | line-height: 26px;
6 | cursor: pointer;
7 | border: 1px solid #fff;
8 | border-radius: 3px;
9 | padding: 0 6px;
10 | padding-right: 25px;
11 | -webkit-user-select: none;
12 | user-select: none;
13 | }
14 | .menu-item:hover {
15 | border: 1px solid #c4cdd3;
16 | background-image: -webkit-linear-gradient(top, rgb(255,255,255) 0%,rgb(227,235,242) 50%,rgb(230,240,248) 100%);
17 | }
18 |
19 | .menu-item.noicon { padding-right: 6px; }
20 | .menu-item.noicon .menu-item-text { padding-left: 0; }
21 |
22 | .menu-item.disabled { color: #999; }
23 | .menu-item.disabled:hover { border: 1px solid #e8e8e8; background-image: -webkit-linear-gradient(top, rgb(255,255,255) 0%,rgb(250,250,250) 50%,rgb(252,252,252) 100%); }
24 |
25 | .menu-separator { width: 100%; border-top: 1px solid #ddd; margin: 5px 0; }
26 |
27 | .menu-item-text {
28 | display: inline-block;
29 | height: 26px;
30 | line-height: 26px;
31 | padding-left: 26px;
32 | background-position: left center;
33 | background-repeat: no-repeat;
34 | }
--------------------------------------------------------------------------------
/src/icon128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minhdam/BitbucketDiffTree/4f89efde4ea8cada380396c5f841eef048bc2a8b/src/icon128.png
--------------------------------------------------------------------------------
/src/icon16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minhdam/BitbucketDiffTree/4f89efde4ea8cada380396c5f841eef048bc2a8b/src/icon16.png
--------------------------------------------------------------------------------
/src/icon48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minhdam/BitbucketDiffTree/4f89efde4ea8cada380396c5f841eef048bc2a8b/src/icon48.png
--------------------------------------------------------------------------------
/src/images/vsizegrip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minhdam/BitbucketDiffTree/4f89efde4ea8cada380396c5f841eef048bc2a8b/src/images/vsizegrip.png
--------------------------------------------------------------------------------
/src/js/background.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/js/content.js:
--------------------------------------------------------------------------------
1 | (function (
2 | TreeNodeModel,
3 | PullRequestModel,
4 | HashingHelper,
5 | HtmlHelper,
6 | PullRequestHelper,
7 | LocalStorageHelper,
8 | TreeHelper,
9 | NewCommentObserver,
10 | FileChangesObserver) {
11 |
12 | 'use strict';
13 |
14 | // Declare variables
15 | var _$pullRequestDiff,
16 | _$pullRequestDiffCompare,
17 | _$pullRequestTabNavigation,
18 | _$commitFilesSummary,
19 | _$diffSections;
20 |
21 | var _$diffTreeWrapper,
22 | _$diffTreeContainer,
23 | _$treeDiff,
24 | _$treeEmpty;
25 |
26 | var _newCommentObserver = new NewCommentObserver(),
27 | _fileChangesObserver = new FileChangesObserver();
28 |
29 | var _interval;
30 |
31 | var _treeObject;
32 | var _treeHelper;
33 |
34 | var _oPullRequestModel = new PullRequestModel();
35 |
36 | /**
37 | * An object of
38 | * {
39 | * fileIdentifier1: { isReviewed: true },
40 | * fileIdentifier2: { isReviewed: false },
41 | * ...
42 | * }
43 | */
44 | var _oPullRequestFileStatuses;
45 |
46 | var diffTreeOptions = {
47 | bUseCompactMode: false,
48 | bShowFilesReviewed: false,
49 | bShowFilesUnreviewed: false,
50 | bShowFilesCommented: false,
51 | }
52 |
53 | var _manifestData = chrome.runtime.getManifest();
54 |
55 | // Get the settings
56 | var _settings = {};
57 | LocalStorageHelper.getAllSettings(function(settings) {
58 | _settings = settings;
59 |
60 | diffTreeOptions.bUseCompactMode = _settings.useCompactMode;
61 |
62 | if (canApplyDiffTree()) {
63 | tryToLoadDiffTreeTool();
64 | }
65 | });
66 |
67 | // Message handler
68 | chrome.runtime.onMessage.addListener(function(msg, sender, response) {
69 | if (msg.from === 'popup') {
70 | switch (msg.action) {
71 | case 'enableDiffTree':
72 | enableDiffTree();
73 | break;
74 | case 'disableDiffTree':
75 | disableDiffTree();
76 | break;
77 | }
78 | }
79 | });
80 |
81 | $(function() {
82 | _$pullRequestTabNavigation = $('#pullrequest-navigation, #compare-tabs');
83 | _oPullRequestModel = PullRequestHelper.getPullRequestMetadata();
84 | bindEvents();
85 | });
86 |
87 | function init() {
88 | _$pullRequestDiff = $('#pullrequest #pullrequest-diff, #branch-detail #compare-diff-content, #commit, #create-pullrequest #diff, #update-pullrequest #diff, #branch-compare #compare-diff-content');
89 | _$pullRequestDiffCompare = $('#pullrequest #compare, #branch-detail #changeset-diff.main, #commit #changeset-diff.main, #create-pullrequest #changeset-diff.main, #update-pullrequest #changeset-diff.main, #branch-compare #changeset-diff.main');
90 | _$commitFilesSummary = _$pullRequestDiff.find('ul.commit-files-summary');
91 | _$diffSections = _$pullRequestDiff.find('section.iterable-item.bb-udiff');
92 | }
93 |
94 | function canApplyDiffTree() {
95 | return $('.diff').length > 0 // for pull request page
96 | || $('#compare-content').length > 0 // for create pull request page
97 | || $('#compare-tabs').length > 0 // for view branch page
98 | || $('#commit').length > 0; // for commit page
99 | }
100 |
101 | function tryToLoadDiffTreeTool() {
102 | if (_settings.enableAlways) {
103 | _interval = setInterval(enableDiffTreeOnLoad, 500);
104 | } else {
105 | _interval = setInterval(disableDiffTreeOnLoad, 500);
106 | }
107 |
108 | // Force clear the _interval after 20 seconds to prevent infinite running
109 | setTimeout(function() {
110 | clearInterval(_interval);
111 | }, 20000);
112 | }
113 |
114 | function enableDiffTreeOnLoad() {
115 | if ($('ul.commit-files-summary').length > 0) {
116 | enableDiffTree(true);
117 | clearInterval(_interval);
118 | }
119 | }
120 |
121 | function disableDiffTreeOnLoad() {
122 | if ($('ul.commit-files-summary').length > 0) {
123 | clearInterval(_interval);
124 | }
125 | }
126 |
127 | function enableDiffTree(bIsOnLoad) {
128 | bIsOnLoad = bIsOnLoad || false;
129 |
130 | if ($('#diffTreeContainer').length === 0) {
131 | init();
132 |
133 | _$commitFilesSummary.hide();
134 | _$diffSections.hide();
135 |
136 | buildDiffTreeAsync(diffTreeOptions, function() {
137 | bindDiffTreeEvents();
138 | showNewVersionIndicator();
139 | navigateToNodeInHash();
140 |
141 | if (!bIsOnLoad) {
142 | scrollToPullRequestSection();
143 | }
144 | });
145 | } else if (!bIsOnLoad) {
146 | scrollToPullRequestSection();
147 | }
148 |
149 | _newCommentObserver.startObserving(newCommentAdded);
150 | _fileChangesObserver.startObserving(enableDiffTree);
151 | }
152 |
153 | function disableDiffTree() {
154 | init();
155 | _$commitFilesSummary.show();
156 | _$diffSections.show();
157 | _$pullRequestDiff.append(_$pullRequestDiffCompare);
158 | _$diffTreeWrapper.remove();
159 | _$diffTreeContainer.remove();
160 | _$pullRequestDiffCompare.removeClass('diff-tree-aside');
161 |
162 | _newCommentObserver.stopObserving();
163 | _fileChangesObserver.stopObserving();
164 | }
165 |
166 | function bindEvents() {
167 | // when user change to "Overview" tab, the code changes is re-loaded, so we need to re-initialize the diff tree
168 | _$pullRequestTabNavigation.off('click', '#pr-menu-diff, #compare-diff-tab');
169 | _$pullRequestTabNavigation.on('click', '#pr-menu-diff, #compare-diff-tab',
170 | function() {
171 | tryToLoadDiffTreeTool();
172 | });
173 | }
174 |
175 | function bindDiffTreeEvents() {
176 | $(document).off('click', '#btnRemoveDiffTree');
177 | $(document).on('click', '#btnRemoveDiffTree', function(e) {
178 | e.preventDefault();
179 | disableDiffTree();
180 | });
181 |
182 | $(document).off('click', '#btnMinimizeDiffTree');
183 | $(document).on('click', '#btnMinimizeDiffTree', function(e) {
184 | e.preventDefault();
185 | minimizeDiffTree();
186 | });
187 |
188 | $(document).off('click', '#btnCompactEmptyFoldersToggle');
189 | $(document).on('click', '#btnCompactEmptyFoldersToggle', function(e) {
190 | e.preventDefault();
191 | compactEmptyFoldersToggle();
192 | });
193 |
194 | $(document).off('click', '#btnCollapseAllFolders');
195 | $(document).on('click', '#btnCollapseAllFolders', function(e) {
196 | e.preventDefault();
197 | collapseAllFolders();
198 | });
199 |
200 | $(document).off('click', '#btnExpandAllFolders');
201 | $(document).on('click', '#btnExpandAllFolders', function(e) {
202 | e.preventDefault();
203 | expandAllFolders();
204 | });
205 |
206 | $(document).off('click', '#btnShowFilesReviewed');
207 | $(document).on('click', '#btnShowFilesReviewed', function(e) {
208 | e.preventDefault();
209 | showFilesReviewed();
210 | });
211 |
212 | $(document).off('click', '#btnShowFilesUnreviewed');
213 | $(document).on('click', '#btnShowFilesUnreviewed', function(e) {
214 | e.preventDefault();
215 | showFilesUnreviewed();
216 | });
217 |
218 | $(document).off('click', '#btnShowFilesCommented');
219 | $(document).on('click', '#btnShowFilesCommented', function(e) {
220 | e.preventDefault();
221 | showFilesCommented();
222 | });
223 |
224 | $(document).off('click', '.reviewed-checkbox');
225 | $(document).on('click', '.reviewed-checkbox', function(e) {
226 | e.preventDefault();
227 | markAsReviewed($(this));
228 | });
229 |
230 | $(document).off('click', '#newVersionIndicator');
231 | $(document).on('click', '#newVersionIndicator', function(e) {
232 | markAsAwarenessOfNewVersion();
233 | });
234 |
235 | $(document).off('keyup', '#searchBox');
236 | $(document).on('keyup', '#searchBox', function(e) {
237 | var searchText = $(this).val();
238 | _$treeDiff.jstree('search', searchText);
239 | filterNodes(diffTreeOptions);
240 | });
241 |
242 | $(document).off('click', '#clearSearch');
243 | $(document).on('click', '#clearSearch', function(e) {
244 | _$treeDiff.jstree('clear_search');
245 | $('#searchBox').val('').focus();
246 | });
247 |
248 | $(document).off('click', '#clearFilter');
249 | $(document).on('click', '#clearFilter', function(e) {
250 | e.preventDefault();
251 | clearFilter();
252 | })
253 | }
254 |
255 | function minimizeDiffTree() {
256 | _$diffTreeContainer.toggleClass('expanded collapsed');
257 | _$pullRequestDiffCompare.toggleClass('expanded collapsed');
258 |
259 | $('#btnMinimizeDiffTree')
260 | .find('span.aui-icon')
261 | .toggleClass('aui-iconfont-arrows-left aui-iconfont-arrows-right');
262 |
263 | $('.dt-main-actions').toggleClass('hidden');
264 | }
265 |
266 | function compactEmptyFoldersToggle() {
267 | var useCompactMode = _settings.useCompactMode || false;
268 | useCompactMode = !useCompactMode;
269 |
270 | diffTreeOptions.bUseCompactMode = useCompactMode;
271 |
272 | buildDiffTreeAsync(diffTreeOptions);
273 | saveCompactModeSetting(useCompactMode);
274 |
275 | var title = useCompactMode ? 'Uncompact empty folders' : 'Compact empty folders';
276 |
277 | $('#btnCompactEmptyFoldersToggle')
278 | .find('span.aui-icon')
279 | .toggleClass('aui-iconfont-unfocus aui-iconfont-focus')
280 | .attr('title', title);
281 | }
282 |
283 | function expandAllFolders() {
284 | _treeHelper.expandAllNodes();
285 | }
286 |
287 | function collapseAllFolders() {
288 | _treeHelper.collapseAllNodes();
289 | }
290 |
291 | function saveCompactModeSetting(useCompactMode) {
292 | LocalStorageHelper.setUseCompactModeSetting(useCompactMode);
293 | _settings.useCompactMode = useCompactMode;
294 | }
295 |
296 | function getContentHash(sFileIdentifier) {
297 | var sDiffContentParentSelector = '.bb-udiff[data-identifier="' + sFileIdentifier + '"]'
298 | var sDiffContent = $(sDiffContentParentSelector).find('.udiff-line:not(.common) .source').toArray().map(d => d.textContent).join('\n');
299 |
300 | return HashingHelper.getHash(sDiffContent);
301 | }
302 |
303 | function markAsReviewed($icon) {
304 | var $node = $icon.closest('li[role=treeitem]');
305 | var sFileIdentifier = $node.data('file-identifier').replace('#chg-', '');
306 | var bIsReviewed = !$node.hasClass('isReviewed');
307 |
308 | var sContentHash = undefined;
309 | if (bIsReviewed) {
310 | sContentHash = getContentHash(sFileIdentifier)
311 | }
312 |
313 | LocalStorageHelper.setPullRequestStatus(_oPullRequestModel, sFileIdentifier, bIsReviewed, sContentHash, function(data) {
314 | _oPullRequestFileStatuses = data;
315 | updateFileReviewStatus($node, bIsReviewed);
316 | updateParentFoldersReviewStatus($node);
317 | });
318 | }
319 |
320 | function updateFileReviewStatus($node, bIsReviewed) {
321 | var $icon = $node.find('.fileIcon');
322 | var title = HtmlHelper.getMarkAsReviewedCheckboxTitle(bIsReviewed);
323 | setNodeReviewStatus($node, bIsReviewed);
324 | $icon.attr('title', title);
325 | }
326 |
327 | function markAsAwarenessOfNewVersion() {
328 | LocalStorageHelper.setVersionSetting(_manifestData.version);
329 | }
330 |
331 | function bindJsTreeEvents() {
332 | _$treeDiff.on('after_open.jstree',
333 | function(event, data) {
334 | $('#' + data.node.id)
335 | .find('> a .jstree-node-icon')
336 | .removeClass('aui-iconfont-devtools-folder-closed')
337 | .addClass('aui-iconfont-devtools-folder-open');
338 | });
339 |
340 | _$treeDiff.on('after_close.jstree',
341 | function(event, data) {
342 | $('#' + data.node.id)
343 | .find('> a .jstree-node-icon')
344 | .removeClass('aui-iconfont-devtools-folder-open')
345 | .addClass('aui-iconfont-devtools-folder-closed');
346 | });
347 |
348 | _$treeDiff.on('select_node.jstree',
349 | function(event, data) {
350 | var $node = $('#' + data.node.id);
351 | var fileIdentifier = $node.data('file-identifier');
352 | if (fileIdentifier) {
353 | // Hide the current section
354 | _$diffSections.hide();
355 |
356 | // Show the selected section
357 | var sectionId = decodeURIComponent(fileIdentifier.replace('#', ''));
358 | var $section = $('section[id*="' + sectionId + '"]');
359 | $section.show();
360 |
361 | // Set the treeDiff height based on the height of the selected section
362 | var height = Math.max($section.height() - 100, 650);
363 | //_$treeDiff.height(height);
364 |
365 | // Set the url hash for the selected file
366 | //window.location.hash = fileIdentifier;
367 | } else {
368 | // Open/close the selected folder
369 | _treeHelper.toggleNode(data.node);
370 | }
371 | });
372 |
373 | _$treeDiff.on('open_node.jstree', onOpenNode);
374 | }
375 |
376 | function onOpenNode(event, data) {
377 | var queueChildNodeIds = [];
378 |
379 | data.node.children.forEach(function(nodeId) {
380 | queueChildNodeIds.push(nodeId);
381 | });
382 |
383 | while (queueChildNodeIds.length) {
384 | var childNodeId = queueChildNodeIds.shift();
385 | var $childNode = $('#' + childNodeId);
386 | var bIsReviewed = getNodeReviewStatus($childNode);
387 | updateFileReviewStatus($childNode, bIsReviewed);
388 |
389 | var oChildNode = _treeHelper.getNode(childNodeId);
390 | oChildNode.children.forEach(function(nodeId) {
391 | queueChildNodeIds.push(nodeId);
392 | });
393 | }
394 | }
395 |
396 | function buildDiffTreeAsync(options, fnCallback) {
397 | LocalStorageHelper.getPullRequestStatus(_oPullRequestModel, function(data) {
398 | _oPullRequestFileStatuses = data;
399 | _treeObject = populateDiffTreeObject();
400 |
401 | if (options.bUseCompactMode) {
402 | _treeObject = compactEmptyFoldersDiffTreeObject(_treeObject);
403 | }
404 |
405 | attachDiffTreeHtml(_treeObject, options);
406 | initializeJsTree();
407 | bindJsTreeEvents();
408 | updateReviewStatusesForAllNodes();
409 | filterNodes(options);
410 |
411 | if (fnCallback) {
412 | fnCallback();
413 | }
414 | });
415 | }
416 |
417 | function populateDiffTreeObject() {
418 | var treeObject = new TreeNodeModel('root', 0);
419 |
420 | _$commitFilesSummary
421 | .find('li.iterable-item')
422 | .each(function() {
423 | var $self = $(this);
424 | var fileName = $self.data('file-identifier');
425 | var link = $self.find('a').attr('href');
426 | var folders = fileName.split('/');
427 | var maxLevel = folders.length;
428 | var tempObject = treeObject;
429 |
430 | folders.forEach(function(folder, index) {
431 | var item = tempObject.children[folder];
432 |
433 | if (!item) {
434 | item = tempObject.children[folder] = new TreeNodeModel(decodeURI(folder), index + 1);
435 |
436 | if (index === maxLevel - 1) {
437 | tempObject.data.fileCount++;
438 | } else {
439 | tempObject.data.folderCount++;
440 | }
441 | }
442 |
443 | // Leaf node which contains file name
444 | if (index === maxLevel - 1) {
445 | var bIsReviewed = _oPullRequestFileStatuses[fileName] !== undefined && _oPullRequestFileStatuses[fileName].isReviewed;
446 | if (bIsReviewed) {
447 | // if the file has been marked as reviewed, check whether its contents have actually changed.
448 | var reviewedHash = _oPullRequestFileStatuses[fileName] !== undefined && _oPullRequestFileStatuses[fileName].contentHash;
449 | var currentContentHash = getContentHash(fileName)
450 |
451 | if (reviewedHash !== currentContentHash) {
452 | // the content hash is different. This means that the file has actually
453 | // changed since it was last reviewed, so we unset the "reviewed" status.
454 | bIsReviewed = false;
455 | }
456 | }
457 |
458 | item.data.isLeaf = true;
459 | item.data.link = link;
460 | item.data.fileStatus = getFileStatus($self);
461 | item.data.commentCount = getFileCommentCount($self);
462 | item.data.isReviewed = bIsReviewed;
463 | }
464 |
465 | tempObject = tempObject.children[folder];
466 | });
467 | });
468 |
469 | //console.log(treeObject);
470 |
471 | return treeObject;
472 | }
473 |
474 | function compactEmptyFoldersDiffTreeObject(oTreeObject) {
475 | var compactTreeObject = oTreeObject.cloneDataOnly();
476 | compactTreeObject = compactEmptyFoldersRecursive(oTreeObject);
477 |
478 | return compactTreeObject;
479 | }
480 |
481 | function compactEmptyFoldersRecursive(oTreeNode) {
482 | var treeNodeResult = oTreeNode.cloneDataOnly();
483 | var parentNode = oTreeNode;
484 |
485 | if (oTreeNode.data.isLeaf) {
486 | return treeNodeResult;
487 | }
488 |
489 | if (oTreeNode.isRoot() === false &&
490 | oTreeNode.data.folderCount === 1 &&
491 | oTreeNode.data.fileCount === 0) {
492 |
493 | var compactNodeName = parentNode.data.name;
494 |
495 | while (parentNode.data.folderCount === 1 && parentNode.data.fileCount === 0) {
496 | var firstFolderObject = parentNode.getChildByIndex(0);
497 | compactNodeName += '/' + firstFolderObject.data.name;
498 | parentNode = firstFolderObject;
499 | }
500 |
501 | treeNodeResult.data.name = compactNodeName;
502 | }
503 |
504 | var children = parentNode.getChildrenAsArray();
505 | children.forEach(function(child, index) {
506 | treeNodeResult.children[child.data.name] = compactEmptyFoldersRecursive(child);
507 | });
508 |
509 | return treeNodeResult;
510 | }
511 |
512 | function attachDiffTreeHtml(oTreeObject, options) {
513 | // Remove the current tree diff if any to prevent duplicated
514 | _$pullRequestDiff.append(_$pullRequestDiffCompare);
515 | $('#diffTreeWrapper').remove();
516 |
517 | // Build diff tree html
518 | var diffTreeContainer = '
';
519 | diffTreeContainer += HtmlHelper.buildDiffTreeActionsPanelHtml(options);
520 |
521 | diffTreeContainer += '
';
522 | diffTreeContainer += '
';
523 | diffTreeContainer += HtmlHelper.buildTreeHtml(oTreeObject);
524 | diffTreeContainer += '
'; // end of #treeDiff
525 |
526 | diffTreeContainer += '
';
527 |
528 | diffTreeContainer += HtmlHelper.buildDiffTreeFooterPanelHtml();
529 |
530 | diffTreeContainer += '
'; // end of #difTreeContainer
531 |
532 | var $diffTreeWrapper = $('');
533 | _$pullRequestDiff.append($diffTreeWrapper);
534 | $diffTreeWrapper
535 | .append(diffTreeContainer)
536 | .append('')
537 | .append(_$pullRequestDiffCompare);
538 |
539 | _$pullRequestDiffCompare.addClass('diff-tree-aside');
540 | _$diffTreeWrapper = $('#diffTreeWrapper');
541 | _$diffTreeContainer = _$diffTreeWrapper.find('#diffTreeContainer');
542 | _$treeDiff = _$diffTreeWrapper.find('#treeDiff');
543 | _$treeEmpty = _$diffTreeWrapper.find('#treeEmpty');
544 |
545 | _treeHelper = new TreeHelper(_$treeDiff);
546 |
547 | if (_settings.diffTreeWidth) {
548 | _$diffTreeContainer.width(_settings.diffTreeWidth);
549 | }
550 |
551 | if (_settings.diffTreeHeight) {
552 | _$treeDiff.height(_settings.diffTreeHeight);
553 | }
554 |
555 | // Allow resizing the diff tree panel
556 | _$diffTreeContainer.resizable({
557 | handleSelector: ".splitter",
558 | resizeHeight: false,
559 | onDragEnd: function(e, $el, opt) {
560 | var width = _$diffTreeContainer.width();
561 | LocalStorageHelper.setDiffTreeWidth(width);
562 | _settings.diffTreeWidth = width;
563 | }
564 | });
565 |
566 | _$treeDiff.resizable({
567 | handleSelector: ".splitter-horizontal",
568 | resizeWidth: false,
569 | onDragEnd: function(e, $el, opt) {
570 | var height = _$treeDiff.height();
571 | LocalStorageHelper.setDiffTreeHeight(height);
572 | _settings.diffTreeHeight = height;
573 | }
574 | });
575 | }
576 |
577 | function initializeJsTree() {
578 | _$treeDiff.jstree({
579 | core: {
580 | multiple: false,
581 | dblclick_toggle: false
582 | },
583 |
584 | plugins: ["sort", "search"],
585 |
586 | sort: function(a, b) {
587 | var node1 = this.get_node(a);
588 | var node2 = this.get_node(b);
589 |
590 | //Put the folder first and then file
591 | if (node1.children.length > 0 && node2.children.length === 0) {
592 | return -1;
593 | } else if (node1.children.length === 0 && node2.children.length > 0) {
594 | return 1;
595 | }
596 |
597 | //Sort by name
598 | return node1.data.fileName.toLowerCase() > node2.data.fileName.toLowerCase() ? 1 : -1;
599 | },
600 |
601 | search: {
602 | show_only_matches: true,
603 | show_only_matches_children: true,
604 | },
605 | });
606 |
607 | // Expand all nodes
608 | expandAllFolders();
609 | }
610 |
611 | function showFirstFile() {
612 | var $firstFileNode = _$treeDiff.find('li.jstree-node.isLeaf:eq(0)');
613 | if ($firstFileNode.length > 0) {
614 | _treeHelper.selectNode($firstFileNode);
615 | }
616 | }
617 |
618 | function showNewVersionIndicator() {
619 | var $newVersionIndicator = $('#newVersionIndicator');
620 | var previousExtensionVersion = _settings.version;
621 | var currentExtenstionVersion = _manifestData.version;
622 | if (getMajorVersion(previousExtensionVersion) !== getMajorVersion(currentExtenstionVersion)) {
623 | $newVersionIndicator.removeClass('hidden');
624 | }
625 | }
626 |
627 | function getMajorVersion(version) {
628 | return version ? version.match(/\d+.\d+/g)[0] : '';
629 | }
630 |
631 | function scrollToPullRequestSection() {
632 | $('html, body')
633 | .animate({
634 | scrollTop: _$pullRequestDiff.offset().top
635 | }, 500);
636 | }
637 |
638 | function getFileStatus($iterableItem) {
639 | var fileStatus = null;
640 |
641 | if ($iterableItem.hasClass('file-added')) {
642 | fileStatus = 0;
643 | } else if ($iterableItem.hasClass('file-modified')) {
644 | fileStatus = 1;
645 | } else if ($iterableItem.hasClass('file-removed')) {
646 | fileStatus = 2;
647 | } else if ($iterableItem.hasClass('file-mergeconflict')) {
648 | fileStatus = 3;
649 | } else if ($iterableItem.hasClass('file-renamed')) {
650 | fileStatus = 4;
651 | }
652 |
653 | return fileStatus;
654 | }
655 |
656 | function getFileCommentCount($iterableItem) {
657 | var count = 0;
658 | var $countBadge = $iterableItem.find('.count-badge');
659 |
660 | if ($countBadge.length === 1) {
661 | count = parseInt($countBadge.find('.count').text());
662 | }
663 |
664 | return count;
665 | }
666 |
667 | function navigateToNodeInHash() {
668 | var hash = window.location.hash;
669 | showFirstFile();
670 |
671 | if (hash.indexOf('#chg-') === 0) { // file nagivation
672 | var $node = $('li[data-file-identifier*="' + hash + '"]');
673 | _treeHelper.selectNode($node);
674 | } else if (hash.indexOf('#comment-') === 0) { // comment navigation
675 | var $comment = $(hash);
676 | navigateToCommentNode($comment);
677 | }
678 | }
679 |
680 | function newCommentAdded(target, addedNode) {
681 | setTimeout(function () {
682 | var $addedNode = $(addedNode);
683 | if (!$addedNode.hasClass('comment')) {
684 | $addedNode = $addedNode.find('li.comment:first-child');
685 | }
686 |
687 | navigateToCommentNode($addedNode);
688 | }, 500);
689 | }
690 |
691 | function navigateToCommentNode($commentNode) {
692 | if ($commentNode.length === 0) return;
693 |
694 | // Select the file that contains the comment on diff tree
695 | var $section = $commentNode.closest('section.iterable-item.bb-udiff');
696 | var refUrl = $section.attr('id');
697 | var $treeNode = _$treeDiff.find('li.isLeaf[data-file-identifier*="' + refUrl + '"]');
698 |
699 | _treeHelper.deselectAllNodes();
700 | _treeHelper.selectNode($treeNode);
701 |
702 | scrollToCommentNode($commentNode);
703 | }
704 |
705 | function scrollToCommentNode($commentNode) {
706 | $commentNode = $($commentNode);
707 | if ($commentNode.length === 0) return;
708 |
709 | // Calculate the scroll offset
710 | var elOffset = $commentNode.offset().top;
711 | var elHeight = $commentNode.height();
712 | var windowHeight = $(window).height();
713 |
714 | var offset;
715 | if (elHeight < windowHeight) {
716 | offset = elOffset - ((windowHeight / 2) - (elHeight / 2));
717 | }
718 | else {
719 | offset = elOffset;
720 | }
721 |
722 | // Animate and highlight the new comment node
723 | $commentNode.attr('style', 'background-color: #f5f5f5');
724 | $('html, body').stop().animate({
725 | scrollTop: offset
726 | }, 500, function () {
727 | setTimeout(function () {
728 | $commentNode.removeAttr('style');
729 | }, 1000);
730 | });
731 | }
732 |
733 | function updateReviewStatusesForAllNodes() {
734 | var $rootNodes = _$treeDiff.find('.jstree-container-ul.jstree-children').children();
735 | $rootNodes.each(function() {
736 | updateReviewStatusesRecursive($(this));
737 | });
738 | }
739 |
740 | function updateReviewStatusesRecursive($node) {
741 | $node = $($node);
742 | if ($node.hasClass('isLeaf')) {
743 | return $node.hasClass('isReviewed');
744 | }
745 |
746 | var bIsReviewed = true;
747 | var $childNodes = $node.find('.jstree-children').children('.jstree-node');
748 | $childNodes.each(function() {
749 | var bIsChildReviewed = updateReviewStatusesRecursive($(this));
750 | bIsReviewed = bIsReviewed && bIsChildReviewed;
751 | });
752 |
753 | setNodeReviewStatus($node, bIsReviewed);
754 |
755 | return bIsReviewed;
756 | }
757 |
758 | function updateParentFoldersReviewStatus($node) {
759 | var $parent = $node.parent().closest('.jstree-node');
760 | while ($parent.length > 0) {
761 | var bIsReviewed = $parent.find('.jstree-children').children('.jstree-node').not('.isReviewed').length === 0;
762 | setNodeReviewStatus($parent, bIsReviewed);
763 |
764 | $parent = $parent.parent().closest('.jstree-node');
765 | }
766 | }
767 |
768 | function getNodeReviewStatus($node) {
769 | var treeNode = _treeHelper.getNode($node);
770 | return treeNode.data.isReviewed;
771 | }
772 |
773 | function setNodeReviewStatus($node, bIsReviewed) {
774 | $node.toggleClass('isReviewed', bIsReviewed);
775 | $node.attr('data-is-reviewed', bIsReviewed);
776 |
777 | var treeNode = _treeHelper.getNode($node);
778 | treeNode.data.isReviewed = bIsReviewed;
779 | }
780 |
781 | function showFilesReviewed() {
782 | $('#btnShowFilesReviewed').toggleClass('selected');
783 | $('#btnShowFilesUnreviewed').removeClass('selected');
784 | filter();
785 | }
786 |
787 | function showFilesUnreviewed() {
788 | $('#btnShowFilesUnreviewed').toggleClass('selected');
789 | $('#btnShowFilesReviewed').removeClass('selected');
790 | filter();
791 | }
792 |
793 | function showFilesCommented() {
794 | $('#btnShowFilesCommented').toggleClass('selected');
795 | filter();
796 | }
797 |
798 | function filter() {
799 | var isShowFilesReviewed = $('#btnShowFilesReviewed').hasClass('selected');
800 | var isShowFilesUnreviewed = $('#btnShowFilesUnreviewed').hasClass('selected');
801 | var isShowFilesCommented = $('#btnShowFilesCommented').hasClass('selected');
802 |
803 | diffTreeOptions.bShowFilesReviewed = isShowFilesReviewed;
804 | diffTreeOptions.bShowFilesUnreviewed = isShowFilesUnreviewed;
805 | diffTreeOptions.bShowFilesCommented = isShowFilesCommented;
806 |
807 | buildDiffTreeAsync(diffTreeOptions);
808 | }
809 |
810 | function filterNodes(options) {
811 | if (options.bShowFilesReviewed) {
812 | _treeHelper.hideNodes($('.jstree-node.isLeaf:not(.isReviewed)'));
813 | }
814 |
815 | if (options.bShowFilesUnreviewed) {
816 | _treeHelper.hideNodes($('.jstree-node.isReviewed'));
817 | }
818 |
819 | if (options.bShowFilesCommented) {
820 | _treeHelper.hideNodes($('.jstree-node.isLeaf:not(.hasComment)'));
821 | }
822 |
823 | if (options.bShowFilesReviewed || options.bShowFilesUnreviewed || options.bShowFilesCommented) {
824 | hideEmptyFolders(_$treeDiff);
825 | }
826 |
827 | var isTreeEmpty = _$treeDiff.find('.jstree-node:not(.jstree-hidden)').length === 0;
828 | _$treeEmpty.toggleClass('hidden', !isTreeEmpty);
829 | }
830 |
831 | function hideEmptyFolders($liTreeNode) {
832 | var $childNodes = $liTreeNode.find('> ul.jstree-children > li.jstree-node:not(.isLeaf)');
833 | $childNodes.each(function() {
834 | hideEmptyFolders($(this));
835 | });
836 |
837 | $liTreeNode = $('#' + $liTreeNode.attr('id')); // to reload the latest DOM status
838 | var $visibleChildNodes = $liTreeNode.find('> ul.jstree-children > li.jstree-node:not(.jstree-hidden)');
839 | if ($liTreeNode.hasClass('jstree-node') && $visibleChildNodes.length === 0) {
840 | _treeHelper.hideNodes($liTreeNode);
841 | }
842 | }
843 |
844 | function clearFilter() {
845 | diffTreeOptions.bShowFilesReviewed = false;
846 | diffTreeOptions.bShowFilesUnreviewed = false;
847 | diffTreeOptions.bShowFilesCommented = false;
848 | buildDiffTreeAsync(diffTreeOptions);
849 | }
850 |
851 | })(
852 | BDT.Models.TreeNodeModel,
853 | BDT.Models.PullRequestModel,
854 | BDT.Helpers.HashingHelper,
855 | BDT.Helpers.HtmlHelper,
856 | BDT.Helpers.PullRequestHelper,
857 | BDT.Helpers.LocalStorageHelper,
858 | BDT.Helpers.TreeHelper,
859 | BDT.DomObservers.NewCommentObserver,
860 | BDT.DomObservers.FileChangesObserver);
--------------------------------------------------------------------------------
/src/js/helpers/hashingHelper.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | 'use strict';
3 |
4 | var HashingHelper = {
5 |
6 | getHash: function(sContent) {
7 | return $.md5(sContent);
8 | }
9 |
10 | };
11 |
12 | // Export via namespace
13 | BDT.Helpers.HashingHelper = HashingHelper;
14 |
15 | })();
--------------------------------------------------------------------------------
/src/js/helpers/htmlHelper.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | 'use strict';
3 |
4 | var HtmlHelper = {
5 |
6 | buildTreeHtml: function(oTreeNodeObject) {
7 | var childItems = oTreeNodeObject.getChildrenAsArray();
8 |
9 | if (childItems.length === 0) {
10 | return '';
11 | }
12 |
13 | var treeHtml = '';
14 |
15 | childItems.forEach(function(childItem, index) {
16 | var data = childItem.data;
17 | var className = '';
18 | var content;
19 |
20 | if (data.isLeaf) {
21 | className += 'isLeaf ';
22 | }
23 |
24 | if (data.commentCount > 0) {
25 | className += 'hasComment ';
26 | }
27 |
28 | if (data.isReviewed) {
29 | className += 'isReviewed ';
30 | }
31 |
32 | treeHtml += '- ';
37 |
38 | if (data.isLeaf) {
39 | content =
40 | HtmlHelper.buildFileIconHtml(data.isReviewed) + ' ' +
41 | HtmlHelper.buildLozengeFileStatusHtml(data.fileStatus) + ' ' +
42 | data.name + ' ' +
43 | HtmlHelper.buildCommentCountBadgeHtml(data.commentCount);
44 |
45 | treeHtml += '' + content + '';
46 | } else {
47 | content =
48 | HtmlHelper.buildFolderOpenIconHtml() + ' ' +
49 | data.name;
50 |
51 | treeHtml += '' + content + '';
52 | }
53 |
54 | // Build child nodes recursively
55 | treeHtml += HtmlHelper.buildTreeHtml(childItem);
56 |
57 | treeHtml += '
';
58 | });
59 |
60 | treeHtml += '
';
61 |
62 | return treeHtml;
63 | },
64 |
65 | buildTreeAsSidebarHtml: function() {
66 |
67 | },
68 |
69 | /**
70 | * @param {object} options An object of
71 | * {
72 | * bUseCompactMode: bool,
73 | * bShowFilesReviewed: bool,
74 | * bShowFilesUnreviewed: bool,
75 | * bShowFilesCommented: bool,
76 | * }
77 | */
78 | buildDiffTreeActionsPanelHtml: function(options) {
79 | var defaultOptions = {
80 | bUseCompactMode: false,
81 | bShowFilesReviewed: false,
82 | bShowFilesUnreviewed: false,
83 | bShowFilesCommented: false,
84 | };
85 |
86 | options = $.extend({}, defaultOptions, options);
87 |
88 | var $html = $('' +
89 | '' +
90 | '
' +
93 | '
' +
98 | '
' +
99 | '
' +
100 | '
' +
101 | '' +
102 | '
' +
103 | '
' +
104 | '
' +
105 | '' +
106 | '' +
107 | '
' +
108 | '
' +
109 | '
');
110 |
111 | $html.find('#btnShowFilesReviewed').toggleClass('selected', options.bShowFilesReviewed);
112 | $html.find('#btnShowFilesUnreviewed').toggleClass('selected', options.bShowFilesUnreviewed);
113 | $html.find('#btnShowFilesCommented').toggleClass('selected', options.bShowFilesCommented);
114 |
115 | return $('').append($html).html();
116 | },
117 |
118 | buildDiffTreeFooterPanelHtml: function() {
119 | var manifestData = chrome.runtime.getManifest();
120 |
121 | return '';
129 | },
130 |
131 | buildLozengeFileStatusHtml: function(iFileStatus) {
132 | var sResult = '';
133 |
134 | switch (iFileStatus) {
135 | case 0: //file added
136 | sResult = 'A';
137 | break;
138 | case 1: //file modified
139 | sResult = 'M';
140 | break;
141 | case 2: //file deleted
142 | sResult = 'D';
143 | break;
144 | case 3: //file conflicted
145 | sResult = 'C';
146 | break;
147 | case 4: //file renamed
148 | sResult = 'R';
149 | break;
150 | }
151 |
152 | return sResult;
153 | },
154 |
155 | buildCommentCountBadgeHtml: function(iCount) {
156 | if (iCount && iCount > 0) {
157 | return '' +
158 | '' +
159 | '' +
160 | iCount +
161 | '' +
162 | '
';
163 | }
164 |
165 | return '';
166 | },
167 |
168 | buildFileIconHtml: function(bIsReviewed) {
169 | var title = HtmlHelper.getMarkAsReviewedCheckboxTitle(bIsReviewed);
170 | return 'File';
171 | },
172 |
173 | buildFolderOpenIconHtml: function() {
174 | return 'Folder open';
175 | },
176 |
177 | buildFolderCloseIconHtml: function() {
178 | return 'Folder closed';
179 | },
180 |
181 | getMarkAsReviewedCheckboxTitle: function(bIsReviewed) {
182 | return bIsReviewed ? 'Click to unmark as reviewed' : 'Click to mark as reviewed';
183 | }
184 | };
185 |
186 | // Export via namespace
187 | BDT.Helpers.HtmlHelper = HtmlHelper;
188 |
189 | })();
--------------------------------------------------------------------------------
/src/js/helpers/localStorageHelper.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | 'use strict';
3 |
4 | var LocalStorageHelper = {
5 |
6 | getAllSettings: function(fnCallback) {
7 | chrome.storage.local.get([
8 | 'enableAlways',
9 | 'useCompactMode',
10 | 'version',
11 | 'diffTreeWidth',
12 | 'diffTreeHeight'
13 | ], function(settings) {
14 | if (fnCallback) {
15 | fnCallback.call(this, settings);
16 | }
17 | });
18 | },
19 |
20 | setUseCompactModeSetting: function(bUseCompactMode, fnCallback) {
21 | chrome.storage.local.set({ 'useCompactMode': bUseCompactMode }, function() {
22 | if (fnCallback) {
23 | fnCallback.call(this);
24 | }
25 | });
26 | },
27 |
28 | setVersionSetting: function(version, fnCallback) {
29 | chrome.storage.local.set({ 'version': version }, function() {
30 | if (fnCallback) {
31 | fnCallback.call(this);
32 | }
33 | });
34 | },
35 |
36 | setDiffTreeWidth: function(diffTreeWidth, fnCallback) {
37 | chrome.storage.local.set({ 'diffTreeWidth': diffTreeWidth }, function() {
38 | if (fnCallback) {
39 | fnCallback.call(this);
40 | }
41 | });
42 | },
43 |
44 | setDiffTreeHeight: function(diffTreeHeight, fnCallback) {
45 | chrome.storage.local.set({ 'diffTreeHeight': diffTreeHeight }, function() {
46 | if (fnCallback) {
47 | fnCallback.call(this);
48 | }
49 | });
50 | },
51 |
52 | /**
53 | * Get the pull request status
54 | * Returns: An object of
55 | * {
56 | * fileIdentifier1: { isReviewed: true },
57 | * fileIdentifier2: { isReviewed: false },
58 | * ...
59 | * }
60 | */
61 | getPullRequestStatus: function(oPullRequestModel, fnCallback) {
62 | var key = 'userid_' + oPullRequestModel.userId
63 | + '_prid_' + oPullRequestModel.pullRequestId
64 | + '_repo_' + oPullRequestModel.repoFullSlug;
65 |
66 | chrome.storage.local.get(key, function(data) {
67 | /* data is a json object of
68 | {
69 | key: {
70 | fileIdentifier1: { isReviewed: true },
71 | fileIdentifier2: { isReviewed: false },
72 | ...
73 | }
74 | }
75 | */
76 |
77 | if (fnCallback) {
78 | fnCallback.call(this, data[key] || {});
79 | }
80 | });
81 | },
82 |
83 | setPullRequestStatus: function(oPullRequestModel, sFileIdentifier, bValue, sContentHash, fnCallback) {
84 | var key = 'userid_' + oPullRequestModel.userId
85 | + '_prid_' + oPullRequestModel.pullRequestId
86 | + '_repo_' + oPullRequestModel.repoFullSlug;
87 |
88 | //chrome.storage.local.remove(key);
89 |
90 | LocalStorageHelper.getPullRequestStatus(oPullRequestModel, function(oData) {
91 | if (!oData[sFileIdentifier]) {
92 | oData[sFileIdentifier] = { isReviewed: false };
93 | }
94 |
95 | oData[sFileIdentifier].isReviewed = bValue;
96 |
97 | if (sContentHash !== undefined) {
98 | // only save the hash if it was provided
99 | oData[sFileIdentifier].contentHash = sContentHash;
100 | }
101 |
102 | var obj = {};
103 | obj[key] = oData;
104 | chrome.storage.local.set(obj, function() {
105 | if (chrome.runtime.lastError)
106 | {
107 | /* error */
108 | console.log(chrome.runtime.lastError.message);
109 | return;
110 | }
111 |
112 | if (fnCallback) {
113 | fnCallback.call(this, oData);
114 | }
115 | });
116 | });
117 | }
118 | };
119 |
120 | // Export via namespace
121 | BDT.Helpers.LocalStorageHelper = LocalStorageHelper;
122 |
123 | })();
--------------------------------------------------------------------------------
/src/js/helpers/pullRequestHelper.js:
--------------------------------------------------------------------------------
1 | (function(PullRequestModel) {
2 | 'use strict';
3 |
4 | var PullRequestHelper = {
5 |
6 | getPullRequestMetadata: function() {
7 | var $body = $('body');
8 | var oCurrentUser = $body.data('current-user');
9 | var oCurrentRepo = $body.data('current-repo');
10 | var oCurrentPr = $body.data('current-pr');
11 |
12 | var pullRequestModel = new PullRequestModel();
13 |
14 | try {
15 | pullRequestModel.userId = oCurrentUser.uuid;
16 | pullRequestModel.pullRequestId = oCurrentPr.localId;
17 | pullRequestModel.repoFullSlug = oCurrentRepo.fullslug;
18 | } catch {
19 | }
20 |
21 | return pullRequestModel;
22 | },
23 |
24 | };
25 |
26 | // Export via namespace
27 | BDT.Helpers.PullRequestHelper = PullRequestHelper;
28 |
29 | })(BDT.Models.PullRequestModel);
--------------------------------------------------------------------------------
/src/js/helpers/treeHelper.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | 'use strict';
3 |
4 | var TreeHelper = function($treeContainer) {
5 | var _$treeContainer = $treeContainer;
6 |
7 | /**
8 | * Get a node id
9 | * @param {object} obj Node id or node DOM
10 | */
11 | function getNodeId(obj) {
12 | var nodeId;
13 |
14 | if (obj && obj instanceof jQuery) {
15 | nodeId = obj.attr('id');
16 | } else {
17 | nodeId = obj;
18 | }
19 |
20 | return nodeId;
21 | }
22 |
23 | /**
24 | * Get a node
25 | * @param {object} obj Node id or node DOM
26 | */
27 | function getNode(obj) {
28 | var nodeId = getNodeId(obj);
29 | return _$treeContainer.jstree(true).get_node(nodeId);
30 | }
31 |
32 | /**
33 | * Select a node
34 | * @param {object} obj Node id or node DOM
35 | */
36 | function selectNode(obj) {
37 | var nodeId = getNodeId(obj);
38 | //openParentNodes(nodeId);
39 | _$treeContainer.jstree(true).select_node(nodeId);
40 | }
41 |
42 | /**
43 | * Show an array of nodes
44 | * @param {object[]} objs An array of node ids or node DOMs
45 | */
46 | function showNodes(objs) {
47 | objs.each(function() {
48 | var node = getNode($(this));
49 | _$treeContainer.jstree(true).show_node(node);
50 | });
51 | }
52 |
53 | /**
54 | * Show all nodes
55 | */
56 | function showAllNodes() {
57 | _$treeContainer.jstree(true).show_all();
58 | // _$treeContainer.find('.jstree-node').removeClass('jstree-hidden jstree-leaf');
59 | // _$treeContainer.find('.jstree-node.isLeaf').addClass('jstree-leaf');
60 | }
61 |
62 | /**
63 | * Hide an array of nodes
64 | * @param {object[]} objs An array of node ids or node DOMs
65 | */
66 | function hideNodes(objs) {
67 | objs.each(function() {
68 | var node = getNode($(this));
69 | _$treeContainer.jstree(true).hide_node(node);
70 | });
71 | }
72 |
73 | /**
74 | * Hide all nodes
75 | */
76 | function hideAllNodes() {
77 | _$treeContainer.jstree(true).hide_all();
78 | }
79 |
80 | function openParentNodes(nodeId) {
81 | var parentNodeId = _$treeContainer.jstree(true).get_parent(nodeId);
82 | console.log('before: ' + parentNodeId);
83 | if (!parentNodeId || parentNodeId === '#') return;
84 | if (_$treeContainer.jstree(true).is_open(parentNodeId)) return;
85 |
86 | openParentNodes(parentNodeId);
87 | console.log('after: ' + parentNodeId);
88 | _$treeContainer.jstree(true).open_node(parentNodeId);
89 | }
90 |
91 | function deselectAllNodes() {
92 | _$treeContainer.jstree(true).deselect_all();
93 | }
94 |
95 | /**
96 | * Toggle a node
97 | * @param {object} obj Node id or node DOM
98 | */
99 | function toggleNode(obj) {
100 | var nodeId = getNodeId(obj);
101 | _$treeContainer.jstree(true).toggle_node(nodeId);
102 | }
103 |
104 | function expandAllNodes() {
105 | _$treeContainer.jstree('open_all');
106 | }
107 |
108 | function collapseAllNodes() {
109 | _$treeContainer.jstree('close_all');
110 | }
111 |
112 | function redraw() {
113 | _$treeContainer.jstree(true).redraw(true);
114 | }
115 |
116 | return {
117 | getNode: getNode,
118 | toggleNode: toggleNode,
119 | selectNode: selectNode,
120 | showNodes: showNodes,
121 | showAllNodes: showAllNodes,
122 | hideNodes: hideNodes,
123 | hideAllNodes: hideAllNodes,
124 | deselectAllNodes: deselectAllNodes,
125 | expandAllNodes: expandAllNodes,
126 | collapseAllNodes: collapseAllNodes,
127 | redraw: redraw,
128 | }
129 | }
130 |
131 | // Export via namespace
132 | BDT.Helpers.TreeHelper = TreeHelper;
133 |
134 | })();
--------------------------------------------------------------------------------
/src/js/models/pullRequestModel.js:
--------------------------------------------------------------------------------
1 | (function(){
2 | 'use trict';
3 |
4 | var PullRequestModel = function() {
5 | var _this = this;
6 |
7 | _this.userId = null;
8 | _this.pullRequestId = null;
9 | _this.repoFullSlug = null;
10 | }
11 |
12 | // Export via namespace
13 | BDT.Models.PullRequestModel = PullRequestModel;
14 |
15 | })();
--------------------------------------------------------------------------------
/src/js/models/settingsModel.js:
--------------------------------------------------------------------------------
1 | (function(){
2 | 'use trict';
3 |
4 | var SettingsModel = function() {
5 | var _this = this;
6 |
7 | _this.enableAlways = false;
8 | _this.useCompactMode = false;
9 | }
10 |
11 | // Export via namespace
12 | BDT.Models.SettingsModel = SettingsModel;
13 |
14 | })();
--------------------------------------------------------------------------------
/src/js/models/treeNodeModel.js:
--------------------------------------------------------------------------------
1 | (function(){
2 | 'use trict';
3 |
4 | var TreeNodeModel = function(name, level) {
5 | var _this = this;
6 |
7 | _this.children = {};
8 |
9 | _this.data = {
10 | name: name,
11 | level: level,
12 | isLeaf: false,
13 | link: null,
14 | folderCount: 0,
15 | fileCount: 0,
16 | fileStatus: null,
17 | commentCount: 0,
18 | isReviewed: false
19 | }
20 | }
21 |
22 | TreeNodeModel.prototype.isRoot = function() {
23 | var _this = this;
24 | return _this.data.level === 0;
25 | }
26 |
27 | TreeNodeModel.prototype.cloneDataOnly = function() {
28 | var _this = this;
29 | var newObject = new TreeNodeModel(_this.data.name, _this.data.level);
30 |
31 | newObject.data = {
32 | name: _this.data.name,
33 | level: _this.data.level,
34 | isLeaf: _this.data.isLeaf,
35 | link: _this.data.link,
36 | folderCount: _this.data.folderCount,
37 | fileCount: _this.data.fileCount,
38 | fileStatus: _this.data.fileStatus,
39 | commentCount: _this.data.commentCount,
40 | isReviewed: _this.data.isReviewed
41 | };
42 |
43 | return newObject;
44 | }
45 |
46 | TreeNodeModel.prototype.getChildByIndex = function(index) {
47 | var _this = this;
48 | var childrenNames = Object.keys(_this.children);
49 |
50 | if (index < 0 || index > childrenNames.length - 1) {
51 | return null;
52 | }
53 |
54 | return _this.children[childrenNames[index]];
55 | };
56 |
57 |
58 | TreeNodeModel.prototype.getChildrenAsArray = function() {
59 | var _this = this;
60 | var children = [];
61 | var childrenNames = Object.keys(_this.children);
62 |
63 | childrenNames.forEach(function(name, index) {
64 | children.push(_this.children[name]);
65 | });
66 |
67 | return children;
68 | }
69 |
70 | TreeNodeModel.prototype.getFoldersAsArray = function() {
71 | var _this = this;
72 | var folders = [];
73 | var childrenNames = Object.keys(_this.children);
74 |
75 | childrenNames.forEach(function(name, index) {
76 | if (_this.children[name].data.isLeaf === false) {
77 | folders.push(_this.children[name]);
78 | }
79 | });
80 |
81 | return folders;
82 | }
83 |
84 | TreeNodeModel.prototype.getFilesAsArray = function() {
85 | var _this = this;
86 | var files = [];
87 | var childrenNames = Object.keys(_this.children);
88 |
89 | childrenNames.forEach(function(name, index) {
90 | if (_this.children[name].data.isLeaf === true) {
91 | files.push(_this.children[name]);
92 | }
93 | });
94 |
95 | return files;
96 | }
97 |
98 | // Export via namespace
99 | BDT.Models.TreeNodeModel = TreeNodeModel;
100 |
101 | })();
--------------------------------------------------------------------------------
/src/js/namespaces.js:
--------------------------------------------------------------------------------
1 | // Declare namespaces
2 | var BDT = {};
3 | BDT.Models = {};
4 | BDT.Helpers = {};
5 | BDT.DomObservers = {};
--------------------------------------------------------------------------------
/src/js/observers/fileChangesObserver.js:
--------------------------------------------------------------------------------
1 | (function () {
2 | 'use strict';
3 |
4 | var FileChangesObserver = function () {
5 | var _this = this;
6 |
7 | _this.observer = null;
8 |
9 | // configuration of the observer
10 | _this.config = {
11 | //attributes: true,
12 | //characterData: true,
13 | childList: true
14 | };
15 |
16 | function startObserving(callback) {
17 | // select the target node
18 | var targets = document.querySelectorAll('#pr-tab-content');
19 |
20 | // create an observer instance
21 | _this.observer = new MutationObserver(function (mutations) {
22 | mutations.forEach(function (mutation) {
23 | if (mutation.type === 'childList') {
24 | if (mutation.addedNodes.length > 0) {
25 | //console.log(mutation);
26 | if (callback) {
27 | callback();
28 | }
29 | }
30 | }
31 | });
32 | });
33 |
34 | // pass in the target node, as well as the observer options
35 | targets.forEach(function (target) {
36 | _this.observer.observe(target, _this.config);
37 | });
38 | }
39 |
40 | function stopObserving() {
41 | if (_this.observer != null) {
42 | _this.observer.disconnect();
43 | }
44 | }
45 |
46 | // Expose public methods
47 | _this.startObserving = startObserving;
48 | _this.stopObserving = stopObserving;
49 | };
50 |
51 | // Export via namespace
52 | BDT.DomObservers.FileChangesObserver = FileChangesObserver;
53 |
54 | })();
--------------------------------------------------------------------------------
/src/js/observers/newCommentObserver.js:
--------------------------------------------------------------------------------
1 | (function () {
2 | 'use strict';
3 |
4 | var NewCommentObserver = function () {
5 | var _this = this;
6 |
7 | _this.observer = null;
8 |
9 | // configuration of the observer
10 | _this.config = {
11 | //attributes: true,
12 | //characterData: true,
13 | childList: true,
14 | subtree: true
15 | };
16 |
17 | function startObserving(callback) {
18 | // select the target node
19 | var targets = document.querySelectorAll('.diff-content-container.refract-container');
20 | var trackableTargets = [
21 | 'diff-content-container refract-container', // comment at file level
22 | 'refract-content-container', // comment level 1
23 | 'child-comments', // comment level 2
24 | 'child-comments iterable' // coment level 2+
25 | ];
26 |
27 | // create an observer instance
28 | _this.observer = new MutationObserver(function (mutations) {
29 | mutations.forEach(function (mutation) {
30 | //console.log(mutation);
31 | if (mutation.type === 'childList') {
32 | // observe when new comment added
33 | if (trackableTargets.indexOf(mutation.target.className.trim()) >= 0 && mutation.addedNodes.length > 0) {
34 | //console.log(mutation);
35 | if (callback) {
36 | callback(mutation.target, mutation.addedNodes[0]);
37 | }
38 | }
39 | }
40 | });
41 | });
42 |
43 | // pass in the target node, as well as the observer options
44 | targets.forEach(function (target) {
45 | _this.observer.observe(target, _this.config);
46 | });
47 | }
48 |
49 | function stopObserving() {
50 | if (_this.observer != null) {
51 | _this.observer.disconnect();
52 | }
53 | }
54 |
55 | // Expose public methods
56 | _this.startObserving = startObserving;
57 | _this.stopObserving = stopObserving;
58 | };
59 |
60 | // Export via namespace
61 | BDT.DomObservers.NewCommentObserver = NewCommentObserver;
62 |
63 | })();
--------------------------------------------------------------------------------
/src/js/popup.js:
--------------------------------------------------------------------------------
1 | (function () {
2 | 'use strict';
3 |
4 | document.addEventListener('DOMContentLoaded',
5 | function() {
6 | $('#btnEnable')
7 | .on('click',
8 | function() {
9 | enableDiffTree();
10 | });
11 |
12 | $('#btnEnableAlways')
13 | .on('click',
14 | function() {
15 | chrome.storage.local.set({ 'enableAlways': true },
16 | function() {
17 | enableDiffTree();
18 | });
19 | });
20 |
21 | $('#btnDisable')
22 | .on('click',
23 | function() {
24 | chrome.storage.local.set({ 'enableAlways': false },
25 | function() {
26 | disableDiffTree();
27 | });
28 | });
29 | });
30 |
31 | function enableDiffTree() {
32 | grantPermissions(function() {
33 | chrome.tabs.query(
34 | {
35 | active: true,
36 | currentWindow: true
37 | },
38 | function(tabs) {
39 | chrome.tabs.sendMessage(tabs[0].id, { from: 'popup', action: "enableDiffTree" });
40 |
41 | window.close();
42 | });
43 | });
44 | }
45 |
46 | function disableDiffTree() {
47 | grantPermissions(function() {
48 | chrome.tabs.query(
49 | {
50 | active: true,
51 | currentWindow: true
52 | },
53 | function(tabs) {
54 | chrome.tabs.sendMessage(tabs[0].id, { from: 'popup', action: "disableDiffTree" });
55 |
56 | window.close();
57 | });
58 | });
59 | }
60 |
61 | function grantPermissions(fnCallback) {
62 | // Permissions must be requested from inside a user gesture, like a button's
63 | // click handler.
64 | chrome.permissions.request({
65 | permissions: ['tabs'],
66 | origins: ['https://bitbucket.org/*']
67 | }, function(granted) {
68 | // The callback argument will be true if the user granted the permissions.
69 | if (granted) {
70 | fnCallback();
71 | } else {
72 | alert('Please grant "tabs" permission to use this chrome extension.');
73 | }
74 | });
75 | }
76 | })();
--------------------------------------------------------------------------------
/src/libs/jquery-resizable.js:
--------------------------------------------------------------------------------
1 | /*
2 | jquery-resizable
3 | Version 0.20 - 3/10/2017
4 | © 2015-2017 Rick Strahl, West Wind Technologies
5 | www.west-wind.com
6 | Licensed under MIT License
7 | */
8 | (function(factory, undefined) {
9 | if (typeof define === 'function' && define.amd) {
10 | // AMD
11 | define(['jquery'], factory);
12 | } else if (typeof module === 'object' && typeof module.exports === 'object') {
13 | // CommonJS
14 | module.exports = factory(require('jquery'));
15 | } else {
16 | // Global jQuery
17 | factory(jQuery);
18 | }
19 | }(function($, undefined) {
20 |
21 | function getHandle(selector, $el) {
22 | if (selector && selector.trim()[0] === ">") {
23 | selector = selector.trim().replace(/^>\s*/, "");
24 |
25 | return $el.find(selector);
26 | }
27 |
28 | return selector ? $(selector) : $el;
29 | }
30 |
31 | if ($.fn.resizable)
32 | return;
33 |
34 | $.fn.resizable = function fnResizable(options) {
35 | var opt = {
36 | // selector for handle that starts dragging
37 | handleSelector: null,
38 | // resize the width
39 | resizeWidth: true,
40 | // resize the height
41 | resizeHeight: true,
42 | // the side that the width resizing is relative to
43 | resizeWidthFrom: 'right',
44 | // the side that the height resizing is relative to
45 | resizeHeightFrom: 'bottom',
46 | // hook into start drag operation (event passed)
47 | onDragStart: null,
48 | // hook into stop drag operation (event passed)
49 | onDragEnd: null,
50 | // hook into each drag operation (event passed)
51 | onDrag: null,
52 | // disable touch-action on $handle
53 | // prevents browser level actions like forward back gestures
54 | touchActionNone: true
55 | };
56 | if (typeof options == "object") opt = $.extend(opt, options);
57 |
58 | return this.each(function () {
59 | var startPos, startTransition;
60 |
61 | var $el = $(this);
62 |
63 | var $handle = getHandle(opt.handleSelector, $el);
64 |
65 | if (opt.touchActionNone)
66 | $handle.css("touch-action", "none");
67 |
68 | $el.addClass("resizable");
69 | $handle.bind('mousedown.rsz touchstart.rsz', startDragging);
70 |
71 | function noop(e) {
72 | e.stopPropagation();
73 | e.preventDefault();
74 | };
75 |
76 | function startDragging(e) {
77 | // Prevent dragging a ghost image in HTML5 / Firefox and maybe others
78 | if ( e.preventDefault ) {
79 | e.preventDefault();
80 | }
81 |
82 | startPos = getMousePos(e);
83 | startPos.width = parseInt($el.width(), 10);
84 | startPos.height = parseInt($el.height(), 10);
85 |
86 | startTransition = $el.css("transition");
87 | $el.css("transition", "none");
88 |
89 | if (opt.onDragStart) {
90 | if (opt.onDragStart(e, $el, opt) === false)
91 | return;
92 | }
93 | opt.dragFunc = doDrag;
94 |
95 | $(document).bind('mousemove.rsz', opt.dragFunc);
96 | $(document).bind('mouseup.rsz', stopDragging);
97 | if (window.Touch || navigator.maxTouchPoints) {
98 | $(document).bind('touchmove.rsz', opt.dragFunc);
99 | $(document).bind('touchend.rsz', stopDragging);
100 | }
101 | $(document).bind('selectstart.rsz', noop); // disable selection
102 | }
103 |
104 | function doDrag(e) {
105 | var pos = getMousePos(e), newWidth, newHeight;
106 |
107 | if (opt.resizeWidthFrom === 'left')
108 | newWidth = startPos.width - pos.x + startPos.x;
109 | else
110 | newWidth = startPos.width + pos.x - startPos.x;
111 |
112 | if (opt.resizeHeightFrom === 'top')
113 | newHeight = startPos.height - pos.y + startPos.y;
114 | else
115 | newHeight = startPos.height + pos.y - startPos.y;
116 |
117 | if (!opt.onDrag || opt.onDrag(e, $el, newWidth, newHeight, opt) !== false) {
118 | if (opt.resizeHeight)
119 | $el.height(newHeight);
120 |
121 | if (opt.resizeWidth)
122 | $el.width(newWidth);
123 | }
124 | }
125 |
126 | function stopDragging(e) {
127 | e.stopPropagation();
128 | e.preventDefault();
129 |
130 | $(document).unbind('mousemove.rsz', opt.dragFunc);
131 | $(document).unbind('mouseup.rsz', stopDragging);
132 |
133 | if (window.Touch || navigator.maxTouchPoints) {
134 | $(document).unbind('touchmove.rsz', opt.dragFunc);
135 | $(document).unbind('touchend.rsz', stopDragging);
136 | }
137 | $(document).unbind('selectstart.rsz', noop);
138 |
139 | // reset changed values
140 | $el.css("transition", startTransition);
141 |
142 | if (opt.onDragEnd)
143 | opt.onDragEnd(e, $el, opt);
144 |
145 | return false;
146 | }
147 |
148 | function getMousePos(e) {
149 | var pos = { x: 0, y: 0, width: 0, height: 0 };
150 | if (typeof e.clientX === "number") {
151 | pos.x = e.clientX;
152 | pos.y = e.clientY;
153 | } else if (e.originalEvent.touches) {
154 | pos.x = e.originalEvent.touches[0].clientX;
155 | pos.y = e.originalEvent.touches[0].clientY;
156 | } else
157 | return null;
158 |
159 | return pos;
160 | }
161 | });
162 | };
163 | }));
--------------------------------------------------------------------------------
/src/libs/jquery.md5.js:
--------------------------------------------------------------------------------
1 | /* The file source can be found here: https://github.com/placemarker/jQuery-MD5/blob/b985fce4e8/jquery.md5.js */
2 | /*
3 | * jQuery MD5 Plugin 1.2.1
4 | * https://github.com/blueimp/jQuery-MD5
5 | *
6 | * Copyright 2010, Sebastian Tschan
7 | * https://blueimp.net
8 | *
9 | * Licensed under the MIT license:
10 | * http://creativecommons.org/licenses/MIT/
11 | *
12 | * Based on
13 | * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
14 | * Digest Algorithm, as defined in RFC 1321.
15 | * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
16 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
17 | * Distributed under the BSD License
18 | * See http://pajhome.org.uk/crypt/md5 for more info.
19 | */
20 |
21 | /*jslint bitwise: true */
22 | /*global unescape, jQuery */
23 |
24 | (function ($) {
25 | 'use strict';
26 |
27 | /*
28 | * Add integers, wrapping at 2^32. This uses 16-bit operations internally
29 | * to work around bugs in some JS interpreters.
30 | */
31 | function safe_add(x, y) {
32 | var lsw = (x & 0xFFFF) + (y & 0xFFFF),
33 | msw = (x >> 16) + (y >> 16) + (lsw >> 16);
34 | return (msw << 16) | (lsw & 0xFFFF);
35 | }
36 |
37 | /*
38 | * Bitwise rotate a 32-bit number to the left.
39 | */
40 | function bit_rol(num, cnt) {
41 | return (num << cnt) | (num >>> (32 - cnt));
42 | }
43 |
44 | /*
45 | * These functions implement the four basic operations the algorithm uses.
46 | */
47 | function md5_cmn(q, a, b, x, s, t) {
48 | return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
49 | }
50 | function md5_ff(a, b, c, d, x, s, t) {
51 | return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
52 | }
53 | function md5_gg(a, b, c, d, x, s, t) {
54 | return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
55 | }
56 | function md5_hh(a, b, c, d, x, s, t) {
57 | return md5_cmn(b ^ c ^ d, a, b, x, s, t);
58 | }
59 | function md5_ii(a, b, c, d, x, s, t) {
60 | return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
61 | }
62 |
63 | /*
64 | * Calculate the MD5 of an array of little-endian words, and a bit length.
65 | */
66 | function binl_md5(x, len) {
67 | /* append padding */
68 | x[len >> 5] |= 0x80 << ((len) % 32);
69 | x[(((len + 64) >>> 9) << 4) + 14] = len;
70 |
71 | var i, olda, oldb, oldc, oldd,
72 | a = 1732584193,
73 | b = -271733879,
74 | c = -1732584194,
75 | d = 271733878;
76 |
77 | for (i = 0; i < x.length; i += 16) {
78 | olda = a;
79 | oldb = b;
80 | oldc = c;
81 | oldd = d;
82 |
83 | a = md5_ff(a, b, c, d, x[i], 7, -680876936);
84 | d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
85 | c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
86 | b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
87 | a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
88 | d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
89 | c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
90 | b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
91 | a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
92 | d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
93 | c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
94 | b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
95 | a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
96 | d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
97 | c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
98 | b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
99 |
100 | a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
101 | d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
102 | c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
103 | b = md5_gg(b, c, d, a, x[i], 20, -373897302);
104 | a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
105 | d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
106 | c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
107 | b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
108 | a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
109 | d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
110 | c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
111 | b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
112 | a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
113 | d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
114 | c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
115 | b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
116 |
117 | a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
118 | d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
119 | c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
120 | b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
121 | a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
122 | d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
123 | c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
124 | b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
125 | a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
126 | d = md5_hh(d, a, b, c, x[i], 11, -358537222);
127 | c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
128 | b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
129 | a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
130 | d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
131 | c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
132 | b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
133 |
134 | a = md5_ii(a, b, c, d, x[i], 6, -198630844);
135 | d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
136 | c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
137 | b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
138 | a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
139 | d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
140 | c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
141 | b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
142 | a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
143 | d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
144 | c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
145 | b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
146 | a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
147 | d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
148 | c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
149 | b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
150 |
151 | a = safe_add(a, olda);
152 | b = safe_add(b, oldb);
153 | c = safe_add(c, oldc);
154 | d = safe_add(d, oldd);
155 | }
156 | return [a, b, c, d];
157 | }
158 |
159 | /*
160 | * Convert an array of little-endian words to a string
161 | */
162 | function binl2rstr(input) {
163 | var i,
164 | output = '';
165 | for (i = 0; i < input.length * 32; i += 8) {
166 | output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF);
167 | }
168 | return output;
169 | }
170 |
171 | /*
172 | * Convert a raw string to an array of little-endian words
173 | * Characters >255 have their high-byte silently ignored.
174 | */
175 | function rstr2binl(input) {
176 | var i,
177 | output = [];
178 | output[(input.length >> 2) - 1] = undefined;
179 | for (i = 0; i < output.length; i += 1) {
180 | output[i] = 0;
181 | }
182 | for (i = 0; i < input.length * 8; i += 8) {
183 | output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32);
184 | }
185 | return output;
186 | }
187 |
188 | /*
189 | * Calculate the MD5 of a raw string
190 | */
191 | function rstr_md5(s) {
192 | return binl2rstr(binl_md5(rstr2binl(s), s.length * 8));
193 | }
194 |
195 | /*
196 | * Calculate the HMAC-MD5, of a key and some data (raw strings)
197 | */
198 | function rstr_hmac_md5(key, data) {
199 | var i,
200 | bkey = rstr2binl(key),
201 | ipad = [],
202 | opad = [],
203 | hash;
204 | ipad[15] = opad[15] = undefined;
205 | if (bkey.length > 16) {
206 | bkey = binl_md5(bkey, key.length * 8);
207 | }
208 | for (i = 0; i < 16; i += 1) {
209 | ipad[i] = bkey[i] ^ 0x36363636;
210 | opad[i] = bkey[i] ^ 0x5C5C5C5C;
211 | }
212 | hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
213 | return binl2rstr(binl_md5(opad.concat(hash), 512 + 128));
214 | }
215 |
216 | /*
217 | * Convert a raw string to a hex string
218 | */
219 | function rstr2hex(input) {
220 | var hex_tab = '0123456789abcdef',
221 | output = '',
222 | x,
223 | i;
224 | for (i = 0; i < input.length; i += 1) {
225 | x = input.charCodeAt(i);
226 | output += hex_tab.charAt((x >>> 4) & 0x0F) +
227 | hex_tab.charAt(x & 0x0F);
228 | }
229 | return output;
230 | }
231 |
232 | /*
233 | * Encode a string as utf-8
234 | */
235 | function str2rstr_utf8(input) {
236 | return unescape(encodeURIComponent(input));
237 | }
238 |
239 | /*
240 | * Take string arguments and return either raw or hex encoded strings
241 | */
242 | function raw_md5(s) {
243 | return rstr_md5(str2rstr_utf8(s));
244 | }
245 | function hex_md5(s) {
246 | return rstr2hex(raw_md5(s));
247 | }
248 | function raw_hmac_md5(k, d) {
249 | return rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d));
250 | }
251 | function hex_hmac_md5(k, d) {
252 | return rstr2hex(raw_hmac_md5(k, d));
253 | }
254 |
255 | $.md5 = function (string, key, raw) {
256 | if (!key) {
257 | if (!raw) {
258 | return hex_md5(string);
259 | } else {
260 | return raw_md5(string);
261 | }
262 | }
263 | if (!raw) {
264 | return hex_hmac_md5(key, string);
265 | } else {
266 | return raw_hmac_md5(key, string);
267 | }
268 | };
269 |
270 | }(typeof jQuery === 'function' ? jQuery : this));
271 |
--------------------------------------------------------------------------------
/src/libs/jquery.min.js:
--------------------------------------------------------------------------------
1 | /*! jQuery v1.12.1 | (c) jQuery Foundation | jquery.org/license */
2 | !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="1.12.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(!l.ownFirst)for(b in a)return k.call(a,b);for(b in a);return void 0===b||k.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(h)return h.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=e.call(arguments,2),d=function(){return a.apply(b||this,c.concat(e.call(arguments)))},d.guid=a.guid=a.guid||n.guid++,d):void 0},now:function(){return+new Date},support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++)if(n.contains(d[b],this))return!0}));for(b=0;e>b;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}if(f=d.getElementById(e[2]),f&&f.parentNode){if(f.id!==e[2])return A.find(a);this.length=1,this[0]=f}return this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||(e=n.uniqueSort(e)),D.test(a)&&(e=e.reverse())),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=!0,c||j.disable(),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.addEventListener?(d.removeEventListener("DOMContentLoaded",K),a.removeEventListener("load",K)):(d.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(d.addEventListener||"load"===a.event.type||"complete"===d.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I)if(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll)a.setTimeout(n.ready);else if(d.addEventListener)d.addEventListener("DOMContentLoaded",K),a.addEventListener("load",K);else{d.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&d.documentElement}catch(e){}c&&c.doScroll&&!function f(){if(!n.isReady){try{c.doScroll("left")}catch(b){return a.setTimeout(f,50)}J(),n.ready()}}()}return I.promise(b)},n.ready.promise();var L;for(L in n(l))break;l.ownFirst="0"===L,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c,e;c=d.getElementsByTagName("body")[0],c&&c.style&&(b=d.createElement("div"),e=d.createElement("div"),e.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(e).appendChild(b),"undefined"!=typeof b.style.zoom&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",l.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(e))}),function(){var a=d.createElement("div");l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}a=null}();var M=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b},N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else c=void 0;
3 | }return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(M(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f}}function S(a,b,c){if(M(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=void 0)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},Z=/^(?:checkbox|radio)$/i,$=/<([\w:-]+)/,_=/^$|\/(?:java|ecma)script/i,aa=/^\s+/,ba="abbr|article|aside|audio|bdi|canvas|data|datalist|details|dialog|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|picture|progress|section|summary|template|time|video";function ca(a){var b=ba.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}!function(){var a=d.createElement("div"),b=d.createDocumentFragment(),c=d.createElement("input");a.innerHTML=" a",l.leadingWhitespace=3===a.firstChild.nodeType,l.tbody=!a.getElementsByTagName("tbody").length,l.htmlSerialize=!!a.getElementsByTagName("link").length,l.html5Clone="<:nav>"!==d.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,b.appendChild(c),l.appendChecked=c.checked,a.innerHTML="",l.noCloneChecked=!!a.cloneNode(!0).lastChild.defaultValue,b.appendChild(a),c=d.createElement("input"),c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),a.appendChild(c),l.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!!a.addEventListener,a[n.expando]=1,l.attributes=!a.getAttribute(n.expando)}();var da={option:[1,""],legend:[1,""],area:[1,""],param:[1,""],thead:[1,""],tr:[2,""],col:[2,""],td:[3,""],_default:l.htmlSerialize?[0,"",""]:[1,"X","
"]};da.optgroup=da.option,da.tbody=da.tfoot=da.colgroup=da.caption=da.thead,da.th=da.td;function ea(a,b){var c,d,e=0,f="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,ea(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function fa(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}var ga=/<|?\w+;/,ha=/r;r++)if(g=a[r],g||0===g)if("object"===n.type(g))n.merge(q,g.nodeType?[g]:g);else if(ga.test(g)){i=i||p.appendChild(b.createElement("div")),j=($.exec(g)||["",""])[1].toLowerCase(),m=da[j]||da._default,i.innerHTML=m[1]+n.htmlPrefilter(g)+m[2],f=m[0];while(f--)i=i.lastChild;if(!l.leadingWhitespace&&aa.test(g)&&q.push(b.createTextNode(aa.exec(g)[0])),!l.tbody){g="table"!==j||ha.test(g)?""!==m[1]||ha.test(g)?0:i:i.firstChild,f=g&&g.childNodes.length;while(f--)n.nodeName(k=g.childNodes[f],"tbody")&&!k.childNodes.length&&g.removeChild(k)}n.merge(q,i.childNodes),i.textContent="";while(i.firstChild)i.removeChild(i.firstChild);i=p.lastChild}else q.push(b.createTextNode(g));i&&p.removeChild(i),l.appendChecked||n.grep(ea(q,"input"),ia),r=0;while(g=q[r++])if(d&&n.inArray(g,d)>-1)e&&e.push(g);else if(h=n.contains(g.ownerDocument,g),i=ea(p.appendChild(g),"script"),h&&fa(i),c){f=0;while(g=i[f++])_.test(g.type||"")&&c.push(g)}return i=null,p}!function(){var b,c,e=d.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b]=c in a)||(e.setAttribute(c,"t"),l[b]=e.attributes[c].expando===!1);e=null}();var ka=/^(?:input|select|textarea)$/i,la=/^key/,ma=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,na=/^(?:focusinfocus|focusoutblur)$/,oa=/^([^.]*)(?:\.(.+)|)/;function pa(){return!0}function qa(){return!1}function ra(){try{return d.activeElement}catch(a){}}function sa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)sa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=qa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return"undefined"==typeof n||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(G)||[""],h=b.length;while(h--)f=oa.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=oa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(i=m=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!na.test(q+n.event.triggered)&&(q.indexOf(".")>-1&&(r=q.split("."),q=r.shift(),r.sort()),h=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=r.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:n.makeArray(c,[b]),l=n.event.special[q]||{},f||!l.trigger||l.trigger.apply(e,c)!==!1)){if(!f&&!l.noBubble&&!n.isWindow(e)){for(j=l.delegateType||q,na.test(j+q)||(i=i.parentNode);i;i=i.parentNode)p.push(i),m=i;m===(e.ownerDocument||d)&&p.push(m.defaultView||m.parentWindow||a)}o=0;while((i=p[o++])&&!b.isPropagationStopped())b.type=o>1?j:l.bindType||q,g=(n._data(i,"events")||{})[b.type]&&n._data(i,"handle"),g&&g.apply(i,c),g=h&&i[h],g&&g.apply&&M(i)&&(b.result=g.apply(i,c),b.result===!1&&b.preventDefault());if(b.type=q,!f&&!b.isDefaultPrevented()&&(!l._default||l._default.apply(p.pop(),c)===!1)&&M(e)&&h&&e[q]&&!n.isWindow(e)){m=e[h],m&&(e[h]=null),n.event.triggered=q;try{e[q]()}catch(s){}n.event.triggered=void 0,m&&(e[h]=m)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.rnamespace||a.rnamespace.test(g.namespace))&&(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]","i"),va=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,wa=/
7 |
8 |
9 |
10 |
11 |
14 |
15 |
18 |
19 |
20 |
21 |
24 |
25 |
26 |