Pathologic was missing because of a .git folder inside.
[yaffs-website] / web / modules / contrib / diff / js / diff.js
1 (function ($, Drupal, drupalSettings) {
2
3   'use strict';
4
5   Drupal.behaviors.diffRevisions = {
6     attach: function (context, settings) {
7       // drupalSettings in not anymore bound to attached functions.
8       // It is available outside the scope of this anonymous function also.
9       var $rows = $('table.diff-revisions tbody tr').once('diff-revisions');
10       if ($rows.length === 0) {
11         return;
12       }
13
14       function updateDiffRadios() {
15         var newTd = false;
16         var oldTd = false;
17         if (!$rows.length) {
18           return true;
19         }
20         $rows.each(function () {
21           var $row = $(this);
22           var $inputs = $row.find('input[type="radio"]');
23           var $oldRadio = $inputs.filter('[name="radios_left"]').eq(0);
24           var $newRadio = $inputs.filter('[name="radios_right"]').eq(0);
25           if (!$oldRadio.length || !$newRadio.length) {
26             return true;
27           }
28           if ($oldRadio.prop('checked')) {
29             oldTd = true;
30             $oldRadio.css('visibility', 'visible');
31             $newRadio.css('visibility', 'hidden');
32           }
33           else if ($newRadio.prop('checked')) {
34             newTd = true;
35             $oldRadio.css('visibility', 'hidden');
36             $newRadio.css('visibility', 'visible');
37           }
38           else {
39             if (drupalSettings.diffRevisionRadios === 'linear') {
40               if (newTd && oldTd) {
41                 $oldRadio.css('visibility', 'visible');
42                 $newRadio.css('visibility', 'hidden');
43               }
44               else if (newTd) {
45                 $newRadio.css('visibility', 'visible');
46                 $oldRadio.css('visibility', 'visible');
47               }
48               else {
49                 $newRadio.css('visibility', 'visible');
50                 $oldRadio.css('visibility', 'hidden');
51               }
52             }
53             else {
54               $newRadio.css('visibility', 'visible');
55               $oldRadio.css('visibility', 'visible');
56             }
57           }
58         });
59         return true;
60       }
61
62       if (drupalSettings.diffRevisionRadios) {
63         $rows.find('input[name="radios_left"], input[name="radios_right"]').click(updateDiffRadios);
64         updateDiffRadios();
65       }
66     }
67   };
68
69 })(jQuery, Drupal, drupalSettings);