2 |
2 |
3 Layout = function() { |
3 Layout = function() { |
4 } |
4 } |
5 |
5 |
6 Layout.prototype = { |
6 Layout.prototype = { |
7 init : function () { |
7 init : function () { |
8 }, |
8 }, |
9 |
9 |
10 isInFrame : function () { |
10 isInFrame : function () { |
11 return (!CY.Lang.isUndefined(parent) && parent.location != location && CY.Lang.isFunction(parent.f_getFrameFilterData)); ; |
11 return (!CY.Lang.isUndefined(parent) && parent.location != location && CY.Lang.isFunction(parent.f_getFrameFilterData)); ; |
12 }, |
12 }, |
13 |
13 |
14 isInComentSite : function () { |
14 isInComentSite : function () { |
15 var ret = false; |
15 var ret = false; |
16 try { |
16 try { |
17 if (!CY.Lang.isUndefined(sv_site_url) && !CY.Lang.isUndefined(parent) && !CY.Lang.isUndefined(parent.parent)) { |
17 if (!CY.Lang.isUndefined(sv_site_url) && !CY.Lang.isUndefined(parent) && !CY.Lang.isUndefined(parent.parent)) { |
18 var parentParentLocation = new String(parent.parent.location) ; |
18 var parentParentLocation = new String(parent.parent.location) ; |
19 // TODO warn server |
19 // TODO warn server |
20 //CY.log(parentParentLocation) ; |
20 //CY.log(parentParentLocation) ; |
21 ret = (parentParentLocation.indexOf(sv_site_url) == 0); |
21 ret = (parentParentLocation.indexOf(sv_site_url) == 0); |
22 } |
22 } |
23 } |
23 } |
24 catch (e) { |
24 catch (e) { |
25 ret=false; |
25 ret=false; |
26 //CY.log("error thrown while trying to access parent.parent.location") ; |
26 //CY.log("error thrown while trying to access parent.parent.location") ; |
27 } |
27 } |
28 //CY.log("inComentSite returned : " + ret) ; |
28 //CY.log("inComentSite returned : " + ret) ; |
29 return ret ; |
29 return ret ; |
30 }, |
30 }, |
31 |
31 |
32 sliderValToPx : function (val) { |
32 sliderValToPx : function (val) { |
33 var winWidth = CY.DOM.winWidth() ; |
33 var winWidth = CY.DOM.winWidth() ; |
34 if (this.isInFrame()) |
34 if (this.isInFrame()) |
35 winWidth = parent.$(parent).width() ; |
35 winWidth = parent.$(parent).width() ; |
36 var theta = val / 100 ; |
36 var theta = val / 100 ; |
37 theta = Math.min(theta, gConf['sliderFixedMin']) ; |
37 theta = Math.min(theta, gConf['sliderFixedMin']) ; |
38 theta = Math.max(theta, gConf['sliderFixedMax']) ; |
38 theta = Math.max(theta, gConf['sliderFixedMax']) ; |
39 var colWidth = theta * winWidth ; |
39 var colWidth = theta * winWidth ; |
40 return Math.floor(colWidth) ; |
40 return Math.floor(colWidth) ; |
41 }, |
41 }, |
42 |
42 |
43 getTopICommentsWidth : function() { |
43 getTopICommentsWidth : function() { |
44 return this.getTopICommentsWidthFromWidth(this.sliderValToPx(gPrefs.get('layout','comments_col_width'))) ; |
44 return this.getTopICommentsWidthFromWidth(this.sliderValToPx(gPrefs.get('layout','comments_col_width'))) ; |
45 }, |
45 }, |
46 |
46 |
47 getTopICommentsWidthFromWidth : function(val) { |
47 getTopICommentsWidthFromWidth : function(val) { |
48 var ret = val - ( 2 * gConf['iCommentThreadPadding']) ; // PhA said : a threaded discussion with a depth of 2 still shoudn't hide the text 20100317 |
48 var ret = val - ( 2 * gConf['iCommentThreadPadding']) ; // PhA said : a threaded discussion with a depth of 2 still shoudn't hide the text 20100317 |
49 return ret - 7; |
49 return ret - 7; |
50 }, |
50 }, |
51 |
51 |
52 setLeftColumnWidth : function (colWidth) { |
52 setLeftColumnWidth : function (colWidth) { |
53 CY.get('#contentcolumn').setStyle('marginLeft', colWidth + 'px'); |
53 CY.get('#contentcolumn').setStyle('marginLeft', colWidth + 'px'); |
54 CY.get('#leftcolumn').setStyle('width', colWidth + 'px'); |
54 CY.get('#leftcolumn').setStyle('width', colWidth + 'px'); |
55 }, |
55 }, |
56 parentInterfaceUnfreeze : function() { |
56 parentInterfaceUnfreeze : function() { |
57 if (this.isInFrame()) |
57 if (this.isInFrame()) |
58 parent.f_interfaceUnfreeze() ; |
58 parent.f_interfaceUnfreeze() ; |
59 } |
59 } |
60 |
60 |
61 } |
61 } |