This file is indexed.

/usr/share/tdiary/js/amazon.js is in tdiary-plugin 3.1.3-3.

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
/*
 * amazon.js : replace amazon URL using bit.ly (amzn.to).
 *
 * Copyright (C) 2011 by TADA Tadashi <t@tdtds.jp>
 * You can distribute it under GPL.
 */

$(function(){
	function shorten(link){
		var url = link.attr('href');
		var api = 'http://api.bit.ly/v3/shorten'
				+ '?format=json'
				+ '&longUrl=' + encodeURIComponent(url)
				+ '&login=' + $tDiary.plugin.bitly.login
				+ '&apiKey=' + $tDiary.plugin.bitly.apiKey;

		$.ajax({
			type: 'GET',
			url: api,
			dataType: 'jsonp',
			success: function(data){
				if (data['data']){
					link.attr('href',data['data']['url']);
				}
				else{
					//console.warn('fail to short: ' + link.attr('href'));
				}
			}
		});
	}

	$(window).bind('scroll', function(event){
		var bottom = $(window).height() + $(window).scrollTop();
		//console.warn('window.bottom: ' + bottom);
		$('a[href*="://www.amazon.co.jp/"]').each(function(){
			var a = $(this);
			if (bottom > a.offset().top){
				//console.warn('appear!: ' + a.text());
				shorten(a);
			}
		});
	});
});