ref: master
plugins/pjax/public/javascripts/loading-overlay.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 |
if (typeof loading_overlay === 'undefined') { // block user actions while making a post. Also indicate the network transaction loading_overlay = { show: function (selector) { var element = jQuery(selector); var overlay = jQuery('<div>', { class: 'loading-overlay', css: { width: element.outerWidth(), height: element.outerHeight(), left: element.position().left, top: element.position().top, marginLeft: parseFloat(element.css('margin-left')), marginTop: parseFloat(element.css('margin-top')), marginRight: parseFloat(element.css('margin-right')), marginBottom: parseFloat(element.css('margin-bottom')), }, }).appendTo(element).get(0); overlay.dest = element; element.loading_overlay = overlay; }, hide: function (selector) { var element = jQuery(selector); var overlay = element.find('.loading-overlay'); overlay.remove(); }, }; } |