Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//Скрипт редактирования для Википедии. Переводит выделенный фрагмент текста в нижний регистр.//Часть кода позаимствована из http://ru.wikipedia.org/wiki/MediaWiki:Wikificator.js//Автор: X-romixvarXRomix_LowerCase_CantWork='Перевод в нижний регистр не может работать в вашем браузере.\n\nLowerCase script cannot work in your browser'// английский текст для тех, кто не видит русские буквыvarXRomix_LowerCase_FullText='Сначала выделите текст. Эта функция переводит выделенный текст в нижний регистр';//Добавляет кнопкуfunctionadd_XRomix_LowerCase_Button(){vartoolbar=document.getElementById('toolbar')vartextbox=document.getElementById('wpTextbox1')if(!textbox||!toolbar)returnvari=document.createElement('img')i.src='http://upload.wikimedia.org/wikipedia/ru/b/b3/Button-LowerCase.PNG'i.alt=i.title='Перевод текста в нижний регистр'i.onclick=XRomix_LowerCasei.style.cursor='pointer'toolbar.appendChild(i)}//Этот код выполняется в начале.if(wgAction=='edit'||wgAction=='submit'){addOnloadHook(add_XRomix_LowerCase_Button)}//Функция для оформления таблицыfunctionXRomix_LowerCase(){vartxt,hidden=[],hidIdx=0,wpTextbox1=document.editform.wpTextbox1varwinScroll=document.documentElement.scrollTop//remember window scrollwpTextbox1.focus()if(typeofwpTextbox1.selectionStart!='undefined'&&(navigator.productSub>20031000||is_safari)){//Mozilla/Opera/Safari3vartextScroll=wpTextbox1.scrollTopvarstartPos=wpTextbox1.selectionStartvarendPos=wpTextbox1.selectionEndtxt=wpTextbox1.value.substring(startPos,endPos)if(txt==''){alert(Khanson_LowerCase_FullText);ShowHelp();return}else{processText()wpTextbox1.value=wpTextbox1.value.substring(0,startPos)+txt+wpTextbox1.value.substring(endPos)}wpTextbox1.selectionStart=startPoswpTextbox1.selectionEnd=startPos+txt.lengthwpTextbox1.scrollTop=textScroll}elseif(document.selection&&document.selection.createRange){//IE//alert("IE");varrange=document.selection.createRange()txt=range.textif(txt==''){alert(XRomix_LowerCase_FullText);ShowHelp();return}else{processText()range.text=txt//if (!window.opera) txt = txt.replace(/\r/g,'')if(range.moveStart)range.moveStart('character',-txt.length)range.select()}}else// Для браузеров, которые не умеют возвращать выделенный фрагмент, выдаем ошибку{alert(XRomix_LowerCase_CantWork);return}document.documentElement.scrollTop=winScroll// scroll back, for IE/OperavarwpSummary=document.getElementById('wpSummary')if(wpSummary){vartemp=wpSummary.value;temp=temp.replace(/\/\*.*?\*\//,"");//комментарииtemp=temp.replace(/[\s]*/,"");//пробелыif(temp==""){wpSummary.value=wpSummary.value+" - [[User talk:Khanson/lowercase.js|lowercase.js]]";}}//Здесь производим замену в переменной txt - это отразится на выделенном фрагменте текста functionprocessText(){txt=txt.toLocaleLowerCase();//переводим строку в нижний регистр}}