From d00e5b5f019a90d07915e780ff03ef16086b47d3 Mon Sep 17 00:00:00 2001 From: Tom Ladendorf Date: Thu, 23 Feb 2017 20:18:59 +0100 Subject: [PATCH 1/4] package.json update --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fae7efa46..a4213feca 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "appirio-styles": "0.x.x", "appirio-tech-ng-iso-constants": "^1.0.6", "appirio-tech-ng-ui-components": "^2.1.2", - "appirio-tech-react-components": "appirio-tech/react-components.git#cl-misc-fixes-3", + "appirio-tech-react-components": "appirio-tech/react-components.git#challenge-listings", "auth0-angular": "^4.1.0", "auth0-js": "^6.8.0", "d3": "^3.5.14", From 5025acf30c40db8c588e2f0dfdff652ef6f2fb43 Mon Sep 17 00:00:00 2001 From: Tom Ladendorf Date: Wed, 1 Mar 2017 20:23:59 +0100 Subject: [PATCH 2/4] Route checking to limit usersnap component to listings page --- app/index.jade | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/index.jade b/app/index.jade index 24cddfb2d..174adc271 100644 --- a/app/index.jade +++ b/app/index.jade @@ -18,15 +18,17 @@ html })(document); script. - (function() { - var s = document.createElement("script"); - s.type = "text/javascript"; - s.async = true; - s.src = '//api.usersnap.com/load/'+ - '3e7c8f0c-6cf6-41b6-9f2c-e8e4e60dfc59.js'; - var x = document.getElementsByTagName('script')[0]; - x.parentNode.insertBefore(s, x); - })(); + if (location.href.match(/listings\/$/)) { + (function() { + var s = document.createElement("script"); + s.type = "text/javascript"; + s.async = true; + s.src = '//api.usersnap.com/load/'+ + '3e7c8f0c-6cf6-41b6-9f2c-e8e4e60dfc59.js'; + var x = document.getElementsByTagName('script')[0]; + x.parentNode.insertBefore(s, x); + })(); + } include ../assets/scripts/google.analytics.jade include ../assets/scripts/zendesk-widget.jade From 2e8366ff0eaad917f4250e2c79064d9cbfda81bb Mon Sep 17 00:00:00 2001 From: Tom Ladendorf Date: Wed, 1 Mar 2017 20:28:40 +0100 Subject: [PATCH 3/4] more elegant solution --- app/index.jade | 13 ------------- app/listings/listings.controller.js | 12 ++++++++++++ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/app/index.jade b/app/index.jade index 174adc271..b81faede9 100644 --- a/app/index.jade +++ b/app/index.jade @@ -17,19 +17,6 @@ html h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='https://use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s) })(document); - script. - if (location.href.match(/listings\/$/)) { - (function() { - var s = document.createElement("script"); - s.type = "text/javascript"; - s.async = true; - s.src = '//api.usersnap.com/load/'+ - '3e7c8f0c-6cf6-41b6-9f2c-e8e4e60dfc59.js'; - var x = document.getElementsByTagName('script')[0]; - x.parentNode.insertBefore(s, x); - })(); - } - include ../assets/scripts/google.analytics.jade include ../assets/scripts/zendesk-widget.jade include ../assets/scripts/raven-js.jade diff --git a/app/listings/listings.controller.js b/app/listings/listings.controller.js index ee1c87791..78cc488b7 100755 --- a/app/listings/listings.controller.js +++ b/app/listings/listings.controller.js @@ -24,6 +24,18 @@ import { loadUser } from '../services/userv3.service.js' activate() function activate() { + + // add usersnap widget to /listings/ route + (function() { + var s = document.createElement("script"); + s.type = "text/javascript"; + s.async = true; + s.src = '//api.usersnap.com/load/'+ + '3e7c8f0c-6cf6-41b6-9f2c-e8e4e60dfc59.js'; + var x = document.getElementsByTagName('script')[0]; + x.parentNode.insertBefore(s, x); + })(); + $scope.myChallenges = [] $scope.reactProps = { config: CONSTANTS, From 5cd7324af60875cdfc4057f821f3be50a9b2bbbb Mon Sep 17 00:00:00 2001 From: Tom Ladendorf Date: Wed, 1 Mar 2017 20:36:53 +0100 Subject: [PATCH 4/4] fixed lint errors --- app/listings/listings.controller.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/listings/listings.controller.js b/app/listings/listings.controller.js index 78cc488b7..d6428e864 100755 --- a/app/listings/listings.controller.js +++ b/app/listings/listings.controller.js @@ -27,14 +27,14 @@ import { loadUser } from '../services/userv3.service.js' // add usersnap widget to /listings/ route (function() { - var s = document.createElement("script"); - s.type = "text/javascript"; - s.async = true; + var s = document.createElement('script') + s.type = 'text/javascript' + s.async = true s.src = '//api.usersnap.com/load/'+ - '3e7c8f0c-6cf6-41b6-9f2c-e8e4e60dfc59.js'; - var x = document.getElementsByTagName('script')[0]; - x.parentNode.insertBefore(s, x); - })(); + '3e7c8f0c-6cf6-41b6-9f2c-e8e4e60dfc59.js' + var x = document.getElementsByTagName('script')[0] + x.parentNode.insertBefore(s, x) + })() $scope.myChallenges = [] $scope.reactProps = {