Ext.ns('DJIndexes'); DJIndexes.PdfOpener = function(){ var handleClick = function(e, t, o){ e.stopEvent(); e.stopPropagation(); if (t.parentNode.href) { popitup(t.parentNode.href, o); } else { if (t.href) { popitup(t.href, o); } } }; var popitup = function(url, options){ try { var gaCategory = 'PDF'; var gaAction = 'download'; if (options && options.gaCategory) { gaCategory = options.gaCategory; } if (options && options.gaAction) { gaAction = options.gaAction; } _gaq.push(['_setAccount', 'UA-15849120-1'], ['_trackEvent', gaCategory, gaAction, url]); } catch (e) { if (console) { console.error(e); console.debug(e); } } var newwindow = window.open(url, '', 'resizable=1,location=1,menubar=1,scrollbars=1,status=1,toolbar=1'); if (window.focus) { newwindow.focus(); } }; return { init: function(root, gaCategory, gaAction){ var options = { stopEvent: true, stopPropagation: true, preventDefault: true, gaCategory: gaCategory, gaAction: gaAction }; if (root) { Ext.select('*[href *=.pdf]', false, root).on(eventName = 'click', fn = handleClick, options = options); Ext.select('*[href *=.Pdf]', false, root).on(eventName = 'click', fn = handleClick, options = options); Ext.select('*[href *=.PDF]', false, root).on(eventName = 'click', fn = handleClick, options = options); } else { Ext.select('*[href *=.pdf]').on(eventName = 'click', fn = handleClick, options = options); Ext.select('*[href *=.Pdf]').on(eventName = 'click', fn = handleClick, options = options); Ext.select('*[href *=.PDF]').on(eventName = 'click', fn = handleClick, options = options); } } }; }(); Ext.onReady(DJIndexes.PdfOpener.init, DJIndexes.PdfOpener); DJIndexes.ExcelTracker = function(){ var handleClick = function(e, t, o){ e.stopEvent(); e.stopPropagation(); if (t.parentNode.href) { popitup(t.parentNode.href, o); } else { if (t.href) { popitup(t.href, o); } } }; var popitup = function(url, options){ try { var gaCategory = 'EXCEL'; var gaAction = 'download'; if (options && options.gaCategory) { gaCategory = options.gaCategory; } if (options && options.gaAction) { gaAction = options.gaAction; } _gaq.push(['_setAccount', 'UA-15849120-1'], ['_trackEvent', gaCategory, gaAction, url]); } catch (e) { if (console) { console.error(e); console.debug(e); } } window.location = url; }; return { init: function(root, gaCategory, gaAction){ var options = { stopEvent: true, stopPropagation: true, preventDefault: true, gaCategory: gaCategory, gaAction: gaAction }; if (root) { Ext.select('*[href *=.xls]', false, root).on(eventName = 'click', fn = handleClick, options = options); Ext.select('*[href *=.xlsx]', false, root).on(eventName = 'click', fn = handleClick, options = options); Ext.select('*[href *=.Xls]', false, root).on(eventName = 'click', fn = handleClick, options = options); Ext.select('*[href *=.Xlsx]', false, root).on(eventName = 'click', fn = handleClick, options = options); Ext.select('*[href *=.XLS]', false, root).on(eventName = 'click', fn = handleClick, options = options); Ext.select('*[href *=.XLSX]', false, root).on(eventName = 'click', fn = handleClick, options = options); } else { Ext.select('*[href *=.xls]').on(eventName = 'click', fn = handleClick, options = options); Ext.select('*[href *=.xlsx]').on(eventName = 'click', fn = handleClick, options = options); Ext.select('*[href *=.Xls]').on(eventName = 'click', fn = handleClick, options = options); Ext.select('*[href *=.Xlsx]').on(eventName = 'click', fn = handleClick, options = options); Ext.select('*[href *=.XLS]').on(eventName = 'click', fn = handleClick, options = options); Ext.select('*[href *=.XLSX]').on(eventName = 'click', fn = handleClick, options = options); } } }; }(); Ext.onReady(DJIndexes.ExcelTracker.init, DJIndexes.ExcelTracker);