Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F727113
D445.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jan 6, 6:58 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Tue, Jan 7, 6:58 AM (3 d, 28 m ago)
Engine
blob
Format
Raw Data
Handle
537175
Attached To
D445: INP-1840 - Reset form scroll prior to window resizing handling
D445.diff
View Options
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
Log In to Comment