This commit is contained in:
Lucas Pleß 2012-12-29 00:27:36 +01:00
parent dbddf9af95
commit 39acf97127
5 changed files with 353 additions and 83 deletions

View File

@ -11,24 +11,6 @@
<PyConsoleSettings /> <PyConsoleSettings />
</option> </option>
</component> </component>
<component name="SvnConfiguration" maxAnnotateRevisions="500" myUseAcceleration="nothing" myAutoUpdateAfterCommit="false" cleanupOnStartRun="false">
<option name="USER" value="" />
<option name="PASSWORD" value="" />
<option name="mySSHConnectionTimeout" value="30000" />
<option name="mySSHReadTimeout" value="30000" />
<option name="LAST_MERGED_REVISION" />
<option name="MERGE_DRY_RUN" value="false" />
<option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
<option name="UPDATE_LOCK_ON_DEMAND" value="false" />
<option name="IGNORE_SPACES_IN_MERGE" value="false" />
<option name="DETECT_NESTED_COPIES" value="true" />
<option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
<option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
<option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
<option name="FORCE_UPDATE" value="false" />
<option name="IGNORE_EXTERNALS" value="false" />
<myIsUseDefaultProxy>false</myIsUseDefaultProxy>
</component>
<component name="masterDetails"> <component name="masterDetails">
<states> <states>
<state key="ProjectJDKs.UI"> <state key="ProjectJDKs.UI">

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="" vcs="" /> <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component> </component>
</project> </project>

View File

