| author | gibus |
| Mon, 10 Mar 2014 13:24:19 +0100 | |
| changeset 600 | fda73ac53450 |
| parent 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 |
}, |
|
|
562
92e8e5aaacde
Give maximum width for add_comment form and toc.
Simon Descarpentries <sid@sopinspace.com>
parents:
532
diff
changeset
|
46 |
|
|
92e8e5aaacde
Give maximum width for add_comment form and toc.
Simon Descarpentries <sid@sopinspace.com>
parents:
532
diff
changeset
|
47 |
iCommentsRequiredThreadPadding : function () { |
|
92e8e5aaacde
Give maximum width for add_comment form and toc.
Simon Descarpentries <sid@sopinspace.com>
parents:
532
diff
changeset
|
48 |
return 2 * gConf['iCommentThreadPadding']; // PhA said : a threaded discussion with a depth of 2 still shoudn't hide the text 20100317 |
|
92e8e5aaacde
Give maximum width for add_comment form and toc.
Simon Descarpentries <sid@sopinspace.com>
parents:
532
diff
changeset
|
49 |
}, |
|
92e8e5aaacde
Give maximum width for add_comment form and toc.
Simon Descarpentries <sid@sopinspace.com>
parents:
532
diff
changeset
|
50 |
|
| 341 | 51 |
getTopICommentsWidthFromWidth : function(val) { |
|
562
92e8e5aaacde
Give maximum width for add_comment form and toc.
Simon Descarpentries <sid@sopinspace.com>
parents:
532
diff
changeset
|
52 |
var ret = val - this.iCommentsRequiredThreadPadding (); |
| 341 | 53 |
return ret - 7; |
54 |
}, |
|
55 |
|
|
56 |
setLeftColumnWidth : function (colWidth) { |
|
|
600
fda73ac53450
Use YUI 3.10 (now that conflict with ASCIIMathML is solved).
gibus
parents:
562
diff
changeset
|
57 |
CY.one('#contentcolumn').setStyle('marginLeft', colWidth + 'px'); |
|
fda73ac53450
Use YUI 3.10 (now that conflict with ASCIIMathML is solved).
gibus
parents:
562
diff
changeset
|
58 |
CY.one('#leftcolumn').setStyle('width', colWidth + 'px'); |
| 341 | 59 |
}, |
60 |
parentInterfaceUnfreeze : function() { |
|
61 |
if (this.isInFrame()) |
|
62 |
parent.f_interfaceUnfreeze() ; |
|
63 |
} |
|
64 |
|
|
| 0 | 65 |
} |