SCEditor và CodeMirror được Forumotion sử dụng trong ACP nhằm giúp Admin sửa chữa code dễ dàng hơn.
Tuy nhiên, đôi lúc nó xảy ra lỗi với một số ký tự đặc biệt hoặc hoạt động chậm khi gặp code lớn, script này sẽ giúp bạn loại bỏ nó mà không gây ảnh hưởng đến code của bạn.
Tuy nhiên, đôi lúc nó xảy ra lỗi với một số ký tự đặc biệt hoặc hoạt động chậm khi gặp code lớn, script này sẽ giúp bạn loại bỏ nó mà không gây ảnh hưởng đến code của bạn.
- Code:
// ==UserScript==
// @name Remove SCEditor + CodeMirror
// @namespace http://devs.forumvi.com/
// @version 1.0.0
// @description Thêm tùy chọn vô hiệu hóa SCEditor và CodeMirror khi tạo hoặc chỉnh sửa code trong Forumotion
// @include http://*/admin/index.forum*
// @match http://*/admin/index.forum*
// @copyright 2013+, Zzbaivong
// @run-at document-end
// @grant none
// ==/UserScript==
$(function() {
function afterBtn(a) {
$("form[action^='/admin/index.forum'] input:submit:last").after('<button id="remove_' + a + '" class="icon_cancel" type="button"> Vô hiệu hóa ' + a + '</button>');
$("#remove_" + a).css({
"font-family": "'Lucida Sans Unicode', Verdana, Helvetica, Arial, sans-serif",
"font-size": "100%",
"vertical-align": "middle"
});
}
if ($.sceditor) {
afterBtn("SCEditor");
$("#remove_SCEditor").click(function() {
$("#text_editor_textarea").height(450).sceditor("instance").destroy();
$(this).remove();
});
}
if (window.editor) {
afterBtn("CodeMirror");
$("#remove_CodeMirror").click(function() {
editor.toTextArea();
$("#text_editor_textarea").height(450);
$(this).remove();
});
}
});
- Vô hiệu hóa hoàn toàn SCEditor và CodeMirror:
- Code:
// ==UserScript==
// @name Remove SCEditor + CodeMirror
// @namespace http://devs.forumvi.com/
// @version 1.0.0
// @description Thêm tùy chọn vô hiệu hóa SCEditor và CodeMirror khi tạo hoặc chỉnh sửa code trong Forumotion
// @include http://*/admin/index.forum*
// @match http://*/admin/index.forum*
// @copyright 2013+, Zzbaivong
// @run-at document-end
// @grant none
// ==/UserScript==
$(function() {
if ($.sceditor) {
$("#text_editor_textarea").height(450).sceditor("instance").destroy();
}
if (window.editor) {
editor.toTextArea();
$("#text_editor_textarea").height(450);
}
});
Zzbaivong