Index: trunk/extensions/SemanticMediaWiki/skins/SMW_sorttable.js |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | // Modified for SMW (in fact, we might rewrite the code since we |
5 | 5 | // usually have very special tables to sort) |
6 | 6 | |
7 | | -addOnloadHook(smw_sortables_init); |
| 7 | +addOnloadHook( smw_sortables_init ); |
8 | 8 | |
9 | 9 | var SORT_COLUMN_INDEX; |
10 | 10 | var SMW_PATH; |
— | — | @@ -14,198 +14,236 @@ |
15 | 15 | // if (!document.getElementById) return; |
16 | 16 | // st = document.getElementById("SMW_sorttable_script_inclusion"); |
17 | 17 | // SMW_PATH = st.src.substring(0, st.src.length-17); |
18 | | - SMW_PATH = wgScriptPath + "/extensions/SemanticMediaWiki/skins"; |
| 18 | + SMW_PATH = wgScriptPath + '/extensions/SemanticMediaWiki/skins'; |
19 | 19 | // Preload images |
20 | 20 | smw_preload_images(); |
21 | 21 | // Now find the tables |
22 | 22 | //if (!document.getElementsByTagName) return; |
23 | 23 | //tbls = document.getElementsByTagName("SMW_headscript_sorttable"); |
24 | | - // Find all tables with class smwtable and make them sortable |
25 | | - if (!document.getElementsByTagName) return; |
26 | | - tbls = document.getElementsByTagName("table"); |
27 | | - for (ti=0;ti<tbls.length;ti++) { |
28 | | - thisTbl = tbls[ti]; |
29 | | - if (((' '+thisTbl.className+' ').indexOf("smwtable") != -1) && (thisTbl.id)) { |
30 | | - //initTable(thisTbl.id); |
31 | | - smw_makeSortable(thisTbl); |
32 | | - } |
33 | | - } |
| 24 | + // Find all tables with class smwtable and make them sortable |
| 25 | + if ( !document.getElementsByTagName ) { |
| 26 | + return; |
| 27 | + } |
| 28 | + tbls = document.getElementsByTagName( 'table' ); |
| 29 | + for ( ti = 0; ti < tbls.length; ti++) { |
| 30 | + thisTbl = tbls[ti]; |
| 31 | + if ( ( ( ' ' + thisTbl.className + ' ' ).indexOf( 'smwtable' ) != -1 ) && ( thisTbl.id ) ) { |
| 32 | + //initTable( thisTbl.id ); |
| 33 | + smw_makeSortable( thisTbl ); |
| 34 | + } |
| 35 | + } |
34 | 36 | } |
35 | 37 | |
36 | 38 | function smw_preload_images() { |
37 | | - // preload icons needed by SMW |
38 | | - if (document.images) { |
39 | | - pic1= new Image(12,14); |
40 | | - pic1.src = SMW_PATH + "/images/sort_up.gif"; |
41 | | - pic2= new Image(12,14); |
42 | | - pic2.src = SMW_PATH + "/images/sort_down.gif"; |
43 | | - pic3= new Image(16,16); |
44 | | - pic3.src = SMW_PATH + "/images/search_icon.png"; // TODO: move this preload to somewhere else? |
45 | | - } |
| 39 | + // preload icons needed by SMW |
| 40 | + if ( document.images ) { |
| 41 | + pic1 = new Image( 12, 14 ); |
| 42 | + pic1.src = SMW_PATH + '/images/sort_up.gif'; |
| 43 | + pic2 = new Image( 12, 14 ); |
| 44 | + pic2.src = SMW_PATH + '/images/sort_down.gif'; |
| 45 | + pic3 = new Image( 16, 16 ); |
| 46 | + pic3.src = SMW_PATH + '/images/search_icon.png'; // TODO: move this preload to somewhere else? |
| 47 | + } |
46 | 48 | } |
47 | 49 | |
48 | | -function smw_makeSortable(table) { |
49 | | - if (table.rows && table.rows.length > 0) { |
50 | | - var firstRow = table.rows[0]; |
51 | | - } |
52 | | - if (!firstRow) return; |
53 | | - if ( (firstRow.cells.length==0)||(firstRow.cells[0].tagName.toLowerCase() != 'th') ) return; |
| 50 | +function smw_makeSortable( table ) { |
| 51 | + if ( table.rows && table.rows.length > 0 ) { |
| 52 | + var firstRow = table.rows[0]; |
| 53 | + } |
| 54 | + if ( !firstRow ) { |
| 55 | + return; |
| 56 | + } |
| 57 | + if ( ( firstRow.cells.length == 0 ) || ( firstRow.cells[0].tagName.toLowerCase() != 'th' ) ) { |
| 58 | + return; |
| 59 | + } |
54 | 60 | |
55 | | - // We have a first row that is a header; make its contents clickable links: |
56 | | - for (var i=0;i<firstRow.cells.length;i++) { |
57 | | - var cell = firstRow.cells[i]; |
58 | | - //var txt = smw_getInnerText(cell); // unused -- we preserve the inner html |
59 | | - cell.innerHTML = '<a href="#" class="sortheader" '+ |
60 | | - 'onclick="smw_resortTable(this, '+i+');return false;">' + |
61 | | - '<span class="sortarrow"><img alt="[<>]" src="' + SMW_PATH + '/images/sort_none.gif"/></span></a> <span style="margin-left: 0.3em; margin-right: 1em;">' + cell.innerHTML + '</span>'; // the is for Opera ... |
62 | | - } |
| 61 | + // We have a first row that is a header; make its contents clickable links: |
| 62 | + for ( var i = 0; i < firstRow.cells.length; i++ ) { |
| 63 | + var cell = firstRow.cells[i]; |
| 64 | + //var txt = smw_getInnerText( cell ); // unused -- we preserve the inner html |
| 65 | + cell.innerHTML = '<a href="#" class="sortheader" '+ |
| 66 | + 'onclick="smw_resortTable(this, '+i+');return false;">' + |
| 67 | + '<span class="sortarrow"><img alt="[<>]" src="' + SMW_PATH + '/images/sort_none.gif"/></span></a> <span style="margin-left: 0.3em; margin-right: 1em;">' + cell.innerHTML + '</span>'; // the is for Opera ... |
| 68 | + } |
63 | 69 | |
64 | | - /*make sortkeys invisible |
65 | | - *for now done in css |
66 | | - *this code provides the possibility to do it via js, so that non js clients |
67 | | - *can see the keys |
68 | | - */ |
69 | | -// for(var ti=0; ti<table.rows.length; ti++){ |
70 | | -// for (var tj=0; tj<table.rows[ti].cells.length; tj++){ |
71 | | -// var spans=table.rows[ti].cells[tj].getElementsByTagName("span"); |
72 | | -// if(spans.length > 0){ |
73 | | -// for (var tk=0;tk<spans.length;tk++) { |
74 | | -// if(spans[tk].className=="smwsortkey"){ |
75 | | -// spans[tk].style.display="none"; |
76 | | -// } |
77 | | -// } |
78 | | -// } |
79 | | -// } |
80 | | -// } |
| 70 | + /** |
| 71 | + * make sortkeys invisible |
| 72 | + * for now done in CSS |
| 73 | + * this code provides the possibility to do it via JS, so that non-JS |
| 74 | + * clients can see the keys |
| 75 | + */ |
| 76 | +/* for( var ti = 0; ti < table.rows.length; ti++ ) { |
| 77 | + for ( var tj = 0; tj < table.rows[ti].cells.length; tj++ ) { |
| 78 | + var spans = table.rows[ti].cells[tj].getElementsByTagName( 'span' ); |
| 79 | + if( spans.length > 0 ) { |
| 80 | + for ( var tk = 0; tk < spans.length; tk++ ) { |
| 81 | + if( spans[tk].className == 'smwsortkey' ) { |
| 82 | + spans[tk].style.display = 'none'; |
| 83 | + } |
| 84 | + } |
| 85 | + } |
| 86 | + } |
| 87 | + }*/ |
81 | 88 | } |
82 | 89 | |
83 | | -function smw_getInnerText(el){ |
84 | | - var spans = el.getElementsByTagName("span"); |
85 | | - if(spans.length > 0){ |
86 | | - for (var i=0;i<spans.length;i++) { |
87 | | - if(spans[i].className=="smwsortkey") return spans[i].innerHTML; |
| 90 | +function smw_getInnerText( el ) { |
| 91 | + var spans = el.getElementsByTagName( 'span' ); |
| 92 | + if( spans.length > 0 ) { |
| 93 | + for ( var i = 0; i < spans.length; i++ ) { |
| 94 | + if( spans[i].className == 'smwsortkey' ) { |
| 95 | + return spans[i].innerHTML; |
| 96 | + } |
| 97 | + } |
| 98 | + } else { |
| 99 | + return el.innerHTML; |
88 | 100 | } |
89 | | - }else{ |
90 | | - return el.innerHTML; |
91 | | - } |
92 | | - |
93 | 101 | } |
94 | 102 | |
95 | | -function smw_resortTable(lnk,clid) { |
96 | | - // get the span |
97 | | - var span; |
98 | | - for (var ci=0;ci<lnk.childNodes.length;ci++) { |
99 | | - if (lnk.childNodes[ci].tagName && lnk.childNodes[ci].tagName.toLowerCase() == 'span') span = lnk.childNodes[ci]; |
100 | | - } |
101 | | - var spantext = smw_getInnerText(span);//is this variable unused |
102 | | - var td = lnk.parentNode; |
103 | | - var column = clid || td.cellIndex; |
104 | | - var table = smw_getParent(td,'TABLE'); |
| 103 | +function smw_resortTable( lnk, clid ) { |
| 104 | + // get the span |
| 105 | + var span; |
| 106 | + for ( var ci = 0; ci < lnk.childNodes.length; ci++ ) { |
| 107 | + if ( lnk.childNodes[ci].tagName && lnk.childNodes[ci].tagName.toLowerCase() == 'span' ) { |
| 108 | + span = lnk.childNodes[ci]; |
| 109 | + } |
| 110 | + } |
| 111 | + var spantext = smw_getInnerText( span ); // Is this variable unused? |
| 112 | + var td = lnk.parentNode; |
| 113 | + var column = clid || td.cellIndex; |
| 114 | + var table = smw_getParent( td, 'TABLE' ); |
105 | 115 | |
| 116 | + if ( table.rows.length <= 1 ) { |
| 117 | + return; |
| 118 | + } |
106 | 119 | |
107 | | - if (table.rows.length <= 1) return; |
| 120 | + sortfn = smw_sort_caseinsensitive; // sorting w/o keys |
| 121 | + // check for sorting keys and change sorting function |
| 122 | + var itm = table.rows[1].cells[column]; |
| 123 | + var spans = itm.getElementsByTagName( 'span' ); |
| 124 | + if( spans.length > 0 ) { |
| 125 | + for ( var i = 0; i < spans.length; i++ ) { |
| 126 | + if( spans[i].className == 'smwsortkey' ) { |
| 127 | + sortfn = smw_sort_numeric; // sorting with keys |
| 128 | + } |
| 129 | + } |
| 130 | + } |
108 | 131 | |
109 | | - sortfn = smw_sort_caseinsensitive; //sorting w/o keys |
110 | | - //check for sorting keys and change sorting function |
111 | | - var itm = table.rows[1].cells[column]; |
112 | | - var spans = itm.getElementsByTagName("span"); |
113 | | - if(spans.length > 0){ |
114 | | - for (var i=0;i<spans.length;i++) { |
115 | | - if(spans[i].className=="smwsortkey") sortfn=smw_sort_numeric; //sorting with keys |
| 132 | + SORT_COLUMN_INDEX = column; |
| 133 | + var firstRow = new Array(); |
| 134 | + var newRows = new Array(); |
| 135 | + var footers = new Array(); |
| 136 | + for ( i = 0; i < table.rows[0].length; i++ ) { |
| 137 | + firstRow[i] = table.rows[0][i]; |
116 | 138 | } |
117 | | - } |
| 139 | + // class "sortbottom" makes rows sort below all others, but they are still sorted |
| 140 | + // class "smwfooter" excludes rows from sorting and appends them below in unchanged order |
| 141 | + for ( j = 1; j < table.rows.length; j++ ) { |
| 142 | + if ( ( !table.rows[j].className || table.rows[j].className.indexOf( 'smwfooter' ) == -1 ) ) { |
| 143 | + newRows.push( table.rows[j] ); |
| 144 | + } else { |
| 145 | + footers.push( table.rows[j] ); |
| 146 | + } |
| 147 | + } |
118 | 148 | |
| 149 | + newRows.sort( sortfn ); |
119 | 150 | |
120 | | - SORT_COLUMN_INDEX = column; |
121 | | - var firstRow = new Array(); |
122 | | - var newRows = new Array(); |
123 | | - var footers = new Array(); |
124 | | - for (i=0;i<table.rows[0].length;i++) { firstRow[i] = table.rows[0][i]; } |
125 | | - // class "sortbottom" makes rows sort below all others, but they are still sorted |
126 | | - // class "smwfooter" excludes rows from sorting and appends them below in unchanged order |
127 | | - for (j=1;j<table.rows.length;j++) { |
128 | | - if ((!table.rows[j].className || table.rows[j].className.indexOf('smwfooter') == -1)) { newRows.push(table.rows[j]); } else { footers.push(table.rows[j]); } |
129 | | - } |
| 151 | + var ARROW; |
| 152 | + if ( span.getAttribute( 'sortdir' ) == 'down' ) { |
| 153 | + ARROW = '<img alt="[>]" src="' + SMW_PATH + '/images/sort_up.gif"/>'; |
| 154 | + newRows.reverse(); |
| 155 | + span.setAttribute( 'sortdir', 'up' ); |
| 156 | + } else { |
| 157 | + ARROW = '<img alt="[<]" src="' + SMW_PATH + '/images/sort_down.gif"/>'; |
| 158 | + span.setAttribute( 'sortdir', 'down' ); |
| 159 | + } |
130 | 160 | |
131 | | - newRows.sort(sortfn); |
| 161 | + // We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones |
| 162 | + // don't do sortbottom rows |
| 163 | + for ( i = 0; i < newRows.length; i++ ) { |
| 164 | + if ( !newRows[i].className || ( newRows[i].className && ( newRows[i].className.indexOf( 'sortbottom' ) == -1 ) ) ) { |
| 165 | + table.tBodies[0].appendChild( newRows[i] ); |
| 166 | + } |
| 167 | + } |
| 168 | + // do sortbottom rows only |
| 169 | + for ( i = 0; i < newRows.length; i++ ) { |
| 170 | + if ( newRows[i].className && ( newRows[i].className.indexOf( 'sortbottom' ) != -1 ) ) { |
| 171 | + table.tBodies[0].appendChild( newRows[i] ); |
| 172 | + } |
| 173 | + } |
| 174 | + for ( i = 0; i < footers.length; i++ ) { |
| 175 | + table.tBodies[0].appendChild( footers[i] ); |
| 176 | + } |
132 | 177 | |
133 | | - var ARROW; |
134 | | - if (span.getAttribute("sortdir") == 'down') { |
135 | | - ARROW = '<img alt="[>]" src="' + SMW_PATH + '/images/sort_up.gif"/>'; |
136 | | - newRows.reverse(); |
137 | | - span.setAttribute('sortdir','up'); |
138 | | - } else { |
139 | | - ARROW = '<img alt="[<]" src="' + SMW_PATH + '/images/sort_down.gif"/>'; |
140 | | - span.setAttribute('sortdir','down'); |
141 | | - } |
| 178 | + // Delete any other arrows there may be showing |
| 179 | + var allspans = document.getElementsByTagName( 'span' ); |
| 180 | + for ( var ci = 0; ci < allspans.length; ci++ ) { |
| 181 | + if ( allspans[ci].className == 'sortarrow' ) { |
| 182 | + if ( smw_getParent( allspans[ci], 'table' ) == smw_getParent( lnk, 'table' ) ) { // in the same table as us? |
| 183 | + allspans[ci].innerHTML = '<img alt="[<>]" src="' + SMW_PATH + '/images/sort_none.gif"/>'; |
| 184 | + } |
| 185 | + } |
| 186 | + } |
142 | 187 | |
143 | | - // We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones |
144 | | - // don't do sortbottom rows |
145 | | - for (i=0;i<newRows.length;i++) { if (!newRows[i].className || (newRows[i].className && (newRows[i].className.indexOf('sortbottom') == -1))) table.tBodies[0].appendChild(newRows[i]);} |
146 | | - // do sortbottom rows only |
147 | | - for (i=0;i<newRows.length;i++) { if (newRows[i].className && (newRows[i].className.indexOf('sortbottom') != -1)) table.tBodies[0].appendChild(newRows[i]);} |
148 | | - for (i=0;i<footers.length;i++) { table.tBodies[0].appendChild(footers[i]);} |
149 | | - |
150 | | - // Delete any other arrows there may be showing |
151 | | - var allspans = document.getElementsByTagName("span"); |
152 | | - for (var ci=0;ci<allspans.length;ci++) { |
153 | | - if (allspans[ci].className == 'sortarrow') { |
154 | | - if (smw_getParent(allspans[ci],"table") == smw_getParent(lnk,"table")) { // in the same table as us? |
155 | | - allspans[ci].innerHTML = '<img alt="[<>]" src="' + SMW_PATH + '/images/sort_none.gif"/>'; |
156 | | - } |
157 | | - } |
158 | | - } |
159 | | - |
160 | | - span.innerHTML = ARROW; |
| 188 | + span.innerHTML = ARROW; |
161 | 189 | } |
162 | 190 | |
163 | | -function smw_getParent(el, pTagName) { |
164 | | - if (el == null) return null; |
165 | | - else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase()) // Gecko bug, supposed to be uppercase |
166 | | - return el; |
167 | | - else |
168 | | - return smw_getParent(el.parentNode, pTagName); |
| 191 | +function smw_getParent( el, pTagName ) { |
| 192 | + if ( el == null ) { |
| 193 | + return null; |
| 194 | + } else if ( el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase() ) { // Gecko bug, supposed to be uppercase |
| 195 | + return el; |
| 196 | + } else { |
| 197 | + return smw_getParent( el.parentNode, pTagName ); |
| 198 | + } |
169 | 199 | } |
170 | 200 | |
171 | | -function smw_sort_caseinsensitive(a,b) { |
172 | | - aa = smw_getInnerText(a.cells[SORT_COLUMN_INDEX]).toLowerCase(); |
173 | | - bb = smw_getInnerText(b.cells[SORT_COLUMN_INDEX]).toLowerCase(); |
174 | | - if (aa==bb) return 0; |
175 | | - if (aa<bb) return -1; |
176 | | - return 1; |
| 201 | +function smw_sort_caseinsensitive( a, b ) { |
| 202 | + aa = smw_getInnerText( a.cells[SORT_COLUMN_INDEX] ).toLowerCase(); |
| 203 | + bb = smw_getInnerText( b.cells[SORT_COLUMN_INDEX] ).toLowerCase(); |
| 204 | + if ( aa == bb ) { |
| 205 | + return 0; |
| 206 | + } |
| 207 | + if ( aa < bb ) { |
| 208 | + return -1; |
| 209 | + } |
| 210 | + return 1; |
177 | 211 | } |
178 | 212 | |
179 | | - |
180 | | -function smw_sort_numeric(a,b) { |
181 | | - aa = parseFloat(smw_getInnerText(a.cells[SORT_COLUMN_INDEX])); |
182 | | - if (isNaN(aa)) aa = 0; |
183 | | - bb = parseFloat(smw_getInnerText(b.cells[SORT_COLUMN_INDEX])); |
184 | | - if (isNaN(bb)) bb = 0; |
185 | | - return aa-bb; |
| 213 | +function smw_sort_numeric( a, b ) { |
| 214 | + aa = parseFloat( smw_getInnerText( a.cells[SORT_COLUMN_INDEX] ) ); |
| 215 | + if ( isNaN( aa ) ) { |
| 216 | + aa = 0; |
| 217 | + } |
| 218 | + bb = parseFloat( smw_getInnerText( b.cells[SORT_COLUMN_INDEX] ) ); |
| 219 | + if ( isNaN( bb ) ) { |
| 220 | + bb = 0; |
| 221 | + } |
| 222 | + return aa-bb; |
186 | 223 | } |
187 | 224 | |
188 | | - |
189 | | -function smw_sort_default(a,b) { |
190 | | - aa = smw_getInnerText(a.cells[SORT_COLUMN_INDEX]); |
191 | | - bb = smw_getInnerText(b.cells[SORT_COLUMN_INDEX]); |
192 | | - if (aa==bb) return 0; |
193 | | - if (aa<bb) return -1; |
194 | | - return 1; |
| 225 | +function smw_sort_default( a, b ) { |
| 226 | + aa = smw_getInnerText( a.cells[SORT_COLUMN_INDEX] ); |
| 227 | + bb = smw_getInnerText( b.cells[SORT_COLUMN_INDEX] ); |
| 228 | + if ( aa == bb ) { |
| 229 | + return 0; |
| 230 | + } |
| 231 | + if ( aa < bb ) { |
| 232 | + return -1; |
| 233 | + } |
| 234 | + return 1; |
195 | 235 | } |
196 | 236 | |
197 | | - |
198 | | -function addEvent(elm, evType, fn, useCapture){ |
199 | 237 | // addEvent and removeEvent |
200 | 238 | // cross-browser event handling for IE5+, NS6 and Mozilla |
201 | 239 | // By Scott Andrew |
202 | | - |
203 | | - if (elm.addEventListener){ |
204 | | - elm.addEventListener(evType, fn, useCapture); |
205 | | - return true; |
206 | | - } else if (elm.attachEvent){ |
207 | | - var r = elm.attachEvent("on"+evType, fn); |
208 | | - return r; |
209 | | - } else { |
210 | | - alert("Handler could not be removed"); |
211 | | - } |
| 240 | +function addEvent( elm, evType, fn, useCapture ) { |
| 241 | + if ( elm.addEventListener ) { |
| 242 | + elm.addEventListener( evType, fn, useCapture ); |
| 243 | + return true; |
| 244 | + } else if ( elm.attachEvent ) { |
| 245 | + var r = elm.attachEvent( 'on' + evType, fn ); |
| 246 | + return r; |
| 247 | + } else { |
| 248 | + alert( 'Handler could not be removed' ); |
| 249 | + } |
212 | 250 | } |
Index: trunk/extensions/SemanticMediaWiki/skins/SMW_custom.css |
— | — | @@ -21,17 +21,16 @@ |
22 | 22 | } |
23 | 23 | |
24 | 24 | /* tables for inline queries */ |
25 | | - |
26 | | -table.smwtable{ |
| 25 | +table.smwtable { |
27 | 26 | background-color: #EEEEFF;/* Note: here and below, we use six digits, since some users had problems with the three digit short forms */ |
28 | 27 | } |
29 | 28 | |
30 | | -table.smwtable th{ |
| 29 | +table.smwtable th { |
31 | 30 | background-color: #EEEEFF; |
32 | 31 | text-align: left; |
33 | 32 | } |
34 | 33 | |
35 | | -table.smwtable td{ |
| 34 | +table.smwtable td { |
36 | 35 | background-color: #FFFFFF; |
37 | 36 | padding: 1px; |
38 | 37 | padding-left: 5px; |
— | — | @@ -40,7 +39,7 @@ |
41 | 40 | vertical-align: top; |
42 | 41 | } |
43 | 42 | |
44 | | -table.smwtable tr.smwfooter td{ |
| 43 | +table.smwtable tr.smwfooter td { |
45 | 44 | font-size: 90%; |
46 | 45 | line-height: 1; |
47 | 46 | background-color: #EEEEFF; |
— | — | @@ -51,40 +50,39 @@ |
52 | 51 | vertical-align: top; |
53 | 52 | } |
54 | 53 | |
55 | | -/*hide keys for sorting table entries*/ |
56 | | -span.smwsortkey{ |
| 54 | +/* hide keys for sorting table entries */ |
| 55 | +span.smwsortkey { |
57 | 56 | display: none; |
58 | 57 | } |
59 | 58 | |
60 | 59 | /* buttons for sort-arrows */ |
61 | | -a.sortheader:hover{ |
| 60 | +a.sortheader:hover { |
62 | 61 | text-decoration: none; |
63 | 62 | } |
64 | 63 | |
65 | 64 | /* "semantic" span classes for Timeline */ |
66 | 65 | |
67 | | -div.smwtimeline{ |
| 66 | +div.smwtimeline { |
68 | 67 | border: 1px solid #AAAAAA; |
69 | 68 | background-color: #F9F9F9; |
70 | 69 | /*text-align: center;*/ |
71 | | - /* After hours of debugging and frustration I now can savely say: IE sucks. (mak) |
| 70 | + /* After hours of debugging and frustration I now can safely say: IE sucks. (mak) |
72 | 71 | You can support Semantic MediaWiki development by not using Internet Explorer. Thanks. |
73 | 72 | (IE centers the Timeline *elements*, which messes up the whole layout) */ |
74 | 73 | } |
75 | 74 | |
76 | | -span.smwtlevent, span.smwtlband, span.smwtlsize, span.smwtlposition{ |
| 75 | +span.smwtlevent, span.smwtlband, span.smwtlsize, span.smwtlposition { |
77 | 76 | display: none; |
78 | 77 | speak: none; |
79 | 78 | } |
80 | 79 | |
81 | | -span.smwtlcomment{ |
| 80 | +span.smwtlcomment { |
82 | 81 | font-style: italic; |
83 | 82 | padding: 5px; |
84 | 83 | } |
85 | 84 | |
86 | 85 | /* Factbox */ |
87 | | - |
88 | | -div.smwfact{ |
| 86 | +div.smwfact { |
89 | 87 | clear: both; |
90 | 88 | background-color: #F9F9F9; |
91 | 89 | padding: 5px; |
— | — | @@ -93,41 +91,40 @@ |
94 | 92 | font-size: 95%; |
95 | 93 | } |
96 | 94 | |
97 | | -div.smwfact td, div.smwfact tr, div.smwfact table{ |
| 95 | +div.smwfact td, div.smwfact tr, div.smwfact table { |
98 | 96 | background-color: #F9F9F9; |
99 | 97 | } |
100 | 98 | |
101 | | -span.smwfactboxhead{ |
| 99 | +span.smwfactboxhead { |
102 | 100 | font-size: 110%; |
103 | 101 | font-weight: bold; |
104 | 102 | float: left; |
105 | 103 | } |
106 | 104 | |
107 | | -table.smwfacttable{ |
| 105 | +table.smwfacttable { |
108 | 106 | border-top: 1px dotted #AAAAAA; |
109 | 107 | width: 100%; |
110 | 108 | clear: both; |
111 | 109 | } |
112 | 110 | |
113 | | -td.smwpropname, th.smwpropname, td.smwspecname{ |
| 111 | +td.smwpropname, th.smwpropname, td.smwspecname { |
114 | 112 | text-align: right; |
115 | 113 | vertical-align: top; |
116 | 114 | padding-right: 1em; |
117 | 115 | } |
118 | 116 | |
119 | | -td.smwprops, td.smwspecs{ |
| 117 | +td.smwprops, td.smwspecs { |
120 | 118 | vertical-align: top; |
121 | 119 | width: 75%; |
122 | 120 | } |
123 | 121 | |
124 | | -div.smwhr hr{ |
| 122 | +div.smwhr hr { |
125 | 123 | background-color: #DDDDDD; |
126 | 124 | color: #DDDDDD; |
127 | 125 | } |
128 | 126 | |
129 | 127 | /* warning messages */ |
130 | | - |
131 | | -span.smwwarning{ |
| 128 | +span.smwwarning { |
132 | 129 | color: #888888; |
133 | 130 | font-style: italic; |
134 | 131 | font-size: 90%; |
— | — | @@ -142,14 +139,14 @@ |
143 | 140 | background: url(images/searchgray_iconsmall.png) center right no-repeat; |
144 | 141 | } |
145 | 142 | |
146 | | -#bodyContent span.smwsearch a{ |
| 143 | +#bodyContent span.smwsearch a { |
147 | 144 | padding-right: 16px; |
148 | 145 | margin-right: 2px; |
149 | 146 | color: #888888; |
150 | 147 | background: url(images/searchgray_iconsmall.png) center right no-repeat; |
151 | 148 | } |
152 | 149 | |
153 | | -#bodyContent span.smwsearch a:hover{ |
| 150 | +#bodyContent span.smwsearch a:hover { |
154 | 151 | text-decoration: none; |
155 | 152 | color: #0000FF; |
156 | 153 | padding-right: 18px; |
— | — | @@ -157,14 +154,14 @@ |
158 | 155 | background: url(images/search_icon.png) center right no-repeat; |
159 | 156 | } |
160 | 157 | |
161 | | -#bodyContent span.swmfactboxheadbrowse a{ |
| 158 | +#bodyContent span.swmfactboxheadbrowse a { |
162 | 159 | padding-right: 16px; |
163 | 160 | margin-right: 2px; |
164 | 161 | color: #000000; |
165 | 162 | background: url(images/browse_iconsmall.png) center right no-repeat; |
166 | 163 | } |
167 | 164 | |
168 | | -#bodyContent span.swmfactboxheadbrowse a:hover{ |
| 165 | +#bodyContent span.swmfactboxheadbrowse a:hover { |
169 | 166 | text-decoration: none; |
170 | 167 | color: #0000FF; |
171 | 168 | padding-right: 18px; |
— | — | @@ -172,14 +169,14 @@ |
173 | 170 | background: url(images/browse_icon.png) center right no-repeat; |
174 | 171 | } |
175 | 172 | |
176 | | -#bodyContent span.smwbrowse a{ |
| 173 | +#bodyContent span.smwbrowse a { |
177 | 174 | padding-right: 16px; |
178 | 175 | margin-right: 2px; |
179 | 176 | color: #888888; |
180 | 177 | background: url(images/browse_iconsmall.png) center right no-repeat; |
181 | 178 | } |
182 | 179 | |
183 | | -#bodyContent span.smwbrowse a:hover{ |
| 180 | +#bodyContent span.smwbrowse a:hover { |
184 | 181 | text-decoration: none; |
185 | 182 | color: #0000FF; |
186 | 183 | padding-right: 18px; |
— | — | @@ -187,29 +184,29 @@ |
188 | 185 | background: url(images/browse_icon.png) center right no-repeat; |
189 | 186 | } |
190 | 187 | |
191 | | -#bodyContent span.smwmap a{ |
| 188 | +#bodyContent span.smwmap a { |
192 | 189 | padding-right: 20px; |
193 | 190 | color: #888888; |
194 | 191 | background: url(images/world.png) center right no-repeat; |
195 | 192 | } |
196 | 193 | |
197 | | -#bodyContent span.smwmap a:hover{ |
| 194 | +#bodyContent span.smwmap a:hover { |
198 | 195 | padding-right: 20px; |
199 | 196 | color: #0000FF; |
200 | 197 | background: url(images/world.png) center right no-repeat; |
201 | 198 | } |
202 | 199 | |
203 | | -#bodyContent span.rdflink{ |
| 200 | +#bodyContent span.rdflink { |
204 | 201 | float: right; |
205 | 202 | } |
206 | 203 | |
207 | | -#bodyContent span.rdflink a{ |
| 204 | +#bodyContent span.rdflink a { |
208 | 205 | padding-right: 20px; |
209 | 206 | color: #888888; |
210 | 207 | background: url(images/rdf_flyer.18.gif) center right no-repeat; |
211 | 208 | } |
212 | 209 | |
213 | | -#bodyContent span.rdflink a:hover{ |
| 210 | +#bodyContent span.rdflink a:hover { |
214 | 211 | text-decoration: none; |
215 | 212 | color: #0000FF; |
216 | 213 | padding-right: 20px; |
— | — | @@ -223,18 +220,18 @@ |
224 | 221 | color: #000000; |
225 | 222 | } |
226 | 223 | |
227 | | -span.smwttpersist span.smwttcontent{ /* show persistent tooltips for non-JavaScript clients */ |
| 224 | +span.smwttpersist span.smwttcontent { /* show persistent tooltips for non-JavaScript clients */ |
228 | 225 | color: #888888; |
229 | 226 | font-style: italic; |
230 | 227 | font-size: 90%; |
231 | 228 | } |
232 | 229 | |
233 | | -span.smwttinline span.smwttcontent{ /* hide inline tooltips for non-JavaScript clients */ |
| 230 | +span.smwttinline span.smwttcontent { /* hide inline tooltips for non-JavaScript clients */ |
234 | 231 | display: none; |
235 | 232 | speak: none; |
236 | 233 | } |
237 | 234 | |
238 | | -span.smwtticon{ /* style for image anchor for persistent tooltips */ |
| 235 | +span.smwtticon { /* style for image anchor for persistent tooltips */ |
239 | 236 | display: none; |
240 | 237 | } |
241 | 238 | |
— | — | @@ -253,11 +250,10 @@ |
254 | 251 | padding-left: 4px; |
255 | 252 | } |
256 | 253 | |
257 | | -/** CSS style file for Semantic MediaWiki Special Browse. */ |
258 | | - |
| 254 | +/* CSS style file for Semantic MediaWiki Special Browse. */ |
259 | 255 | table.smwb-factbox { |
260 | 256 | border-left: 8px solid #DDDDDD; |
261 | | - width:100% |
| 257 | + width: 100% |
262 | 258 | } |
263 | 259 | |
264 | 260 | tr.smwb-title { |
— | — | @@ -267,12 +263,12 @@ |
268 | 264 | } |
269 | 265 | |
270 | 266 | tr.smwb-title td { |
271 | | - padding-left:5px; |
| 267 | + padding-left: 5px; |
272 | 268 | border-bottom: 2px solid white; |
273 | 269 | } |
274 | 270 | |
275 | 271 | tr.smwb-propvalue { |
276 | | - width:100%; |
| 272 | + width: 100%; |
277 | 273 | background-color: #EEEEEE; |
278 | 274 | } |
279 | 275 | |
— | — | @@ -282,7 +278,7 @@ |
283 | 279 | font-weight: bold; |
284 | 280 | font-size: 120%; |
285 | 281 | background-color: #DDDDDD; |
286 | | - padding:0.2em 0.6em; |
| 282 | + padding: 0.2em 0.6em; |
287 | 283 | border-bottom: 2px solid white; |
288 | 284 | border-top: 2px solid white; |
289 | 285 | } |
— | — | @@ -293,7 +289,7 @@ |
294 | 290 | border: 0px solid white; |
295 | 291 | border-bottom: 2px solid white; |
296 | 292 | border-top: 2px solid white; |
297 | | - width:90%; |
| 293 | + width: 90%; |
298 | 294 | } |
299 | 295 | |
300 | 296 | tr.smwb-center { |
— | — | @@ -303,11 +299,10 @@ |
304 | 300 | span.smwb-value { |
305 | 301 | } |
306 | 302 | |
307 | | -/** Inverse factbox */ |
308 | | - |
| 303 | +/* Inverse factbox */ |
309 | 304 | table.smwb-ifactbox { |
310 | 305 | border-right: 8px solid #DDDDDD; |
311 | | - width:100% |
| 306 | + width: 100% |
312 | 307 | } |
313 | 308 | |
314 | 309 | tr.smwb-ititle { |
— | — | @@ -317,14 +312,14 @@ |
318 | 313 | } |
319 | 314 | |
320 | 315 | tr.smwb-ititle td { |
321 | | - padding-left:5px; |
| 316 | + padding-left: 5px; |
322 | 317 | border-bottom: 2px solid white; |
323 | 318 | } |
324 | 319 | |
325 | 320 | tr.smwb-ipropvalue { |
326 | | - width:100%; |
| 321 | + width: 100%; |
327 | 322 | background-color: #EEEEEE; |
328 | | - text-align:right; |
| 323 | + text-align: right; |
329 | 324 | } |
330 | 325 | |
331 | 326 | tr.smwb-ipropvalue th { |
— | — | @@ -332,7 +327,7 @@ |
333 | 328 | font-weight: bold; |
334 | 329 | font-size: 120%; |
335 | 330 | background-color: #DDDDDD; |
336 | | - padding:0.2em 0.6em; |
| 331 | + padding: 0.2em 0.6em; |
337 | 332 | border-bottom: 3px solid white; |
338 | 333 | border-top: 3px solid white; |
339 | 334 | } |
— | — | @@ -341,8 +336,8 @@ |
342 | 337 | background-color: #EEEEEE; |
343 | 338 | border-bottom: 3px solid white; |
344 | 339 | border-top: 3px solid white; |
345 | | - padding-right:1em; |
346 | | - width:90%; |
| 340 | + padding-right: 1em; |
| 341 | + width: 90%; |
347 | 342 | } |
348 | 343 | |
349 | 344 | span.smwb-ivalue { |
Index: trunk/extensions/SemanticMediaWiki/skins/SMW_custom_rtl.css |
— | — | @@ -1,6 +1,5 @@ |
2 | 2 | /* tables for inline queries */ |
3 | | - |
4 | | -table.smwtable th, table.smwtable td{ |
| 3 | +table.smwtable th, table.smwtable td { |
5 | 4 | text-align: right; |
6 | 5 | } |
7 | 6 | |
— | — | @@ -9,16 +8,15 @@ |
10 | 9 | } |
11 | 10 | |
12 | 11 | /* Factbox */ |
13 | | - |
14 | 12 | span.smwfactboxhead { |
15 | | - float:right; |
| 13 | + float: right; |
16 | 14 | } |
17 | 15 | |
18 | 16 | span.smwrdflink { |
19 | | - float:left; |
| 17 | + float: left; |
20 | 18 | } |
21 | 19 | |
22 | | -td.smwpropname, th.smwpropname, td.smwspecname{ |
| 20 | +td.smwpropname, th.smwpropname, td.smwspecname { |
23 | 21 | text-align: left; |
24 | 22 | } |
25 | 23 | |
— | — | @@ -31,7 +29,7 @@ |
32 | 30 | margin-left: 2px; |
33 | 31 | } |
34 | 32 | |
35 | | -#bodyContent span.smwsearch a{ |
| 33 | +#bodyContent span.smwsearch a { |
36 | 34 | padding-right: 0; |
37 | 35 | margin-right: 0; |
38 | 36 | padding-left: 16px; |
— | — | @@ -39,7 +37,7 @@ |
40 | 38 | background: url(images/searchgray_iconsmall.png) center left no-repeat; |
41 | 39 | } |
42 | 40 | |
43 | | -#bodyContent span.smwsearch a:hover{ |
| 41 | +#bodyContent span.smwsearch a:hover { |
44 | 42 | padding-right: 0; |
45 | 43 | margin-right: 0; |
46 | 44 | padding-left: 18px; |
— | — | @@ -47,7 +45,7 @@ |
48 | 46 | background: url(images/search_icon.png) center left no-repeat; |
49 | 47 | } |
50 | 48 | |
51 | | -#bodyContent span.swmfactboxheadbrowse a{ |
| 49 | +#bodyContent span.swmfactboxheadbrowse a { |
52 | 50 | padding-left: 16px; |
53 | 51 | margin-left: 2px; |
54 | 52 | padding-right: 0px; |
— | — | @@ -56,7 +54,7 @@ |
57 | 55 | background: url(images/browse_iconsmall.png) center left no-repeat; |
58 | 56 | } |
59 | 57 | |
60 | | -#bodyContent span.swmfactboxheadbrowse a:hover{ |
| 58 | +#bodyContent span.swmfactboxheadbrowse a:hover { |
61 | 59 | text-decoration: none; |
62 | 60 | color: #0000FF; |
63 | 61 | padding-left: 18px; |
— | — | @@ -66,7 +64,7 @@ |
67 | 65 | background: url(images/browse_icon.png) center left no-repeat; |
68 | 66 | } |
69 | 67 | |
70 | | -#bodyContent span.smwbrowse a{ |
| 68 | +#bodyContent span.smwbrowse a { |
71 | 69 | padding-left: 16px; |
72 | 70 | margin-left: 2px; |
73 | 71 | padding-right: 0px; |
— | — | @@ -75,7 +73,7 @@ |
76 | 74 | background: url(images/browse_iconsmall.png) center left no-repeat; |
77 | 75 | } |
78 | 76 | |
79 | | -#bodyContent span.smwbrowse a:hover{ |
| 77 | +#bodyContent span.smwbrowse a:hover { |
80 | 78 | text-decoration: none; |
81 | 79 | color: #0000FF; |
82 | 80 | padding-left: 18px; |
— | — | @@ -85,30 +83,29 @@ |
86 | 84 | background: url(images/browse_icon.png) center left no-repeat; |
87 | 85 | } |
88 | 86 | |
89 | | -#bodyContent span.smwmap a{ |
| 87 | +#bodyContent span.smwmap a { |
90 | 88 | padding-right: 0; |
91 | 89 | padding-left: 20px; |
92 | 90 | background: url(images/world.png) center left no-repeat; |
93 | 91 | } |
94 | 92 | |
95 | | -#bodyContent span.smwmap a:hover{ |
| 93 | +#bodyContent span.smwmap a:hover { |
96 | 94 | padding-right: 0; |
97 | 95 | padding-left: 20px; |
98 | 96 | } |
99 | 97 | |
100 | 98 | /* RDF icons */ |
101 | | - |
102 | | -#bodyContent span.rdflink{ |
| 99 | +#bodyContent span.rdflink { |
103 | 100 | float: left; |
104 | 101 | } |
105 | 102 | |
106 | | -#bodyContent span.rdflink a{ |
| 103 | +#bodyContent span.rdflink a { |
107 | 104 | padding-left: 20px; |
108 | 105 | padding-right: 0; |
109 | 106 | background: url(images/rdf_flyer.18.gif) center left no-repeat; |
110 | 107 | } |
111 | 108 | |
112 | | -#bodyContent span.rdflink a:hover{ |
| 109 | +#bodyContent span.rdflink a:hover { |
113 | 110 | padding-right: 0; |
114 | 111 | margin-right: 0; |
115 | 112 | padding-left: 20px; |
Index: trunk/extensions/SemanticMediaWiki/skins/SMW_tooltip.js |
— | — | @@ -1,14 +1,14 @@ |
2 | | -addOnloadHook(smw_tooltipInit); |
| 2 | +addOnloadHook( smw_tooltipInit ); |
3 | 3 | |
4 | | -//these two objects needed due to the "hack" in timeline-api.js |
5 | | -//see the comment there |
| 4 | +// these two objects needed due to the "hack" in timeline-api.js |
| 5 | +// see the comment there |
6 | 6 | BubbleTT = new Object(); |
7 | 7 | BubbleTT.Platform= new Object(); |
8 | 8 | |
9 | | -var tt = null; //the tooltip |
10 | | -var all_tt = []; //record all active tooltips |
| 9 | +var tt = null; // the tooltip |
| 10 | +var all_tt = []; // record all active tooltips |
11 | 11 | |
12 | | -var imagePath=wgScriptPath+"/extensions/SemanticMediaWiki/skins/images/"; |
| 12 | +var imagePath = wgScriptPath + '/extensions/SemanticMediaWiki/skins/images/'; |
13 | 13 | |
14 | 14 | // Dimensions of persistent tooltips |
15 | 15 | var SMWTT_WIDTH_P = 200; |
— | — | @@ -18,111 +18,115 @@ |
19 | 19 | var SMWTT_WIDTH_I = 175; |
20 | 20 | var SMWTT_HEIGHT_I = 70; |
21 | 21 | |
22 | | -/*register events for the tooltips*/ |
| 22 | +/* register events for the tooltips */ |
23 | 23 | function smw_tooltipInit() { |
24 | | - var anchs = document.getElementsByTagName("span"); |
25 | | - for (var i=0; i<anchs.length; i++) { |
26 | | - if(anchs[i].className=="smwttpersist")smw_makePersistentTooltip(anchs[i]); |
27 | | - if(anchs[i].className=="smwttinline")smw_makeInlineTooltip(anchs[i]); |
| 24 | + var anchs = document.getElementsByTagName( 'span' ); |
| 25 | + for ( var i = 0; i < anchs.length; i++ ) { |
| 26 | + if( anchs[i].className == 'smwttpersist' ) { |
| 27 | + smw_makePersistentTooltip( anchs[i] ); |
| 28 | + } |
| 29 | + if( anchs[i].className == 'smwttinline' ) { |
| 30 | + smw_makeInlineTooltip( anchs[i] ); |
| 31 | + } |
28 | 32 | } |
29 | 33 | } |
30 | 34 | |
31 | | -function smw_makeInlineTooltip(a) { |
32 | | - var spans = a.getElementsByTagName("span"); |
33 | | - a.className="smwttactiveinline"; |
34 | | - //make content invisible |
35 | | - //done here and not in the css so that non-js clients can see it |
36 | | - for (var i=0;i<spans.length;i++) { |
37 | | - if(spans[i].className=="smwttcontent"){ |
38 | | - spans[i].style.display="none"; |
| 35 | +function smw_makeInlineTooltip( a ) { |
| 36 | + var spans = a.getElementsByTagName( 'span' ); |
| 37 | + a.className = 'smwttactiveinline'; |
| 38 | + // make content invisible |
| 39 | + // done here and not in the CSS so that non-JS clients can see it |
| 40 | + for ( var i = 0; i < spans.length; i++ ) { |
| 41 | + if( spans[i].className == 'smwttcontent' ) { |
| 42 | + spans[i].style.display = 'none'; |
39 | 43 | } |
40 | 44 | } |
41 | | - a.onmouseover=smw_showTooltipInline; |
42 | | - a.onmouseout=smw_hideTooltip; |
| 45 | + a.onmouseover = smw_showTooltipInline; |
| 46 | + a.onmouseout = smw_hideTooltip; |
43 | 47 | } |
44 | 48 | |
45 | | -function smw_makePersistentTooltip(a) { |
46 | | - var spans = a.getElementsByTagName("span"); |
47 | | - a.className="smwttactivepersist"; |
48 | | - for (var i=0;i<spans.length;i++) { |
49 | | - if(spans[i].className=="smwtticon"){ |
50 | | - img=document.createElement("img"); |
51 | | - img.setAttribute("src",imagePath+spans[i].innerHTML); |
52 | | - img.className="smwttimg"; |
53 | | - a.replaceChild(img, a.firstChild); |
| 49 | +function smw_makePersistentTooltip( a ) { |
| 50 | + var spans = a.getElementsByTagName( 'span' ); |
| 51 | + a.className = 'smwttactivepersist'; |
| 52 | + for ( var i = 0; i < spans.length; i++ ) { |
| 53 | + if( spans[i].className == 'smwtticon' ){ |
| 54 | + img=document.createElement( 'img' ); |
| 55 | + img.setAttribute( 'src', imagePath + spans[i].innerHTML ); |
| 56 | + img.className = 'smwttimg'; |
| 57 | + a.replaceChild( img, a.firstChild ); |
54 | 58 | } |
55 | | - //make content invisible |
56 | | - //done here and not in the css so that non-js clients can see it |
57 | | - if(spans[i].className=="smwttcontent"){ |
58 | | - spans[i].style.display="none"; |
| 59 | + // make content invisible |
| 60 | + // done here and not in the css so that non-js clients can see it |
| 61 | + if( spans[i].className == 'smwttcontent' ) { |
| 62 | + spans[i].style.display = 'none'; |
59 | 63 | } |
60 | 64 | } |
61 | | - //register event with anchor |
62 | | - if (BubbleTT.Platform.browser.isIE) { |
63 | | - a.attachEvent("onclick", smw_showTooltipPersist); |
| 65 | + // register event with anchor |
| 66 | + if ( BubbleTT.Platform.browser.isIE ) { |
| 67 | + a.attachEvent( 'onclick', smw_showTooltipPersist ); |
64 | 68 | } else { |
65 | | - a.addEventListener("click", smw_showTooltipPersist, false); |
| 69 | + a.addEventListener( 'click', smw_showTooltipPersist, false ); |
66 | 70 | } |
67 | 71 | } |
68 | 72 | |
69 | | -/*display tooltip*/ |
70 | | -function smw_showTooltipPersist(e) { |
71 | | - var x; |
72 | | - var y; |
73 | | - if(BubbleTT.Platform.browser.isIE){ |
74 | | - c = BubbleTT.getElementCoordinates(window.event.srcElement); |
| 73 | +/* display tooltip */ |
| 74 | +function smw_showTooltipPersist( e ) { |
| 75 | + var x; |
| 76 | + var y; |
| 77 | + if( BubbleTT.Platform.browser.isIE ) { |
| 78 | + c = BubbleTT.getElementCoordinates( window.event.srcElement ); |
75 | 79 | x = c.left; |
76 | 80 | y = c.top; |
77 | | - }else{ |
| 81 | + } else { |
78 | 82 | x = e.pageX; |
79 | 83 | y = e.pageY; |
80 | 84 | } |
81 | | - var origin = (BubbleTT.Platform.browser.isIE) ? window.event.srcElement : e.target; |
82 | | - //If the anchor of the tooltip contains hmtl, the source of the event is not the anchor. |
83 | | - //As we need a reference to it to get the tooltip content we need to go up the dom-tree. |
84 | | - while( !( origin.className=="smwttactivepersist" ) ) { |
| 85 | + var origin = ( BubbleTT.Platform.browser.isIE ) ? window.event.srcElement : e.target; |
| 86 | + // If the anchor of the tooltip contains hmtl, the source of the event is not the anchor. |
| 87 | + // As we need a reference to it to get the tooltip content we need to go up the dom-tree. |
| 88 | + while( !( origin.className == 'smwttactivepersist' ) ) { |
85 | 89 | origin = origin.parentNode; |
86 | 90 | }; |
87 | 91 | |
88 | 92 | tt = BubbleTT.createBubbleForPoint( true, origin, x, y, SMWTT_WIDTH_P, SMWTT_HEIGHT_P ); |
89 | | - all_tt.push(tt); |
90 | | - BubbleTT.fillBubble(tt, origin); |
| 93 | + all_tt.push( tt ); |
| 94 | + BubbleTT.fillBubble( tt, origin ); |
91 | 95 | |
92 | | - //unregister handler to open bubble |
93 | | - if (BubbleTT.Platform.browser.isIE) { |
94 | | - origin.detachEvent("onclick", smw_showTooltipPersist); |
| 96 | + // unregister handler to open bubble |
| 97 | + if ( BubbleTT.Platform.browser.isIE ) { |
| 98 | + origin.detachEvent( 'onclick', smw_showTooltipPersist ); |
95 | 99 | } else { |
96 | | - origin.removeEventListener("click", smw_showTooltipPersist, false); |
| 100 | + origin.removeEventListener( 'click', smw_showTooltipPersist, false ); |
97 | 101 | } |
98 | 102 | } |
99 | 103 | |
100 | | - |
101 | | - |
102 | | -function smw_showTooltipInline(e) { |
103 | | - if (tt != null) { // show only one tooltip at a time |
| 104 | +function smw_showTooltipInline( e ) { |
| 105 | + if ( tt != null ) { // show only one tooltip at a time |
104 | 106 | return; |
105 | 107 | } |
106 | 108 | var x; |
107 | 109 | var y; |
108 | | - if(BubbleTT.Platform.browser.isIE){ |
109 | | - c = BubbleTT.getElementCoordinates(window.event.srcElement); |
| 110 | + if( BubbleTT.Platform.browser.isIE ) { |
| 111 | + c = BubbleTT.getElementCoordinates( window.event.srcElement ); |
110 | 112 | x = c.left; |
111 | 113 | y = c.top; |
112 | | - }else{ |
| 114 | + } else { |
113 | 115 | x = e.pageX; |
114 | 116 | y = e.pageY; |
115 | 117 | } |
116 | | - var origin = (BubbleTT.Platform.browser.isIE) ? window.event.srcElement : e.target; |
117 | | - //If the anchor of the tooltip contains hmtl, the source of the event is not the anchor. |
118 | | - //As we need a reference to it to get the tooltip content we need to go up the dom-tree. |
119 | | - while(!(origin.className=="smwttactiveinline"))origin=origin.parentNode; |
| 118 | + var origin = ( BubbleTT.Platform.browser.isIE ) ? window.event.srcElement : e.target; |
| 119 | + // If the anchor of the tooltip contains hmtl, the source of the event is not the anchor. |
| 120 | + // As we need a reference to it to get the tooltip content we need to go up the dom-tree. |
| 121 | + while( !( origin.className == 'smwttactiveinline' ) ) { |
| 122 | + origin = origin.parentNode; |
| 123 | + } |
120 | 124 | var doc = origin.ownerDocument; |
121 | 125 | tt = BubbleTT.createBubbleForPoint( false, origin, x, y, SMWTT_WIDTH_I, SMWTT_HEIGHT_I ); |
122 | | - BubbleTT.fillBubble(tt, origin); |
| 126 | + BubbleTT.fillBubble( tt, origin ); |
123 | 127 | } |
124 | 128 | |
125 | | -function smw_hideTooltip(){ |
126 | | - if (tt) { |
| 129 | +function smw_hideTooltip() { |
| 130 | + if ( tt ) { |
127 | 131 | tt.close(); |
128 | 132 | tt = null; |
129 | 133 | } |
— | — | @@ -132,7 +136,7 @@ |
133 | 137 | * Provided for the convenience of SMW extensions, used, e.g., by Halo |
134 | 138 | */ |
135 | 139 | function _smw_hideAllTooltips() { |
136 | | - for(var i = 0; i < all_tt.length; i++) { |
| 140 | + for( var i = 0; i < all_tt.length; i++ ) { |
137 | 141 | all_tt[i].close(); |
138 | 142 | } |
139 | 143 | all_tt = []; |
— | — | @@ -143,17 +147,17 @@ |
144 | 148 | * used to place tooltips in IE as mouse coordinates |
145 | 149 | * behave strangely |
146 | 150 | */ |
147 | | -BubbleTT.getElementCoordinates = function(elmt) { |
| 151 | +BubbleTT.getElementCoordinates = function( elmt ) { |
148 | 152 | var left = 0; |
149 | 153 | var top = 0; |
150 | 154 | |
151 | | - if (elmt.nodeType != 1) { |
| 155 | + if ( elmt.nodeType != 1 ) { |
152 | 156 | elmt = elmt.parentNode; |
153 | 157 | } |
154 | 158 | |
155 | | - while (elmt != null) { |
| 159 | + while ( elmt != null ) { |
156 | 160 | left += elmt.offsetLeft; |
157 | | - top += elmt.offsetTop - (elmt.scrollTop ? elmt.scrollTop : 0); |
| 161 | + top += elmt.offsetTop - ( elmt.scrollTop ? elmt.scrollTop : 0 ); |
158 | 162 | elmt = elmt.offsetParent; |
159 | 163 | } |
160 | 164 | // consider document scroll position too |
— | — | @@ -163,11 +167,10 @@ |
164 | 168 | |
165 | 169 | |
166 | 170 | /*================================================================== |
167 | | - * code below from Simile-Timeline (util/graphics.js) modified |
| 171 | + * code below from Simile-Timeline (util/graphics.js) modified |
168 | 172 | *================================================================== |
169 | 173 | */ |
170 | 174 | |
171 | | - |
172 | 175 | BubbleTT._bubbleMargins = { |
173 | 176 | top: 33, |
174 | 177 | bottom: 42, |
— | — | @@ -175,8 +178,8 @@ |
176 | 179 | right: 40 |
177 | 180 | }; |
178 | 181 | |
179 | | -/*pixels from boundary of the whole bubble div to the tip of the arrow*/ |
180 | | -BubbleTT._arrowOffsets = { |
| 182 | +/* pixels from boundary of the whole bubble div to the tip of the arrow */ |
| 183 | +BubbleTT._arrowOffsets = { |
181 | 184 | top: 0, |
182 | 185 | bottom: 9, |
183 | 186 | left: 1, |
— | — | @@ -187,30 +190,28 @@ |
188 | 191 | BubbleTT._bubblePointOffset = 15; |
189 | 192 | BubbleTT._halfArrowWidth = 18; |
190 | 193 | |
191 | | - |
192 | | - |
193 | | -/*creates an empty bubble*/ |
194 | | -BubbleTT.createBubbleForPoint = function(closingButton, origin, pageX, pageY, contentWidth, contentHeight) { |
195 | | - var doc = origin.ownerDocument; |
| 194 | +/* creates an empty bubble */ |
| 195 | +BubbleTT.createBubbleForPoint = function( closingButton, origin, pageX, pageY, contentWidth, contentHeight ) { |
| 196 | + var doc = origin.ownerDocument; |
196 | 197 | var bubble = { |
197 | 198 | _closed: false, |
198 | 199 | _doc: doc, |
199 | | - close: function() { |
200 | | - if (!this._closed) { |
201 | | - this._doc.body.removeChild(this._div); |
| 200 | + close: function() { |
| 201 | + if ( !this._closed ) { |
| 202 | + this._doc.body.removeChild( this._div ); |
202 | 203 | this._doc = null; |
203 | 204 | this._div = null; |
204 | 205 | this._content = null; |
205 | 206 | this._closed = true; |
206 | | - if(closingButton){//for persistent bubble: re-attach handler to open bubble again |
207 | | - if (BubbleTT.Platform.browser.isIE) { |
208 | | - origin.attachEvent("onclick", smw_showTooltipPersist); |
209 | | - } else { |
210 | | - origin.addEventListener("click", smw_showTooltipPersist, false); |
| 207 | + if( closingButton ) { // for persistent bubble: re-attach handler to open bubble again |
| 208 | + if ( BubbleTT.Platform.browser.isIE ) { |
| 209 | + origin.attachEvent( 'onclick', smw_showTooltipPersist ); |
| 210 | + } else { |
| 211 | + origin.addEventListener( 'click', smw_showTooltipPersist, false ); |
| 212 | + } |
| 213 | + } |
211 | 214 | } |
212 | 215 | } |
213 | | - } |
214 | | - } |
215 | 216 | }; |
216 | 217 | |
217 | 218 | var docWidth = doc.body.offsetWidth; |
— | — | @@ -220,170 +221,168 @@ |
221 | 222 | var bubbleWidth = margins.left + contentWidth + margins.right; |
222 | 223 | var bubbleHeight = margins.top + contentHeight + margins.bottom; |
223 | 224 | |
224 | | - var pngIsTranslucent = (!BubbleTT.Platform.browser.isIE) || (BubbleTT.Platform.browser.majorVersion > 6); |
| 225 | + var pngIsTranslucent = ( !BubbleTT.Platform.browser.isIE ) || ( BubbleTT.Platform.browser.majorVersion > 6 ); |
225 | 226 | |
226 | | - var setImg = function(elmt, url, width, height) { |
227 | | - elmt.style.position = "absolute"; |
228 | | - elmt.style.width = width + "px"; |
229 | | - elmt.style.height = height + "px"; |
230 | | - if (pngIsTranslucent) { |
231 | | - elmt.style.background = "url(" + url + ")"; |
| 227 | + var setImg = function( elmt, url, width, height ) { |
| 228 | + elmt.style.position = 'absolute'; |
| 229 | + elmt.style.width = width + 'px'; |
| 230 | + elmt.style.height = height + 'px'; |
| 231 | + if ( pngIsTranslucent ) { |
| 232 | + elmt.style.background = 'url(' + url + ')'; |
232 | 233 | } else { |
233 | 234 | elmt.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url +"', sizingMethod='crop')"; |
234 | 235 | } |
235 | 236 | }; |
236 | | - |
237 | | - var div = doc.createElement("div"); |
238 | | - div.style.width = bubbleWidth + "px"; |
239 | | - div.style.height = bubbleHeight + "px"; |
240 | | - div.style.position = "absolute"; |
| 237 | + |
| 238 | + var div = doc.createElement( 'div' ); |
| 239 | + div.style.width = bubbleWidth + 'px'; |
| 240 | + div.style.height = bubbleHeight + 'px'; |
| 241 | + div.style.position = 'absolute'; |
241 | 242 | div.style.zIndex = 1000; |
242 | 243 | bubble._div = div; |
243 | 244 | |
244 | | - var divInner = doc.createElement("div"); |
245 | | - divInner.style.width = "100%"; |
246 | | - divInner.style.height = "100%"; |
247 | | - divInner.style.position = "relative"; |
248 | | - div.appendChild(divInner); |
| 245 | + var divInner = doc.createElement( 'div' ); |
| 246 | + divInner.style.width = '100%'; |
| 247 | + divInner.style.height = '100%'; |
| 248 | + divInner.style.position = 'relative'; |
| 249 | + div.appendChild( divInner ); |
249 | 250 | |
250 | | - var createImg = function(url, left, top, width, height) { |
251 | | - var divImg = doc.createElement("div"); |
252 | | - divImg.style.left = left + "px"; |
253 | | - divImg.style.top = top + "px"; |
254 | | - setImg(divImg, url, width, height); |
255 | | - divInner.appendChild(divImg); |
| 251 | + var createImg = function( url, left, top, width, height ) { |
| 252 | + var divImg = doc.createElement( 'div' ); |
| 253 | + divImg.style.left = left + 'px'; |
| 254 | + divImg.style.top = top + 'px'; |
| 255 | + setImg( divImg, url, width, height ); |
| 256 | + divInner.appendChild( divImg ); |
256 | 257 | }; |
257 | 258 | |
258 | | - createImg(imagePath + "bubble-top-left.png", 0, 0, margins.left, margins.top); |
259 | | - createImg(imagePath + "bubble-top.png", margins.left, 0, contentWidth, margins.top); |
260 | | - createImg(imagePath + "bubble-top-right.png", margins.left + contentWidth, 0, margins.right, margins.top); |
| 259 | + createImg( imagePath + 'bubble-top-left.png', 0, 0, margins.left, margins.top ); |
| 260 | + createImg( imagePath + 'bubble-top.png', margins.left, 0, contentWidth, margins.top ); |
| 261 | + createImg( imagePath + 'bubble-top-right.png', margins.left + contentWidth, 0, margins.right, margins.top ); |
261 | 262 | |
262 | | - createImg(imagePath + "bubble-left.png", 0, margins.top, margins.left, contentHeight); |
263 | | - createImg(imagePath + "bubble-right.png", margins.left + contentWidth, margins.top, margins.right, contentHeight); |
| 263 | + createImg( imagePath + 'bubble-left.png', 0, margins.top, margins.left, contentHeight ); |
| 264 | + createImg( imagePath + 'bubble-right.png', margins.left + contentWidth, margins.top, margins.right, contentHeight ); |
264 | 265 | |
265 | | - createImg(imagePath + "bubble-bottom-left.png", 0, margins.top + contentHeight, margins.left, margins.bottom); |
266 | | - createImg(imagePath + "bubble-bottom.png", margins.left, margins.top + contentHeight, contentWidth, margins.bottom); |
267 | | - createImg(imagePath + "bubble-bottom-right.png", margins.left + contentWidth, margins.top + contentHeight, margins.right, margins.bottom); |
| 266 | + createImg( imagePath + 'bubble-bottom-left.png', 0, margins.top + contentHeight, margins.left, margins.bottom ); |
| 267 | + createImg( imagePath + 'bubble-bottom.png', margins.left, margins.top + contentHeight, contentWidth, margins.bottom ); |
| 268 | + createImg( imagePath + 'bubble-bottom-right.png', margins.left + contentWidth, margins.top + contentHeight, margins.right, margins.bottom ); |
268 | 269 | |
269 | | - //closing button |
270 | | - if(closingButton){ |
271 | | - var divClose = doc.createElement("div"); |
272 | | - divClose.style.left = (bubbleWidth - margins.right + BubbleTT._bubblePadding - 16 - 2) + "px"; |
273 | | - divClose.style.top = (margins.top - BubbleTT._bubblePadding + 1) + "px"; |
274 | | - divClose.style.cursor = "pointer"; |
275 | | - setImg(divClose, imagePath + "close-button.png", 16, 16); |
276 | | - BubbleTT.DOM.registerEventWithObject(divClose, "click", bubble, bubble.close); |
277 | | - divInner.appendChild(divClose); |
| 270 | + // closing button |
| 271 | + if( closingButton ) { |
| 272 | + var divClose = doc.createElement( 'div' ); |
| 273 | + divClose.style.left = ( bubbleWidth - margins.right + BubbleTT._bubblePadding - 16 - 2 ) + 'px'; |
| 274 | + divClose.style.top = ( margins.top - BubbleTT._bubblePadding + 1 ) + 'px'; |
| 275 | + divClose.style.cursor = 'pointer'; |
| 276 | + setImg( divClose, imagePath + 'close-button.png', 16, 16 ); |
| 277 | + BubbleTT.DOM.registerEventWithObject( divClose, 'click', bubble, bubble.close ); |
| 278 | + divInner.appendChild( divClose ); |
278 | 279 | } |
279 | 280 | |
280 | | - var divContent = doc.createElement("div"); |
281 | | - divContent.style.position = "absolute"; |
282 | | - divContent.style.left = margins.left + "px"; |
283 | | - divContent.style.top = margins.top + "px"; |
284 | | - divContent.style.width = contentWidth + "px"; |
285 | | - divContent.style.height = contentHeight + "px"; |
286 | | - divContent.style.overflow = "auto"; |
287 | | - divContent.style.background = "white"; |
288 | | - divInner.appendChild(divContent); |
| 281 | + var divContent = doc.createElement( 'div' ); |
| 282 | + divContent.style.position = 'absolute'; |
| 283 | + divContent.style.left = margins.left + 'px'; |
| 284 | + divContent.style.top = margins.top + 'px'; |
| 285 | + divContent.style.width = contentWidth + 'px'; |
| 286 | + divContent.style.height = contentHeight + 'px'; |
| 287 | + divContent.style.overflow = 'auto'; |
| 288 | + divContent.style.background = 'white'; |
| 289 | + divInner.appendChild( divContent ); |
289 | 290 | bubble.content = divContent; |
290 | 291 | |
291 | 292 | (function() { |
292 | | - if (pageX - BubbleTT._halfArrowWidth - BubbleTT._bubblePadding > 0 && |
293 | | - pageX + BubbleTT._halfArrowWidth + BubbleTT._bubblePadding < docWidth) { |
294 | | - |
295 | | - var left = pageX - Math.round(contentWidth / 2) - margins.left; |
296 | | - left = pageX < (docWidth / 2) ? |
297 | | - Math.max(left, -(margins.left - BubbleTT._bubblePadding)) : |
298 | | - Math.min(left, docWidth + (margins.right - BubbleTT._bubblePadding) - bubbleWidth); |
299 | | - |
300 | | - if (pageY - BubbleTT._bubblePointOffset - bubbleHeight > 0) { // top |
301 | | - var divImg = doc.createElement("div"); |
302 | | - |
303 | | - divImg.style.left = (pageX - BubbleTT._halfArrowWidth - left) + "px"; |
304 | | - divImg.style.top = (margins.top + contentHeight) + "px"; |
305 | | - setImg(divImg, imagePath + "bubble-bottom-arrow.png", 37, margins.bottom); |
306 | | - divInner.appendChild(divImg); |
307 | | - |
308 | | - div.style.left = left + "px"; |
309 | | - div.style.top = (pageY - BubbleTT._bubblePointOffset - bubbleHeight + |
310 | | - BubbleTT._arrowOffsets.bottom) + "px"; |
311 | | - |
| 293 | + if ( pageX - BubbleTT._halfArrowWidth - BubbleTT._bubblePadding > 0 && |
| 294 | + pageX + BubbleTT._halfArrowWidth + BubbleTT._bubblePadding < docWidth ) { |
| 295 | + |
| 296 | + var left = pageX - Math.round( contentWidth / 2 ) - margins.left; |
| 297 | + left = pageX < ( docWidth / 2 ) ? |
| 298 | + Math.max( left, -( margins.left - BubbleTT._bubblePadding ) ) : |
| 299 | + Math.min( left, docWidth + ( margins.right - BubbleTT._bubblePadding ) - bubbleWidth ); |
| 300 | + |
| 301 | + if ( pageY - BubbleTT._bubblePointOffset - bubbleHeight > 0 ) { // top |
| 302 | + var divImg = doc.createElement( 'div' ); |
| 303 | + |
| 304 | + divImg.style.left = ( pageX - BubbleTT._halfArrowWidth - left ) + 'px'; |
| 305 | + divImg.style.top = ( margins.top + contentHeight ) + 'px'; |
| 306 | + setImg( divImg, imagePath + 'bubble-bottom-arrow.png', 37, margins.bottom ); |
| 307 | + divInner.appendChild( divImg ); |
| 308 | + |
| 309 | + div.style.left = left + 'px'; |
| 310 | + div.style.top = ( pageY - BubbleTT._bubblePointOffset - bubbleHeight + |
| 311 | + BubbleTT._arrowOffsets.bottom ) + 'px'; |
| 312 | + |
312 | 313 | return; |
313 | | - } else if (pageY + BubbleTT._bubblePointOffset + bubbleHeight < docHeight) { // bottom |
314 | | - var divImg = doc.createElement("div"); |
315 | | - |
316 | | - divImg.style.left = (pageX - BubbleTT._halfArrowWidth - left) + "px"; |
317 | | - divImg.style.top = "0px"; |
318 | | - setImg(divImg, imagePath + "bubble-top-arrow.png", 37, margins.top); |
319 | | - divInner.appendChild(divImg); |
320 | | - |
321 | | - div.style.left = left + "px"; |
322 | | - div.style.top = (pageY + BubbleTT._bubblePointOffset - |
323 | | - BubbleTT._arrowOffsets.top) + "px"; |
324 | | - |
| 314 | + } else if ( pageY + BubbleTT._bubblePointOffset + bubbleHeight < docHeight ) { // bottom |
| 315 | + var divImg = doc.createElement( 'div' ); |
| 316 | + |
| 317 | + divImg.style.left = ( pageX - BubbleTT._halfArrowWidth - left ) + 'px'; |
| 318 | + divImg.style.top = '0px'; |
| 319 | + setImg( divImg, imagePath + 'bubble-top-arrow.png', 37, margins.top ); |
| 320 | + divInner.appendChild( divImg ); |
| 321 | + |
| 322 | + div.style.left = left + 'px'; |
| 323 | + div.style.top = ( pageY + BubbleTT._bubblePointOffset - |
| 324 | + BubbleTT._arrowOffsets.top ) + 'px'; |
| 325 | + |
325 | 326 | return; |
326 | 327 | } |
327 | 328 | } |
328 | 329 | |
329 | | - var top = pageY - Math.round(contentHeight / 2) - margins.top; |
330 | | - top = pageY < (docHeight / 2) ? |
331 | | - Math.max(top, -(margins.top - BubbleTT._bubblePadding)) : |
332 | | - Math.min(top, docHeight + (margins.bottom - BubbleTT._bubblePadding) - bubbleHeight); |
333 | | - |
334 | | - if (pageX - BubbleTT._bubblePointOffset - bubbleWidth > 0) { // left |
335 | | - var divImg = doc.createElement("div"); |
336 | | - |
337 | | - divImg.style.left = (margins.left + contentWidth) + "px"; |
338 | | - divImg.style.top = (pageY - BubbleTT._halfArrowWidth - top) + "px"; |
339 | | - setImg(divImg, imagePath + "bubble-right-arrow.png", margins.right, 37); |
340 | | - divInner.appendChild(divImg); |
341 | | - |
342 | | - div.style.left = (pageX - BubbleTT._bubblePointOffset - bubbleWidth + |
343 | | - BubbleTT._arrowOffsets.right) + "px"; |
344 | | - div.style.top = top + "px"; |
| 330 | + var top = pageY - Math.round( contentHeight / 2 ) - margins.top; |
| 331 | + top = pageY < ( docHeight / 2 ) ? |
| 332 | + Math.max( top, -(margins.top - BubbleTT._bubblePadding ) ) : |
| 333 | + Math.min( top, docHeight + ( margins.bottom - BubbleTT._bubblePadding ) - bubbleHeight ); |
| 334 | + |
| 335 | + if ( pageX - BubbleTT._bubblePointOffset - bubbleWidth > 0 ) { // left |
| 336 | + var divImg = doc.createElement( 'div' ); |
| 337 | + |
| 338 | + divImg.style.left = ( margins.left + contentWidth ) + 'px'; |
| 339 | + divImg.style.top = ( pageY - BubbleTT._halfArrowWidth - top ) + 'px'; |
| 340 | + setImg( divImg, imagePath + 'bubble-right-arrow.png', margins.right, 37 ); |
| 341 | + divInner.appendChild( divImg ); |
| 342 | + |
| 343 | + div.style.left = ( pageX - BubbleTT._bubblePointOffset - bubbleWidth + |
| 344 | + BubbleTT._arrowOffsets.right ) + 'px'; |
| 345 | + div.style.top = top + 'px'; |
345 | 346 | } else { // right |
346 | | - var divImg = doc.createElement("div"); |
347 | | - |
348 | | - divImg.style.left = "0px"; |
349 | | - divImg.style.top = (pageY - BubbleTT._halfArrowWidth - top) + "px"; |
350 | | - setImg(divImg, imagePath + "bubble-left-arrow.png", margins.left, 37); |
351 | | - divInner.appendChild(divImg); |
352 | | - |
353 | | - div.style.left = (pageX + BubbleTT._bubblePointOffset - |
354 | | - BubbleTT._arrowOffsets.left) + "px"; |
355 | | - div.style.top = top + "px"; |
| 347 | + var divImg = doc.createElement( 'div' ); |
| 348 | + |
| 349 | + divImg.style.left = '0px'; |
| 350 | + divImg.style.top = ( pageY - BubbleTT._halfArrowWidth - top ) + 'px'; |
| 351 | + setImg( divImg, imagePath + 'bubble-left-arrow.png', margins.left, 37 ); |
| 352 | + divInner.appendChild( divImg ); |
| 353 | + |
| 354 | + div.style.left = ( pageX + BubbleTT._bubblePointOffset - |
| 355 | + BubbleTT._arrowOffsets.left ) + 'px'; |
| 356 | + div.style.top = top + 'px'; |
356 | 357 | } |
357 | 358 | })(); |
358 | 359 | |
359 | | - doc.body.appendChild(div); |
| 360 | + doc.body.appendChild( div ); |
360 | 361 | return bubble; |
361 | 362 | }; |
362 | 363 | |
363 | | - |
364 | | - |
365 | | -/*fill bubble with html content*/ |
366 | | -BubbleTT.fillBubble = function(bubble,origin){ |
367 | | - doc=bubble._doc; |
368 | | - div = doc.createElement("div"); |
369 | | - div.className = "smwtt"; |
370 | | - //get tooltip content |
371 | | - spans=origin.getElementsByTagName("span"); |
372 | | - for (i=0; i<spans.length; i++){ |
373 | | - /* "\n" and "<!--br-->" are replaced by "<br />" to support linebreaks |
374 | | - * in tooltips without corrupting the page for non js-clients. |
| 364 | +/* fill bubble with HTML content */ |
| 365 | +BubbleTT.fillBubble = function( bubble, origin ) { |
| 366 | + doc = bubble._doc; |
| 367 | + div = doc.createElement( 'div' ); |
| 368 | + div.className = 'smwtt'; |
| 369 | + // get tooltip content |
| 370 | + spans = origin.getElementsByTagName( 'span' ); |
| 371 | + for ( i = 0; i < spans.length; i++ ) { |
| 372 | + /* "\n" and "<!--br-->" are replaced by "<br />" to support linebreaks |
| 373 | + * in tooltips without corrupting the page for non JS-clients. |
375 | 374 | */ |
376 | | - if(spans[i].className=="smwttcontent") { |
377 | | - div.innerHTML=spans[i].innerHTML.replace(/\n/g,"<br />"); |
378 | | - div.innerHTML=spans[i].innerHTML.replace(/<!--br-->/g,"<br />"); |
| 375 | + if( spans[i].className == 'smwttcontent' ) { |
| 376 | + div.innerHTML = spans[i].innerHTML.replace( /\n/g, '<br />' ); |
| 377 | + div.innerHTML = spans[i].innerHTML.replace( /<!--br-->/g, '<br />' ); |
379 | 378 | } |
380 | 379 | } |
381 | | - bubble.content.appendChild(div); |
| 380 | + bubble.content.appendChild( div ); |
382 | 381 | }; |
383 | 382 | |
384 | 383 | |
385 | 384 | /*================================================================== |
386 | 385 | * all below from Simile-Timeline (util/platform.js) with classname |
387 | | - * Timeline replaced by BubbleTT to avoid complications with both |
| 386 | + * Timeline replaced by BubbleTT to avoid complications with both |
388 | 387 | * scripts running on the same page |
389 | 388 | *================================================================== |
390 | 389 | */ |
— | — | @@ -402,71 +401,71 @@ |
403 | 402 | isFirefox: false, |
404 | 403 | isOpera: false, |
405 | 404 | isSafari: false, |
406 | | - |
| 405 | + |
407 | 406 | majorVersion: 0, |
408 | 407 | minorVersion: 0 |
409 | 408 | }; |
410 | 409 | |
411 | 410 | (function() { |
412 | 411 | var an = navigator.appName.toLowerCase(); |
413 | | - var ua = navigator.userAgent.toLowerCase(); |
| 412 | + var ua = navigator.userAgent.toLowerCase(); |
414 | 413 | |
415 | 414 | /* |
416 | 415 | * Operating system |
417 | 416 | */ |
418 | | - BubbleTT.Platform.os.isMac = (ua.indexOf('mac') != -1); |
419 | | - BubbleTT.Platform.os.isWin = (ua.indexOf('win') != -1); |
| 417 | + BubbleTT.Platform.os.isMac = ( ua.indexOf( 'mac' ) != -1 ); |
| 418 | + BubbleTT.Platform.os.isWin = ( ua.indexOf( 'win' ) != -1 ); |
420 | 419 | BubbleTT.Platform.os.isWin32 = BubbleTT.Platform.isWin && ( |
421 | | - ua.indexOf('95') != -1 || |
422 | | - ua.indexOf('98') != -1 || |
423 | | - ua.indexOf('nt') != -1 || |
424 | | - ua.indexOf('win32') != -1 || |
425 | | - ua.indexOf('32bit') != -1 |
| 420 | + ua.indexOf( '95' ) != -1 || |
| 421 | + ua.indexOf( '98' ) != -1 || |
| 422 | + ua.indexOf( 'nt' ) != -1 || |
| 423 | + ua.indexOf( 'win32' ) != -1 || |
| 424 | + ua.indexOf( '32bit' ) != -1 |
426 | 425 | ); |
427 | | - BubbleTT.Platform.os.isUnix = (ua.indexOf('x11') != -1); |
| 426 | + BubbleTT.Platform.os.isUnix = ( ua.indexOf( 'x11' ) != -1 ); |
428 | 427 | |
429 | 428 | /* |
430 | 429 | * Browser |
431 | 430 | */ |
432 | | - BubbleTT.Platform.browser.isIE = (an.indexOf("microsoft") != -1); |
433 | | - BubbleTT.Platform.browser.isNetscape = (an.indexOf("netscape") != -1); |
434 | | - BubbleTT.Platform.browser.isMozilla = (ua.indexOf("mozilla") != -1); |
435 | | - BubbleTT.Platform.browser.isFirefox = (ua.indexOf("firefox") != -1); |
436 | | - BubbleTT.Platform.browser.isOpera = (an.indexOf("opera") != -1); |
437 | | - //BubbleTT.Platform.browser.isSafari = (an.indexOf("safari") != -1); |
| 431 | + BubbleTT.Platform.browser.isIE = ( an.indexOf( 'microsoft' ) != -1 ); |
| 432 | + BubbleTT.Platform.browser.isNetscape = ( an.indexOf( 'netscape' ) != -1 ); |
| 433 | + BubbleTT.Platform.browser.isMozilla = ( ua.indexOf( 'mozilla' ) != -1 ); |
| 434 | + BubbleTT.Platform.browser.isFirefox = ( ua.indexOf( 'firefox' ) != -1 ); |
| 435 | + BubbleTT.Platform.browser.isOpera = ( an.indexOf( 'opera' ) != -1 ); |
| 436 | + //BubbleTT.Platform.browser.isSafari = (an.indexOf( 'safari' ) != -1 ); |
438 | 437 | |
439 | | - var parseVersionString = function(s) { |
440 | | - var a = s.split("."); |
441 | | - BubbleTT.Platform.browser.majorVersion = parseInt(a[0]); |
442 | | - BubbleTT.Platform.browser.minorVersion = parseInt(a[1]); |
| 438 | + var parseVersionString = function( s ) { |
| 439 | + var a = s.split( '.' ); |
| 440 | + BubbleTT.Platform.browser.majorVersion = parseInt( a[0] ); |
| 441 | + BubbleTT.Platform.browser.minorVersion = parseInt( a[1] ); |
443 | 442 | }; |
444 | | - var indexOf = function(s, sub, start) { |
445 | | - var i = s.indexOf(sub, start); |
| 443 | + var indexOf = function( s, sub, start ) { |
| 444 | + var i = s.indexOf( sub, start ); |
446 | 445 | return i >= 0 ? i : s.length; |
447 | 446 | }; |
448 | 447 | |
449 | | - if (BubbleTT.Platform.browser.isMozilla) { |
450 | | - var offset = ua.indexOf("mozilla/"); |
451 | | - if (offset >= 0) { |
452 | | - parseVersionString(ua.substring(offset + 8, indexOf(ua, " ", offset))); |
| 448 | + if ( BubbleTT.Platform.browser.isMozilla ) { |
| 449 | + var offset = ua.indexOf( 'mozilla/' ); |
| 450 | + if ( offset >= 0 ) { |
| 451 | + parseVersionString( ua.substring( offset + 8, indexOf( ua, ' ', offset ) ) ); |
453 | 452 | } |
454 | 453 | } |
455 | | - if (BubbleTT.Platform.browser.isIE) { |
456 | | - var offset = ua.indexOf("msie "); |
457 | | - if (offset >= 0) { |
458 | | - parseVersionString(ua.substring(offset + 5, indexOf(ua, ";", offset))); |
| 454 | + if ( BubbleTT.Platform.browser.isIE ) { |
| 455 | + var offset = ua.indexOf( 'msie ' ); |
| 456 | + if ( offset >= 0 ) { |
| 457 | + parseVersionString( ua.substring( offset + 5, indexOf( ua, ';', offset ) ) ); |
459 | 458 | } |
460 | 459 | } |
461 | | - if (BubbleTT.Platform.browser.isNetscape) { |
462 | | - var offset = ua.indexOf("rv:"); |
463 | | - if (offset >= 0) { |
464 | | - parseVersionString(ua.substring(offset + 3, indexOf(ua, ")", offset))); |
| 460 | + if ( BubbleTT.Platform.browser.isNetscape ) { |
| 461 | + var offset = ua.indexOf( 'rv:' ); |
| 462 | + if ( offset >= 0 ) { |
| 463 | + parseVersionString( ua.substring( offset + 3, indexOf( ua, ')', offset ) ) ); |
465 | 464 | } |
466 | 465 | } |
467 | | - if (BubbleTT.Platform.browser.isFirefox) { |
468 | | - var offset = ua.indexOf("firefox/"); |
469 | | - if (offset >= 0) { |
470 | | - parseVersionString(ua.substring(offset + 8, indexOf(ua, " ", offset))); |
| 466 | + if ( BubbleTT.Platform.browser.isFirefox ) { |
| 467 | + var offset = ua.indexOf( 'firefox/' ); |
| 468 | + if ( offset >= 0 ) { |
| 469 | + parseVersionString( ua.substring( offset + 8, indexOf( ua, ' ', offset ) ) ); |
471 | 470 | } |
472 | 471 | } |
473 | 472 | })(); |
— | — | @@ -476,40 +475,40 @@ |
477 | 476 | }; |
478 | 477 | |
479 | 478 | /*================================================== |
480 | | - * DOM Utility Functions |
| 479 | + * DOM Utility Functions |
481 | 480 | * all below from Simile-Timeline (util/dom.js) with classname |
482 | | - * Timeline replaced by BubbleTT to avoid complications with both |
| 481 | + * Timeline replaced by BubbleTT to avoid complications with both |
483 | 482 | * scripts running on the same page |
484 | 483 | *================================================== |
485 | 484 | */ |
486 | 485 | |
487 | 486 | BubbleTT.DOM = new Object(); |
488 | 487 | |
489 | | -BubbleTT.DOM.registerEventWithObject = function(elmt, eventName, obj, handler) { |
490 | | - BubbleTT.DOM.registerEvent(elmt, eventName, function(elmt2, evt, target) { |
491 | | - return handler.call(obj, elmt2, evt, target); |
| 488 | +BubbleTT.DOM.registerEventWithObject = function( elmt, eventName, obj, handler ) { |
| 489 | + BubbleTT.DOM.registerEvent( elmt, eventName, function( elmt2, evt, target ) { |
| 490 | + return handler.call( obj, elmt2, evt, target ); |
492 | 491 | }); |
493 | 492 | }; |
494 | 493 | |
495 | | -BubbleTT.DOM.registerEvent = function(elmt, eventName, handler) { |
496 | | - var handler2 = function(evt) { |
497 | | - evt = (evt) ? evt : ((event) ? event : null); |
498 | | - if (evt) { |
499 | | - var target = (evt.target) ? |
500 | | - evt.target : ((evt.srcElement) ? evt.srcElement : null); |
501 | | - if (target) { |
502 | | - target = (target.nodeType == 1 || target.nodeType == 9) ? |
| 494 | +BubbleTT.DOM.registerEvent = function( elmt, eventName, handler ) { |
| 495 | + var handler2 = function( evt ) { |
| 496 | + evt = ( evt ) ? evt : ( ( event ) ? event : null ); |
| 497 | + if ( evt ) { |
| 498 | + var target = ( evt.target ) ? |
| 499 | + evt.target : ( ( evt.srcElement ) ? evt.srcElement : null ); |
| 500 | + if ( target ) { |
| 501 | + target = ( target.nodeType == 1 || target.nodeType == 9 ) ? |
503 | 502 | target : target.parentNode; |
504 | 503 | } |
505 | | - |
506 | | - return handler(elmt, evt, target); |
| 504 | + |
| 505 | + return handler( elmt, evt, target ); |
507 | 506 | } |
508 | 507 | return true; |
509 | 508 | }; |
510 | 509 | |
511 | | - if (BubbleTT.Platform.browser.isIE) { |
512 | | - elmt.attachEvent("on" + eventName, handler2); |
| 510 | + if ( BubbleTT.Platform.browser.isIE ) { |
| 511 | + elmt.attachEvent( 'on' + eventName, handler2 ); |
513 | 512 | } else { |
514 | | - elmt.addEventListener(eventName, handler2, false); |
| 513 | + elmt.addEventListener( eventName, handler2, false ); |
515 | 514 | } |
516 | 515 | }; |
\ No newline at end of file |