Merge branch 'msvc-spike' of github.com:mattgodbolt/gcc-explorer into msvc-spike

dev/git-series/gccdum
Matt Godbolt 7 years ago
commit 72bdb086de

@ -23,7 +23,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
define(function (require, exports) {
define(function (require) {
"use strict";
var options = require('options');
var Raven = require('raven-js');
@ -36,6 +36,7 @@ define(function (require, exports) {
}).install();
}
var gaProxy;
if (options.googleAnalyticsEnabled) {
(function (i, s, o, g, r, a, m) {
i.GoogleAnalyticsObject = r;
@ -49,15 +50,17 @@ define(function (require, exports) {
a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
exports.ga = window.ga;
ga('create', options.googleAnalyticsAccount, 'auto');
ga('send', 'pageview');
gaProxy = function () {
window.ga.apply(window.ga, arguments);
};
} else {
exports.ga = function () {
gaProxy = function () {
};
}
exports.initialise = function () {
function initialise() {
$(function () {
function create_script_element(id, url) {
var el = document.createElement('script');
@ -84,5 +87,10 @@ define(function (require, exports) {
}(document, 'flattr_button'));
}
});
}
return {
ga: gaProxy,
initialise: initialise
};
});

@ -268,8 +268,18 @@ define(function (require) {
Compiler.prototype.onCompileResponse = function (request, result) {
this.lastResult = result;
ga('send', 'event', 'Compile', request.compiler, request.options, result.code);
ga('send', 'timing', 'Compile', 'Timing', Date.now() - request.timestamp);
ga('send', {
hitType: 'event',
eventCategory: 'Compile',
eventAction: request.compiler,
eventLabel: request.options
});
ga('send', {
hitType: 'timing',
timingCategory: 'Compile',
timingVar: request.compiler,
timingValue: Date.now() - request.timestamp
});
this.outputEditor.operation(_.bind(function () {
this.setAssembly(result.asm || fakeAsm("[no output]"));
if (request.filters.binary) {

@ -89,7 +89,12 @@ define(function (require) {
});
if (!config) {
var savedState = localStorage.getItem('gl');
var savedState = null;
try {
savedState = window.localStorage.getItem('gl');
} catch (e) {
// Some browsers in secure modes can throw exceptions here...
}
config = savedState !== null ? JSON.parse(savedState) : defaultConfig;
}
@ -104,7 +109,11 @@ define(function (require) {
}
layout.on('stateChanged', function () {
var state = JSON.stringify(layout.toConfig());
localStorage.setItem('gl', state);
try {
window.localStorage.setItem('gl', state);
} catch (e) {
// Some browsers in secure modes may throw
}
});
function sizeRoot() {

Loading…
Cancel
Save