diff --git a/lib/gollum/frontend/public/javascript/gollum.js b/lib/gollum/frontend/public/javascript/gollum.js
index 9e0305c7..e88fb0b0 100644
--- a/lib/gollum/frontend/public/javascript/gollum.js
+++ b/lib/gollum/frontend/public/javascript/gollum.js
@@ -29,26 +29,34 @@ $(document).ready(function() {
$('#wiki-history td.revert-action a').mouseenter(highlightOn);
$('#wiki-history td.revert-action a').mouseleave(highlightOff);
+
+ if ($('td.revert-action a').length) {
+ $('td.revert-action a').click(function(e) {
+ e.preventDefault();
+
+ var commitSha = $(this).attr('rel');
+ var truncatedSha = commitSha.toString().substr(0, 7);
+ // revert action
+ $.GollumDialog.init({
+ title: 'Revert to ' + truncatedSha + '?',
+ body: 'Are you sure you wish to revert to commit ' +
+ truncatedSha + '' +
+ ' ? This will overwrite any previous changes.',
+ OK: function() {
+ // TODO add async endpoint to revert here
+ }
+ });
+ });
+ }
+
+ if ($('.history a.action-compare-revision').length) {
+ $('.history a.action-compare-revision').click(function() {
+ $("#version-form").submit();
+ });
+ }
}
- if ($('td.revert-action a').length) {
- $('td.revert-action a').click(function(e) {
- e.preventDefault();
-
- var commitSha = $(this).attr('rel');
- var truncatedSha = commitSha.toString().substr(0, 7);
- // revert action
- $.GollumDialog.init({
- title: 'Revert to ' + truncatedSha + '?',
- body: 'Are you sure you wish to revert to commit ' +
- truncatedSha + '' +
- ' ? This will overwrite any previous changes.',
- OK: function() {
- // TODO add async endpoint to revert here
- }
- });
- });
- }
+
if ($('#searchbar a#search-submit').length) {
$.GollumPlaceholder.add($('#searchbar #search-query'));