2
1
0
1 回答
- 654
例えばカスタム HTML から以下のような JavaScript を適用すれば
ページの上部に記事が古い旨の警告を表示させることができるかと思います。<script> (function($) { var baseUrl = Confluence.getBaseUrl(); var contentId = Confluence.getContentId(); var yearNum = 1; if (!contentId || contentId === '0') return; // Get the content. $.ajax({ url: baseUrl + '/rest/api/content/' + contentId + '?expand=history.lastUpdated', type: 'GET', dataType: 'json' }).done(function(content) { // console.log('---- content ----'); // console.log(content); var lastUpdatedDate = moment(content.history.lastUpdated.when); var now = moment(); var diff = now.diff(lastUpdatedDate, 'year'); if (diff >= yearNum) { showOldAlert(); setHideEvent(); } }).fail(function(xhr) { console.error('Could not get the content.'); console.error(xhr); }); function showOldAlert() { var htmlString = '<div class="old-alert confluence-information-macro confluence-information-macro-note" style="background-color:#fae188;">' + '<span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span>' + '<div class="confluence-information-macro-body"><p><span style="color:#594300;font-weight:bold;">この記事は最終更新日から ' + yearNum + ' 年以上が経過していますよ!</span></p></div></div>'; $('#main > :first').before($(htmlString)); } function setHideEvent() { $('#editPageLink').on('click', function() { $('.old-alert').css('display', 'none'); }); } })(AJS.$); </script>
その他にはユーザーマクロを作成したり、
レイアウトをカスタマイズしたりすることでも表示ができるでしょうか...コメントを追加...
Confluence のページで最終更新日が古いもの
例えば更新されてから一年以上たっているような記事を一目でわかるようにしたのですが
何か方法はありますでしょうか。