2016-01-02 14:23:51 +01:00
|
|
|
<link rel="import" href="text-input-dialog.html">
|
2016-01-02 02:26:07 +01:00
|
|
|
<script>
|
|
|
|
'use strict';
|
|
|
|
window.Chat = window.Chat || {};
|
2016-01-02 14:23:51 +01:00
|
|
|
(function() {
|
|
|
|
var textInput = Polymer.Base.create('text-input-dialog');
|
|
|
|
textInput.className = 'textInput';
|
|
|
|
document.body.appendChild(textInput);
|
|
|
|
Chat.TextInputBehavior = {
|
|
|
|
properties: {
|
|
|
|
contact: Object,
|
|
|
|
},
|
|
|
|
get textInput() {
|
|
|
|
var textInput = Polymer.dom(document).querySelector('.textInput');
|
|
|
|
return textInput;
|
|
|
|
},
|
|
|
|
openTextDialog: function() {
|
|
|
|
this.textInput.open(this.contact);
|
|
|
|
},
|
|
|
|
|
|
|
|
listeners: {
|
|
|
|
'contextmenu': '_handleContextMenu',
|
|
|
|
'down': '_handleDown',
|
|
|
|
'up': '_handleUp',
|
|
|
|
},
|
|
|
|
_handleContextMenu: function(ev) {
|
|
|
|
ev.preventDefault();
|
|
|
|
ev.stopPropagation();
|
|
|
|
ev.cancelBubble = true;
|
|
|
|
this.cancelAsync(this.pressTimer);
|
|
|
|
this.openTextDialog();
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
_handleUp: function(e) {
|
|
|
|
this.cancelAsync(this.pressTimer);
|
|
|
|
},
|
|
|
|
_handleDown: function(ev) {
|
|
|
|
this.pressTimer = this.async(function() {
|
|
|
|
this.openTextDialog();
|
|
|
|
ev.preventDefault();
|
|
|
|
ev.stopPropagation();
|
|
|
|
ev.cancelBubble = true;
|
|
|
|
return false;
|
2016-01-03 03:07:10 +01:00
|
|
|
}, 800);
|
2016-01-02 14:23:51 +01:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}());
|
2016-01-02 02:26:07 +01:00
|
|
|
</script>
|