Improved FxOS downloads

This commit is contained in:
Igor Zhukov 2014-11-27 16:48:42 +00:00
parent bf3e0ab630
commit b69df79e85
5 changed files with 43 additions and 1 deletions

View File

@ -1870,6 +1870,9 @@ img.img_fullsize {
-ms-interpolation-mode: nearest-neighbor; /* IE8+ */
}
.video_full_player video {
background: #000;
}
.media_modal_info {
color: #999;

View File

@ -1166,6 +1166,9 @@ a.mobile_modal_action .tg_checkbox_label {
font-size: 13px;
height: 46px;
}
.media_modal_top_actions .navbar-quick-media-back:hover {
text-decoration: none;
}
.media_modal_top_actions .navbar-quick-media-back .icon-back {
position: absolute;
margin-left: -18px;

View File

@ -214,6 +214,26 @@ angular.module('izhukov.utils', [])
window.navigator.msSaveBlob(blob, fileName);
return false;
}
if (window.navigator && navigator.getDeviceStorage) {
var storageName = 'sdcard';
switch (mimeType.split('/')[0]) {
case 'video': storageName = 'videos'; break;
case 'audio': storageName = 'music'; break;
case 'image': storageName = 'pictures'; break;
}
var deviceStorage = navigator.getDeviceStorage(storageName);
var request = deviceStorage.addNamed(blob, fileName);
request.onsuccess = function () {
console.log('Device storage save result', this.result);
};
request.onerror = function () {
};
return;
}
getFileCorrectUrl(blob, mimeType).then(function (url) {
var anchor = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
anchor.href = url;

View File

@ -2573,7 +2573,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
function saveVideoFile (videoID) {
var video = videos[videoID],
mimeType = video.mime_type || 'video/mpeg4',
mimeType = video.mime_type || 'video/mp4',
fileExt = mimeType.split('.')[1] || 'mp4',
fileName = 't_video' + videoID + '.' + fileExt,
historyVideo = videosForHistory[videoID] || video || {};

View File

@ -28,6 +28,22 @@
},
"push": {
"description": "Required for notifications"
},
"device-storage:music": {
"description": "Required for voice notes download",
"access": "createonly"
},
"device-storage:pictures": {
"description": "Required for photos download",
"access": "createonly"
},
"device-storage:sdcard": {
"description": "Required for documents download",
"access": "createonly"
},
"device-storage:videos": {
"description": "Required for videos download",
"access": "createonly"
}
},
"activities": {