##// END OF EJS Templates
inline comments gui
marcink -
r1683:28eeddf8 beta
parent child Browse files
Show More
@@ -1,129 +1,146 b''
1 div.diffblock {
1 div.diffblock {
2 overflow: auto;
2 overflow: auto;
3 padding: 0px;
3 padding: 0px;
4 border: 1px solid #ccc;
4 border: 1px solid #ccc;
5 background: #f8f8f8;
5 background: #f8f8f8;
6 font-size: 100%;
6 font-size: 100%;
7 line-height: 100%;
7 line-height: 100%;
8 /* new */
8 /* new */
9 line-height: 125%;
9 line-height: 125%;
10 }
10 }
11
11
12 div.diffblock.margined{
12 div.diffblock.margined{
13 margin: 0px 20px 0px 20px;
13 margin: 0px 20px 0px 20px;
14 }
14 }
15
15
16 div.diffblock .code-header{
16 div.diffblock .code-header{
17 border-bottom: 1px solid #CCCCCC;
17 border-bottom: 1px solid #CCCCCC;
18 background: #EEEEEE;
18 background: #EEEEEE;
19 padding:10px 0 10px 0;
19 padding:10px 0 10px 0;
20 }
20 }
21 div.diffblock .code-header div{
21 div.diffblock .code-header div{
22 margin-left:25px;
22 margin-left:25px;
23 font-weight: bold;
23 font-weight: bold;
24 }
24 }
25 div.diffblock .code-body{
25 div.diffblock .code-body{
26 background: #FFFFFF;
26 background: #FFFFFF;
27 }
27 }
28 div.diffblock pre.raw{
28 div.diffblock pre.raw{
29 background: #FFFFFF;
29 background: #FFFFFF;
30 color:#000000;
30 color:#000000;
31 }
31 }
32
32
33 table.code-difftable{
33 table.code-difftable{
34 border-collapse: collapse;
34 border-collapse: collapse;
35 width: 99%;
35 width: 99%;
36 }
36 }
37
37
38 table.code-difftable td {
38 table.code-difftable td {
39 padding: 0 !important;
39 padding: 0 !important;
40 background: none !important;
40 background: none !important;
41 border:0 !important;
41 border:0 !important;
42 }
42 }
43
43
44
44
45 .code-difftable .context{
45 .code-difftable .context{
46 background:none repeat scroll 0 0 #DDE7EF;
46 background:none repeat scroll 0 0 #DDE7EF;
47 }
47 }
48 .code-difftable .add{
48 .code-difftable .add{
49 background:none repeat scroll 0 0 #DDFFDD;
49 background:none repeat scroll 0 0 #DDFFDD;
50 }
50 }
51 .code-difftable .add ins{
51 .code-difftable .add ins{
52 background:none repeat scroll 0 0 #AAFFAA;
52 background:none repeat scroll 0 0 #AAFFAA;
53 text-decoration:none;
53 text-decoration:none;
54 }
54 }
55
55
56 .code-difftable .del{
56 .code-difftable .del{
57 background:none repeat scroll 0 0 #FFDDDD;
57 background:none repeat scroll 0 0 #FFDDDD;
58 }
58 }
59 .code-difftable .del del{
59 .code-difftable .del del{
60 background:none repeat scroll 0 0 #FFAAAA;
60 background:none repeat scroll 0 0 #FFAAAA;
61 text-decoration:none;
61 text-decoration:none;
62 }
62 }
63
63
64 .code-difftable .lineno{
64 .code-difftable .lineno{
65 background:none repeat scroll 0 0 #EEEEEE !important;
65 background:none repeat scroll 0 0 #EEEEEE !important;
66 padding-left:2px;
66 padding-left:2px;
67 padding-right:2px;
67 padding-right:2px;
68 text-align:right;
68 text-align:right;
69 width:30px;
69 width:30px;
70 -moz-user-select:none;
70 -moz-user-select:none;
71 -webkit-user-select: none;
71 -webkit-user-select: none;
72 }
72 }
73 .code-difftable .lineno-inline{
74 background:none repeat scroll 0 0 #FFF !important;
75 padding-left:2px;
76 padding-right:2px;
77 text-align:right;
78 width:30px;
79 -moz-user-select:none;
80 -webkit-user-select: none;
81 }
73 .code-difftable .new {
82 .code-difftable .new {
74 border-right: 1px solid #CCC !important;
83 border-right: 1px solid #CCC !important;
75 }
84 }
76 .code-difftable .old {
85 .code-difftable .old {
77 border-right: 1px solid #CCC !important;
86 border-right: 1px solid #CCC !important;
78 }
87 }
88
89 .code-difftable .lineno-inline.new-inline{
90
91 }
92 .code-difftable .lineno-inline.old-inline{
93 border-right: 1px solid #CCC !important;
94 }
95
79 .code-difftable .lineno pre{
96 .code-difftable .lineno pre{
80 color:#747474 !important;
97 color:#747474 !important;
81 font:11px "Bitstream Vera Sans Mono",Monaco,"Courier New",Courier,monospace !important;
98 font:11px "Bitstream Vera Sans Mono",Monaco,"Courier New",Courier,monospace !important;
82 letter-spacing:-1px;
99 letter-spacing:-1px;
83 text-align:right;
100 text-align:right;
84 width:20px;
101 width:20px;
85 }
102 }
86 .code-difftable .lineno a{
103 .code-difftable .lineno a{
87 font-weight: 700;
104 font-weight: 700;
88 cursor: pointer;
105 cursor: pointer;
89 }
106 }
90 .code-difftable .code td{
107 .code-difftable .code td{
91 margin:0;
108 margin:0;
92 padding: 0;
109 padding: 0;
93 }
110 }
94 .code-difftable .code pre{
111 .code-difftable .code pre{
95 margin:0;
112 margin:0;
96 padding:0;
113 padding:0;
97 }
114 }
98
115
99 .code {
116 .code {
100 display: block;
117 display: block;
101 width: 100%;
118 width: 100%;
102 }
119 }
103 .code-diff {
120 .code-diff {
104 padding: 0px;
121 padding: 0px;
105 margin-top: 5px;
122 margin-top: 5px;
106 margin-bottom: 5px;
123 margin-bottom: 5px;
107 border-left: 2px solid #ccc;
124 border-left: 2px solid #ccc;
108 }
125 }
109 .code-diff pre, .line pre {
126 .code-diff pre, .line pre {
110 padding: 3px;
127 padding: 3px;
111 margin: 0;
128 margin: 0;
112 }
129 }
113 .lineno a {
130 .lineno a {
114 text-decoration: none;
131 text-decoration: none;
115 }
132 }
116
133
117 .line{
134 .line{
118 padding:0;
135 padding:0;
119 margin:0;
136 margin:0;
120 }
137 }
121
138
122 .line.highlight{
139 .line.highlight{
123 background-color:#FFFFCC;
140 background-color:#FFFFCC;
124 cursor: pointer;
141 cursor: pointer;
125 background-image:url("../images/icons/comment_add.png");
142 background-image:url("../images/icons/comment_add.png");
126 background-repeat:no-repeat;
143 background-repeat:no-repeat;
127 background-position: right;
144 background-position: right;
128 background-position: 100% 50%;
145 background-position: 100% 50%;
129 }
146 }
@@ -1,343 +1,343 b''
1 /**
1 /**
2 RhodeCode JS Files
2 RhodeCode JS Files
3 **/
3 **/
4
4
5 if (typeof console == "undefined" || typeof console.log == "undefined"){
5 if (typeof console == "undefined" || typeof console.log == "undefined"){
6 console = { log: function() {} }
6 console = { log: function() {} }
7 }
7 }
8
8
9
9
10 function str_repeat(i, m) {
10 function str_repeat(i, m) {
11 for (var o = []; m > 0; o[--m] = i);
11 for (var o = []; m > 0; o[--m] = i);
12 return o.join('');
12 return o.join('');
13 }
13 }
14
14
15 /**
15 /**
16 * INJECT .format function into String
16 * INJECT .format function into String
17 * Usage: "My name is {0} {1}".format("Johny","Bravo")
17 * Usage: "My name is {0} {1}".format("Johny","Bravo")
18 * Return "My name is Johny Bravo"
18 * Return "My name is Johny Bravo"
19 * Inspired by https://gist.github.com/1049426
19 * Inspired by https://gist.github.com/1049426
20 */
20 */
21 String.prototype.format = function() {
21 String.prototype.format = function() {
22
22
23 function format() {
23 function format() {
24 var str = this;
24 var str = this;
25 var len = arguments.length+1;
25 var len = arguments.length+1;
26 var safe = undefined;
26 var safe = undefined;
27 var arg = undefined;
27 var arg = undefined;
28
28
29 // For each {0} {1} {n...} replace with the argument in that position. If
29 // For each {0} {1} {n...} replace with the argument in that position. If
30 // the argument is an object or an array it will be stringified to JSON.
30 // the argument is an object or an array it will be stringified to JSON.
31 for (var i=0; i < len; arg = arguments[i++]) {
31 for (var i=0; i < len; arg = arguments[i++]) {
32 safe = typeof arg === 'object' ? JSON.stringify(arg) : arg;
32 safe = typeof arg === 'object' ? JSON.stringify(arg) : arg;
33 str = str.replace(RegExp('\\{'+(i-1)+'\\}', 'g'), safe);
33 str = str.replace(RegExp('\\{'+(i-1)+'\\}', 'g'), safe);
34 }
34 }
35 return str;
35 return str;
36 }
36 }
37
37
38 // Save a reference of what may already exist under the property native.
38 // Save a reference of what may already exist under the property native.
39 // Allows for doing something like: if("".format.native) { /* use native */ }
39 // Allows for doing something like: if("".format.native) { /* use native */ }
40 format.native = String.prototype.format;
40 format.native = String.prototype.format;
41
41
42 // Replace the prototype property
42 // Replace the prototype property
43 return format;
43 return format;
44
44
45 }();
45 }();
46
46
47
47
48 /**
48 /**
49 * SmartColorGenerator
49 * SmartColorGenerator
50 *
50 *
51 *usage::
51 *usage::
52 * var CG = new ColorGenerator();
52 * var CG = new ColorGenerator();
53 * var col = CG.getColor(key); //returns array of RGB
53 * var col = CG.getColor(key); //returns array of RGB
54 * 'rgb({0})'.format(col.join(',')
54 * 'rgb({0})'.format(col.join(',')
55 *
55 *
56 * @returns {ColorGenerator}
56 * @returns {ColorGenerator}
57 */
57 */
58 function ColorGenerator(){
58 function ColorGenerator(){
59 this.GOLDEN_RATIO = 0.618033988749895;
59 this.GOLDEN_RATIO = 0.618033988749895;
60 this.CURRENT_RATIO = 0.22717784590367374 // this can be random
60 this.CURRENT_RATIO = 0.22717784590367374 // this can be random
61 this.HSV_1 = 0.75;//saturation
61 this.HSV_1 = 0.75;//saturation
62 this.HSV_2 = 0.95;
62 this.HSV_2 = 0.95;
63 this.color;
63 this.color;
64 this.cacheColorMap = {};
64 this.cacheColorMap = {};
65 };
65 };
66
66
67 ColorGenerator.prototype = {
67 ColorGenerator.prototype = {
68 getColor:function(key){
68 getColor:function(key){
69 if(this.cacheColorMap[key] !== undefined){
69 if(this.cacheColorMap[key] !== undefined){
70 return this.cacheColorMap[key];
70 return this.cacheColorMap[key];
71 }
71 }
72 else{
72 else{
73 this.cacheColorMap[key] = this.generateColor();
73 this.cacheColorMap[key] = this.generateColor();
74 return this.cacheColorMap[key];
74 return this.cacheColorMap[key];
75 }
75 }
76 },
76 },
77 _hsvToRgb:function(h,s,v){
77 _hsvToRgb:function(h,s,v){
78 if (s == 0.0)
78 if (s == 0.0)
79 return [v, v, v];
79 return [v, v, v];
80 i = parseInt(h * 6.0)
80 i = parseInt(h * 6.0)
81 f = (h * 6.0) - i
81 f = (h * 6.0) - i
82 p = v * (1.0 - s)
82 p = v * (1.0 - s)
83 q = v * (1.0 - s * f)
83 q = v * (1.0 - s * f)
84 t = v * (1.0 - s * (1.0 - f))
84 t = v * (1.0 - s * (1.0 - f))
85 i = i % 6
85 i = i % 6
86 if (i == 0)
86 if (i == 0)
87 return [v, t, p]
87 return [v, t, p]
88 if (i == 1)
88 if (i == 1)
89 return [q, v, p]
89 return [q, v, p]
90 if (i == 2)
90 if (i == 2)
91 return [p, v, t]
91 return [p, v, t]
92 if (i == 3)
92 if (i == 3)
93 return [p, q, v]
93 return [p, q, v]
94 if (i == 4)
94 if (i == 4)
95 return [t, p, v]
95 return [t, p, v]
96 if (i == 5)
96 if (i == 5)
97 return [v, p, q]
97 return [v, p, q]
98 },
98 },
99 generateColor:function(){
99 generateColor:function(){
100 this.CURRENT_RATIO = this.CURRENT_RATIO+this.GOLDEN_RATIO;
100 this.CURRENT_RATIO = this.CURRENT_RATIO+this.GOLDEN_RATIO;
101 this.CURRENT_RATIO = this.CURRENT_RATIO %= 1;
101 this.CURRENT_RATIO = this.CURRENT_RATIO %= 1;
102 HSV_tuple = [this.CURRENT_RATIO, this.HSV_1, this.HSV_2]
102 HSV_tuple = [this.CURRENT_RATIO, this.HSV_1, this.HSV_2]
103 RGB_tuple = this._hsvToRgb(HSV_tuple[0],HSV_tuple[1],HSV_tuple[2]);
103 RGB_tuple = this._hsvToRgb(HSV_tuple[0],HSV_tuple[1],HSV_tuple[2]);
104 function toRgb(v){
104 function toRgb(v){
105 return ""+parseInt(v*256)
105 return ""+parseInt(v*256)
106 }
106 }
107 return [toRgb(RGB_tuple[0]),toRgb(RGB_tuple[1]),toRgb(RGB_tuple[2])];
107 return [toRgb(RGB_tuple[0]),toRgb(RGB_tuple[1]),toRgb(RGB_tuple[2])];
108
108
109 }
109 }
110 }
110 }
111
111
112
112
113
113
114
114
115
115
116 /**
116 /**
117 * GLOBAL YUI Shortcuts
117 * GLOBAL YUI Shortcuts
118 */
118 */
119 var YUC = YAHOO.util.Connect;
119 var YUC = YAHOO.util.Connect;
120 var YUD = YAHOO.util.Dom;
120 var YUD = YAHOO.util.Dom;
121 var YUE = YAHOO.util.Event;
121 var YUE = YAHOO.util.Event;
122 var YUQ = YAHOO.util.Selector.query;
122 var YUQ = YAHOO.util.Selector.query;
123
123
124 // defines if push state is enabled for this browser ?
124 // defines if push state is enabled for this browser ?
125 var push_state_enabled = Boolean(
125 var push_state_enabled = Boolean(
126 window.history && window.history.pushState && window.history.replaceState
126 window.history && window.history.pushState && window.history.replaceState
127 && !( /* disable for versions of iOS before version 4.3 (8F190) */
127 && !( /* disable for versions of iOS before version 4.3 (8F190) */
128 (/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent)
128 (/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent)
129 /* disable for the mercury iOS browser, or at least older versions of the webkit engine */
129 /* disable for the mercury iOS browser, or at least older versions of the webkit engine */
130 || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent)
130 || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent)
131 )
131 )
132 )
132 )
133
133
134 /**
134 /**
135 * Partial Ajax Implementation
135 * Partial Ajax Implementation
136 *
136 *
137 * @param url: defines url to make partial request
137 * @param url: defines url to make partial request
138 * @param container: defines id of container to input partial result
138 * @param container: defines id of container to input partial result
139 * @param s_call: success callback function that takes o as arg
139 * @param s_call: success callback function that takes o as arg
140 * o.tId
140 * o.tId
141 * o.status
141 * o.status
142 * o.statusText
142 * o.statusText
143 * o.getResponseHeader[ ]
143 * o.getResponseHeader[ ]
144 * o.getAllResponseHeaders
144 * o.getAllResponseHeaders
145 * o.responseText
145 * o.responseText
146 * o.responseXML
146 * o.responseXML
147 * o.argument
147 * o.argument
148 * @param f_call: failure callback
148 * @param f_call: failure callback
149 * @param args arguments
149 * @param args arguments
150 */
150 */
151 function ypjax(url,container,s_call,f_call,args){
151 function ypjax(url,container,s_call,f_call,args){
152 var method='GET';
152 var method='GET';
153 if(args===undefined){
153 if(args===undefined){
154 args=null;
154 args=null;
155 }
155 }
156
156
157 // Set special header for partial ajax == HTTP_X_PARTIAL_XHR
157 // Set special header for partial ajax == HTTP_X_PARTIAL_XHR
158 YUC.initHeader('X-PARTIAL-XHR',true);
158 YUC.initHeader('X-PARTIAL-XHR',true);
159
159
160 // wrapper of passed callback
160 // wrapper of passed callback
161 var s_wrapper = (function(o){
161 var s_wrapper = (function(o){
162 return function(o){
162 return function(o){
163 YUD.get(container).innerHTML=o.responseText;
163 YUD.get(container).innerHTML=o.responseText;
164 YUD.setStyle(container,'opacity','1.0');
164 YUD.setStyle(container,'opacity','1.0');
165 //execute the given original callback
165 //execute the given original callback
166 if (s_call !== undefined){
166 if (s_call !== undefined){
167 s_call(o);
167 s_call(o);
168 }
168 }
169 }
169 }
170 })()
170 })()
171 YUD.setStyle(container,'opacity','0.3');
171 YUD.setStyle(container,'opacity','0.3');
172 YUC.asyncRequest(method,url,{
172 YUC.asyncRequest(method,url,{
173 success:s_wrapper,
173 success:s_wrapper,
174 failure:function(o){
174 failure:function(o){
175 console.log(o);
175 console.log(o);
176 YUD.get(container).innerHTML='ERROR';
176 YUD.get(container).innerHTML='ERROR';
177 YUD.setStyle(container,'opacity','1.0');
177 YUD.setStyle(container,'opacity','1.0');
178 YUD.setStyle(container,'color','red');
178 YUD.setStyle(container,'color','red');
179 }
179 }
180 },args);
180 },args);
181
181
182 }
182 }
183
183
184 /**
184 /**
185 * tooltip activate
185 * tooltip activate
186 */
186 */
187 var tooltip_activate = function(){
187 var tooltip_activate = function(){
188 function toolTipsId(){
188 function toolTipsId(){
189 var ids = [];
189 var ids = [];
190 var tts = YUQ('.tooltip');
190 var tts = YUQ('.tooltip');
191 for (var i = 0; i < tts.length; i++) {
191 for (var i = 0; i < tts.length; i++) {
192 // if element doesn't not have and id
192 // if element doesn't not have and id
193 // autogenerate one for tooltip
193 // autogenerate one for tooltip
194 if (!tts[i].id){
194 if (!tts[i].id){
195 tts[i].id='tt'+((i*100)+tts.length);
195 tts[i].id='tt'+((i*100)+tts.length);
196 }
196 }
197 ids.push(tts[i].id);
197 ids.push(tts[i].id);
198 }
198 }
199 return ids
199 return ids
200 };
200 };
201 var myToolTips = new YAHOO.widget.Tooltip("tooltip", {
201 var myToolTips = new YAHOO.widget.Tooltip("tooltip", {
202 context: [[toolTipsId()],"tl","bl",null,[0,5]],
202 context: [[toolTipsId()],"tl","bl",null,[0,5]],
203 monitorresize:false,
203 monitorresize:false,
204 xyoffset :[0,0],
204 xyoffset :[0,0],
205 autodismissdelay:300000,
205 autodismissdelay:300000,
206 hidedelay:5,
206 hidedelay:5,
207 showdelay:20,
207 showdelay:20,
208 });
208 });
209 }
209 }
210
210
211 /**
211 /**
212 * show more
212 * show more
213 */
213 */
214 var show_more_event = function(){
214 var show_more_event = function(){
215 YUE.on(YUD.getElementsByClassName('show_more'),'click',function(e){
215 YUE.on(YUD.getElementsByClassName('show_more'),'click',function(e){
216 var el = e.target;
216 var el = e.target;
217 YUD.setStyle(YUD.get(el.id.substring(1)),'display','');
217 YUD.setStyle(YUD.get(el.id.substring(1)),'display','');
218 YUD.setStyle(el.parentNode,'display','none');
218 YUD.setStyle(el.parentNode,'display','none');
219 });
219 });
220 }
220 }
221
221
222
222
223 /**
223 /**
224 * Quick filter widget
224 * Quick filter widget
225 *
225 *
226 * @param target: filter input target
226 * @param target: filter input target
227 * @param nodes: list of nodes in html we want to filter.
227 * @param nodes: list of nodes in html we want to filter.
228 * @param display_element function that takes current node from nodes and
228 * @param display_element function that takes current node from nodes and
229 * does hide or show based on the node
229 * does hide or show based on the node
230 *
230 *
231 */
231 */
232 var q_filter = function(target,nodes,display_element){
232 var q_filter = function(target,nodes,display_element){
233
233
234 var nodes = nodes;
234 var nodes = nodes;
235 var q_filter_field = YUD.get(target);
235 var q_filter_field = YUD.get(target);
236 var F = YAHOO.namespace(target);
236 var F = YAHOO.namespace(target);
237
237
238 YUE.on(q_filter_field,'click',function(){
238 YUE.on(q_filter_field,'click',function(){
239 q_filter_field.value = '';
239 q_filter_field.value = '';
240 });
240 });
241
241
242 YUE.on(q_filter_field,'keyup',function(e){
242 YUE.on(q_filter_field,'keyup',function(e){
243 clearTimeout(F.filterTimeout);
243 clearTimeout(F.filterTimeout);
244 F.filterTimeout = setTimeout(F.updateFilter,600);
244 F.filterTimeout = setTimeout(F.updateFilter,600);
245 });
245 });
246
246
247 F.filterTimeout = null;
247 F.filterTimeout = null;
248
248
249 var show_node = function(node){
249 var show_node = function(node){
250 YUD.setStyle(node,'display','')
250 YUD.setStyle(node,'display','')
251 }
251 }
252 var hide_node = function(node){
252 var hide_node = function(node){
253 YUD.setStyle(node,'display','none');
253 YUD.setStyle(node,'display','none');
254 }
254 }
255
255
256 F.updateFilter = function() {
256 F.updateFilter = function() {
257 // Reset timeout
257 // Reset timeout
258 F.filterTimeout = null;
258 F.filterTimeout = null;
259
259
260 var obsolete = [];
260 var obsolete = [];
261
261
262 var req = q_filter_field.value.toLowerCase();
262 var req = q_filter_field.value.toLowerCase();
263
263
264 var l = nodes.length;
264 var l = nodes.length;
265 var i;
265 var i;
266 var showing = 0;
266 var showing = 0;
267
267
268 for (i=0;i<l;i++ ){
268 for (i=0;i<l;i++ ){
269 var n = nodes[i];
269 var n = nodes[i];
270 var target_element = display_element(n)
270 var target_element = display_element(n)
271 if(req && n.innerHTML.toLowerCase().indexOf(req) == -1){
271 if(req && n.innerHTML.toLowerCase().indexOf(req) == -1){
272 hide_node(target_element);
272 hide_node(target_element);
273 }
273 }
274 else{
274 else{
275 show_node(target_element);
275 show_node(target_element);
276 showing+=1;
276 showing+=1;
277 }
277 }
278 }
278 }
279
279
280 // if repo_count is set update the number
280 // if repo_count is set update the number
281 var cnt = YUD.get('repo_count');
281 var cnt = YUD.get('repo_count');
282 if(cnt){
282 if(cnt){
283 YUD.get('repo_count').innerHTML = showing;
283 YUD.get('repo_count').innerHTML = showing;
284 }
284 }
285
285
286 }
286 }
287 }
287 }
288
288
289 var ajaxPOST = function(url,postData,success) {
289 var ajaxPOST = function(url,postData,success) {
290 var sUrl = url;
290 var sUrl = url;
291 var callback = {
291 var callback = {
292 success: success,
292 success: success,
293 failure: function (o) {
293 failure: function (o) {
294 alert("error");
294 alert("error");
295 },
295 },
296 };
296 };
297 var postData = postData;
297 var postData = postData;
298 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
298 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
299 };
299 };
300
300
301
301
302 /** comments **/
302 /** comments **/
303 var removeInlineForm = function(form) {
303 var removeInlineForm = function(form) {
304 form.parentNode.removeChild(form);
304 form.parentNode.removeChild(form);
305 }
305 }
306
306
307 var tableTr = function(cls,body){
307 var tableTr = function(cls,body){
308 var form = document.createElement('tr');
308 var form = document.createElement('tr');
309 YUD.addClass(form, cls);
309 YUD.addClass(form, cls);
310 form.innerHTML = '<td class="lineno new"></td>'+
310 form.innerHTML = '<td class="lineno-inline new-inline"></td>'+
311 '<td class="lineno old"></td>'+
311 '<td class="lineno-inline old-inline"></td>'+
312 '<td>{0}</td>'.format(body);
312 '<td>{0}</td>'.format(body);
313 return form;
313 return form;
314 }
314 }
315
315
316 var createInlineForm = function(parent_tr, f_path, line) {
316 var createInlineForm = function(parent_tr, f_path, line) {
317 var tmpl = YUD.get('comment-inline-form-template').innerHTML;
317 var tmpl = YUD.get('comment-inline-form-template').innerHTML;
318 tmpl = tmpl.format(f_path, line);
318 tmpl = tmpl.format(f_path, line);
319 var form = tableTr('comment-form-inline',tmpl)
319 var form = tableTr('comment-form-inline',tmpl)
320
320
321 // create event for hide button
321 // create event for hide button
322 form = new YAHOO.util.Element(form);
322 form = new YAHOO.util.Element(form);
323 var form_hide_button = new YAHOO.util.Element(form.getElementsByClassName('hide-inline-form')[0]);
323 var form_hide_button = new YAHOO.util.Element(form.getElementsByClassName('hide-inline-form')[0]);
324 form_hide_button.on('click', function(e) {
324 form_hide_button.on('click', function(e) {
325 var newtr = e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode;
325 var newtr = e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode;
326 removeInlineForm(newtr);
326 removeInlineForm(newtr);
327 YUD.removeClass(parent_tr, 'form-open');
327 YUD.removeClass(parent_tr, 'form-open');
328 });
328 });
329 return form
329 return form
330 }
330 }
331 var getLineNo = function(tr) {
331 var getLineNo = function(tr) {
332 var line;
332 var line;
333 var o = tr.children[0].id.split('_');
333 var o = tr.children[0].id.split('_');
334 var n = tr.children[1].id.split('_');
334 var n = tr.children[1].id.split('_');
335
335
336 if (n.length >= 2) {
336 if (n.length >= 2) {
337 line = n[n.length-1];
337 line = n[n.length-1];
338 } else if (o.length >= 2) {
338 } else if (o.length >= 2) {
339 line = o[n.length-1];
339 line = o[n.length-1];
340 }
340 }
341
341
342 return line
342 return line
343 } No newline at end of file
343 }
General Comments 0
You need to be logged in to leave comments. Login now