Created
April 16, 2020 04:15
-
-
Save tinybeans/b24d3c7ccf87936dc249819da503fb0d to your computer and use it in GitHub Desktop.
MTAppInCats と MTAppTabs の組み合わせの代替案
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
// $.MTAppCategorySwitch({ | |
// selector: { | |
// 'init': '#title-field', | |
// 'hide': | |
// '#text-field,#excerpt-field,#customfield_entryogimage-field,#customfield_entryeyecatch-field,#customfield_entryappendix-field,#customfield_entrycontact-field,#customfield_entrylinkurl-field', | |
// 'cat49': | |
// '#title-field,#text-field,#excerpt-field,#customfield_entryogimage-field,#customfield_entryeyecatch-field,#customfield_entryappendix-field,#customfield_entrycontact-field', | |
// 'cat50': | |
// '#title-field,#text-field,#excerpt-field,#customfield_entryogimage-field,#customfield_entryeyecatch-field,#customfield_entryappendix-field,#customfield_entrycontact-field', | |
// 'cat51': | |
// '#title-field,#text-field,#excerpt-field,#customfield_entryogimage-field,#customfield_entryeyecatch-field,#customfield_entrylinkurl-field', | |
// } | |
// }); | |
const $body = $('body'); | |
const $selectedCategory = $('#category-ids'); | |
const noSelectedCategoryClass = 'no-selected-category' | |
if (mtappVars.selected_category.length === 0) { | |
$body.addClass(noSelectedCategoryClass); | |
} | |
setCookie('categoryType01', 'no', 365); | |
$('#category-field').on('click', ':checkbox', function () { | |
window.setTimeout(function () { | |
const selectedCategories = $selectedCategory.val().split(','); | |
if (selectedCategories.length === 0 || selectedCategories[0] === '') { | |
$body.addClass(noSelectedCategoryClass); | |
} | |
else { | |
$body.removeClass(noSelectedCategoryClass); | |
} | |
const categoryType01 = getCookie('categoryType01'); | |
if ($.inArray('49', selectedCategories) !== -1 || $.inArray('50', selectedCategories) !== -1) { | |
if (categoryType01 === 'no') { | |
$body.addClass('categoryType01'); | |
$.MTAppTabs({ | |
basename: { | |
"excerpt": "meta description", | |
"cf_entryogimage": "OGP 画像", | |
"cf_entryeyecatch": "アイキャッチ画像", | |
}, | |
pointer: '#text-field', | |
insert: 'before', | |
}); | |
$.MTAppTabs({ | |
basename: { | |
"cf_entryappendix": "解説文", | |
"cf_entrycontact": "お問い合わせ先" | |
}, | |
pointer: '#text-field', | |
insert: 'after', | |
}); | |
$.MTAppApplyTinyMCE({ | |
target: ['customfield_entryappendix', 'customfield_entrycontact'], | |
sortable: false | |
}); | |
setCookie('categoryType01', 'yes', 365); | |
} | |
} | |
else if (categoryType01 === 'yes') { | |
if (confirm('画面をリフレッシュしてよろしいですか?')) { | |
location.reload(); | |
} | |
} | |
}, 200); | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment