diff --git a/src/config/shim.js b/src/config/shim.js index c725f0508..5b7e21c5e 100644 --- a/src/config/shim.js +++ b/src/config/shim.js @@ -70,3 +70,17 @@ })(); } })(); + +/** + * In the case of a proxied URL, we want to show a warning message + * Do that by checking for the presence of the canonical URL ([ui|dev|qa].adsabs.harvard.edu) + */ +(function checkIfProxied() { + const canonicalUrlPattern = /^(ui|qa|dev)\.adsabs\.harvard\.edu$/; + + // if test fails, it is proxied url, set a class on body element + if (!canonicalUrlPattern.test(location.hostname)) { + const [bodyEl] = document.getElementsByTagName('body'); + bodyEl.classList.add('is-proxied'); + } +})(); diff --git a/src/js/apps/discovery/main.js b/src/js/apps/discovery/main.js index cba7b3134..593a58de5 100644 --- a/src/js/apps/discovery/main.js +++ b/src/js/apps/discovery/main.js @@ -21,8 +21,16 @@ define(['config/discovery.config', 'module'], function(config, module) { 'js/components/application', 'js/mixins/discovery_bootstrap', 'js/mixins/api_access', + 'js/components/api_feedback', 'analytics', - ], function(Router, Application, DiscoveryBootstrap, ApiAccess, analytics) { + ], function( + Router, + Application, + DiscoveryBootstrap, + ApiAccess, + ApiFeedback, + analytics + ) { var updateProgress = typeof window.__setAppLoadingProgress === 'function' ? window.__setAppLoadingProgress @@ -156,10 +164,24 @@ define(['config/discovery.config', 'module'], function(config, module) { // accessibility: skip to main content $('body').on('click', '#skip-to-main-content', function() { - $('#main-content').focus(); + $('#main-content').trigger('focus'); return false; }); + // check for is-proxied class, and if present, send alert + if ($('body').hasClass('is-proxied')) { + const msg = `You are using a proxied version of ADS, we recommend you switch to the regular non-proxied URL: https://ui.adsabs.harvard.edu`; + + pubsub.publish( + pubsub.getCurrentPubSubKey(), + pubsub.ALERT, + new ApiFeedback({ + type: 'danger', + msg, + }) + ); + } + // app is loaded, send timing event if (window.__PAGE_LOAD_TIMESTAMP) { diff --git a/src/js/widgets/alerts/templates/page_top_alert.html b/src/js/widgets/alerts/templates/page_top_alert.html index 71a22efd7..9cd0f934c 100644 --- a/src/js/widgets/alerts/templates/page_top_alert.html +++ b/src/js/widgets/alerts/templates/page_top_alert.html @@ -6,7 +6,7 @@
diff --git a/src/js/widgets/resources/components/app.jsx.js b/src/js/widgets/resources/components/app.jsx.js index 55fab9b4b..cfe03a890 100644 --- a/src/js/widgets/resources/components/app.jsx.js +++ b/src/js/widgets/resources/components/app.jsx.js @@ -24,7 +24,7 @@ define(['underscore', 'react', 'prop-types'], function(_, React, PropTypes) {
{key}
{_.map(groups, (g, idx) => ( - + div { - display:inline-block; + .alert > div { + display: inline-block; vertical-align: top; } - .alert>div:first-of-type { + .alert > div:first-of-type { width: 80%; } - .alert>div:nth-of-type(2) { + .alert > div:nth-of-type(2) { width: 19%; } - } .s-tabs-widget { - - .nav-tabs>li>a { + .nav-tabs > li > a { padding: 5px 10px 10px 10px !important; color: $text-color; } - .nav-tabs>li.active>a, .nav-tabs>li.active>a:hover, .nav-tabs>li.active>a:focus { + .nav-tabs > li.active > a, + .nav-tabs > li.active > a:hover, + .nav-tabs > li.active > a:focus { h5 { color: $brand-primary-faded; } border: $border-light-default; border-bottom: none; cursor: default; - } .tab-content { @extend .s-ads-card; - box-shadow : 0 3px 5px $default-box-shadow-color; - border-top : none; + box-shadow: 0 3px 5px $default-box-shadow-color; + border-top: none; position: relative; top: -10px; border-bottom-left-radius: $border-radius-base; border-bottom-right-radius: $border-radius-base; background-color: $body-bg; } - } #backToTopBtn {