Skip to content

Commit

Permalink
Merge pull request #101 from hmrc/DDCNLS-413
Browse files Browse the repository at this point in the history
DDCNLS-413: Changed webchat implementation.
  • Loading branch information
Leanne Northrop authored Dec 6, 2016
2 parents 05b13be + ccb1ee0 commit 8484c71
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 32 deletions.
2 changes: 2 additions & 0 deletions app/config/ApplicationConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ object ApplicationConfig extends ApplicationConfig with ServicesConfig {
override val LANG_LANG_WELSH = "cy"

override val isWelshEnabled = configuration.getBoolean("welsh-translation").getOrElse(false)
lazy val webchatId = loadConfig("webchat.id")
}

trait ApplicationConfig {
Expand Down Expand Up @@ -113,4 +114,5 @@ trait ApplicationConfig {
val LANG_LANG_WELSH: String

val isWelshEnabled: Boolean
val webchatId: String
}
9 changes: 9 additions & 0 deletions app/views/includes/web_chat.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@(webchatId: String)
<script type="text/javascript" id="webchat" data-webchat-id="@webchatId">var EG_ACT_ID="@webchatId"; (function(e,f){var d,c,b,a=e.createElement("iframe");a.src="about:blank";a.title="";a.id="egot_iframe";(a.frameElement||a).style.cssText="width:0;height:0;border:0";b=e.getElementsByTagName("script");b=b[b.length-1];b.parentNode.insertBefore(a,b);try
{c=a.contentWindow.document}
catch(g)
{d=e.domain,a.src="javascript:var d=document.open();d.domain='"+d+"';void(0);",c=a.contentWindow.document}
c.open()._d=function()
{var a=this.createElement("script");d&&(this.domain=d);a.src=f;this.isEGFIF= !0;this.body.appendChild(a)}
;c.write('<body onload="document._d();">');c.close()})(document,"//analytics.analytics-egain.com/onetag/"+EG_ACT_ID);
</script>
33 changes: 3 additions & 30 deletions app/views/templates/tamc_main.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,40 +35,12 @@
@import config._
@import play.api.Play
@import play.api.Play.current

@import config.ApplicationConfig.webchatId

@scriptElement = {
<script type="text/javascript" src='@controllers.routes.Assets.at("javascripts/tamc.js")'></script>

<script type="text/javascript">

var EG_ACT_ID = "TT55004894";
(function (e, f) {
var d, c, b, a = e.createElement("iframe");
a.src = "about:blank";
a.title = "";
a.id = "egot_iframe";
(a.frameElement || a).style.cssText = "width:0;height:0;border:0";
b = e.getElementsByTagName("script");
b = b[b.length - 1];
b.parentNode.insertBefore(a, b);
try {
c = a.contentWindow.document
} catch (g) {
d = e.domain, a.src = "javascript:var d=document.open();d.domain='" + d + "';void(0);", c = a.contentWindow.document
}
c.open()._d = function () {
var a = this.createElement("script");
d && (this.domain = d);
a.src = f;
this.isEGFIF = !0;
this.body.appendChild(a)
};
c.write('<body onload="document._d();">');
c.close()
})(document, "//analytics.analytics-egain.com/onetag/" + EG_ACT_ID);

</script>

<script type="text/javascript">
function initCobrowse(){
Expand All @@ -81,6 +53,7 @@
}
</script>
}
@views.html.includes.web_chat(webchatId)


@betaBanner = {
Expand Down Expand Up @@ -191,5 +164,5 @@
}

@additionalFooterLinks = {
<li><a href="#" onclick="javascript:initCobrowse()">@Messages("generic.sharescreen")</a></li>
<li><a href="javascript:return false;" onclick="initCobrowse()">@Messages("generic.sharescreen")</a></li>
}
8 changes: 6 additions & 2 deletions conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ personal-allowance-2017 = 11500
max-limit-2017 = 45000

application.session.httpOnly=true
play.filters.headers.contentSecurityPolicy= "default-src 'self' 'unsafe-inline' localhost:9032 localhost:9250 webchat-dev.tax.service.gov.uk analytics.analytics-egain.com 'unsafe-eval' assets.digital.cabinet-office.gov.uk www.google-analytics.com data:"
play.filters.headers.contentSecurityPolicy= "default-src 'self' 'unsafe-inline' 'unsafe-eval' localhost:9032 localhost:9250 webchat-dev.tax.service.gov.uk *.analytics-egain.com stats.g.doubleclick.net assets.digital.cabinet-office.gov.uk www.google-analytics.com data:"

metrics {
name = ${appName}.
Expand Down Expand Up @@ -142,4 +142,8 @@ microservice {
}
}

}
}

webchat {
id = TT55004894
}

0 comments on commit 8484c71

Please sign in to comment.