Index: trunk/phase3/skins/common/wikibits.js |
— | — | @@ -315,26 +315,59 @@ |
316 | 316 | } |
317 | 317 | } |
318 | 318 | |
| 319 | +mwEditButtons = []; |
| 320 | +mwCustomEditButtons = []; // eg to add in MediaWiki:Common.js |
| 321 | + |
319 | 322 | // this function generates the actual toolbar buttons with localized text |
320 | 323 | // we use it to avoid creating the toolbar where javascript is not enabled |
321 | 324 | function addButton(imageFile, speedTip, tagOpen, tagClose, sampleText) { |
322 | 325 | // Don't generate buttons for browsers which don't fully |
323 | 326 | // support it. |
324 | | - if (!document.selection && !is_gecko) { |
| 327 | + mwEditButtons[mwEditButtons.length] = |
| 328 | + {"imageFile": imageFile, |
| 329 | + "speedTip": speedTip, |
| 330 | + "tagOpen": tagOpen, |
| 331 | + "tagClose": tagClose, |
| 332 | + "sampleText": sampleText}; |
| 333 | +} |
| 334 | + |
| 335 | +// this function generates the actual toolbar buttons with localized text |
| 336 | +// we use it to avoid creating the toolbar where javascript is not enabled |
| 337 | +function mwInsertEditButton(parent, item) { |
| 338 | + var image = document.createElement("img"); |
| 339 | + image.width = 23; |
| 340 | + image.height = 22; |
| 341 | + image.src = item.imageFile; |
| 342 | + image.border = 0; |
| 343 | + image.alt = item.speedTip; |
| 344 | + image.title = item.speedTip; |
| 345 | + image.style.cursor = "pointer"; |
| 346 | + image.onclick = function() { |
| 347 | + insertTags(item.tagOpen, item.tagClose, item.sampleText); |
325 | 348 | return false; |
326 | 349 | } |
327 | | - imageFile = escapeQuotesHTML(imageFile); |
328 | | - speedTip = escapeQuotesHTML(speedTip); |
329 | | - tagOpen = escapeQuotes(tagOpen); |
330 | | - tagClose = escapeQuotes(tagClose); |
331 | | - sampleText = escapeQuotes(sampleText); |
332 | | - var mouseOver = ""; |
| 350 | + |
| 351 | + parent.appendChild(image); |
| 352 | +} |
333 | 353 | |
334 | | - document.write("<a href=\"javascript:insertTags"); |
335 | | - document.write("('"+tagOpen+"','"+tagClose+"','"+sampleText+"');\">"); |
336 | | - document.write("<img width=\"23\" height=\"22\" src=\""+imageFile+"\" border=\"0\" alt=\""+speedTip+"\" title=\""+speedTip+"\""+mouseOver+">"); |
337 | | - document.write("</a>"); |
338 | | - return; |
| 354 | +function mwSetupToolbar() { |
| 355 | + var toolbar = document.getElementById('toolbar'); |
| 356 | + if (!toolbar) return false; |
| 357 | + |
| 358 | + var textbox = document.getElementById('wpTextbox1'); |
| 359 | + if (!textbox) return false; |
| 360 | + |
| 361 | + // Don't generate buttons for browsers which don't fully |
| 362 | + // support it. |
| 363 | + if (!document.selection && textbox.selectionStart == null) |
| 364 | + return false; |
| 365 | + |
| 366 | + for (var i in mwEditButtons) { |
| 367 | + mwInsertEditButton(toolbar, mwEditButtons[i]); |
| 368 | + } |
| 369 | + for (var i in mwCustomEditButtons) { |
| 370 | + mwInsertEditButton(toolbar, mwCustomEditButtons[i]); |
| 371 | + } |
339 | 372 | } |
340 | 373 | |
341 | 374 | function escapeQuotes(text) { |
— | — | @@ -709,3 +742,4 @@ |
710 | 743 | } |
711 | 744 | |
712 | 745 | hookEvent("load", allmessagesshow); |
| 746 | +hookEvent("load", mwSetupToolbar); |
\ No newline at end of file |
Index: trunk/phase3/skins/MonoBook.php |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | <!--[if lt IE 7]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js"></script> |
67 | 67 | <meta http-equiv="imagetoolbar" content="no" /><![endif]--> |
68 | 68 | <script type="<?php $this->text('jsmimetype') ?>">var skin = '<?php $this->text('skinname')?>';var stylepath = '<?php $this->text('stylepath')?>';</script> |
69 | | - <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js"><!-- wikibits js --></script> |
| 69 | + <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?1"><!-- wikibits js --></script> |
70 | 70 | <?php if($this->data['jsvarurl' ]) { ?> |
71 | 71 | <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl' ) ?>"><!-- site js --></script> |
72 | 72 | <?php } ?> |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -1528,9 +1528,9 @@ |
1529 | 1529 | 'key' => 'R' |
1530 | 1530 | ) |
1531 | 1531 | ); |
1532 | | - $toolbar ="<script type='$wgJsMimeType'>\n/*<![CDATA[*/\n"; |
| 1532 | + $toolbar = "<div id='toolbar'>\n"; |
| 1533 | + $toolbar.="<script type='$wgJsMimeType'>\n/*<![CDATA[*/\n"; |
1533 | 1534 | |
1534 | | - $toolbar.="document.writeln(\"<div id='toolbar'>\");\n"; |
1535 | 1535 | foreach($toolarray as $tool) { |
1536 | 1536 | |
1537 | 1537 | $image=$wgStylePath.'/common/images/'.$tool['image']; |
— | — | @@ -1549,8 +1549,8 @@ |
1550 | 1550 | $toolbar.="addButton('$image','$tip','$open','$close','$sample');\n"; |
1551 | 1551 | } |
1552 | 1552 | |
1553 | | - $toolbar.="document.writeln(\"</div>\");\n"; |
1554 | 1553 | $toolbar.="/*]]>*/\n</script>"; |
| 1554 | + $toolbar.="\n</div>"; |
1555 | 1555 | return $toolbar; |
1556 | 1556 | } |
1557 | 1557 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -81,6 +81,10 @@ |
82 | 82 | registrations as well as self-registrations. |
83 | 83 | * (bug 4327) Report age of cached data sets in query pages |
84 | 84 | * (bug 4662) Fix Safari check in wikibits.js |
| 85 | +* (bug 4663) Edit toolbar enabled in compatible versions of Safari |
| 86 | +* (bug 5572) Edit toolbar enabled in compatible versions of Konqueror (3.5+) |
| 87 | +* (bug 5235) Edit toolbar tooltips no longer show JavaScript junk in Opera |
| 88 | +* Edit toolbar now works in pure XHTML mode (application/xhtml+xml) |
85 | 89 | |
86 | 90 | |
87 | 91 | == Compatibility == |