/usr/share/hotot/js/ui.previewer.coffee 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 | class Previewer
constructor: (sel) ->
@me = $(sel)
@image = @me.find('.image')
@link = @me.children('.image_wrapper')
@close_btn = @me.children('.close')
@visible = false
@close_btn.click(=>
@close()
)
@link.click( (ev) =>
if ev.which != 1 && ev.which != 2
@close()
return
if conf.vars.platform == 'Chrome'
chrome.tabs.create(
{ url: @link.attr('href'), active: ev.which == 1 },
()->
)
@close()
return false
@close()
)
reset: () ->
@reload_proc('image/ani_loading_bar.gif')
@image.css('margin', '20px 0')
reload: (image_url) ->
@reset()
@reload_proc(image_url)
reload_proc: (image_url) ->
preloader = new Image
preloader.onload = () =>
@image.attr('src', image_url)
@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
@image.width(width)
@image.height(height)
@link.attr('href', image_url)
@resize(width, height)
preload = null
preloader.src = image_url
resize: (width, height) ->
# resize previewer
if width < 64
width = 64
if height < 64
height = 64
height += 30
@me.width(width).height(height)
@me.css({'margin-top': (0 - height)/2-10, 'margin-left': (0 - width)/2-10})
open: () ->
@visible = true
@me.show()
@me.transition({'opacity': 1}, 100)
close: () ->
@visible = false
@me.transition({'opacity': 0}, 100, ()=>@me.hide())
root = exports ? this
root.widget = root.widget ? {}
root.widget.Previewer = Previewer
|