r74917 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74916‎ | r74917 | r74918 >
Date:20:29, 17 October 2010
Author:ashley
Status:deferred
Tags:
Comment:
Semantic MediaWiki: coding style cleanup to CSS and JS files
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/skins/SMW_custom.css (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/skins/SMW_custom_rtl.css (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/skins/SMW_sorttable.js (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/skins/SMW_tooltip.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/skins/SMW_sorttable.js
@@ -3,7 +3,7 @@
44 // Modified for SMW (in fact, we might rewrite the code since we
55 // usually have very special tables to sort)
66
7 -addOnloadHook(smw_sortables_init);
 7+addOnloadHook( smw_sortables_init );
88
99 var SORT_COLUMN_INDEX;
1010 var SMW_PATH;
@@ -14,198 +14,236 @@
1515 // if (!document.getElementById) return;
1616 // st = document.getElementById("SMW_sorttable_script_inclusion");
1717 // SMW_PATH = st.src.substring(0, st.src.length-17);
18 - SMW_PATH = wgScriptPath + "/extensions/SemanticMediaWiki/skins";
 18+ SMW_PATH = wgScriptPath + '/extensions/SemanticMediaWiki/skins';
1919 // Preload images
2020 smw_preload_images();
2121 // Now find the tables
2222 //if (!document.getElementsByTagName) return;
2323 //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+ }
3436 }
3537
3638 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+ }
4648 }
4749
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+ }
5460
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="[&lt;&gt;]" src="' + SMW_PATH + '/images/sort_none.gif"/></span></a>&nbsp;<span style="margin-left: 0.3em; margin-right: 1em;">' + cell.innerHTML + '</span>'; // the &nbsp; 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="[&lt;&gt;]" src="' + SMW_PATH + '/images/sort_none.gif"/></span></a>&nbsp;<span style="margin-left: 0.3em; margin-right: 1em;">' + cell.innerHTML + '</span>'; // the &nbsp; is for Opera ...
 68+ }
6369
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+ }*/
8188 }
8289
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;
88100 }
89 - }else{
90 - return el.innerHTML;
91 - }
92 -
93101 }
94102
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' );
105115
 116+ if ( table.rows.length <= 1 ) {
 117+ return;
 118+ }
106119
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+ }
108131
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];
116138 }
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+ }
118148
 149+ newRows.sort( sortfn );
119150
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="[&gt;]" src="' + SMW_PATH + '/images/sort_up.gif"/>';
 154+ newRows.reverse();
 155+ span.setAttribute( 'sortdir', 'up' );
 156+ } else {
 157+ ARROW = '<img alt="[&lt;]" src="' + SMW_PATH + '/images/sort_down.gif"/>';
 158+ span.setAttribute( 'sortdir', 'down' );
 159+ }
130160
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+ }
132177
133 - var ARROW;
134 - if (span.getAttribute("sortdir") == 'down') {
135 - ARROW = '<img alt="[&gt;]" src="' + SMW_PATH + '/images/sort_up.gif"/>';
136 - newRows.reverse();
137 - span.setAttribute('sortdir','up');
138 - } else {
139 - ARROW = '<img alt="[&lt;]" 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="[&lt;&gt;]" src="' + SMW_PATH + '/images/sort_none.gif"/>';
 184+ }
 185+ }
 186+ }
142187
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="[&lt;&gt;]" src="' + SMW_PATH + '/images/sort_none.gif"/>';
156 - }
157 - }
158 - }
159 -
160 - span.innerHTML = ARROW;
 188+ span.innerHTML = ARROW;
