From db780e10e4981f15da653d8fc53e0fb80c8cce9a Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Tue, 13 Jan 2015 04:54:53 -0500 Subject: [PATCH] Fix bug where Drafts list wasn't updated on draft-save action in new window (#1490225) --- program/js/list.js | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/program/js/list.js b/program/js/list.js index c49a897..fd14c63 100644 --- a/program/js/list.js +++ b/program/js/list.js @@ -195,7 +195,12 @@ var me = this; $(window).resize(function(){ me.resize() }); - $(window).scroll(function(){ me.fixed_header.css({ 'marginLeft': (-$(window).scrollLeft()) + 'px' }) }); + $(window).scroll(function(){ + var w = $(window); + me.fixed_header.css('marginLeft', (-w.scrollLeft()) + 'px'); + if (!bw.webkit) + me.fixed_header.css('marginTop', (-w.scrollTop()) + 'px'); + }); } else { $(this.fixed_header).find('thead').replaceWith(clone); @@ -295,11 +300,13 @@ if (row.className) domrow.className = row.className; if (row.style) $.extend(domrow.style, row.style); - for (var domcell, col, i=0; row.cols && i < row.cols.length; i++) { + for (var e, domcell, col, i=0; row.cols && i < row.cols.length; i++) { col = row.cols[i]; domcell = document.createElement(this.col_tagname()); if (col.className) domcell.className = col.className; if (col.innerHTML) domcell.innerHTML = col.innerHTML; + for (e in col.events) + domcell['on' + e] = col.events[e]; domrow.appendChild(domcell); } @@ -360,7 +367,7 @@ // Un-focus already focused elements (#1487123, #1487316, #1488600, #1488620) // It looks that window.focus() does the job for all browsers, but not Firefox (#1489058) - $(':focus:not(body)').blur(); + $('iframe,:focus:not(body)').blur(); window.focus(); if (e || (e = window.event)) @@ -1030,7 +1037,7 @@ /** * Unselect selected row(s) */ -clear_selection: function(id) +clear_selection: function(id, no_event) { var n, num_select = this.selection.length; @@ -1052,7 +1059,7 @@ this.selection = []; } - if (num_select && !this.selection.length) + if (num_select && !this.selection.length && !no_event) this.triggerEvent('select'); }, @@ -1105,7 +1112,7 @@ if (!multiple) { if (this.selection.length > 1 || !this.in_selection(id)) { - this.clear_selection(); + this.clear_selection(null, true); this.selection[0] = id; $(this.rows[id].obj).addClass('selected'); } @@ -1275,7 +1282,8 @@ */ scrollto: function(id) { - var row = this.rows[id].obj; + var row = this.rows[id] ? this.rows[id].obj : null; + if (row && this.frame) { var scroll_to = Number(row.offsetTop), head_offset = 0; @@ -1340,7 +1348,7 @@ var uid = RegExp.$1, row = self.rows[uid]; - if ($.inArray(uid, selection) > -1) + if (!row || $.inArray(uid, selection) > -1) return; selection.push(uid); -- Gitblit v1.9.1