/* * Material Experience - Card Layout Engines Class * * EYEMG - Interactive Media Group * Created by Mike Crute (mcrute@eyemg.com) * Updated by Mike Crute (mcrute@eyemg.com) on 9/26/07 */ Card.Layout.Custom = Class.create(); Object.extend(Object.extend(Card.Layout.Custom.prototype, Card.Layout.prototype), { /* * Initialize the layout class */ initialize: function(cframe, data, card) { this.cframe = cframe; this.data = data; this.card = card; this.color = this.card.options.color; this.hasResources = false; this.inited = false; }, /* * Create custom scroll bars for an HTML element. */ scrollify: function(div, isiframe) { var div2 = null; // Inherit the color from a link var color = $$('ul#navigation li a')[0].getStyle('background-color'); if (isiframe) { div2 = div.contentWindow.document.documentElement; } else { div2 = div; } // Create the scroll container and draggable widget this.cframe.appendChild( this.scrollCont = Builder.node('div', { style: 'border-left: 1px solid ' + color + ';' + 'width: 1px; position: absolute; ' + 'height:' + div.offsetHeight + 'px; ' + 'top: 10px;' + 'left: ' + (div.offsetLeft + div.offsetWidth + 12) + 'px;' }, this.scrollBar = Builder.node('img', { src: 'http://materialexperience.santoprene.com/images/pill.gif', style: 'display: block; margin-left: -3px; cursor: move; ' + 'background: ' + color + '; padding: 0px;' }) )); // Create the scroller this.scroller = new Control.Slider(this.scrollBar, this.scrollCont, { axis: 'vertical', range: $R(0, div2.scrollHeight), onSlide: function(value) { div2.scrollTop = Math.floor(value); }.bind(this) }); new PeriodicalExecuter(function() { // Hide the scroller if there isn't a need for it if (div2.scrollHeight > 480) { this.scrollCont.show(); } else { this.scrollCont.hide(); return; } // Update the scroller range when the contents change this.scroller.range = $R(0, div2.scrollHeight); // Move the scroller when the scrolled element changes // (e.g. linking down into the page). if (this.scroller.value != div2.scrollTop) { this.scroller.setValue(div2.scrollTop); } }.bind(this), 1); }, initIframe: function(url) { $('wideCol').innerHTML = ''; }, /* * Main function to layout the card. */ layout: function() { var htmlstr = '