main.js
2.47 KB
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
$(document).ready(function() {
if($('div.form.login').length) { // in login page
$('input#LoginForm_password').focus();
}
$('table.preview input[name="checkAll"]').click(function() {
$('table.preview .confirm input').prop('checked', this.checked);
});
$('table.preview td.confirm input').click(function() {
$('table.preview input[name="checkAll"]').prop('checked', !$('table.preview td.confirm input:not(:checked)').length);
});
$('table.preview input[name="checkAll"]').prop('checked', !$('table.preview td.confirm input:not(:checked)').length);
$('.form .row.sticky input:not(.error), .form .row.sticky select:not(.error), .form .row.sticky textarea:not(.error)').each(function(){
var value;
if(this.tagName=='SELECT')
value=this.options[this.selectedIndex].text;
else if(this.tagName=='TEXTAREA')
value=$(this).html();
else
value=$(this).val();
if(value=='')
value='[empty]';
$(this).before('<div class="value">'+value+'</div>').hide();
});
$(document).on('click', '.form.gii .row.sticky .value', function(){
$(this).hide();
$(this).next().show().get(0).focus();
});
$('.form.gii .row input, .form.gii .row textarea, .form.gii .row select, .with-tooltip').not('.no-tooltip, .no-tooltip *').tooltip({
position: "center right",
offset: [-2, 10]
});
$('.form.gii .row input').change(function(){
$('.form.gii .feedback').hide();
$('.form.gii input[name="generate"]').hide();
});
$('.form.gii .view-code').click(function(){
var title=$(this).attr('rel');
$.fancybox.showActivity();
$.ajax({
type: 'POST',
cache: false,
url: $(this).attr('href'),
data: $('.form.gii form').serializeArray(),
success: function(data){
$.fancybox(data, {
'title': title,
'titlePosition': 'inside',
'titleFormat': function(title, currentArray, currentIndex, currentOpts) {
return '<div id="tip7-title"><span><a href="javascript:;" onclick="$.fancybox.close();">close</a></span>' + (title && title.length ? '<b>' + title + '</b>' : '' ) + '</div>';
},
'showCloseButton': false,
'autoDimensions': false,
'width': 900,
'height': 'auto',
'onComplete':function(){
$('#fancybox-inner').scrollTop(0);
}
});
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$.fancybox('<div class="error">'+XMLHttpRequest.responseText+'</div>');
}
});
return false;
});
$(document).on('click', '#fancybox-inner .close-code', function(){
$.fancybox.close();
return false;
});
});