Commit d165619c authored by Madhur's avatar Madhur

src folder for master branch

parent c3a0389e
/*! Angular Emoji 1.0.0 2014-12-26 */
span.emoji {
display: -moz-inline-box;
-moz-box-orient: vertical;
display: inline-block;
vertical-align: baseline;
*vertical-align: auto;
*zoom: 1;
*display: inline;
width: 1em;
height: 1em;
background-size: 1em;
background-repeat: no-repeat;
text-indent: -9999px;
}
span.emoji-sizer {
line-height: 0.81em;
font-size: 1em;
margin: -2px 0;
}
span.emoji-outer {
display: -moz-inline-box;
display: inline-block;
*display: inline;
height: 1em;
width: 1em;
}
span.emoji-inner {
display: -moz-inline-box;
display: inline-block;
text-indent: -9999px;
width: 100%;
height: 100%;
vertical-align: baseline;
*vertical-align: auto;
*zoom: 1;
}
img.emoji {
width: 1em;
height: 1em;
}
.emoji-wysiwyg-editor:empty:before {
content: attr(placeholder);
color: #9aa2ab;
}
.icon-emoji {
display: inline-block;
width: 23px;
height: 23px;
vertical-align: text-top;
background: url('../img/IconsetW.png') -10px -4px/42px 1171px no-repeat;
opacity: 0.8;
}
.im_emoji_btn:hover .icon-emoji {
opacity: 1;
}
/* Emoji area */
.emoji-wysiwyg-editor:empty:before {
content: attr(placeholder);
color: #9aa2ab;
}
.emoji-wysiwyg-editor:active:before,
.emoji-wysiwyg-editor:focus:before {
content: none;
}
.emoji-wysiwyg-editor {
padding:6px;
-moz-box-sizing: content-box;
font-size: 12px;
margin-bottom: 10px;
min-height: 36px;
height: 30px;
max-height: 284px;
overflow: auto;
line-height: 17px;
border: 1px solid #d2dbe3;
border-radius: 2px;
-webkit-box-shadow: none;
box-shadow: none;
-webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
-webkit-user-select: text;
word-wrap: break-word;
}
.emoji-wysiwyg-editor img {
width: 20px;
height: 20px;
vertical-align: middle;
margin: -3px 0 0 0;
}
.emoji-menu {
position: absolute;
z-index: 999;
width: 225px;
margin-left: -107px;
margin-top: -252px;
overflow: hidden;
border: 1px #dfdfdf solid;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
overflow: hidden;
-webkit-box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1);
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1);
}
.emoji-items-wrap1 {
background: #FFF;
padding: 5px 2px 5px 5px;
}
.emoji-items-wrap1 .emoji-menu-tabs {
width: 100%;
margin-bottom: 8px;
margin-top: 3px;
}
.emoji-items-wrap1 .emoji-menu-tabs td {
text-align: center;
color: white;
line-height: 0;
}
.emoji-menu-tabs .emoji-menu-tab {
display: inline-block;
width: 24px;
height: 29px;
background: url('../img/IconsetSmiles.png') no-repeat;
background-size: 42px 350px;
}
.is_1x .emoji-menu-tabs .emoji-menu-tab {
background-image: url('../img/IconsetSmiles_1x.png');
}
.emoji-menu-tabs .icon-recent {background-position: -9px -306px; }
.emoji-menu-tabs .icon-recent-selected {background-position: -9px -277px; }
.emoji-menu-tabs .icon-smile {background-position: -9px -34px; }
.emoji-menu-tabs .icon-smile-selected {background-position: -9px -5px; }
.emoji-menu-tabs .icon-flower {background-position: -9px -145px; }
.emoji-menu-tabs .icon-flower-selected {background-position: -9px -118px; }
.emoji-menu-tabs .icon-bell {background-position: -9px -89px; }
.emoji-menu-tabs .icon-bell-selected {background-position: -9px -61px; }
.emoji-menu-tabs .icon-car {background-position: -9px -196px; }
.emoji-menu-tabs .icon-car-selected {background-position: -9px -170px; }
.emoji-menu-tabs .icon-grid {background-position: -9px -248px; }
.emoji-menu-tabs .icon-grid-selected {background-position: -9px -222px; }
.emoji-menu-tabs .icon-smile,
.emoji-menu-tabs .icon-flower,
.emoji-menu-tabs .icon-bell,
.emoji-menu-tabs .icon-car,
.emoji-menu-tabs .icon-grid {
opacity: 0.7;
}
.emoji-menu-tabs .icon-smile:hover,
.emoji-menu-tabs .icon-flower:hover,
.emoji-menu-tabs .icon-bell:hover,
.emoji-menu-tabs .icon-car:hover,
.emoji-menu-tabs .icon-grid:hover {
opacity: 1;
}
.emoji-menu .emoji-items-wrap {
position: relative;
height: 174px;
}
.emoji-menu .emoji-items {
padding-right: 8px;
outline: 0 !important;
}
.emoji-menu img {
width: 20px;
height: 20px;
vertical-align: middle;
border: 0 none;
}
.emoji-menu .emoji-items a {
margin: -1px 0 0 -1px;
padding: 5px;
display: block;
float: left;
border-radius: 2px;
}
.emoji-menu .emoji-items a:hover {
background-color: #edf2f5;
}
.emoji-menu:after {
content: ' ';
display: block;
clear: left;
}
.emoji-menu a .label {
display: none;
}
/*! Angular Emoji 1.0.0 2014-12-26 */
/** initial setup **/
.nano {
position : relative;
width : 100%;
height : 100%;
overflow : hidden;
}
.nano > .nano-content {
position : absolute;
overflow : scroll;
overflow-x : hidden;
top : 0;
right : 0;
bottom : 0;
left : 0;
}
.nano > .nano-content:focus {
outline: thin dotted;
}
.nano > .nano-content::-webkit-scrollbar {
display: none;
}
.has-scrollbar > .nano-content::-webkit-scrollbar {
display: block;
}
.nano > .nano-pane {
background : rgba(0,0,0,.25);
position : absolute;
width : 10px;
right : 0;
top : 0;
bottom : 0;
visibility : hidden\9; /* Target only IE7 and IE8 with this hack */
opacity : .01;
-webkit-transition : .2s;
-moz-transition : .2s;
-o-transition : .2s;
transition : .2s;
-moz-border-radius : 5px;
-webkit-border-radius : 5px;
border-radius : 5px;
}
.nano > .nano-pane > .nano-slider {
background: #444;
background: rgba(0,0,0,.5);
position : relative;
margin : 0 1px;
-moz-border-radius : 3px;
-webkit-border-radius : 3px;
border-radius : 3px;
}
.nano:hover > .nano-pane, .nano-pane.active, .nano-pane.flashed {
visibility : visible\9; /* Target only IE7 and IE8 with this hack */
opacity : 0.99;
}
/*! Angular Emoji 1.0.0 2014-12-26 */
body
{
background: #222222 url("../img/black_linen_v2.png") repeat;
color: #aaaaaa;
}
h1
{
color:white;
}
.form-control:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);
}
.emojiForm
{
top: 50%;
width:100%;
}
.form-control,pre
{
background-color:black;
color:white;
}
ul li, .radio
{
display:inline;
}
ul {
padding: 0;
list-style-type: none;
}
pre
{
background-color: #555555;
margin-top:20px;
border:none;
}
.emoji-wysiwyg-editor, .userinput
{
background-color: white;
color:black;
overflow:auto;
}
.emoji-wysiwyg-editor
{
height: 52px;
}
\ No newline at end of file
/*! Angular Emoji 1.0.0 2014-12-26 */
'use strict';
var emojiApp = angular.module("emojiApp", ['ngSanitize']);
emojiApp.config(['$sceProvider', function($sceProvider)
{
$sceProvider.enabled(false);
var icons = {},
reverseIcons = {},
i, j, hex, name, dataItem, row, column, totalColumns;
for (j = 0; j < Config.EmojiCategories.length; j++)
{
totalColumns = Config.EmojiCategorySpritesheetDimens[j][1];
for (i = 0; i < Config.EmojiCategories[j].length; i++)
{
dataItem = Config.Emoji[Config.EmojiCategories[j][i]];
name = dataItem[1][0];
row = Math.floor(i / totalColumns);
column = (i % totalColumns);
icons[':' + name + ':'] = [j, row, column,
':' + name + ':'
];
reverseIcons[name] = dataItem[0];
}
}
$.emojiarea.spritesheetPath = 'img/emojisprite_!.png';
$.emojiarea.spritesheetDimens = Config.EmojiCategorySpritesheetDimens;
$.emojiarea.iconSize = 20;
$.emojiarea.icons = icons;
$.emojiarea.reverseIcons = reverseIcons;
}]);
emojiApp.directive('contenteditable', [ '$sce', function($sce) {
return {
restrict : 'A', // only activate on element attribute
require : '?ngModel', // get a hold of NgModelController
link : function(scope, element, attrs, ngModel) {
if (!ngModel)
return; // do nothing if no ng-model
// Specify how UI should be updated
ngModel.$render = function() {
element.html(ngModel.$viewValue || '');
};
// Listen for change events to enable binding
element.on('blur keyup change', function() {
scope.$evalAsync(read);
});
read(); // initialize
// Write data to the model
function read() {
var html = element.html();
// When we clear the content editable the browser leaves a <br>
// behind
// If strip-br attribute is provided then we strip this out
if (attrs.stripBr && html == '<br>') {
html = '';
}
ngModel.$setViewValue(html);
}
}
};
} ]);
This source diff could not be displayed because it is too large. You can view the blob instead.
/*! Angular Emoji 1.0.0 2014-12-26 */
'use strict';
emojiApp.directive('emojiForm', ['$timeout', '$http', '$interpolate','$compile', function($timeout, $http, $interpolate, $compile)
{
return {
scope:
{
emojiMessage: '='
},
link: link
};
function link($scope, element, attrs)
{
var messageField = $('textarea', element)[0],
fileSelects = $('input', element),
emojiButton = $('#emojibtn', element)[0],
editorElement = messageField,
emojiArea = $(messageField).emojiarea(
{
button: emojiButton,
norealTime: true
}),
emojiMenu = $('.emoji-menu', element)[0],
richTextarea = $(
'.emoji-wysiwyg-editor', element)[0];
var s = $compile($("#messageDiv"));
$("#messageDiv").replaceWith(s($scope));
if (richTextarea)
{
editorElement = richTextarea;
$(richTextarea).addClass('form-control');
$(richTextarea)
.attr(
'placeholder',
$interpolate(
$(messageField).attr(
'placeholder'))(
$scope));
var updatePromise;
$(richTextarea)
.on('DOMNodeInserted', onPastedImageEvent)
.on(
'keyup',
function(e)
{
updateHeight();
if (!sendAwaiting)
{
$scope
.$apply(function()
{
$scope.emojiMessage.messagetext = richTextarea.textContent;
});
}
$timeout.cancel(updatePromise);
updatePromise = $timeout(
updateValue, 1000);
});
}
var sendOnEnter = true;
$(editorElement).on(
'keydown',
function(e)
{
if (richTextarea)
{
updateHeight();
}
if (e.keyCode == 13)
{
var submit = false;
if (sendOnEnter && !e.shiftKey)
{
submit = true;
}
else if (!sendOnEnter && (e.ctrlKey || e.metaKey))
{
submit = true;
}
if (submit)
{
$timeout.cancel(updatePromise);
updateValue();
$scope.emojiMessage.replyToUser();
// $(element).trigger('message_send');
resetTyping();
return cancelEvent(e);
}
}
});
// $(submitBtn).on('mousedown touchstart', function(e)
// {
// $timeout.cancel(updatePromise);
// updateValue();
// $scope.draftMessage.replyToUser();
// resetTyping();
// return cancelEvent(e);
// });
function resetTyping()
{
// lastTyping = 0;
// lastLength = 0;
};
function updateRichTextarea()
{
console.log("updateRichTextarea");
if (richTextarea)
{
$timeout.cancel(updatePromise);
var html = $('<div>').text(
$scope.draftMessage.text || '').html();
html = html.replace(/\n/g, '<br/>');
$(richTextarea).html(html);
lastLength = html.length;
updateHeight();
}
}
function updateValue()
{
if (richTextarea)
{
$(richTextarea).trigger('change');
updateHeight();
}
}
var height = richTextarea.offsetHeight;
function updateHeight()
{
var newHeight = richTextarea.offsetHeight;
if (height != newHeight)
{
height = newHeight;
$scope.$emit('ui_editor_resize');
}
};
function onPastedImageEvent(e)
{
var element = (e.originalEvent || e).target,
src = (element ||
{}).src || '',
remove = false;
if (src.substr(0, 5) == 'data:')
{
remove = true;
var blob = dataUrlToBlob(src);
ErrorService.confirm(
{
type: 'FILE_CLIPBOARD_PASTE'
}).then(function()
{
$scope.draftMessage.files = [blob];
$scope.draftMessage.isMedia = true;
});
setZeroTimeout(function()
{
element.parentNode.removeChild(element);
})
}
else if (src && !src.match(/img\/blank\.gif/))
{
var replacementNode = document.createTextNode(' ' + src + ' ');
setTimeout(function()
{
element.parentNode.replaceChild(replacementNode, element);
}, 100);
}
};
function onPasteEvent(e)
{
console.log("onPasteEvent");
var cData = (e.originalEvent || e).clipboardData,
items = cData && cData.items || [],
files = [],
file, i;
for (i = 0; i < items.length; i++)
{
if (items[i].kind == 'file')
{
file = items[i].getAsFile();
files.push(file);
}
}
if (files.length > 0)
{
ErrorService.confirm(
{
type: 'FILES_CLIPBOARD_PASTE',
files: files
}).then(function()
{
$scope.draftMessage.files = files;
$scope.draftMessage.isMedia = true;
});
}
}
function onKeyDown(e)
{
if (e.keyCode == 9 && !e.shiftKey && !e.ctrlKey && !e.metaKey && !$modalStack.getTop())
{ // TAB
editorElement.focus();
return cancelEvent(e);
}
}
$(document).on('keydown', onKeyDown);
$(document).on('paste', onPasteEvent);
var sendAwaiting = false;
function focusField()
{
onContentLoaded(function()
{
editorElement.focus();
});
}
$scope.$on('$destroy', function cleanup()
{
$(document).off('paste', onPasteEvent);
$(document).off('keydown', onKeyDown);
$(submitBtn).off('mousedown')
fileSelects.off('change');
if (richTextarea)
{
$(richTextarea).off('DOMNodeInserted keyup',
onPastedImageEvent);
}
$(editorElement).off('keydown');
});
}
}]);
emojiApp.directive('contenteditable', [ '$sce', function($sce) {
return {
restrict : 'A', // only activate on element attribute
require : '?ngModel', // get a hold of NgModelController
link : function(scope, element, attrs, ngModel) {
if (!ngModel)
return; // do nothing if no ng-model
// Specify how UI should be updated
ngModel.$render = function() {
element.html(ngModel.$viewValue || '');
};
// Listen for change events to enable binding
element.on('blur keyup change', function() {
scope.$evalAsync(read);
});
read(); // initialize
// Write data to the model
function read() {
var html = element.html();
// When we clear the content editable the browser leaves a <br>
// behind
// If strip-br attribute is provided then we strip this out
if (attrs.stripBr && html == '<br>') {
html = '';
}
ngModel.$setViewValue(html);
}
}
};
} ]);
/*! Angular Emoji 1.0.0 2014-12-26 */
'use strict';
emojiApp.filter('colonToCode', function() {
return function(input) {
if(!input)
return "";
if(!Config.rx_colons)
Config.init_unified();
return input.replace(Config.rx_colons, function(m)
{
var val = Config.mapcolon[m];
if (val)
{
return val;
}
else
return "";
});
};
});
emojiApp.filter('codeToSmiley', function() {
return function(input) {
if(!input)
return "";
if(!Config.rx_codes)
Config.init_unified();
return input.replace(Config.rx_codes, function(m)
{
var val = Config.reversemap[m];
if (val) {
val = ":" + val + ":";
var $img = $.emojiarea.createIcon($.emojiarea.icons[val]);
return $img;
}
else
return "";
});
};
});
emojiApp.filter('colonToSmiley', function() {
return function(input) {
if(!input)
return "";
if(!Config.rx_colons)
Config.init_unified();
return input.replace(Config.rx_colons, function(m)
{
if (m)
{
var $img = $.emojiarea.createIcon($.emojiarea.icons[m]);
return $img;
}
else
return "";
});
};
});
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
/*! Angular Emoji 1.0.0 2014-12-26 */
'use strict';
function cancelEvent (event) {
event = event || window.event;
if (event) {
event = event.originalEvent || event;
if (event.stopPropagation) event.stopPropagation();
if (event.preventDefault) event.preventDefault();
}
return false;
}
//ConfigStorage
(function(window)
{
var keyPrefix = '';
var noPrefix = false;
var cache = {};
var useCs = !!(window.chrome && chrome.storage && chrome.storage.local);
var useLs = !useCs && !!window.localStorage;
function storageSetPrefix(newPrefix)
{
keyPrefix = newPrefix;
}
function storageSetNoPrefix()
{
noPrefix = true;
}
function storageGetPrefix()
{
if (noPrefix)
{
noPrefix = false;
return '';
}
return keyPrefix;
}
function storageGetValue()
{
var keys = Array.prototype.slice.call(arguments),
callback = keys.pop(),
result = [],
single = keys.length == 1,
value,
allFound = true,
prefix = storageGetPrefix(),
i, key;
for (i = 0; i < keys.length; i++)
{
key = keys[i] = prefix + keys[i];
if (key.substr(0, 3) != 'xt_' && cache[key] !== undefined)
{
result.push(cache[key]);
}
else if (useLs)
{
try
{
value = localStorage.getItem(key);
}
catch (e)
{
useLs = false;
}
try
{
value = (value === undefined || value === null) ? false : JSON.parse(value);
}
catch (e)
{
value = false;
}
result.push(cache[key] = value);
}
else if (!useCs)
{
result.push(cache[key] = false);
}
else
{
allFound = false;
}
}
if (allFound)
{
return callback(single ? result[0] : result);
}
chrome.storage.local.get(keys, function(resultObj)
{
var value;
result = [];
for (i = 0; i < keys.length; i++)
{
key = keys[i];
value = resultObj[key];
value = value === undefined || value === null ? false : JSON.parse(value);
result.push(cache[key] = value);
}
callback(single ? result[0] : result);
});
};
function storageSetValue(obj, callback)
{
var keyValues = {},
prefix = storageGetPrefix(),
key, value;
for (key in obj)
{
if (obj.hasOwnProperty(key))
{
value = obj[key];
key = prefix + key;
cache[key] = value;
value = JSON.stringify(value);
if (useLs)
{
try
{
localStorage.setItem(key, value);
}
catch (e)
{
useLs = false;
}
}
else
{
keyValues[key] = value;
}
}
}
if (useLs || !useCs)
{
if (callback)
{
callback();
}
return;
}
chrome.storage.local.set(keyValues, callback);
};
function storageRemoveValue()
{
var keys = Array.prototype.slice.call(arguments),
prefix = storageGetPrefix(),
i, key, callback;
if (typeof keys[keys.length - 1] === 'function')
{
callback = keys.pop();
}
for (i = 0; i < keys.length; i++)
{
key = keys[i] = prefix + keys[i];
delete cache[key];
if (useLs)
{
try
{
localStorage.removeItem(key);
}
catch (e)
{
useLs = false;
}
}
}
if (useCs)
{
chrome.storage.local.remove(keys, callback);
}
else if (callback)
{
callback();
}
};
window.ConfigStorage = {
prefix: storageSetPrefix,
noPrefix: storageSetNoPrefix,
get: storageGetValue,
set: storageSetValue,
remove: storageRemoveValue
};
})(this);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment