Page MenuHomeIn-Portal Phabricator

D445.diff
No OneTemporary

File Metadata

Created
Mon, Jan 6, 6:58 AM

D445.diff

Index: branches/5.2.x/core/admin_templates/js/forms.js
===================================================================
--- branches/5.2.x/core/admin_templates/js/forms.js
+++ branches/5.2.x/core/admin_templates/js/forms.js
@@ -148,6 +148,8 @@
Form.ScrollerH = 17;
Form.HasChanged = false;
+Form.reizeTimeoutId = false;
+
Form.Init = function(id) {
this.Div = document.getElementById(id);
if (!this.Div) {
@@ -191,7 +193,13 @@
// alert('Measuring min width now')
- addEvent(window, 'resize', function() {Form.Resize()})
+ // Call the "resize" event using debounce technique.
+ $(window).resize(function () {
+ clearTimeout(Form.reizeTimeoutId);
+ Form.reizeTimeoutId = setTimeout(function () {
+ Form.Resize();
+ }, 100);
+ });
this.Resize(false);
@@ -283,7 +291,7 @@
var h = (document.all ? window.document.body.offsetHeight : window.innerHeight);
var $div = $(this.Div);
- var pos = $div.offset();
+ var pos = this.GetOffsetWithoutUserScroll($div);
h -= pos.top;
@@ -362,6 +370,20 @@
// print_pre(this.Controls)
};
+Form.GetOffsetWithoutUserScroll = function ($div) {
+ var $ret,
+ $wrapper_div = $div.parent(),
+ $old_scroll_top = $wrapper_div.scrollTop();
+
+ $wrapper_div.scrollTop(0);
+
+ $ret = $div.offset();
+
+ $wrapper_div.scrollTop($old_scroll_top);
+
+ return $ret;
+};
+
Form.ResetHeights = function()
{
for (var i = 0; i < this.Controls.length; i++) {

Event Timeline