Skip to content

Instantly share code, notes, and snippets.

@tinybeans
Last active July 5, 2021 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tinybeans/5f1c487e1aef1c52f5fd5a10d3ed0d47 to your computer and use it in GitHub Desktop.
Save tinybeans/5f1c487e1aef1c52f5fd5a10d3ed0d47 to your computer and use it in GitHub Desktop.
test.js
(function($){
// 記事編集画面のカスタマイズ
if (mtappVars.screen_id == 'edit-entry') {
if (mtappVars.site.customfields.blog_is_jpen) {
// 英文タイトルのスタイルを設定
$('#customfield_entry_title_en').addClass('title').attr('placeholder', '英文タイトル');
// フィールドの表示/非表示を切り替えられなくする
$(('#entry_fields-field')).hide();
//
mtapp.sortDisabled();
mtapp.fieldSort({
sort: 'permalink,title,customfield_entry_inst_jn,text,tags,keywords,excerpt,customfield_entry_en,customfield_event_date,customfield_entry_pickup,customfield_entry_ignore,customfield_entry_image,customfield_entry_title_en,customfield_entry_inst_en,customfield_entry_body_en,customfield_entry_more_en,customfield_tag_en,customfield_link_jn,customfield_link_en'
});
setTimeout(function () {
// フィールドを横並びにする
$('#tags-field').before('<div id="tags_keywords" class="row"></div>');
$('#excerpt-field').after('<div id="bi_entry" class="row"><div id="bi_group" class="row"></div></div>');
$('#customfield_entry_title_en-field').before('<div id="en_entry"></div>');
setTimeout(function () {
$('#tags_keywords').append($('#tags-field'));
$('#tags_keywords').append($('#keywords-field'));
$('#tags-field').addClass('col-6');
$('#keywords-field').addClass('col-6');
$('#keywords').addClass('form-group');
$('#tags-field .field-content').css('padding-right', '1em');
$('#keywords-field .field-content').css('padding-right', '1em');
$('#bi_group').append($('#customfield_entry_en-field'));
$('#bi_group').append($('#customfield_event_date-field'));
$('#bi_group').append($('#customfield_entry_pickup-field'));
$('#bi_group').append($('#customfield_entry_ignore-field'));
$('#bi_entry').append($('#customfield_entry_image-field'));
$('#customfield_entry_en-field').addClass('col-3');
$('#customfield_event_date-field').addClass('col-3');
$('#customfield_entry_pickup-field').addClass('col-3');
$('#customfield_entry_ignore-field').addClass('col-3');
$('#customfield_entry_en-field .field-content').css('padding-right', '1em');
$('#customfield_event_date-field .field-content').css('padding-right', '1em');
$('#customfield_entry_pickup-field .field-content').css('padding-right', '1em');
$('#customfield_entry_ignore-field .field-content').css('padding-right', '1em');
$('#en_entry').append($('#customfield_entry_title_en-field'));
$('#en_entry').append($('#customfield_entry_inst_en-field'));
//$('#en_entry').append($('#customfield_entry_body_en-field'));
//$('#en_entry').append($('#customfield_entry_more_en-field'));
$('#en_entry').append($('#customfield_tag_en-field'));
// 英語本文と続きをタブにまとめる
mtapp.tabs({
content: [{
label: '英語本文',
seletor: '#customfield_entry_body_en-field'
}, {
label: '英語続き',
selector: '#customfield_entry_more_en-field'
}],
pointer: '#customfield_entry_inst_en-field',
method: 'after'
});
//英語本文と続きをリッチテキストにする
$('#customfield_entry_body_en').mtapp('overlayEditor');
$('#customfield_entry_more_en').mtapp('overlayEditor');
// BI記事系のフィールドを横並びにする
}, 10);
}, 10);
}
// ウェブページ編集画面のカスタマイズ
} else if (mtappVars.screen_id == 'edit-page') {
if (mtappVars.site.customfields.blog_is_jpen) {
// 英文タイトルのスタイルを設定
$('#customfield_page_title_en').addClass('title').attr('placeholder', '英文タイトル');
// フィールドの表示/非表示を切り替えられなくする
$(('#entry_fields-field')).hide();
// ドラッグアンドドロップをできなくする
mtapp.sortDisabled();
// フィールドの並び順を固定する
mtapp.fieldSort({
sort: 'permalink,title,text,tags,keywords,excerpt,customfield_page_en,customfield_page_image,customfield_page_main_image,customfield_page_title_en,customfield_page_body_en,customfield_page_more_en,customfield_page_tag_en'
});
// $('#tags,#keywords,#excerpt,#customfield_page_en,#customfield_page_image,#customfield_page_main_image,#customfield_page_title_en,#customfield_page_tag_en').removeClass('sort-enabled');
// 英語本文と続きをタブにまとめる
setTimeout(function () {
// フィールドを横並びにする
$('#tags-field').before('<div id="tags_keywords" class="row"></div>');
$('#customfield_page_title_en-field').before('<div id="bi_page"><div id="bi_group" class="row"></div></div>');
$('#customfield_page_title_en-field').before('<div id="en_page"></div>');
setTimeout(function () {
$('#tags_keywords').append($('#tags-field'));
$('#tags_keywords').append($('#keywords-field'));
$('#tags-field').addClass('col-6');
$('#keywords-field').addClass('col-6');
$('#keywords').addClass('form-group');
$('#tags-field .field-content').css('padding-right', '1em');
$('#keywords-field .field-content').css('padding-right', '1em');
$('#bi_page').prepend($('#customfield_page_en-field'));
$('#bi_group').append($('#customfield_page_image-field'));
$('#bi_group').append($('#customfield_page_main_image-field'));
$('#customfield_page_image-field').addClass('col-6');
$('#customfield_page_main_image-field').addClass('col-6');
$('#customfield_page_image-field .field-content').css('padding-right', '1em');
$('#customfield_page_main_image-field .field-content').css('padding-right', '1em');
$('#en_page').append($('#customfield_page_title_en-field'));
$('#en_page').append($('#customfield_page_body_en-field'));
$('#en_page').append($('#customfield_page_more_en-field'));
$('#en_page').append($('#customfield_page_tag_en-field'));
// 英語本文と続きをタブにまとめる
mtapp.tabs({
content: [{
label: '英語本文',
seletor: '#customfield_page_body_en-field'
}, {
label: '英語続き',
selector: '#customfield_page_more_en-field'
}],
pointer: '#customfield_page_title_en-field',
method: 'after'
});
//英語本文と続きをリッチテキストにする
$('#customfield_pege_body_en').mtapp('overlayEditor');
$('#customfield_page_more_en').mtapp('overlayEditor');
}, 10);
}, 10);
}
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment