Skip to content

Commit

Permalink
Minification possibility
Browse files Browse the repository at this point in the history
  • Loading branch information
pratik60 committed Jan 5, 2015
1 parent b733bfc commit 4dcce5d
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions javascripts/angular-emoticons.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
(function() {
var emoticonize, filters;
// ==ClosureCompiler==
// @output_file_name default.js
// @compilation_level SIMPLE_OPTIMIZATIONS
// ==/ClosureCompiler==

emoticonize = function($sce) {
(function() {
var filters = angular.module('emoticonizeFilter', []);
filters.filter('emoticonize', ['$sce',function($sce) {
var emoticon, escapeCharacters, exclude, excludeArray, preMatch, specialEmoticons, specialRegex;
escapeCharacters = [")", "(", "*", "[", "]", "{", "}", "|", "^", "<", ">", "\\", "?", "+", "=", "."];
specialEmoticons = {
Expand Down Expand Up @@ -158,11 +162,11 @@
preMatch = '(^|[\\s\\0])';
var specialEmoticonsObject = {};
for(emoticon in specialEmoticons)
{
emoticon_new = emoticon.replace(specialRegex, '\\$1');
{
emoticon_new = emoticon.replace(specialRegex, '\\$1');
specialEmoticonsObject[emoticon] = new RegExp(preMatch + '(' + emoticon_new + ')', 'g');
}

exclude = 'span.css-emoticon';
exclude += ",pre,code,.no-emoticons";
excludeArray = exclude.split(',');
Expand All @@ -171,18 +175,15 @@

text=text.valueOf();
cssClass = 'css-emoticon';

for (emoticon in specialEmoticonsObject) {
specialCssClass = cssClass + " " + specialEmoticons[emoticon].cssClass;
text = text.replace(specialEmoticonsObject[emoticon], "$1<span class='" + specialCssClass + "'>$2</span>");
}

return $sce.trustAsHtml(text);
};
};

filters = angular.module('emoticonizeFilter', []);

filters.filter('emoticonize', emoticonize);
}]);

}).call(this);

0 comments on commit 4dcce5d

Please sign in to comment.