mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-20 15:06:15 -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
|
@ -41,9 +41,18 @@
|
||||||
|
|
||||||
.explanation {
|
.explanation {
|
||||||
@apply(--paper-font-headline);
|
@apply(--paper-font-headline);
|
||||||
color: #4285f4;
|
color: #4E4E4E;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.short {
|
||||||
|
@apply(--paper-font-body1);
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.url {
|
||||||
|
color: #4285f4;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="buddies">
|
<div class="buddies">
|
||||||
<template is="dom-repeat" items="{{buddies}}">
|
<template is="dom-repeat" items="{{buddies}}">
|
||||||
|
@ -53,7 +62,8 @@
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div hidden$="{{buddies.0}}" class="explanation">
|
<div hidden$="{{buddies.0}}" class="explanation">
|
||||||
Open this page on other devices<br> to send files.
|
Open <span class="url">dropc.at</span> on other devices
|
||||||
|
<br> to send files.
|
||||||
</div>
|
</div>
|
||||||
<personal-avatar class="me"></personal-avatar>
|
<personal-avatar class="me"></personal-avatar>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
</style>
|
</style>
|
||||||
<iron-icon icon="chat:wifi-tethering"></iron-icon>
|
<iron-icon icon="chat:wifi-tethering"></iron-icon>
|
||||||
<div class="paper-font-body1">
|
<div class="paper-font-body1">
|
||||||
Snapdrop lets you share instantly with people near by.
|
The easiest way to transfer files across devices.
|
||||||
</div>
|
</div>
|
||||||
<div class="paper-font-body1 discover">
|
<div class="paper-font-body1 discover">
|
||||||
Allow me to be discovered by: Everyone in this network.
|
Allow me to be discovered by: Everyone in this network.
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
-->
|
-->
|
||||||
<!-- Add your elements here -->
|
<!-- Add your elements here -->
|
||||||
<link rel="import" href="../styles/app-theme.html">
|
<link rel="import" href="../styles/app-theme.html">
|
||||||
<link rel="import" href="x-cards/x-card.html">
|
<link rel="import" href="x-cards/about-page.html">
|
||||||
<link rel="import" href="x-cards/x-cards.html">
|
<link rel="import" href="x-cards/x-cards.html">
|
||||||
<link rel="import" href="buddy-finder/buddy-finder.html">
|
<link rel="import" href="buddy-finder/buddy-finder.html">
|
||||||
<link rel="import" href="p2p-network/connection-wrapper.html">
|
<link rel="import" href="p2p-network/connection-wrapper.html">
|
||||||
|
|
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>
|
|
@ -23,6 +23,9 @@
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
},
|
},
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
if (window.isActive) {
|
||||||
|
clearInterval(this.reconnectTimer);
|
||||||
|
this.reconnectTimer = undefined;
|
||||||
var options;
|
var options;
|
||||||
if (window.debug) {
|
if (window.debug) {
|
||||||
options = {
|
options = {
|
||||||
|
@ -54,16 +57,15 @@
|
||||||
//ugly hack to find out error type
|
//ugly hack to find out error type
|
||||||
if (err.message.indexOf('Could not connect to peer') > -1) {
|
if (err.message.indexOf('Could not connect to peer') > -1) {
|
||||||
delete this._connectedPeers[this.peer];
|
delete this._connectedPeers[this.peer];
|
||||||
this.set('peer', 'error');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (err.message.indexOf('Lost connection to server') > -1) {
|
if (err.message.indexOf('Lost connection to server') > -1) {
|
||||||
this._peer.destroy();
|
this._peer.destroy();
|
||||||
this.set('me', this.me);
|
this._reconnect();
|
||||||
this.async(this._initialize, 3000);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
connect: function(c) {
|
connect: function(c) {
|
||||||
|
@ -145,7 +147,7 @@
|
||||||
conns.forEach(function(conn) {
|
conns.forEach(function(conn) {
|
||||||
if (conn.label === 'file') {
|
if (conn.label === 'file') {
|
||||||
conn.send(file);
|
conn.send(file);
|
||||||
console.log('file send via WebRTC');
|
console.log('send file via WebRTC');
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
|
@ -159,6 +161,12 @@
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
_reconnect: function(e) {
|
||||||
|
//try to reconnect after 3s
|
||||||
|
if (!this.reconnectTimer) {
|
||||||
|
this.reconnectTimer = setInterval(this.initialize.bind(this), 3000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
25
app/elements/p2p-network/tab-active.html
Normal file
25
app/elements/p2p-network/tab-active.html
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<script>
|
||||||
|
'use strict';
|
||||||
|
var vis = (function() {
|
||||||
|
var stateKey,
|
||||||
|
eventKey,
|
||||||
|
keys = {
|
||||||
|
hidden: "visibilitychange",
|
||||||
|
webkitHidden: "webkitvisibilitychange",
|
||||||
|
mozHidden: "mozvisibilitychange",
|
||||||
|
msHidden: "msvisibilitychange"
|
||||||
|
};
|
||||||
|
for (stateKey in keys) {
|
||||||
|
if (stateKey in document) {
|
||||||
|
eventKey = keys[stateKey];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return function(c) {
|
||||||
|
if (c) {
|
||||||
|
document.addEventListener(eventKey, c);
|
||||||
|
}
|
||||||
|
return !document[stateKey];
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
</script>
|
|
@ -9,12 +9,25 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
'use strict';
|
'use strict';
|
||||||
|
window.isActive = true;
|
||||||
|
|
||||||
|
window.onfocus = function() {
|
||||||
|
window.isActive = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
window.onblur = function() {
|
||||||
|
window.isActive = false;
|
||||||
|
};
|
||||||
|
|
||||||
Polymer({
|
Polymer({
|
||||||
is: 'web-socket',
|
is: 'web-socket',
|
||||||
attached: function() {
|
attached: function() {
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
init: function() {
|
init: function() {
|
||||||
|
if (window.isActive) {
|
||||||
|
clearInterval(this.reconnectTimer);
|
||||||
|
this.reconnectTimer = undefined;
|
||||||
var websocketUrl = (window.debug ? 'ws://' + window.location.hostname + ':3002' : 'wss://snapdrop.net') + '/binary';
|
var websocketUrl = (window.debug ? 'ws://' + window.location.hostname + ':3002' : 'wss://snapdrop.net') + '/binary';
|
||||||
this.client = new BinaryClient(websocketUrl);
|
this.client = new BinaryClient(websocketUrl);
|
||||||
this.client.on('stream', function(stream, meta) {
|
this.client.on('stream', function(stream, meta) {
|
||||||
|
@ -45,7 +58,6 @@
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
this.client.on('open', function(e) {
|
this.client.on('open', function(e) {
|
||||||
this.cancelAsync(this.reconnectTimer);
|
|
||||||
console.log(e);
|
console.log(e);
|
||||||
this.client.send({}, {
|
this.client.send({}, {
|
||||||
serverMsg: 'rtc-support',
|
serverMsg: 'rtc-support',
|
||||||
|
@ -58,6 +70,7 @@
|
||||||
this.client.on('close', function(e) {
|
this.client.on('close', function(e) {
|
||||||
this._reconnect(e);
|
this._reconnect(e);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_sendFile: function(toPeer, file) {
|
_sendFile: function(toPeer, file) {
|
||||||
console.log('send file via WebSocket', file);
|
console.log('send file via WebSocket', file);
|
||||||
|
@ -80,7 +93,9 @@
|
||||||
_reconnect: function(e) {
|
_reconnect: function(e) {
|
||||||
console.log('disconnected', e);
|
console.log('disconnected', e);
|
||||||
//try to reconnect after 3s
|
//try to reconnect after 3s
|
||||||
this.reconnectTimer = this.async(this.init, 3000);
|
if (!this.reconnectTimer) {
|
||||||
|
this.reconnectTimer = setInterval(this.init.bind(this), 3000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<link rel="import" href="../../bower_components/neon-animation/neon-animations.html">
|
<link rel="import" href="../../bower_components/neon-animation/neon-animations.html">
|
||||||
<link rel="import" href="../../bower_components/paper-styles/paper-styles-classes.html">
|
<link rel="import" href="../../bower_components/paper-styles/paper-styles-classes.html">
|
||||||
<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
|
<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
|
||||||
<dom-module id="x-card">
|
<dom-module id="about-page">
|
||||||
<template>
|
<template>
|
||||||
<style>
|
<style>
|
||||||
:host {
|
:host {
|
||||||
|
@ -18,13 +18,12 @@
|
||||||
background-color: #4285f4;
|
background-color: #4285f4;
|
||||||
@apply(--layout-fit);
|
@apply(--layout-fit);
|
||||||
}
|
}
|
||||||
|
/* paper-icon-button {
|
||||||
paper-icon-button {
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 16px;
|
top: 16px;
|
||||||
right: 16px;
|
right: 16px;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
#container {
|
#container {
|
||||||
@apply(--layout-fit);
|
@apply(--layout-fit);
|
||||||
|
@ -35,13 +34,12 @@
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
height: 80px;
|
height: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slogan{
|
.slogan {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,24 +85,74 @@
|
||||||
a.paper-font-subhead {
|
a.paper-font-subhead {
|
||||||
padding-top: 32px;
|
padding-top: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.share {
|
||||||
|
position: absolute;
|
||||||
|
top: 16px;
|
||||||
|
right: 16px;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
#btn,
|
||||||
|
.share a {
|
||||||
|
color: #52524F;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share a {
|
||||||
|
text-decoration: none;
|
||||||
|
padding-left: 8px;
|
||||||
|
padding-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share a:hover,
|
||||||
|
#btn:hover {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<paper-icon-button id="btn" icon="chat:close" on-tap="_switch"></paper-icon-button>
|
|
||||||
<div id="placeholder"></div>
|
<div id="placeholder"></div>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
|
<div class="share">
|
||||||
|
<a href="https://twitter.com/snapdrop42" target="_blank">
|
||||||
|
<iron-icon icon="chat:twitter"></iron-icon>
|
||||||
|
<paper-tooltip for="" position="bottom" offset="14">
|
||||||
|
Contact us on Twitter!
|
||||||
|
</paper-tooltip>
|
||||||
|
</a>
|
||||||
|
<a href="https://www.facebook.com/snapdrop.net/" target="_blank">
|
||||||
|
<iron-icon icon="chat:facebook"></iron-icon>
|
||||||
|
<paper-tooltip for="" position="bottom" offset="14">
|
||||||
|
Contact us on Facebook!
|
||||||
|
</paper-tooltip>
|
||||||
|
</a>
|
||||||
|
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FDAHZJH3228D6" target="_blank">
|
||||||
|
<iron-icon icon="chat:local-cafe"></iron-icon>
|
||||||
|
<paper-tooltip for="" position="bottom" offset="14">
|
||||||
|
You like Snapdrop?
|
||||||
|
<br> Buy me a cup of coffee!
|
||||||
|
</paper-tooltip>
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/capira12/snapdrop" target="_blank" class="github">
|
||||||
|
<iron-icon icon="chat:github"></iron-icon>
|
||||||
|
<paper-tooltip for="" position="bottom" offset="14">
|
||||||
|
Get involved!
|
||||||
|
</paper-tooltip>
|
||||||
|
</a>
|
||||||
|
<paper-icon-button id="btn" icon="chat:close" on-tap="_switch"></paper-icon-button>
|
||||||
|
</div>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<iron-icon icon="chat:wifi-tethering" class="logo"></iron-icon>
|
<iron-icon icon="chat:wifi-tethering" class="logo"></iron-icon>
|
||||||
<div class="paper-font-headline">Snapdrop</div>
|
<div class="paper-font-headline">Snapdrop</div>
|
||||||
<div class="slogan">The easiest way to transfer files accross devices.</div>
|
<div class="slogan">The easiest way to transfer files across devices.</div>
|
||||||
<a class="paper-font-subhead" href="https://github.com/capira12/snapdrop/blob/master/faq.md" target="_blank">Frequently Asked Questions</a>
|
<a class="paper-font-subhead" href="https://github.com/capira12/snapdrop/blob/master/faq.md" target="_blank">Frequently Asked Questions</a>
|
||||||
</div>
|
</div>
|
||||||
<span id="footer">Built with ♥ by <a href="https://twitter.com/snapdrop42" target="_blank">Robin Linus</a></span>
|
<span id="footer">Built with ♥ by <a href="https://twitter.com/capira42" target="_blank">Robin Linus</a></span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</dom-module>
|
</dom-module>
|
||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
Polymer({
|
Polymer({
|
||||||
is: 'x-card',
|
is: 'about-page',
|
||||||
behaviors: [
|
behaviors: [
|
||||||
Polymer.NeonSharedElementAnimatableBehavior
|
Polymer.NeonSharedElementAnimatableBehavior
|
||||||
],
|
],
|
|
@ -47,40 +47,10 @@
|
||||||
color: #4285f4;
|
color: #4285f4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (max-height: 640px) {
|
|
||||||
.github {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
<div id="placeholder"></div>
|
<div id="placeholder"></div>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<div class="share">
|
<div class="share">
|
||||||
<a href="https://twitter.com/snapdrop42" target="_blank">
|
|
||||||
<iron-icon icon="chat:twitter"></iron-icon>
|
|
||||||
<paper-tooltip for="" position="bottom" offset="14">
|
|
||||||
Contact us on Twitter!
|
|
||||||
</paper-tooltip>
|
|
||||||
</a>
|
|
||||||
<a href="https://www.facebook.com/snapdrop.net/" target="_blank">
|
|
||||||
<iron-icon icon="chat:facebook"></iron-icon>
|
|
||||||
<paper-tooltip for="" position="bottom" offset="14">
|
|
||||||
Like us on Facebook!
|
|
||||||
</paper-tooltip>
|
|
||||||
</a>
|
|
||||||
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FDAHZJH3228D6" target="_blank">
|
|
||||||
<iron-icon icon="chat:local-cafe"></iron-icon>
|
|
||||||
<paper-tooltip for="" position="bottom" offset="14">
|
|
||||||
You like Snapdrop?
|
|
||||||
<br> Buy me a cup of coffee!
|
|
||||||
</paper-tooltip>
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/capira12/snapdrop" target="_blank" class="github">
|
|
||||||
<iron-icon icon="chat:github" ></iron-icon>
|
|
||||||
<paper-tooltip for="" position="bottom" offset="14">
|
|
||||||
Get involved!
|
|
||||||
</paper-tooltip>
|
|
||||||
</a>
|
|
||||||
<paper-icon-button id="btn" icon="chat:info-outline" on-tap="_switch"></paper-icon-button>
|
<paper-icon-button id="btn" icon="chat:info-outline" on-tap="_switch"></paper-icon-button>
|
||||||
</div>
|
</div>
|
||||||
<content select="div"></content>
|
<content select="div"></content>
|
||||||
|
|
|
@ -56,8 +56,8 @@
|
||||||
<buddy-finder me="{{me}}" active$="{{loading}}" buddies="{{buddies}}"></buddy-finder>
|
<buddy-finder me="{{me}}" active$="{{loading}}" buddies="{{buddies}}"></buddy-finder>
|
||||||
</div>
|
</div>
|
||||||
</x-cards>
|
</x-cards>
|
||||||
<x-card on-switch="_showApp">
|
<about-page on-switch="_showApp">
|
||||||
</x-card>
|
</about-page>
|
||||||
</neon-animated-pages>
|
</neon-animated-pages>
|
||||||
<file-receiver></file-receiver>
|
<file-receiver></file-receiver>
|
||||||
<paper-toast id="toast" duration="6000">
|
<paper-toast id="toast" duration="6000">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue