Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F803929
D445.id1146.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
Wed, Feb 26, 9:01 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Thu, Feb 27, 9:01 AM (7 h, 56 m)
Engine
blob
Format
Raw Data
Handle
576649
Attached To
D445: INP-1840 - Reset form scroll prior to window resizing handling
D445.id1146.diff
View Options
Index: core/admin_templates/js/forms.js
===================================================================
--- core/admin_templates/js/forms.js
+++ 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