Changeset 1900373
- Timestamp:
- 06/28/2018 07:02:06 AM (8 years ago)
- Location:
- code-editor-and-compiler/trunk
- Files:
-
- 6 edited
-
admin/compilebin-admin.php (modified) (3 diffs)
-
admin/js/editor-handler.js (modified) (8 diffs)
-
common/css/editor-style.css (modified) (1 diff)
-
common/js/include.js (modified) (2 diffs)
-
compilebin.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
code-editor-and-compiler/trunk/admin/compilebin-admin.php
r1897955 r1900373 380 380 <div class="cdbx-div-right-2"> 381 381 <select name="cdbx-lang" id="cdbx-lang" style="margin-top:-0.1em"></select> 382 <input id="cdbx-filename" class="cdbx-textbox" placeholder="Filename" style=""></input> .<span id="cdbx-filename-ext"></span>382 <input id="cdbx-filename" class="cdbx-textbox" placeholder="Filename" style=""></input><span id="cdbx-filename-ext"></span> 383 383 <button type="button" id="cdbx-setting" class="button button-default" style="float:right" title="Enter your API key for code execution"> 384 384 <span class="dashicons dashicons-admin-network" aria-hidden="true" style="margin-top:0.2em"></span> … … 388 388 </button> 389 389 </div> 390 <div id="cdbx-div-output" style="width: 100%">390 <div id="cdbx-div-output" style="width:98%"> 391 391 Output Appears Here ... 392 392 </div> … … 556 556 </div> 557 557 <div class="cdbx-div-right-2" style="width:100%;"> 558 <input id="cdbx-filename" class="cdbx-textbox" style="margin-top:5px;float:left;font-size:13px;" placeholder="Filename"></input><span style="float:left;margin-top:5px;">.</span><spanid="cdbx-filename-ext" style="float:left;margin-top:5px;"></span>558 <input id="cdbx-filename" class="cdbx-textbox" style="margin-top:5px;float:left;font-size:13px;" placeholder="Filename"></input><span id="cdbx-filename-ext" style="float:left;margin-top:5px;"></span> 559 559 <!--<button type="button" id="cdbx-code-help" class="cdbx-btn-1" style="float:right"> 560 560 <span class="dashicons dashicons-editor-help" aria-hidden="true"></span> -
code-editor-and-compiler/trunk/admin/js/editor-handler.js
r1897951 r1900373 93 93 }); 94 94 }; 95 96 var cdbx_updateDOM = function () { 97 if (cdbx_curLangId == cdbx_defLangId || cdbx_run_btn_status == 0) { 98 $(CDBX_FILENAME).hide(); 99 $(CDBX_FILENAME_EXT).hide(); 100 $(CDBX_RUN_CODE).prop("disabled", true); 101 $(CDBX_STDIN).hide(); 102 $(CDBX_CMDLINE).hide(); 103 104 var cdbx_info_html = 'Syntax Highlighter Mode <br>'; 105 var cdbx_info_html_web = 'Syntax Highlighter Mode <br>'; 106 107 if (cdbx_curLangId == cdbx_defLangId) { 108 cdbx_info_html += '<p style="color:#696969"><label style="color:#008B8B">Default language is selected.</label><br> Code that you write in any language will only be automatically syntax highlighted in public view. Select a specific language from the drop down menu to run your code.</p>'; 109 } 110 111 if (cdbx_run_btn_status == 0) { 112 /* run button needs to be hidden in web design editor also */ 113 $(CDBX_RUN_CODE_WEB).prop("disabled", true); 114 //$(CDBX_OUTPUT_WEB_LINK).hide(); 115 cdbx_info_html_web += '<p style="color:#696969"><label style="color:#008B8B">Code execution is disabled.</label><br> Please enable it from <a href="" id="cdbx-global-setting">global settings</a></p>'; 116 cdbx_info_html += '<p style="color:#696969"><label style="color:#008B8B">Code execution is disabled.</label><br> Please enable it from <a href="" id="cdbx-global-setting">global settings</a></p>'; 117 $(CDBX_DIV_OUTPUT_WEB).html(cdbx_info_html_web); 118 } else { 119 $(CDBX_RUN_CODE_WEB).prop("disabled", false); 120 $(CDBX_DIV_OUTPUT_WEB).html(cdbx_default_output); 121 } 122 123 $(CDBX_DIV_OUTPUT).html(cdbx_info_html); 124 125 } else { 126 $(CDBX_FILENAME).show(); 127 $(CDBX_FILENAME_EXT).show(); 128 $(CDBX_RUN_CODE).prop("disabled", false); 129 $(CDBX_STDIN).show(); 130 $(CDBX_CMDLINE).show(); 131 $(CDBX_DIV_OUTPUT).html(cdbx_default_output); 132 133 $(CDBX_RUN_CODE_WEB).prop("disabled", false); 134 //$(CDBX_OUTPUT_WEB_LINK).show(); 135 } 136 }; 137 95 138 96 139 var cdbx_executeHtmlCode = function(html, css, js, externalCss, externalJs, output_div) { … … 159 202 var initEditorDialog = function() { 160 203 $(CDBX_EDITOR_DIALOG).dialog({ 161 title: 'Code Editor ',204 title: 'Code Editor and Compiler', 162 205 dialogClass: 'wp-dialog', 163 206 autoOpen: false, … … 183 226 }); 184 227 $(CDBX_LANG).val(cdbx_curLangId); 228 cdbx_updateDOM(); 185 229 $(CDBX_FILENAME).val(cdbx_progName); 186 230 if (cdbx_editorNode == null) { … … 257 301 cdbx_curEditorIdPref = parseInt(setObj.editorPref); 258 302 } 259 if (setObj.langPref.length > 0) { 303 304 if (setObj.langPref.length > 0) { 260 305 cdbx_curLangId = parseInt(setObj.langPref); 261 306 cdbx_curLangIdPref = parseInt(setObj.langPref); … … 298 343 var file_name = $(CDBX_FILENAME).val(); 299 344 var prefix = '<pre id="' + pre_id + '"' + ' class="prettyprint" style="padding:10px;border:1px solid rgba(231, 231, 230, 1);border-radius:10px;background-color:#FFFFFF;font-family: courier, sans-serif;font-size:13px;">'; 300 var suffix = '<input id="' + input_id + '"' + 345 346 var suffix = ''; 347 if (lang_id == cdbx_defLangId) { 348 suffix = '<input id="' + input_id + '"' + 349 'class="cdbx-try-code cdbx-btn-main-def"' + 350 'style="background-color:#FFFFFF;margin-bottom:0;color:#008B8B;border: 1px solid rgba(231, 231, 230, 1); border-radius: 10px;font-size:13px;height:30px;min-width:60px;max-width:150px;padding:4px;font-weight:normal;outline:none;display:none;"' + 351 'type="" value="Run" data-code="' + pre_id + '"' + 352 'data-lang="' + lang_id + '"' + 'data-filename="' + file_name + '" /><br></pre><br>'; 353 } else { 354 suffix = '<input id="' + input_id + '"' + 301 355 'class="cdbx-try-code cdbx-btn-main"' + 302 356 'style="background-color:#FFFFFF;margin-bottom:0;color:#008B8B;border: 1px solid rgba(231, 231, 230, 1); border-radius: 10px;font-size:13px;height:30px;min-width:60px;max-width:150px;padding:4px;font-weight:normal;outline:none;"' + 303 357 'type="button" value="Run" data-code="' + pre_id + '"' + 304 'data-lang="' + lang_id + '"' + 'data-filename="' + file_name + '" /><br></pre><br>'; 358 'data-lang="' + lang_id + '"' + 'data-filename="' + file_name + '" /><br></pre><br>'; 359 } 360 305 361 wp.media.editor.insert(prefix + code + suffix); 306 362 $(CDBX_EDITOR_DIALOG).dialog(CDBX_EVENT_CLOSE); … … 469 525 cdbx_curLangId = $(this).find('option:selected').val(); 470 526 cdbx_setMode(); 527 cdbx_updateDOM(); 471 528 }); 472 529 … … 676 733 cdbx_setTheme(); 677 734 cdbx_run_btn_status = cdbx_json.run_btn_status; 735 cdbx_updateDOM(); 678 736 }, 679 737 error: function(jqXHR, textStatus, errorThrown) { … … 692 750 '<div class="cdbx-dialog-box">' + 693 751 '<div id="cdbx-global-setting-save-msg" style="color:#000080"></div>' + 694 '<input type="checkbox" id="cdbx-run-btn-status"> <span class="cdbx-label-text"> Hide Run Button</span>    <span class="cdbx-info-text-1">Syntax highlighter mode only. Run button will not be visible in code snippets.</span><br><br>' +752 '<input type="checkbox" id="cdbx-run-btn-status"> <span class="cdbx-label-text">Disable code execution</span>    <span class="cdbx-info-text-1">Syntax highlighter mode only. Run button will not be visible in code snippets.</span><br><br>' + 695 753 '<span class="cdbx-label-text">Preferred Editor</span> <select name="cdbx-pref-editor" id="cdbx-pref-editor" style=""></select>    <span class="cdbx-info-text-1">Default code editor.</span><br><br>' + 696 754 '<span class="cdbx-label-text">Preferred Language</span> <select name="cdbx-pref-lang" id="cdbx-pref-lang" style=""></select>    <span class="cdbx-info-text-1">Default programming language.</span><br><br>' + -
code-editor-and-compiler/trunk/common/css/editor-style.css
r1897951 r1900373 57 57 width:100%; 58 58 margin-top: 5px; 59 padding: 4px; 59 60 } 60 61 -
code-editor-and-compiler/trunk/common/js/include.js
r1897848 r1900373 105 105 106 106 var cdbx_languages = [ 107 { id: 0, name: 'C', mode: 'ace/mode/c_cpp', ext: 'c' }, 108 { id: 1, name: 'C++', mode: 'ace/mode/c_cpp', ext: 'cpp' }, 109 { id: 2, name: 'Java', mode: 'ace/mode/java', ext: 'java' }, 110 { id: 3, name: 'Python2.7', mode: 'ace/mode/python', ext: 'py' }, 111 { id: 4, name: 'Python3', mode: 'ace/mode/python', ext: 'py' }, 112 { id: 5, name: 'Perl', mode: 'ace/mode/perl', ext: 'pl' }, 113 { id: 6, name: 'Ruby', mode: 'ace/mode/ruby', ext: 'rb' }, 114 { id: 7, name: 'Clojure', mode: 'ace/mode/clojure', ext: 'clj' }, 115 { id: 8, name: 'Elixir', mode: 'ace/mode/elixir', ext: 'ex' }, 116 { id: 9, name: 'C#', mode: 'ace/mode/csharp', ext: 'cs' }, 117 { id: 10, name: 'Erlang', mode: 'ace/mode/erlang', ext: 'erl' }, 118 { id: 11, name: 'Scala', mode: 'ace/mode/scala', ext: 'scala' }, 119 { id: 12, name: 'Go', mode: 'ace/mode/golang', ext: 'go' }, 120 { id: 13, name: 'Objective-C', mode: 'ace/mode/objectivec', ext: 'm' }, 121 { id: 14, name: 'VB.Net', mode: 'ace/mode/vbscript', ext: 'vb' }, 122 { id: 15, name: 'Swift3', mode: 'ace/mode/objectivec', ext: 'swift' } 107 { id: 0, name: 'C', mode: 'ace/mode/c_cpp', ext: '.c' }, 108 { id: 1, name: 'C++', mode: 'ace/mode/c_cpp', ext: '.cpp' }, 109 { id: 2, name: 'Java', mode: 'ace/mode/java', ext: '.java' }, 110 { id: 3, name: 'Python2.7', mode: 'ace/mode/python', ext: '.py' }, 111 { id: 4, name: 'Python3', mode: 'ace/mode/python', ext: '.py' }, 112 { id: 5, name: 'Perl', mode: 'ace/mode/perl', ext: '.pl' }, 113 { id: 6, name: 'Ruby', mode: 'ace/mode/ruby', ext: '.rb' }, 114 { id: 7, name: 'Clojure', mode: 'ace/mode/clojure', ext: '.clj' }, 115 { id: 8, name: 'Elixir', mode: 'ace/mode/elixir', ext: '.ex' }, 116 { id: 9, name: 'C#', mode: 'ace/mode/csharp', ext: '.cs' }, 117 { id: 10, name: 'Erlang', mode: 'ace/mode/erlang', ext: '.erl' }, 118 { id: 11, name: 'Scala', mode: 'ace/mode/scala', ext: '.scala' }, 119 { id: 12, name: 'Go', mode: 'ace/mode/golang', ext: '.go' }, 120 { id: 13, name: 'Objective-C', mode: 'ace/mode/objectivec', ext: '.m' }, 121 { id: 14, name: 'VB.Net', mode: 'ace/mode/vbscript', ext: '.vb' }, 122 { id: 15, name: 'Swift3', mode: 'ace/mode/objectivec', ext: '.swift' }, 123 { id: 16, name: 'Default', mode: 'ace/mode/c_cpp', ext: '' } 123 124 ]; 124 125 … … 155 156 var cdbx_editor_css = null; 156 157 var cdbx_editor_js = null; 157 var cdbx_curLangId = 0; 158 var cdbx_curLangIdPref = 0; 158 var cdbx_defLangId = cdbx_languages.length - 1; 159 var cdbx_curLangId = cdbx_defLangId; 160 var cdbx_curLangIdPref = cdbx_defLangId; 159 161 var cdbx_curEditorIdPref = 0; 160 162 var cdbx_run_btn_status = 1; -
code-editor-and-compiler/trunk/compilebin.php
r1897955 r1900373 9 9 * Plugin Name: Code Editor and Compiler 10 10 * Plugin URI: https://www.compilebin.com 11 * Description: Execute code online.11 * Description: Syntax highlighter and code compiler. 12 12 * Version: 1.3.1 13 13 * Author: Compilebin -
code-editor-and-compiler/trunk/readme.txt
r1897955 r1900373 13 13 14 14 == Description == 15 This pluginacts as an interface to the online compiler api service on cloud provided by https://www.compilebin.com. It interacts with cloud service via rest APIs i.e, submit the code and get the output. Users need to signup and get an api key which is to be updated in the plugin to use the service. Plugin contains a link for signing up for the service. There is no security concern on the web server as the task of code execution is offloaded to the cloud service. The plugin uses the following open source libraries :15 This is a syntax highlighter plugin which also acts as an interface to the online compiler api service on cloud provided by https://www.compilebin.com. It interacts with cloud service via rest APIs i.e, submit the code and get the output. Users need to signup and get an api key which is to be updated in the plugin to use the service. Plugin contains a link for signing up for the service. There is no security concern on the web server as the task of code execution is offloaded to the cloud service. The plugin uses the following open source libraries : 16 16 1) Code prettify for syntax highlighting 17 17 2) Ace code editor
Note: See TracChangeset
for help on using the changeset viewer.