User:Mopsgamer/global.js

$(function { Editor = { AddInside: "#Editor", ButtonTextOpenEditor: "Открыть", ButtonTextChangeEditor: "Сменить редактор", ButtonTextCloseEditor: "Закрыть", ButtonTextCopy: "Копировать", 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(' Копировать '); $('#EditorRightArea').append(' Очистить Фон Красный  '); $('#EditorHeader').append('Открыть <button id="Close">Закрыть '); $('#ChangeEditorArea').text(Editor.ButtonTextOpenEditor); $('#CloseEditor').text(Editor.ButtonTextCloseEditor); $('#Copy').text(Editor.ButtonTextCopy); $('#EditorAreaTitle').text(AreaTitle); $('#EditorAreaTitle').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"); $('#Editor ul>li').css("list-style-type", "none"); $('#Clear').click(function{ $('#EditorViewArea>div').attr("style", ""); }) $('#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').hide;	$('#EditorViewArea').show;	$('#EditorRightAreaView').show;	$('#EditorRightAreaText').hide; 	$('#EditorTextArea').text($('#EditorViewArea').val); 	$('#Copy').hide; 	break; 	case "EditorTextArea": 	Area = "EditorViewArea"; 	AreaTitle = Editor.TextAreaTitle; 	$('#EditorTextArea').show;	$('#EditorViewArea').hide;	$('#EditorRightAreaView').hide;	$('#EditorRightAreaText').show; 	$('#Copy').show; 	}} $('#EditorAreaTitle').text(AreaTitle); $('#ChangeEditorArea').text(Editor.ButtonTextChangeEditor); }); });