annotate onto/talks/mo-ismir-2007/ui/default/slides.js @ 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 // S5 v1.1 slides.js -- released into the Public Domain
Chris@0 2 //
Chris@0 3 // Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information
Chris@0 4 // about all the wonderful and talented contributors to this code!
Chris@0 5
Chris@0 6 var undef;
Chris@0 7 var slideCSS = '';
Chris@0 8 var snum = 0;
Chris@0 9 var smax = 1;
Chris@0 10 var incpos = 0;
Chris@0 11 var number = undef;
Chris@0 12 var s5mode = true;
Chris@0 13 var defaultView = 'slideshow';
Chris@0 14 var controlVis = 'visible';
Chris@0 15
Chris@0 16 var isIE = navigator.appName == 'Microsoft Internet Explorer' ? 1 : 0;
Chris@0 17 var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;
Chris@0 18 var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;
Chris@0 19
Chris@0 20 function hasClass(object, className) {
Chris@0 21 if (!object.className) return false;
Chris@0 22 return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);
Chris@0 23 }
Chris@0 24
Chris@0 25 function hasValue(object, value) {
Chris@0 26 if (!object) return false;
Chris@0 27 return (object.search('(^|\\s)' + value + '(\\s|$)') != -1);
Chris@0 28 }
Chris@0 29
Chris@0 30 function removeClass(object,className) {
Chris@0 31 if (!object) return;
Chris@0 32 object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2);
Chris@0 33 }
Chris@0 34
Chris@0 35 function addClass(object,className) {
Chris@0 36 if (!object || hasClass(object, className)) return;
Chris@0 37 if (object.className) {
Chris@0 38 object.className += ' '+className;
Chris@0 39 } else {
Chris@0 40 object.className = className;
Chris@0 41 }
Chris@0 42 }
Chris@0 43
Chris@0 44 function GetElementsWithClassName(elementName,className) {
Chris@0 45 var allElements = document.getElementsByTagName(elementName);
Chris@0 46 var elemColl = new Array();
Chris@0 47 for (var i = 0; i< allElements.length; i++) {
Chris@0 48 if (hasClass(allElements[i], className)) {
Chris@0 49 elemColl[elemColl.length] = allElements[i];
Chris@0 50 }
Chris@0 51 }
Chris@0 52 return elemColl;
Chris@0 53 }
Chris@0 54
Chris@0 55 function isParentOrSelf(element, id) {
Chris@0 56 if (element == null || element.nodeName=='BODY') return false;
Chris@0 57 else if (element.id == id) return true;
Chris@0 58 else return isParentOrSelf(element.parentNode, id);
Chris@0 59 }
Chris@0 60
Chris@0 61 function nodeValue(node) {
Chris@0 62 var result = "";
Chris@0 63 if (node.nodeType == 1) {
Chris@0 64 var children = node.childNodes;
Chris@0 65 for (var i = 0; i < children.length; ++i) {
Chris@0 66 result += nodeValue(children[i]);
Chris@0 67 }
Chris@0 68 }
Chris@0 69 else if (node.nodeType == 3) {
Chris@0 70 result = node.nodeValue;
Chris@0 71 }
Chris@0 72 return(result);
Chris@0 73 }
Chris@0 74
Chris@0 75 function slideLabel() {
Chris@0 76 var slideColl = GetElementsWithClassName('*','slide');
Chris@0 77 var list = document.getElementById('jumplist');
Chris@0 78 smax = slideColl.length;
Chris@0 79 for (var n = 0; n < smax; n++) {
Chris@0 80 var obj = slideColl[n];
Chris@0 81
Chris@0 82 var did = 'slide' + n.toString();
Chris@0 83 obj.setAttribute('id',did);
Chris@0 84 if (isOp) continue;
Chris@0 85
Chris@0 86 var otext = '';
Chris@0 87 var menu = obj.firstChild;
Chris@0 88 if (!menu) continue; // to cope with empty slides
Chris@0 89 while (menu && menu.nodeType == 3) {
Chris@0 90 menu = menu.nextSibling;
Chris@0 91 }
Chris@0 92 if (!menu) continue; // to cope with slides with only text nodes
Chris@0 93
Chris@0 94 var menunodes = menu.childNodes;
Chris@0 95 for (var o = 0; o < menunodes.length; o++) {
Chris@0 96 otext += nodeValue(menunodes[o]);
Chris@0 97 }
Chris@0 98 list.options[list.length] = new Option(n + ' : ' + otext, n);
Chris@0 99 }
Chris@0 100 }
Chris@0 101
Chris@0 102 function currentSlide() {
Chris@0 103 var cs;
Chris@0 104 if (document.getElementById) {
Chris@0 105 cs = document.getElementById('currentSlide');
Chris@0 106 } else {
Chris@0 107 cs = document.currentSlide;
Chris@0 108 }
Chris@0 109 cs.innerHTML = '<span id="csHere">' + snum + '<\/span> ' +
Chris@0 110 '<span id="csSep">\/<\/span> ' +
Chris@0 111 '<span id="csTotal">' + (smax-1) + '<\/span>';
Chris@0 112 if (snum == 0) {
Chris@0 113 cs.style.visibility = 'hidden';
Chris@0 114 } else {
Chris@0 115 cs.style.visibility = 'visible';
Chris@0 116 }
Chris@0 117 }
Chris@0 118
Chris@0 119 function go(step) {
Chris@0 120 if (document.getElementById('slideProj').disabled || step == 0) return;
Chris@0 121 var jl = document.getElementById('jumplist');
Chris@0 122 var cid = 'slide' + snum;
Chris@0 123 var ce = document.getElementById(cid);
Chris@0 124 if (incrementals[snum].length > 0) {
Chris@0 125 for (var i = 0; i < incrementals[snum].length; i++) {
Chris@0 126 removeClass(incrementals[snum][i], 'current');
Chris@0 127 removeClass(incrementals[snum][i], 'incremental');
Chris@0 128 }
Chris@0 129 }
Chris@0 130 if (step != 'j') {
Chris@0 131 snum += step;
Chris@0 132 lmax = smax - 1;
Chris@0 133 if (snum > lmax) snum = lmax;
Chris@0 134 if (snum < 0) snum = 0;
Chris@0 135 } else
Chris@0 136 snum = parseInt(jl.value);
Chris@0 137 var nid = 'slide' + snum;
Chris@0 138 var ne = document.getElementById(nid);
Chris@0 139 if (!ne) {
Chris@0 140 ne = document.getElementById('slide0');
Chris@0 141 snum = 0;
Chris@0 142 }
Chris@0 143 if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;}
Chris@0 144 if (incrementals[snum].length > 0 && incpos == 0) {
Chris@0 145 for (var i = 0; i < incrementals[snum].length; i++) {
Chris@0 146 if (hasClass(incrementals[snum][i], 'current'))
Chris@0 147 incpos = i + 1;
Chris@0 148 else
Chris@0 149 addClass(incrementals[snum][i], 'incremental');
Chris@0 150 }
Chris@0 151 }
Chris@0 152 if (incrementals[snum].length > 0 && incpos > 0)
Chris@0 153 addClass(incrementals[snum][incpos - 1], 'current');
Chris@0 154 ce.style.visibility = 'hidden';
Chris@0 155 ne.style.visibility = 'visible';
Chris@0 156 jl.selectedIndex = snum;
Chris@0 157 currentSlide();
Chris@0 158 number = 0;
Chris@0 159 }
Chris@0 160
Chris@0 161 function goTo(target) {
Chris@0 162 if (target >= smax || target == snum) return;
Chris@0 163 go(target - snum);
Chris@0 164 }
Chris@0 165
Chris@0 166 function subgo(step) {
Chris@0 167 if (step > 0) {
Chris@0 168 removeClass(incrementals[snum][incpos - 1],'current');
Chris@0 169 removeClass(incrementals[snum][incpos], 'incremental');
Chris@0 170 addClass(incrementals[snum][incpos],'current');
Chris@0 171 incpos++;
Chris@0 172 } else {
Chris@0 173 incpos--;
Chris@0 174 removeClass(incrementals[snum][incpos],'current');
Chris@0 175 addClass(incrementals[snum][incpos], 'incremental');
Chris@0 176 addClass(incrementals[snum][incpos - 1],'current');
Chris@0 177 }
Chris@0 178 }
Chris@0 179
Chris@0 180 function toggle() {
Chris@0 181 var slideColl = GetElementsWithClassName('*','slide');
Chris@0 182 var slides = document.getElementById('slideProj');
Chris@0 183 var outline = document.getElementById('outlineStyle');
Chris@0 184 if (!slides.disabled) {
Chris@0 185 slides.disabled = true;
Chris@0 186 outline.disabled = false;
Chris@0 187 s5mode = false;
Chris@0 188 fontSize('1em');
Chris@0 189 for (var n = 0; n < smax; n++) {
Chris@0 190 var slide = slideColl[n];
Chris@0 191 slide.style.visibility = 'visible';
Chris@0 192 }
Chris@0 193 } else {
Chris@0 194 slides.disabled = false;
Chris@0 195 outline.disabled = true;
Chris@0 196 s5mode = true;
Chris@0 197 fontScale();
Chris@0 198 for (var n = 0; n < smax; n++) {
Chris@0 199 var slide = slideColl[n];
Chris@0 200 slide.style.visibility = 'hidden';
Chris@0 201 }
Chris@0 202 slideColl[snum].style.visibility = 'visible';
Chris@0 203 }
Chris@0 204 }
Chris@0 205
Chris@0 206 function showHide(action) {
Chris@0 207 var obj = GetElementsWithClassName('*','hideme')[0];
Chris@0 208 switch (action) {
Chris@0 209 case 's': obj.style.visibility = 'visible'; break;
Chris@0 210 case 'h': obj.style.visibility = 'hidden'; break;
Chris@0 211 case 'k':
Chris@0 212 if (obj.style.visibility != 'visible') {
Chris@0 213 obj.style.visibility = 'visible';
Chris@0 214 } else {
Chris@0 215 obj.style.visibility = 'hidden';
Chris@0 216 }
Chris@0 217 break;
Chris@0 218 }
Chris@0 219 }
Chris@0 220
Chris@0 221 // 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/)
Chris@0 222 function keys(key) {
Chris@0 223 if (!key) {
Chris@0 224 key = event;
Chris@0 225 key.which = key.keyCode;
Chris@0 226 }
Chris@0 227 if (key.which == 84) {
Chris@0 228 toggle();
Chris@0 229 return;
Chris@0 230 }
Chris@0 231 if (s5mode) {
Chris@0 232 switch (key.which) {
Chris@0 233 case 10: // return
Chris@0 234 case 13: // enter
Chris@0 235 if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
Chris@0 236 if (key.target && isParentOrSelf(key.target, 'controls')) return;
Chris@0 237 if(number != undef) {
Chris@0 238 goTo(number);
Chris@0 239 break;
Chris@0 240 }
Chris@0 241 case 32: // spacebar
Chris@0 242 case 34: // page down
Chris@0 243 case 39: // rightkey
Chris@0 244 case 40: // downkey
Chris@0 245 if(number != undef) {
Chris@0 246 go(number);
Chris@0 247 } else if (!incrementals[snum] || incpos >= incrementals[snum].length) {
Chris@0 248 go(1);
Chris@0 249 } else {
Chris@0 250 subgo(1);
Chris@0 251 }
Chris@0 252 break;
Chris@0 253 case 33: // page up
Chris@0 254 case 37: // leftkey
Chris@0 255 case 38: // upkey
Chris@0 256 if(number != undef) {
Chris@0 257 go(-1 * number);
Chris@0 258 } else if (!incrementals[snum] || incpos <= 0) {
Chris@0 259 go(-1);
Chris@0 260 } else {
Chris@0 261 subgo(-1);
Chris@0 262 }
Chris@0 263 break;
Chris@0 264 case 36: // home
Chris@0 265 goTo(0);
Chris@0 266 break;
Chris@0 267 case 35: // end
Chris@0 268 goTo(smax-1);
Chris@0 269 break;
Chris@0 270 case 67: // c
Chris@0 271 showHide('k');
Chris@0 272 break;
Chris@0 273 }
Chris@0 274 if (key.which < 48 || key.which > 57) {
Chris@0 275 number = undef;
Chris@0 276 } else {
Chris@0 277 if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
Chris@0 278 if (key.target && isParentOrSelf(key.target, 'controls')) return;
Chris@0 279 number = (((number != undef) ? number : 0) * 10) + (key.which - 48);
Chris@0 280 }
Chris@0 281 }
Chris@0 282 return false;
Chris@0 283 }
Chris@0 284
Chris@0 285 function clicker(e) {
Chris@0 286 number = undef;
Chris@0 287 var target;
Chris@0 288 if (window.event) {
Chris@0 289 target = window.event.srcElement;
Chris@0 290 e = window.event;
Chris@0 291 } else target = e.target;
Chris@0 292 if (target.getAttribute('href') != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target,'object')) return true;
Chris@0 293 if (!e.which || e.which == 1) {
Chris@0 294 if (!incrementals[snum] || incpos >= incrementals[snum].length) {
Chris@0 295 go(1);
Chris@0 296 } else {
Chris@0 297 subgo(1);
Chris@0 298 }
Chris@0 299 }
Chris@0 300 }
Chris@0 301
Chris@0 302 function findSlide(hash) {
Chris@0 303 var target = null;
Chris@0 304 var slides = GetElementsWithClassName('*','slide');
Chris@0 305 for (var i = 0; i < slides.length; i++) {
Chris@0 306 var targetSlide = slides[i];
Chris@0 307 if ( (targetSlide.name && targetSlide.name == hash)
Chris@0 308 || (targetSlide.id && targetSlide.id == hash) ) {
Chris@0 309 target = targetSlide;
Chris@0 310 break;
Chris@0 311 }
Chris@0 312 }
Chris@0 313 while(target != null && target.nodeName != 'BODY') {
Chris@0 314 if (hasClass(target, 'slide')) {
Chris@0 315 return parseInt(target.id.slice(5));
Chris@0 316 }
Chris@0 317 target = target.parentNode;
Chris@0 318 }
Chris@0 319 return null;
Chris@0 320 }
Chris@0 321
Chris@0 322 function slideJump() {
Chris@0 323 if (window.location.hash == null) return;
Chris@0 324 var sregex = /^#slide(\d+)$/;
Chris@0 325 var matches = sregex.exec(window.location.hash);
Chris@0 326 var dest = null;
Chris@0 327 if (matches != null) {
Chris@0 328 dest = parseInt(matches[1]);
Chris@0 329 } else {
Chris@0 330 dest = findSlide(window.location.hash.slice(1));
Chris@0 331 }
Chris@0 332 if (dest != null)
Chris@0 333 go(dest - snum);
Chris@0 334 }
Chris@0 335
Chris@0 336 function fixLinks() {
Chris@0 337 var thisUri = window.location.href;
Chris@0 338 thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length);
Chris@0 339 var aelements = document.getElementsByTagName('A');
Chris@0 340 for (var i = 0; i < aelements.length; i++) {
Chris@0 341 var a = aelements[i].href;
Chris@0 342 var slideID = a.match('\#slide[0-9]{1,2}');
Chris@0 343 if ((slideID) && (slideID[0].slice(0,1) == '#')) {
Chris@0 344 var dest = findSlide(slideID[0].slice(1));
Chris@0 345 if (dest != null) {
Chris@0 346 if (aelements[i].addEventListener) {
Chris@0 347 aelements[i].addEventListener("click", new Function("e",
Chris@0 348 "if (document.getElementById('slideProj').disabled) return;" +
Chris@0 349 "go("+dest+" - snum); " +
Chris@0 350 "if (e.preventDefault) e.preventDefault();"), true);
Chris@0 351 } else if (aelements[i].attachEvent) {
Chris@0 352 aelements[i].attachEvent("onclick", new Function("",
Chris@0 353 "if (document.getElementById('slideProj').disabled) return;" +
Chris@0 354 "go("+dest+" - snum); " +
Chris@0 355 "event.returnValue = false;"));
Chris@0 356 }
Chris@0 357 }
Chris@0 358 }
Chris@0 359 }
Chris@0 360 }
Chris@0 361
Chris@0 362 function externalLinks() {
Chris@0 363 if (!document.getElementsByTagName) return;
Chris@0 364 var anchors = document.getElementsByTagName('a');
Chris@0 365 for (var i=0; i<anchors.length; i++) {
Chris@0 366 var anchor = anchors[i];
Chris@0 367 if (anchor.getAttribute('href') && hasValue(anchor.rel, 'external')) {
Chris@0 368 anchor.target = '_blank';
Chris@0 369 addClass(anchor,'external');
Chris@0 370 }
Chris@0 371 }
Chris@0 372 }
Chris@0 373
Chris@0 374 function createControls() {
Chris@0 375 var controlsDiv = document.getElementById("controls");
Chris@0 376 if (!controlsDiv) return;
Chris@0 377 var hider = ' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';
Chris@0 378 var hideDiv, hideList = '';
Chris@0 379 if (controlVis == 'hidden') {
Chris@0 380 hideDiv = hider;
Chris@0 381 } else {
Chris@0 382 hideList = hider;
Chris@0 383 }
Chris@0 384 controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' +
Chris@0 385 '<div id="navLinks">' +
Chris@0 386 '<a accesskey="t" id="toggle" href="javascript:toggle();">&#216;<\/a>' +
Chris@0 387 '<a accesskey="z" id="prev" href="javascript:go(-1);">&laquo;<\/a>' +
Chris@0 388 '<a accesskey="x" id="next" href="javascript:go(1);">&raquo;<\/a>' +
Chris@0 389 '<div id="navList"' + hideList + '><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>' +
Chris@0 390 '<\/div><\/form>';
Chris@0 391 if (controlVis == 'hidden') {
Chris@0 392 var hidden = document.getElementById('navLinks');
Chris@0 393 } else {
Chris@0 394 var hidden = document.getElementById('jumplist');
Chris@0 395 }
Chris@0 396 addClass(hidden,'hideme');
Chris@0 397 }
Chris@0 398
Chris@0 399 function fontScale() { // causes layout problems in FireFox that get fixed if browser's Reload is used; same may be true of other Gecko-based browsers
Chris@0 400 if (!s5mode) return false;
Chris@0 401 var vScale = 22; // both yield 32 (after rounding) at 1024x768
Chris@0 402 var hScale = 32; // perhaps should auto-calculate based on theme's declared value?
Chris@0 403 if (window.innerHeight) {
Chris@0 404 var vSize = window.innerHeight;
Chris@0 405 var hSize = window.innerWidth;
Chris@0 406 } else if (document.documentElement.clientHeight) {
Chris@0 407 var vSize = document.documentElement.clientHeight;
Chris@0 408 var hSize = document.documentElement.clientWidth;
Chris@0 409 } else if (document.body.clientHeight) {
Chris@0 410 var vSize = document.body.clientHeight;
Chris@0 411 var hSize = document.body.clientWidth;
Chris@0 412 } else {
Chris@0 413 var vSize = 700; // assuming 1024x768, minus chrome and such
Chris@0 414 var hSize = 1024; // these do not account for kiosk mode or Opera Show
Chris@0 415 }
Chris@0 416 var newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));
Chris@0 417 fontSize(newSize + 'px');
Chris@0 418 if (isGe) { // hack to counter incremental reflow bugs
Chris@0 419 var obj = document.getElementsByTagName('body')[0];
Chris@0 420 obj.style.display = 'none';
Chris@0 421 obj.style.display = 'block';
Chris@0 422 }
Chris@0 423 }
Chris@0 424
Chris@0 425 function fontSize(value) {
Chris@0 426 if (!(s5ss = document.getElementById('s5ss'))) {
Chris@0 427 if (!isIE) {
Chris@0 428 document.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style'));
Chris@0 429 s5ss.setAttribute('media','screen, projection');
Chris@0 430 s5ss.setAttribute('id','s5ss');
Chris@0 431 } else {
Chris@0 432 document.createStyleSheet();
Chris@0 433 document.s5ss = document.styleSheets[document.styleSheets.length - 1];
Chris@0 434 }
Chris@0 435 }
Chris@0 436 if (!isIE) {
Chris@0 437 while (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild);
Chris@0 438 s5ss.appendChild(document.createTextNode('body {font-size: ' + value + ' !important;}'));
Chris@0 439 } else {
Chris@0 440 document.s5ss.addRule('body','font-size: ' + value + ' !important;');
Chris@0 441 }
Chris@0 442 }
Chris@0 443
Chris@0 444 function notOperaFix() {
Chris@0 445 slideCSS = document.getElementById('slideProj').href;
Chris@0 446 var slides = document.getElementById('slideProj');
Chris@0 447 var outline = document.getElementById('outlineStyle');
Chris@0 448 slides.setAttribute('media','screen');
Chris@0 449 outline.disabled = true;
Chris@0 450 if (isGe) {
Chris@0 451 slides.setAttribute('href','null'); // Gecko fix
Chris@0 452 slides.setAttribute('href',slideCSS); // Gecko fix
Chris@0 453 }
Chris@0 454 if (isIE && document.styleSheets && document.styleSheets[0]) {
Chris@0 455 document.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)');
Chris@0 456 document.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)');
Chris@0 457 document.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)');
Chris@0 458 }
Chris@0 459 }
Chris@0 460
Chris@0 461 function getIncrementals(obj) {
Chris@0 462 var incrementals = new Array();
Chris@0 463 if (!obj)
Chris@0 464 return incrementals;
Chris@0 465 var children = obj.childNodes;
Chris@0 466 for (var i = 0; i < children.length; i++) {
Chris@0 467 var child = children[i];
Chris@0 468 if (hasClass(child, 'incremental')) {
Chris@0 469 if (child.nodeName == 'OL' || child.nodeName == 'UL') {
Chris@0 470 removeClass(child, 'incremental');
Chris@0 471 for (var j = 0; j < child.childNodes.length; j++) {
Chris@0 472 if (child.childNodes[j].nodeType == 1) {
Chris@0 473 addClass(child.childNodes[j], 'incremental');
Chris@0 474 }
Chris@0 475 }
Chris@0 476 } else {
Chris@0 477 incrementals[incrementals.length] = child;
Chris@0 478 removeClass(child,'incremental');
Chris@0 479 }
Chris@0 480 }
Chris@0 481 if (hasClass(child, 'show-first')) {
Chris@0 482 if (child.nodeName == 'OL' || child.nodeName == 'UL') {
Chris@0 483 removeClass(child, 'show-first');
Chris@0 484 if (child.childNodes[isGe].nodeType == 1) {
Chris@0 485 removeClass(child.childNodes[isGe], 'incremental');
Chris@0 486 }
Chris@0 487 } else {
Chris@0 488 incrementals[incrementals.length] = child;
Chris@0 489 }
Chris@0 490 }
Chris@0 491 incrementals = incrementals.concat(getIncrementals(child));
Chris@0 492 }
Chris@0 493 return incrementals;
Chris@0 494 }
Chris@0 495
Chris@0 496 function createIncrementals() {
Chris@0 497 var incrementals = new Array();
Chris@0 498 for (var i = 0; i < smax; i++) {
Chris@0 499 incrementals[i] = getIncrementals(document.getElementById('slide'+i));
Chris@0 500 }
Chris@0 501 return incrementals;
Chris@0 502 }
Chris@0 503
Chris@0 504 function defaultCheck() {
Chris@0 505 var allMetas = document.getElementsByTagName('meta');
Chris@0 506 for (var i = 0; i< allMetas.length; i++) {
Chris@0 507 if (allMetas[i].name == 'defaultView') {
Chris@0 508 defaultView = allMetas[i].content;
Chris@0 509 }
Chris@0 510 if (allMetas[i].name == 'controlVis') {
Chris@0 511 controlVis = allMetas[i].content;
Chris@0 512 }
Chris@0 513 }
Chris@0 514 }
Chris@0 515
Chris@0 516 // Key trap fix, new function body for trap()
Chris@0 517 function trap(e) {
Chris@0 518 if (!e) {
Chris@0 519 e = event;
Chris@0 520 e.which = e.keyCode;
Chris@0 521 }
Chris@0 522 try {
Chris@0 523 modifierKey = e.ctrlKey || e.altKey || e.metaKey;
Chris@0 524 }
Chris@0 525 catch(e) {
Chris@0 526 modifierKey = false;
Chris@0 527 }
Chris@0 528 return modifierKey || e.which == 0;
Chris@0 529 }
Chris@0 530
Chris@0 531 function startup() {
Chris@0 532 defaultCheck();
Chris@0 533 if (!isOp) createControls();
Chris@0 534 slideLabel();
Chris@0 535 fixLinks();
Chris@0 536 externalLinks();
Chris@0 537 fontScale();
Chris@0 538 if (!isOp) {
Chris@0 539 notOperaFix();
Chris@0 540 incrementals = createIncrementals();
Chris@0 541 slideJump();
Chris@0 542 if (defaultView == 'outline') {
Chris@0 543 toggle();
Chris@0 544 }
Chris@0 545 document.onkeyup = keys;
Chris@0 546 document.onkeypress = trap;
Chris@0 547 document.onclick = clicker;
Chris@0 548 }
Chris@0 549 }
Chris@0 550
Chris@0 551 window.onload = startup;
Chris@0 552 window.onresize = function(){setTimeout('fontScale()', 50);}