github.com/jancarloviray/community@v0.41.1-0.20170124221257-33a66c87cf2f/app/lib/intercom/index.js (about) 1 // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved. 2 // 3 // This software (Documize Community Edition) is licensed under 4 // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html 5 // 6 // You can operate outside the AGPL restrictions by purchasing 7 // Documize Enterprise Edition and obtaining a commercial license 8 // by contacting <sales@documize.com>. 9 // 10 // https://documize.com 11 12 /*jshint node:true*/ 13 module.exports = { 14 name: 'intercom', 15 16 contentFor: function (type, config) { 17 // Not using Intercom for app activity logging? 18 if (!config.APP.auditEnabled) { 19 return ''; 20 } 21 22 var appId = config.APP.intercomKey; 23 24 if ('head-footer' === type && appId.length > 0) { 25 return "<script type='text/javascript'> (function() { var w = window; var ic = w.Intercom; if (typeof ic === 'function') { ic('reattach_activator'); ic('update', intercomSettings); } else { var d = document; var i = function() { i.c(arguments) }; i.q = []; i.c = function(args) { i.q.push(args) }; w.Intercom = i; function l() { var s = d.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = 'https://widget.intercom.io/widget/${appId}'; var x = d.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x); } if (w.attachEvent) { w.attachEvent('onload', l); } else { w.addEventListener('load', l, false); } } })() </script>"; 26 } 27 }, 28 29 isDevelopingAddon: function () { 30 return true; 31 } 32 };