smparkes-envjs 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/envjsrb +157 -73
- data/bin/jquery-1.3.2-test.js +11 -4
- data/lib/envjs/env.js +935 -11028
- data/lib/envjs/net/cgi.rb +94 -0
- data/lib/envjs/net/file.rb +4 -4
- data/lib/envjs/runtime.rb +80 -24
- data/test/call-load-test.js +0 -2
- data/test/firebug/errorIcon.png +0 -0
- data/test/firebug/firebug.css +209 -0
- data/test/firebug/firebug.html +23 -0
- data/test/firebug/firebug.js +672 -0
- data/test/firebug/firebugx.js +10 -0
- data/test/firebug/infoIcon.png +0 -0
- data/test/firebug/warningIcon.png +0 -0
- data/test/fixtures/html/events.html +171 -0
- data/test/fixtures/html/iframe1.html +46 -0
- data/test/fixtures/html/iframe1a.html +46 -0
- data/test/fixtures/html/iframe2.html +45 -0
- data/test/fixtures/html/iframe3.html +28 -0
- data/test/fixtures/html/iframeN.html +57 -0
- data/test/fixtures/html/malformed.html +181 -0
- data/test/fixtures/html/scope.html +81 -0
- data/test/fixtures/html/trivial.html +19 -0
- data/test/fixtures/html/with_js.html +26 -0
- data/test/fixtures/images/icon-blue.png +0 -0
- data/test/fixtures/js/external_script.js +1 -0
- data/test/fixtures/js/script.js +1 -0
- data/test/fixtures/js/script_error.js +2 -0
- data/test/html/malformed.html +1 -0
- data/test/index.html +21 -19
- data/test/{primaryTests.js → primary-tests.js} +1 -3
- data/test/{prototype.js → prototype-test.js} +0 -2
- data/test/qunit/qunit/qunit.css +0 -0
- data/test/qunit/qunit/qunit.js +2 -2
- data/test/{qunit/qunit/qunit.js.smp → specs/dist/env.spec.js} +539 -7
- data/test/specs/envjs.spec.css +46 -0
- data/test/specs/parser/html.js +31 -0
- data/test/specs/parser/spec.html +40 -0
- data/test/specs/parser/xml.js +31 -0
- data/test/specs/qunit.bdd.js +210 -0
- data/test/{qunit.smp/qunit → specs}/qunit.css +0 -0
- data/test/{qunit.smp/qunit → specs}/qunit.js +2 -2
- data/test/specs/template/spec-0.js +31 -0
- data/test/specs/template/spec-1.js +31 -0
- data/test/specs/template/spec.html +40 -0
- data/test/specs/window/css.js +23 -0
- data/test/specs/window/dialog.js +25 -0
- data/test/specs/window/document.js +23 -0
- data/test/specs/window/event.js +25 -0
- data/test/specs/window/history.js +34 -0
- data/test/specs/window/location.js +34 -0
- data/test/specs/window/navigator.js +71 -0
- data/test/specs/window/screen.js +42 -0
- data/test/specs/window/spec.html +48 -0
- data/test/specs/window/timer.js +26 -0
- data/test/specs/window/window.js +53 -0
- data/test/specs/xhr/spec.html +47 -0
- data/test/specs/xhr/xhr.js +31 -0
- data/test/test.js +10 -0
- data/test/unit/elementmembers.js +31 -0
- data/test/unit/nu.validator.js +34 -0
- data/test/unit/onload.js +1 -3
- data/test/unit/parser.js +106 -98
- data/test/unit/prototypecompat.js +2 -2
- data/test/vendor/jQuery/1.3.2/ChangeLog.txt +98 -0
- data/test/vendor/jQuery/1.3.2/GPL-LICENSE.txt +278 -0
- data/test/vendor/jQuery/1.3.2/MIT-LICENSE.txt +20 -0
- data/test/vendor/jQuery/1.3.2/Makefile +154 -0
- data/test/vendor/jQuery/1.3.2/README +67 -0
- data/test/vendor/jQuery/1.3.2/build/ant-contrib-0.6.jar +0 -0
- data/test/vendor/jQuery/1.3.2/build/build/min.js +11 -0
- data/test/vendor/jQuery/1.3.2/build/build/pack.js +19 -0
- data/test/vendor/jQuery/1.3.2/build/js/Packer.js +209 -0
- data/test/vendor/jQuery/1.3.2/build/js/ParseMaster.js +106 -0
- data/test/vendor/jQuery/1.3.2/build/js/Words.js +62 -0
- data/test/vendor/jQuery/1.3.2/build/js/base2.js +978 -0
- data/test/vendor/jQuery/1.3.2/build/js/jsmin.js +316 -0
- data/test/vendor/jQuery/1.3.2/build/js/json.js +117 -0
- data/test/vendor/jQuery/1.3.2/build/js/pack.js +316 -0
- data/test/vendor/jQuery/1.3.2/build/js/parse.js +105 -0
- data/test/vendor/jQuery/1.3.2/build/js/writeFile.js +19 -0
- data/test/vendor/jQuery/1.3.2/build/js/xml.js +25 -0
- data/test/vendor/jQuery/1.3.2/build/js.jar +0 -0
- data/test/vendor/jQuery/1.3.2/build/runtest/env.js +1 -0
- data/test/vendor/jQuery/1.3.2/build/runtest/test.js +106 -0
- data/test/vendor/jQuery/1.3.2/build/runtest/testrunner.js +197 -0
- data/test/vendor/jQuery/1.3.2/build/speed/benchmarker.css +65 -0
- data/test/vendor/jQuery/1.3.2/build/speed/benchmarker.js +181 -0
- data/test/vendor/jQuery/1.3.2/build/speed/index.html +72 -0
- data/test/vendor/jQuery/1.3.2/build/speed/jquery-basis.js +3549 -0
- data/test/vendor/jQuery/1.3.2/build/style.xsl +99 -0
- data/test/vendor/jQuery/1.3.2/build/yuicompressor-2.4.2.jar +0 -0
- data/test/vendor/jQuery/1.3.2/build.xml +123 -0
- data/test/vendor/jQuery/1.3.2/dist/jquery.js +4376 -0
- data/test/vendor/jQuery/1.3.2/reminder.txt +3 -0
- data/test/vendor/jQuery/1.3.2/src/ajax.js +541 -0
- data/test/vendor/jQuery/1.3.2/src/core.js +1255 -0
- data/test/vendor/jQuery/1.3.2/src/data.js +145 -0
- data/test/vendor/jQuery/1.3.2/src/dimensions.js +49 -0
- data/test/vendor/jQuery/1.3.2/src/event.js +684 -0
- data/test/vendor/jQuery/1.3.2/src/fx.js +407 -0
- data/test/vendor/jQuery/1.3.2/src/intro.js +13 -0
- data/test/vendor/jQuery/1.3.2/src/offset.js +155 -0
- data/test/vendor/jQuery/1.3.2/src/outro.js +1 -0
- data/test/vendor/jQuery/1.3.2/src/selector.js +1015 -0
- data/test/vendor/jQuery/1.3.2/src/support.js +112 -0
- data/test/vendor/jQuery/1.3.2/test/data/cow.jpg +0 -0
- data/test/vendor/jQuery/1.3.2/test/data/dashboard.xml +11 -0
- data/test/vendor/jQuery/1.3.2/test/data/echoQuery.php +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/iframe.html +8 -0
- data/test/vendor/jQuery/1.3.2/test/data/json.php +9 -0
- data/test/vendor/jQuery/1.3.2/test/data/json_assigned_obj.js +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/json_obj.js +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/jsonp.php +10 -0
- data/test/vendor/jQuery/1.3.2/test/data/name.html +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/name.php +29 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/absolute.html +39 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/body.html +24 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/fixed.html +33 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/relative.html +31 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/scroll.html +39 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/static.html +31 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/table.html +43 -0
- data/test/vendor/jQuery/1.3.2/test/data/params_html.php +12 -0
- data/test/vendor/jQuery/1.3.2/test/data/test.html +7 -0
- data/test/vendor/jQuery/1.3.2/test/data/test.js +3 -0
- data/test/vendor/jQuery/1.3.2/test/data/test.php +7 -0
- data/test/vendor/jQuery/1.3.2/test/data/test2.html +5 -0
- data/test/vendor/jQuery/1.3.2/test/data/test3.html +3 -0
- data/test/vendor/jQuery/1.3.2/test/data/testrunner.js +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/text.php +12 -0
- data/test/vendor/jQuery/1.3.2/test/data/with_fries.xml +25 -0
- data/test/vendor/jQuery/1.3.2/test/index.html +229 -0
- data/test/vendor/jQuery/1.3.2/test/jqenv-1259090275493.html +247 -0
- data/test/vendor/jQuery/1.3.2/test/jqenv-1259091671501.html +247 -0
- data/test/vendor/jQuery/1.3.2/test/jqenv-1259175319655.html +247 -0
- data/test/vendor/jQuery/1.3.2/test/offset.html +28 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/jquery/1.2.1/jquery.js +11 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/jquery/1.2.3/jquery.js +11 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/mootools/1.11/mootools.js +1577 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/prototype/1.6.0.2/prototype.js +4221 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/builder.js +131 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/controls.js +835 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/dragdrop.js +944 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/effects.js +1090 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/scriptaculous.js +51 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/slider.js +278 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/unittest.js +564 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/builder.js +136 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/controls.js +965 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/dragdrop.js +974 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/effects.js +1122 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/scriptaculous.js +58 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/slider.js +275 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/sound.js +55 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/unittest.js +568 -0
- data/test/vendor/jQuery/1.3.2/test/polluted.php +64 -0
- data/test/vendor/jQuery/1.3.2/test/qunit/testrunner.js +780 -0
- data/test/vendor/jQuery/1.3.2/test/qunit/testsuite.css +120 -0
- data/test/vendor/jQuery/1.3.2/test/test.js +41 -0
- data/test/vendor/jQuery/1.3.2/test/unit/ajax.js +856 -0
- data/test/vendor/jQuery/1.3.2/test/unit/core.js +1872 -0
- data/test/vendor/jQuery/1.3.2/test/unit/data.js +160 -0
- data/test/vendor/jQuery/1.3.2/test/unit/dimensions.js +86 -0
- data/test/vendor/jQuery/1.3.2/test/unit/event.js +670 -0
- data/test/vendor/jQuery/1.3.2/test/unit/fx.js +451 -0
- data/test/vendor/jQuery/1.3.2/test/unit/offset.js +173 -0
- data/test/vendor/jQuery/1.3.2/test/unit/selector.js +395 -0
- data/test/vendor/jQuery/1.3.2/test/xhtml.php +5 -0
- data/test/vendor/jQuery/1.3.2/version.txt +1 -0
- metadata +158 -22
- data/lib/envjs/runtime.rb.smp +0 -133
- data/test/envjs-call-load-test.js +0 -5
- data/test/envjs-prototype.js +0 -5
- data/test/qunit/package.json +0 -21
- data/test/qunit/test/index.html +0 -17
- data/test/qunit/test/same.js +0 -1368
- data/test/qunit/test/test.js +0 -136
- data/test/qunit.smp/package.json +0 -21
- data/test/qunit.smp/test/index.html +0 -17
- data/test/qunit.smp/test/same.js +0 -1368
- data/test/qunit.smp/test/test.js +0 -136
- data/test/rhino-call-load-test.js +0 -5
- data/test/rhino-prototype.js +0 -5
- data/test/test-with-envs-jar.js +0 -8
- data/test/test-with-rhino-jar.js +0 -9
@@ -0,0 +1,58 @@
|
|
1
|
+
// script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
2
|
+
|
3
|
+
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
4
|
+
//
|
5
|
+
// Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
// a copy of this software and associated documentation files (the
|
7
|
+
// "Software"), to deal in the Software without restriction, including
|
8
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
// distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
// permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
// the following conditions:
|
12
|
+
//
|
13
|
+
// The above copyright notice and this permission notice shall be
|
14
|
+
// included in all copies or substantial portions of the Software.
|
15
|
+
//
|
16
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
//
|
24
|
+
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
25
|
+
|
26
|
+
var Scriptaculous = {
|
27
|
+
Version: '1.8.1',
|
28
|
+
require: function(libraryName) {
|
29
|
+
// inserting via DOM fails in Safari 2.0, so brute force approach
|
30
|
+
document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
|
31
|
+
},
|
32
|
+
REQUIRED_PROTOTYPE: '1.6.0',
|
33
|
+
load: function() {
|
34
|
+
function convertVersionString(versionString){
|
35
|
+
var r = versionString.split('.');
|
36
|
+
return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
|
37
|
+
}
|
38
|
+
|
39
|
+
if((typeof Prototype=='undefined') ||
|
40
|
+
(typeof Element == 'undefined') ||
|
41
|
+
(typeof Element.Methods=='undefined') ||
|
42
|
+
(convertVersionString(Prototype.Version) <
|
43
|
+
convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
|
44
|
+
throw("script.aculo.us requires the Prototype JavaScript framework >= " +
|
45
|
+
Scriptaculous.REQUIRED_PROTOTYPE);
|
46
|
+
|
47
|
+
$A(document.getElementsByTagName("script")).findAll( function(s) {
|
48
|
+
return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
|
49
|
+
}).each( function(s) {
|
50
|
+
var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
|
51
|
+
var includes = s.src.match(/\?.*load=([a-z,]*)/);
|
52
|
+
(includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
|
53
|
+
function(include) { Scriptaculous.require(path+include+'.js') });
|
54
|
+
});
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
Scriptaculous.load();
|
@@ -0,0 +1,275 @@
|
|
1
|
+
// script.aculo.us slider.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
2
|
+
|
3
|
+
// Copyright (c) 2005-2007 Marty Haught, Thomas Fuchs
|
4
|
+
//
|
5
|
+
// script.aculo.us is freely distributable under the terms of an MIT-style license.
|
6
|
+
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
7
|
+
|
8
|
+
if (!Control) var Control = { };
|
9
|
+
|
10
|
+
// options:
|
11
|
+
// axis: 'vertical', or 'horizontal' (default)
|
12
|
+
//
|
13
|
+
// callbacks:
|
14
|
+
// onChange(value)
|
15
|
+
// onSlide(value)
|
16
|
+
Control.Slider = Class.create({
|
17
|
+
initialize: function(handle, track, options) {
|
18
|
+
var slider = this;
|
19
|
+
|
20
|
+
if (Object.isArray(handle)) {
|
21
|
+
this.handles = handle.collect( function(e) { return $(e) });
|
22
|
+
} else {
|
23
|
+
this.handles = [$(handle)];
|
24
|
+
}
|
25
|
+
|
26
|
+
this.track = $(track);
|
27
|
+
this.options = options || { };
|
28
|
+
|
29
|
+
this.axis = this.options.axis || 'horizontal';
|
30
|
+
this.increment = this.options.increment || 1;
|
31
|
+
this.step = parseInt(this.options.step || '1');
|
32
|
+
this.range = this.options.range || $R(0,1);
|
33
|
+
|
34
|
+
this.value = 0; // assure backwards compat
|
35
|
+
this.values = this.handles.map( function() { return 0 });
|
36
|
+
this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false;
|
37
|
+
this.options.startSpan = $(this.options.startSpan || null);
|
38
|
+
this.options.endSpan = $(this.options.endSpan || null);
|
39
|
+
|
40
|
+
this.restricted = this.options.restricted || false;
|
41
|
+
|
42
|
+
this.maximum = this.options.maximum || this.range.end;
|
43
|
+
this.minimum = this.options.minimum || this.range.start;
|
44
|
+
|
45
|
+
// Will be used to align the handle onto the track, if necessary
|
46
|
+
this.alignX = parseInt(this.options.alignX || '0');
|
47
|
+
this.alignY = parseInt(this.options.alignY || '0');
|
48
|
+
|
49
|
+
this.trackLength = this.maximumOffset() - this.minimumOffset();
|
50
|
+
|
51
|
+
this.handleLength = this.isVertical() ?
|
52
|
+
(this.handles[0].offsetHeight != 0 ?
|
53
|
+
this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) :
|
54
|
+
(this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth :
|
55
|
+
this.handles[0].style.width.replace(/px$/,""));
|
56
|
+
|
57
|
+
this.active = false;
|
58
|
+
this.dragging = false;
|
59
|
+
this.disabled = false;
|
60
|
+
|
61
|
+
if (this.options.disabled) this.setDisabled();
|
62
|
+
|
63
|
+
// Allowed values array
|
64
|
+
this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false;
|
65
|
+
if (this.allowedValues) {
|
66
|
+
this.minimum = this.allowedValues.min();
|
67
|
+
this.maximum = this.allowedValues.max();
|
68
|
+
}
|
69
|
+
|
70
|
+
this.eventMouseDown = this.startDrag.bindAsEventListener(this);
|
71
|
+
this.eventMouseUp = this.endDrag.bindAsEventListener(this);
|
72
|
+
this.eventMouseMove = this.update.bindAsEventListener(this);
|
73
|
+
|
74
|
+
// Initialize handles in reverse (make sure first handle is active)
|
75
|
+
this.handles.each( function(h,i) {
|
76
|
+
i = slider.handles.length-1-i;
|
77
|
+
slider.setValue(parseFloat(
|
78
|
+
(Object.isArray(slider.options.sliderValue) ?
|
79
|
+
slider.options.sliderValue[i] : slider.options.sliderValue) ||
|
80
|
+
slider.range.start), i);
|
81
|
+
h.makePositioned().observe("mousedown", slider.eventMouseDown);
|
82
|
+
});
|
83
|
+
|
84
|
+
this.track.observe("mousedown", this.eventMouseDown);
|
85
|
+
document.observe("mouseup", this.eventMouseUp);
|
86
|
+
document.observe("mousemove", this.eventMouseMove);
|
87
|
+
|
88
|
+
this.initialized = true;
|
89
|
+
},
|
90
|
+
dispose: function() {
|
91
|
+
var slider = this;
|
92
|
+
Event.stopObserving(this.track, "mousedown", this.eventMouseDown);
|
93
|
+
Event.stopObserving(document, "mouseup", this.eventMouseUp);
|
94
|
+
Event.stopObserving(document, "mousemove", this.eventMouseMove);
|
95
|
+
this.handles.each( function(h) {
|
96
|
+
Event.stopObserving(h, "mousedown", slider.eventMouseDown);
|
97
|
+
});
|
98
|
+
},
|
99
|
+
setDisabled: function(){
|
100
|
+
this.disabled = true;
|
101
|
+
},
|
102
|
+
setEnabled: function(){
|
103
|
+
this.disabled = false;
|
104
|
+
},
|
105
|
+
getNearestValue: function(value){
|
106
|
+
if (this.allowedValues){
|
107
|
+
if (value >= this.allowedValues.max()) return(this.allowedValues.max());
|
108
|
+
if (value <= this.allowedValues.min()) return(this.allowedValues.min());
|
109
|
+
|
110
|
+
var offset = Math.abs(this.allowedValues[0] - value);
|
111
|
+
var newValue = this.allowedValues[0];
|
112
|
+
this.allowedValues.each( function(v) {
|
113
|
+
var currentOffset = Math.abs(v - value);
|
114
|
+
if (currentOffset <= offset){
|
115
|
+
newValue = v;
|
116
|
+
offset = currentOffset;
|
117
|
+
}
|
118
|
+
});
|
119
|
+
return newValue;
|
120
|
+
}
|
121
|
+
if (value > this.range.end) return this.range.end;
|
122
|
+
if (value < this.range.start) return this.range.start;
|
123
|
+
return value;
|
124
|
+
},
|
125
|
+
setValue: function(sliderValue, handleIdx){
|
126
|
+
if (!this.active) {
|
127
|
+
this.activeHandleIdx = handleIdx || 0;
|
128
|
+
this.activeHandle = this.handles[this.activeHandleIdx];
|
129
|
+
this.updateStyles();
|
130
|
+
}
|
131
|
+
handleIdx = handleIdx || this.activeHandleIdx || 0;
|
132
|
+
if (this.initialized && this.restricted) {
|
133
|
+
if ((handleIdx>0) && (sliderValue<this.values[handleIdx-1]))
|
134
|
+
sliderValue = this.values[handleIdx-1];
|
135
|
+
if ((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1]))
|
136
|
+
sliderValue = this.values[handleIdx+1];
|
137
|
+
}
|
138
|
+
sliderValue = this.getNearestValue(sliderValue);
|
139
|
+
this.values[handleIdx] = sliderValue;
|
140
|
+
this.value = this.values[0]; // assure backwards compat
|
141
|
+
|
142
|
+
this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] =
|
143
|
+
this.translateToPx(sliderValue);
|
144
|
+
|
145
|
+
this.drawSpans();
|
146
|
+
if (!this.dragging || !this.event) this.updateFinished();
|
147
|
+
},
|
148
|
+
setValueBy: function(delta, handleIdx) {
|
149
|
+
this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta,
|
150
|
+
handleIdx || this.activeHandleIdx || 0);
|
151
|
+
},
|
152
|
+
translateToPx: function(value) {
|
153
|
+
return Math.round(
|
154
|
+
((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) *
|
155
|
+
(value - this.range.start)) + "px";
|
156
|
+
},
|
157
|
+
translateToValue: function(offset) {
|
158
|
+
return ((offset/(this.trackLength-this.handleLength) *
|
159
|
+
(this.range.end-this.range.start)) + this.range.start);
|
160
|
+
},
|
161
|
+
getRange: function(range) {
|
162
|
+
var v = this.values.sortBy(Prototype.K);
|
163
|
+
range = range || 0;
|
164
|
+
return $R(v[range],v[range+1]);
|
165
|
+
},
|
166
|
+
minimumOffset: function(){
|
167
|
+
return(this.isVertical() ? this.alignY : this.alignX);
|
168
|
+
},
|
169
|
+
maximumOffset: function(){
|
170
|
+
return(this.isVertical() ?
|
171
|
+
(this.track.offsetHeight != 0 ? this.track.offsetHeight :
|
172
|
+
this.track.style.height.replace(/px$/,"")) - this.alignY :
|
173
|
+
(this.track.offsetWidth != 0 ? this.track.offsetWidth :
|
174
|
+
this.track.style.width.replace(/px$/,"")) - this.alignX);
|
175
|
+
},
|
176
|
+
isVertical: function(){
|
177
|
+
return (this.axis == 'vertical');
|
178
|
+
},
|
179
|
+
drawSpans: function() {
|
180
|
+
var slider = this;
|
181
|
+
if (this.spans)
|
182
|
+
$R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) });
|
183
|
+
if (this.options.startSpan)
|
184
|
+
this.setSpan(this.options.startSpan,
|
185
|
+
$R(0, this.values.length>1 ? this.getRange(0).min() : this.value ));
|
186
|
+
if (this.options.endSpan)
|
187
|
+
this.setSpan(this.options.endSpan,
|
188
|
+
$R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum));
|
189
|
+
},
|
190
|
+
setSpan: function(span, range) {
|
191
|
+
if (this.isVertical()) {
|
192
|
+
span.style.top = this.translateToPx(range.start);
|
193
|
+
span.style.height = this.translateToPx(range.end - range.start + this.range.start);
|
194
|
+
} else {
|
195
|
+
span.style.left = this.translateToPx(range.start);
|
196
|
+
span.style.width = this.translateToPx(range.end - range.start + this.range.start);
|
197
|
+
}
|
198
|
+
},
|
199
|
+
updateStyles: function() {
|
200
|
+
this.handles.each( function(h){ Element.removeClassName(h, 'selected') });
|
201
|
+
Element.addClassName(this.activeHandle, 'selected');
|
202
|
+
},
|
203
|
+
startDrag: function(event) {
|
204
|
+
if (Event.isLeftClick(event)) {
|
205
|
+
if (!this.disabled){
|
206
|
+
this.active = true;
|
207
|
+
|
208
|
+
var handle = Event.element(event);
|
209
|
+
var pointer = [Event.pointerX(event), Event.pointerY(event)];
|
210
|
+
var track = handle;
|
211
|
+
if (track==this.track) {
|
212
|
+
var offsets = Position.cumulativeOffset(this.track);
|
213
|
+
this.event = event;
|
214
|
+
this.setValue(this.translateToValue(
|
215
|
+
(this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2)
|
216
|
+
));
|
217
|
+
var offsets = Position.cumulativeOffset(this.activeHandle);
|
218
|
+
this.offsetX = (pointer[0] - offsets[0]);
|
219
|
+
this.offsetY = (pointer[1] - offsets[1]);
|
220
|
+
} else {
|
221
|
+
// find the handle (prevents issues with Safari)
|
222
|
+
while((this.handles.indexOf(handle) == -1) && handle.parentNode)
|
223
|
+
handle = handle.parentNode;
|
224
|
+
|
225
|
+
if (this.handles.indexOf(handle)!=-1) {
|
226
|
+
this.activeHandle = handle;
|
227
|
+
this.activeHandleIdx = this.handles.indexOf(this.activeHandle);
|
228
|
+
this.updateStyles();
|
229
|
+
|
230
|
+
var offsets = Position.cumulativeOffset(this.activeHandle);
|
231
|
+
this.offsetX = (pointer[0] - offsets[0]);
|
232
|
+
this.offsetY = (pointer[1] - offsets[1]);
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
236
|
+
Event.stop(event);
|
237
|
+
}
|
238
|
+
},
|
239
|
+
update: function(event) {
|
240
|
+
if (this.active) {
|
241
|
+
if (!this.dragging) this.dragging = true;
|
242
|
+
this.draw(event);
|
243
|
+
if (Prototype.Browser.WebKit) window.scrollBy(0,0);
|
244
|
+
Event.stop(event);
|
245
|
+
}
|
246
|
+
},
|
247
|
+
draw: function(event) {
|
248
|
+
var pointer = [Event.pointerX(event), Event.pointerY(event)];
|
249
|
+
var offsets = Position.cumulativeOffset(this.track);
|
250
|
+
pointer[0] -= this.offsetX + offsets[0];
|
251
|
+
pointer[1] -= this.offsetY + offsets[1];
|
252
|
+
this.event = event;
|
253
|
+
this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] ));
|
254
|
+
if (this.initialized && this.options.onSlide)
|
255
|
+
this.options.onSlide(this.values.length>1 ? this.values : this.value, this);
|
256
|
+
},
|
257
|
+
endDrag: function(event) {
|
258
|
+
if (this.active && this.dragging) {
|
259
|
+
this.finishDrag(event, true);
|
260
|
+
Event.stop(event);
|
261
|
+
}
|
262
|
+
this.active = false;
|
263
|
+
this.dragging = false;
|
264
|
+
},
|
265
|
+
finishDrag: function(event, success) {
|
266
|
+
this.active = false;
|
267
|
+
this.dragging = false;
|
268
|
+
this.updateFinished();
|
269
|
+
},
|
270
|
+
updateFinished: function() {
|
271
|
+
if (this.initialized && this.options.onChange)
|
272
|
+
this.options.onChange(this.values.length>1 ? this.values : this.value, this);
|
273
|
+
this.event = null;
|
274
|
+
}
|
275
|
+
});
|
@@ -0,0 +1,55 @@
|
|
1
|
+
// script.aculo.us sound.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
2
|
+
|
3
|
+
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
4
|
+
//
|
5
|
+
// Based on code created by Jules Gravinese (http://www.webveteran.com/)
|
6
|
+
//
|
7
|
+
// script.aculo.us is freely distributable under the terms of an MIT-style license.
|
8
|
+
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
9
|
+
|
10
|
+
Sound = {
|
11
|
+
tracks: {},
|
12
|
+
_enabled: true,
|
13
|
+
template:
|
14
|
+
new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'),
|
15
|
+
enable: function(){
|
16
|
+
Sound._enabled = true;
|
17
|
+
},
|
18
|
+
disable: function(){
|
19
|
+
Sound._enabled = false;
|
20
|
+
},
|
21
|
+
play: function(url){
|
22
|
+
if(!Sound._enabled) return;
|
23
|
+
var options = Object.extend({
|
24
|
+
track: 'global', url: url, replace: false
|
25
|
+
}, arguments[1] || {});
|
26
|
+
|
27
|
+
if(options.replace && this.tracks[options.track]) {
|
28
|
+
$R(0, this.tracks[options.track].id).each(function(id){
|
29
|
+
var sound = $('sound_'+options.track+'_'+id);
|
30
|
+
sound.Stop && sound.Stop();
|
31
|
+
sound.remove();
|
32
|
+
})
|
33
|
+
this.tracks[options.track] = null;
|
34
|
+
}
|
35
|
+
|
36
|
+
if(!this.tracks[options.track])
|
37
|
+
this.tracks[options.track] = { id: 0 }
|
38
|
+
else
|
39
|
+
this.tracks[options.track].id++;
|
40
|
+
|
41
|
+
options.id = this.tracks[options.track].id;
|
42
|
+
$$('body')[0].insert(
|
43
|
+
Prototype.Browser.IE ? new Element('bgsound',{
|
44
|
+
id: 'sound_'+options.track+'_'+options.id,
|
45
|
+
src: options.url, loop: 1, autostart: true
|
46
|
+
}) : Sound.template.evaluate(options));
|
47
|
+
}
|
48
|
+
};
|
49
|
+
|
50
|
+
if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){
|
51
|
+
if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 }))
|
52
|
+
Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>')
|
53
|
+
else
|
54
|
+
Sound.play = function(){}
|
55
|
+
}
|