利用者:Jms/monobook.js

checkEnter = function( e ) {
    var code;
 
    if( e.which ){
        code = e.which;
    }else if( e.keyCode ){
        code = e.keyCode
    }else{
        code = window.event.keyCode; 
    }
 
    if( code == 13 ){
        document.getElementById('wpPreview').click();
        return false;
    }
}
 
function summaryEnterPreview(){
    var summary = document.getElementById('wpSummary');
    var saveButton = document.getElementById('wpSave');
    var previewButton = document.getElementById('wpPreview');
    var diffButton = document.getElementById('wpDiff');

    if(summary != null){
        previewButton.style.fontWeight = 'bold';
        saveButton.style.fontWeight = 'normal';
        addHandler(summary, 'keypress', checkEnter);
    }
}
 
if( wgAction == 'edit' || wgAction == 'submit'){
    addOnloadHook(summaryEnterPreview);
}