Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Подстветка синтаксиса для админки
- if ($_SERVER['SCRIPT_NAME']=="/bitrix/admin/fileman_file_edit.php")
- {
- AddEventHandler("main", "OnEpilog", "InitPHPHighlight");
- function InitPHPHighlight()
- {
- global $APPLICATION;
- $path = '/js/codemirror';
- $string='
- <link rel="stylesheet" href="'.$path.'/lib/codemirror.css">
- <link rel="stylesheet" href="'.$path.'/lib/util/dialog.css">
- <script src="'.$path.'/lib/codemirror.js"></script>
- <script src="'.$path.'/mode/htmlmixed/htmlmixed.js"></script>
- <script src="'.$path.'/mode/xml/xml.js"></script>
- <script src="'.$path.'/mode/javascript/javascript.js"></script>
- <script src="'.$path.'/mode/css/css.js"></script>
- <script src="'.$path.'/mode/clike/clike.js"></script>
- <script src="'.$path.'/mode/php/php.js"></script>
- <script src="'.$path.'/lib/util/dialog.js"></script>
- <script src="'.$path.'/lib/util/searchcursor.js"></script>
- <script src="'.$path.'/lib/util/search.js"></script>
- <style>
- .CodeMirror-scroll, .CodeMirror-dialog { font: 12px "Monaco", "Lucida Console", "Courier" !important; }
- .CodeMirror-dialog > div { top:auto; bottom:9px; left:-8px; right:-8px;}
- .CodeMirror-scroll { height: 500px; }
- .CodeMirror-selected { background: #c7ddfe !important; }
- .activeline { background: #ffffff !important;}
- </style>
- <script>
- BX.ready(function(){
- //setTimeout( Codemirror_Init, 300);
- Codemirror_Init();
- });
- function Codemirror_Init() {
- var nl=document.getElementsByTagName("textarea");
- var editor = CodeMirror.fromTextArea(nl[0], {
- lineNumbers: true,
- matchBrackets: true,
- mode: "application/x-httpd-php",
- indentUnit: 2,
- indentWithTabs: false,
- tabMode: "indent",
- enterMode: "indent",
- lineWrapping: true,
- onChange: function(){editor.save();},
- onCursorActivity: function() {
- editor.setLineClass(hlLine, null);
- hlLine = editor.setLineClass(editor.getCursor().line, "activeline");
- },
- });
- var hlLine = editor.setLineClass(0, "activeline");
- }
- </script>';
- $APPLICATION->AddHeadString($string);
- }
- }
Add Comment
Please, Sign In to add comment