1 // contains code that proposed by the text_view_comment frame to its parent frame |
1 // contains code that proposed by the text_view_comment frame to its parent frame |
2 |
2 |
3 |
3 |
4 c_persistPreference = function(key1, key2, val) { |
4 c_persistPreference = function(key1, key2, val) { |
5 gPrefs.persist(key1, key2, val) ; |
5 gPrefs.persist(key1, key2, val) ; |
6 } |
6 } |
7 |
7 |
8 c_readDefaultPreference = function(key1, key2) { |
8 c_readDefaultPreference = function(key1, key2) { |
9 return gConf['defaultPrefs'][key1][key2] ; |
9 return gConf['defaultPrefs'][key1][key2] ; |
10 } |
10 } |
11 |
11 |
12 c_readPreference = function(key1, key2) { |
12 c_readPreference = function(key1, key2) { |
13 return gPrefs.get(key1,key2) ; |
13 return gPrefs.get(key1,key2) ; |
14 } |
14 } |
15 |
15 |
16 c_resetPreferences = function(entries) { |
16 c_resetPreferences = function(entries) { |
17 gPrefs.reset(entries) ; |
17 gPrefs.reset(entries) ; |
18 } |
18 } |
19 |
19 |
20 c_applyTextStyle = function(val) { |
20 c_applyTextStyle = function(val) { |
21 CY.use(val) ; |
21 CY.use(val) ; |
22 } |
22 } |
23 |
23 |
24 sliderValToPx = function (val) { |
24 sliderValToPx = function (val) { |
25 var winWidth = CY.DOM.winWidth() ; |
25 var winWidth = CY.DOM.winWidth() ; |
26 if (gLayout.isInFrame()) |
26 if (gLayout.isInFrame()) |
27 winWidth = parent.$(parent).width() ; |
27 winWidth = parent.$(parent).width() ; |
28 var theta = val / 100 ; |
28 var theta = val / 100 ; |
29 theta = Math.min(theta, gConf['sliderFixedMin']) ; |
29 theta = Math.min(theta, gConf['sliderFixedMin']) ; |
30 theta = Math.max(theta, gConf['sliderFixedMax']) ; |
30 theta = Math.max(theta, gConf['sliderFixedMax']) ; |
31 var colWidth = theta * winWidth ; |
31 var colWidth = theta * winWidth ; |
32 return Math.floor(colWidth) ; |
32 return Math.floor(colWidth) ; |
33 } |
33 } |
34 |
34 |
35 |
35 |
36 c_setCommentsColWidth = function(val) { |
36 c_setCommentsColWidth = function(val) { |
37 var colWidth = sliderValToPx(val) ; |
37 var colWidth = sliderValToPx(val) ; |
38 gLayout.setLeftColumnWidth(colWidth) ; |
38 gLayout.setLeftColumnWidth(colWidth) ; |
39 |
39 |
40 var iCommentWidth = gLayout.getTopICommentsWidthFromWidth(colWidth) ; |
40 var iCommentWidth = gLayout.getTopICommentsWidthFromWidth(colWidth) ; |
41 |
41 |
42 // icomments |
42 // icomments |
43 gIComments.setWidth(iCommentWidth) ; |
43 gIComments.setWidth(iCommentWidth) ; |
44 |
44 |
45 //forms |
45 //forms |
46 gICommentForm['overlay'].get('boundingBox').setStyle('width', iCommentWidth + 'px') ; |
46 gICommentForm['overlay'].get('boundingBox').setStyle('width', iCommentWidth + 'px') ; |
47 changeFormFieldsWidth(gICommentForm['formId'], iCommentWidth) ; |
47 changeFormFieldsWidth(gICommentForm['formId'], iCommentWidth) ; |
48 |
48 |
49 if (gNewReply) |
49 if (gNewReply) |
50 changeFormFieldsWidth(gNewReply['ids']['formId'], iCommentWidth) ; |
50 changeFormFieldsWidth(gNewReply['ids']['formId'], iCommentWidth) ; |
51 if (gEdit) |
51 if (gEdit) |
52 changeFormFieldsWidth(gEdit['ids']['formId'], iCommentWidth) ; |
52 changeFormFieldsWidth(gEdit['ids']['formId'], iCommentWidth) ; |
53 } |
53 } |