This file is indexed.

/usr/share/oem-config-slideshow/slides/link-core/slideshow.js is in oem-config-slideshow-ubuntu-mate 113.

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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
/*
Slideshow script for ubiquity-slideshow, global to all variations.

* Interprets parameters passed via location.hash (in #?param1=key?param2 format)
* Creates an animated slideshow inside the #slideshow element.
* Automatically loads a requested locale, based on the default slides.
* Manages slideshow controls, if requested via parameters.

Assumptions are made about the design of the html document this is inside of.
Please see slides/ubuntu/index.html for an example of this script in use.

Please include this script last, after any other scripts.


Dependencies (please load these first):
link-core/jquery.js
link-core/jquery.cycle.all.js
link-core/signals.js
*/

/* Pass parameters by creating a global SLIDESHOW_OPTIONS object, containing
   any options described at <http://jquery.malsup.com/cycle/options.html>
   
   The default callback for cycle.next also checks an extra autopause parameter,
   which will pause the slideshow when it reaches the end (but doesn't stop it)
   
   Signals: slideshow-loaded
            slideshow-started
            slide-opening
            slide-opened
            slide-closing
            slide-closed
*/

var slideshow;

var directory = {};
var extra_directory = {};

$(document).ready(function() {
	function loadExtraSlides() {
		$.ajax({
			type: 'GET',
			url: 'extra/directory.jsonp',
			dataType: 'jsonp',
			jsonpCallback: 'ubiquitySlideshowDirectoryCb',
			success: function(data, status, xhr) {
				extra_directory = $.extend(extra_directory, data);
			},
			complete: function(xhr, status) {
				slideshowReady();
			}
		});
	}
	
	$.ajax({
		type: 'GET',
		url: 'directory.jsonp',
		dataType: 'jsonp',
		jsonpCallback: 'ubiquitySlideshowDirectoryCb',
		success: function(data, status, xhr) {
			directory = $.extend(directory, data);
		},
		complete: function(xhr, status) {
			loadExtraSlides();
		}
	});
});

function slideshowReady() {
	slideshow = $('#slideshow');
	
	var slideshow_options = {
		fx:'scrollHorz',
		timeout:45000,
		speed:500,
		nowrap:false,
		autopause:true,
		manualTrump:false,
	};
	
	$.extend(slideshow_options, window.SLIDESHOW_OPTIONS);
	
	if ( 'rtl' in INSTANCE_OPTIONS )
		$(document.body).addClass('rtl');
	
	var locale = INSTANCE_OPTIONS['locale'] || 'C';
	loadSlides(locale);
	
	Signals.fire('slideshow-loaded');
	
	slideshow_options.before = function(curr, next, opts) {
		if ($(next).data('last')) {
			$('#next-slide').addClass('disabled').fadeOut(slideshow_options.speed);
		} else {
			$('#next-slide').removeClass('disabled').fadeIn(slideshow_options.speed);
		}
		
		if ($(next).data('first')) {
			$('#prev-slide').addClass('disabled').fadeOut(slideshow_options.speed);
		} else {
			$('#prev-slide').removeClass('disabled').fadeIn(slideshow_options.speed);
		}
		
		Signals.fire('slide-closing', $(curr));
		Signals.fire('slide-opening', $(next));
	}
	
	slideshow_options.after = function(curr, next, opts) {
		var index = opts.currSlide;
		/* pause at last slide if requested in options */
		if ( index == opts.slideCount - 1 && opts.autopause ) {
			slideshow.cycle('pause'); /* slides can still be advanced manually */
		}
		
		Signals.fire('slide-closed', $(curr));
		Signals.fire('slide-opened', $(next));
	}
	
	var controls = $('#controls');
	if ( 'controls' in INSTANCE_OPTIONS ) {
		var debug_controls = $('#debug-controls');
		if (debug_controls.length > 0) {
			debug_controls.show();
			controls = debug_controls;
		}
	}
	slideshow_options.prev = controls.children('#prev-slide');
	slideshow_options.next = controls.children('#next-slide');
	
	if ( 'slideNumber' in INSTANCE_OPTIONS )
		slideshow_options.startingSlide = INSTANCE_OPTIONS['slideNumber'];
	
	if (slideshow.children().length > 1) {
		slideshow.cycle(slideshow_options)
		Signals.fire('slideshow-started');
	} else {
		$('#prev-slide').addClass('disabled').hide();
		$('#next-slide').addClass('disabled').hide();
	}
};

function getTranslatedFile(locale, file_name, file_category) {
	var territory = locale.split(".",1)[0];
	var language = territory.split("_",1)[0];
	
	return tryFileLocale(locale, file_name, file_category) ||
	       tryFileLocale(territory, file_name, file_category) ||
	       tryFileLocale(language, file_name, file_category) ||
	       tryFileLocale('C', file_name, file_category);
	
	function tryFileLocale(locale, file_name, file_category) {
		if (translationFileExists(extra_directory, locale, file_name, file_category)) {
			// extra_directory can override slides from any locale, including C
			return './extra/'+locale+'/'+file_name;
		} else if (locale == 'C') {
			return './'+file_name;
		} else if (translationFileExists(directory, locale, file_name, file_category)) {
			return './l10n/'+locale+'/'+file_name;
		} else {
			return undefined;
		}
	}
	
	function translationFileExists(directory, locale, file_name, file_category) {
		return locale in directory &&
		       file_category in directory[locale] &&
		       directory[locale][file_category].indexOf(file_name) >= 0;
	}
}

function loadSlides(locale) {
	var selected_slidesets = []
	if ( 'slidesets' in INSTANCE_OPTIONS )
		selected_slidesets = INSTANCE_OPTIONS['slidesets'].split(' ');
	
	function slideIsVisible(slide) {
		var slidesets = $(slide).data('slidesets');
		var is_visible = true;
		if ( slidesets !== undefined ) {
			is_visible = false;
			$.each(slidesets.split(' '), function(index, slideset) {
				if ($.inArray(slideset, selected_slidesets) >= 0) {
					is_visible = true;
				}
			});
		}
		return is_visible;
	}
	
	function translateSlideContents(locale, contents) {
		// Warning: this assumes all images are local.
		// TODO: Only translate images selected by $(img.translatable)
		var images = $('img', contents);
		$.each(images, function(index, image) {
			var image_name = $(image).attr('src');
			var translated_image = getTranslatedFile(locale, image_name, 'media');
			$(image).attr('src', translated_image);
		});
	}
	
	slideshow.children('div').each(function(index, slide) {
		if ( slideIsVisible($(slide)) ) {
			var slide_name = $(slide).children('a').attr('href');
			var translated_slide = getTranslatedFile(locale, slide_name, 'slides');
			
			$.ajax({
				type: 'GET',
				url: translated_slide,
				cache: false,
				async: false,
				success: function(data, status, xhr) {
					$(data).appendTo(slide);
					translateSlideContents(locale, slide);
				}
			});
		} else {
			$(slide).detach();
		}
	});
	
	slideshow.children('div').first().data('first', true);
	slideshow.children('div').last().data('last', true);
}