Sha256: 211130ddc096051b356d1cb88f9ccf39486ddb8b70998e85f9e86e4cde74c04e

Contents?: true

Size: 916 Bytes

Versions: 10

Compression:

Stored size: 916 Bytes

Contents

if (typeof daddy === "undefined") {
  var daddy = {};
}
daddy.screenshot = {};

daddy.screenshot.get_or_create_viewer = function() {
  if (!this.viewer) {
    this.viewer = $('<div id="screenshot_viewer" style="display: none;"></div>');
    this.viewer.css({position: 'absolute'}).appendTo('body');
    this.viewer.show_image = function(image) {
      var clone= $(image).clone().removeClass('screenshot');
    
      this.empty().append(clone);
      this.css('left', $(window).scrollLeft());
      this.css('top', $(window).scrollTop());
      this.show();
    };
    this.viewer.close = function() {
      this.hide();
    };
  }
  
  return this.viewer;
};

var viewer = null;

$(document).ready(function() {
  viewer = daddy.screenshot.get_or_create_viewer();

  $('body').click(function(e) {
    viewer.close();
    if ($(e.target).hasClass('screenshot')) {
      viewer.show_image(e.target);
    }
  });

});

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
daddy-0.3.36 lib/daddy/formatter/screenshot.js
daddy-0.3.35 lib/daddy/formatter/screenshot.js
daddy-0.3.34 lib/daddy/formatter/screenshot.js
daddy-0.3.33 lib/daddy/formatter/screenshot.js
daddy-0.3.32 lib/daddy/formatter/screenshot.js
daddy-0.3.31 lib/daddy/formatter/screenshot.js
daddy-0.3.30 lib/daddy/formatter/screenshot.js
daddy-0.3.29 lib/daddy/formatter/screenshot.js
daddy-0.3.28 lib/daddy/formatter/screenshot.js
daddy-0.3.27 lib/daddy/formatter/screenshot.js