User:Mopsgamer/global.js

$(function { Editor = { AddInside: "#Editor", ButtonTextOpenEditor: "Открыть", ButtonTextChangeEditor: "Сменить редактор", ButtonTextCloseEditor: "Закрыть", ButtonTextCopy: "Копировать", ButtonTextFind: "Найти", TextAreaTitle: "Код", ViewAreaTitle: "Вид" }; Area = "EditorTextArea"; AreaTitle = Editor.TextAreaTitle; var SearchText; $(Editor.AddInside).html('').css("border", "1px solid #90afcc"); $(Editor.AddInside).append('  '); $('#EditorAreas').append(' '); $('#EditorAreas').append(' '); $('#EditorAreas').append(' '); $('#EditorRightArea').append('Очистить Копировать '); $('#EditorHeader').append('Открыть Закрыть '); $('#ChangeEditorArea').text(Editor.ButtonTextOpenEditor); $('#CloseEditor').text(Editor.ButtonTextCloseEditor); $('#Copy').text(Editor.ButtonTextCopy); $('#EditorAreaTitle').text(AreaTitle) $('#EditorAreaTitle').hide; $('#EditorRightArea').hide; $('#EditorAreas').hide; $('#Close').hide; $('#Copy').hide; $('#Close').css("margin-left", "10px").css("float", "right").css("width", "120px"); $('#EditorViewArea').css("transform", "scale(0)"); $('#EditorRightArea>button').css("width", "90px"); $('#Clear').click(function{ $('#EditorTextArea').html(''); }) $('#Copy').click(function{ $('#EditorTextArea').select; document.execCommand("copy"); document.getSelection.collapseToEnd; }) $('#Close').click(function{ $('#ChangeEditorArea').text(Editor.ButtonTextOpenEditor); $(Editor.AddInside).css("height", "unset"); $('#EditorAreas').hide; $('#EditorAreaTitle').hide; $('#Close').hide; $('#Copy').hide; }) Area = "EditorTextArea"; AreaTitle = Editor.ViewAreaTitle; $('#EditorViewArea').css("transform", "scale(1)"); $('#EditorTextArea').css("transform", "scale(0)"); $('#ChangeEditorArea').click(function{ $(Editor.AddInside).css("height", "500px"); $('#Close').show; $('#EditorAreas').show; $('#EditorAreaTitle').show;	if( $('#ChangeEditorArea').text == Editor.ButtonTextChangeEditor ){	switch (Area) {	case "EditorViewArea":	Area = "EditorTextArea";	AreaTitle = Editor.ViewAreaTitle;	$('#EditorTextArea').css("transform", "scale(0)");	$('#EditorViewArea').css("transform", "scale(1)"); 	$('#EditorViewArea').html($('#EditorTextArea').val); 	$('#EditorRightArea').hide; 	$('#Copy').hide; 	break; 	case "EditorTextArea": 	Area = "EditorViewArea"; 	AreaTitle = Editor.TextAreaTitle; 	$('#EditorViewArea').css("transform", "scale(0)"); 	$('#EditorTextArea').css("transform", "scale(1)"); 	$('#EditorRightArea').show; 	$('#Copy').show; 	}} $('#EditorAreaTitle').text(AreaTitle); $('#ChangeEditorArea').text(Editor.ButtonTextChangeEditor); }); });