МедияУики:Common.js/Core.js: Разлика между версии

От Уикицитат
Изтрито е съдържание Добавено е съдържание
Borislav (беседа | приноси)
абе, основите от Уикипедия са полезни
Borislav (беседа | приноси)
м грр
Ред 1: Ред 1:
document.write('<script type="text/javascript" src="http://bg.wikipedia.org/w/index.php?title=%D0%9C%D0%B5%D0%B4%D0%B8%D1%8F%D0%A3%D0%B8%D0%BA%D0%B8:Common.js/CoreO.js&action=raw&ctype=text/javascript"><\/scr'+'ipt>');
document.write('<script type="text/javascript" src="http://bg.wikipedia.org/w/index.php?title=%D0%9C%D0%B5%D0%B4%D0%B8%D1%8F%D0%A3%D0%B8%D0%BA%D0%B8:Common.js/Core.js&action=raw&ctype=text/javascript"><\/scr'+'ipt>');


function applyFuncToTheTextarea(func) {
function applyFuncToTheTextarea(func) {

Версия от 06:39, 4 юни 2008

document.write('<script type="text/javascript" src="http://bg.wikipedia.org/w/index.php?title=%D0%9C%D0%B5%D0%B4%D0%B8%D1%8F%D0%A3%D0%B8%D0%BA%D0%B8:Common.js/Core.js&action=raw&ctype=text/javascript"><\/scr'+'ipt>');

function applyFuncToTheTextarea(func) {
	applyFuncToTextarea("wpTextbox1", func);
}

function applyFuncToTextarea(tid, func) {
	var ta = document.getElementById(tid);
	if ( typeof(ta.selectionStart) != "undefined"
			&& ta.selectionStart != ta.selectionEnd ) {
		ta.value = String.concat(
			ta.value.substring(0, ta.selectionStart),
			func.call(null, ta.value.substring(ta.selectionStart, ta.selectionEnd)),
			ta.value.substring(ta.selectionEnd, ta.value.length) );
	} else if (document.selection && document.selection.createRange().text != "") {
		document.selection.createRange().text = func.call(
			null, document.selection.createRange().text);
	} else {
		ta.value = func.call(null, ta.value);
	}
	ta.focus();
}

function sortlines(text) {
	return text.split('\n').sort().join('\n');
}