161189 }
162190
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+ }
169199 }
170200
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;
177211 }
178212
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;
186223 }
187224
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;
195235 }
196236
197 -
198 -function addEvent(elm, evType, fn, useCapture){
199237 // addEvent and removeEvent
200238 // cross-browser event handling for IE5+, NS6 and Mozilla
201239 // 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+ }
212250 }
Index: trunk/extensions/SemanticMediaWiki/skins/SMW_custom.css
@@ -21,17 +21,16 @@
2222 }
2323
2424 /* tables for inline queries */
25 -
26 -table.smwtable{
 25+table.smwtable {
2726 background-color: #EEEEFF;/* Note: here and below, we use six digits, since some users had problems with the three digit short forms */
2827 }
2928
30 -table.smwtable th{
 29+table.smwtable th {
3130 background-color: #EEEEFF;
3231 text-align: left;
3332 }
3433
35 -table.smwtable td{
 34+table.smwtable td {
3635 background-color: #FFFFFF;
3736 padding: 1px;
3837 padding-left: 5px;
@@ -40,7 +39,7 @@
4140 vertical-align: top;
4241 }
4342
44 -table.smwtable tr.smwfooter td{
 43+table.smwtable tr.smwfooter td {
4544 font-size: 90%;
4645 line-height: 1;
4746 background-color: #EEEEFF;
@@ -51,40 +50,39 @@
5251 vertical-align: top;
5352 }
5453
55 -/*hide keys for sorting table entries*/
56 -span.smwsortkey{
 54+/* hide keys for sorting table entries */
 55+span.smwsortkey {
5756 display: none;
5857 }
5958
6059 /* buttons for sort-arrows */
61 -a.sortheader:hover{
 60+a.sortheader:hover {
6261 text-decoration: none;
6362 }
6463
6564 /* "semantic" span classes for Timeline */
6665
67 -div.smwtimeline{
 66+div.smwtimeline {
6867 border: 1px solid #AAAAAA;
6968 background-color: #F9F9F9;
7069 /*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)
7271 You can support Semantic MediaWiki development by not using Internet Explorer. Thanks.
7372 (IE centers the Timeline *elements*, which messes up the whole layout) */
7473 }
7574
76 -span.smwtlevent, span.smwtlband, span.smwtlsize, span.smwtlposition{
 75+span.smwtlevent, span.smwtlband, span.smwtlsize, span.smwtlposition {
7776 display: none;
7877 speak: none;
7978 }
8079
81 -span.smwtlcomment{
 80+span.smwtlcomment {
8281 font-style: italic;
8382 padding: 5px;
8483 }
8584
8685 /* Factbox */
87 -
88 -div.smwfact{
 86+div.smwfact {
8987 clear: both;
9088 background-color: #F9F9F9;
9189 padding: 5px;
@@ -93,41 +91,40 @@
9492 font-size: 95%;
9593 }
9694
97 -div.smwfact td, div.smwfact tr, div.smwfact table{
 95+div.smwfact td, div.smwfact tr, div.smwfact table {
9896 background-color: #F9F9F9;
9997 }
10098
101 -span.smwfactboxhead{
 99+span.smwfactboxhead {
102100 font-size: 110%;
103101 font-weight: bold;
104102 float: left;
105103 }
106104
107 -table.smwfacttable{
 105+table.smwfacttable {
108106 border-top: 1px dotted #AAAAAA;
109107 width: 100%;
110108 clear: both;
111109 }
112110
113 -td.smwpropname, th.smwpropname, td.smwspecname{
 111+td.smwpropname, th.smwpropname, td.smwspecname {
114112 text-align: right;
115113 vertical-align: top;
116114 padding-right: 1em;
117115 }
118116
119 -td.smwprops, td.smwspecs{
 117+td.smwprops, td.smwspecs {
120118 vertical-align: top;
121119 width: 75%;
122120 }
123121
124 -div.smwhr hr{
 122+div.smwhr hr {
125123 background-color: #DDDDDD;
126124 color: #DDDDDD;
127125 }
128126
129127 /* warning messages */
130 -
131 -span.smwwarning{
 128+span.smwwarning {
132129 color: #888888;
133130 font-style: italic;
134131 font-size: 90%;
@@ -142,14 +139,14 @@
143140 background: url(images/searchgray_iconsmall.png) center right no-repeat;
144141 }
145142
146 -#bodyContent span.smwsearch a{
 143+#bodyContent span.smwsearch a {
147144 padding-right: 16px;
148145 margin-right: 2px;
149146 color: #888888;
150147 background: url(images/searchgray_iconsmall.png) center right no-repeat;
151148 }
152149
153 -#bodyContent span.smwsearch a:hover{
 150+#bodyContent span.smwsearch a:hover {
154151 text-decoration: none;
155152 color: #0000FF;
156153 padding-right: 18px;
@@ -157,14 +154,14 @@
158155 background: url(images/search_icon.png) center right no-repeat;
159156 }
160157
161 -#bodyContent span.swmfactboxheadbrowse a{
 158+#bodyContent span.swmfactboxheadbrowse a {
162159 padding-right: 16px;
163160 margin-right: 2px;
164161 color: #000000;
165162 background: url(images/browse_iconsmall.png) center right no-repeat;
166163 }
167164
168 -#bodyContent span.swmfactboxheadbrowse a:hover{
 165+#bodyContent span.swmfactboxheadbrowse a:hover {
169166 text-decoration: none;
170167 color: #0000FF;
171168 padding-right: 18px;
@@ -172,14 +169,14 @@
173170 background: url(images/browse_icon.png) center right no-repeat;
174171 }
175172
176 -#bodyContent span.smwbrowse a{
 173+#bodyContent span.smwbrowse a {
177174 padding-right: 16px;
178175 margin-right: 2px;
179176 color: #888888;
180177 background: url(images/browse_iconsmall.png) center right no-repeat;
181178 }
182179
183 -#bodyContent span.smwbrowse a:hover{
 180+#bodyContent span.smwbrowse a:hover {
184181 text-decoration: none;
185182 color: #0000FF;
186183 padding-right: 18px;
@@ -187,29 +184,29 @@
188185 background: url(images/browse_icon.png) center right no-repeat;
189186 }
190187
191 -#bodyContent span.smwmap a{
 188+#bodyContent span.smwmap a {
192189 padding-right: 20px;
193190 color: #888888;
194191 background: url(images/world.png) center right no-repeat;
195192 }
196193
197 -#bodyContent span.smwmap a:hover{
 194+#bodyContent span.smwmap a:hover {
198195 padding-right: 20px;
199196 color: #0000FF;
200197 background: url(images/world.png) center right no-repeat;
201198 }
202199
203 -#bodyContent span.rdflink{
 200+#bodyContent span.rdflink {
204201 float: right;
205202 }
206203
207 -#bodyContent span.rdflink a{
 204+#bodyContent span.rdflink a {
208205 padding-right: 20px;
209206 color: #888888;
210207 background: url(images/rdf_flyer.18.gif) center right no-repeat;
211208 }
212209
213 -#bodyContent span.rdflink a:hover{
 210+#bodyContent span.rdflink a:hover {
214211 text-decoration: none;
215212 color: #0000FF;
216213 padding-right: 20px;
@@ -223,18 +220,18 @@
224221 color: #000000;
225222 }
226223
227 -span.smwttpersist span.smwttcontent{ /* show persistent tooltips for non-JavaScript clients */
 224+span.smwttpersist span.smwttcontent { /* show persistent tooltips for non-JavaScript clients */
228225 color: #888888;
229226 font-style: italic;
230227 font-size: 90%;
231228 }
232229
233 -span.smwttinline span.smwttcontent{ /* hide inline tooltips for non-JavaScript clients */
 230+span.smwttinline span.smwttcontent { /* hide inline tooltips for non-JavaScript clients */
234231 display: none;
235232 speak: none;
236233 }
237234
238 -span.smwtticon{ /* style for image anchor for persistent tooltips */
 235+span.smwtticon { /* style for image anchor for persistent tooltips */
239236 display: none;
240237 }
241238
@@ -253,11 +250,10 @@
254251 padding-left: 4px;
255252 }
256253
257 -/** CSS style file for Semantic MediaWiki Special Browse. */
258 -
 254+/* CSS style file for Semantic MediaWiki Special Browse. */
259255 table.smwb-factbox {
260256 border-left: 8px solid #DDDDDD;
261 - width:100%
 257+ width: 100%
262258 }
263259
264260 tr.smwb-title {
@@ -267,12 +263,12 @@
268264 }
269265
270266 tr.smwb-title td {
271 - padding-left:5px;
 267+ padding-left: 5px;
272268 border-bottom: 2px solid white;
273269 }
274270
275271 tr.smwb-propvalue {
276 - width:100%;
 272+ width: 100%;
277273 background-color: #EEEEEE;
278274 }
279275
@@ -282,7 +278,7 @@
283279 font-weight: bold;
284280 font-size: 120%;
285281 background-color: #DDDDDD;
286 - padding:0.2em 0.6em;
 282+ padding: 0.2em 0.6em;
287283 border-bottom: 2px solid white;
288284 border-top: 2px solid white;
289285 }
@@ -293,7 +289,7 @@
294290 border: 0px solid white;
295291 border-bottom: 2px solid white;
296292 border-top: 2px solid white;
297 - width:90%;
 293+ width: 90%;
298294 }
299295
300296 tr.smwb-center {
@@ -303,11 +299,10 @@
304300 span.smwb-value {
305301 }
306302
307 -/** Inverse factbox */
308 -
 303+/* Inverse factbox */
309304 table.smwb-ifactbox {
310305 border-right: 8px solid #DDDDDD;
311 - width:100%
 306+ width: 100%
312307 }
313308
314309 tr.smwb-ititle {
@@ -317,14 +312,14 @@
318313 }
319314
320315 tr.smwb-ititle td {
321 - padding-left:5px;
 316+ padding-left: 5px;
322317 border-bottom: 2px solid white;
323318 }
324319
325320 tr.smwb-ipropvalue {
326 - width:100%;
 321+ width: 100%;
327322 background-color: #EEEEEE;
328 - text-align:right;
 323+ text-align: right;
329324 }
330325
331326 tr.smwb-ipropvalue th {
@@ -332,7 +327,7 @@
333328 font-weight: bold;
334329 font-size: 120%;
335330 background-color: #DDDDDD;
336 - padding:0.2em 0.6em;
 331+ padding: 0.2em 0.6em;
337332 border-bottom: 3px solid white;
338333 border-top: 3px solid white;
339334 }
@@ -341,8 +336,8 @@
342337 background-color: #EEEEEE;
343338 border-bottom: 3px solid white;
344339 border-top: 3px solid white;
345 - padding-right:1em;
346 - width:90%;
 340+ padding-right: 1em;
 341+ width: 90%;
347342 }
348343
349344 span.smwb-ivalue {
Index: trunk/extensions/SemanticMediaWiki/skins/SMW_custom_rtl.css
@@ -1,6 +1,5 @@
22 /* tables for inline queries */
3 -
4 -table.smwtable th, table.smwtable td{
 3+table.smwtable th, table.smwtable td {
54 text-align: right;
65 }
76
@@ -9,16 +8,15 @@
109 }
1110
1211 /* Factbox */
13 -
1412 span.smwfactboxhead {
15 - float:right;
 13+ float: right;
1614 }
1715
1816 span.smwrdflink {
19 - float:left;
 17+ float: left;
2018 }
2119
22 -td.smwpropname, th.smwpropname, td.smwspecname{
 20+td.smwpropname, th.smwpropname, td.smwspecname {
2321 text-align: left;
2422 }
2523
@@ -31,7 +29,7 @@
3230 margin-left: 2px;
3331 }
3432
35 -#bodyContent span.smwsearch a{
 33+#bodyContent span.smwsearch a {
3634 padding-right: 0;
3735 margin-right: 0;
3836 padding-left: 16px;
@@ -39,7 +37,7 @@
4038 background: url(images/searchgray_iconsmall.png) center left no-repeat;
4139 }
4240
43 -#bodyContent span.smwsearch a:hover{
 41+#bodyContent span.smwsearch a:hover {
4442 padding-right: 0;
4543 margin-right: 0;
4644 padding-left: 18px;
@@ -47,7 +45,7 @@
4846 background: url(images/search_icon.png) center left no-repeat;
4947 }
5048
51 -#bodyContent span.swmfactboxheadbrowse a{
 49+#bodyContent span.swmfactboxheadbrowse a {
5250 padding-left: 16px;
5351 margin-left: 2px;
5452 padding-right: 0px;
@@ -56,7 +54,7 @@
5755 background: url(images/browse_iconsmall.png) center left no-repeat;
5856 }
5957
60 -#bodyContent span.swmfactboxheadbrowse a:hover{
 58+#bodyContent span.swmfactboxheadbrowse a:hover {
6159 text-decoration: none;
6260 color: #0000FF;
6361 padding-left: 18px;
@@ -66,7 +64,7 @@
6765 background: url(images/browse_icon.png) center left no-repeat;
6866 }
6967
70 -#bodyContent span.smwbrowse a{
 68+#bodyContent span.smwbrowse a {
7169 padding-left: 16px;
7270 margin-left: 2px;
7371 padding-right: 0px;
@@ -75,7 +73,7 @@
7674 background: url(images/browse_iconsmall.png) center left no-repeat;
7775 }
7876
79 -#bodyContent span.smwbrowse a:hover{
 77+#bodyContent span.smwbrowse a:hover {
8078 text-decoration: none;
8179 color: #0000FF;
8280 padding-left: 18px;
@@ -85,30 +83,29 @@
8684 background: url(images/browse_icon.png) center left no-repeat;
8785 }
8886
89 -#bodyContent span.smwmap a{
 87+#bodyContent span.smwmap a {
9088 padding-right: 0;
9189 padding-left: 20px;
9290 background: url(images/world.png) center left no-repeat;
9391 }
9492
95 -#bodyContent span.smwmap a:hover{
 93+#bodyContent span.smwmap a:hover {
