equal
deleted
inserted
replaced
|
1 // globals used: gConf, gPrefs |
|
2 |
|
3 Layout = function() { |
|
4 } |
|
5 |
|
6 Layout.prototype = { |
|
7 init : function () { |
|
8 }, |
|
9 |
|
10 isInFrame : function () { |
|
11 return (!CY.Lang.isUndefined(parent) && parent.location != location && CY.Lang.isFunction(parent.f_getFrameFilterData)); ; |
|
12 }, |
|
13 |
|
14 isInComentSite : function () { |
|
15 // TODO test with IE, test also when embeded |
|
16 |
|
17 var ret = false; |
|
18 try { |
|
19 ret = (!CY.Lang.isUndefined(parent) && !CY.Lang.isUndefined(parent.parent) && parent.parent.location != location && CY.Lang.isFunction(parent.parent.v_toggleFrameSize)); |
|
20 } |
|
21 catch (e) { |
|
22 ret=false; |
|
23 } |
|
24 |
|
25 return ret ; |
|
26 }, |
|
27 |
|
28 sliderValToPx : function (val) { |
|
29 var winWidth = CY.DOM.winWidth() ; |
|
30 if (this.isInFrame()) |
|
31 winWidth = parent.$(parent).width() ; |
|
32 var theta = val / 100 ; |
|
33 theta = Math.min(theta, gConf['sliderFixedMin']) ; |
|
34 theta = Math.max(theta, gConf['sliderFixedMax']) ; |
|
35 var colWidth = theta * winWidth ; |
|
36 return Math.floor(colWidth) ; |
|
37 }, |
|
38 |
|
39 getTopICommentsWidth : function() { |
|
40 return this.getTopICommentsWidthFromWidth(this.sliderValToPx(gPrefs.get('layout','comments_col_width'))) ; |
|
41 }, |
|
42 |
|
43 getTopICommentsWidthFromWidth : function(val) { |
|
44 return val - 7; |
|
45 }, |
|
46 |
|
47 setLeftColumnWidth : function (colWidth) { |
|
48 CY.get('#contentcolumn').setStyle('marginLeft', colWidth + 'px'); |
|
49 CY.get('#leftcolumn').setStyle('width', colWidth + 'px'); |
|
50 }, |
|
51 |
|
52 parentInterfaceUnfreeze : function() { |
|
53 if (this.isInFrame()) |
|
54 parent.f_interfaceUnfreeze() ; |
|
55 } |
|
56 |
|
57 } |