/usr/share/hotot/js/ui.previewer.js is in hotot-common 1:0.9.8.14-2.
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 | // Generated by CoffeeScript 1.3.1
(function() {
var Previewer, root, _ref;
Previewer = (function() {
Previewer.name = 'Previewer';
function Previewer(sel) {
var _this = this;
this.me = $(sel);
this.image = this.me.find('.image');
this.link = this.me.children('.image_wrapper');
this.close_btn = this.me.children('.close');
this.visible = false;
this.close_btn.click(function() {
return _this.close();
});
this.link.click(function(ev) {
if (ev.which !== 1 && ev.which !== 2) {
_this.close();
return;
}
if (conf.vars.platform === 'Chrome') {
chrome.tabs.create({
url: _this.link.attr('href'),
active: ev.which === 1
}, function() {});
_this.close();
return false;
}
return _this.close();
});
}
Previewer.prototype.reset = function() {
this.reload_proc('image/ani_loading_bar.gif');
return this.image.css('margin', '20px 0');
};
Previewer.prototype.reload = function(image_url) {
this.reset();
return this.reload_proc(image_url);
};
Previewer.prototype.reload_proc = function(image_url) {
var preloader,
_this = this;
preloader = new Image;
preloader.onload = function() {
var height, preload, width;
_this.image.attr('src', image_url);
_this.image.css('margin', '0');
width = preloader.width;
height = preloader.height;
if ($(window).width() < width + 40) {
width = $(window).width() - 40;
height = (width + .0) / preloader.width * preloader.height;
}
if ($(window).height() < height + 70) {
height = $(window).height() - 70;
width = (height + .0) / preloader.height * preloader.width;
}
_this.image.width(width);
_this.image.height(height);
_this.link.attr('href', image_url);
_this.resize(width, height);
return preload = null;
};
return preloader.src = image_url;
};
Previewer.prototype.resize = function(width, height) {
if (width < 64) {
width = 64;
}
if (height < 64) {
height = 64;
}
height += 30;
this.me.width(width).height(height);
return this.me.css({
'margin-top': (0 - height) / 2 - 10,
'margin-left': (0 - width) / 2 - 10
});
};
Previewer.prototype.open = function() {
this.visible = true;
this.me.show();
return this.me.transition({
'opacity': 1
}, 100);
};
Previewer.prototype.close = function() {
var _this = this;
this.visible = false;
return this.me.transition({
'opacity': 0
}, 100, function() {
return _this.me.hide();
});
};
return Previewer;
})();
root = typeof exports !== "undefined" && exports !== null ? exports : this;
root.widget = (_ref = root.widget) != null ? _ref : {};
root.widget.Previewer = Previewer;
}).call(this);
|