PageRenderTime 355ms CodeModel.GetById 133ms app.highlight 96ms RepoModel.GetById 119ms app.codeStats 1ms

/kai/public/javascripts/behavior.js

https://bitbucket.org/bbangert/kai/
JavaScript | 45 lines | 43 code | 1 blank | 1 comment | 5 complexity | 71f5c8d35133a885b811df0672775c30 MD5 | raw file
 1$(document).ready(function() {
 2    // Swap the layout toggle if they have wide-screen
 3    if ($.cookie('layout_style') == 'Stretch') {
 4        $('#doc4').attr('id', 'doc3');
 5        $('#layout-toggle').html('Stretch');
 6    };
 7    
 8    $('div.viewtoggle a').click(function() {
 9        $(this).toggleClass('down');
10        $(this).parent().next().slideToggle();
11        return false;
12    });
13    $('div.details a').click(function() {
14        $.blockUI({ message: $('#buildinfo') });
15        var url = '/buildbot/details/' + $(this).attr('class');
16        $.ajax({
17            url: url,
18            cache: false,
19            success: function(data, textStatus) {
20                $.blockUI({ message: data, 
21                            css: { width: '90%', top: '5%', 
22                                   bottom: '5%', left: '5%',
23                                   overflow: 'auto', right: '5%',
24                                   textAlign: 'left', cursor: 'default' } });
25                $('div.close a').click(function() {
26                    $.unblockUI();
27                    return false;
28                });
29            }
30        });
31        return false;
32    });
33    $('#layout-toggle').click(function() {
34        if ($('#layout-toggle').html() == 'Fixed-width') {
35            $('#doc4').attr('id', 'doc3');
36            $('#layout-toggle').html('Stretch');
37            $.cookie('layout_style', 'Stretch', {path: '/', domain: '.pylonshq.com'});
38        } else {
39            $('#doc3').attr('id', 'doc4');
40            $('#layout-toggle').html('Fixed-width');
41            $.cookie('layout_style', null, {path: '/', domain: '.pylonshq.com'});
42        }
43        return false;
44    });
45});