e756a3fd0c
commit 5b7ac6f0f56f3888c01049f08b6b47dbeb3bcfb0 Author: Robin Linus <robin_woll@capira.de> Date: Wed Dec 30 18:06:48 2015 +0100 Clean up about and social links commit 9c7da37d1e8f58f1c45626289fbab336fc982a0f Author: Robin Linus <robin_woll@capira.de> Date: Wed Dec 30 18:06:35 2015 +0100 Change Slogan commit fcea5cfb5c6928acabce44caacc1d75fafdab447 Author: Robin Linus <robin_woll@capira.de> Date: Wed Dec 30 18:06:22 2015 +0100 Add shorturl commit f09e9e42c30aa7b26df2a5fb00bec653f3ad68e1 Author: Robin Linus <robin_woll@capira.de> Date: Wed Dec 30 16:56:55 2015 +0100 initial
45 lines
1.3 KiB
HTML
45 lines
1.3 KiB
HTML
<script>
|
|
'use strict';
|
|
window.Chat = window.Chat || {};
|
|
Chat.InvitationLinkBehavior = {
|
|
properties: {
|
|
contact: {
|
|
type: String
|
|
}
|
|
},
|
|
_copy: function(e) {
|
|
if (e) {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
}
|
|
Polymer.Base.create('textarea');
|
|
var copyTextarea = this.textarea;
|
|
copyTextarea.value = this.link;
|
|
copyTextarea.select();
|
|
try {
|
|
var successful = document.execCommand('copy');
|
|
if (successful) {
|
|
app.displayToast('Copied invitation link to clipboard. Share it to send files to friends!');
|
|
}
|
|
} catch (err) {
|
|
console.log('Oops, unable to copy', err);
|
|
}
|
|
copyTextarea.blur();
|
|
},
|
|
get link() {
|
|
return 'http://' + window.location.host + '/' + this.contact;
|
|
},
|
|
get textarea() {
|
|
var textarea = document.querySelector('#copytextarea');
|
|
if (!textarea) {
|
|
textarea = Polymer.Base.create('textarea');
|
|
textarea.id = 'copytextarea';
|
|
var style = textarea.style;
|
|
style.position = 'absolute';
|
|
style.top = '-10000px';
|
|
document.body.appendChild(textarea);
|
|
}
|
|
return textarea;
|
|
}
|
|
};
|
|
</script>
|