User:Alex Smotrov/insertTags()
Current
While editing Wikipedia, you can insert some predefined text using either toolbar or Edittools. They both use Javascript function insertTags() defined in wikibits.js (svn). This function accepts 3 parameters: tagOpen, tagClose, sampleText.
First, let's try to use this function in Firefox:
<tagOpen>sampleText<tagClose>
— and you can start typing, replacing sample text
If you already had some text selected, then it's
<tagOpen>Your text<tagClose>|
— note that cursor is at the end and again you can start typing
Unfortunately, for Internet Explorer it's different:
<tagOpen>sampleText<tagClose>| — now you have to go back and delete sample text manually
If you already had some text selected, then it's
<tagOpen>Your Text<tagClose>
or even
<tagOpen>Your Text<tagClose> (same selection, but invisible, and no cursor) — now you have to press → before typing, otherwise you will replace this selection.
Also there is:
- annoying feature: the whole window «jumps», making textarea «more visible»
- curious feature: you can «insert» the text selected anywhere else on the page (not just in textarea)
Note that Opera 9 supports boths IE and Firefox methods. It is unfortunate that Opera is currently fed IE code and therefore is crippled in almost the same way.
Proposed
Proposed insertTags.js is trying to fix these problems for IE (Firefox code is pretty much the same). It is submitted as bugzilla:10526. Please leave your comments/suggestions at the talk page or on the bug page.
Demo
- Start IE or Opera and go to any Wikipedia edit page
- See how tags are inserted using buttons on top or links at bottom
- Paste this into browser address field and press Enter
javascript:importScript('User:Alex_Smotrov/inserttags.js');void 0
- Repeat step 2
Or you can simply add importScript('User:Alex_Smotrov/inserttags.js') → monobook.js
Tested in: Firefox 1.5, IE6/7, Opera 9.2
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.