Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: chrome/common/extensions/docs/static/js/branch.js

Issue 15087006: Docserver: there is only one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: epic rebase Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 (function() {
6
7 function init() {
8 var branchChooser = document.getElementById('branch-chooser-popup');
9 Array.prototype.forEach.call(branchChooser.getElementsByTagName('button'),
10 function(button) {
11 button.addEventListener('click', function(event) {
12 choose(button.className);
13 event.stopPropagation();
14 });
15 });
16 }
17
18 function choose(branch) {
19 var currentBranch = window.bootstrap.branchInfo.current;
20 var path = window.location.pathname.split('/');
21 if (path[0] == '')
22 path = path.slice(1);
23 var index = path.indexOf(currentBranch);
24 if (index != -1)
25 path[index] = branch;
26 else
27 path.splice(0, 0, branch);
28 window.location.pathname = '/' + path.join('/');
29 }
30
31 init();
32
33 })()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/static/css/site.css ('k') | chrome/common/extensions/docs/static/js/platform_chooser.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698