Skip to content

Instantly share code, notes, and snippets.

@dandiebolt
Created July 24, 2015 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dandiebolt/4d01194ac91a6ae51279 to your computer and use it in GitHub Desktop.
Save dandiebolt/4d01194ac91a6ae51279 to your computer and use it in GitHub Desktop.
(function(){
var querystring=document.location.search;
if(/a=er/i.test(querystring) || /nwr/i.test(querystring)) {
data = [{
name: "smile",
image: "https://djyqr7fxk5rha.cloudfront.net/smile.png"
}, {
name: "relieved",
image: "https://djyqr7fxk5rha.cloudfront.net/relieved.png"
}, {
name: "joy",
image: "https://djyqr7fxk5rha.cloudfront.net/joy.png"
}, {
name: "+1",
image: "https://djyqr7fxk5rha.cloudfront.net/%2B1.png"
}, {
name: "-1",
image: "https://djyqr7fxk5rha.cloudfront.net/-1.png"
}];
var smilieToMarkup = {};
data.forEach(function(item, index) {
smilieToMarkup[item.name] = "<img src='" + item.image + "'>";
});
$(_fid_7).on("blur", function() {
this.value = this.value
.replace(/:(.+?):/g, function($0, $1) {
return smilieToMarkup[$1];
});
});
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment