Commit f01994e1f85684e4c880ce0f0030cc729db8748b

Authored by Nihad Abbasov
1 parent 8c7caaa6

move assets from lib directory to vendor

[ci skip]
lib/assets/javascripts/branch-graph.js
... ... @@ -1,181 +0,0 @@
1   -var commits = {},
2   - comms = {},
3   - pixelsX = [],
4   - pixelsY = [],
5   - mmax = Math.max,
6   - mtime = 0,
7   - mspace = 0,
8   - parents = {},
9   - ii = 0,
10   - colors = ["#000"];
11   -
12   -function initGraph(){
13   - commits = chunk1.commits;
14   - ii = commits.length;
15   - for (var i = 0; i < ii; i++) {
16   - for (var j = 0, jj = commits[i].parents.length; j < jj; j++) {
17   - parents[commits[i].parents[j][0]] = true;
18   - }
19   - mtime = Math.max(mtime, commits[i].time);
20   - mspace = Math.max(mspace, commits[i].space);
21   - }
22   - mtime = mtime + 4;
23   - mspace = mspace + 10;
24   - for (i = 0; i < ii; i++) {
25   - if (commits[i].id in parents) {
26   - commits[i].isParent = true;
27   - }
28   - comms[commits[i].id] = commits[i];
29   - }
30   - for (var k = 0; k < mspace; k++) {
31   - colors.push(Raphael.getColor());
32   - }
33   -}
34   -
35   -function branchGraph(holder) {
36   - var ch = mspace * 20 + 20, cw = mtime * 20 + 20,
37   - r = Raphael("holder", cw, ch),
38   - top = r.set();
39   - var cuday = 0, cumonth = "";
40   - r.rect(0, 0, days.length * 20 + 80, 30).attr({fill: "#FFF"});
41   - r.rect(0, 30, days.length * 20 + 80, 20).attr({fill: "#f1f1f1"});
42   -
43   - for (mm = 0; mm < days.length; mm++) {
44   - if(days[mm] != null){
45   - if(cuday != days[mm][0]){
46   - r.text(10 + mm * 20, 40, days[mm][0]).attr({font: "14px Fontin-Sans, Arial", fill: "#444"});
47   - cuday = days[mm][0]
48   - }
49   - if(cumonth != days[mm][1]){
50   - r.text(10 + mm * 20, 15, days[mm][1]).attr({font: "14px Fontin-Sans, Arial", fill: "#474D57"});
51   - cumonth = days[mm][1]
52   - }
53   -
54   - }
55   - }
56   - for (i = 0; i < ii; i++) {
57   - var x = 10 + 20 * commits[i].time,
58   - y = 70 + 20 * commits[i].space;
59   - r.circle(x, y, 3).attr({fill: colors[commits[i].space], stroke: "none"});
60   - if (commits[i].refs != null && commits[i].refs != "") {
61   - var longrefs = commits[i].refs
62   - var shortrefs = commits[i].refs;
63   - if (shortrefs.length > 15){
64   - shortrefs = shortrefs.substr(0,13) + "...";
65   - }
66   - var t = r.text(x+5, y+5, shortrefs).attr({font: "12px Fontin-Sans, Arial", fill: "#666",
67   - title: longrefs, cursor: "pointer", rotation: "90"});
68   -
69   - var textbox = t.getBBox();
70   - t.translate(textbox.height/-4,textbox.width/2);
71   - }
72   - for (var j = 0, jj = commits[i].parents.length; j < jj; j++) {
73   - var c = comms[commits[i].parents[j][0]];
74   - if (c) {
75   - var cx = 10 + 20 * c.time,
76   - cy = 70 + 20 * c.space;
77   - if (c.space == commits[i].space) {
78   - r.path("M" + (x - 5) + "," + (y + .0001) + "L" + (15 + 20 * c.time) + "," + (y + .0001))
79   - .attr({stroke: colors[c.space], "stroke-width": 2});
80   -
81   - } else if (c.space < commits[i].space) {
82   - r.path(["M", x - 5, y + .0001, "l-5-2,0,4,5,-2C",x-5,y,x -17, y+2, x -20, y-10,"L", cx,y-10,cx , cy])
83   - .attr({stroke: colors[commits[i].space], "stroke-width": 2});
84   - } else {
85   - r.path(["M", x-5, y, "l-5-2,0,4,5,-2C",x-5,y,x -17, y-2, x -20, y+10,"L", cx,y+10,cx , cy])
86   - .attr({stroke: colors[commits[i].space], "stroke-width": 2});
87   - }
88   - }
89   - }
90   - (function (c, x, y) {
91   - top.push(r.circle(x, y, 10).attr({fill: "#000", opacity: 0, cursor: "pointer"})
92   - .click(function(){
93   - location.href = location.href.replace("graph", "commits/" + c.id);
94   - })
95   - .hover(function () {
96   - var s = r.text(100, 100,c.author + "\n \n" +c.id + "\n \n" + c.message).attr({fill: "#fff"});
97   - this.popup = r.popupit(x, y + 5, s, 0);
98   - top.push(this.popup.insertBefore(this));
99   - }, function () {
100   - this.popup && this.popup.remove() && delete this.popup;
101   - }));
102   - }(commits[i], x, y));
103   - }
104   - top.toFront();
105   - var hw = holder.offsetWidth,
106   - hh = holder.offsetHeight,
107   - v = r.rect(hw - 8, 0, 4, Math.pow(hh, 2) / ch, 2).attr({fill: "#000", opacity: 0}),
108   - h = r.rect(0, hh - 8, Math.pow(hw, 2) / cw, 4, 2).attr({fill: "#000", opacity: 0}),
109   - bars = r.set(v, h),
110   - drag,
111   - dragger = function (e) {
112   - if (drag) {
113   - e = e || window.event;
114   - holder.scrollLeft = drag.sl - (e.clientX - drag.x);
115   - holder.scrollTop = drag.st - (e.clientY - drag.y);
116   - }
117   - };
118   - holder.onmousedown = function (e) {
119   - e = e || window.event;
120   - drag = {x: e.clientX, y: e.clientY, st: holder.scrollTop, sl: holder.scrollLeft};
121   - document.onmousemove = dragger;
122   - bars.animate({opacity: .5}, 300);
123   - };
124   - document.onmouseup = function () {
125   - drag = false;
126   - document.onmousemove = null;
127   - bars.animate({opacity: 0}, 300);
128   - };
129   - holder.scrollLeft = cw;
130   -};
131   -Raphael.fn.popupit = function (x, y, set, dir, size) {
132   - dir = dir == null ? 2 : dir;
133   - size = size || 5;
134   - x = Math.round(x);
135   - y = Math.round(y);
136   - var bb = set.getBBox(),
137   - w = Math.round(bb.width / 2),
138   - h = Math.round(bb.height / 2),
139   - dx = [0, w + size * 2, 0, -w - size * 2],
140   - dy = [-h * 2 - size * 3, -h - size, 0, -h - size],
141   - p = ["M", x - dx[dir], y - dy[dir], "l", -size, (dir == 2) * -size, -mmax(w - size, 0), 0, "a", size, size, 0, 0, 1, -size, -size,
142   - "l", 0, -mmax(h - size, 0), (dir == 3) * -size, -size, (dir == 3) * size, -size, 0, -mmax(h - size, 0), "a", size, size, 0, 0, 1, size, -size,
143   - "l", mmax(w - size, 0), 0, size, !dir * -size, size, !dir * size, mmax(w - size, 0), 0, "a", size, size, 0, 0, 1, size, size,
144   - "l", 0, mmax(h - size, 0), (dir == 1) * size, size, (dir == 1) * -size, size, 0, mmax(h - size, 0), "a", size, size, 0, 0, 1, -size, size,
145   - "l", -mmax(w - size, 0), 0, "z"].join(","),
146   - xy = [{x: x, y: y + size * 2 + h}, {x: x - size * 2 - w, y: y}, {x: x, y: y - size * 2 - h}, {x: x + size * 2 + w, y: y}][dir];
147   - set.translate(xy.x - w - bb.x, xy.y - h - bb.y);
148   - return this.set(this.path(p).attr({fill: "#234", stroke: "none"}).insertBefore(set.node ? set : set[0]), set);
149   -};
150   -Raphael.fn.popup = function (x, y, text, dir, size) {
151   - dir = dir == null ? 2 : dir > 3 ? 3 : dir;
152   - size = size || 5;
153   - text = text || "$9.99";
154   - var res = this.set(),
155   - d = 3;
156   - res.push(this.path().attr({fill: "#000", stroke: "#000"}));
157   - res.push(this.text(x, y, text).attr(this.g.txtattr).attr({fill: "#fff", "font-family": "Helvetica, Arial"}));
158   - res.update = function (X, Y, withAnimation) {
159   - X = X || x;
160   - Y = Y || y;
161   - var bb = this[1].getBBox(),
162   - w = bb.width / 2,
163   - h = bb.height / 2,
164   - dx = [0, w + size * 2, 0, -w - size * 2],
165   - dy = [-h * 2 - size * 3, -h - size, 0, -h - size],
166   - p = ["M", X - dx[dir], Y - dy[dir], "l", -size, (dir == 2) * -size, -mmax(w - size, 0), 0, "a", size, size, 0, 0, 1, -size, -size,
167   - "l", 0, -mmax(h - size, 0), (dir == 3) * -size, -size, (dir == 3) * size, -size, 0, -mmax(h - size, 0), "a", size, size, 0, 0, 1, size, -size,
168   - "l", mmax(w - size, 0), 0, size, !dir * -size, size, !dir * size, mmax(w - size, 0), 0, "a", size, size, 0, 0, 1, size, size,
169   - "l", 0, mmax(h - size, 0), (dir == 1) * size, size, (dir == 1) * -size, size, 0, mmax(h - size, 0), "a", size, size, 0, 0, 1, -size, size,
170   - "l", -mmax(w - size, 0), 0, "z"].join(","),
171   - xy = [{x: X, y: Y + size * 2 + h}, {x: X - size * 2 - w, y: Y}, {x: X, y: Y - size * 2 - h}, {x: X + size * 2 + w, y: Y}][dir];
172   - xy.path = p;
173   - if (withAnimation) {
174   - this.animate(xy, 500, ">");
175   - } else {
176   - this.attr(xy);
177   - }
178   - return this;
179   - };
180   - return res.update(x, y);
181   -};
vendor/assets/javascripts/branch-graph.js 0 → 100644
... ... @@ -0,0 +1,181 @@
  1 +var commits = {},
  2 + comms = {},
  3 + pixelsX = [],
  4 + pixelsY = [],
  5 + mmax = Math.max,
  6 + mtime = 0,
  7 + mspace = 0,
  8 + parents = {},
  9 + ii = 0,
  10 + colors = ["#000"];
  11 +
  12 +function initGraph(){
  13 + commits = chunk1.commits;
  14 + ii = commits.length;
  15 + for (var i = 0; i < ii; i++) {
  16 + for (var j = 0, jj = commits[i].parents.length; j < jj; j++) {
  17 + parents[commits[i].parents[j][0]] = true;
  18 + }
  19 + mtime = Math.max(mtime, commits[i].time);
  20 + mspace = Math.max(mspace, commits[i].space);
  21 + }
  22 + mtime = mtime + 4;
  23 + mspace = mspace + 10;
  24 + for (i = 0; i < ii; i++) {
  25 + if (commits[i].id in parents) {
  26 + commits[i].isParent = true;
  27 + }
  28 + comms[commits[i].id] = commits[i];
  29 + }
  30 + for (var k = 0; k < mspace; k++) {
  31 + colors.push(Raphael.getColor());
  32 + }
  33 +}
  34 +
  35 +function branchGraph(holder) {
  36 + var ch = mspace * 20 + 20, cw = mtime * 20 + 20,
  37 + r = Raphael("holder", cw, ch),
  38 + top = r.set();
  39 + var cuday = 0, cumonth = "";
  40 + r.rect(0, 0, days.length * 20 + 80, 30).attr({fill: "#FFF"});
  41 + r.rect(0, 30, days.length * 20 + 80, 20).attr({fill: "#f1f1f1"});
  42 +
  43 + for (mm = 0; mm < days.length; mm++) {
  44 + if(days[mm] != null){
  45 + if(cuday != days[mm][0]){
  46 + r.text(10 + mm * 20, 40, days[mm][0]).attr({font: "14px Fontin-Sans, Arial", fill: "#444"});
  47 + cuday = days[mm][0]
  48 + }
  49 + if(cumonth != days[mm][1]){
  50 + r.text(10 + mm * 20, 15, days[mm][1]).attr({font: "14px Fontin-Sans, Arial", fill: "#474D57"});
  51 + cumonth = days[mm][1]
  52 + }
  53 +
  54 + }
  55 + }
  56 + for (i = 0; i < ii; i++) {
  57 + var x = 10 + 20 * commits[i].time,
  58 + y = 70 + 20 * commits[i].space;
  59 + r.circle(x, y, 3).attr({fill: colors[commits[i].space], stroke: "none"});
  60 + if (commits[i].refs != null && commits[i].refs != "") {
  61 + var longrefs = commits[i].refs
  62 + var shortrefs = commits[i].refs;
  63 + if (shortrefs.length > 15){
  64 + shortrefs = shortrefs.substr(0,13) + "...";
  65 + }
  66 + var t = r.text(x+5, y+5, shortrefs).attr({font: "12px Fontin-Sans, Arial", fill: "#666",
  67 + title: longrefs, cursor: "pointer", rotation: "90"});
  68 +
  69 + var textbox = t.getBBox();
  70 + t.translate(textbox.height/-4,textbox.width/2);
  71 + }
  72 + for (var j = 0, jj = commits[i].parents.length; j < jj; j++) {
  73 + var c = comms[commits[i].parents[j][0]];
  74 + if (c) {
  75 + var cx = 10 + 20 * c.time,
  76 + cy = 70 + 20 * c.space;
  77 + if (c.space == commits[i].space) {
  78 + r.path("M" + (x - 5) + "," + (y + .0001) + "L" + (15 + 20 * c.time) + "," + (y + .0001))
  79 + .attr({stroke: colors[c.space], "stroke-width": 2});
  80 +
  81 + } else if (c.space < commits[i].space) {
  82 + r.path(["M", x - 5, y + .0001, "l-5-2,0,4,5,-2C",x-5,y,x -17, y+2, x -20, y-10,"L", cx,y-10,cx , cy])
  83 + .attr({stroke: colors[commits[i].space], "stroke-width": 2});
  84 + } else {
  85 + r.path(["M", x-5, y, "l-5-2,0,4,5,-2C",x-5,y,x -17, y-2, x -20, y+10,"L", cx,y+10,cx , cy])
  86 + .attr({stroke: colors[commits[i].space], "stroke-width": 2});
  87 + }
  88 + }
  89 + }
  90 + (function (c, x, y) {
  91 + top.push(r.circle(x, y, 10).attr({fill: "#000", opacity: 0, cursor: "pointer"})
  92 + .click(function(){
  93 + location.href = location.href.replace("graph", "commits/" + c.id);
  94 + })
  95 + .hover(function () {
  96 + var s = r.text(100, 100,c.author + "\n \n" +c.id + "\n \n" + c.message).attr({fill: "#fff"});
  97 + this.popup = r.popupit(x, y + 5, s, 0);
  98 + top.push(this.popup.insertBefore(this));
  99 + }, function () {
  100 + this.popup && this.popup.remove() && delete this.popup;
  101 + }));
  102 + }(commits[i], x, y));
  103 + }
  104 + top.toFront();
  105 + var hw = holder.offsetWidth,
  106 + hh = holder.offsetHeight,
  107 + v = r.rect(hw - 8, 0, 4, Math.pow(hh, 2) / ch, 2).attr({fill: "#000", opacity: 0}),
  108 + h = r.rect(0, hh - 8, Math.pow(hw, 2) / cw, 4, 2).attr({fill: "#000", opacity: 0}),
  109 + bars = r.set(v, h),
  110 + drag,
  111 + dragger = function (e) {
  112 + if (drag) {
  113 + e = e || window.event;
  114 + holder.scrollLeft = drag.sl - (e.clientX - drag.x);
  115 + holder.scrollTop = drag.st - (e.clientY - drag.y);
  116 + }
  117 + };
  118 + holder.onmousedown = function (e) {
  119 + e = e || window.event;
  120 + drag = {x: e.clientX, y: e.clientY, st: holder.scrollTop, sl: holder.scrollLeft};
  121 + document.onmousemove = dragger;
  122 + bars.animate({opacity: .5}, 300);
  123 + };
  124 + document.onmouseup = function () {
  125 + drag = false;
  126 + document.onmousemove = null;
  127 + bars.animate({opacity: 0}, 300);
  128 + };
  129 + holder.scrollLeft = cw;
  130 +};
  131 +Raphael.fn.popupit = function (x, y, set, dir, size) {
  132 + dir = dir == null ? 2 : dir;
  133 + size = size || 5;
  134 + x = Math.round(x);
  135 + y = Math.round(y);
  136 + var bb = set.getBBox(),
  137 + w = Math.round(bb.width / 2),
  138 + h = Math.round(bb.height / 2),
  139 + dx = [0, w + size * 2, 0, -w - size * 2],
  140 + dy = [-h * 2 - size * 3, -h - size, 0, -h - size],
  141 + p = ["M", x - dx[dir], y - dy[dir], "l", -size, (dir == 2) * -size, -mmax(w - size, 0), 0, "a", size, size, 0, 0, 1, -size, -size,
  142 + "l", 0, -mmax(h - size, 0), (dir == 3) * -size, -size, (dir == 3) * size, -size, 0, -mmax(h - size, 0), "a", size, size, 0, 0, 1, size, -size,
  143 + "l", mmax(w - size, 0), 0, size, !dir * -size, size, !dir * size, mmax(w - size, 0), 0, "a", size, size, 0, 0, 1, size, size,
  144 + "l", 0, mmax(h - size, 0), (dir == 1) * size, size, (dir == 1) * -size, size, 0, mmax(h - size, 0), "a", size, size, 0, 0, 1, -size, size,
  145 + "l", -mmax(w - size, 0), 0, "z"].join(","),
  146 + xy = [{x: x, y: y + size * 2 + h}, {x: x - size * 2 - w, y: y}, {x: x, y: y - size * 2 - h}, {x: x + size * 2 + w, y: y}][dir];
  147 + set.translate(xy.x - w - bb.x, xy.y - h - bb.y);
  148 + return this.set(this.path(p).attr({fill: "#234", stroke: "none"}).insertBefore(set.node ? set : set[0]), set);
  149 +};
  150 +Raphael.fn.popup = function (x, y, text, dir, size) {
  151 + dir = dir == null ? 2 : dir > 3 ? 3 : dir;
  152 + size = size || 5;
  153 + text = text || "$9.99";
  154 + var res = this.set(),
  155 + d = 3;
  156 + res.push(this.path().attr({fill: "#000", stroke: "#000"}));
  157 + res.push(this.text(x, y, text).attr(this.g.txtattr).attr({fill: "#fff", "font-family": "Helvetica, Arial"}));
  158 + res.update = function (X, Y, withAnimation) {
  159 + X = X || x;
  160 + Y = Y || y;
  161 + var bb = this[1].getBBox(),
  162 + w = bb.width / 2,
  163 + h = bb.height / 2,
  164 + dx = [0, w + size * 2, 0, -w - size * 2],
  165 + dy = [-h * 2 - size * 3, -h - size, 0, -h - size],
  166 + p = ["M", X - dx[dir], Y - dy[dir], "l", -size, (dir == 2) * -size, -mmax(w - size, 0), 0, "a", size, size, 0, 0, 1, -size, -size,
  167 + "l", 0, -mmax(h - size, 0), (dir == 3) * -size, -size, (dir == 3) * size, -size, 0, -mmax(h - size, 0), "a", size, size, 0, 0, 1, size, -size,
  168 + "l", mmax(w - size, 0), 0, size, !dir * -size, size, !dir * size, mmax(w - size, 0), 0, "a", size, size, 0, 0, 1, size, size,
  169 + "l", 0, mmax(h - size, 0), (dir == 1) * size, size, (dir == 1) * -size, size, 0, mmax(h - size, 0), "a", size, size, 0, 0, 1, -size, size,
  170 + "l", -mmax(w - size, 0), 0, "z"].join(","),
  171 + xy = [{x: X, y: Y + size * 2 + h}, {x: X - size * 2 - w, y: Y}, {x: X, y: Y - size * 2 - h}, {x: X + size * 2 + w, y: Y}][dir];
  172 + xy.path = p;
  173 + if (withAnimation) {
  174 + this.animate(xy, 500, ">");
  175 + } else {
  176 + this.attr(xy);
  177 + }
  178 + return this;
  179 + };
  180 + return res.update(x, y);
  181 +};
... ...