@ -1,17 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="72d93b4a-de8e-43f1-9d4b-34713e827c14" name="Default" comment=""> <list default="true" id="72d93b4a-de8e-43f1-9d4b-34713e827c14" name="Default" comment="added some logging">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/bootstrap/css/style.css" /> <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/bootstrap/js/html5slider.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/index.html" afterPath="$PROJECT_DIR$/index.html" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/index.html" afterPath="$PROJECT_DIR$/index.html" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/misc.xml" afterPath="$PROJECT_DIR$/.idea/misc.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/vcs.xml" afterPath="$PROJECT_DIR$/.idea/vcs.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
</list> </list>
<ignored path="nodeartnet.iws" /> <ignored path="nodeartnet.iws" />
<ignored path=".idea/workspace.xml" /> <ignored path=".idea/workspace.xml" />
<file path="$PROJECT_DIR$/../hackcentercontrol/app.js" changelist="72d93b4a-de8e-43f1-9d4b-34713e827c14" time="1356729852724" ignored="false" /> <file path="$PROJECT_DIR$/../hackcentercontrol/app.js" changelist="72d93b4a-de8e-43f1-9d4b-34713e827c14" time="1356729852724" ignored="false" />
<file path="/app.js" changelist="72d93b4a-de8e-43f1-9d4b-34713e827c14" time="1356732858583" ignored="false" /> <file path="/app.js" changelist="72d93b4a-de8e-43f1-9d4b-34713e827c14" time="1356736182346" ignored="false" />
<file path="/index.html" changelist="72d93b4a-de8e-43f1-9d4b-34713e827c14" time="1356735773223" ignored="false" /> <file path="/index.html" changelist="72d93b4a-de8e-43f1-9d4b-34713e827c14" time="1356737224079" ignored="false" />
<file path="/Dummy.txt" changelist="72d93b4a-de8e-43f1-9d4b-34713e827c14" time="1356735801846" ignored="false" /> <file path="/Dummy.txt" changelist="72d93b4a-de8e-43f1-9d4b-34713e827c14" time="1356737242714" ignored="false" />
<option name="TRACKING_ENABLED" value="true" /> <option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -71,22 +73,20 @@
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf> <leaf>
<file leaf-file-name="app.js" pinned="false" current="true" current-in-tab="true"> <file leaf-file-name="app.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app.js"> <entry file="file://$PROJECT_DIR$/app.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="15" column="10" selection-start="455" selection-end="455" vertical-scroll-proportion="-0.20357941"> <state line="46" column="20" selection-start="1338" selection-end="1338" vertical-scroll-proportion="0.0">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="index.html" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="index.html" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/index.html"> <entry file="file://$PROJECT_DIR$/index.html">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="197" column="101" selection-start="9117" selection-end="9117" vertical-scroll-proportion="-6.875"> <state line="3" column="39" selection-start="64" selection-end="64" vertical-scroll-proportion="0.10638298">
<folding> <folding />
<element signature="n#style#0;n#br#0;n#body#0;n#html#0;n#!!top" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -120,6 +120,7 @@
<list> <list>
<option value="$PROJECT_DIR$/bootstrap/css/screen.css" /> <option value="$PROJECT_DIR$/bootstrap/css/screen.css" />
<option value="$PROJECT_DIR$/app.js" /> <option value="$PROJECT_DIR$/app.js" />
<option value="$PROJECT_DIR$/bootstrap/css/style.css" />
<option value="$PROJECT_DIR$/index.html" /> <option value="$PROJECT_DIR$/index.html" />
</list> </list>
</option> </option>
@ -240,6 +241,11 @@
<property name="GoToClass.includeLibraries" value="false" /> <property name="GoToClass.includeLibraries" value="false" />
<property name="MemberChooser.copyJavadoc" value="false" /> <property name="MemberChooser.copyJavadoc" value="false" />
</component> </component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/bootstrap/js" />
</key>
</component>
<component name="RunManager"> <component name="RunManager">
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin"> <configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" /> <module name="" />
@ -363,13 +369,22 @@
<created>1356729353747</created> <created>1356729353747</created>
<updated>1356729353747</updated> <updated>1356729353747</updated>
</task> </task>
<task id="LOCAL-00001" summary="included badboys buttons">
<created>1356735847002</created>
<updated>1356735847002</updated>
</task>
<task id="LOCAL-00002" summary="added some logging">
<created>1356736243634</created>
<updated>1356736243634</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers /> <servers />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-4" y="25" width="1608" height="853" extended-state="6" /> <frame x="-4" y="25" width="1608" height="853" extended-state="6" />
<editor active="false" /> <editor active="false" />
<layout> <layout>
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3286119" sideWeight="0.497426" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Changes" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3286119" sideWeight="0.497426" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
@ -377,6 +392,7 @@
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3286119" sideWeight="0.4980695" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3286119" sideWeight="0.4980695" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
@ -396,8 +412,8 @@
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" /> <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" /> <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_NEW_TODO" value="true" /> <option name="CHECK_NEW_TODO" value="false" />
<option name="myTodoPanelSettings"> <option name="myTodoPanelSettings">
<value> <value>
<are-packages-shown value="false" /> <are-packages-shown value="false" />
@ -429,7 +445,7 @@
<option name="MAXIMUM_HISTORY_ROWS" value="1000" /> <option name="MAXIMUM_HISTORY_ROWS" value="1000" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" /> <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" /> <option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
<option name="LAST_COMMIT_MESSAGE" /> <option name="LAST_COMMIT_MESSAGE" value="added some logging" />
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" /> <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="false" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" /> <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" /> <option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
@ -442,6 +458,8 @@
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false" /> <option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" /> <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" /> <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
<MESSAGE value="included badboys buttons" />
<MESSAGE value="added some logging" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager /> <breakpoint-manager />
@ -457,15 +475,15 @@
<entry file="file://$PROJECT_DIR$/index.html"> <entry file="file://$PROJECT_DIR$/index.html">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="24" column="96" selection-start="672" selection-end="672" vertical-scroll-proportion="0.0"> <state line="24" column="96" selection-start="672" selection-end="672" vertical-scroll-proportion="0.0">
<folding> <folding />
<element signature="n#style#0;n#br#0;n#body#0;n#html#0;n#!!top" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/bootstrap/js/jquery-1.8.3.min.js"> <entry file="file://$PROJECT_DIR$/app.js">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" /> <state line="46" column="20" selection-start="1338" selection-end="1338" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/bootstrap/css/style.css"> <entry file="file://$PROJECT_DIR$/bootstrap/css/style.css">
@ -477,16 +495,7 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/index.html"> <entry file="file://$PROJECT_DIR$/index.html">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="197" column="101" selection-start="9117" selection-end="9117" vertical-scroll-proportion="-6.875"> <state line="3" column="39" selection-start="64" selection-end="64" vertical-scroll-proportion="0.10638298">
<folding>
<element signature="n#style#0;n#br#0;n#body#0;n#html#0;n#!!top" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app.js">
<provider selected="true" editor-type-id="text-editor">
<state line="15" column="10" selection-start="455" selection-end="455" vertical-scroll-proportion="-0.20357941">
<folding /> <folding />
</state> </state>
</provider> </provider>

View File

