For faster navigation, this Iframe is preloading the Wikiwand page for Участник:X-romix/lowercase.js.

Участник:X-romix/lowercase.js

Материал из Википедии — свободной энциклопедии

//Скрипт редактирования для Википедии. Переводит выделенный фрагмент текста в нижний регистр.
//Часть кода позаимствована из https://ru.wikipedia.org/wiki/MediaWiki:Wikificator.js
//Автор: X-romix
 
var XRomix_LowerCase_CantWork = 'Перевод в нижний регистр не может работать в вашем браузере.\n\nLowerCase script cannot work in your browser' // английский текст для тех, кто не видит русские буквы
var XRomix_LowerCase_FullText = 'Сначала выделите текст. Эта функция переводит выделенный текст в нижний регистр';
 
//Добавляет кнопку
function add_XRomix_LowerCase_Button(){
	var toolbar = document.getElementById('gadget-toolbar')
	var textbox = document.getElementById('wpTextbox1')
	if (!textbox || !toolbar) return
	var i = document.createElement('img')
	i.src = 'https://upload.wikimedia.org/wikipedia/ru/b/b3/Button-LowerCase.PNG'
	i.alt = i.title = 'Перевод текста в нижний регистр'
	i.onclick = XRomix_LowerCase
	i.style.cursor = 'pointer'
	toolbar.appendChild(i)
} 
 
//Этот код выполняется в начале.
if (mw.config.get('wgAction') == 'edit' || mw.config.get('wgAction') == 'submit'){
  mw.hook( 'legacy.toolbar.ready' ).add( add_XRomix_LowerCase_Button );
}
 
 
//Функция для оформления таблицы
function XRomix_LowerCase(){
  
 var txt, hidden = [], hidIdx = 0, wpTextbox1 = document.editform.wpTextbox1
 var winScroll = document.documentElement.scrollTop //remember window scroll
 wpTextbox1.focus()
 
 if (typeof wpTextbox1.selectionStart != 'undefined' 
    && (navigator.productSub > 20031000 || is_safari)) { //Mozilla/Opera/Safari3
 
    var textScroll = wpTextbox1.scrollTop
    var startPos = wpTextbox1.selectionStart
    var endPos = wpTextbox1.selectionEnd
    txt = wpTextbox1.value.substring(startPos, endPos)
    if (txt == '') {alert(XRomix_LowerCase_FullText); ShowHelp(); return}
    else{
 
	  processText()
      wpTextbox1.value = wpTextbox1.value.substring(0, startPos) + txt + wpTextbox1.value.substring(endPos)
    }
    wpTextbox1.selectionStart = startPos
    wpTextbox1.selectionEnd = startPos + txt.length
    wpTextbox1.scrollTop = textScroll
 
 }else if (document.selection && document.selection.createRange) { //IE
 	 //alert("IE");
 
   var range = document.selection.createRange()
   txt = range.text
   if (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/Opera

 var wpSummary = document.getElementById('wpSummary')
 if(wpSummary){
    var temp=wpSummary.value;
    temp=temp.replace(/\/\*.*?\*\// , ""); //комментарии
    temp=temp.replace(/[\s]*/ , ""); //пробелы
    if (temp==""){
       //wpSummary.value=wpSummary.value+" - [[User talk:X-romix/lowercase.js|lowercase.js]]";
    }
 }
 
 
//Здесь производим замену в переменной txt - это отразится на выделенном фрагменте текста 
function processText(){
	txt=txt.toLocaleLowerCase(); //переводим строку в нижний регистр
}	

}
{{bottomLinkPreText}} {{bottomLinkText}}
Участник:X-romix/lowercase.js
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?