Skip to content

Commit 0c7ac44

Browse files
loading indicator when clicking save button (hestiacp#2740)
* loading indicator for save button ... should probably find a better place to load the image from. maybe somone on github has an idea * replace all the buttons before clicking save: https://i.imgur.com/DKin97B.png after clicking save: https://i.imgur.com/UOPsK0p.png * bundle loading-gif also made the css selector stricter (but not as strict as #save_button would be..) the source of the image is the GPLv2-licensed PhpMyAdmin ( https://raw.githubusercontent.com/phpmyadmin/phpmyadmin/7a6d4e68d3f6238f837d92c84c80081436ff02cc/themes/original/img/ajax_clock_small.gif ), strictly speaking i'm not sure if we're actually allowed to bundle the image directly, but if it ever actually becomes a problem (eg the PhpMyAdmin team demand we remove it) I'm sure finding-or-making a replacement won't be too hard..? I also think that will never actually happen. * Replace with different spinner * Remove spinner image again * Remove some console.log output * comment Safari render hack Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com>
1 parent c4d44a0 commit 0c7ac44

File tree

6 files changed

+11
-8
lines changed

6 files changed

+11
-8
lines changed

web/js/events.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ VE.helpers.createConfirmationDialog = function(elm, dialog_title, confirmed_loca
153153

154154

155155
var reference_copied = $(elm[0]).clone();
156-
console.log(reference_copied);
157156
config = $.extend(config, custom_config);
158157
$(reference_copied).dialog(config);
159158

@@ -228,7 +227,6 @@ function updateInterval(){
228227
}
229228

230229
function stopTimer(){
231-
console.log(reloadFunction);
232230
if(reloadFunction){
233231
clearInterval(reloadFunction);
234232
reloadFunction = false;

web/js/init.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,17 @@ $(document).ready(function(){
613613
$('.l-unit').find('.ch-toggle').prop('checked', false);
614614
$('.l-unit.selected').find('.ch-toggle').prop('checked', true);
615615
});
616+
// todo: maybe give the save button id?
617+
$(".ui-button[data-id=vstobjects][data-action=submit]").on('click', function(ev){
618+
let loadingAnimationEle = document.createElement("div");
619+
loadingAnimationEle.innerHTML = '<div class="timer-container" style="float:right;"><div class="timer-button spinner"><div class="spinner-inner"></div><div class="spinner-mask"></div> <div class="spinner-mask-two"></div></div></div>';
620+
// this both gives an indication that we've clicked and is loading, also prevents double-clicking/clicking-on-something-else while loading.
621+
$(".ui-button[data-id=vstobjects][data-action=submit]").replaceWith(loadingAnimationEle);
622+
$(".ui-button").replaceWith('');
623+
// workaround a render bug on Safari (loading icon doesn't render without this)
624+
ev.preventDefault();
625+
$('#vstobjects').submit();
626+
});
616627
});
617628

618629
/**

web/js/pages/add_mail_acc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ generate_mail_credentials = function() {
141141
output=output.replace(/ $/, "");
142142
output=output.replace(/:\|/g, ": ");
143143
output=output.replace(/\|/g, "\n");
144-
//console.log(output);
145144
$('#v_credentials').val(output);
146145
}
147146

web/js/pages/add_web.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
var prepath = $('input[name="v-custom-doc-root_prepath"]').val();
33
var domain = $('select[name="v-custom-doc-domain"]').val();
44
var folder = $('input[name="v-custom-doc-folder"]').val();
5-
console.log(domain, folder);
65
$('.custom_docroot_hint').text(prepath+domain+'/public_html/'+folder);
76
}
87
App.Listeners.DB.keypress_custom_folder = function() {

web/js/pages/edit_mail_acc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ generate_mail_credentials = function() {
120120
output=output.replace(/ $/, "");
121121
output=output.replace(/:\|/g, ": ");
122122
output=output.replace(/\|/g, "\n");
123-
//console.log(output);
124123
$('#v_credentials').val(output);
125124
}
126125

web/js/templates.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ var Templator = function()
2626
{
2727
var init = function()
2828
{
29-
fb.info('Templator work');
3029
Templator.splitThemAll();
3130
Templator.freezeTplIndexes();
3231
};
@@ -36,7 +35,6 @@ var Templator = function()
3635
* Split the tpl strings into arrays
3736
*/
3837
Templator.splitThemAll = function(){
39-
fb.info('splitting tpls');
4038
jQuery.each(App.Templates.html, function(o){
4139
//try{
4240
var tpls = App.Templates.html[o];
@@ -52,7 +50,6 @@ var Templator = function()
5250
* Iterates tpls
5351
*/
5452
Templator.freezeTplIndexes = function(){
55-
fb.info('freezing tpl keys');
5653
jQuery.each(App.Templates.html, Templator.cacheTplIndexes);
5754
},
5855

0 commit comments

Comments
 (0)