summaryrefslogtreecommitdiffstats
path: root/WebHob_1.5/b3/assets/js/main.js
blob: 7ec8777675df1d3e9dfc017f3234b2d669f13598 (plain)
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
$(document).ready(function() {

    /*
     * PrettyPrint plugin.
     *
     */
    // Init
    prettyPrint();

    // Prevent invalid links from jumping page scroll
    $('a[href=#]').not('.builds-projects a').click(function() {
        return false;
    });

	$(document).not('.builds-projects a').on("click", "a[href=#]", function() {
		return false;
	});

    /* Belen's additions */

    // enable popovers in any table cells that contain an anchor with the
    // .btn class applied, and make sure popovers work on click, are
    // mutually exclusive and they close when you click outside their area

    $('td > a.btn').not("#packages-popover, .nopop").popover( { html: true, placement: 'left', container: 'body', trigger: 'click' });

    /*$('html').click(function(e){
    	$('td > a.btn').popover('hide');
    	$('.get-help').tooltip('hide');
    	$("li .icon-warning-sign, li .icon-minus-sign, #machine-distro .icon-minus-sign, td > .icon-warning-sign, td > .icon-minus-sign").popover('hide');
    });

    $('td > a.btn').not('.nopop').popover({
    	html: true,
    	placement: 'left',
    	container: 'body',
    	trigger: 'manual'
    }).click(function(e){
    	$('td > a.btn').not(this).popover('hide');
    	$(this).popover('show');
    	e.stopPropagation();
    });*/

    // popovers on hover for project added items in the project page
	$("li .icon-minus-sign, #machine-distro .icon-minus-sign").popover({
		placement: 'top',
		container: 'body',
		trigger: "manual" ,
		html: true
	}).on("mouseenter", function () {
        var _this = this;
        setTimeout( function () {
        	$(_this).popover("show");
        }, 400);
        $(".popover").on("mouseleave", function () {
            $(_this).popover('hide');
        });
        $(".popover").on("click", function () {
            $(_this).popover('hide');
        });
    }).on("mouseleave", function () {
        var _this = this;
        setTimeout(function () {
            if (!$(".popover:hover").length) {
                $(_this).popover("hide")
            }
        }, 100);
    });

    // popovers on hover for project added items in the 'all' pages
	$(".icon-minus-sign").popover({
		container: 'body',
		trigger: "manual" ,
		html: true
	}).on("mouseenter", function () {
        var _this = this;
        setTimeout (function () {
        	$(_this).popover("show");
        }, 400);
        $(".popover").on("mouseleave", function () {
            $(_this).popover('hide');
        });
        $(".popover").on("click", function () {
            $(_this).popover('hide');
        });
    }).on("mouseleave", function () {
        var _this = this;
        setTimeout(function () {
            if (!$(".popover:hover").length) {
                $(_this).popover("hide")
            }
        }, 100);
    });

	// enable help information tooltips so that they
	// don't disappear while you are hovering over them
	$(".get-help").tooltip( {container: 'body', html: true} );

    /*$(".get-help").tooltip({
    	container: 'body',
    	html: true,
    	trigger: 'manual'
    }).on("mouseenter", function () {
        var _this = this;
        setTimeout( function () {
        	$(_this).tooltip("show");
        }, 400);
        $(".tooltip").on("mouseleave", function () {
            $(_this).tooltip('hide');
        });
    }).on("mouseleave", function () {
        var _this = this;
        setTimeout(function () {
            if (!$(".tooltip:hover").length) {
                $(_this).tooltip("hide")
            }
        }, 100);
    });  */

    //enable tooltips for the delete action
	  $(".glyphicon-trash").not(".no-tooltip, .remove").tooltip( {container: 'body', html: true, delay: {show: 400}, title: "Delete" });

    // enable toolipts for the remove action
    $(".remove").not("no-tooltip").tooltip( {container: 'body', html: true, delay: {show: 400}, title: "Remove" });

    //enable tooltips for the edit action
    $(".glyphicon-edit").tooltip( {container: 'body', html: true, delay: {show: 400}, title: "Change" });

    //enable tooltips for the download action
    $(".glyphicon-download-alt").tooltip( {container: 'body', html: true, delay: {show: 400} });

    //enable tooltips for the build action in the my image recipes section
    $(".icon-refresh").tooltip( {container: 'body', html: true, delay: {show: 400} });

    //enable tooltips for restoring deleting packages in my image recipes
    $(".icon-arrow-left").tooltip( {container: 'body', html: true, delay: {show: 400}, title: "Restore" });

    // enable tooltips for the commit in the layer details page heading
    $(".commit").tooltip ({ container: 'body', html: true, delay: {show: 400} });

    //enable tooltips and popovers for the analysis project info bubble
    $('h1 > .icon-info-sign').popover( { container: 'body', html: true, placement: 'bottom' } );

	// show help bubble only on hover inside tables
	$(".hover-help").css("visibility","hidden");
	$("th, td").hover(function () {
		$(this).find(".hover-help").css("visibility","visible");
	});
	$("th, td").mouseleave(function () {
		$(this).find(".hover-help").css("visibility","hidden");
	});

	// show actions available only on hover inside tables
	$(".action").css("visibility","hidden");
	$("tr").hover(function () {
		$(this).find(".action").css("visibility","visible");
	});
	$("tr").mouseleave(function () {
		$(this).find(".action").css("visibility","hidden");
	});

    // show task type and outcome in task details pages
    $(".task-info").tooltip({ container: 'body', html: true, delay: {show: 200}, placement: 'right' });

    // show layer information in project pages
    $(".layer-info").tooltip({ container: 'body', html: true, delay: {show: 200}, placement: 'right' });
    $(".layer-info-top").tooltip({ container: 'body', html: true, delay: {show: 200}, placement: 'top' });

	// linking directly to tabs
	$(function(){
  		var hash = window.location.hash;
  		hash && $('ul.nav a[href="' + hash + '"]').tab('show');

  		$('.nav-tabs a').click(function (e) {
    		$(this).tab('show');
			$('body').scrollTop();
  		});
	});

});