「javascript/commentics」の編集履歴(バックアップ)一覧はこちら

javascript/commentics - (2018/09/21 (金) 01:55:28) の1つ前との変更点

追加された行は緑色になります。

削除された行は赤色になります。

#js(){{{ <script type="text/javascript"> // -------------------------------------------------------------------- // ■使い方 // #include(javascript/commentics) ←メニューページでincludeさせるので不要 // #divclass(commentics){タブスタイル,ページ名} //【タブスタイル】は後述のいずれかを指定。サーヴァント、イベント、召喚報告、編集議論、一般 //【ページ名】一意のページ名を指定。@wikiのページ名と同じでOK。ただし@wikiと違ってコメントページ作成後はページ名を変更できない(@wikiのページ名を変えたからこっちも変えようとか駄目絶対) // 例: #divclass(commentics){サーヴァント,アルトリア・ペンドラゴン〔アーチャー〕} // -------------------------------------------------------------------- $(function(){ $('.commentics').each(function() { var tabstyle = ['サーヴァント', 'イベント', '召喚報告', '編集議論', '一般']; var pages = ['servant.php', 'event.php', 'summonreport.php', 'editreport.php', 'general.php']; var commentics_url = 'https://ss1.xrea.com/fgoc.s1006.xrea.com/'; var prm = $.map($(this).children('p:last-child').text().split(','), $.trim); if ($(this).find('iframe').length > 0) { return true; } if (prm.length < 2 || prm[0] === '') { $(this).css('color', 'red').text('[commentics] 引数が足りない!#divclass(commentics){タブスタイル,ページ名);だよ'); return true; } if (tabstyle.indexOf(prm[0]) === -1) { $(this).css('color', 'red').text('[commentics] 第一引数のタブスタイル名が変!後述から選んでね。' + tabstyle.join('、')); return true; } if (prm[1] === '') { $(this).css('color', 'red').text('[commentics] 第二引数のページ名が空!'); return true; } $(this).css({ 'margin': '0', 'padding': '0', 'border': '0', 'overflow': 'hidden' }); $('<iframe>').attr({ 'src': commentics_url + pages[tabstyle.indexOf(prm[0])] + '?id=' + encodeURIComponent(prm[1]), 'scrolling': 'no', }).css({ 'width': '100%', 'height': '100px', 'border': '0', 'margin': '0', 'padding': '0' }).text('(IFRAME 機能を有効にしてください)').appendTo(this); }); }); $(function() { $(window).on('message', function(event) { // クロスサイトリクエストフォージェリ対策(送信元の検証) if (event.originalEvent.origin !== 'https://ss1.xrea.com') { return; } let mo = event.originalEvent.data, fid = '.commentics iframe'; if (mo && typeof mo === 'object' && 'cmd' in mo) { if (mo.cmd == 'resize') { $(fid).css('height', mo.height+'px'); } else if (mo.cmd == 'move') { $('html, body').animate({ scrollTop: ($(fid).offset().top + parseInt(mo.pos)) + 'px' }, mo.speed); } } }); }); </script> }}}
#js(){{{ <script type="text/javascript"> // -------------------------------------------------------------------- // ■使い方 // #include(javascript/commentics) ←メニューページでincludeさせるので不要 // #divclass(commentics){タブスタイル,ページ名} //【タブスタイル】は後述のいずれかを指定。サーヴァント、イベント、召喚報告、編集議論、一般 //【ページ名】一意のページ名を指定。@wikiのページ名と同じでOK。ただし@wikiと違ってコメントページ作成後はページ名を変更できない(@wikiのページ名を変えたからこっちも変えようとか駄目絶対) // 例: #divclass(commentics){サーヴァント,アルトリア・ペンドラゴン〔アーチャー〕} // -------------------------------------------------------------------- $(function(){ $('.commentics').each(function() { var tabstyle = ['サーヴァント', 'イベント', '召喚報告', '編集議論', '一般']; var pages = ['servant.php', 'event.php', 'summonreport.php', 'editreport.php', 'general.php']; var commentics_url = 'https://ss1.xrea.com/fgoc.s1006.xrea.com/'; var prm = $.map($(this).children('p:last-child').text().split(','), $.trim); if ($(this).find('iframe').length > 0) { return true; } if (prm.length < 2 || prm[0] === '') { $(this).css('color', 'red').text('[commentics] 引数が足りない!#divclass(commentics){タブスタイル,ページ名);だよ'); return true; } if (tabstyle.indexOf(prm[0]) === -1) { $(this).css('color', 'red').text('[commentics] 第一引数のタブスタイル名が変!後述から選んでね。' + tabstyle.join('、')); return true; } if (prm[1] === '') { $(this).css('color', 'red').text('[commentics] 第二引数のページ名が空!'); return true; } $(this).children('p:last-child').empty(); $(this).css({ 'margin': '0', 'padding': '0', 'border': '0', 'overflow': 'hidden' }); $('<iframe>').attr({ 'src': commentics_url + pages[tabstyle.indexOf(prm[0])] + '?id=' + encodeURIComponent(prm[1]), 'scrolling': 'no', }).css({ 'width': '100%', 'height': '100px', 'border': '0', 'margin': '0', 'padding': '0' }).text('(IFRAME 機能を有効にしてください)').appendTo(this); }); }); $(function() { $(window).on('message', function(event) { // クロスサイトリクエストフォージェリ対策(送信元の検証) if (event.originalEvent.origin !== 'https://ss1.xrea.com') { return; } let mo = event.originalEvent.data, fid = '.commentics iframe'; if (mo && typeof mo === 'object' && 'cmd' in mo) { if (mo.cmd == 'resize') { $(fid).css('height', mo.height+'px'); } else if (mo.cmd == 'move') { $('html, body').animate({ scrollTop: ($(fid).offset().top + parseInt(mo.pos)) + 'px' }, mo.speed); } } }); }); </script> }}}

表示オプション

横に並べて表示:
変化行の前後のみ表示: