summaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js')
-rw-r--r--src/js/app.js29
-rw-r--r--src/js/sliders.js56
2 files changed, 0 insertions, 85 deletions
diff --git a/src/js/app.js b/src/js/app.js
deleted file mode 100644
index 773e5b0..0000000
--- a/src/js/app.js
+++ /dev/null
@@ -1,29 +0,0 @@
-import Mustache from 'mustache';
-import { init as init_sliders } from './sliders';
-
-var template;
-
-function render_sliders(sliders) {
- var sliderContainer = document.getElementById('SliderContainer');
- for( var i=0; i<sliders.length; i++) {
- var node = Mustache.render(template, sliders[i]);
- sliderContainer.innerHTML += node;
- }
-}
-
-export function init() {
- template = document.getElementById('slider-template').innerHTML;
- Mustache.parse(template);
-
- var sliders = [];
- for( var i=0; i<10; i++) {
- sliders.push({
- id: i,
- name: 'Volume '+i,
- value: Math.floor(Math.random()*100)
- });
- }
-
- init_sliders(sliders);
- render_sliders(sliders);
-} \ No newline at end of file
diff --git a/src/js/sliders.js b/src/js/sliders.js
deleted file mode 100644
index 624e8e4..0000000
--- a/src/js/sliders.js
+++ /dev/null
@@ -1,56 +0,0 @@
-this.sliders = {};
-
-function getRootNode(node) {
- while(!node.hasAttribute('slider-id') && node.parentNode) {
- return getRootNode(node.parentNode);
- }
-
- if( node.hasAttribute('slider-id') ) {
- return node;
- } else {
- return false;
- }
-}
-
-function getValue(node) {
- node = getRootNode(node);
- if( node ) {
- return parseInt(node.getAttribute('value'));
- } else {
- return false;
- }
-}
-
-function setValue(node, value) {
- node = getRootNode(node);
- if( node ){
- value = Math.max(Math.min(value, 100), 0);
- node.setAttribute('value', value);
- node.getElementsByTagName('progress')[0].value = value;
- node.getElementsByTagName('input')[0].value = value;
- node.getElementsByClassName('value')[0].innerHTML = value+'%';
- }
-}
-
-function init(sliders) {
- console.log(sliders);
-}
-
-function increase(node) {
- setValue(node, getValue(node)+5);
-}
-
-function decrease(node) {
- setValue(node, getValue(node)-5);
-}
-
-function change(node) {
- setValue(node, node.value);
-}
-
-module.exports = {
- init: init,
- increase: increase,
- decrease: decrease,
- change: change
-} \ No newline at end of file