9694 padding-right: 0;
9795 padding-left: 20px;
9896 }
9997
10098 /* RDF icons */
101 -
102 -#bodyContent span.rdflink{
 99+#bodyContent span.rdflink {
103100 float: left;
104101 }
105102
106 -#bodyContent span.rdflink a{
 103+#bodyContent span.rdflink a {
107104 padding-left: 20px;
108105 padding-right: 0;
109106 background: url(images/rdf_flyer.18.gif) center left no-repeat;
110107 }
111108
112 -#bodyContent span.rdflink a:hover{
 109+#bodyContent span.rdflink a:hover {
113110 padding-right: 0;
114111 margin-right: 0;
115112 padding-left: 20px;
Index: trunk/extensions/SemanticMediaWiki/skins/SMW_tooltip.js
@@ -1,14 +1,14 @@
2 -addOnloadHook(smw_tooltipInit);
 2+addOnloadHook( smw_tooltipInit );
33
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
66 BubbleTT = new Object();
77 BubbleTT.Platform= new Object();
88
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
1111
12 -var imagePath=wgScriptPath+"/extensions/SemanticMediaWiki/skins/images/";
 12+var imagePath = wgScriptPath + '/extensions/SemanticMediaWiki/skins/images/';
1313
1414 // Dimensions of persistent tooltips
1515 var SMWTT_WIDTH_P = 200;
@@ -18,111 +18,115 @@
1919 var SMWTT_WIDTH_I = 175;
2020 var SMWTT_HEIGHT_I = 70;
2121
22 -/*register events for the tooltips*/
 22+/* register events for the tooltips */
