-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.js
69 lines (48 loc) · 1.81 KB
/
script.js
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
jQuery(document).ready(function($){
$(window).on('resize',function() {
$('#current-size').text('('+ $(window).width() +' x '+ $(window).height() +')');
}).resize();
$('#device-custom').on('change', function() {
if (this.checked) {
$('#device-custom-width, #device-custom-height').prop( "disabled", false );
} else {
$('#device-custom-width, #device-custom-height').prop( "disabled", true );
}
});
$('#device-custom-width, #device-custom-height').on('input', function() {
$('#device-custom').prop( "checked", true );
});
$('#devices-list input[type="checkbox"]').on('change', function() {
if ( $('#devices-list input[type="checkbox"]:checked').length ) {
$('#resp-submit').prop( "disabled", false );
} else {
$('#resp-submit').prop( "disabled", true );
}
});
$('#optioner-form').on('submit', function(){
if ( $('#device-custom-width, #device-custom-height').val() == "" ) {
$('#device-custom').prop( "checked", false );
$('#device-custom-width, #device-custom-height').prop( "disabled", true );
}
});
// ACCESS SETTING SAVE
$('#responsivity_public').on('change', function() {
$('#responsivity-ajax-option-save').submit();
});
$('#responsivity-ajax-option-save').submit(function() {
var form = $(this);
var check = $('#responsivity_public');
var data = form.serialize();
check.prop("disabled", true);
$.post( 'options.php', data ).error(function() {
alert('An error occured. Please try again.');
}).success( function() {
check.prop("disabled", false);
});
return false;
});
$('#resp_full_height_mode').on('change', function() {
if ( $(this).prop("checked") ) $('#resp_show_devices').prop('checked', false).prop('disabled', true);
else $('#resp_show_devices').prop('disabled', false);
});
}); // document ready