This file is indexed.

/usr/share/calibre/viewer/images.js is in calibre 2.55.0+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
/*
 * images management
 * Copyright 2008 Kovid Goyal
 * License: GNU GPL v3
 */

function scale_images() {
    $("img:visible").each(function() {
        var img = $(this);
        var offset = img.offset();
        var avail_width = window.innerWidth - offset.left - 5;
        var avail_height = window.innerHeight - 5;
        img.css('width', img.data('orig-width'));
        img.css('height', img.data('orig-height'));
        var width = img.width();
        var height = img.height();
        var ratio = 0;

        if (width > avail_width) {
            ratio = avail_width / width;
            img.css('width', avail_width+'px');
            img.css('height', (ratio*height) + 'px');
            height = height * ratio;
            width = width * ratio;
        }

        if (height > avail_height) {
            ratio = avail_height / height;
            img.css('height', avail_height);
            img.css('width', width * ratio);
        }
        //window.py_bridge.debug(window.getComputedStyle(this, '').getPropertyValue('max-width'));
    });
}

function store_original_size_attributes() {
    $("img").each(function() {
        var img = $(this);
        img.data('orig-width', img.css('width'));
        img.data('orig-height', img.css('height'));
    });
}

function setup_image_scaling_handlers() {
   store_original_size_attributes();
   scale_images();
   $(window).resize(function(){
        scale_images();
   });
}