| 1 |
/* |
| 2 |
+=====================================================================+ |
| 3 |
| __ ______ _____ | |
| 4 |
| \ \ / / _ \_ _|__ _ __ _ __ ___ | |
| 5 |
| \ \ /\ / /| |_) || |/ _ \ '__| '_ ` _ \ | |
| 6 |
| \ V V / | __/ | | __/ | | | | | | | | |
| 7 |
| \_/\_/ |_| |_|\___|_| |_| |_| |_| | |
| 8 |
| | |
| 9 |
| (c) Jerome Bruandet ~ https://nintechnet.com/ | |
| 10 |
+=====================================================================+ |
| 11 |
*/ |
| 12 |
function wpterm_preview( what, where, newvalue ) { |
| 13 |
|
| 14 |
if ( what == 'color' ) { |
| 15 |
if ( newvalue.match(/^[a-f0-9]+$/) ) { |
| 16 |
newvalue = '#' + newvalue; |
| 17 |
} |
| 18 |
if ( where == 'background' ) { |
| 19 |
document.getElementById('textarea-test').style.backgroundColor = newvalue; |
| 20 |
} else if ( where == 'color' ) { |
| 21 |
document.getElementById('textarea-test').style.color = newvalue; |
| 22 |
} |
| 23 |
|
| 24 |
} else if ( what == 'fontsize' ) { |
| 25 |
if (! newvalue.match(/^(?:9|1[0-9]|20)$/) ) { |
| 26 |
newvalue = '13px'; |
| 27 |
} else { |
| 28 |
newvalue += 'px'; |
| 29 |
} |
| 30 |
document.getElementById('textarea-test').style.fontSize = newvalue; |
| 31 |
|
| 32 |
} else if ( what == 'fontface' ) { |
| 33 |
if ( newvalue.match(/^[a-f0-9]+$/) ) { |
| 34 |
newvalue = 'Consolas,Monaco,monospace'; |
| 35 |
} |
| 36 |
document.getElementById('textarea-test').style.fontFamily = newvalue; |
| 37 |
|
| 38 |
} else if ( what == 'fontweight' ) { |
| 39 |
if ( document.getElementById( where ).checked == true ) { |
| 40 |
newvalue = 'bold'; |
| 41 |
}else{ |
| 42 |
newvalue = 'normal'; |
| 43 |
} |
| 44 |
document.getElementById('textarea-test').style.fontWeight = newvalue; |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
function bell_preview( choice, what ) { |
| 49 |
if ( what == 'beep' ) { |
| 50 |
if ( choice.checked ) { |
| 51 |
// Audible bell (not compatible with IE): |
| 52 |
var snd = new Audio("data:audio/wav;base64,UklGRkgBAABXQVZFZm10IBAAAAABAAEAESsA" + |
| 53 |
"ABErAAABAAgAZGF0YSQBAACBf359cm9rgaB5lQOF/6NVG6Gop49deZGkmF1IkaOhYUSKpoZqTE+c" + |
| 54 |
"op5tUnSNkYZ1gIeOfXt7iIeEd3mDhISCfoF8fYKCgH+HiYV9foWJhn9/gIeGgXx/hYZ+fX6FgH9/" + |
| 55 |
"f3+CgoF7eYKMhn99gYV/fn6FhoF/f399f4OChIF9gYGBe4CDhIN9fn+CgH6AgoSAgICAgIGAf4F/" + |
| 56 |
"f4CBfoB/gIF/gICAgH9+gYGAgIF/gH9+gX9/f4F/gYJ/gH6AgICAf39/f4F/f3+BfoF/gH5/gYB/" + |
| 57 |
"gIF/enl4fH2Bg4aGhYJ/fn9+gYKEg4KAfnx9f4CAg4KBgIB9f4CBg4OCgYGBgICBgYGAgoCAgIB/" + |
| 58 |
"gX+Bf4CAgYCAf4GBgYCBgICBgoGBgIB/"); |
| 59 |
snd.play(); |
| 60 |
} |
| 61 |
} else { |
| 62 |
if ( choice.checked ) { |
| 63 |
jQuery( '#visual-bell' ).addClass( 'error' ); |
| 64 |
} else { |
| 65 |
jQuery( '#visual-bell' ).removeClass( 'error' ); |
| 66 |
} |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
/* ================================================================== */ |
| 71 |
|
| 72 |
function show_license() { |
| 73 |
|
| 74 |
jQuery("#wpterm-license").slideDown(); |
| 75 |
jQuery("#wpterm-license-button").slideUp(); |
| 76 |
|
| 77 |
} |
| 78 |
|
| 79 |
/* ================================================================== */ |
| 80 |
// EOF |
| 81 |
|