Completed
Push — master ( c92530...d282cd )
by Dimas
15:54
created

views/superuser/theme/index.js   A

Complexity

Total Complexity 9
Complexity/F 1.29

Size

Lines of Code 40
Function Count 7

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 22
dl 0
loc 40
rs 10
c 0
b 0
f 0
wmc 9
mnd 2
bc 2
fnc 7
bpm 0.2857
cpm 1.2857
noi 2

2 Functions

Rating   Name   Duplication   Size   Complexity  
B index.js ➔ latest 0 16 8
A index.js ➔ genCacheKey 0 3 1
1
$(document).ready(function () {
2
  $("[onload]").each(function (i, el) {
3
    eval(el.getAttribute("onload"));
0 ignored issues
show
Security Performance introduced by
Calls to eval are slow and potentially dangerous, especially on untrusted code. Please consider whether there is another way to achieve your goal.
Loading history...
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);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
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
}
37
38
function genCacheKey() {
39
  $("#keyCache").val(guid());
40
}
41