// basic test thing - ch window.testCall = function(){ return { account:s_account, pageName:s_msn.pageName, pageURL:s_msn.pageURL, dc:s_msn.dc, visitorNamespace:s_msn.visitorNamespace }; }; msnbc.modules.BasicInteractive = msnbc.modules.Module.extend({ setup: function(data, container){ // the short name is used for URL commands and the share link this.SHORT_NAME = 'dt'; // setup instance properties ... this.rendered = false; // the data parameter passed above to setup() is an object // it contains the moduleData specific to this module this.data = data; // the container parameter is the instance of the container class // all modules are attached to containers this.markup = container.markup; this.title = container.title; // workaround because handler for FlashAnimation is broken this.options = this.matchOptions(this.data.content[0].data); if (!this.options) {msnbc.warn('bad settings for BasicInteractive'); return;} var embedParams = {}; var flashvars = {}; jQuery.each(this.options, function(k,v){ if (k.match( /allowscriptaccess|allowfullscreen|wmode|flashvars|play|loop|menu|quality|scale|align|salign|bgcolor|base|src|movie|width|height/i)) { embedParams[k]=v; } else { flashvars[k]=v; } }); embedParams.flashvars = flashvars; // prepare the embed this.flash = this.addComponent("msnbc.components.FlashComponent"); this.flash.setupEmbedParameters({ "embedParams" : embedParams }); // setup share links this.shareMenu = this.addComponent("msnbc.components.ShareMenu"); this.shareMenu.setup($(this.title).text(), new msnbc.misc.URLCommand(this.SHORT_NAME)); this.shareMenu.insert($(this.title).parent()); }, render: function(){ if (this.rendered) return; if ($(this.markup).find('.getFlash').length > 0) { //hide noscript content $(this.markup).find('.getFlash').remove(); } // insert the flash embed, which was defined above in setup this.flash.insertOn(this.markup); this.rendered = true; }, // You can ignore this special workaround. We won't need it once an XSL bug is fixed matchOptions: function(text){ if (!text) return false; var options = {}; var sets = text.match(/(\S+)\s*?[\:=]\s*?(\S+)/g); if (sets) { for (var i=0; i < sets.length; i++) { var kv = sets[i].match(/(\S+)\s*?[\:=]\s*?(\S+)/); options[kv[1]] = kv[2]; } } else { // something's messed up in the input or the regex } return options; }, // if we wanted to pass parameters to our interactive, // based on cookie settings or URL commands, we'd do so here handleURLParams: function(params){ msnbc.log('[modules.BasicInteractive::handleURLParams] sent params'); }, // this function defines the module methods which handle URL commands and cookie settings getInterface: function(){ return { names: this.SHORT_NAME, commands: { generic: function(params) { this.handleURLParams(params); } } }; }, // this function returns the parameters used to render this module's tease in the story nav and floating nav getNavTease: function(nav){ return { "label": 'Data', "icon": 'data', "abstract": this.options.tease || '', "title": $(this.title).find('span.subhead').text(), "href": "#data", "source": this.data.content[0].source || '' }; } });