| author | Simon Descarpentries <sid@sopinspace.com> |
| Wed, 06 Nov 2013 19:05:09 +0100 | |
| changeset 562 | 92e8e5aaacde |
| parent 468 | 24b4923125c5 |
| permissions | -rw-r--r-- |
| 0 | 1 |
// contains code that proposed by the text_view_comment frame to its parent frame |
2 |
||
3 |
||
4 |
c_persistPreference = function(key1, key2, val) { |
|
| 341 | 5 |
gPrefs.persist(key1, key2, val) ; |
| 0 | 6 |
} |
7 |
||
8 |
c_readDefaultPreference = function(key1, key2) { |
|
| 341 | 9 |
return gConf['defaultPrefs'][key1][key2] ; |
| 0 | 10 |
} |
11 |
||
12 |
c_readPreference = function(key1, key2) { |
|
| 341 | 13 |
return gPrefs.get(key1,key2) ; |
| 0 | 14 |
} |
15 |
||
16 |
c_resetPreferences = function(entries) { |
|
| 341 | 17 |
gPrefs.reset(entries) ; |
| 0 | 18 |
} |
19 |
||
20 |
c_applyTextStyle = function(val) { |
|
| 341 | 21 |
CY.use(val) ; |
| 0 | 22 |
} |
23 |
||
24 |
sliderValToPx = function (val) { |
|
| 341 | 25 |
var winWidth = CY.DOM.winWidth() ; |
26 |
if (gLayout.isInFrame()) |
|
27 |
winWidth = parent.$(parent).width() ; |
|
28 |
var theta = val / 100 ; |
|
29 |
theta = Math.min(theta, gConf['sliderFixedMin']) ; |
|
30 |
theta = Math.max(theta, gConf['sliderFixedMax']) ; |
|
31 |
var colWidth = theta * winWidth ; |
|
32 |
return Math.floor(colWidth) ; |
|
| 0 | 33 |
} |
34 |
||
35 |
||
36 |
c_setCommentsColWidth = function(val) { |
|
| 341 | 37 |
var colWidth = sliderValToPx(val) ; |
38 |
gLayout.setLeftColumnWidth(colWidth) ; |
|
| 0 | 39 |
|
| 341 | 40 |
var iCommentWidth = gLayout.getTopICommentsWidthFromWidth(colWidth) ; |
| 0 | 41 |
|
| 341 | 42 |
// icomments |
43 |
gIComments.setWidth(iCommentWidth) ; |
|
| 0 | 44 |
|
|
562
92e8e5aaacde
Give maximum width for add_comment form and toc.
Simon Descarpentries <sid@sopinspace.com>
parents:
468
diff
changeset
|
45 |
iCommentWidth += gLayout.iCommentsRequiredThreadPadding (); // SID: use max available space as there is no indentation on that box |
|
92e8e5aaacde
Give maximum width for add_comment form and toc.
Simon Descarpentries <sid@sopinspace.com>
parents:
468
diff
changeset
|
46 |
|
| 341 | 47 |
//forms |
48 |
gICommentForm['overlay'].get('boundingBox').setStyle('width', iCommentWidth + 'px') ; |
|
49 |
changeFormFieldsWidth(gICommentForm['formId'], iCommentWidth) ; |
|
50 |
|
|
| 421 | 51 |
//toc |
52 |
//For some reasons: gToc['overlay'].get('boundingBox').setStyle('width', iCommentWidth + 'px'); |
|
53 |
// does not work when the div.c-toc has a fixed position. |
|
| 468 | 54 |
document.getElementById('the-toc').style.width = iCommentWidth + 'px'; |
| 421 | 55 |
|
| 341 | 56 |
if (gNewReply) |
57 |
changeFormFieldsWidth(gNewReply['ids']['formId'], iCommentWidth) ; |
|
58 |
if (gEdit) |
|
59 |
changeFormFieldsWidth(gEdit['ids']['formId'], iCommentWidth) ; |
|
| 0 | 60 |
} |