Mercurial > kallithea
annotate rhodecode/public/js/rhodecode.js @ 1772:c83d3d42ab92 beta
- diff.css merge to main style.css
- css fixes for diffs
- JS fixes for diff and inline comments
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 10 Dec 2011 00:48:05 +0200 |
parents | d6c6ea17b100 |
children | defcf245f3e9 |
rev | line source |
---|---|
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
1 /** |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
2 RhodeCode JS Files |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
3 **/ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
4 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
5 if (typeof console == "undefined" || typeof console.log == "undefined"){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
6 console = { log: function() {} } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
7 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
8 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
9 |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
10 var str_repeat = function(i, m) { |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
11 for (var o = []; m > 0; o[--m] = i); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
12 return o.join(''); |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
13 }; |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
14 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
15 /** |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
16 * INJECT .format function into String |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
17 * Usage: "My name is {0} {1}".format("Johny","Bravo") |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
18 * Return "My name is Johny Bravo" |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
19 * Inspired by https://gist.github.com/1049426 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
20 */ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
21 String.prototype.format = function() { |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
22 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
23 function format() { |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
24 var str = this; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
25 var len = arguments.length+1; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
26 var safe = undefined; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
27 var arg = undefined; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
28 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
29 // For each {0} {1} {n...} replace with the argument in that position. If |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
30 // the argument is an object or an array it will be stringified to JSON. |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
31 for (var i=0; i < len; arg = arguments[i++]) { |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
32 safe = typeof arg === 'object' ? JSON.stringify(arg) : arg; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
33 str = str.replace(RegExp('\\{'+(i-1)+'\\}', 'g'), safe); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
34 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
35 return str; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
36 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
37 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
38 // Save a reference of what may already exist under the property native. |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
39 // Allows for doing something like: if("".format.native) { /* use native */ } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
40 format.native = String.prototype.format; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
41 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
42 // Replace the prototype property |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
43 return format; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
44 |
1458
9d9e491e2a21
added author to main page tooltip
Marcin Kuzminski <marcin@python-works.com>
parents:
1426
diff
changeset
|
45 }(); |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
46 |
1465
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
47 |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
48 /** |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
49 * SmartColorGenerator |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
50 * |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
51 *usage:: |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
52 * var CG = new ColorGenerator(); |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
53 * var col = CG.getColor(key); //returns array of RGB |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
54 * 'rgb({0})'.format(col.join(',') |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
55 * |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
56 * @returns {ColorGenerator} |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
57 */ |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
58 var ColorGenerator = function(){ |
1465
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
59 this.GOLDEN_RATIO = 0.618033988749895; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
60 this.CURRENT_RATIO = 0.22717784590367374 // this can be random |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
61 this.HSV_1 = 0.75;//saturation |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
62 this.HSV_2 = 0.95; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
63 this.color; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
64 this.cacheColorMap = {}; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
65 }; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
66 |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
67 ColorGenerator.prototype = { |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
68 getColor:function(key){ |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
69 if(this.cacheColorMap[key] !== undefined){ |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
70 return this.cacheColorMap[key]; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
71 } |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
72 else{ |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
73 this.cacheColorMap[key] = this.generateColor(); |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
74 return this.cacheColorMap[key]; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
75 } |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
76 }, |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
77 _hsvToRgb:function(h,s,v){ |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
78 if (s == 0.0) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
79 return [v, v, v]; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
80 i = parseInt(h * 6.0) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
81 f = (h * 6.0) - i |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
82 p = v * (1.0 - s) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
83 q = v * (1.0 - s * f) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
84 t = v * (1.0 - s * (1.0 - f)) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
85 i = i % 6 |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
86 if (i == 0) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
87 return [v, t, p] |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
88 if (i == 1) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
89 return [q, v, p] |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
90 if (i == 2) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
91 return [p, v, t] |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
92 if (i == 3) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
93 return [p, q, v] |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
94 if (i == 4) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
95 return [t, p, v] |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
96 if (i == 5) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
97 return [v, p, q] |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
98 }, |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
99 generateColor:function(){ |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
100 this.CURRENT_RATIO = this.CURRENT_RATIO+this.GOLDEN_RATIO; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
101 this.CURRENT_RATIO = this.CURRENT_RATIO %= 1; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
102 HSV_tuple = [this.CURRENT_RATIO, this.HSV_1, this.HSV_2] |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
103 RGB_tuple = this._hsvToRgb(HSV_tuple[0],HSV_tuple[1],HSV_tuple[2]); |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
104 function toRgb(v){ |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
105 return ""+parseInt(v*256) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
106 } |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
107 return [toRgb(RGB_tuple[0]),toRgb(RGB_tuple[1]),toRgb(RGB_tuple[2])]; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
108 |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
109 } |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
110 } |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
111 |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
112 |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
113 |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
114 |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
115 |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
116 /** |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
117 * GLOBAL YUI Shortcuts |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
118 */ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
119 var YUC = YAHOO.util.Connect; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
120 var YUD = YAHOO.util.Dom; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
121 var YUE = YAHOO.util.Event; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
122 var YUQ = YAHOO.util.Selector.query; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
123 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
124 // defines if push state is enabled for this browser ? |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
125 var push_state_enabled = Boolean( |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
126 window.history && window.history.pushState && window.history.replaceState |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
127 && !( /* disable for versions of iOS before version 4.3 (8F190) */ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
128 (/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent) |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
129 /* disable for the mercury iOS browser, or at least older versions of the webkit engine */ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
130 || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent) |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
131 ) |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
132 ); |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
133 |
1717
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
134 var _run_callbacks = function(callbacks){ |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
135 if (callbacks !== undefined){ |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
136 var _l = callbacks.length; |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
137 for (var i=0;i<_l;i++){ |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
138 var func = callbacks[i]; |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
139 if(typeof(func)=='function'){ |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
140 try{ |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
141 func(); |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
142 }catch (err){}; |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
143 } |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
144 } |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
145 } |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
146 } |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
147 |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
148 /** |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
149 * Partial Ajax Implementation |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
150 * |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
151 * @param url: defines url to make partial request |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
152 * @param container: defines id of container to input partial result |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
153 * @param s_call: success callback function that takes o as arg |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
154 * o.tId |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
155 * o.status |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
156 * o.statusText |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
157 * o.getResponseHeader[ ] |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
158 * o.getAllResponseHeaders |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
159 * o.responseText |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
160 * o.responseXML |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
161 * o.argument |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
162 * @param f_call: failure callback |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
163 * @param args arguments |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
164 */ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
165 function ypjax(url,container,s_call,f_call,args){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
166 var method='GET'; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
167 if(args===undefined){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
168 args=null; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
169 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
170 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
171 // Set special header for partial ajax == HTTP_X_PARTIAL_XHR |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
172 YUC.initHeader('X-PARTIAL-XHR',true); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
173 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
174 // wrapper of passed callback |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
175 var s_wrapper = (function(o){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
176 return function(o){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
177 YUD.get(container).innerHTML=o.responseText; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
178 YUD.setStyle(container,'opacity','1.0'); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
179 //execute the given original callback |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
180 if (s_call !== undefined){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
181 s_call(o); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
182 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
183 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
184 })() |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
185 YUD.setStyle(container,'opacity','0.3'); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
186 YUC.asyncRequest(method,url,{ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
187 success:s_wrapper, |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
188 failure:function(o){ |
1651
96ae22a4e963
Display error on ypjax fail
Marcin Kuzminski <marcin@python-works.com>
parents:
1638
diff
changeset
|
189 console.log(o); |
96ae22a4e963
Display error on ypjax fail
Marcin Kuzminski <marcin@python-works.com>
parents:
1638
diff
changeset
|
190 YUD.get(container).innerHTML='ERROR'; |
96ae22a4e963
Display error on ypjax fail
Marcin Kuzminski <marcin@python-works.com>
parents:
1638
diff
changeset
|
191 YUD.setStyle(container,'opacity','1.0'); |
96ae22a4e963
Display error on ypjax fail
Marcin Kuzminski <marcin@python-works.com>
parents:
1638
diff
changeset
|
192 YUD.setStyle(container,'color','red'); |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
193 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
194 },args); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
195 |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
196 }; |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
197 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
198 /** |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
199 * tooltip activate |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
200 */ |
1458
9d9e491e2a21
added author to main page tooltip
Marcin Kuzminski <marcin@python-works.com>
parents:
1426
diff
changeset
|
201 var tooltip_activate = function(){ |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
202 function toolTipsId(){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
203 var ids = []; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
204 var tts = YUQ('.tooltip'); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
205 for (var i = 0; i < tts.length; i++) { |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
206 // if element doesn't not have and id |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
207 // autogenerate one for tooltip |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
208 if (!tts[i].id){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
209 tts[i].id='tt'+((i*100)+tts.length); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
210 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
211 ids.push(tts[i].id); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
212 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
213 return ids |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
214 }; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
215 var myToolTips = new YAHOO.widget.Tooltip("tooltip", { |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
216 context: [[toolTipsId()],"tl","bl",null,[0,5]], |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
217 monitorresize:false, |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
218 xyoffset :[0,0], |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
219 autodismissdelay:300000, |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
220 hidedelay:5, |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
221 showdelay:20, |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
222 }); |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
223 }; |
1426
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
224 |
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
225 /** |
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
226 * show more |
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
227 */ |
1458
9d9e491e2a21
added author to main page tooltip
Marcin Kuzminski <marcin@python-works.com>
parents:
1426
diff
changeset
|
228 var show_more_event = function(){ |
1426
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
229 YUE.on(YUD.getElementsByClassName('show_more'),'click',function(e){ |
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
230 var el = e.target; |
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
231 YUD.setStyle(YUD.get(el.id.substring(1)),'display',''); |
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
232 YUD.setStyle(el.parentNode,'display','none'); |
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
233 }); |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
234 }; |
1426
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
235 |
1653
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
236 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
237 /** |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
238 * Quick filter widget |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
239 * |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
240 * @param target: filter input target |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
241 * @param nodes: list of nodes in html we want to filter. |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
242 * @param display_element function that takes current node from nodes and |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
243 * does hide or show based on the node |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
244 * |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
245 */ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
246 var q_filter = function(target,nodes,display_element){ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
247 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
248 var nodes = nodes; |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
249 var q_filter_field = YUD.get(target); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
250 var F = YAHOO.namespace(target); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
251 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
252 YUE.on(q_filter_field,'click',function(){ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
253 q_filter_field.value = ''; |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
254 }); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
255 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
256 YUE.on(q_filter_field,'keyup',function(e){ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
257 clearTimeout(F.filterTimeout); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
258 F.filterTimeout = setTimeout(F.updateFilter,600); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
259 }); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
260 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
261 F.filterTimeout = null; |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
262 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
263 var show_node = function(node){ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
264 YUD.setStyle(node,'display','') |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
265 } |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
266 var hide_node = function(node){ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
267 YUD.setStyle(node,'display','none'); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
268 } |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
269 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
270 F.updateFilter = function() { |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
271 // Reset timeout |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
272 F.filterTimeout = null; |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
273 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
274 var obsolete = []; |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
275 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
276 var req = q_filter_field.value.toLowerCase(); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
277 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
278 var l = nodes.length; |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
279 var i; |
1667
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
280 var showing = 0; |
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
281 |
1653
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
282 for (i=0;i<l;i++ ){ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
283 var n = nodes[i]; |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
284 var target_element = display_element(n) |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
285 if(req && n.innerHTML.toLowerCase().indexOf(req) == -1){ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
286 hide_node(target_element); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
287 } |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
288 else{ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
289 show_node(target_element); |
1667
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
290 showing+=1; |
1653
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
291 } |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
292 } |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
293 |
1667
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
294 // if repo_count is set update the number |
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
295 var cnt = YUD.get('repo_count'); |
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
296 if(cnt){ |
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
297 YUD.get('repo_count').innerHTML = showing; |
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
298 } |
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
299 |
1653
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
300 } |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
301 }; |
1653
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
302 |
1674
6f0143e5efe5
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1667
diff
changeset
|
303 var ajaxPOST = function(url,postData,success) { |
6f0143e5efe5
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1667
diff
changeset
|
304 var sUrl = url; |
6f0143e5efe5
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1667
diff
changeset
|
305 var callback = { |
6f0143e5efe5
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1667
diff
changeset
|
306 success: success, |
6f0143e5efe5
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1667
diff
changeset
|
307 failure: function (o) { |
6f0143e5efe5
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1667
diff
changeset
|
308 alert("error"); |
6f0143e5efe5
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1667
diff
changeset
|
309 }, |
6f0143e5efe5
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1667
diff
changeset
|
310 }; |
6f0143e5efe5
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1667
diff
changeset
|
311 var postData = postData; |
6f0143e5efe5
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1667
diff
changeset
|
312 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData); |
6f0143e5efe5
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1667
diff
changeset
|
313 }; |
1653
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
314 |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
315 |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
316 /** comments **/ |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
317 var removeInlineForm = function(form) { |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
318 form.parentNode.removeChild(form); |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
319 }; |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
320 |
1682
1f2ba96de73e
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1679
diff
changeset
|
321 var tableTr = function(cls,body){ |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
322 var form = document.createElement('tr'); |
1682
1f2ba96de73e
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1679
diff
changeset
|
323 YUD.addClass(form, cls); |
1683
28eeddf81b25
inline comments gui
Marcin Kuzminski <marcin@python-works.com>
parents:
1682
diff
changeset
|
324 form.innerHTML = '<td class="lineno-inline new-inline"></td>'+ |
28eeddf81b25
inline comments gui
Marcin Kuzminski <marcin@python-works.com>
parents:
1682
diff
changeset
|
325 '<td class="lineno-inline old-inline"></td>'+ |
1682
1f2ba96de73e
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1679
diff
changeset
|
326 '<td>{0}</td>'.format(body); |
1f2ba96de73e
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1679
diff
changeset
|
327 return form; |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
328 }; |
1682
1f2ba96de73e
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1679
diff
changeset
|
329 |
1f2ba96de73e
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1679
diff
changeset
|
330 var createInlineForm = function(parent_tr, f_path, line) { |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
331 var tmpl = YUD.get('comment-inline-form-template').innerHTML; |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
332 tmpl = tmpl.format(f_path, line); |
1682
1f2ba96de73e
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1679
diff
changeset
|
333 var form = tableTr('comment-form-inline',tmpl) |
1f2ba96de73e
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1679
diff
changeset
|
334 |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
335 // create event for hide button |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
336 form = new YAHOO.util.Element(form); |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
337 var form_hide_button = new YAHOO.util.Element(form.getElementsByClassName('hide-inline-form')[0]); |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
338 form_hide_button.on('click', function(e) { |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
339 var newtr = e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode; |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
340 removeInlineForm(newtr); |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
341 YUD.removeClass(parent_tr, 'form-open'); |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
342 }); |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
343 return form |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
344 }; |
1705
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
345 var injectInlineForm = function(tr){ |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
346 if(YUD.hasClass(tr,'form-open') || YUD.hasClass(tr,'context')){ |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
347 return |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
348 } |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
349 YUD.addClass(tr,'form-open'); |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
350 var node = tr.parentNode.parentNode.parentNode.getElementsByClassName('full_f_path')[0]; |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
351 var f_path = YUD.getAttribute(node,'path'); |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
352 var lineno = getLineNo(tr); |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
353 var form = createInlineForm(tr, f_path, lineno); |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
354 var target_tr = tr; |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
355 if(YUD.hasClass(YUD.getNextSibling(tr),'inline-comments')){ |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
356 target_tr = YUD.getNextSibling(tr); |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
357 } |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
358 YUD.insertAfter(form,target_tr); |
1772
c83d3d42ab92
- diff.css merge to main style.css
Marcin Kuzminski <marcin@python-works.com>
parents:
1759
diff
changeset
|
359 YUD.get('text_'+lineno).focus(); |
c83d3d42ab92
- diff.css merge to main style.css
Marcin Kuzminski <marcin@python-works.com>
parents:
1759
diff
changeset
|
360 tooltip_activate(); |
1705
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
361 }; |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
362 |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
363 var createInlineAddButton = function(tr,label){ |
1759
d6c6ea17b100
inline comment button fix
Marcin Kuzminski <marcin@python-works.com>
parents:
1717
diff
changeset
|
364 var html = '<div class="add-comment"><span class="ui-btn">{0}</span></div>'.format(label); |
1705
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
365 |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
366 var add = new YAHOO.util.Element(tableTr('inline-comments-button',html)); |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
367 add.on('click', function(e) { |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
368 injectInlineForm(tr); |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
369 }); |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
370 return add; |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
371 }; |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
372 |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
373 var getLineNo = function(tr) { |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
374 var line; |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
375 var o = tr.children[0].id.split('_'); |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
376 var n = tr.children[1].id.split('_'); |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
377 |
1679
c3d9cd8c0cba
fixed inline comment file parsing
Marcin Kuzminski <marcin@python-works.com>
parents:
1677
diff
changeset
|
378 if (n.length >= 2) { |
c3d9cd8c0cba
fixed inline comment file parsing
Marcin Kuzminski <marcin@python-works.com>
parents:
1677
diff
changeset
|
379 line = n[n.length-1]; |
c3d9cd8c0cba
fixed inline comment file parsing
Marcin Kuzminski <marcin@python-works.com>
parents:
1677
diff
changeset
|
380 } else if (o.length >= 2) { |
1685
2e583dbfcf22
fixed typo in linenumber calculation on inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1683
diff
changeset
|
381 line = o[o.length-1]; |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
382 } |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
383 |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
384 return line |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
385 }; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
386 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
387 |
1705
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
388 var fileBrowserListeners = function(current_url, node_list_url, url_base, |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
389 truncated_lbl, nomatch_lbl){ |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
390 var current_url_branch = +"?branch=__BRANCH__"; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
391 var url = url_base; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
392 var node_url = node_list_url; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
393 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
394 YUE.on('stay_at_branch','click',function(e){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
395 if(e.target.checked){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
396 var uri = current_url_branch; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
397 uri = uri.replace('__BRANCH__',e.target.value); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
398 window.location = uri; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
399 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
400 else{ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
401 window.location = current_url; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
402 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
403 }) |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
404 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
405 var n_filter = YUD.get('node_filter'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
406 var F = YAHOO.namespace('node_filter'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
407 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
408 F.filterTimeout = null; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
409 var nodes = null; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
410 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
411 F.initFilter = function(){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
412 YUD.setStyle('node_filter_box_loading','display',''); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
413 YUD.setStyle('search_activate_id','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
414 YUD.setStyle('add_node_id','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
415 YUC.initHeader('X-PARTIAL-XHR',true); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
416 YUC.asyncRequest('GET',url,{ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
417 success:function(o){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
418 nodes = JSON.parse(o.responseText); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
419 YUD.setStyle('node_filter_box_loading','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
420 YUD.setStyle('node_filter_box','display',''); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
421 }, |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
422 failure:function(o){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
423 console.log('failed to load'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
424 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
425 },null); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
426 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
427 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
428 F.updateFilter = function(e) { |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
429 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
430 return function(){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
431 // Reset timeout |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
432 F.filterTimeout = null; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
433 var query = e.target.value; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
434 var match = []; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
435 var matches = 0; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
436 var matches_max = 20; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
437 if (query != ""){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
438 for(var i=0;i<nodes.length;i++){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
439 var pos = nodes[i].toLowerCase().indexOf(query) |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
440 if(query && pos != -1){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
441 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
442 matches++ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
443 //show only certain amount to not kill browser |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
444 if (matches > matches_max){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
445 break; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
446 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
447 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
448 var n = nodes[i]; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
449 var n_hl = n.substring(0,pos) |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
450 +"<b>{0}</b>".format(n.substring(pos,pos+query.length)) |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
451 +n.substring(pos+query.length) |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
452 match.push('<tr><td><a class="browser-file" href="{0}">{1}</a></td><td colspan="5"></td></tr>'.format(node_url.replace('__FPATH__',n),n_hl)); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
453 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
454 if(match.length >= matches_max){ |
1705
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
455 match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format(truncated_lbl)); |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
456 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
457 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
458 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
459 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
460 if(query != ""){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
461 YUD.setStyle('tbody','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
462 YUD.setStyle('tbody_filtered','display',''); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
463 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
464 if (match.length==0){ |
1705
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
465 match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format(nomatch_lbl)); |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
466 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
467 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
468 YUD.get('tbody_filtered').innerHTML = match.join(""); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
469 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
470 else{ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
471 YUD.setStyle('tbody','display',''); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
472 YUD.setStyle('tbody_filtered','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
473 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
474 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
475 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
476 }; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
477 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
478 YUE.on(YUD.get('filter_activate'),'click',function(){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
479 F.initFilter(); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
480 }) |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
481 YUE.on(n_filter,'click',function(){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
482 n_filter.value = ''; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
483 }); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
484 YUE.on(n_filter,'keyup',function(e){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
485 clearTimeout(F.filterTimeout); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
486 F.filterTimeout = setTimeout(F.updateFilter(e),600); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
487 }); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
488 }; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
489 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
490 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
491 var initCodeMirror = function(textAreadId,resetUrl){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
492 var myCodeMirror = CodeMirror.fromTextArea(YUD.get(textAreadId),{ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
493 mode: "null", |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
494 lineNumbers:true |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
495 }); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
496 YUE.on('reset','click',function(e){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
497 window.location=resetUrl |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
498 }); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
499 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
500 YUE.on('file_enable','click',function(){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
501 YUD.setStyle('editor_container','display',''); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
502 YUD.setStyle('upload_file_container','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
503 YUD.setStyle('filename_container','display',''); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
504 }); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
505 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
506 YUE.on('upload_file_enable','click',function(){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
507 YUD.setStyle('editor_container','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
508 YUD.setStyle('upload_file_container','display',''); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
509 YUD.setStyle('filename_container','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
510 }); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
511 }; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
512 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
513 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
514 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
515 var getIdentNode = function(n){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
516 //iterate thru nodes untill matched interesting node ! |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
517 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
518 if (typeof n == 'undefined'){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
519 return -1 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
520 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
521 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
522 if(typeof n.id != "undefined" && n.id.match('L[0-9]+')){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
523 return n |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
524 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
525 else{ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
526 return getIdentNode(n.parentNode); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
527 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
528 }; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
529 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
530 var getSelectionLink = function(selection_link_label) { |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
531 return function(){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
532 //get selection from start/to nodes |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
533 if (typeof window.getSelection != "undefined") { |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
534 s = window.getSelection(); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
535 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
536 from = getIdentNode(s.anchorNode); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
537 till = getIdentNode(s.focusNode); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
538 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
539 f_int = parseInt(from.id.replace('L','')); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
540 t_int = parseInt(till.id.replace('L','')); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
541 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
542 if (f_int > t_int){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
543 //highlight from bottom |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
544 offset = -35; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
545 ranges = [t_int,f_int]; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
546 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
547 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
548 else{ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
549 //highligth from top |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
550 offset = 35; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
551 ranges = [f_int,t_int]; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
552 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
553 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
554 if (ranges[0] != ranges[1]){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
555 if(YUD.get('linktt') == null){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
556 hl_div = document.createElement('div'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
557 hl_div.id = 'linktt'; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
558 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
559 anchor = '#L'+ranges[0]+'-'+ranges[1]; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
560 hl_div.innerHTML = ''; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
561 l = document.createElement('a'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
562 l.href = location.href.substring(0,location.href.indexOf('#'))+anchor; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
563 l.innerHTML = selection_link_label; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
564 hl_div.appendChild(l); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
565 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
566 YUD.get('body').appendChild(hl_div); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
567 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
568 xy = YUD.getXY(till.id); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
569 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
570 YUD.addClass('linktt','yui-tt'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
571 YUD.setStyle('linktt','top',xy[1]+offset+'px'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
572 YUD.setStyle('linktt','left',xy[0]+'px'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
573 YUD.setStyle('linktt','visibility','visible'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
574 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
575 else{ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
576 YUD.setStyle('linktt','visibility','hidden'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
577 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
578 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
579 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
580 }; |
1712
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
581 |
1717
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
582 var deleteNotification = function(url, notification_id,callbacks){ |
1712
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
583 var callback = { |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
584 success:function(o){ |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
585 var obj = YUD.get(String("notification_"+notification_id)); |
1717
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
586 if(obj.parentNode !== undefined){ |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
587 obj.parentNode.removeChild(obj); |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
588 } |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
589 _run_callbacks(callbacks); |
1712
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
590 }, |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
591 failure:function(o){ |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
592 alert("error"); |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
593 }, |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
594 }; |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
595 var postData = '_method=delete'; |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
596 var sUrl = url.replace('__NOTIFICATION_ID__',notification_id); |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
597 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
598 callback, postData); |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
599 }; |