Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
49
gaia/shared/js/contacts/utilities/dom.js
Executable file
49
gaia/shared/js/contacts/utilities/dom.js
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
'use strict';
|
||||
|
||||
var utils = window.utils || {};
|
||||
|
||||
if (!utils.dom) {
|
||||
(function(document) {
|
||||
var Dom = utils.dom = {};
|
||||
|
||||
// remove all children of a given parent node
|
||||
Dom.removeChildNodes = function(node) {
|
||||
while (node.hasChildNodes()) {
|
||||
node.removeChild(node.firstChild);
|
||||
}
|
||||
};
|
||||
|
||||
// Given a container, applys the class passed to all the
|
||||
// nodes matching a selector.
|
||||
// CAUTION: Please be careful using this function as it could
|
||||
// be quite expensive depending on the container and selector.
|
||||
Dom.addClassToNodes = function(container, selector, clazz) {
|
||||
var nodes = container.querySelectorAll(selector);
|
||||
for (var i = 0, n = nodes.length; i < n; ++i) {
|
||||
nodes[i].classList.add(clazz);
|
||||
}
|
||||
};
|
||||
|
||||
// Given a container, removes the class passed to all the
|
||||
// nodes matching a selector.
|
||||
// CAUTION: Please be careful using this function as it could
|
||||
// be quite expensive depending on the container and selector.
|
||||
Dom.removeClassFromNodes = function(container, selector, clazz) {
|
||||
var nodes = container.querySelectorAll(selector);
|
||||
for (var i = 0, n = nodes.length; i < n; ++i) {
|
||||
nodes[i].classList.remove(clazz);
|
||||
}
|
||||
};
|
||||
|
||||
Dom.updatePhoto = function(photo, dest) {
|
||||
var background = '';
|
||||
if (photo != null) {
|
||||
background = 'url(' + URL.createObjectURL(photo) + ')';
|
||||
}
|
||||
dest.style.backgroundImage = background;
|
||||
// Only for testing purposes
|
||||
dest.dataset.photoReady = 'true';
|
||||
};
|
||||
|
||||
})(document);
|
||||
}
|
||||
Loading…
Reference in a new issue