2323 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+ }
2832 }
2933 }
3034
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';
3943 }
4044 }
41 - a.onmouseover=smw_showTooltipInline;
42 - a.onmouseout=smw_hideTooltip;
 45+ a.onmouseover = smw_showTooltipInline;
 46+ a.onmouseout = smw_hideTooltip;
4347 }
4448
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 );
5458 }
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';
5963 }
6064 }
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 );
6468 } else {
65 - a.addEventListener("click", smw_showTooltipPersist, false);
 69+ a.addEventListener( 'click', smw_showTooltipPersist, false );
6670 }
6771 }
6872
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 );
7579 x = c.left;
7680 y = c.top;
77 - }else{
 81+ } else {
7882 x = e.pageX;
7983 y = e.pageY;
8084 }
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' ) ) {
8589 origin = origin.parentNode;
8690 };
8791
8892 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 );
9195
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 );
9599 } else {
96 - origin.removeEventListener("click", smw_showTooltipPersist, false);
 100+ origin.removeEventListener( 'click', smw_showTooltipPersist, false );
97101 }
98102 }
99103
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
104106 return;
105107 }
106108 var x;
107109 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 );
110112 x = c.left;
111113 y = c.top;
112 - }else{
 114+ } else {
113115 x = e.pageX;
114116 y = e.pageY;
115117 }
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+ }
120124 var doc = origin.ownerDocument;
121125 tt = BubbleTT.createBubbleForPoint( false, origin, x, y, SMWTT_WIDTH_I, SMWTT_HEIGHT_I );
122 - BubbleTT.fillBubble(tt, origin);
 126+ BubbleTT.fillBubble( tt, origin );
