-
Notifications
You must be signed in to change notification settings - Fork 723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace label on key #555
Comments
Hi @oz1cz! There are two ways to add an image to the key... (demo) Add a background image to the specific key. In this example, the /* target greek letter alpha */
.ui-keyboard-945 span {
/* keyboard icon used in this example */
background: url(css/images/keyboard.png) center center no-repeat;
display: block;
width: 30px;
/* hide key text */
text-indent: -999em;
}
/* needed for inline image (second method below) */
.ui-keyboard-button {
vertical-align: middle;
} And a second, bit more complex method - I really need to fix it - is to make an action key, then set the I just found out that including // making an action key, it needs an action
$.keyboard.keyaction['β'] = 'β';
$('#keyboard2').keyboard({
layout: 'custom',
customLayout: {
// wrap the key in curly brackets to make it
// an action key
'default': ['α {β}']
},
display: {
// including a colon in the url breaks the image :(
'β': '<img src="css/images/keyboard.png">'
}
}); |
Thank you, @Mottie, the CSS-based solution works very nicely for me! (Using "text-indent: -999em" to hide the original key text was an eye-opener. :-) ) |
Thanks for this. Unfortunately I am not knowledgeable enough to be able to make this work. |
Hi @andrewvharris! Did you look at the demo from my first response? Adding an image in the |
Hello Rob
I did look at the demo, which is exactly what I need but I just don't have a great enough understanding of where the CSS and Script etc should go and how they should be configured to get the working. I am basically trying to make a keyboard with musical notes on that will produce a letter or symbol (£) so that I can use it will ABCJ notation. I am going to need to learn a lot more before I can do it.
Cheers
Andrew
Andrew Harris
…________________________________
From: Rob Garrison <[email protected]>
Sent: 17 April 2018 14:27
To: Mottie/Keyboard
Cc: Andrew Harris; Mention
Subject: Re: [Mottie/Keyboard] Replace label on key (#555)
Hi @andrewvharris<https://github.com/andrewvharris>!
Did you look at the demo from my first response? Adding an image in the display doesn't work correctly, but adding it as a background image in CSS will work. Where are you having issues? If the background image is too big, you may not see it, be sure to include a background-size: cover<https://developer.mozilla.org/en-US/docs/Web/CSS/background-size> to shrink it down.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#555 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AkeVjNiIPZcgCfPlUb28-_cRrGIy2XPlks5tpe26gaJpZM4NKTfH>.
|
Oh, well I think most musical symbols are included within unicode, so all you really would need is the unicode codepoint. If you look in the demo I shared with you through email - copied to jsbin to show all the necessary code in the HTML panel - you'll see If you want to use an image, then I've updated the jsfiddle demo as follows (click the "ABC" button to switch layouts): Script // not really necessary, but changed to a space to not add any content
'default': ' :ABC_Music_Notation' CSS .ui-keyboard-default span {
background-size: cover;
display: inline-block;
width: 20px;
height: 20px;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAA7CAMAAAAO7ilLAAABy1BMVEUAAAAAAADuIiIAAADuIiIAAADuIiLuIiIBAADuIiIAAADuIiLuIiIAAADuIiIAAADuIiIAAADuIiIAAAAAAAAAAAAAAADuIiIAAADuIiIAAADuIiLuIiIAAADuIiLuIiLuIiIAAAAAAAAAAADuIiIAAAAAAAAAAADuIiLuIiIAAAAAAAAAAADuIiLuIiLuIiIAAADuIiIAAADuIiLuIiIAAADuIiLuIiLuIiLuIiLuIiLuIiIAAADuIiLuIiLuIiLuIiLuIiLuIiLuIiLuIiLuIiLuIiIAAAAAAAAAAAAAAADuIiIAAAAAAAAAAADuIiIZGBgAAAAAAAAAAABjDg7uIiI3BwelFxfuIiLOHR3uIiIAAAAKCAgAAADuIiIAAABuEBAAAABDCgosBgYhBQUdBAQAAACDExPBHBzuIiIAAAAaBASfFxfuIiIhBQXuIiIAAADuIiIAAAAEAwMKCgoQEBAHBwcMDAwXFxcVFRUcHBwSEhIhISEeHh4bGxsaGhosLCwpKSkkJCQgICAjBQUUAwMxMTHjICCBEhJECQnoISHWHh7OHR27GhpfDg5eDQ1GRkY5OTndICDGHBywGRmsGRk+GBhmDw9RDAyAXgvIAAAAcXRSTlMAlpa52lAoG+BkJMS7kn9qNhEE8dfRzMm/tbSR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LOg9QbaChHoxDoBgmxN2U0EnZdCOMxhHHqgymt0E1M5E4HalaTFG2zSn909CYSNf5qs2p7W8MajzIFb7zMuSkE8N82o6YfdbZ70Wd1duZHi2BxmNC8gt+l3KUtTn4+vkZzDRd93ktpsWydUY823OAFJaiXzoO8zeojqNt0bYJK2Ng3PuKSPLf5ALns416inXXdOu6mfT6OohkDeTxcp1b+T6LHD0tqubCC9hJJH4ooPmiy/nxZ4YiUv43S8jFZqfACthx2CV9+L2w8OnzDJ39ySclHr2dp47sJW4+ztJP34iiEorhH9y6fnNF2bv3RDCDC+8dpSQapfTSFk/DPfvXB6I4uIIxJ24ZDcAbO3M5F8ySRkhHQaINGq14E/hVU3WUUposlPSB18awaF6R65ZSSk9cKVGot61eEFwT2S9Bn7xjLVbVT9lUK0haShoQshFNk434vF9YNawOLYvsXF0ds1FvgtU6DC2dL0Q1WDUjhmkblI5DIX8B3VQV3a/P30MAAAAASUVORK5CYII=");
} The following background image was reduced in size using https://tinypng.com/ and then converted into a data-uri using http://duri.me/. |
Hello Rob
The link you sent me (http://jsbin.com/pawiyejupi/edit?html,output) looks much more understandable to me and is really helpful so thank you very much for that. I changed the key letters to musical symbols by cutting and pasting in from the Unicode library on Wikipedia. Is it possible to map the output of a key so that for example pressing one that shows [quarter rest] <https://en.wikipedia.org/wiki/File:QuarterRest.svg> on the key will produce "z1" in the textarea?
Thanks again for your help with this, I'm learning fast
Andrew
[http://static.jsbin.com/images/logo.png]<http://jsbin.com/pawiyejupi/edit?html,output>
JS Bin<http://jsbin.com/pawiyejupi/edit?html,output>
jsbin.com
A live pastebin for HTML, CSS & JavaScript and a range of processors, including SCSS, CoffeeScript, Jade and more...
Andrew Harris
…________________________________
From: Rob Garrison <[email protected]>
Sent: 17 April 2018 15:40
To: Mottie/Keyboard
Cc: Andrew Harris; Mention
Subject: Re: [Mottie/Keyboard] Replace label on key (#555)
Oh, well I think most musical symbols are included within unicode<https://en.wiktionary.org/wiki/Appendix:Unicode/Musical_Symbols>, so all you really would need is the unicode codepoint.
If you look in the demo I shared with you through email - copied to jsbin<http://jsbin.com/pawiyejupi/edit?html,output> to show all the necessary code in the HTML panel - you'll see 'default': '\u{1d11e}:ABC_Music_Notation' added to the display setting. The \u{1d11e} portion is adding a "MUSICAL SYMBOL G CLEF"<http://unicode.org/cldr/utility/character.jsp?a=1D11E> to the key using javascript unicode notation<https://mathiasbynens.be/notes/javascript-escapes#unicode-code-point> (\u{xxxx}); the "ABC_Music_Notation" portion becomes the tooltip (hover over the key to see it).
If you want to use an image, then I've updated the jsfiddle demo<http://jsfiddle.net/Mottie/gtemw9y2/7/> as follows:
Script
// not really necessary, but changed to a space to not add any content
'default': ' :ABC_Music_Notation'
CSS
.ui-keyboard-default span {
background-size: cover;
display: inline-block;
width: 20px;
height: 20px;
background-image: url(" data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAA7CAMAAAAO7ilLAAABy1BMVEUAAAAAAADuIiIAAADuIiIAAADuIiLuIiIBAADuIiIAAADuIiLuIiIAAADuIiIAAADuIiIAAADuIiIAAAAAAAAAAAAAAADuIiIAAADuIiIAAADuIiLuIiIAAADuIiLuIiLuIiIAAAAAAAAAAADuIiIAAAAAAAAAAADuIiLuIiIAAAAAAAAAAADuIiLuIiLuIiIAAADuIiIAAADuIiLuIiIAAADuIiLuIiLuIiLuIiLuIiLuIiIAAADuIiLuIiLuIiLuIiLuIiLuIiLuIiLuIiLuIiLuIiIAAAAAAAAAAAAAAADuIiIAAAAAAAAAAADuIiIZGBgAAAAAAAAAAABjDg7uIiI3BwelFxfuIiLOHR3uIiIAAAAKCAgAAADuIiIAAABuEBAAAABDCgosBgYhBQUdBAQAAACDExPBHBzuIiIAAAAaBASfFxfuIiIhBQXuIiIAAADuIiIAAAAEAwMKCgoQEBAHBwcMDAwXFxcVFRUcHBwSEhIhISEeHh4bGxsaGhosLCwpKSkkJCQgICAjBQUUAwMxMTHjICCBEhJECQnoISHWHh7OHR27GhpfDg5eDQ1GRkY5OT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3uW3kLKQhAnY3TE52IBmv16ol60DKI9CpxdbHf8RU9KUz5upDGa/ijFKuFIYaYfpILseR4geOz0B6DQMKsgVbLOg9QbaChHoxDoBgmxN2U0EnZdCOMxhHHqgymt0E1M5E4HalaTFG2zSn909CYSNf5qs2p7W8MajzIFb7zMuSkE8N82o6YfdbZ70Wd1duZHi2BxmNC8gt+l3KUtTn4+vkZzDRd93ktpsWydUY823OAFJaiXzoO8zeojqNt0bYJK2Ng3PuKSPLf5ALns416inXXdOu6mfT6OohkDeTxcp1b+T6LHD0tqubCC9hJJH4ooPmiy/nxZ4YiUv43S8jFZqfACthx2CV9+L2w8OnzDJ39ySclHr2dp47sJW4+ztJP34iiEorhH9y6fnNF2bv3RDCDC+8dpSQapfTSFk/DPfvXB6I4uIIxJ24ZDcAbO3M5F8ySRkhHQaINGq14E/hVU3WUUposlPSB18awaF6R65ZSSk9cKVGot61eEFwT2S9Bn7xjLVbVT9lUK0haShoQshFNk434vF9YNawOLYvsXF0ds1FvgtU6DC2dL0Q1WDUjhmkblI5DIX8B3VQV3a/P30MAAAAASUVORK5CYII=");
}
The following background image was reduced in size using https://tinypng.com/ and then converted into a data-uri using http://duri.me/.
[clef]<https://user-images.githubusercontent.com/136959/38877010-58d817c2-4223-11e8-9de6-f8030b62a8b9.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#555 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AkeVjIvvgM3IDkEGgh9GCipogJH7NXREks5tpf7vgaJpZM4NKTfH>.
|
In this example, we'll add an action key named
$(function() {
$.keyboard.keyaction.halfQuarter = 'z1';
$('#keyboard').keyboard({
layout: 'customLayout',
customLayout: {
'default': [
'{halfQuarter}'
]
},
display: {
'halfQuarter': ' '
}
})
// activate the typing extension
.addTyping({
showTyping: true,
delay: 250
});
}); CSS .ui-keyboard-halfQuarter span {
width: 20px;
height: 20px;
display: inline-block;
background-repeat: no-repeat;
background-position: center center;
background-image: url('data:image/svg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6ICIKICAgICAgICAgc3R5bGU9ImZpbGw6IzAwMDAwMDtmaWxsLW9wYWNpdHk6MSIKICAgICAgICAgaWQ9InBhdGgzMDEwIiAvPgogICAgPC9nPgogIDwvZz4KPC9zdmc+Cg==');
} |
Hello Rob
The example<http://jsfiddle.net/egb3a1sk/4379/> you sent is exactly it. So if I may ask one last (probably pretty dumb question) before I leave you alone and make it work. In order to get this to work I will need to upload and extract all the dependencies from the Mottie Keyboard depository into a directory and then make sure that the html page I generate points to them. The code from each area of the example you linked (the CSS, HTML and Java) then all go in that html page inside the correct tags ?
Thanks for your patience and help. I will be able to achieve what I am now trying to get done thanks to you
All the best
Andrew
Andrew Harris
…________________________________
From: Rob Garrison <[email protected]>
Sent: 18 April 2018 16:41
To: Mottie/Keyboard
Cc: Andrew Harris; Mention
Subject: Re: [Mottie/Keyboard] Replace label on key (#555)
In this example<http://jsfiddle.net/egb3a1sk/4379/>, we'll add an action key named {halfQuarter} (name it anything you want, but use the same name throughout the JavaScript and CSS).
1. First we'll define the key action
2. Then add it to the customLayout as {halfQuarter}
3. Set it's display to a space
4. Define the background image in the css:
* I clicked on the half quarter svg image on the wikipage and was taken to a page with only the svg showing.
* Then go to https://dopiaza.org/tools/datauri/index.php, click on "Retrieve file from a URL" radio option.
* Leave "Use base64 encoding" checked.
* Click on "Generate Data URI".
* Copy the data URI from the resulting input.
* Paste the data URL inside the quotes of background-image: url('') in the CSS
$(function() {
$.keyboard.keyaction.halfQuarter = 'z1';
$('#keyboard').keyboard({
layout: 'customLayout',
customLayout: {
'default': [
'{halfQuarter}'
]
},
display: {
'halfQuarter': ' '
}
})
// activate the typing extension
.addTyping({
showTyping: true,
delay: 250
});
});
CSS
.ui-keyboard-halfQuarter span {
width: 20px;
height: 20px;
display: inline-block;
background-repeat: no-repeat;
background-position: center center;
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+C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hdGgzMDEwIiAvPgogICAgPC9nPgogIDwvZz4KPC9zdmc+Cg==');
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#555 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AkeVjAiaY9Brk2OWrPgXkt2-k3sCUFPnks5tp17CgaJpZM4NKTfH>.
|
Yes. But this is JavaScript. Java is a completely different language. You don't really need to download all the files unless you plan to use it offline; but if you want, the whole package isn't that big. Download the zip file of the current build, extract and save the files to your hard drive somewhere. Then, make sure to point to the necessary files in the HTML. You'd need to repeat this process for any updates. If you're planning on using the files online, then I would recommend pointing the js and css to cdnjs - it's a content delivery network so it will provide the needed files quickly. You'll need to manually change the links for any updates. |
I just made a change, not on the CDN yet, that will allow you to add an display: {
'halfQuarter': '<img src="https://upload.wikimedia.org/wikipedia/commons/0/03/QuarterRest.svg">'
} You'll need to tweak the css a bit to get stuff to line up (demo). Also, I wouldn't recommend using that wikimedia url if you're planning on making the program work offline. |
Version 1.28.2 has been released with this change. It should be available on CDNJS soon. |
It works brilliantly. Thank you so much |
Hello Rob.
I am so very close but have encountered one issue in terms of the keyboard events not being interpreted by the abc notation script. You can see what I mean here
http://truro-penwith.000webhostapp.com/new1.html
As you can see the text box is written into my the keyboard, but the notes dont appear until you either add a letter from the physical keyboard or click with the mouse on the music. I have pasted the html below.
Any ideas?
Thanks
Andrew
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link href='http://fonts.googleapis.com/css?family=Open Sans' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="/abcjs_editor_2.0-min.js" type="text/javascript"></script>
</head>
<body>
<div class="col-sm-1" id="editwindow" style="margin: 0px; white-space: nowrap; min-width:700px;">
<textarea name="keyboard" id="keyboard" rows="20" cols="46" style="padding:5px; margin: 0px;">
X: 1
T: Cooley's
M: 4/4
L: 1/8
R: reel
K: Emin
|ddd|
</textarea>
<span id="paper0"></span>
</div>
<script type="text/javascript">
function do_resize() {
var w = $('#topbar').width();
var e = $('#keyboard').width();
//console.log("w = " + w);
//console.log("e = " + e);
var sw = 700;
var scale = 0.85;
var arealeft = w - e;
console.log("arealeft = " + arealeft);
if (arealeft < 800) {
scale = scale * (arealeft - 50)/ sw;
sw = arealeft - 50;
//console.log("scale = " + scale);
//console.log("sw = " + sw);
}
$('#paperid').width = sw;
abc_editor = new ABCJS.Editor("keyboard", { paper_id: "paper0", midi_id:"midi", warnings_id:"warnings",
render_options: {staffwidth: sw, scale: scale},
midi_options: {program: 2,
qpm: 150, type: "qt"},
gui: false });
$('#paperid').width = sw;
$('#bluebox').width = sw;
};
window.onresize = function(event) {
do_resize();
};
window.onload = function() {
do_resize();
}
</script>
</div>
<div id="wrap">
<textarea id="keyboard"></textarea>
</div>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js"></script>
<script src="https://mottie.github.io/Keyboard/js/jquery.keyboard.js"></script>
<script src="https://mottie.github.io/Keyboard/js/jquery.keyboard.extension-typing.js"></script>
<script>
/* VIRTUAL KEYBOARD DEMO - https://github.com/Mottie/Keyboard */
$(function() {
$('#keyboard').keyboard({
layout: 'custom',
customLayout: {
'default': [
'a b c d e f g #',
'A B C D E F G _',
'7 8 9 ~ = " \' /',
'4 5 6 | [ ] ( )',
'1 2 3 > z , . :',
'0 {space} {meta1} {b} {e}'
],
},
usePreview: false,
autoAccept: true,
display: {
'default': '\u{1d11e}:ABC_Music_Notation',
'meta1': 'ABC:Standard_Keyboard'
}
})
// activate the typing extension
.addTyping({
showTyping: true,
delay: 250
});
});
</script>
</body></html>
Andrew Harris
…________________________________
From: Rob Garrison <[email protected]>
Sent: 19 April 2018 13:58
To: Mottie/Keyboard
Cc: Andrew Harris; Mention
Subject: Re: [Mottie/Keyboard] Replace label on key (#555)
Version 1.28.2 has been released with this change. It should be available on CDNJS soon.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#555 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AkeVjFRjI-DQhRgUi0Tr7xsJX3yjMe7Eks5tqIoNgaJpZM4NKTfH>.
|
Within in the keyboard initialization, add a change: function () {
do_resize();
} |
Thank you very much
Andrew Harris
…________________________________
From: Rob Garrison <[email protected]>
Sent: 20 April 2018 13:57
To: Mottie/Keyboard
Cc: Andrew Harris; Mention
Subject: Re: [Mottie/Keyboard] Replace label on key (#555)
Within in the keyboard initialization, add a change callback<https://github.com/Mottie/Keyboard/wiki/Methods#change> which calls the do_resize() function (demo<https://jsbin.com/nawiqor/edit?html,output>):
change: function () {
do_resize();
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#555 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AkeVjKSRA-1fxqjoBUSkFvouuRoNY1Wwks5tqds8gaJpZM4NKTfH>.
|
Hello Rob
What function creates the text box above the keyboard? I want to turn it of so that the keyboard keeps typing into the original text box.
Many thanks
]Andrew
http://truro-penwith.000webhostapp.com/musickb.html
Andrew Harris
…________________________________
From: Rob Garrison <[email protected]>
Sent: 20 April 2018 13:57
To: Mottie/Keyboard
Cc: Andrew Harris; Mention
Subject: Re: [Mottie/Keyboard] Replace label on key (#555)
Within in the keyboard initialization, add a change callback<https://github.com/Mottie/Keyboard/wiki/Methods#change> which calls the do_resize() function (demo<https://jsbin.com/nawiqor/edit?html,output>):
change: function () {
do_resize();
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#555 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AkeVjKSRA-1fxqjoBUSkFvouuRoNY1Wwks5tqds8gaJpZM4NKTfH>.
|
Set the |
Hello Rob
I thought you might like to see how the music typing is coming together. It is very excitingly working very well. I've just got to figure out now how to take the contents of the text area and compare it against a correct version, which is not something I will bother you with unless you have any genius ideas
Cheers
Andrew
http://truro-penwith.000webhostapp.com/test.html
Andrew Harris
…________________________________
From: Rob Garrison <[email protected]>
Sent: 23 April 2018 16:45
To: Mottie/Keyboard
Cc: Andrew Harris; Mention
Subject: Re: [Mottie/Keyboard] Replace label on key (#555)
Set the usePreview option<https://github.com/Mottie/Keyboard/wiki/Usability#usepreview> to false.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#555 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AkeVjOKn71oAX-clrpnIbzX7O-PSVom2ks5trfcUgaJpZM4NKTfH>.
|
Dear Rob
I am ready to start testing the music resource I have put together using your keyboard and ABC notation.
http://truro-penwith.000webhostapp.com/final.html
I just want to know that as far as I understand in theory I should be able to style the keyboard so that it, in fact, looks like a piano keyboard? It would only be a question of spacing as I could have the top row being the black keys and the one underneath, the white. Is this detailed in the styling part of the Wiki (any help gratefully received)
Thanks and all the best
Andrew
Andrew Harris
…________________________________
From: Andrew Harris
Sent: 01 May 2018 17:00
To: Mottie/Keyboard; Mottie/Keyboard
Cc: Mention
Subject: Mottie Music Keyborad
Hello Rob
I thought you might like to see how the music typing is coming together. It is very excitingly working very well. I've just got to figure out now how to take the contents of the text area and compare it against a correct version, which is not something I will bother you with unless you have any genius ideas
Cheers
Andrew
http://truro-penwith.000webhostapp.com/test.html
Andrew Harris
________________________________
From: Rob Garrison <[email protected]>
Sent: 23 April 2018 16:45
To: Mottie/Keyboard
Cc: Andrew Harris; Mention
Subject: Re: [Mottie/Keyboard] Replace label on key (#555)
Set the usePreview option<https://github.com/Mottie/Keyboard/wiki/Usability#usepreview> to false.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#555 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AkeVjOKn71oAX-clrpnIbzX7O-PSVom2ks5trfcUgaJpZM4NKTfH>.
|
Very nice!
I think you should check out this code which checks and highlights the difference between two strings.
Yes, I have this demo on the wiki page that uses css absolute positioning to position the enter key, but in your case I think you could use the css from beautiful piano - here's a demo - but I'm not sure if you're going to include the black keys? .ui-keyboard-button[class*="-A"],
.ui-keyboard-button[class*="-B"],
.ui-keyboard-button[class*="-C"],
.ui-keyboard-button[class*="-D"],
.ui-keyboard-button[class*="-E"],
.ui-keyboard-button[class*="-F"],
.ui-keyboard-button[class*="-G"] {
background: linear-gradient(-30deg, #f5f5f5, #fff);
box-shadow: inset 0 1px 0px #fff, inset 0 -1px 0px #fff,
inset 1px 0px 0px #fff, inset -1px 0px 0px #fff,
0 4px 3px rgba(0, 0, 0, 0.7);
height: 100px;
position: relative;
margin: 2px 0 6px;
}
.ui-keyboard-button[class*="-A"]:active,
.ui-keyboard-button[class*="-B"]:active,
.ui-keyboard-button[class*="-C"]:active,
.ui-keyboard-button[class*="-D"]:active,
.ui-keyboard-button[class*="-E"]:active,
.ui-keyboard-button[class*="-F"]:active,
.ui-keyboard-button[class*="-G"]:active {
-webkit-box-shadow: 0 2px 2px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0 2px 2px rgba(0, 0, 0, 0.4);
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.4);
position: relative;
top: 2px;
}
.ui-keyboard-button[class*="-A"]:active:before,
.ui-keyboard-button[class*="-B"]:active:before,
.ui-keyboard-button[class*="-C"]:active:before,
.ui-keyboard-button[class*="-D"]:active:before,
.ui-keyboard-button[class*="-E"]:active:before,
.ui-keyboard-button[class*="-F"]:active:before,
.ui-keyboard-button[class*="-G"]:active:before {
content: "";
width: 0px;
height: 0px;
border-width: 216px 5px 0px;
border-style: solid;
border-color: transparent transparent transparent rgba(0, 0, 0, 0.1);
position: absolute;
left: 0px;
top: 0px;
}
.ui-keyboard-button[class*="-A"]:active:after,
.ui-keyboard-button[class*="-B"]:active:after,
.ui-keyboard-button[class*="-C"]:active:after,
.ui-keyboard-button[class*="-D"]:active:after,
.ui-keyboard-button[class*="-E"]:active:after,
.ui-keyboard-button[class*="-F"]:active:after,
.ui-keyboard-button[class*="-G"]:active:after {
content: "";
width: 0px;
height: 0px;
border-width: 216px 5px 0px;
border-style: solid;
border-color: transparent rgba(0, 0, 0, 0.1) transparent transparent;
position: absolute;
right: 0px;
top: 0px;
} I also cleaned up the |
Also, have you seen this pianoKeyboard library? It doesn't looks like it works with ABC notation, but it looks nice. 😸 |
Dear Rob
I think I am there. I have it how I want it and am testing it on my students now. Thanks again for all your help and when it goes live I will of course credit you on each page.
All the best
Andrew
http://truro-penwith.000webhostapp.com/finaltest.html
Andrew Harris
…________________________________
From: Andrew Harris
Sent: 08 June 2018 14:18
To: Mottie/Keyboard; Mottie/Keyboard
Cc: Mention
Subject: Re: Mottie Music Keyborad
Dear Rob
I am ready to start testing the music resource I have put together using your keyboard and ABC notation.
http://truro-penwith.000webhostapp.com/final.html
I just want to know that as far as I understand in theory I should be able to style the keyboard so that it, in fact, looks like a piano keyboard? It would only be a question of spacing as I could have the top row being the black keys and the one underneath, the white. Is this detailed in the styling part of the Wiki (any help gratefully received)
Thanks and all the best
Andrew
Andrew Harris
________________________________
From: Andrew Harris
Sent: 01 May 2018 17:00
To: Mottie/Keyboard; Mottie/Keyboard
Cc: Mention
Subject: Mottie Music Keyborad
Hello Rob
I thought you might like to see how the music typing is coming together. It is very excitingly working very well. I've just got to figure out now how to take the contents of the text area and compare it against a correct version, which is not something I will bother you with unless you have any genius ideas
Cheers
Andrew
http://truro-penwith.000webhostapp.com/test.html
Andrew Harris
________________________________
From: Rob Garrison <[email protected]>
Sent: 23 April 2018 16:45
To: Mottie/Keyboard
Cc: Andrew Harris; Mention
Subject: Re: [Mottie/Keyboard] Replace label on key (#555)
Set the usePreview option<https://github.com/Mottie/Keyboard/wiki/Usability#usepreview> to false.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#555 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AkeVjOKn71oAX-clrpnIbzX7O-PSVom2ks5trfcUgaJpZM4NKTfH>.
|
Hello again
Just one thing I thought. If I could format the black keys to be black with css (and white text) then I wouldn't have to use any images and could map specific keystokes which would be more logical. Is that possible?
Andrew
Andrew Harris
|
I figured it out!
Andrew Harris
|
Oh? I was going to say yes, it is possible... but my OCD kicked in and I started working on it LOL |
I used this
.ui-keyboard button.ui-keyboard-clear {
background: #f58400;
color: #fff;
}
Many thank yous
Andrew Harris
…________________________________
From: Rob Garrison <[email protected]>
Sent: 14 June 2018 15:52
To: Mottie/Keyboard
Cc: Andrew Harris; Mention
Subject: Re: [Mottie/Keyboard] Replace label on key (#555)
Oh? I was going to say yes, it is possible... but my OCD kicked in and I started working on it LOL
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#555 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AkeVjJKr5rtc4Esi9yWa_6GDAkcS6Dfzks5t8niwgaJpZM4NKTfH>.
|
What about something like this? demo |
Oops, I forgot to fix the shifted keyset to make flats... but I think you get the idea. |
It is a thing of beauty. I will use it thank you!
Andrew
Andrew Harris
…________________________________
From: Rob Garrison <[email protected]>
Sent: 14 June 2018 16:03
To: Mottie/Keyboard
Cc: Andrew Harris; Mention
Subject: Re: [Mottie/Keyboard] Replace label on key (#555)
Oops, I forgot to fix the shifted keyset to make flats... but I think you get the idea.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#555 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AkeVjGQmIOSxf4QHo3qsc-2F9Dy5BpA5ks5t8ns4gaJpZM4NKTfH>.
|
LOL, and here's one with the black keys overlapping the white... demo. |
Even more genius! I cant get my images to load though?
Andrew Harris
…________________________________
From: Rob Garrison <[email protected]>
Sent: 14 June 2018 16:38
To: Mottie/Keyboard
Cc: Andrew Harris; Mention
Subject: Re: [Mottie/Keyboard] Replace label on key (#555)
LOL, and here's one with the black keys overlapping the white... demo<https://jsfiddle.net/4vg1f58k/40/>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#555 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AkeVjGlagqMCi2jGRipN1pAEdjUTwVbvks5t8oN0gaJpZM4NKTfH>.
|
The demo is using the relative urls copied from the finaltest demo... I didn't bother changing them. It shouldn't alter the look on your web site. |
Sorry that was a dumb question about the images...they all good now as is shift etc. I think I'm going to stick with this layout
http://truro-penwith.000webhostapp.com/finaltest.html
I notice that the Macs at work using Chrome and Safari show the layout a bit out of alignment but nothing worth worrying about, its probably because they are old browsers.
The students are now Beta testing for me and I am going to make a whole bunch of new tests so Ill let you know how it goes
Thanks again for all the help, it has been exceptional.
Andrew
Andrew Harris
…________________________________
From: Rob Garrison <[email protected]>
Sent: 14 June 2018 16:59
To: Mottie/Keyboard
Cc: Andrew Harris; Mention
Subject: Re: [Mottie/Keyboard] Replace label on key (#555)
The demo is using the relative urls copied from the finaltest demo... I didn't bother changing them. It shouldn't alter the look on your web site.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#555 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AkeVjL8zZEV18SmEwTQzwO-GPag3ygI9ks5t8oh2gaJpZM4NKTfH>.
|
Is there any way to replace the label on a character key with an image?
I'm trying to create a classical Hebrew keyboard, and some of the vowel characters are so small that they are almost impossible to view in any reasonable font size. So for some of those characters, I would like to display a small image on the key button instead of the actual character.
Is this possible with the current code?
The text was updated successfully, but these errors were encountered: