mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-26 17:56:16 -04:00
Lots of minor fixes
This commit is contained in:
parent
bb81b6f2e4
commit
d8dcbfcb0f
21 changed files with 332 additions and 60 deletions
|
@ -20,7 +20,7 @@
|
|||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
padding: 12px;
|
||||
margin-bottom: 4px;
|
||||
margin-bottom: 6px;
|
||||
background-color: #4285f4;
|
||||
color: white;
|
||||
}
|
||||
|
@ -127,39 +127,50 @@
|
|||
return status;
|
||||
},
|
||||
attached: function() {
|
||||
// var adsDialog = document.querySelector('#ads');
|
||||
this.async(function() {
|
||||
app.conn.addEventListener('file-offered', function(e) {
|
||||
if (e.detail.to === this.contact.peerId) {
|
||||
this.status = 'Waiting to accept...';
|
||||
//adsDialog.open();
|
||||
}
|
||||
}.bind(this), false);
|
||||
app.conn.addEventListener('upload-started', function(e) {
|
||||
if (e.detail.to === this.contact.peerId) {
|
||||
this.status = 'Uploading...';
|
||||
// adsDialog.setState('Uploading...');
|
||||
}
|
||||
}.bind(this), false);
|
||||
app.conn.addEventListener('download-started', function(e) {
|
||||
if (e.detail.from === this.contact.peerId) {
|
||||
this.status = 'Downloading...';
|
||||
//adsDialog.open();
|
||||
// adsDialog.setState('Downloading...');
|
||||
}
|
||||
}.bind(this), false);
|
||||
app.conn.addEventListener('upload-complete', function(e) {
|
||||
if (e.detail.from === this.contact.peerId) {
|
||||
this.status = this.defaultStatus;
|
||||
adsDialog.setState('Transfer Complete');
|
||||
// adsDialog.close();
|
||||
}
|
||||
}.bind(this), false);
|
||||
app.conn.addEventListener('download-complete', function(e) {
|
||||
if (e.detail.from === this.contact.peerId) {
|
||||
this.status = this.defaultStatus;
|
||||
adsDialog.setState('Transfer Complete');
|
||||
// adsDialog.close();
|
||||
}
|
||||
}.bind(this), false);
|
||||
app.conn.addEventListener('file-declined', function(e) {
|
||||
if (e.detail.from === this.contact.peerId) {
|
||||
this.status = this.defaultStatus;
|
||||
// adsDialog.close(true);
|
||||
}
|
||||
}.bind(this), false);
|
||||
app.conn.addEventListener('upload-error', function(e) {
|
||||
this.status = this.defaultStatus;
|
||||
// adsDialog.close();
|
||||
}.bind(this), false);
|
||||
}, 200);
|
||||
}
|
||||
|
|
|
@ -102,11 +102,10 @@
|
|||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
<div class="explanation2" hidden$="{{!_showExplanation}}">
|
||||
Tap to send File.
|
||||
<br> Long Press to send Text.
|
||||
{{_clickExplanation1}} Device to send File.
|
||||
<br> {{_clickExplanation2}} to send a Text.
|
||||
</div>
|
||||
<div class="buddies" two-lines$="{{twoLinesOfBuddies}}">
|
||||
<template is="dom-repeat" items="{{buddies}}">
|
||||
|
@ -123,44 +122,66 @@
|
|||
</template>
|
||||
<script>
|
||||
'use strict';
|
||||
Polymer({
|
||||
is: 'buddy-finder',
|
||||
properties: {
|
||||
buddies: {
|
||||
type: Array,
|
||||
notify: true
|
||||
(function() {
|
||||
var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
||||
Polymer({
|
||||
is: 'buddy-finder',
|
||||
properties: {
|
||||
buddies: {
|
||||
type: Array,
|
||||
notify: true
|
||||
},
|
||||
me: {
|
||||
type: String,
|
||||
},
|
||||
_showExplanation: {
|
||||
computed: '_computeShowExplanation(buddies.length)',
|
||||
value: false
|
||||
},
|
||||
twoLinesOfBuddies: {
|
||||
value: false
|
||||
},
|
||||
_clickExplanation1: {
|
||||
value: (function() {
|
||||
if (isMobile) {
|
||||
return 'Tap';
|
||||
} else {
|
||||
return 'Click';
|
||||
}
|
||||
})
|
||||
},
|
||||
_clickExplanation2: {
|
||||
value: (function() {
|
||||
if (isMobile) {
|
||||
return 'Long Press';
|
||||
} else {
|
||||
return 'Right Click';
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
me: {
|
||||
type: String,
|
||||
observers: [
|
||||
'_buddiesChanged(buddies.splices)'
|
||||
],
|
||||
_fileSelected: function(e) {
|
||||
var peerId = e.model.item.peerId;
|
||||
var file = e.detail;
|
||||
app.conn.sendFile(peerId, file);
|
||||
//document.querySelector('#ads').open();
|
||||
},
|
||||
_showExplanation: {
|
||||
computed: '_computeShowExplanation(buddies.length)',
|
||||
value: false
|
||||
_computeShowExplanation: function(nBuddies) {
|
||||
if (!nBuddies || nBuddies === 0) {
|
||||
return false;
|
||||
}
|
||||
if (nBuddies < 3) {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
twoLinesOfBuddies: {
|
||||
value: false
|
||||
_buddiesChanged: function() {
|
||||
var length = window.innerWidth / 120;
|
||||
this.set('twoLinesOfBuddies', (this.buddies.length > length));
|
||||
}
|
||||
},
|
||||
observers: [
|
||||
'_buddiesChanged(buddies.splices)'
|
||||
],
|
||||
_fileSelected: function(e) {
|
||||
var peerId = e.model.item.peerId;
|
||||
var file = e.detail;
|
||||
app.conn.sendFile(peerId, file);
|
||||
},
|
||||
_computeShowExplanation: function(nBuddies) {
|
||||
if (!nBuddies || nBuddies === 0) {
|
||||
return false;
|
||||
}
|
||||
if (nBuddies < 3) {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
_buddiesChanged: function() {
|
||||
var length = window.innerWidth / 120;
|
||||
this.set('twoLinesOfBuddies', (this.buddies.length > length));
|
||||
}
|
||||
});
|
||||
});
|
||||
}());
|
||||
</script>
|
||||
</dom-module>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
text-align: center;
|
||||
cursor: pointer;
|
||||
width: 160px;
|
||||
line-height: 18px !important;
|
||||
line-height: 12px !important;
|
||||
}
|
||||
|
||||
:root {
|
||||
|
@ -37,7 +37,7 @@
|
|||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
<div class="name-label" hidden$="{{name}}">My Name</div>
|
||||
<div class="name-label" hidden$="{{name}}">My Device</div>
|
||||
<div class="name-label" hidden$="{{!name}}">{{name}}</div>
|
||||
<iron-localstorage name="device-name" value="{{name}}" iron-localstorage-load="_nameChanged"></iron-localstorage>
|
||||
</template>
|
||||
|
|
95
app/elements/donate-dialog/donate-dialog.html
Normal file
95
app/elements/donate-dialog/donate-dialog.html
Normal file
|
@ -0,0 +1,95 @@
|
|||
<link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">
|
||||
<dom-module id="donate-dialog-impl">
|
||||
<template>
|
||||
<style>
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
|
||||
paper-dialog {
|
||||
max-width: 324px;
|
||||
}
|
||||
|
||||
iron-icon {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 4px;
|
||||
color: #4285f4;
|
||||
}
|
||||
|
||||
p {
|
||||
padding: 0 48px;
|
||||
margin: 4px;
|
||||
@apply(--paper-font-subhead);
|
||||
}
|
||||
|
||||
paper-dialog > a {
|
||||
text-decoration: none;
|
||||
color: #52524F;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 500px) {
|
||||
paper-dialog {
|
||||
margin: 24px
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<paper-dialog id="dialog" with-backdrop entry-animation="scale-up-animation" exit-animation="fade-out-animation" modal>
|
||||
<h2>Do you like Snapdrop?</h2>
|
||||
<a href="https://www.paypal.com/cgi-bin/webscr?business=robin@capira.de&cmd=_xclick¤cy_code=USD&item_name=Snapdrop&shipping=0" target="_blank" dialog-confirm>
|
||||
<p>
|
||||
<iron-icon icon="chat:local-cafe"></iron-icon>
|
||||
<span>Donate a cup of Coffee <br>to the Developers!</span>
|
||||
</p>
|
||||
</a>
|
||||
<div class="buttons">
|
||||
<paper-button dialog-dismiss>No, thanks.</paper-button>
|
||||
<a href="https://www.paypal.com/cgi-bin/webscr?business=robin@capira.de&cmd=_xclick¤cy_code=USD&item_name=Snapdrop&shipping=0" target="_blank">
|
||||
<paper-button dialog-confirm>Donate</paper-button>
|
||||
</a>
|
||||
</div>
|
||||
</paper-dialog>
|
||||
</template>
|
||||
<script>
|
||||
'use strict';
|
||||
Polymer({
|
||||
is: 'donate-dialog-impl',
|
||||
open: function() {
|
||||
this.$.dialog.open();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
||||
<dom-module id="donate-dialog">
|
||||
<script>
|
||||
'use strict';
|
||||
Polymer({
|
||||
is: 'donate-dialog',
|
||||
properties: {
|
||||
chance: {
|
||||
value: 1 / 6
|
||||
}
|
||||
},
|
||||
attached: function() {
|
||||
window.donateDialog = this;
|
||||
},
|
||||
get dialog() {
|
||||
var dialog = document.querySelector('donate-dialog-impl');
|
||||
if (!dialog) {
|
||||
dialog = Polymer.Base.create('donate-dialog-impl');
|
||||
document.body.appendChild(dialog);
|
||||
}
|
||||
return dialog;
|
||||
},
|
||||
open: function() {
|
||||
var chance = Math.random() <= this.chance;
|
||||
if (chance) {
|
||||
this.dialog.open();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
|
@ -13,4 +13,5 @@
|
|||
<link rel="import" href="buddy-finder/buddy-finder.html">
|
||||
<link rel="import" href="p2p-network/connection-wrapper.html">
|
||||
<link rel="import" href="file-sharing/file-receiver.html">
|
||||
<link rel="import" href="donate-dialog/donate-dialog.html">
|
||||
|
|
@ -8,7 +8,7 @@ Chat.FileButtonBehaviorImpl = {
|
|||
if (!fileInput) {
|
||||
fileInput = document.createElement('input');
|
||||
fileInput.type = 'file';
|
||||
fileInput.multiple = 'true';
|
||||
fileInput.multiple = 'false';
|
||||
fileInput.className = 'fileInput';
|
||||
fileInput.style.position = 'fixed';
|
||||
fileInput.style.top = '-10000px';
|
||||
|
|
|
@ -128,6 +128,9 @@ Chat.FileTransferProtocol = {
|
|||
_onReceived: function(offer) {
|
||||
this.loading = false;
|
||||
this.fire('upload-complete', offer);
|
||||
if(window.donateDialog){
|
||||
window.donateDialog.open();
|
||||
}
|
||||
},
|
||||
_onError: function() {
|
||||
this.loading = false;
|
||||
|
|
|
@ -130,40 +130,40 @@
|
|||
<div class="paper-font-headline">Snapdrop</div>
|
||||
<div class="slogan">The easiest way to transfer files across devices.</div>
|
||||
<div class="social">
|
||||
<a href="https://twitter.com/snapdrop42" target="_blank">
|
||||
<a href="https://twitter.com/intent/tweet?text=https://snapdrop.net%20by%20@robin_linus%20&" target="_blank">
|
||||
<iron-icon icon="chat:twitter"></iron-icon>
|
||||
<paper-tooltip for="" position="bottom" offset="14">
|
||||
Contact us on Twitter!
|
||||
<paper-tooltip position="bottom" offset="14">
|
||||
Tweet about Snapdrop!
|
||||
</paper-tooltip>
|
||||
</a>
|
||||
<a href="https://www.facebook.com/snapdrop.net/" target="_blank">
|
||||
<a href="https://www.facebook.com/RobinLinus" target="_blank">
|
||||
<iron-icon icon="chat:facebook"></iron-icon>
|
||||
<paper-tooltip for="" position="bottom" offset="14">
|
||||
Contact us on Facebook!
|
||||
<paper-tooltip position="bottom" offset="14">
|
||||
Like my Facebook Page!
|
||||
</paper-tooltip>
|
||||
</a>
|
||||
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R9C5E42UYEQCN" target="_blank">
|
||||
<a href="https://www.paypal.com/cgi-bin/webscr?business=robin@capira.de&cmd=_xclick¤cy_code=USD&item_name=Snapdrop&shipping=0" target="_blank">
|
||||
<iron-icon icon="chat:local-cafe"></iron-icon>
|
||||
<paper-tooltip for="" position="bottom" offset="14">
|
||||
<paper-tooltip 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">
|
||||
<a href="https://github.com/yougrow/snapdrop" target="_blank" class="github">
|
||||
<iron-icon icon="chat:github"></iron-icon>
|
||||
<paper-tooltip for="" position="bottom" offset="14">
|
||||
<paper-tooltip position="bottom" offset="14">
|
||||
Get involved!
|
||||
</paper-tooltip>
|
||||
</a>
|
||||
<a href="https://github.com/capira12/snapdrop#frequently-asked-questions" target="_blank" class="github">
|
||||
<a href="https://github.com/yougrow/snapdrop#frequently-asked-questions" target="_blank" class="github">
|
||||
<iron-icon icon="chat:help-outline"></iron-icon>
|
||||
<paper-tooltip for="" position="bottom" offset="14">
|
||||
<paper-tooltip position="bottom" offset="14">
|
||||
Frequently Asked Questions
|
||||
</paper-tooltip>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<span id="footer">Built with ♥ by <a href="https://twitter.com/capira42" target="_blank">Robin Linus</a></span>
|
||||
<span id="footer"><a href="https://twitter.com/robin_linus" target="_blank">Built with ♥ by Robin Linus</a></span>
|
||||
</div>
|
||||
</template>
|
||||
</dom-module>
|
||||
|
|
92
app/elements/x-cards/settings-page.html
Normal file
92
app/elements/x-cards/settings-page.html
Normal file
|
@ -0,0 +1,92 @@
|
|||
<dom-module id="settings-page">
|
||||
<template>
|
||||
<style>
|
||||
:host {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
color: white;
|
||||
z-index: 3
|
||||
}
|
||||
|
||||
#placeholder {
|
||||
opacity: 0;
|
||||
background-color: #4285f4;
|
||||
@apply(--layout-fit);
|
||||
}
|
||||
/* paper-icon-button {
|
||||
position: absolute;
|
||||
top: 16px;
|
||||
right: 16px;
|
||||
z-index: 2;
|
||||
}*/
|
||||
|
||||
#container {
|
||||
@apply(--layout-fit);
|
||||
@apply(--layout-vertical);
|
||||
@apply(--layout-center-center);
|
||||
background-color: #4285f4;
|
||||
padding: 64px 32px 64px 32px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
</template>
|
||||
<script>
|
||||
'use strict';
|
||||
Polymer({
|
||||
is: 'settings-page',
|
||||
behaviors: [
|
||||
Polymer.NeonSharedElementAnimatableBehavior
|
||||
],
|
||||
properties: {
|
||||
animationConfig: {
|
||||
value: function() {
|
||||
return {
|
||||
'entry': [{
|
||||
name: 'ripple-animation',
|
||||
id: 'ripple',
|
||||
toPage: this
|
||||
}, {
|
||||
name: 'fade-out-animation',
|
||||
node: this.$.placeholder,
|
||||
timing: {
|
||||
delay: 250
|
||||
}
|
||||
}, {
|
||||
name: 'fade-in-animation',
|
||||
node: this.$.container,
|
||||
timing: {
|
||||
delay: 50
|
||||
}
|
||||
}],
|
||||
'exit': [{
|
||||
name: 'opaque-animation',
|
||||
node: this.$.placeholder
|
||||
}, {
|
||||
name: 'fade-out-animation',
|
||||
node: this.$.container,
|
||||
timing: {
|
||||
duration: 0
|
||||
}
|
||||
}, {
|
||||
name: 'reverse-ripple-animation',
|
||||
id: 'reverse-ripple',
|
||||
fromPage: this
|
||||
}]
|
||||
};
|
||||
}
|
||||
},
|
||||
sharedElements: {
|
||||
value: function() {
|
||||
return {
|
||||
'ripple': this.$.placeholder,
|
||||
'reverse-ripple': this.$.placeholder
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
_switch: function() {
|
||||
document.querySelector('#pages').select(0);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
Loading…
Add table
Add a link
Reference in a new issue