Code Duplication    Length = 36-36 lines in 2 locations

views/office/superuser/theme/index.js 1 location

@@ 1-36 (lines=36) @@
1
$(document).ready(function() {
2
  $('[onload]').each(function(i, el) {
3
    eval(el.getAttribute('onload'));
4
  });
5
  $(document).on('click', 'button[id="ajax"][src]', function(e) {
6
    e.preventDefault();
7
    $.ajax({
8
      url: $(this).attr('src'),
9
      method: 'POST',
10
      success: function(res) {
11
        console.log(res);
12
      }
13
    });
14
  });
15
});
16
17
/**
18
 * latest file
19
 * @param {HTMLElement} element
20
 */
21
function latest(element) {
22
  $.ajax({
23
    url: 'clean',
24
    method: 'POST',
25
    data: {
26
      latest: 'true'
27
    },
28
    success: function(res) {
29
      if (typeof res == 'object') {
30
        if (res.hasOwnProperty('result')) {
31
          element.innerHTML = res.result;
32
        }
33
      }
34
    }
35
  });
36
}

views/superuser/theme/index.js 1 location

@@ 1-36 (lines=36) @@
1
$(document).ready(function() {
2
  $('[onload]').each(function(i, el) {
3
    eval(el.getAttribute('onload'));
4
  });
5
  $(document).on('click', 'button[id="ajax"][src]', function(e) {
6
    e.preventDefault();
7
    $.ajax({
8
      url: $(this).attr('src'),
9
      method: 'POST',
10
      success: function(res) {
11
        console.log(res);
12
      }
13
    });
14
  });
15
});
16
17
/**
18
 * latest file
19
 * @param {HTMLElement} element
20
 */
21
function latest(element) {
22
  $.ajax({
23
    url: 'clean',
24
    method: 'POST',
25
    data: {
26
      latest: 'true'
27
    },
28
    success: function(res) {
29
      if (typeof res == 'object') {
30
        if (res.hasOwnProperty('result')) {
31
          element.innerHTML = res.result;
32
        }
33
      }
34
    }
35
  });
36
}