Fix too many simultaneous requests on agreement edit screen

약관 에디터 iframe을 동시에 5개 띄우면서 과부하가 발생하는 문제 수정
This commit is contained in:
Kijin Sung 2017-11-30 23:23:07 +09:00
parent 04fbcdd514
commit e19c196a67
6 changed files with 65 additions and 23 deletions

View file

@ -0,0 +1,29 @@
(function($) {
// Editor replacement callback function
var editor_replace = function(input) {
var iframe = $('<iframe class="editor_iframe"></iframe>');
iframe.attr("src", current_url.setQuery("act", "dispMemberAdminAgreementsEdit").setQuery("parent_input_id", input.attr("id")));
iframe.insertAfter(input);
input.siblings(".editor_preview").hide();
if (input.attr("type") !== "hidden") {
input.hide();
}
};
// Editor replacement
$(function() {
$(".editor_preview").on("click", function() {
var input = $(this).siblings(".editor_content");
if (input.size()) {
$(this).off("click").off("focus");
editor_replace(input.first());
}
});
$(".editor_preview").on("focus", function() {
$(this).triggerHandler("click");
});
});
})(jQuery);