Mercurial > kallithea
changeset 5644:e8229d389948
js: move .diff-collapse-button handling from the global base.js to the special diff js
Move it where it belongs and avoid adding more stuff to the global js later.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Tue, 05 Jan 2016 16:55:52 +0100 |
parents | 150431aae9ba |
children | 9f754ef1c18f |
files | kallithea/public/js/base.js kallithea/templates/changeset/diff_block.html |
diffstat | 2 files changed, 13 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/public/js/base.js Sat Jan 02 11:55:36 2016 +0100 +++ b/kallithea/public/js/base.js Tue Jan 05 16:55:52 2016 +0100 @@ -1912,20 +1912,3 @@ } return results; }; - -// global hooks after DOM is loaded - -$(document).ready(function(){ - $('.diff-collapse-button').click(function(e) { - var $button = $(e.currentTarget); - var $target = $('#' + $button.attr('target')); - if($target.hasClass('hidden')){ - $target.removeClass('hidden'); - $button.html("↑ {0} ↑".format(_TM['Collapse Diff'])); - } - else if(!$target.hasClass('hidden')){ - $target.addClass('hidden'); - $button.html("↓ {0} ↓".format(_TM['Expand Diff'])); - } - }); -});
--- a/kallithea/templates/changeset/diff_block.html Sat Jan 02 11:55:36 2016 +0100 +++ b/kallithea/templates/changeset/diff_block.html Tue Jan 05 16:55:52 2016 +0100 @@ -151,6 +151,19 @@ }; $('.btn-image-diff-swap').mouseup(reset); $('.btn-image-diff-swap').mouseleave(reset); + + $('.diff-collapse-button').click(function(e) { + var $button = $(e.currentTarget); + var $target = $('#' + $button.attr('target')); + if($target.hasClass('hidden')){ + $target.removeClass('hidden'); + $button.html("↑ {0} ↑".format(_TM['Collapse Diff'])); + } + else if(!$target.hasClass('hidden')){ + $target.addClass('hidden'); + $button.html("↓ {0} ↓".format(_TM['Expand Diff'])); + } + }); }); </script> </%def>