MediaWiki:Common.js:修订间差异

Baneq​(留言 | 贡献)
无编辑摘要
Baneq​(留言 | 贡献)
无编辑摘要
第67行: 第67行:
} );
} );


// ===== 🎨 取色按钮(追加,不影响上面的 Noblecraft 格式 booklet)=====
// ===== 🎨 取色按钮 =====
var NC_PALETTE = [
var NC_PALETTE = [
'#c0392b','#d35400','#e67e22','#f1c40f','#27ae60','#16a085','#1a6b7d','#0f4c5c',
'#c0392b','#d35400','#e67e22','#f1c40f','#27ae60','#16a085','#1a6b7d','#0f4c5c',
第74行: 第74行:
var $ncPanel = null;
var $ncPanel = null;
function ncApplyColor( hex ) {
function ncApplyColor( hex ) {
try { localStorage.setItem( 'nc-last-color', hex ); } catch ( e ) {}
$textarea.textSelection( 'encapsulateSelection',
$textarea.textSelection( 'encapsulateSelection',
{ pre: '{{色|' + hex + '|', peri: '文字', post: '}}', selectPeri: true } );
{ pre: '{{色|' + hex + '|', peri: '文字', post: '}}', selectPeri: true } );
第92行: 第93行:
var $row = $( '<div class="nc-colorpop-row">' ).appendTo( $ncPanel );
var $row = $( '<div class="nc-colorpop-row">' ).appendTo( $ncPanel );
$( '<label>自定义</label>' ).appendTo( $row );
$( '<label>自定义</label>' ).appendTo( $row );
var $native = $( '<input type="color" value="#1a6b7d">' ).appendTo( $row );
var lastColor;
try { lastColor = localStorage.getItem( 'nc-last-color' ); } catch ( e ) {}
var $native = $( '<input type="color">' ).val( lastColor || '#1a6b7d' ).appendTo( $row );
$( '<button type="button" class="nc-colorpop-ok">应用</button>' )
$( '<button type="button" class="nc-colorpop-ok">应用</button>' )
.on( 'click', function () { ncApplyColor( $native.val() ); } ).appendTo( $row );
.on( 'click', function () { ncApplyColor( $native.val() ); } ).appendTo( $row );