-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathColorboxExtender_Admin.js
50 lines (41 loc) · 1.39 KB
/
ColorboxExtender_Admin.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
/*
#######################################################################
JS/jQuery for Typesetter CMS - 'Colorbox Extender' plugin - Admin Page
Author: J. Krausz
Date: 2016-12-22
Version 1.1
######################################################################
*/
$(function(){
$(window).on("beforeunload", function(){
if( $("#cbe_config_form").attr("data-values-changed") == "1" ){
return "Warning: There are unsaved changes that will be lost. Proceed anyway?"; // most browsers will show their own msg here
}
});
if( $("#cbe_style_select").val() == "none" ){
$("#cbe_system_settings_link").show();
}
$("#cbe_config_form input, #cbe_config_form select").on("change", function(e){
$("#cbe_config_form").attr("data-values-changed", "1");
});
$("#cbe_style_select").on("change", function(){
if( $(this).val() == "none" ){
$("#cbe_system_settings_link").fadeIn();
}else{
$("#cbe_system_settings_link").fadeOut();
}
});
$("#cbe_system_settings_link").on("click", function(e){
if( $("#cbe_config_form").attr("data-values-changed") == "1" ){
var save = confirm("Settings have been changed. " + gplang.Save + "?");
if( save ){
e.preventDefault();
$("#cbe_config_submit").click();
}
}
});
$("#cbe_config_form").on("submit", function(e){
$(this).attr("data-values-changed", "0");
return true;
});
});