This file is indexed.

/usr/share/tdiary/js/slideshow.js is in tdiary-contrib 5.0.8-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
/*
 * slideshow.js : show slides
 *
 * Copyright (C) 2016 by TADA Tadashi <t@tdtds.jp>
 * Distributed under the GPL2 or any later version.
 */

$(function(){
	function isFullscreenEnabled(doc) {
		return(
			doc.fullscreenEnabled ||
			doc.webkitFullscreenEnabled ||
			doc.mozFullScreenEnabled ||
			doc.msFullscreenEnabled ||
			false
		);
	};

	function requestFullscreen(element) {
		var funcs = [
			'requestFullscreen',
			'webkitRequestFullscreen',
			'mozRequestFullScreen',
			'msRequestFullscreen',
		];
		$.each(funcs, function(idx, func) {
			if (element[func]) {
				element[func]();
				return false;
			}
		});
	};

	function isFullscreen() {
		if (document.fullscreenElement ||
				document.webkitFullscreenElement ||
				document.mozFullScreenElement ||
				document.msFullscreenElement ) {
			return true;
		}
		return false;
	};

	function startSlideShow(content) {
		if (!isFullscreenEnabled(document)) {
			return false;
		}

		var slides = [];
		$.each(content.children(), function(i, elem) {
			var e = $(elem).clone();
			if (e.prop('tagName') == 'H3') { // main title
				$('a', e).remove(); // section anchor
				$('span', e).remove(); // hatena start etc...
				$('button.slideshow', e).remove();
				slides.push([$('<div class="slide-title">').append(e)]);
			} else if (e.prop('tagName') == 'H4') { // page title
				slides.push([e, $('<div class="slide-body">')]);
			} else {
				var last = slides[slides.length-1];
				last[last.length-1].append(e);
			}
		});

		var screen = window.screen;
		var slide = $('<div>').
			         addClass('slide').
	               css('width', screen.width).
		            css('height', screen.height);
		var current_page = 0;
		var firstClick = true;

		$('body').append(slide);
		slide.append(slides[current_page]);
		requestFullscreen(slide[current_page]);

		$(document).on({
			'keydown': function(e) {
				if (e.keyCode == 13 || e.keyCode == 34 || e.keyCode == 39) { // next page
					if (slides.length - 1 > current_page) {
						e.preventDefault();
						slide.empty().append(slides[++current_page]);
					}
				} else if (e.keyCode == 37 || e.keyCode == 33) { // prev page
					if (current_page > 0) {
						e.preventDefault();
						slide.empty().append(slides[--current_page]);
					}
				} else if (e.keyCode == 36) { // [Home] to top page
					e.preventDefault();
					slide.empty().append(slides[current_page = 0]);
				} else if (e.keyCode == 35) { // [End] to bottom page
					e.preventDefault();
					slide.empty().append(slides[current_page = slides.length-1]);
				}
			},
			'click': function() {
				if (!firstClick && slides.length - 1 > current_page) {
					slide.empty().append(slides[++current_page]);
				}
				firstClick = false;
			},
			'fullscreenchange webkitfullscreenchange mozfullscreenchange msfullscreenchange': function() {
				if (!isFullscreen()) { // fullscreen was closed
					$(document).off('keydown').off('click');
					slide.remove();
				}
			}
		});

		return true;
	};

	$('.slideshow').on('click', function(e){
		var section = $(this).parent().parent();
		e.preventDefault();
		if (!startSlideShow(section)) {
			alert("couldn't start slideshow.")
			return;
		}
	});
});