「利用者:Dragoniez/scripts/AN Reporter.js」の版間の差分

削除された内容 追加された内容
v7.4.4: modified dragoLib.dialogCSS()
v7.5.0: 定型文をカスタム要約フィールドにコピーする機能を追加 (ANR-R010)
2行目:
* AN Reporter (ANR) *
* Author: Dragoniez *
* Version: 7.45.40 *
************************************/
//<nowiki>
302行目:
'<select id="anr-predefinedreasons-select">' +
'<optgroup style="display: none;">' + // Adjust font size
'<option selected value="">定型文を使用する場合は選択してください</option>' +
'</optgroup>' +
'</select>' +
312行目:
'<div id="anr-summary-div" class="anr-dialog-needmargin">' +
'<input id="anr-summary-checkbox" type="checkbox">' +
'<label for="anr-summary-checkbox">要約にコメントを追加</label><br/>' +
'<input id="anr-summary-copypdreason" type="button" style="display: none; margin: 0.3em 0;" value="定形文をコピー"></input>' +
'<textarea id="anr-summary-text" class="anr-dialog-textarea" rows="3" style="display: none;"></textarea>' +
'</div>' +
603 ⟶ 604行目:
}
}
 
// Show/hide a button in the summary field depending on the value selected in the predefined reasons dropdown
$(document).off('change', '#anr-predefinedreasons-select').on('change', '#anr-predefinedreasons-select', function() {
var selected = $(this).val();
var $btn = $('#anr-summary-copypdreason');
if (selected) {
$btn.css('display', 'inline-block');
} else {
$btn.css('display', 'none');
}
});
 
// Copy the predefined reason into the summary field when the relevant button is clicked
$(document).off('click', '#anr-summary-copypdreason').on('click', '#anr-summary-copypdreason', function() {
var $summary = $('#anr-summary-text'),
selectedVal = $('#anr-predefinedreasons-select').find('option').filter(':selected').val();
$summary.val($summary.val() + selectedVal);
});
 
// Function to check information typed into the form
691 ⟶ 710行目:
 
// The reason of the report
var fixedReason = $('#anr-predefinedreasons-select').find('option').filter(':selected').textval();
fixedReason = fixedReason === '定型文を使用する場合は選択してください' ? '': fixedReason;
var reason = fixedReason + dragoLib.trim2($('#anr-reason-text').val());