| author | gibus |
| Wed, 11 Sep 2013 23:13:01 +0200 | |
| changeset 532 | 0bad3613f59d |
| parent 525 | 89ef5ed3c48b |
| child 562 | 92e8e5aaacde |
| permissions | -rw-r--r-- |
| 0 | 1 |
// globals used: gConf, gPrefs |
2 |
||
3 |
Layout = function() { |
|
4 |
} |
|
5 |
||
6 |
Layout.prototype = { |
|
| 341 | 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 |
var ret = false; |
|
16 |
try { |
|
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) ; |
|
19 |
// TODO warn server |
|
20 |
//CY.log(parentParentLocation) ; |
|
21 |
ret = (parentParentLocation.indexOf(sv_site_url) == 0); |
|
22 |
} |
|
23 |
} |
|
24 |
catch (e) { |
|
25 |
ret=false; |
|
26 |
//CY.log("error thrown while trying to access parent.parent.location") ; |
|
27 |
} |
|
28 |
//CY.log("inComentSite returned : " + ret) ; |
|
29 |
return ret ; |
|
30 |
}, |
|
31 |
|
|
32 |
sliderValToPx : function (val) { |
|
33 |
var winWidth = CY.DOM.winWidth() ; |
|
34 |
if (this.isInFrame()) |
|
35 |
winWidth = parent.$(parent).width() ; |
|
36 |
var theta = val / 100 ; |
|
37 |
theta = Math.min(theta, gConf['sliderFixedMin']) ; |
|
38 |
theta = Math.max(theta, gConf['sliderFixedMax']) ; |
|
39 |
var colWidth = theta * winWidth ; |
|
40 |
return Math.floor(colWidth) ; |
|
41 |
}, |
|
| 0 | 42 |
|
| 341 | 43 |
getTopICommentsWidth : function() { |
44 |
return this.getTopICommentsWidthFromWidth(this.sliderValToPx(gPrefs.get('layout','comments_col_width'))) ; |
|
45 |
}, |
|
46 |
|
|
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 |
|
49 |
return ret - 7; |
|
50 |
}, |
|
51 |
|
|
52 |
setLeftColumnWidth : function (colWidth) { |
|
|
532
0bad3613f59d
Reverse to YUI 3.0.0 since with YUI.3.10.3, comment content including words 'paragraph' or 'section' do not show up on Firefox, this is weird and has to be investigated.
gibus
parents:
525
diff
changeset
|
53 |
CY.get('#contentcolumn').setStyle('marginLeft', colWidth + 'px'); |
|
0bad3613f59d
Reverse to YUI 3.0.0 since with YUI.3.10.3, comment content including words 'paragraph' or 'section' do not show up on Firefox, this is weird and has to be investigated.
gibus
parents:
525
diff
changeset
|
54 |
CY.get('#leftcolumn').setStyle('width', colWidth + 'px'); |
| 341 | 55 |
}, |
56 |
parentInterfaceUnfreeze : function() { |
|
57 |
if (this.isInFrame()) |
|
58 |
parent.f_interfaceUnfreeze() ; |
|
59 |
} |
|
60 |
|
|
| 0 | 61 |
} |