remove unnessary(?) things from charmscout script
This commit is contained in:
parent
0f6a6a9551
commit
351cf8078d
|
@ -32,6 +32,7 @@ app.import('bower_components/JavaScript-MD5/js/md5.js');
|
||||||
app.import('vendor/ansiparse.js');
|
app.import('vendor/ansiparse.js');
|
||||||
app.import('vendor/log.js');
|
app.import('vendor/log.js');
|
||||||
app.import('vendor/customerio.js');
|
app.import('vendor/customerio.js');
|
||||||
|
app.import('vendor/charmscout.js');
|
||||||
app.import('bower_components/moment/moment.js');
|
app.import('bower_components/moment/moment.js');
|
||||||
// Use `app.import` to add additional libraries to the generated
|
// Use `app.import` to add additional libraries to the generated
|
||||||
// output files.
|
// output files.
|
||||||
|
|
|
@ -6,7 +6,8 @@ initialize = (container, app) ->
|
||||||
key: config.charmKey
|
key: config.charmKey
|
||||||
url: "https://charmscout.herokuapp.com/feedback"
|
url: "https://charmscout.herokuapp.com/feedback"
|
||||||
|
|
||||||
$('head').append $('<script src="https://charmscout.herokuapp.com/charmeur.js?v=2" async defer></script>')
|
window.bootstrapCharm()
|
||||||
|
# $('head').append $('<script src="https://charmscout.herokuapp.com/charmeur.js?v=2" async defer></script>')
|
||||||
|
|
||||||
Initializer =
|
Initializer =
|
||||||
name: 'charm'
|
name: 'charm'
|
||||||
|
|
|
@ -1,3 +1,74 @@
|
||||||
|
.feedback-button
|
||||||
|
display: inline-block
|
||||||
|
position: fixed
|
||||||
|
right: 0
|
||||||
|
left: auto
|
||||||
|
// top: 35%
|
||||||
|
bottom: 0
|
||||||
|
margin: 0
|
||||||
|
padding: 1.5em 1em .5em
|
||||||
|
border-radius: 4px
|
||||||
|
// transform: rotate(90deg) translateY(-140%)
|
||||||
|
will-change: transform
|
||||||
|
transition: transform ease 200ms
|
||||||
|
background: $white
|
||||||
|
font-size: 13px
|
||||||
|
color: #a2afb3
|
||||||
|
text-transform: uppercase
|
||||||
|
box-shadow: 0px 0px 3px 1px rgba(0,0,0,0.15)
|
||||||
|
z-index: 999
|
||||||
|
|
||||||
|
.feedback-button:hover
|
||||||
|
// transform: rotate(90deg) translateY(-130%)
|
||||||
|
|
||||||
|
.feedback-popup
|
||||||
|
position: fixed
|
||||||
|
top: 50%
|
||||||
|
left: 50%
|
||||||
|
width: 30em
|
||||||
|
transform: translate(-50%, -50%)
|
||||||
|
padding: 1em 1.3em
|
||||||
|
background-color: #ffffff
|
||||||
|
border-radius: 5px
|
||||||
|
z-index: 999
|
||||||
|
box-shadow: 0px 0px 3px 1px rgba(0,0,0,0.15)
|
||||||
|
h1
|
||||||
|
margin: 0 0 .4em
|
||||||
|
padding-left: .4em
|
||||||
|
color: #347389
|
||||||
|
font-size: 20px
|
||||||
|
textarea
|
||||||
|
box-sizing: border-box
|
||||||
|
display: block
|
||||||
|
width: 100%
|
||||||
|
height: 10em
|
||||||
|
margin-bottom: .8em
|
||||||
|
padding: .5em .6em
|
||||||
|
resize: vertical
|
||||||
|
background-color: #f4f3eb
|
||||||
|
font-size: 15px
|
||||||
|
color: #7d7e80
|
||||||
|
border: none
|
||||||
|
font-family: $font-family-sans-serif
|
||||||
|
.submit
|
||||||
|
margin-right: 1em
|
||||||
|
padding: .3em .7em
|
||||||
|
background-color: #37a766
|
||||||
|
color: $white
|
||||||
|
font-size: 15px
|
||||||
|
border: none
|
||||||
|
border-radius: 4px
|
||||||
|
font-family: $font-family-sans-serif
|
||||||
|
cursor: pointer
|
||||||
|
a
|
||||||
|
color: #7d7e80
|
||||||
|
font-size: 15px
|
||||||
|
text-decoration: none
|
||||||
|
a:hover
|
||||||
|
text-decoration: underline
|
||||||
|
|
||||||
|
#CHARM_FORM_TARGET
|
||||||
|
display: none
|
||||||
|
|
||||||
.feedback-button
|
.feedback-button
|
||||||
display: none
|
display: none
|
||||||
|
|
115
vendor/charmscout.js
vendored
115
vendor/charmscout.js
vendored
|
@ -1,81 +1,9 @@
|
||||||
// Copyright (c) 2010-2012 Slash7 LLC http://charmhq.com/
|
// Copyright (c) 2010-2012 Slash7 LLC http://charmhq.com/
|
||||||
// Copyright (c) 2010-2012 Thomas Fuchs http://mir.aculo.us/
|
// Copyright (c) 2010-2012 Thomas Fuchs http://mir.aculo.us/
|
||||||
// License: https://github.com/cheerful/charmeur/blob/master/MIT-LICENSE
|
// License: https://github.com/cheerful/charmeur/blob/master/MIT-LICENSE
|
||||||
(function(){
|
|
||||||
|
window.bootstrapCharm = function(){
|
||||||
var tab, box, email, shown = false, sending = false, openmsg = null, callbacks = {},
|
var tab, box, email, shown = false, sending = false, openmsg = null, callbacks = {},
|
||||||
VENDORS = ['webkit','moz','o','ms'],
|
|
||||||
STYLE =
|
|
||||||
'.feedback-button {' +
|
|
||||||
' display: inline-block;' +
|
|
||||||
' position: fixed;' +
|
|
||||||
' right: 0;' +
|
|
||||||
' left: auto;' +
|
|
||||||
' top: 35%;' +
|
|
||||||
' margin: 0;' +
|
|
||||||
' padding: 1.5em 1em .5em;' +
|
|
||||||
' border-radius: 4px;' +
|
|
||||||
' transform: rotate(90deg) translateY(-140%);' +
|
|
||||||
' will-change: transform;' +
|
|
||||||
' transition: transform ease 200ms;' +
|
|
||||||
' background: #ffffff;' +
|
|
||||||
' font-size: 13px;' +
|
|
||||||
' color: #a2afb3;' +
|
|
||||||
' text-transform: uppercase;' +
|
|
||||||
' box-shadow: 0px 0px 3px 1px rgba(0,0,0,0.15);' +
|
|
||||||
'}' +
|
|
||||||
'.feedback-button:hover {' +
|
|
||||||
' transform: rotate(90deg) translateY(-130%);' +
|
|
||||||
'}' +
|
|
||||||
'.feedback-popup {' +
|
|
||||||
' position: fixed;' +
|
|
||||||
' top: 50%;' +
|
|
||||||
' left: 50%;' +
|
|
||||||
' width: 30em;' +
|
|
||||||
' transform: translate(-50%, -50%);' +
|
|
||||||
' padding: 1em 1.3em;' +
|
|
||||||
' background-color: #ffffff;' +
|
|
||||||
' border-radius: 5px;' +
|
|
||||||
' z-index: 999;'
|
|
||||||
' box-shadow: 0px 0px 3px 1px rgba(0,0,0,0.15);' +
|
|
||||||
' }' +
|
|
||||||
' .feedback-popup h1 {' +
|
|
||||||
' margin: 0 0 .4em;' +
|
|
||||||
' padding-left: .4em;' +
|
|
||||||
' color: #347389;' +
|
|
||||||
' font-size: 20px;' +
|
|
||||||
' }' +
|
|
||||||
' .feedback-popup textarea {' +
|
|
||||||
' box-sizing: border-box;' +
|
|
||||||
' display: block;' +
|
|
||||||
' width: 100%;' +
|
|
||||||
' height: 10em;' +
|
|
||||||
' margin-bottom: .8em;' +
|
|
||||||
' padding: .5em .6em;' +
|
|
||||||
' resize: vertical;' +
|
|
||||||
' background-color: #f4f3eb;' +
|
|
||||||
' font-size: 15px;' +
|
|
||||||
' color: #7d7e80;' +
|
|
||||||
' border: none;' +
|
|
||||||
' font-family: "Source Sans Pro", Helvetica, sans-serif;' +
|
|
||||||
' }' +
|
|
||||||
' .feedback-popup .submit {' +
|
|
||||||
' margin-right: 1em;' +
|
|
||||||
' padding: .3em .7em;' +
|
|
||||||
' background-color: #37a766;' +
|
|
||||||
' color: #ffffff;' +
|
|
||||||
' font-size: 15px;' +
|
|
||||||
' border: none;' +
|
|
||||||
' border-radius: 4px;' +
|
|
||||||
' font-family: "Source Sans Pro", Helvetica, sans-serif;' +
|
|
||||||
' }' +
|
|
||||||
' .feedback-popup a {' +
|
|
||||||
' color: #7d7e80;' +
|
|
||||||
' font-size: 15px;' +
|
|
||||||
' text-decoration: none;' +
|
|
||||||
' }' +
|
|
||||||
' .feedback-popup a:hover {' +
|
|
||||||
' text-decoration: underline;' +
|
|
||||||
' }',
|
|
||||||
BOX =
|
BOX =
|
||||||
'<div class="feedback-popup">' +
|
'<div class="feedback-popup">' +
|
||||||
'<h1>Have feedback or questions?</h1>' +
|
'<h1>Have feedback or questions?</h1>' +
|
||||||
|
@ -84,8 +12,8 @@
|
||||||
'<div id="CHARM_YOUR_EMAIL"></div>'+
|
'<div id="CHARM_YOUR_EMAIL"></div>'+
|
||||||
'<div id="CHARM_YOUR_COMMENT"></div>'+
|
'<div id="CHARM_YOUR_COMMENT"></div>'+
|
||||||
'<textarea id="CHARM_COMMENT" name="content" class="ignore-return-pressed" placeholder="Let us know and we will get right back to you by email"></textarea>' +
|
'<textarea id="CHARM_COMMENT" name="content" class="ignore-return-pressed" placeholder="Let us know and we will get right back to you by email"></textarea>' +
|
||||||
'<input id="CHARM_SUBMIT" type="submit" class="submit" value="">' +
|
'<input id="CHARM_SUBMIT" type="submit" class="submit" value="Send Feedback">' +
|
||||||
'<a href="#" title="" id="CHARM_CANCEL"></a>' +
|
'<a href="#" title="" id="CHARM_CANCEL">cancel</a>' +
|
||||||
'</form>' +
|
'</form>' +
|
||||||
'</div>',
|
'</div>',
|
||||||
DEFAULTS = {
|
DEFAULTS = {
|
||||||
|
@ -99,14 +27,6 @@
|
||||||
feedback_error: 'There was a problem sending your message.<br/>Please contact support directly.<br/><br/>close this message'
|
feedback_error: 'There was a problem sending your message.<br/>Please contact support directly.<br/><br/>close this message'
|
||||||
};
|
};
|
||||||
|
|
||||||
function vendored(property, value){
|
|
||||||
var string = '';
|
|
||||||
for(var i=0;i<VENDORS.length;i++)
|
|
||||||
string += '-'+VENDORS[i]+'-'+property+":"+value+';';
|
|
||||||
string += property+":"+value+';';
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
|
|
||||||
function log(s){
|
function log(s){
|
||||||
'console' in window && 'log' in console && console.log(s);
|
'console' in window && 'log' in console && console.log(s);
|
||||||
}
|
}
|
||||||
|
@ -122,19 +42,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function $(id){ return typeof id == 'string' ? document.getElementById(id) : id; }
|
function $(id){ return typeof id == 'string' ? document.getElementById(id) : id; }
|
||||||
function css(id,style){ $(id).style.cssText += ';' + style; }
|
|
||||||
|
|
||||||
function csstag(styles){
|
|
||||||
var css = document.createElement('style');
|
|
||||||
css.setAttribute('type','text/css');
|
|
||||||
if('styleSheet' in css)
|
|
||||||
css.styleSheet.cssText = styles;
|
|
||||||
else
|
|
||||||
css.innerHTML = styles;
|
|
||||||
|
|
||||||
document.getElementsByTagName('head')[0].appendChild(css);
|
|
||||||
}
|
|
||||||
|
|
||||||
function init(){
|
function init(){
|
||||||
tab = document.createElement('a');
|
tab = document.createElement('a');
|
||||||
tab.id = "CHARM_TAB";
|
tab.id = "CHARM_TAB";
|
||||||
|
@ -143,7 +51,6 @@
|
||||||
tab.href = "https://secure.charmhq.com/feedback/" + __CHARM.key;
|
tab.href = "https://secure.charmhq.com/feedback/" + __CHARM.key;
|
||||||
tab.onclick = function(){ show(); return false };
|
tab.onclick = function(){ show(); return false };
|
||||||
document.body.appendChild(tab);
|
document.body.appendChild(tab);
|
||||||
csstag(STYLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function template(string){
|
function template(string){
|
||||||
|
@ -207,16 +114,16 @@
|
||||||
userdata('email');
|
userdata('email');
|
||||||
}
|
}
|
||||||
|
|
||||||
customize('text');
|
// customize('text');
|
||||||
customize('submit', 'value');
|
// customize('submit', 'value');
|
||||||
customize('cancel');
|
// customize('cancel');
|
||||||
|
|
||||||
userdata('key');
|
userdata('key');
|
||||||
userdata('customer');
|
userdata('customer');
|
||||||
userdata('customer_info');
|
userdata('customer_info');
|
||||||
userdata('first_name');
|
userdata('first_name');
|
||||||
userdata('last_name');
|
userdata('last_name');
|
||||||
userdata('user_info');
|
userdata('user_info');
|
||||||
userdata('customer_id');
|
userdata('customer_id');
|
||||||
userdata('subject');
|
userdata('subject');
|
||||||
|
|
||||||
|
@ -232,7 +139,6 @@
|
||||||
var scrollTop = document.body.scrollTop;
|
var scrollTop = document.body.scrollTop;
|
||||||
|
|
||||||
box.className = 'open' + ($('CHARM_YOUR_EMAIL') ? ' with-email' : '');
|
box.className = 'open' + ($('CHARM_YOUR_EMAIL') ? ' with-email' : '');
|
||||||
css(box, 'display:block');
|
|
||||||
$('CHARM_FORM').onsubmit = function(){
|
$('CHARM_FORM').onsubmit = function(){
|
||||||
var ok = !($('CHARM_COMMENT').value.replace(/^\s+/, '').replace(/\s+$/, '') == "");
|
var ok = !($('CHARM_COMMENT').value.replace(/^\s+/, '').replace(/\s+$/, '') == "");
|
||||||
if(ok){
|
if(ok){
|
||||||
|
@ -255,7 +161,6 @@
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
css(box, 'display:block');
|
|
||||||
box.offsetLeft;
|
box.offsetLeft;
|
||||||
box.className = 'open' + ($('CHARM_YOUR_EMAIL') ? ' with-email' : '');
|
box.className = 'open' + ($('CHARM_YOUR_EMAIL') ? ' with-email' : '');
|
||||||
if($('CHARM_EMAIL'))
|
if($('CHARM_EMAIL'))
|
||||||
|
@ -341,4 +246,4 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
init();
|
init();
|
||||||
})();
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user