Switching from Intercom to Olark.

master
Nick Sergeant 2014-07-21 10:36:51 -04:00
parent f456539993
commit a004d49470
3 changed files with 23 additions and 48 deletions

View File

@ -14,7 +14,7 @@
{% block page-description %}{% endblock %}
{% block rochester-made %}{% endblock %}
{% block keyboard-shortcuts %}{% endblock %}
{% block intercom %}{% endblock %}
{% block olark %}{% endblock %}
{% block js %}
{{ block.super }}
window.blog_post = true;

View File

@ -1,4 +1,4 @@
{% load snipt_tags intercom %}
{% load snipt_tags %}
<!DOCTYPE html>
<html lang="en" class="{% block html-class %}{% endblock %}" ng-app="Snipt">
@ -419,42 +419,27 @@
{% endblock %}
{% if request.user.profile.get_account_age <= 7 or request.user.profile.is_pro %}
{% if not debug %}
{% block intercom %}
<script id="IntercomSettingsScriptTag">
var intercomSettings = {
app_id: 'sajf131y',
user_id: {{ request.user.id }},
user_hash: '{{ request.user.id|intercom_sha_256 }}',
email: '{{ request.user.email }}',
created_at: {{ request.user.date_joined|date:"U" }},
custom_data: {
'snipts count': {% snipts_count_for_user %},
'profile link': 'https://snipt.net/{{ request.user.username }}/',
'is pro': window.user_is_pro,
'blog domain': '{{ request.user.profile.blog_domain }}',
'pro date': {% firstof request.user.profile.pro_date|date:"U" 'null' %},
},
widget: {
activator: '#IntercomDefaultWidget'
}
};
</script>
<script>
(function() {
function async_load() {
var s = document.createElement('script');
s.type = 'text/javascript'; s.async = true;
s.src = 'https://static.intercomcdn.com/intercom.v1.js';
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
if (window.attachEvent) {
window.attachEvent('onload', async_load);
} else {
window.addEventListener('load', async_load, false);
}
})();
</script>
{% block olark %}
<!-- begin olark code -->
<script data-cfasync="false" type='text/javascript'>/*<![CDATA[*/window.olark||(function(c){var f=window,d=document,l=f.location.protocol=="https:"?"https:":"http:",z=c.name,r="load";var nt=function(){
f[z]=function(){
(a.s=a.s||[]).push(arguments)};var a=f[z]._={
},q=c.methods.length;while(q--){(function(n){f[z][n]=function(){
f[z]("call",n,arguments)}})(c.methods[q])}a.l=c.loader;a.i=nt;a.p={
0:+new Date};a.P=function(u){
a.p[u]=new Date-a.p[0]};function s(){
a.P(r);f[z](r)}f.addEventListener?f.addEventListener(r,s,false):f.attachEvent("on"+r,s);var ld=function(){function p(hd){
hd="head";return["<",hd,"></",hd,"><",i,' onl' + 'oad="var d=',g,";d.getElementsByTagName('head')[0].",j,"(d.",h,"('script')).",k,"='",l,"//",a.l,"'",'"',"></",i,">"].join("")}var i="body",m=d[i];if(!m){
return setTimeout(ld,100)}a.P(1);var j="appendChild",h="createElement",k="src",n=d[h]("div"),v=n[j](d[h](z)),b=d[h]("iframe"),g="document",e="domain",o;n.style.display="none";m.insertBefore(n,m.firstChild).id=z;b.frameBorder="0";b.id=z+"-loader";if(/MSIE[ ]+6/.test(navigator.userAgent)){
b.src="javascript:false"}b.allowTransparency="true";v[j](b);try{
b.contentWindow[g].open()}catch(w){
c[e]=d[e];o="javascript:var d="+g+".open();d.domain='"+d.domain+"';";b[k]=o+"void(0);"}try{
var t=b.contentWindow[g];t.write(p());t.close()}catch(x){
b[k]=o+'d.write("'+p().replace(/"/g,String.fromCharCode(92)+'"')+'");d.close();'}a.P(2)};ld()};nt()})({
loader: "static.olark.com/jsclient/loader0.js",name:"olark",methods:["configure","extend","declare","identify"]});
/* custom configuration goes here (www.olark.com/documentation) */
olark.identify('9104-133-10-2665');/*]]>*/</script><noscript><a href="https://www.olark.com/site/9104-133-10-2665/contact" title="Contact us" target="_blank">Questions? Feedback?</a> powered by <a href="http://www.olark.com?welcome" title="Olark live chat software">Olark live chat software</a></noscript>
<!-- end olark code -->
{% endblock %}
{% endif %}
{% endif %}

View File

@ -1,10 +0,0 @@
from django import template
from settings_local import INTERCOM_SECRET_KEY
import hmac, hashlib
register = template.Library()
@register.filter
def intercom_sha_256(user_id):
return hmac.new(INTERCOM_SECRET_KEY, str(user_id), digestmod=hashlib.sha256).hexdigest()