Dateigrösse: 6.06 kb
1 <!DOCTYPE html> 2 <html lang="de" dir="ltr" xml:lang="de" xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 6 <meta content="noindex,nofollow" name="robots" /> 7 8 <!-- http://de.wikipedia.org/w/index.php?title=Wiktionary&action=edit§ion=1 --> 9 <!-- http://de.wikipedia.org/skins-1.5/common/edit.js?177 --> 10 11 <title>Wikipedia editform</title> 12 13 <link type="text/css" href="http://de.wikipedia.org/skins-1.5/monobook/main.css?177" rel="stylesheet" /> 14 15 <script type="text/javascript"> 16 // apply tagOpen/tagClose to selection in textarea, 17 // use sampleText instead of selection if there is none 18 function insertTags(tagOpen, tagClose, sampleText) { 19 var txtarea; 20 if (document.editform) { 21 txtarea = document.editform.wpTextbox1; 22 } else { 23 // some alternate form? take the first one we can find 24 var areas = document.getElementsByTagName('textarea'); 25 txtarea = areas[0]; 26 } 27 var selText, isSample = false; 28 // IE/Opera 29 if (document.selection && document.selection.createRange) { 30 31 //save window scroll position 32 if (document.documentElement && document.documentElement.scrollTop) 33 var winScroll = document.documentElement.scrollTop 34 else if (document.body) 35 var winScroll = document.body.scrollTop; 36 //get current selection 37 txtarea.focus(); 38 var range = document.selection.createRange(); 39 selText = range.text; 40 //insert tags 41 checkSelectedText(); 42 range.text = tagOpen + selText + tagClose; 43 //mark sample text as selected 44 if (isSample && range.moveStart) { 45 if (window.opera) 46 tagClose = tagClose.replace(/\n/g,''); 47 range.moveStart('character', - tagClose.length - selText.length); 48 range.moveEnd('character', - tagClose.length); 49 } 50 range.select(); 51 //restore window scroll position 52 if (document.documentElement && document.documentElement.scrollTop) 53 document.documentElement.scrollTop = winScroll 54 else if (document.body) 55 document.body.scrollTop = winScroll; 56 // Mozilla 57 } else if (txtarea.selectionStart || txtarea.selectionStart == '0') { 58 59 //save textarea scroll position 60 var textScroll = txtarea.scrollTop; 61 //get current selection 62 txtarea.focus(); 63 var startPos = txtarea.selectionStart; 64 var endPos = txtarea.selectionEnd; 65 selText = txtarea.value.substring(startPos, endPos); 66 //insert tags 67 checkSelectedText(); 68 txtarea.value = txtarea.value.substring(0, startPos) 69 + tagOpen + selText + tagClose 70 + txtarea.value.substring(endPos, txtarea.value.length); 71 //set new selection 72 if (isSample) { 73 txtarea.selectionStart = startPos + tagOpen.length; 74 txtarea.selectionEnd = startPos + tagOpen.length + selText.length; 75 } else { 76 txtarea.selectionStart = startPos + tagOpen.length + selText.length + tagClose.length; 77 txtarea.selectionEnd = txtarea.selectionStart; 78 } 79 //restore textarea scroll position 80 txtarea.scrollTop = textScroll; 81 } 82 83 function checkSelectedText(){ 84 if (!selText) { 85 selText = sampleText; 86 isSample = true; 87 } else if (selText.charAt(selText.length - 1) == ' ') { //exclude ending space char 88 selText = selText.substring(0, selText.length - 1); 89 tagClose += ' ' 90 } 91 } 92 93 } 94 </script> 95 </head> 96 97 <body> 98 99 <div id="toolbar"> 100 <img id="mw-editbutton-bold" class="mw-toolbar-editbutton" width="23" height="22" border="0" src="wikipedia/inc/button_bold.png" alt="" title="Fetter Text" style="cursor: pointer;" onclick="insertTags('\'\'\' ', ' \'\'\'', 'Fetter Text'); return false;" /> 101 <img id="mw-editbutton-italic" class="mw-toolbar-editbutton" width="23" height="22" border="0" src="wikipedia/inc/button_italic.png" alt="" title="Kursiver Text" style="cursor: pointer;" onclick="insertTags('\'\' ', ' \'\'', 'Kursiver Text'); return false;" /> 102 <img id="mw-editbutton-link" class="mw-toolbar-editbutton" width="23" height="22" border="0" src="wikipedia/inc/button_link.png" alt="" title="Interner Link" style="cursor: pointer;" onclick="insertTags('[[ ', ' ]]', 'Link-Text'); return false;" /> 103 <img id="mw-editbutton-extlink" class="mw-toolbar-editbutton" width="23" height="22" border="0" src="wikipedia/inc/button_extlink.png" alt="" title="Externer Link (http://www...)" style="cursor: pointer;" onclick="insertTags('[ ', ' ]', 'http://www.beispiel.ch'); return false;" /> 104 <img id="mw-editbutton-headline" class="mw-toolbar-editbutton" width="23" height="22" border="0" src="wikipedia/inc/button_headline.png" alt="" title="Überschrift" style="cursor: pointer;" onclick="insertTags('\n== ' , ' ==\n', 'Überschrift'); return false;" /> 105 <img id="mw-editbutton-image" class="mw-toolbar-editbutton" width="23" height="22" border="0" src="wikipedia/inc/button_image.png" alt="" title="Dateilink" style="cursor: pointer;" onclick="insertTags('[[Bild:', ']]', 'beispiel.jpg'); return false;" /> 106 <img id="mw-editbutton-media" class="mw-toolbar-editbutton" width="23" height="22" border="0" src="wikipedia/inc/button_media.png" alt="" title="Mediendatei-Link" style="cursor: pointer;" onclick="insertTags('[[Media:', ']]', 'beispiel.mp3'); return false;" /> 107 <img id="mw-editbutton-nowiki" class="mw-toolbar-editbutton" width="23" height="22" border="0" src="wikipedia/inc/button_nowiki.png" alt="" title="Unformatierter Text" style="cursor: pointer;" onclick="insertTags('\x3cnowiki\x3e', '\x3c/nowiki\x3e', 'Unformatierten Text hier einfügen'); return false;" /> 108 </div> 109 110 <form id="editform" enctype="multipart/form-data" action="/index.php?title=Wiktionary&action=submit" method="post" name="editform"> 111 <input type="hidden" name="baseRevId" value="50837642"/> 112 <input type="hidden" name="wpSection" value="1"/> 113 <input type="hidden" name="wpStarttime" value="20080927044540"/> 114 <input type="hidden" name="wpEdittime" value="20080917085016"/> 115 <input type="hidden" name="wpScrolltop" value="" id="wpScrolltop"/> 116 <textarea id="wpTextbox1" accesskey="," tabindex="1" rows="25" cols="80" name="wpTextbox1"></textarea> 117 </form> 118 119 </body> 120 </html> 121