/* Copyright 2012 Yu-Jie Lin * MIT License */ function GAWR(options) { var self = this; // ----- this.report = function(entry) { // Google Analytics function _report() { var _gaq = window._gaq || []; _gaq.push(['_setAccount', self.model.UA]); if (!self.model.page_tracked) { _gaq.push(['_trackPageview']); self.model.page_tracked = true; } _gaq.push(['_trackEvent', 'report', entry.issue, entry.info]) if (!window._gaq) window._gaq = _gaq; } if (window._gaq) { _report(); } else { $.ajaxSetup({cache: true}); $.getScript(('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js', _report); $.ajaxSetup({cache: false}); } self.view.report_sent(); } // ----- this.model = new GAWRModel(options); this.view = new GAWRView(options.target, this.model, this); } function GAWRModel(options) { var self = this; // ----- // ----- this.UA = options.UA; this.report_options = options.report_options; this.page_tracked = false; } function GAWRView(target, model, control) { var self = this; // ----- this.create_form = function() { var $target = $('#' + self.target).empty(); var $div = $('
'); $('