@ -0,0 +1,278 @@
/*
html5slider - a JS implementation of <input type=range> for Firefox 16 and up
https://github.com/fryn/html5slider
Copyright (c) 2010-2012 Frank Yan, <http://frankyan.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
(function() {
// test for native support
var test = document.createElement('input');
try {
test.type = 'range';
if (test.type == 'range')
return;
} catch (e) {
return;
}
// test for required property support
test.style.background = 'linear-gradient(red, red)';
if (!test.style.backgroundImage || !('MozAppearance' in test.style) ||
!document.mozSetImageElement || !this.MutationObserver)
return;
var scale;
var isMac = navigator.platform == 'MacIntel';
var thumb = {
radius: isMac ? 9 : 6,
width: isMac ? 22 : 12,
height: isMac ? 16 : 20
};
var track = 'linear-gradient(transparent ' + (isMac ?
'6px, #999 6px, #999 7px, #ccc 8px, #bbb 9px, #bbb 10px, transparent 10px' :
'9px, #999 9px, #bbb 10px, #fff 11px, transparent 11px') +
', transparent)';
var styles = {
'min-width': thumb.width + 'px',
'min-height': thumb.height + 'px',
'max-height': thumb.height + 'px',
padding: '0 0 ' + (isMac ? '2px' : '1px'),
border: 0,
'border-radius': 0,
cursor: 'default',
'text-indent': '-999999px' // -moz-user-select: none; breaks mouse capture
};
var options = {
attributes: true,
attributeFilter: ['min', 'max', 'step', 'value']
};
var forEach = Array.prototype.forEach;
var onChange = document.createEvent('HTMLEvents');
onChange.initEvent('change', true, false);
if (document.readyState == 'loading')
document.addEventListener('DOMContentLoaded', initialize, true);
else
initialize();
function initialize() {
// create initial sliders
forEach.call(document.querySelectorAll('input[type=range]'), transform);
// create sliders on-the-fly
new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.addedNodes)
forEach.call(mutation.addedNodes, function(node) {
check(node);
if (node.childElementCount)
forEach.call(node.querySelectorAll('input'), check);
});
});
}).observe(document, { childList: true, subtree: true });
}
function check(input) {
if (input.localName == 'input' && input.type != 'range' &&
input.getAttribute('type') == 'range')
transform(input);
}
function transform(slider) {
var isValueSet, areAttrsSet, isChanged, isClick, prevValue, rawValue, prevX;
var min, max, step, range, value = slider.value;
// lazily create shared slider affordance
if (!scale) {
scale = document.body.appendChild(document.createElement('hr'));
style(scale, {
'-moz-appearance': isMac ? 'scale-horizontal' : 'scalethumb-horizontal',
display: 'block',
visibility: 'visible',
opacity: 1,
position: 'fixed',
top: '-999999px'
});
document.mozSetImageElement('__sliderthumb__', scale);
}
// reimplement value and type properties
var getValue = function() { return '' + value; };
var setValue = function setValue(val) {
value = '' + val;
isValueSet = true;
draw();
delete slider.value;
slider.value = value;
slider.__defineGetter__('value', getValue);
slider.__defineSetter__('value', setValue);
};
slider.__defineGetter__('value', getValue);
slider.__defineSetter__('value', setValue);
slider.__defineGetter__('type', function() { return 'range'; });
// sync properties with attributes
['min', 'max', 'step'].forEach(function(prop) {
if (slider.hasAttribute(prop))
areAttrsSet = true;
slider.__defineGetter__(prop, function() {
return this.hasAttribute(prop) ? this.getAttribute(prop) : '';
});
slider.__defineSetter__(prop, function(val) {
val === null ? this.removeAttribute(prop) : this.setAttribute(prop, val);
});
});
// initialize slider
slider.readOnly = true;
style(slider, styles);
update();
new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.attributeName != 'value') {
update();
areAttrsSet = true;
}
// note that value attribute only sets initial value
else if (!isValueSet) {
value = slider.getAttribute('value');
draw();
}
});
}).observe(slider, options);
slider.addEventListener('mousedown', onDragStart, true);
slider.addEventListener('keydown', onKeyDown, true);
slider.addEventListener('focus', onFocus, true);
slider.addEventListener('blur', onBlur, true);
function onDragStart(e) {
isClick = true;
setTimeout(function() { isClick = false; }, 0);
if (e.button || !range)
return;
var width = parseFloat(getComputedStyle(this, 0).width);
var multiplier = (width - thumb.width) / range;
if (!multiplier)
return;
// distance between click and center of thumb
var dev = e.clientX - this.getBoundingClientRect().left - thumb.width / 2 -
(value - min) * multiplier;
// if click was not on thumb, move thumb to click location
if (Math.abs(dev) > thumb.radius) {
isChanged = true;
this.value -= -dev / multiplier;
}
rawValue = value;
prevX = e.clientX;
this.addEventListener('mousemove', onDrag, true);
this.addEventListener('mouseup', onDragEnd, true);
}
function onDrag(e) {
var width = parseFloat(getComputedStyle(this, 0).width);
var multiplier = (width - thumb.width) / range;
if (!multiplier)
return;
rawValue += (e.clientX - prevX) / multiplier;
prevX = e.clientX;
isChanged = true;
this.value = rawValue;
}
function onDragEnd() {
this.removeEventListener('mousemove', onDrag, true);
this.removeEventListener('mouseup', onDragEnd, true);
}
function onKeyDown(e) {
if (e.keyCode > 36 && e.keyCode < 41) { // 37-40: left, up, right, down
onFocus.call(this);
isChanged = true;
this.value = value + (e.keyCode == 38 || e.keyCode == 39 ? step : -step);
}
}
function onFocus() {
if (!isClick)
this.style.boxShadow = !isMac ? '0 0 0 2px #fb0' :
'inset 0 0 20px rgba(0,127,255,.1), 0 0 1px rgba(0,127,255,.4)';
}
function onBlur() {
this.style.boxShadow = '';
}
// determines whether value is valid number in attribute form
function isAttrNum(value) {
return !isNaN(value) && +value == parseFloat(value);
}
// validates min, max, and step attributes and redraws
function update() {
min = isAttrNum(slider.min) ? +slider.min : 0;
max = isAttrNum(slider.max) ? +slider.max : 100;
if (max < min)
max = min > 100 ? min : 100;
step = isAttrNum(slider.step) && slider.step > 0 ? +slider.step : 1;
range = max - min;
draw(true);
}
// recalculates value property
function calc() {
if (!isValueSet && !areAttrsSet)
value = slider.getAttribute('value');
if (!isAttrNum(value))
value = (min + max) / 2;;
// snap to step intervals (WebKit sometimes does not - bug?)
value = Math.round((value - min) / step) * step + min;
if (value < min)
value = min;
else if (value > max)
value = min + ~~(range / step) * step;
}
// renders slider using CSS background ;)
function draw(attrsModified) {
calc();
if (isChanged && value != prevValue)
slider.dispatchEvent(onChange);
isChanged = false;
if (!attrsModified && value == prevValue)
return;
prevValue = value;
var position = range ? (value - min) / range * 100 : 0;
var bg = '-moz-element(#__sliderthumb__) ' + position + '% no-repeat, ';
style(slider, { background: bg + track });
}
}
function style(element, styles) {
for (var prop in styles)
element.style.setProperty(prop, styles[prop], 'important');
}
})();

View File

@ -1,21 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Bootstrap 101 Template</title> <title>Hackcenter Light Control</title>
<!-- Bootstrap --> <!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen"> <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="css/style.css" rel="stylesheet" media="screen"> <link href="css/style.css" rel="stylesheet" media="screen">
<style type="text/css"> <script src="bootstrap/js/jquery-1.8.3.min.js"></script>
body { margin: 20px; }
.kasten {
display:block;
background-color: green;
width: 30%;
height: 100px;
padding: 10px;
}
</style>
<script src="js/jquery-1.8.3.min.js"></script>
</head> </head>
<body> <body>
<div class="container left"> <div class="container left">
@ -71,49 +61,49 @@
</div> </div>
<div class="row"> <div class="row">
<div class="span3"> <div class="span3">
<div class="btn-group wabe-4-1-red" data-channel="/2/multitoggle/1/3"> <div class="btn-group wabe-5-1-red" data-channel="/2/multitoggle/1/3">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
<div class="btn-group wabe-4-1-green" data-channel="/2/multitoggle/2/3"> <div class="btn-group wabe-5-1-green" data-channel="/2/multitoggle/2/3">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
<div class="btn-group wabe-4-1-blue" data-channel="/2/multitoggle/1/4"> <div class="btn-group wabe-5-1-blue" data-channel="/2/multitoggle/1/4">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
</div> </div>
<div class="span3 spansmall"> <div class="span3 spansmall">
<div class="btn-group wabe-2-1-red" data-channel="/2/multitoggle/2/16"> <div class="btn-group wabe-6-1-red" data-channel="/2/multitoggle/2/16">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
</div> </div>
<div class="span3"> <div class="span3">
<div class="btn-group wabe-4-1-red" data-channel="/2/multitoggle/3/3"> <div class="btn-group wabe-7-1-red" data-channel="/2/multitoggle/3/3">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
<div class="btn-group wabe-4-1-green" data-channel="/2/multitoggle/4/3"> <div class="btn-group wabe-7-1-green" data-channel="/2/multitoggle/4/3">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
<div class="btn-group wabe-4-1-blue" data-channel="/2/multitoggle/3/4"> <div class="btn-group wabe-7-1-blue" data-channel="/2/multitoggle/3/4">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
</div> </div>
<div class="span3"> <div class="span3">
<div class="btn-group wabe-4-1-red" data-channel="/2/multitoggle/5/3"> <div class="btn-group wabe-8-1-red" data-channel="/2/multitoggle/5/3">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
<div class="btn-group wabe-4-1-green" data-channel="/2/multitoggle/6/3"> <div class="btn-group wabe-8-1-green" data-channel="/2/multitoggle/6/3">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
<div class="btn-group wabe-4-1-blue" data-channel="/2/multitoggle/5/4"> <div class="btn-group wabe-8-1-blue" data-channel="/2/multitoggle/5/4">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
@ -121,49 +111,49 @@
</div> </div>
<div class="row"> <div class="row">
<div class="span3"> <div class="span3">
<div class="btn-group wabe-4-1-red" data-channel="/2/multitoggle/1/5"> <div class="btn-group wabe-9-1-red" data-channel="/2/multitoggle/1/5">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
<div class="btn-group wabe-4-1-green" data-channel="/2/multitoggle/2/5"> <div class="btn-group wabe-9-1-green" data-channel="/2/multitoggle/2/5">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
<div class="btn-group wabe-4-1-blue" data-channel="/2/multitoggle/1/6"> <div class="btn-group wabe-9-1-blue" data-channel="/2/multitoggle/1/6">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
</div> </div>
<div class="span3 spansmall"> <div class="span3 spansmall">
<div class="btn-group wabe-2-1-red" data-channel="/2/multitoggle/3/16"> <div class="btn-group wabe-10-1-red" data-channel="/2/multitoggle/3/16">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
</div> </div>
<div class="span3"> <div class="span3">
<div class="btn-group wabe-4-1-red" data-channel="/2/multitoggle/3/5"> <div class="btn-group wabe-11-1-red" data-channel="/2/multitoggle/3/5">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
<div class="btn-group wabe-4-1-green" data-channel="/2/multitoggle/4/5"> <div class="btn-group wabe-11-1-green" data-channel="/2/multitoggle/4/5">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
<div class="btn-group wabe-4-1-blue" data-channel="/2/multitoggle/3/6"> <div class="btn-group wabe-11-1-blue" data-channel="/2/multitoggle/3/6">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
</div> </div>
<div class="span3"> <div class="span3">
<div class="btn-group wabe-4-1-red" data-channel="/2/multitoggle/5/5"> <div class="btn-group wabe-12-1-red" data-channel="/2/multitoggle/5/5">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
<div class="btn-group wabe-4-1-green" data-channel="/2/multitoggle/6/5"> <div class="btn-group wabe-12-1-green" data-channel="/2/multitoggle/6/5">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
<div class="btn-group wabe-4-1-blue" data-channel="/2/multitoggle/5/6"> <div class="btn-group wabe-12-1-blue" data-channel="/2/multitoggle/5/6">
<button class="btn btn-success">on</button> <button class="btn btn-success">on</button>
<button class="btn btn-danger">off</button> <button class="btn btn-danger">off</button>
</div> </div>
@ -172,6 +162,7 @@
</div> </div>
</div> </div>
<!--
<div class="container right"> <div class="container right">
<div class="span2"> <div class="span2">
LED LED
@ -183,11 +174,13 @@
</div> </div>
</div> </div>
-->
<!--
<br style="clear: both" /> <br style="clear: both" />
<div class="container bottom"> <div class="container bottom">
<input type="range" name="bottom-slider" id="bottom-slider" min="0" max="100" value="0" /> <input type="range" name="bottom-slider" id="bottom-slider" min="0" max="100" value="0" />
</div> </div> -->
@ -220,9 +213,17 @@
} }
}); });
/*
$(document).delegate('#bottom-slider', 'change', function(event) {
socket.emit('oscmessage', { chan: '/1/fader1', val: })
}); */
}); });
</script> </script>
<script src="js/bootstrap.min.js"></script> <script src="js/bootstrap.min.js"></script>
<script src="js/html5slider.js"></script>
</body> </body>
</html> </html>