Permalink
Browse files

sounds and the dollars

  • Loading branch information...
1 parent ab296c6 commit fbe1957e4bd0fc3eefe48376b455e2e58658d0d0 @stuarthalloway stuarthalloway committed Aug 29, 2008
View
3 .gitignore
@@ -1,2 +1,5 @@
log/*
db/development.sqlite3
+db/test.sqlite3
+db/schema.rb
+public/sounds/*
View
23 app/views/examples/dollars.html.erb
@@ -0,0 +1,23 @@
+<script type="text/javascript" src="/javascripts/examples/dollars.js"></script>
+
+<div id="main">
+<h2>$ and $$ Demo</h2>
+
+<form>
+ <table id="form-table">
+ <tr>
+ <td class="function-name">$</td>
+ <td><input type="text" name="id-value" id="id-value"/></td>
+ <td><input type="button" value="Highlight!" name="highlight-by-id" id="highlight-by-id"/></td>
+ </tr>
+ <tr>
+ <td class="function-name">$$</td>
+ <td><input type="text" name="css-value" id="css-value"/></td>
+ <td><input type="button" value="Highlight!" name="highlight-by-css" id="highlight-by-css"/></td>
+ </tr>
+ </table>
+</form>
+</div>
+
+<pre id="markup">
+</pre>
View
2 app/views/examples/index.html.erb
@@ -6,6 +6,7 @@
<li><%= link_to "Server-side validation", :action => "server_validation" %></li>
<li><%= link_to "Server-side validation with updater", :action => "server_validation_with_updater" %></a></li>
<li><%= link_to "Chat", :action => "chat" %></li>
+ <li><%= link_to "$ and $$", :action => "dollars" %></li>
</ul>
<h2>Scripty</h2>
@@ -14,6 +15,7 @@
<li><%= link_to "Morph", :action => "morph" %></li>
<li><%= link_to "Autocomplete", :action => "autocomplete" %></li>
<li><%= link_to "Sortable", :action => "sortable" %></li>
+ <li><%= link_to "Sound", :action => "sound" %></li>
</ul>
<h2>Object Model</h2>
View
8 app/views/examples/sound.html.erb
@@ -0,0 +1,8 @@
+<script type="text/javascript" src="/javascripts/sound.js"></script>
+<script type="text/javascript" src="/javascripts/examples/sound.js"></script>
+
+<h2>Sound Demo</h2>
+
+<input type="button" id="on" value="System On"></input>
+<input type="button" id="off" value="System Off"></input>
+<input type="button" id="play" value="Play"></input>
View
BIN keynote/prototaculous.key/droppedImage-14.pict
Binary file not shown.
View
BIN keynote/prototaculous.key/index.apxl.gz
Binary file not shown.
View
BIN keynote/prototaculous.key/thumbs/st10-2.tiff
Binary file not shown.
View
BIN keynote/prototaculous.key/thumbs/st17.tiff
Binary file not shown.
View
BIN keynote/prototaculous.key/thumbs/st2-6.tiff
Binary file not shown.
View
BIN keynote/prototaculous.key/thumbs/st26.tiff
Binary file not shown.
View
BIN keynote/prototaculous.key/thumbs/st27.tiff
Binary file not shown.
View
BIN keynote/prototaculous.key/thumbs/st28.tiff
Binary file not shown.
View
BIN keynote/prototaculous.key/thumbs/st9.tiff
Binary file not shown.
View
139 prototaculous.iws
@@ -59,22 +59,10 @@
</component>
<component name="FileEditorManager">
<leaf>
- <file leaf-file-name="application.html.erb" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/app/views/layouts/application.html.erb">
- <provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
- <folding />
- </state>
- </provider>
- <provider editor-type-id="HtmlPreview">
- <state />
- </provider>
- </entry>
- </file>
- <file leaf-file-name="portal.html.erb" pinned="false" current="false" current-in-tab="false">
+ <file leaf-file-name="portal.html.erb" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/views/examples/portal.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="1" column="0" selection-start="0" selection-end="71" vertical-scroll-proportion="-0.26027396">
+ <state line="1" column="0" selection-start="0" selection-end="71" vertical-scroll-proportion="0.032986112">
<folding />
</state>
</provider>
@@ -83,34 +71,34 @@
</provider>
</entry>
</file>
- <file leaf-file-name="autocomplete.html.erb" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/app/views/examples/autocomplete.html.erb">
+ <file leaf-file-name="autocomplete.js" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/public/javascripts/examples/autocomplete.js">
<provider selected="true" editor-type-id="text-editor">
- <state line="11" column="0" selection-start="400" selection-end="400" vertical-scroll-proportion="0.22376874">
+ <state line="4" column="3" selection-start="209" selection-end="209" vertical-scroll-proportion="0.11445783">
<folding />
</state>
</provider>
- <provider editor-type-id="HtmlPreview">
- <state />
- </provider>
</entry>
</file>
- <file leaf-file-name="autocomplete.js" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/public/javascripts/examples/autocomplete.js">
+ <file leaf-file-name="sound.js" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/public/javascripts/examples/sound.js">
<provider selected="true" editor-type-id="text-editor">
- <state line="4" column="3" selection-start="209" selection-end="209" vertical-scroll-proportion="0.07436399">
+ <state line="4" column="14" selection-start="186" selection-end="186" vertical-scroll-proportion="0.11445783">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="controls.js" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/public/javascripts/controls.js">
+ <file leaf-file-name="morph.html.erb" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/app/views/examples/morph.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="10" column="30" selection-start="454" selection-end="454" vertical-scroll-proportion="-8.803519">
+ <state line="5" column="0" selection-start="0" selection-end="126" vertical-scroll-proportion="-1.3013699">
<folding />
</state>
</provider>
+ <provider editor-type-id="HtmlPreview">
+ <state />
+ </provider>
</entry>
</file>
<file leaf-file-name="sortable.js" pinned="false" current="false" current-in-tab="false">
@@ -122,7 +110,7 @@
</provider>
</entry>
</file>
- <file leaf-file-name="extend.js" pinned="false" current="true" current-in-tab="true">
+ <file leaf-file-name="extend.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/public/javascripts/examples/extend.js">
<provider selected="true" editor-type-id="text-editor">
<state line="2" column="0" selection-start="0" selection-end="61" vertical-scroll-proportion="0.0642978">
@@ -134,6 +122,18 @@
</provider>
</entry>
</file>
+ <file leaf-file-name="sound.html.erb" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/app/views/examples/sound.html.erb">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="7" column="42" selection-start="325" selection-end="325" vertical-scroll-proportion="-1.8219178">
+ <folding />
+ </state>
+ </provider>
+ <provider editor-type-id="HtmlPreview">
+ <state />
+ </provider>
+ </entry>
+ </file>
<file leaf-file-name="extend.html.erb" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/views/examples/extend.html.erb">
<provider selected="true" editor-type-id="text-editor">
@@ -149,7 +149,7 @@
<file leaf-file-name="index.html.erb" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/views/examples/index.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="20" column="25" selection-start="720" selection-end="720" vertical-scroll-proportion="-5.2054796">
+ <state line="21" column="25" selection-start="774" selection-end="774" vertical-scroll-proportion="-5.2054796">
<folding />
</state>
</provider>
@@ -616,27 +616,27 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/app/views/examples/morph.html.erb">
+ <entry file="file://$PROJECT_DIR$/app/views/examples/server_validation_with_updater.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="63" selection-start="63" selection-end="63" vertical-scroll-proportion="0.0">
+ <state line="0" column="56" selection-start="56" selection-end="56" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
<provider editor-type-id="HtmlPreview">
<state />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/examples/core_effects.html.erb">
+ <entry file="file://$PROJECT_DIR$/app/views/examples/validate_field.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="1" column="0" selection-start="0" selection-end="85" vertical-scroll-proportion="0.020021075">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
<provider editor-type-id="HtmlPreview">
<state />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/examples/server_validation.html.erb">
+ <entry file="file://$PROJECT_DIR$/app/views/examples/validation.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="58" selection-start="58" selection-end="58" vertical-scroll-proportion="0.0">
<folding />
@@ -646,117 +646,114 @@
<state />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/examples/server_validation_with_updater.html.erb">
+ <entry file="file://$PROJECT_DIR$/app/views/layouts/application.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="56" selection-start="56" selection-end="56" vertical-scroll-proportion="0.0">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
<provider editor-type-id="HtmlPreview">
<state />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/examples/validate_field.html.erb">
+ <entry file="file://$PROJECT_DIR$/app/views/examples/autocomplete.html.erb">
<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="11" column="0" selection-start="400" selection-end="400" vertical-scroll-proportion="0.22376874">
<folding />
</state>
</provider>
<provider editor-type-id="HtmlPreview">
<state />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/examples/validation.html.erb">
+ <entry file="file://$PROJECT_DIR$/public/javascripts/controls.js">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="58" selection-start="58" selection-end="58" vertical-scroll-proportion="0.0">
+ <state line="10" column="30" selection-start="454" selection-end="454" vertical-scroll-proportion="-8.803519">
<folding />
</state>
</provider>
- <provider editor-type-id="HtmlPreview">
- <state />
- </provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/layouts/application.html.erb">
+ <entry file="file://$PROJECT_DIR$/public/javascripts/examples/sortable.js">
<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="0" column="28" selection-start="28" selection-end="28" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
- <provider editor-type-id="HtmlPreview">
- <state />
- </provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/examples/autocomplete.html.erb">
+ <entry file="file://$PROJECT_DIR$/app/views/examples/index.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="11" column="0" selection-start="400" selection-end="400" vertical-scroll-proportion="0.22376874">
+ <state line="21" column="25" selection-start="774" selection-end="774" vertical-scroll-proportion="-5.2054796">
<folding />
</state>
</provider>
<provider editor-type-id="HtmlPreview">
<state />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/public/javascripts/examples/autocomplete.js">
+ <entry file="file://$PROJECT_DIR$/public/javascripts/prototype.js">
<provider selected="true" editor-type-id="text-editor">
- <state line="4" column="3" selection-start="209" selection-end="209" vertical-scroll-proportion="0.07436399">
+ <state line="0" column="24" selection-start="24" selection-end="24" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/public/javascripts/controls.js">
+ <entry file="file://$PROJECT_DIR$/app/views/examples/extend.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="10" column="30" selection-start="454" selection-end="454" vertical-scroll-proportion="-8.803519">
+ <state line="4" column="19" selection-start="124" selection-end="124" vertical-scroll-proportion="-1.0410959">
<folding />
</state>
</provider>
- </entry>
- <entry file="file://$PROJECT_DIR$/public/javascripts/examples/sortable.js">
- <provider selected="true" editor-type-id="text-editor">
- <state line="0" column="28" selection-start="28" selection-end="28" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <provider editor-type-id="HtmlPreview">
+ <state />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/examples/index.html.erb">
+ <entry file="file://$PROJECT_DIR$/public/javascripts/examples/extend.js">
<provider selected="true" editor-type-id="text-editor">
- <state line="20" column="25" selection-start="720" selection-end="720" vertical-scroll-proportion="-5.2054796">
+ <state line="2" column="0" selection-start="0" selection-end="61" vertical-scroll-proportion="0.0642978">
<folding />
</state>
</provider>
<provider editor-type-id="HtmlPreview">
<state />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/examples/portal.html.erb">
+ <entry file="file://$PROJECT_DIR$/public/javascripts/examples/autocomplete.js">
<provider selected="true" editor-type-id="text-editor">
- <state line="1" column="0" selection-start="0" selection-end="71" vertical-scroll-proportion="-0.26027396">
+ <state line="4" column="3" selection-start="209" selection-end="209" vertical-scroll-proportion="0.11445783">
<folding />
</state>
</provider>
- <provider editor-type-id="HtmlPreview">
- <state />
+ </entry>
+ <entry file="file://$PROJECT_DIR$/public/javascripts/examples/sound.js">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="4" column="14" selection-start="186" selection-end="186" vertical-scroll-proportion="0.11445783">
+ <folding />
+ </state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/public/javascripts/prototype.js">
+ <entry file="file://$PROJECT_DIR$/app/views/examples/morph.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="24" selection-start="24" selection-end="24" vertical-scroll-proportion="0.0">
+ <state line="5" column="0" selection-start="0" selection-end="126" vertical-scroll-proportion="-1.3013699">
<folding />
</state>
</provider>
+ <provider editor-type-id="HtmlPreview">
+ <state />
+ </provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/examples/extend.html.erb">
+ <entry file="file://$PROJECT_DIR$/app/views/examples/sound.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="4" column="19" selection-start="124" selection-end="124" vertical-scroll-proportion="-1.0410959">
+ <state line="7" column="42" selection-start="325" selection-end="325" vertical-scroll-proportion="-1.8219178">
<folding />
</state>
</provider>
<provider editor-type-id="HtmlPreview">
<state />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/public/javascripts/examples/extend.js">
+ <entry file="file://$PROJECT_DIR$/app/views/examples/portal.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="2" column="0" selection-start="0" selection-end="61" vertical-scroll-proportion="0.0642978">
+ <state line="1" column="0" selection-start="0" selection-end="71" vertical-scroll-proportion="0.032986112">
<folding />
</state>
</provider>
View
9 public/javascripts/examples/dollars.js
@@ -0,0 +1,9 @@
+document.observe("dom:loaded", function() {
+ $("highlight-by-css").observe("click", function() {
+ $$($("css-value").value).invoke("highlight");
+ });
+ $("highlight-by-id").observe("click", function() {
+ $($("id-value").value).highlight();
+ });
+ $("markup").innerHTML = $("main").innerHTML.escapeHTML();
+});
View
7 public/javascripts/examples/sound.js
@@ -0,0 +1,7 @@
+document.observe("dom:loaded", function() {
+ $("off").observe("click", Sound.disable);
+ $("on").observe("click", Sound.enable);
+ $("play").observe("click", function() {
+ Sound.play("/sounds/frontalot-secrets.mp3");
+ });
+});
View
55 public/javascripts/sound.js
@@ -0,0 +1,55 @@
+// script.aculo.us sound.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
+
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
+// Based on code created by Jules Gravinese (http://www.webveteran.com/)
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+Sound = {
+ tracks: {},
+ _enabled: true,
+ template:
+ new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'),
+ enable: function(){
+ Sound._enabled = true;
+ },
+ disable: function(){
+ Sound._enabled = false;
+ },
+ play: function(url){
+ if(!Sound._enabled) return;
+ var options = Object.extend({
+ track: 'global', url: url, replace: false
+ }, arguments[1] || {});
+
+ if(options.replace && this.tracks[options.track]) {
+ $R(0, this.tracks[options.track].id).each(function(id){
+ var sound = $('sound_'+options.track+'_'+id);
+ sound.Stop && sound.Stop();
+ sound.remove();
+ })
+ this.tracks[options.track] = null;
+ }
+
+ if(!this.tracks[options.track])
+ this.tracks[options.track] = { id: 0 }
+ else
+ this.tracks[options.track].id++;
+
+ options.id = this.tracks[options.track].id;
+ $$('body')[0].insert(
+ Prototype.Browser.IE ? new Element('bgsound',{
+ id: 'sound_'+options.track+'_'+options.id,
+ src: options.url, loop: 1, autostart: true
+ }) : Sound.template.evaluate(options));
+ }
+};
+
+if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){
+ if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 }))
+ Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>')
+ else
+ Sound.play = function(){}
+}

0 comments on commit fbe1957

Please sign in to comment.