Merge branch 'small-updates'
commit
c243a635b1
1
images/icon/download.svg
Normal file
1
images/icon/download.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path fill="#000" d="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z" /></svg>
|
||||||
|
After Width: | Height: | Size: 348 B |
@ -25,6 +25,7 @@ require( [
|
|||||||
'views/workspaceview',
|
'views/workspaceview',
|
||||||
'views/welcomeview',
|
'views/welcomeview',
|
||||||
'views/settingsview',
|
'views/settingsview',
|
||||||
|
'views/downloadview',
|
||||||
'models/controlsmodel',
|
'models/controlsmodel',
|
||||||
'models/imagemodel',
|
'models/imagemodel',
|
||||||
'models/glitchmodel',
|
'models/glitchmodel',
|
||||||
@ -54,6 +55,7 @@ require( [
|
|||||||
WorkspaceView,
|
WorkspaceView,
|
||||||
WelcomeView,
|
WelcomeView,
|
||||||
SettingsView,
|
SettingsView,
|
||||||
|
DownloadView,
|
||||||
ControlsModel,
|
ControlsModel,
|
||||||
ImageModel,
|
ImageModel,
|
||||||
GlitchModel,
|
GlitchModel,
|
||||||
@ -87,9 +89,10 @@ require( [
|
|||||||
var saveView = SaveView( navView.el );
|
var saveView = SaveView( navView.el );
|
||||||
var webcamView = WebCamView( navView.el );
|
var webcamView = WebCamView( navView.el );
|
||||||
var shareView = ShareView( navView.el );
|
var shareView = ShareView( navView.el );
|
||||||
var aboutView = AboutView( navView.el );
|
|
||||||
var settingsView = SettingsView( navView.el );
|
var settingsView = SettingsView( navView.el );
|
||||||
|
var aboutView = AboutView( navView.el );
|
||||||
var fullscreenView = FullscreenView( workspaceView.el );
|
var fullscreenView = FullscreenView( workspaceView.el );
|
||||||
|
var downloadView = DownloadView( workspaceView.el );
|
||||||
var dragAndDropView = DragAndDropView( canvasView.el );
|
var dragAndDropView = DragAndDropView( canvasView.el );
|
||||||
var welcomeView = WelcomeView();
|
var welcomeView = WelcomeView();
|
||||||
|
|
||||||
@ -318,13 +321,12 @@ require( [
|
|||||||
var downloadLinkTimeoutId = NaN;
|
var downloadLinkTimeoutId = NaN;
|
||||||
|
|
||||||
function updateDownloadLink () {
|
function updateDownloadLink () {
|
||||||
if ( saveView.getActive() ) {
|
clearTimeout( downloadLinkTimeoutId );
|
||||||
clearTimeout( downloadLinkTimeoutId );
|
|
||||||
|
|
||||||
downloadLinkTimeoutId = setTimeout( function () {
|
downloadLinkTimeoutId = setTimeout( function () {
|
||||||
glitchModel.getImageGenerationFn( saveView.updateDownloadLink, 'original' )( imageModel.getLastFileName() )
|
glitchModel.getImageGenerationFn( saveView.updateDownloadLink, 'original' )( imageModel.getLastFileName() );
|
||||||
}, 200 );
|
glitchModel.getImageGenerationFn( downloadView.updateDownloadLink, 'original' )( imageModel.getLastFileName() );
|
||||||
}
|
}, 200 );
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideAppLoader () {
|
function hideAppLoader () {
|
||||||
|
|||||||
49
scripts/views/downloadview.js
Normal file
49
scripts/views/downloadview.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*global define*/
|
||||||
|
define(
|
||||||
|
[ 'util/browser', 'util/el', 'util/time' ],
|
||||||
|
function ( browser, elHelper, timeHelper ) {
|
||||||
|
// the fullscreen button
|
||||||
|
// includes a lot of code to account for the different browser implementations
|
||||||
|
function DownloadView ( parentEl ) {
|
||||||
|
if ( ! ( this instanceof DownloadView ) ) {
|
||||||
|
return new DownloadView( parentEl );
|
||||||
|
}
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
var isInFullScreen = false;
|
||||||
|
var downloadLinkEl = elHelper.createLink(
|
||||||
|
'file.download',
|
||||||
|
'file.downloadtitle',
|
||||||
|
null, null,
|
||||||
|
'download-button',
|
||||||
|
parentEl
|
||||||
|
);
|
||||||
|
|
||||||
|
downloadLinkEl.target = '_blank';;
|
||||||
|
|
||||||
|
// the href attribute of the download link is updated every time
|
||||||
|
// we change a parameter
|
||||||
|
function updateDownloadLink ( newUrl, fileName ) {
|
||||||
|
fileName = fileName || 'glitched';
|
||||||
|
|
||||||
|
var newNameParts = fileName.split( '/' );
|
||||||
|
var newName = newNameParts.length > 1 ? newNameParts.pop() : newNameParts[0];
|
||||||
|
newName = newName.split( '.' ).shift();
|
||||||
|
|
||||||
|
date = new Date();
|
||||||
|
fileId = timeHelper.dateTimeToLocalStr( date );
|
||||||
|
var newFileName = ( newName + '-glitched-' + fileId + '.png' )
|
||||||
|
newFileName = newFileName.replace( /(\s|\/|:)/gmi, '-' );
|
||||||
|
|
||||||
|
// setting the download attribute makes the browser
|
||||||
|
// download the link target instead of opening it
|
||||||
|
downloadLinkEl.setAttribute( 'download', newFileName );
|
||||||
|
downloadLinkEl.href = newUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.updateDownloadLink = updateDownloadLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DownloadView;
|
||||||
|
}
|
||||||
|
);
|
||||||
@ -162,10 +162,20 @@ define(
|
|||||||
var dx = touchPos.x - touchStartPos.x;
|
var dx = touchPos.x - touchStartPos.x;
|
||||||
|
|
||||||
if ( translateX > -navWidth && translateX < 0 && Math.abs( dx ) > 0 ) {
|
if ( translateX > -navWidth && translateX < 0 && Math.abs( dx ) > 0 ) {
|
||||||
if ( translateX < -navWidth / 2 ) {
|
if ( dx > 0 ) {
|
||||||
deactivate();
|
// swiped in
|
||||||
|
if ( translateX < -navWidth * 0.75 ) {
|
||||||
|
deactivate();
|
||||||
|
} else {
|
||||||
|
activate();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
activate();
|
// swiped out
|
||||||
|
if ( translateX < -navWidth * 0.25 ) {
|
||||||
|
deactivate();
|
||||||
|
} else {
|
||||||
|
activate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,12 +69,12 @@ define(
|
|||||||
.add( isOnlineCssClass, uploadButtonEl )
|
.add( isOnlineCssClass, uploadButtonEl )
|
||||||
.add( isOnlineCssClass, 'loader', statusEl )
|
.add( isOnlineCssClass, 'loader', statusEl )
|
||||||
.add( isOnlineCssClass, imgLinkLabel, imgLinkEl )
|
.add( isOnlineCssClass, imgLinkLabel, imgLinkEl )
|
||||||
.add( isOnlineCssClass, imgurLinkEl )
|
|
||||||
.add( isOnlineCssClass, redditShareLinkEl )
|
|
||||||
.add( isOnlineCssClass, twitterShareLinkEl )
|
.add( isOnlineCssClass, twitterShareLinkEl )
|
||||||
.add( isOnlineCssClass, facebookShareLinkEl )
|
.add( isOnlineCssClass, facebookShareLinkEl )
|
||||||
.add( isOnlineCssClass, pinterestShareLinkEl )
|
.add( isOnlineCssClass, imgurLinkEl )
|
||||||
.add( isOnlineCssClass, vkontakteShareLinkEl );
|
.add( isOnlineCssClass, redditShareLinkEl )
|
||||||
|
.add( isOnlineCssClass, vkontakteShareLinkEl )
|
||||||
|
.add( isOnlineCssClass, pinterestShareLinkEl );
|
||||||
|
|
||||||
if ( browser.test( 'localforage' ) ) {
|
if ( browser.test( 'localforage' ) ) {
|
||||||
sharedListEl = elHelper.createEl( 'ul', 'shared-list dialog-list' );
|
sharedListEl = elHelper.createEl( 'ul', 'shared-list dialog-list' );
|
||||||
@ -326,7 +326,7 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( service === 'twitter' ) {
|
if ( service === 'twitter' ) {
|
||||||
params.text = loc( 'share.link.description.withname' ) + ' ' + imgUrl + ' ' + config.share.appURL;
|
params.text = loc( 'share.link.description.withname' ) + ' ' + imgurLink + ' ' + config.share.appURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return config.share.sharer[service] + '?' + strHelper.objToQueryStr( params );
|
return config.share.sharer[service] + '?' + strHelper.objToQueryStr( params );
|
||||||
|
|||||||
@ -90,8 +90,10 @@ define(
|
|||||||
function userMediaFailed () {
|
function userMediaFailed () {
|
||||||
if ( stream ) {
|
if ( stream ) {
|
||||||
stopStream();
|
stopStream();
|
||||||
publishers.error.dispatch( 'webcam.error.access' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closeVideo();
|
||||||
|
publishers.error.dispatch( 'webcam.error.access' );
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeVideo () {
|
function closeVideo () {
|
||||||
|
|||||||
@ -25,6 +25,7 @@ function updateStaticCache () {
|
|||||||
'images/icon/open-in-app.svg',
|
'images/icon/open-in-app.svg',
|
||||||
'images/icon/share-variant.svg',
|
'images/icon/share-variant.svg',
|
||||||
'images/icon/settings.svg',
|
'images/icon/settings.svg',
|
||||||
|
'images/icon/download.svg',
|
||||||
'lang/en-us.json'
|
'lang/en-us.json'
|
||||||
] );
|
] );
|
||||||
// These items must be cached for the Service Worker to complete installation
|
// These items must be cached for the Service Worker to complete installation
|
||||||
|
|||||||
@ -2,4 +2,8 @@
|
|||||||
content: '';
|
content: '';
|
||||||
display: table;
|
display: table;
|
||||||
clear: both;
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
a, button {
|
||||||
|
-webkit-tap-highlight-color: rgba( 0, 0, 0, 0 );
|
||||||
}
|
}
|
||||||
@ -289,6 +289,16 @@
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.has-touch .share-dialog .dialog-item .button {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.has-touch .share-dialog .entry-button-wrapper .button {
|
||||||
|
width: auto;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
/*pulse keyframe animation is inlined in html*/
|
/*pulse keyframe animation is inlined in html*/
|
||||||
|
|
||||||
.dialog .loader {
|
.dialog .loader {
|
||||||
|
|||||||
@ -82,7 +82,8 @@ input.scale-slider {
|
|||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fullscreen-button {
|
.fullscreen-button,
|
||||||
|
.download-button {
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
@ -102,6 +103,11 @@ input.scale-slider {
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.download-button {
|
||||||
|
top: 60px;
|
||||||
|
background-image: url(../../images/icon/download.svg);
|
||||||
|
}
|
||||||
|
|
||||||
html:not(.has-touch) .fullscreen-button {
|
html:not(.has-touch) .fullscreen-button {
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user