annotate screencasts/songbird-map/index.html @ 19:1e79ce3ff5f5 tip

Simplify and cut some non-working resource paths
author Chris Cannam
date Wed, 08 Nov 2017 15:27:23 +0000
parents 1e44d666ced1
children
rev   line source
Chris@0 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
Chris@0 2 <html>
Chris@0 3 <head>
Chris@0 4 <title>Playing with Linked Data, Jamendo, Geonames, Mazzle and Songbird</title>
Chris@0 5 <script language="javascript">
Chris@0 6 /* Jesse Ruderman
Chris@0 7 * July 18, 2004
Chris@0 8 *
Chris@0 9 * Remaining problems:
Chris@0 10 * IE sometimes crashes on exit after using the this script.
Chris@0 11 * In IE, it is a little ugly because IE doesn't support border-radius.
Chris@0 12 * In IE, it does not work at standalone Flash URLs.
Chris@0 13 */
Chris@0 14
Chris@0 15 function setupSeekBar() {
Chris@0 16
Chris@0 17 setTimeout(initFlashControls, 100);
Chris@0 18
Chris@0 19 function initFlashControls()
Chris@0 20 {
Chris@0 21 var count = 0;
Chris@0 22
Chris@0 23 function tt(elem)
Chris@0 24 {
Chris@0 25 if (typeof elem.TotalFrames != "undefined") /* do not coerce elem.StopPlay to bool, because that breaks IE */
Chris@0 26 {
Chris@0 27 addFlashControls(elem);
Chris@0 28 ++count;
Chris@0 29 }
Chris@0 30 }
Chris@0 31
Chris@0 32 var i, x;
Chris@0 33
Chris@0 34 for (i = 0; x = document.getElementsByTagName("object")[i]; ++i)
Chris@0 35 tt(x);
Chris@0 36
Chris@0 37 for (i = 0; x = document.getElementsByTagName("embed")[i]; ++i)
Chris@0 38 tt(x);
Chris@0 39
Chris@0 40 }
Chris@0 41
Chris@0 42
Chris@0 43 function addFlashControls(flash)
Chris@0 44 {
Chris@0 45 var controlsDiv = document.createElement("div");
Chris@0 46
Chris@0 47 /* Put the controls under the Flash.
Chris@0 48 *
Chris@0 49 * If the Flash is an <embed> in an <object>, we do not want to touch the <object>, because that would make
Chris@0 50 * Mozilla re-test whether the <object> is broken and reset the <embed>. So in that case, we put the controls
Chris@0 51 * under the <object>.
Chris@0 52 */
Chris@0 53 var where = flash;
Chris@0 54 while (where.parentNode.tagName.toLowerCase() == "object")
Chris@0 55 where = where.parentNode;
Chris@0 56 where.parentNode.insertBefore(controlsDiv, where.nextSibling);
Chris@0 57
Chris@0 58 /* Construct controls using DOM2 instead of innerHTML.
Chris@0 59 * In Mozilla, innerHTML= is like innerText= at standalone flash URLs.
Chris@0 60 */
Chris@0 61 var table = document.createElement("table");
Chris@0 62 controlsDiv.appendChild(table);
Chris@0 63
Chris@0 64 var row = table.insertRow(-1);
Chris@0 65
Chris@0 66 var pauseButton = document.createElement("button");
Chris@0 67 pauseButton.appendChild(document.createTextNode("Pause"));
Chris@0 68 var buttonCell = row.insertCell(-1);
Chris@0 69 buttonCell.appendChild(pauseButton);
Chris@0 70
Chris@0 71 var slider = row.insertCell(-1);
Chris@0 72 slider.width = "100%";
Chris@0 73
Chris@0 74 var visibleSlider = document.createElement("div");
Chris@0 75 visibleSlider.style.position = "relative";
Chris@0 76 visibleSlider.style.height = "10px";
Chris@0 77 visibleSlider.style.width = "100%";
Chris@0 78 visibleSlider.style.MozBorderRadius = "4px";
Chris@0 79 visibleSlider.style.background = "#aaa";
Chris@0 80 slider.appendChild(visibleSlider);
Chris@0 81
Chris@0 82 var thumb = document.createElement("div");
Chris@0 83 thumb.style.position = "absolute";
Chris@0 84 thumb.style.height = "20px";
Chris@0 85 thumb.style.width = "10px";
Chris@0 86 thumb.style.top = "-5px";
Chris@0 87 thumb.style.MozBorderRadius = "4px";
Chris@0 88 thumb.style.background = "#666";
Chris@0 89 visibleSlider.appendChild(thumb);
Chris@0 90
Chris@0 91
Chris@0 92 var sliderWidth;
Chris@0 93 var paused = false;
Chris@0 94 var dragging = false;
Chris@0 95
Chris@0 96 table.width = Math.max(parseInt(flash.width) || 0, 400);
Chris@0 97
Chris@0 98 addEvent(pauseButton, "click", pauseUnpause);
Chris@0 99 addEvent(slider, "mousedown", drag);
Chris@0 100 addEvent(slider, "drag", function() { return false; }); /* For IE */
Chris@0 101 window.setInterval(update, 30);
Chris@0 102
Chris@0 103 function pauseUnpause()
Chris@0 104 {
Chris@0 105 paused = !paused;
Chris@0 106
Chris@0 107 pauseButton.style.borderStyle = paused ? "inset" : "";
Chris@0 108
Chris@0 109 if (paused)
Chris@0 110 flash.StopPlay();
Chris@0 111 else
Chris@0 112 flash.Play();
Chris@0 113 }
Chris@0 114
Chris@0 115 function update()
Chris@0 116 {
Chris@0 117 sliderWidth = parseInt(getWidth(slider) - getWidth(thumb));
Chris@0 118
Chris@0 119 if (!paused && !dragging)
Chris@0 120 thumb.style.left = parseInt(flash.CurrentFrame() / totalFrames() * sliderWidth) + "px";
Chris@0 121 }
Chris@0 122
Chris@0 123 function dragMousemove(e)
Chris@0 124 {
Chris@0 125 var pageX = e.clientX + document.body.scrollLeft; /* cross-browser, unlike e.pageX, which IE does not support */
Chris@0 126 var pos = bounds(0, pageX - getX(slider) - 5, sliderWidth);
Chris@0 127 var frame = bounds(1, Math.ceil(totalFrames() * pos / sliderWidth), totalFrames() - 2);
Chris@0 128
Chris@0 129 thumb.style.left = pos + "px";
Chris@0 130
Chris@0 131 flash.GotoFrame(frame);
Chris@0 132 }
Chris@0 133
Chris@0 134 function release(e)
Chris@0 135 {
Chris@0 136 removeEvent(document, "mousemove", dragMousemove);
Chris@0 137 removeEvent(document, "mouseup", release);
Chris@0 138 if (!paused)
Chris@0 139 flash.Play();
Chris@0 140 dragging = false;
Chris@0 141 }
Chris@0 142
Chris@0 143 function drag(e)
Chris@0 144 {
Chris@0 145 addEvent(document, "mousemove", dragMousemove);
Chris@0 146 addEvent(document, "mouseup", release);
Chris@0 147 dragging = true;
Chris@0 148 dragMousemove(e);
Chris@0 149 }
Chris@0 150
Chris@0 151
Chris@0 152
Chris@0 153 /* Boring functions, some of which only exist to hide differences between IE and Mozilla. */
Chris@0 154
Chris@0 155 function bounds(min, val, max)
Chris@0 156 {
Chris@0 157 return Math.min(Math.max(min, val), max);
Chris@0 158 }
Chris@0 159
Chris@0 160 function totalFrames()
Chris@0 161 {
Chris@0 162 /* This is weird. TotalFrames differs between IE and Mozilla. CurrentFrame does not. */
Chris@0 163
Chris@0 164 if (typeof flash.TotalFrames == "number")
Chris@0 165 return flash.TotalFrames; /* IE */
Chris@0 166 else if (typeof flash.TotalFrames == "function")
Chris@0 167 return flash.TotalFrames(); /* Mozilla */
Chris@0 168 else
Chris@0 169 return 1; /* Partially loaded Flash in IE? */
Chris@0 170 }
Chris@0 171
Chris@0 172 function getWidth(elem)
Chris@0 173 {
Chris@0 174 if (document.defaultView && document.defaultView.getComputedStyle)
Chris@0 175 return parseFloat(document.defaultView.getComputedStyle(elem,null).getPropertyValue("width")); /* Mozilla */
Chris@0 176 else
Chris@0 177 return parseFloat(elem.offsetWidth); /* IE (currentStyle.width can be "auto" or "100%") */
Chris@0 178 }
Chris@0 179
Chris@0 180 function getX(elem)
Chris@0 181 {
Chris@0 182 if (!elem) return 0;
Chris@0 183 return (elem.offsetLeft) + getX(elem.offsetParent);
Chris@0 184 }
Chris@0 185
Chris@0 186 function addEvent(elem, eventName, fun)
Chris@0 187 {
Chris@0 188 if (elem.addEventListener) /* Mozilla */
Chris@0 189 elem.addEventListener(eventName, fun, false);
Chris@0 190 else /* IE */
Chris@0 191 elem.attachEvent("on" + eventName, fun);
Chris@0 192 }
Chris@0 193
Chris@0 194 function removeEvent(elem, eventName, fun)
Chris@0 195 {
Chris@0 196 if (elem.addEventListener)
Chris@0 197 elem.removeEventListener(eventName, fun, false);
Chris@0 198 else
Chris@0 199 elem.detachEvent("on" + eventName, fun);
Chris@0 200 }
Chris@0 201
Chris@0 202 }
Chris@0 203
Chris@0 204 }
Chris@0 205 </script>
Chris@0 206 </head>
Chris@0 207 <body onload="setupSeekBar();">
Chris@0 208 <h1>Playing with Linked Data, Jamendo, Geonames, Mazzle and Songbird</h1>
Chris@0 209 <hr noshade><center>
Chris@0 210 <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1280" height="800"
Chris@0 211 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0">
Chris@0 212 <param name="movie" value="songibird-mix.swf">
Chris@0 213 <param name="play" value="true">
Chris@0 214 <param name="loop" value="True">
Chris@0 215 <param name="quality" value="low">
Chris@0 216 <embed src="songibird-mix.swf" width="1280" height="800" play="true"
Chris@0 217 loop="True" quality="low" type="application/x-shockwave-flash"
Chris@0 218 pluginspage="http://www.macromedia.com/go/getflashplayer">
Chris@0 219 </embed></object></center>
Chris@0 220 <hr noshade>
Chris@0 221 <div align=right>
Chris@0 222 <em>Generated by <a href="http://www.unixuser.org/~euske/vnc2swf/">pyvnc2swf</a>-0.9.2</em>
Chris@0 223 </div>
Chris@0 224
Chris@0 225 <script type="text/javascript">
Chris@0 226 var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
Chris@0 227 document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
Chris@0 228 </script>
Chris@0 229 <script type="text/javascript">
Chris@0 230 var pageTracker = _gat._getTracker("UA-3327144-3");
Chris@0 231 pageTracker._initData();
Chris@0 232 pageTracker._trackPageview();
Chris@0 233 </script>
Chris@0 234
Chris@0 235 </body></html>