1 // Copyright 2015 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.
6 /** Amount that each level of bookmarks is indented by (px). */
7 var BOOKMARK_INDENT
= 20;
10 is
: 'viewer-bookmark',
14 * A bookmark object, each containing a:
17 * - children (an array of bookmarks)
21 observer
: 'bookmarkChanged_'
26 observer
: 'depthChanged'
37 bookmarkChanged_: function() {
38 this.$.expand
.style
.visibility
=
39 this.bookmark
.children
.length
> 0 ? 'visible' : 'hidden';
42 depthChanged: function() {
43 this.childDepth
= this.depth
+ 1;
44 this.$.item
.style
.paddingLeft
= (this.depth
* BOOKMARK_INDENT
) + 'px';
48 if (this.bookmark
.hasOwnProperty('page'))
49 this.fire('change-page', {page
: this.bookmark
.page
});
52 toggleChildren: function(e
) {
53 this.childrenShown_
= !this.childrenShown_
;
54 if (this.childrenShown_
)
55 this.$.expand
.classList
.add('open');
57 this.$.expand
.classList
.remove('open');
58 e
.stopPropagation(); // Prevent the above onClick handler from firing.