/* * Javascript implementations for Papercut 2008 website * (c) Papercut Media. No reproduction without permission. Feel free to ask. * Author: Patrick Pittman * Date: October 2007 * Version: 1.0 * Requires: Prototype.js framework, ufo.js for flash loading, Dreamgirl on the other end for AJAXy JSON communication */ function Papercut() { this.loaderlock = false; this.baseHref = "http://www.andrewhorabin.com/"; this.ajaxBase = this.baseHref+"js/ajax/"; this.ajaxProgress = document.createElement('img'); this.ajaxProgress.src = this.baseHref+"images/icons/ajax-loader.gif"; this.anchors = $H({}); } Papercut.prototype.init = function(e) { Element.extend(document.body); this.playerLinks(); this.loadPlayer(); } function isDefined(variable) { return (!(!( variable||false ))) } Papercut.prototype.playerLinks = function(wrapper) { if (!wrapper) { wrapper = $('wrapper'); } if (wrapper) { docLinks = wrapper.getElementsByTagName('A'); if (docLinks) { $A(docLinks).each( function(element) { var reqUri = element.href; var reqAnchor = reqUri.lastIndexOf('#'); if (element.href.match("listen")) { $log("Player link: "+element.href); element.observe('click',function(e) { Event.stop(e); element = Event.element(e).up('a'); $log(element.href); popup = window.open(element.href,'horabinPlayer','width=300,height=330,resizable=1,scrollbars=yes,status=yes'); if (window.focus) { popup.focus() }; }); } }); } } } Papercut.prototype.loadPlayer = function() { if ($('musicBox')) { var xspf = { movie:this.baseHref+"andrew-horabin-music-player.swf?playlist_url="+this.baseHref+"xspf/wam.xspf&autoresume=1&autoplay=1", id:"xspf", width:"240", height:"270", majorversion:"8", build:"0", allowscriptaccess: "always", wmode: "transparent" }; UFO.create(xspf,'musicBox'); } } function cleanupFP9IELeaks() { __flash_unloadHandler = function() {}; __flash_savedUnloadHandler = function() {}; } function fixIEPNG() { var version = parseFloat(navigator.appVersion.split('MSIE')[1]); if ((version >= 5.5) && (document.body.filters)) { for(var i=0; i" img.outerHTML = strNewHTML i = i-1 } } } } function initPapercut() { Papercut.init(); } var Papercut = new Papercut(); document.observe('dom:loaded',initPapercut);