"대문"의 두 판 사이의 차이
4번째 줄: | 4번째 줄: | ||
===[[불교사]]=== | ===[[불교사]]=== | ||
+ | function fixCompare() { | ||
+ | var $histForm = $('#mw-history-compare'), | ||
+ | $diffList = $('#pagehistory'), | ||
+ | $buttons = $histForm.find('input.historysubmit'), | ||
+ | buttonText, $compareLink; | ||
+ | if ( $buttons.length === 0 ) { | ||
+ | // Only one version, so do nothing | ||
+ | return; | ||
+ | } | ||
+ | buttonText = $buttons | ||
+ | .remove() | ||
+ | .first().val(); | ||
+ | $compareLink = $('<a></a>', { | ||
+ | 'class': 'compare-link', | ||
+ | 'text': buttonText | ||
+ | }); | ||
+ | $histForm | ||
+ | .prepend($compareLink) | ||
+ | .append($compareLink.clone()); | ||
+ | var updateCompare = function(){ | ||
+ | var $radio = $histForm.find('input[type=radio]:checked'), | ||
+ | genLink = mw.config.get('wgScript') | ||
+ | + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) ) | ||
+ | + '&diff=' + $radio.eq(0).val() | ||
+ | + '&oldid=' + $radio.eq(1).val(); | ||
+ | $('.compare-link').each(function() { | ||
+ | $(this).attr('href', genLink); | ||
+ | }); | ||
+ | }; | ||
+ | updateCompare(); | ||
+ | $diffList.change(updateCompare); | ||
+ | } | ||
+ | |||
+ | if ( mw.config.get('wgAction') === 'history' ) { | ||
+ | mw.util.addCSS( '.compare-link { border-radius:5px; color:black; text-decoration:none; border-width:1px 2px 2px 1px; border-style:solid; border-color:#DDDDDD #BBBBBB #BBBBBB #DDDDDD; padding:0.2em 1em; background-color:#EEEEEE; white-space:nowrap; } .compare-link:active{ border-width:0.1em; margin:0.1em; }' ); | ||
+ | $(fixCompare); | ||
+ | } | ||
== 시작하기 == | == 시작하기 == |
2017년 7월 12일 (수) 17:07 판
공부
불교
불교사
function fixCompare() { var $histForm = $('#mw-history-compare'), $diffList = $('#pagehistory'), $buttons = $histForm.find('input.historysubmit'), buttonText, $compareLink; if ( $buttons.length === 0 ) { // Only one version, so do nothing return; }
buttonText = $buttons
.remove() .first().val(); $compareLink = $('<a></a>', { 'class': 'compare-link', 'text': buttonText }); $histForm .prepend($compareLink) .append($compareLink.clone()); var updateCompare = function(){ var $radio = $histForm.find('input[type=radio]:checked'), genLink = mw.config.get('wgScript') + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) ) + '&diff=' + $radio.eq(0).val() + '&oldid=' + $radio.eq(1).val(); $('.compare-link').each(function() { $(this).attr('href', genLink); }); }; updateCompare(); $diffList.change(updateCompare); }
if ( mw.config.get('wgAction') === 'history' ) { mw.util.addCSS( '.compare-link { border-radius:5px; color:black; text-decoration:none; border-width:1px 2px 2px 1px; border-style:solid; border-color:#DDDDDD #BBBBBB #BBBBBB #DDDDDD; padding:0.2em 1em; background-color:#EEEEEE; white-space:nowrap; } .compare-link:active{ border-width:0.1em; margin:0.1em; }' ); $(fixCompare); }