[dw-free] Jump back to where you were after editing a filter
[commit: http://hg.dwscoalition.org/dw-free/rev/a286d2a201aa]
http://bugs.dwscoalition.org/show_bug.cgi?id=1865
After editing a filter, go back to your place in the list by selecting the
list item which comes after the one(s) you just moved. (If at the end of the
list, select the last unselected element).
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1865
After editing a filter, go back to your place in the list by selecting the
list item which comes after the one(s) you just moved. (If at the end of the
list, select the last unselected element).
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- htdocs/js/subfilters.js
-------------------------------------------------------------------------------- diff -r 39da881c53ea -r a286d2a201aa htdocs/js/subfilters.js --- a/htdocs/js/subfilters.js Wed Nov 23 19:28:46 2011 +0800 +++ b/htdocs/js/subfilters.js Wed Nov 23 21:40:13 2011 +0800 @@ -100,7 +100,7 @@ } -function cfPopulateLists() { +function cfPopulateLists(selectValue) { // whenever we repopulate the lists, we lose what is selected cfHideOptions(); @@ -144,7 +144,7 @@ } $('#cf-in-list').html( inOpts ); - $('#cf-notin-list').html( outOpts ); + $('#cf-notin-list').html( outOpts ).val( selectValue ); if ($.browser.msie && parseInt($.browser.version, 10) <= 8) $('#cf-in-list, #cf-notin-list').css('width', 'auto').css('width', '100%'); // set #cf-in-list and #cf-notin-list width (IE n..7 bug) } @@ -429,8 +429,13 @@ // kick off a save event cfSaveChanges(); + var $opt = $("#cf-notin-list option"); + var lastsel = $opt.filter(":selected:last").index(); + var at_end = $opt.length - 1 - lastsel == 0; + var $newsel = $opt.filter((at_end?":lt(":":gt(") + lastsel+")").filter(":not(:selected)" + (at_end?":last":":first")) + // and then redisplay our lists - cfPopulateLists(); + cfPopulateLists( $newsel.val() ); } --------------------------------------------------------------------------------