This file is indexed.

/usr/share/mizuho/templates/topbar.js is in ruby-mizuho 0.9.20+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
Mizuho.initializeTopBar = $.proxy(function() {
	var $window = this.$window;
	var $document = this.$document;
	var self = this;
	var $topbar = $('#topbar');
	var $title = $('#header h1');
	var $currentSection = $('#current_section');
	var isMobileDevice = this.isMobileDevice();
	var timerId;
	
	// Create the floating table of contents used in the top bar.
	var $floattoc = $('<div id="floattoc"></div>').html($('#toc').html());
	$floattoc.find('#toctitle').remove();
	$floattoc.find('.comments').remove();
	$floattoc.css('visibility', 'hidden');
	$floattoc.insertAfter($topbar);
	var $floattoclinks = $floattoc.find('a');
	$floattoclinks.each(function() {
		// Firefox changes '#!' to '#%21' so change that back.
		var $this = $(this);
		var href = $this.attr('href');
		if (href.match(/^#%21/)) {
			$this.attr('href', href.replace(/^#%21/, '#!'));
		}
	});
	$floattoclinks.click(function(event) {
		self.internalLinkClicked(this, event);
	});
	
	// Callback for when the user clicks on the Table of Contents
	// button on the top bar.
	function showFloatingToc() {
		var scrollUpdateTimerId;
		
		function reposition() {
			if (isMobileDevice) {
				$floattoc.css({
					top: $currentSection.offset().top +
						$currentSection.innerHeight() +
						'px',
					height: $window.height() * 0.7 + 'px'
				});
			}
		}
		
		function highlightCurrentTocEntry() {
			var currentSubsection = self.currentSubsection();
			$floattoclinks.removeClass('current');
			if (currentSubsection) {
				var currentSubsectionTitle = $(currentSubsection).text();
				var $link;
				
				$floattoclinks.each(function() {
					if ($(this).text() == currentSubsectionTitle) {
						$link = $(this);
						return false;
					}
				});
				if ($link) {
					$link.addClass('current');
					self.setScrollTop(
						$floattoc.scrollTop() +
							$link.position().top -
							$floattoc.height() * 0.45,
						$floattoc);
					return false;
				}
			}
		}
		
		function hideFloatingToc() {
			$currentSection.removeClass('pressed');
			$floattoc.css('visibility', 'hidden');
			$floattoclinks.unbind('click', hideFloatingToc);
			$document.unbind('mousedown', onMouseDown);
			$document.unbind('touchdown', onMouseDown);
			$document.unbind('mizuho:hideTopBar', hideFloatingToc);
			$window.unbind('scroll', onScroll);
			if (scrollUpdateTimerId !== undefined) {
				clearTimeout(scrollUpdateTimerId);
				scrollUpdateTimerId = undefined;
			}
		}
		
		function onMouseDown(event) {
			if (event.target != $floattoc[0]
			 && $(event.target).closest('#floattoc').length == 0) {
				hideFloatingToc();
			}
		}
		
		function onScroll(event) {
			if (scrollUpdateTimerId === undefined) {
				scrollUpdateTimerId = setTimeout(function() {
					scrollUpdateTimerId = undefined;
					reposition();
					highlightCurrentTocEntry();
				}, 100);
			}
		}
		
		// Layout and display floating TOC.
		highlightCurrentTocEntry();
		var origScrollTop = $document.scrollTop();
		var windowWidth = $window.width();
		var maxRight = windowWidth - Math.floor(windowWidth * 0.1);
		
		if ($currentSection.offset().left + $floattoc.outerWidth() > maxRight) {
			$floattoc.css('left', maxRight - $floattoc.outerWidth());
		} else {
			$floattoc.css('left', $currentSection.offset().left + 'px');
		}
		reposition();
		$floattoc.css('visibility', 'visible');
		$currentSection.addClass('pressed');
		
		$floattoclinks.bind('click', hideFloatingToc);
		$document.bind('mousedown', onMouseDown)
		$document.bind('touchdown', onMouseDown);
		$document.bind('mizuho:hideTopBar', hideFloatingToc);
		$window.bind('scroll', onScroll);
	}
	
	// Called whenever the user scrolls. Updates the title of the
	// Table of Contents button in the top bar to the section that
	// the user is currently reading.
	function update() {
		if ($title.offset().top + $title.height() < $document.scrollTop()) {
			if (!$topbar.is(':visible')) {
				$topbar.slideDown(250);
				$document.trigger('mizuho:showTopBar');
			}
		} else {
			if ($topbar.is(':visible')) {
				$topbar.slideUp();
				$document.trigger('mizuho:hideTopBar');
			}
		}
		
		if (isMobileDevice) {
			$topbar.css({
				top: $document.scrollTop() + 'px',
				width: $window.width() -
					parseInt($topbar.css('padding-left')) -
					parseInt($topbar.css('padding-right')) +
					'px'
			});
		}
		
		var header = self.currentSubsection();
		var name;
		if (header) {
			name = $(header).text();
		} else {
			name = 'Preamble';
		}
		$currentSection.text(name);
	}
	
	function scheduleUpdate() {
		if (timerId !== undefined) {
			return;
		}
		timerId = setTimeout(function() {
			timerId = undefined;
			update();
		}, 100);
	}
	
	
	if (isMobileDevice) {
		// Mobile devices don't support position fixed.
		$topbar.css('position', 'absolute');
		$floattoc.css('position', 'absolute');
	}
	
	$currentSection.click(showFloatingToc);
	$window.scroll(scheduleUpdate);
	$document.bind('mizuho:updateTopBar', update);
}, Mizuho);

$(document).ready(Mizuho.initializeTopBar);