mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-26 01:36:18 -04:00
Squashed commit of the following:
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
This commit is contained in:
parent
1bce467a7c
commit
e756a3fd0c
11 changed files with 278 additions and 128 deletions
45
app/elements/invitation-link/invitation-link-behavior.html
Normal file
45
app/elements/invitation-link/invitation-link-behavior.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
<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>
|
29
app/elements/invitation-link/invitation-link.html
Normal file
29
app/elements/invitation-link/invitation-link.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
<link rel="import" href="invitation-link-behavior.html">
|
||||
<link rel="import" href="../../bower_components/paper-tooltip/paper-tooltip.html">
|
||||
<dom-module id="invitation-link">
|
||||
<template>
|
||||
<style>
|
||||
:host {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 16px;
|
||||
left: 16px;
|
||||
z-index: 3;
|
||||
}
|
||||
</style>
|
||||
<paper-icon-button icon="chat:share" on-tap="_copy" id="btn"></paper-icon-button>
|
||||
<paper-tooltip
|
||||
for="btn"
|
||||
position="bottom"
|
||||
offset="14">
|
||||
Get an Invitation Link to send files accross different networks.
|
||||
</paper-tooltip>
|
||||
</template>
|
||||
<script>
|
||||
'use strict';
|
||||
Polymer({
|
||||
is: 'invitation-link',
|
||||
behaviors: [Chat.InvitationLinkBehavior]
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
Loading…
Add table
Add a link
Reference in a new issue