Browse Source

Links to other languges now configurable

dev/git-series/gccdum
Matt Godbolt 6 years ago
parent
commit
dcfaab84f1
  1. 5
      app.js
  2. 1
      etc/config/compiler-explorer.amazon.beta.properties
  3. 1
      etc/config/compiler-explorer.amazon.properties
  4. 1
      etc/config/compiler-explorer.defaults.properties
  5. 1
      etc/config/compiler-explorer.lud-mgodbolt01.properties
  6. 2
      static/index.html
  7. 17
      static/main.js

5
app.js

@ -152,6 +152,10 @@ function ClientOptionsHandler(fileSources) {
// sort source file alphabetically
sources = sources.sort(compareOn("name"));
var text = "";
var languages = _.map(gccProps("languages", '').split(':'), function (thing) {
var splat = thing.split("=");
return {language: splat[0], url: splat[1]};
});
this.setCompilers = function (compilers) {
var options = {
googleAnalyticsAccount: gccProps('clientGoogleAnalyticsAccount', 'UA-55180-6'),
@ -167,6 +171,7 @@ function ClientOptionsHandler(fileSources) {
defaultCompiler: compilerProps('defaultCompiler', ''),
compileOptions: compilerProps("options"),
supportsBinary: !!compilerProps("supportsBinary"),
languages: languages,
sources: sources,
raven: gccProps('ravenUrl', ''),
release: gitReleaseName,

1
etc/config/compiler-explorer.amazon.beta.properties

@ -0,0 +1 @@
languages=C++=//gcc.beta.godbolt.org:D=//d.beta.godbolt.org:Rust=//rust.beta.godbolt.org:Go=//go.beta.godbolt.org

1
etc/config/compiler-explorer.amazon.properties

@ -10,3 +10,4 @@ proxyRetries=300
proxyRetryMs=500
rescanCompilerSecs=600
ravenUrl=https://8e4614f649ad4e3faf3e7e8827b935f9@sentry.io/102028
languages=C++=//gcc.godbolt.org:D=//d.godbolt.org:Rust=//rust.godbolt.org:Go=//go.godbolt.org

1
etc/config/compiler-explorer.defaults.properties

@ -4,6 +4,7 @@ compileTimeoutMs=10000
defaultSource=builtin
cacheMb=50
language=C++
languages=
maxConcurrentCompiles=2
staticMaxAgeSecs=1
optionsWhitelistRe=.*

1
etc/config/compiler-explorer.lud-mgodbolt01.properties

@ -2,3 +2,4 @@ language=C++
clientURLShortener=google
rescanCompilerSecs=360
ravenUrl=https://8e4614f649ad4e3faf3e7e8827b935f9@sentry.io/102028
languages=C++=gcc:D=d:Rust=rust:Go=go

2
static/index.html

@ -46,8 +46,8 @@
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Other Languages<b class="caret"></b></a>
<!-- List filled by main.js -->
<ul class="dropdown-menu" id="languages-links">
<li class="template"><a href=""></a></li>
</ul>
</li>
<li><a href="#" id="share">Share</a></li>

17
static/main.js

@ -187,11 +187,18 @@ define(function (require) {
window.location.reload();
});
var hostName = window.location.hostname;
$('#languages-links').append('<li><a href="//gcc.' + hostName + '">C++</a></li>');
$('#languages-links').append('<li><a href="//d.' + hostName + '">D</a></li>');
$('#languages-links').append('<li><a href="//go.' + hostName + '">Go</a></li>');
$('#languages-links').append('<li><a href="//rust.' + hostName + '">Rust</a></li>');
if (options.languages) {
_.each(options.languages, function (lang) {
var links = $("#languages-links");
links.find(".template")
.clone()
.removeClass("template")
.appendTo(links)
.find('a').attr('href', lang.url).text(lang.language);
});
} else {
$("#languages-links").parent().hide();
}
}
$(start);

Loading…
Cancel
Save