Fixed track collection downloads in Firefox and Safari

Firefox and Safari mistook the previous track collection download code for a
popup and blocked it, making it difficult to download transcoded-on-demand
collections in those browsers.
This commit is contained in:
Peter Deltchev 2017-09-16 02:27:54 -07:00
parent 6cc959069f
commit dba3669d7e
5 changed files with 10288 additions and 5 deletions

View file

@ -123,6 +123,9 @@ class Comment extends Model
]; ];
} }
/**
* @return Commentable
*/
public function getResourceAttribute():Commentable public function getResourceAttribute():Commentable
{ {
if ($this->track_id !== null) { if ($this->track_id !== null) {

10253
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -29,7 +29,7 @@
"gulp-header": "1.8.2", "gulp-header": "1.8.2",
"gulp-htmlmin": "^3.0.0", "gulp-htmlmin": "^3.0.0",
"gulp-if": "2.0.1", "gulp-if": "2.0.1",
"gulp-imagemin": "^3.1.1", "gulp-imagemin": "^3.3.0",
"gulp-inject-string": "^1.1.0", "gulp-inject-string": "^1.1.0",
"gulp-inline-css": "^3.1.0", "gulp-inline-css": "^3.1.0",
"gulp-less": "3.1.0", "gulp-less": "3.1.0",
@ -38,14 +38,14 @@
"gulp-notify": "2.2.0", "gulp-notify": "2.2.0",
"gulp-plumber": "1.1.0", "gulp-plumber": "1.1.0",
"gulp-replace": "^0.5.4", "gulp-replace": "^0.5.4",
"gulp-sass": "^3.0.0", "gulp-sass": "^3.1.0",
"gulp-sourcemaps": "1.6.0", "gulp-sourcemaps": "1.6.0",
"gulp-uncss": "^1.0.6", "gulp-uncss": "^1.0.6",
"gulp-util": "3.0.7", "gulp-util": "3.0.7",
"inky": "^1.3.7", "inky": "^1.3.7",
"jquery": "2.2.4", "jquery": "2.2.4",
"lazypipe": "^1.0.1", "lazypipe": "^1.0.1",
"panini": "^1.3.1", "panini": "^1.5.1",
"run-sequence": "^1.2.2", "run-sequence": "^1.2.2",
"script-loader": "0.7.0", "script-loader": "0.7.0",
"siphon-media-query": "^1.0.0", "siphon-media-query": "^1.0.0",

View file

@ -64,6 +64,20 @@ module.exports = angular.module('ponyfm').controller "album", [
, 5000) , 5000)
else else
$scope.isInProgress = false $scope.isInProgress = false
$window.open $scope.albumUrl
# Use a hidden iframe to trigger a cross-browser-friendly
# download
# Based on: https://stackoverflow.com/a/3069972
iframe = document.createElement('iframe');
iframe.style.display = "none";
iframe.src = $scope.albumUrl;
document.body.appendChild(iframe);
# Clean up the iframe after the download has had time to begin
$timeout(
() ->
iframe.outerHTML = ""
, 10000)
$scope.checkMixedLosslessness(format) $scope.checkMixedLosslessness(format)
] ]

View file

@ -58,6 +58,19 @@ module.exports = angular.module('ponyfm').controller 'playlist', [
, 5000) , 5000)
else else
$scope.isInProgress = false $scope.isInProgress = false
$window.open $scope.playlistUrl
# Use a hidden iframe to trigger a cross-browser-friendly
# download
# Based on: https://stackoverflow.com/a/3069972
iframe = document.createElement('iframe');
iframe.style.display = "none";
iframe.src = $scope.playlistUrl;
document.body.appendChild(iframe);
# Clean up the iframe after the download has had time to begin
$timeout(
() ->
iframe.outerHTML = ""
, 10000)
$scope.checkMixedLosslessness(format) $scope.checkMixedLosslessness(format)
] ]