3cd41d160e56a271abf2108345b221e2b0fd9cb8
1 /***************************************************************************
2 * Copyright (C) 2003-2006 Polytechnique.org *
3 * http://opensource.polytechnique.org/ *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
18 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
19 ***************************************************************************/
22 var h
= windowHeight();
25 document
.getElementById('flyspray_report').style
.display
= 'block';
26 document
.getElementById('flyspray_report').style
.top
= y
+'px';
30 function getScrollY() {
31 var scrOfX
= 0, scrOfY
= 0;
32 if( typeof( window
.pageYOffset
) == 'number' ) {
34 scrOfY
= window
.pageYOffset
;
35 } else if( document
.body
&& ( document
.body
.scrollLeft
|| document
.body
.scrollTop
) ) {
37 scrOfY
= document
.body
.scrollTop
;
38 } else if( document
.documentElement
&& ( document
.documentElement
.scrollLeft
|| document
.documentElement
.scrollTop
) ) {
39 //IE6 standards compliant mode
40 scrOfY
= document
.documentElement
.scrollTop
;
44 function windowHeight() {
45 if( typeof( window
.innerWidth
) == 'number' ) {
47 return window
.innerHeight
;
48 } else if( document
.documentElement
&& ( document
.documentElement
.clientWidth
|| document
.documentElement
.clientHeight
) ) {
49 return document
.documentElement
.clientHeight
;
50 } else if( document
.body
&& ( document
.body
.clientWidth
|| document
.body
.clientHeight
) ) {
52 return document
.body
.clientHeight
;
57 function close_bug(f
,send
) {
58 var detail
= document
.getElementById('flyspray_detail');
59 detail
.value
= utf8(detail
.value
);
60 var title
= document
.getElementById('flyspray_title');
61 title
.value
= utf8(title
.value
);
67 document
.getElementById('flyspray_report').style
.display
= 'none';
70 function utf8(isotext
)
73 for ( i
=0; i
<isotext
.length
; i
++ )
75 unicodchar
= isotext
.charCodeAt(i
);
78 utf8text
+= String
.fromCharCode(unicodchar
);
79 } else if(unicodchar
< 0x800) {
80 var val1
= 0xC0 + (unicodchar
& 0x7C0) / 0x40; // 0011111000000
81 var val2
= 0x80 + (unicodchar
& 0x3F); // 0000000111111
82 utf8text
+= String
.fromCharCode(val1
,val2
);
83 } else if(unicodchar
< 0x10000) {
84 var val1
= 0xE0 + (unicodchar
& 0xF000) / 0x1000; // 001111000000000000
85 var val2
= 0x80 + (unicodchar
& 0xFC0) / 0x40; // 000000111111000000
86 var val3
= 0x80 + (unicodchar
& 0x3F); // 000000000000111111
87 utf8text
+= String
.fromCharCode(val1
,val2
, val3
);
88 } else if(unicodchar
< 0x200000){
89 var val4
= 0x80 + (unicodchar
& 0x1C0000) / 0x40000;// 00111000000000000000000
90 var val2
= 0x80 + (unicodchar
& 0x3F000) / 0x1000; // 00000111111000000000000
91 var val3
= 0x80 + (unicodchar
& 0xFC0) / 0x40; // 00000000000111111000000
92 var val4
= 0x80 + (unicodchar
& 0x3F); // 00000000000000000111111
93 utf8text
+= String
.fromCharCode(val1
,val2
, val3
, val4
);