mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
Fix undo preview and remove duplicate code
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
d8b57924fb
commit
d8045966de
2 changed files with 30 additions and 31 deletions
|
|
@ -81,7 +81,7 @@
|
|||
vertical-align: middle;
|
||||
border-radius: 3px;
|
||||
}
|
||||
I
|
||||
|
||||
#theming-preview {
|
||||
width: 230px;
|
||||
height: 140px;
|
||||
|
|
|
|||
|
|
@ -173,46 +173,42 @@ $(document).ready(function () {
|
|||
|
||||
$('#theming-name').change(function(e) {
|
||||
var el = $(this);
|
||||
if(checkName()){
|
||||
$.when(el.focusout()).then(function() {
|
||||
setThemingValue('name', $(this).val());
|
||||
});
|
||||
if (e.keyCode == 13) {
|
||||
setThemingValue('name', $(this).val());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#theming-url').change(function(e) {
|
||||
$('#theming input[type=text]').change(function(e) {
|
||||
var el = $(this);
|
||||
var setting = el.parent().find('div[data-setting]').data('setting');
|
||||
var value = $(this).val();
|
||||
|
||||
if(setting === 'color') {
|
||||
if (value.indexOf('#') !== 0) {
|
||||
value = '#' + value;
|
||||
}
|
||||
}
|
||||
if(setting === 'name') {
|
||||
if(checkName()){
|
||||
$.when(el.focusout()).then(function() {
|
||||
setThemingValue('name', value);
|
||||
});
|
||||
if (e.keyCode == 13) {
|
||||
setThemingValue('name', value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$.when(el.focusout()).then(function() {
|
||||
setThemingValue('url', $(this).val());
|
||||
setThemingValue(setting, value);
|
||||
});
|
||||
if (e.keyCode == 13) {
|
||||
setThemingValue('url', $(this).val());
|
||||
setThemingValue(setting, value);
|
||||
}
|
||||
});
|
||||
|
||||
$('#theming-slogan').change(function(e) {
|
||||
var el = $(this);
|
||||
$.when(el.focusout()).then(function() {
|
||||
setThemingValue('slogan', $(this).val());
|
||||
});
|
||||
if (e.keyCode == 13) {
|
||||
setThemingValue('slogan', $(this).val());
|
||||
}
|
||||
});
|
||||
|
||||
$('#theming-color').change(function (e) {
|
||||
var color = $(this).val();
|
||||
if (color.indexOf('#') !== 0) {
|
||||
color = '#' + color;
|
||||
}
|
||||
setThemingValue('color', color);
|
||||
});
|
||||
|
||||
$('.theme-undo').click(function (e) {
|
||||
var setting = $(this).data('setting');
|
||||
var $form = $(this).closest('form');
|
||||
var image = $form.data('image-key');
|
||||
|
||||
startLoading();
|
||||
$('.theme-undo[data-setting=' + setting + ']').hide();
|
||||
$.post(
|
||||
|
|
@ -222,10 +218,13 @@ $(document).ready(function () {
|
|||
var colorPicker = document.getElementById('theming-color');
|
||||
colorPicker.style.backgroundColor = response.data.value;
|
||||
colorPicker.value = response.data.value.slice(1).toUpperCase();
|
||||
} else if (setting !== 'logoMime' && setting !== 'backgroundMime') {
|
||||
} else if (!image) {
|
||||
var input = document.getElementById('theming-'+setting);
|
||||
input.value = response.data.value;
|
||||
}
|
||||
if (image) {
|
||||
$form.find('.image-preview').css('background-image','none');
|
||||
}
|
||||
preview(setting, response.data.value, response.data.serverCssUrl);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue