Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
34 lines
822 B
JavaScript
Executable file
34 lines
822 B
JavaScript
Executable file
/**
|
|
* The template function for generating an UI element for a keyboard object.
|
|
*
|
|
* @module keyboard/keyboard_template
|
|
*/
|
|
define(function(require) {
|
|
'use strict';
|
|
|
|
return function kp_keyboardTemplate(keyboard, recycled) {
|
|
var container = null;
|
|
var a;
|
|
var span;
|
|
if (recycled) {
|
|
container = recycled;
|
|
a = container.querySelector('a');
|
|
span = container.querySelector('span');
|
|
} else {
|
|
container = document.createElement('li');
|
|
a = document.createElement('a');
|
|
span = document.createElement('span');
|
|
|
|
a.href = '#';
|
|
a.className = 'menu-item';
|
|
a.appendChild(span);
|
|
container.appendChild(a);
|
|
}
|
|
|
|
container.onclick = function() {
|
|
keyboard.app.launch();
|
|
};
|
|
span.textContent = keyboard.name;
|
|
return container;
|
|
};
|
|
});
|