123127 }
124128
125 -function smw_hideTooltip(){
126 - if (tt) {
 129+function smw_hideTooltip() {
 130+ if ( tt ) {
127131 tt.close();
128132 tt = null;
129133 }
@@ -132,7 +136,7 @@
133137 * Provided for the convenience of SMW extensions, used, e.g., by Halo
134138 */
135139 function _smw_hideAllTooltips() {
136 - for(var i = 0; i < all_tt.length; i++) {
 140+ for( var i = 0; i < all_tt.length; i++ ) {
137141 all_tt[i].close();
138142 }
139143 all_tt = [];
@@ -143,17 +147,17 @@
144148 * used to place tooltips in IE as mouse coordinates
145149 * behave strangely
146150 */
147 -BubbleTT.getElementCoordinates = function(elmt) {
 151+BubbleTT.getElementCoordinates = function( elmt ) {
148152 var left = 0;
149153 var top = 0;
150154
151 - if (elmt.nodeType != 1) {
 155+ if ( elmt.nodeType != 1 ) {
152156 elmt = elmt.parentNode;
153157 }
154158
155 - while (elmt != null) {
 159+ while ( elmt != null ) {
156160 left += elmt.offsetLeft;
157 - top += elmt.offsetTop - (elmt.scrollTop ? elmt.scrollTop : 0);
 161+ top += elmt.offsetTop - ( elmt.scrollTop ? elmt.scrollTop : 0 );
158162 elmt = elmt.offsetParent;
159163 }
160164 // consider document scroll position too
@@ -163,11 +167,10 @@
164168
165169
166170 /*==================================================================
167 - * code below from Simile-Timeline (util/graphics.js) modified
 171+ * code below from Simile-Timeline (util/graphics.js) modified
168172 *==================================================================
169173 */
170174
171 -
172175 BubbleTT._bubbleMargins = {
173176 top: 33,
174177 bottom: 42,
@@ -175,8 +178,8 @@
176179 right: 40
177180 };
178181
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 = {
181184 top: 0,
182185 bottom: 9,
183186 left: 1,
@@ -187,30 +190,28 @@
188191 BubbleTT._bubblePointOffset = 15;
189192 BubbleTT._halfArrowWidth = 18;
190193
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;
196197 var bubble = {
197198 _closed: false,
198199 _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 );
202203 this._doc = null;
203204 this._div = null;
204205 this._content = null;
205206 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+ }
211214 }
212215 }
213 - }
214 - }
215216 };
216217
217218 var docWidth = doc.body.offsetWidth;
@@ -220,170 +221,168 @@
221222 var bubbleWidth = margins.left + contentWidth + margins.right;
222223 var bubbleHeight = margins.top + contentHeight + margins.bottom;
223224
224 - var pngIsTranslucent = (!BubbleTT.Platform.browser.isIE) || (BubbleTT.Platform.browser.majorVersion > 6);
 225+ var pngIsTranslucent = ( !BubbleTT.Platform.browser.isIE ) || ( BubbleTT.Platform.browser.majorVersion > 6 );
225226
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 + ')';
232233 } else {
233234 elmt.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url +"', sizingMethod='crop')";
234235 }
235236 };
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';
241242 div.style.zIndex = 1000;
242243 bubble._div = div;
243244
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 );
249250
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 );
256257 };
257258
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 );
261262
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 );
264265
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 );
268269
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 );
278279 }
279280
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 );
289290 bubble.content = divContent;
290291
291292 (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+
312313 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+
325326 return;
326327 }
327328 }
328329
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';
345346 } 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';
356357 }
357358 })();
358359
359 - doc.body.appendChild(div);
 360+ doc.body.appendChild( div );
360361 return bubble;
361362 };
362363
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.
375374 */
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 />' );
379378 }
380379 }
381 - bubble.content.appendChild(div);
 380+ bubble.content.appendChild( div );
382381 };
383382
384383
385384 /*==================================================================
386385 * 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
388387 * scripts running on the same page
389388 *==================================================================
390389 */
@@ -402,71 +401,71 @@
403402 isFirefox: false,
404403 isOpera: false,
405404 isSafari: false,
406 -
 405+
407406 majorVersion: 0,
408407 minorVersion: 0
409408 };
410409
411410 (function() {
412411 var an = navigator.appName.toLowerCase();
413 - var ua = navigator.userAgent.toLowerCase();
 412+ var ua = navigator.userAgent.toLowerCase();
414413
415414 /*
416415 * Operating system
417416 */
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 );
420419 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
426425 );
427 - BubbleTT.Platform.os.isUnix = (ua.indexOf('x11') != -1);
 426+ BubbleTT.Platform.os.isUnix = ( ua.indexOf( 'x11' ) != -1 );
428427
429428 /*
430429 * Browser
431430 */
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 );
438437
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] );
443442 };
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 );
446445 return i >= 0 ? i : s.length;
447446 };
448447
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 ) ) );
453452 }
454453 }
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 ) ) );
459458 }
460459 }
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 ) ) );
465464 }
466465 }
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 ) ) );
471470 }
472471 }
473472 })();
@@ -476,40 +475,40 @@
477476 };
478477
479478 /*==================================================
480 - * DOM Utility Functions
 479+ * DOM Utility Functions
481480 * 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
483482 * scripts running on the same page
484483 *==================================================
485484 */
486485
487486 BubbleTT.DOM = new Object();
488487
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 );
492491 });
493492 };
494493
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 ) ?
503502 target : target.parentNode;
504503 }
505 -
506 - return handler(elmt, evt, target);
 504+
 505+ return handler( elmt, evt, target );
507506 }
508507 return true;
509508 };
510509
511 - if (BubbleTT.Platform.browser.isIE) {
512 - elmt.attachEvent("on" + eventName, handler2);
 510+ if ( BubbleTT.Platform.browser.isIE ) {
 511+ elmt.attachEvent( 'on' + eventName, handler2 );
513512 } else {
514 - elmt.addEventListener(eventName, handler2, false);
 513+ elmt.addEventListener( eventName, handler2, false );
515514 }
516515 };
\ No newline at end of file

Status & tagging log