Sha256: cdac8d8ca80b842096d1ae84b90ad5a91ebda014a3cd7791b3344001bc77ac58

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

$(document).ready(function(){

    if(!<%= PivotalReporter::Engine.config.enabled %>) return;

    ar slide_action    = -1;
    var container_width = -1;

    $pr_toggle = $('<a href="#" id="pr_report_button" title="Report Bug or Request Feature">!</a>');
    $pr_container = $('<div id="pivotal_reporter">');
    $pr_frame = $('<iframe id="pivotal_reporter_window" border="0" >').attr('src', '<%= PivotalReporter::Engine.config.mount_point %>');
    $pr_container.append($pr_frame).hide();

    $pr_toggle.click(function(e){
        h_slide_toggle($pr_container)
    });

    $pr_container
        .mouseover(function(e) {
            clearTimeout(slide_action);
        })
        .mouseout(function(e) {
            slide_action = setTimeout(toggle_report_window, 500);
        });

    $('body').prepend($pr_container).prepend($pr_toggle);

    var container_width = $pr_container.width();

    $pr_container.css('width', 0).css('top', $pr_toggle.css('top')).show();

    function toggle_report_window()
    {
        h_slide_toggle($pr_container);
    }
    function h_slide_toggle($obj)
    {
        var new_w = $obj.css('width') == '0px' ? container_width : 0;

        $obj.animate(
            {
                width: new_w
            },
            250,
            'swing');
    }

});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pivotal_reporter-0.7.1 app/assets/javascripts/pivotal_reporter/report_button.js.erb