From b00982cd61ea8429b0ac3cede5e579f56eaf7737 Mon Sep 17 00:00:00 2001 From: Peter Deltchev Date: Sat, 24 Oct 2015 19:35:37 -0700 Subject: [PATCH] Converted a bunch of tabs to spaces. --- app/Commands/CreateCommentCommand.php | 28 +- app/Commands/ToggleFavouriteCommand.php | 12 +- app/Console/Commands/ClassifyMLPMA.php | 2 +- app/Console/Commands/ImportMLPMA.php | 4 +- app/Console/Commands/PoniverseApiSetup.php | 14 +- app/Library/Poniverse/Poniverse.php | 6 +- app/Library/Poniverse/oauth2/Client.php | 2 +- app/Library/ZipStream.php | 1100 ++++++++--------- app/ResourceLogItem.php | 28 +- app/Track.php | 14 +- config/newrelic.php | 66 +- config/poniverse.php | 18 +- ...2013_09_10_014644_create_latest_column.php | 38 +- .../2013_09_24_055911_track_is_listed.php | 10 +- public/.htaccess | 8 +- public/images/fm_logo_white.svg | 162 +-- public/template.php | 2 +- public/templates/account/_layout.html | 8 +- public/templates/account/album.html | 94 +- public/templates/account/albums.html | 50 +- public/templates/account/playlists.html | 38 +- public/templates/account/settings.html | 68 +- public/templates/account/track.html | 238 ++-- public/templates/account/tracks.html | 24 +- public/templates/albums/index.html | 14 +- public/templates/albums/list.html | 2 +- public/templates/albums/show.html | 90 +- public/templates/artists/_show_layout.html | 40 +- public/templates/artists/content.html | 14 +- public/templates/artists/favourites.html | 18 +- public/templates/artists/index.html | 14 +- public/templates/artists/list.html | 40 +- public/templates/artists/profile.html | 28 +- public/templates/auth/login.html | 12 +- public/templates/auth/register.html | 6 +- public/templates/content/_layout.html | 10 +- public/templates/dashboard/index.html | 38 +- public/templates/directives/albums-list.html | 38 +- public/templates/directives/comments.html | 42 +- .../directives/favourite-button.html | 18 +- public/templates/directives/image-upload.html | 38 +- public/templates/directives/player.html | 72 +- .../templates/directives/playlists-list.html | 38 +- public/templates/directives/track-player.html | 12 +- public/templates/directives/tracks-list.html | 52 +- public/templates/errors/500.html | 4 +- public/templates/favourites/_layout.html | 22 +- public/templates/favourites/albums.html | 4 +- public/templates/favourites/playlists.html | 4 +- public/templates/favourites/tracks.html | 4 +- public/templates/home/index.html | 54 +- public/templates/pages/about.html | 40 +- public/templates/pages/faq.html | 128 +- .../partials/album-share-dialog.html | 14 +- public/templates/partials/auth/login.html | 52 +- public/templates/partials/credits-dialog.html | 12 +- .../templates/partials/playlist-dialog.html | 76 +- .../partials/playlist-share-dialog.html | 14 +- .../partials/track-share-dialog.html | 22 +- public/templates/playlists/index.html | 14 +- public/templates/playlists/list.html | 4 +- public/templates/playlists/show.html | 88 +- public/templates/tracks/index.html | 132 +- public/templates/tracks/list.html | 4 +- public/templates/tracks/show.html | 142 +-- public/templates/uploader/index.html | 54 +- resources/assets/scripts/app/app.coffee | 382 +++--- .../controllers/account-albums-edit.coffee | 224 ++-- .../app/controllers/account-albums.coffee | 64 +- .../controllers/account-image-select.coffee | 16 +- .../app/controllers/account-playlists.coffee | 66 +- .../app/controllers/account-settings.coffee | 96 +- .../app/controllers/account-track.coffee | 240 ++-- .../app/controllers/account-tracks.coffee | 62 +- .../scripts/app/controllers/album.coffee | 38 +- .../app/controllers/albums-list.coffee | 16 +- .../scripts/app/controllers/albums.coffee | 34 +- .../app/controllers/application.coffee | 132 +- .../app/controllers/artist-content.coffee | 18 +- .../app/controllers/artist-favourites.coffee | 16 +- .../app/controllers/artist-profile.coffee | 12 +- .../scripts/app/controllers/artist.coffee | 24 +- .../app/controllers/artists-list.coffee | 16 +- .../scripts/app/controllers/artists.coffee | 34 +- .../scripts/app/controllers/credits.coffee | 6 +- .../scripts/app/controllers/dashboard.coffee | 18 +- .../app/controllers/favourites-albums.coffee | 16 +- .../controllers/favourites-playlists.coffee | 16 +- .../app/controllers/favourites-tracks.coffee | 16 +- .../scripts/app/controllers/home.coffee | 18 +- .../scripts/app/controllers/login.coffee | 26 +- .../app/controllers/playlist-form.coffee | 40 +- .../scripts/app/controllers/playlist.coffee | 30 +- .../app/controllers/playlists-list.coffee | 16 +- .../scripts/app/controllers/playlists.coffee | 34 +- .../scripts/app/controllers/sidebar.coffee | 76 +- .../scripts/app/controllers/track.coffee | 88 +- .../app/controllers/tracks-list.coffee | 24 +- .../scripts/app/controllers/tracks.coffee | 66 +- .../scripts/app/controllers/uploader.coffee | 8 +- .../scripts/app/directives/albums-list.coffee | 22 +- .../scripts/app/directives/comments.coffee | 46 +- .../scripts/app/directives/eat-click.coffee | 6 +- .../app/directives/favouriteButton.coffee | 36 +- .../app/directives/image-upload.coffee | 136 +- .../scripts/app/directives/player.coffee | 112 +- .../app/directives/playlists-list.coffee | 22 +- .../scripts/app/directives/popup.coffee | 136 +- .../app/directives/progress-bar.coffee | 8 +- .../app/directives/scroll-recorder.coffee | 42 +- .../app/directives/share-buttons.coffee | 10 +- .../scripts/app/directives/src-loader.coffee | 36 +- .../app/directives/track-player.coffee | 24 +- .../scripts/app/directives/tracks-list.coffee | 34 +- .../scripts/app/directives/uploader.coffee | 30 +- .../assets/scripts/app/filters/length.coffee | 4 +- .../app/filters/moment-from-now.coffee | 4 +- .../scripts/app/filters/newlines.coffee | 6 +- .../assets/scripts/app/filters/noHTML.coffee | 10 +- .../assets/scripts/app/filters/pfm-date.js | 376 +++--- .../app/filters/seconds-display.coffee | 32 +- .../assets/scripts/app/filters/trust.coffee | 12 +- .../app/services/account-albums.coffee | 44 +- .../app/services/account-tracks.coffee | 48 +- .../assets/scripts/app/services/albums.coffee | 50 +- .../scripts/app/services/artists.coffee | 98 +- .../assets/scripts/app/services/auth.coffee | 24 +- .../scripts/app/services/comments.coffee | 40 +- .../scripts/app/services/dashboard.coffee | 26 +- .../scripts/app/services/favourites.coffee | 62 +- .../assets/scripts/app/services/follow.coffee | 20 +- .../assets/scripts/app/services/images.coffee | 36 +- .../scripts/app/services/lightbox.coffee | 18 +- .../assets/scripts/app/services/player.coffee | 218 ++-- .../scripts/app/services/playlists.coffee | 204 +-- .../scripts/app/services/taxonomies.coffee | 60 +- .../assets/scripts/app/services/tracks.coffee | 368 +++--- .../assets/scripts/app/services/upload.coffee | 84 +- resources/assets/styles/account-content.less | 604 ++++----- .../assets/styles/base/bootstrap/mixins.less | 8 +- resources/assets/styles/body.less | 196 +-- resources/assets/styles/components.less | 444 +++---- resources/assets/styles/content.less | 602 ++++----- resources/assets/styles/dashboard.less | 150 +-- resources/assets/styles/embed.less | 182 +-- resources/assets/styles/forms.less | 26 +- resources/assets/styles/layout.less | 250 ++-- resources/assets/styles/mixins.less | 58 +- resources/assets/styles/player.less | 284 ++--- resources/assets/styles/profiler.less | 246 ++-- resources/assets/styles/uploader.less | 130 +- resources/lang/en/validation.php | 14 +- resources/views/albums/index.blade.php | 6 +- resources/views/albums/show.blade.php | 6 +- resources/views/artists/index.blade.php | 6 +- resources/views/artists/profile.blade.php | 6 +- resources/views/auth/login.blade.php | 6 +- resources/views/auth/register.blade.php | 6 +- resources/views/errors/400.blade.php | 12 +- resources/views/errors/403.blade.php | 12 +- resources/views/errors/404.blade.php | 12 +- resources/views/errors/500.blade.php | 12 +- resources/views/home/index.blade.php | 18 +- resources/views/pages/about.blade.php | 4 +- resources/views/pages/faq.blade.php | 4 +- resources/views/playlists/index.blade.php | 6 +- resources/views/playlists/show.blade.php | 6 +- resources/views/shared/_app_layout.blade.php | 186 +-- resources/views/shared/_layout.blade.php | 28 +- resources/views/shared/null.blade.php | 4 +- resources/views/tracks/embed.blade.php | 90 +- resources/views/tracks/index.blade.php | 6 +- resources/views/tracks/show.blade.php | 6 +- vagrant/install.sh | 18 +- vagrant/pony.fm.mysql.config | 50 +- vagrant/pony.fm.nginx.config | 112 +- vagrant/pony.fm.nginx.site.config | 10 +- 177 files changed, 5958 insertions(+), 5958 deletions(-) diff --git a/app/Commands/CreateCommentCommand.php b/app/Commands/CreateCommentCommand.php index 54c215f0..cac33db8 100644 --- a/app/Commands/CreateCommentCommand.php +++ b/app/Commands/CreateCommentCommand.php @@ -78,25 +78,25 @@ class CreateCommentCommand extends CommandBase $comment->$column = $this->_id; $comment->save(); - // Recount the track's comments, if this is a track comment - if ($this->_type === 'track') { - $entity = Track::find($this->_id); + // Recount the track's comments, if this is a track comment + if ($this->_type === 'track') { + $entity = Track::find($this->_id); - } elseif ($this->_type === 'album') { - $entity = Album::find($this->_id); + } elseif ($this->_type === 'album') { + $entity = Album::find($this->_id); - } elseif ($this->_type === 'playlist') { - $entity = Playlist::find($this->_id); + } elseif ($this->_type === 'playlist') { + $entity = Playlist::find($this->_id); - } elseif ($this->_type === 'user') { - $entity = User::find($this->_id); + } elseif ($this->_type === 'user') { + $entity = User::find($this->_id); - } else { - App::abort(400, 'This comment is being added to an invalid entity!'); - } + } else { + App::abort(400, 'This comment is being added to an invalid entity!'); + } - $entity->comment_count = Comment::where($column, $this->_id)->count(); - $entity->save(); + $entity->comment_count = Comment::where($column, $this->_id)->count(); + $entity->save(); return CommandResponse::succeed(Comment::mapPublic($comment)); } diff --git a/app/Commands/ToggleFavouriteCommand.php b/app/Commands/ToggleFavouriteCommand.php index 1928e71e..ba496fa5 100644 --- a/app/Commands/ToggleFavouriteCommand.php +++ b/app/Commands/ToggleFavouriteCommand.php @@ -62,14 +62,14 @@ class ToggleFavouriteCommand extends CommandBase DB::table($resourceTable)->whereId($this->_resourceId)->update([ 'favourite_count' => DB::raw('( - SELECT - COUNT(id) - FROM - favourites - WHERE ' . + SELECT + COUNT(id) + FROM + favourites + WHERE ' . $typeId . ' = ' . $this->_resourceId . ')') ]); return CommandResponse::succeed(['is_favourited' => $isFavourited]); } -} \ No newline at end of file +} diff --git a/app/Console/Commands/ClassifyMLPMA.php b/app/Console/Commands/ClassifyMLPMA.php index 649bc315..92ed7299 100644 --- a/app/Console/Commands/ClassifyMLPMA.php +++ b/app/Console/Commands/ClassifyMLPMA.php @@ -80,7 +80,7 @@ class ClassifyMLPMA extends Command $queriedTitle = DB::connection()->getPdo()->quote($sanitizedTrackTitle); $officialSongs = ShowSong::select(['id', 'title']) ->whereRaw(" - MATCH (title) + MATCH (title) AGAINST ($queriedTitle IN BOOLEAN MODE) ") ->get(); diff --git a/app/Console/Commands/ImportMLPMA.php b/app/Console/Commands/ImportMLPMA.php index e312acb0..897a0efe 100644 --- a/app/Console/Commands/ImportMLPMA.php +++ b/app/Console/Commands/ImportMLPMA.php @@ -167,12 +167,12 @@ class ImportMLPMA extends Command list($parsedTags, $rawTags) = $this->getVorbisTags($allTags); } elseif (Str::lower($file->getExtension()) === 'wav') { - list($parsedTags, $rawTags) = $this->getAtomTags($allTags); + list($parsedTags, $rawTags) = $this->getAtomTags($allTags); } - //========================================================================================================== + //========================================================================================================== // Determine the release date. //========================================================================================================== $modifiedDate = Carbon::createFromTimeStampUTC(File::lastModified($file->getPathname())); diff --git a/app/Console/Commands/PoniverseApiSetup.php b/app/Console/Commands/PoniverseApiSetup.php index fb5e312e..c11faf88 100644 --- a/app/Console/Commands/PoniverseApiSetup.php +++ b/app/Console/Commands/PoniverseApiSetup.php @@ -42,15 +42,15 @@ class PoniverseApiSetup extends Command { $this->output->getFormatter()->setStyle('bold', new OutputFormatterStyle(null, null, ['bold'])); - $this->comment('Sign in with your Poniverse account! Your password won\'t be stored locally.'); - $this->line(''); - $this->comment('This sets up your Poniverse API credentials, which are necessary for Pony.fm\'s integration with Poniverse to work.'); - $this->line(''); - $this->comment('If you don\'t have a Poniverse account, create one at: https://poniverse.net/register'); + $this->comment('Sign in with your Poniverse account! Your password won\'t be stored locally.'); + $this->line(''); + $this->comment('This sets up your Poniverse API credentials, which are necessary for Pony.fm\'s integration with Poniverse to work.'); + $this->line(''); + $this->comment('If you don\'t have a Poniverse account, create one at: https://poniverse.net/register'); $username = $this->ask('Your Poniverse username'); $password = $this->secret('Your Poniverse password'); - // log in + // log in $client = new Client(['base_uri' => 'https://api.poniverse.net/v1/dev/']); try { @@ -75,7 +75,7 @@ class PoniverseApiSetup extends Command $clientId = $json->id; $clientSecret = $json->secret; - // save new key to .env + // save new key to .env $this->setEnvironmentVariable('PONI_CLIENT_ID', $this->laravel['config']['poniverse.client_id'], $clientId); $this->setEnvironmentVariable('PONI_CLIENT_SECRET', $this->laravel['config']['poniverse.secret'], $clientSecret); diff --git a/app/Library/Poniverse/Poniverse.php b/app/Library/Poniverse/Poniverse.php index 3ad250cf..19ea1b8b 100644 --- a/app/Library/Poniverse/Poniverse.php +++ b/app/Library/Poniverse/Poniverse.php @@ -11,7 +11,7 @@ class Poniverse { protected $clientSecret; protected $accessToken; protected $redirectUri; - protected $urls; + protected $urls; /** * @var OAuth2\Client @@ -27,7 +27,7 @@ class Poniverse { */ public function __construct($clientId, $clientSecret, $accessToken = '') { - $this->urls = Config::get('poniverse.urls'); + $this->urls = Config::get('poniverse.urls'); $this->clientId = $clientId; $this->clientSecret = $clientSecret; @@ -92,4 +92,4 @@ class Poniverse { return json_decode($result, true); } -} \ No newline at end of file +} diff --git a/app/Library/Poniverse/oauth2/Client.php b/app/Library/Poniverse/oauth2/Client.php index 698739fc..2b937440 100644 --- a/app/Library/Poniverse/oauth2/Client.php +++ b/app/Library/Poniverse/oauth2/Client.php @@ -403,7 +403,7 @@ class Client $curl_options[CURLOPT_POST] = true; /* No break */ case self::HTTP_METHOD_PUT: - case self::HTTP_METHOD_PATCH: + case self::HTTP_METHOD_PATCH: /** * Passing an array to CURLOPT_POSTFIELDS will encode the data as multipart/form-data, diff --git a/app/Library/ZipStream.php b/app/Library/ZipStream.php index e627efb8..d3ed6cb1 100644 --- a/app/Library/ZipStream.php +++ b/app/Library/ZipStream.php @@ -20,554 +20,554 @@ * @version 1.37 */ class ZipStream { - const VERSION = 1.37; - - const ZIP_LOCAL_FILE_HEADER = "\x50\x4b\x03\x04"; // Local file header signature - const ZIP_CENTRAL_FILE_HEADER = "\x50\x4b\x01\x02"; // Central file header signature - const ZIP_END_OF_CENTRAL_DIRECTORY = "\x50\x4b\x05\x06\x00\x00\x00\x00"; //end of Central directory record - - const EXT_FILE_ATTR_DIR = "\x10\x00\xFF\x41"; - const EXT_FILE_ATTR_FILE = "\x00\x00\xFF\x81"; - - const ATTR_VERSION_TO_EXTRACT = "\x14\x00"; // Version needed to extract - const ATTR_MADE_BY_VERSION = "\x1E\x03"; // Made By Version - - private $zipMemoryThreshold = 1048576; // Autocreate tempfile if the zip data exceeds 1048576 bytes (1 MB) - - private $zipComment = null; - private $cdRec = array(); // central directory - private $offset = 0; - private $isFinalized = FALSE; - private $addExtraField = TRUE; - - private $streamChunkSize = 16384; // 65536; - private $streamFilePath = null; - private $streamTimeStamp = null; - private $streamComment = null; - private $streamFile = null; - private $streamData = null; - private $streamFileLength = 0; - - /** - * Constructor. - * - * @param String $archiveName Name to send to the HTTP client. - * @param String $contentType Content mime type. Optional, defaults to "application/zip". - */ - function __construct($archiveName = "", $contentType = "application/zip") { - if (!function_exists('sys_get_temp_dir')) { - die ("ERROR: ZipStream " . self::VERSION . " requires PHP version 5.2.1 or above."); - } - - $headerFile = null; - $headerLine = null; - if (!headers_sent($headerFile, $headerLine) or die("

Error: Unable to send file $archiveName. HTML Headers have already been sent from $headerFile in line $headerLine

")) { - if ((ob_get_contents() === FALSE || ob_get_contents() == '') or die("\n

Error: Unable to send file $archiveName.epub. Output buffer contains the following text (typically warnings or errors):
" . ob_get_contents() . "

")) { - if (ini_get('zlib.output_compression')) { - ini_set('zlib.output_compression', 'Off'); - } - - header('Pragma: public'); - header("Last-Modified: " . gmdate("D, d M Y H:i:s T")); - header("Expires: 0"); - header("Accept-Ranges: bytes"); - //header("Connection: Keep-Alive"); - header("Content-Type: " . $contentType); - header('Content-Disposition: attachment; filename="' . $archiveName . '";'); - header("Content-Transfer-Encoding: binary"); - flush(); - } - } - } - - function __destruct() { - $this->isFinalized = TRUE; - $this->cdRec = null; - exit; - } - - /** - * Extra fields on the Zip directory records are Unix time codes needed for compatibility on the default Mac zip archive tool. - * These are enabled as default, as they do no harm elsewhere and only add 26 bytes per file added. - * - * @param bool $setExtraField TRUE (default) will enable adding of extra fields, anything else will disable it. - */ - function setExtraField($setExtraField = TRUE) { - $this->addExtraField = ($setExtraField === TRUE); - } - - /** - * Set Zip archive comment. - * - * @param string $newComment New comment. null to clear. - * @return bool $success - */ - public function setComment($newComment = null) { - if ($this->isFinalized) { - return FALSE; - } - $this->zipComment = $newComment; - - return TRUE; - } - - /** - * Add an empty directory entry to the zip archive. - * Basically this is only used if an empty directory is added. - * - * @param string $directoryPath Directory Path and name to be added to the archive. - * @param int $timestamp (Optional) Timestamp for the added directory, if omitted or set to 0, the current time will be used. - * @param string $fileComment (Optional) Comment to be added to the archive for this directory. To use fileComment, timestamp must be given. - * @return bool $success - */ - public function addDirectory($directoryPath, $timestamp = 0, $fileComment = null) { - if ($this->isFinalized) { - return FALSE; - } - - $directoryPath = str_replace("\\", "/", $directoryPath); - $directoryPath = rtrim($directoryPath, "/"); - - if (strlen($directoryPath) > 0) { - $this->buildZipEntry($directoryPath.'/', $fileComment, "\x00\x00", "\x00\x00", $timestamp, "\x00\x00\x00\x00", 0, 0, self::EXT_FILE_ATTR_DIR); - return TRUE; - } - return FALSE; - } - - /** - * Add a file to the archive at the specified location and file name. - * - * @param string $data File data. - * @param string $filePath Filepath and name to be used in the archive. - * @param int $timestamp (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used. - * @param string $fileComment (Optional) Comment to be added to the archive for this file. To use fileComment, timestamp must be given. - * @return bool $success - */ - public function addFile($data, $filePath, $timestamp = 0, $fileComment = null) { - if ($this->isFinalized) { - return FALSE; - } - - if (is_resource($data) && get_resource_type($data) == "stream") { - $this->addLargeFile($data, $filePath, $timestamp, $fileComment); - return FALSE; - } - - $gzType = "\x08\x00"; // Compression type 8 = deflate - $gpFlags = "\x00\x00"; // General Purpose bit flags for compression type 8 it is: 0=Normal, 1=Maximum, 2=Fast, 3=super fast compression. - $dataLength = strlen($data); - $fileCRC32 = pack("V", crc32($data)); - - $gzData = gzcompress($data); - $gzData = substr(substr($gzData, 0, strlen($gzData) - 4), 2); // gzcompress adds a 2 byte header and 4 byte CRC we can't use. - // The 2 byte header does contain useful data, though in this case the 2 parameters we'd be interrested in will always be 8 for compression type, and 2 for General purpose flag. - $gzLength = strlen($gzData); - - if ($gzLength >= $dataLength) { - $gzLength = $dataLength; - $gzData = $data; - $gzType = "\x00\x00"; // Compression type 0 = stored - $gpFlags = "\x00\x00"; // Compression type 0 = stored - } - - $this->buildZipEntry($filePath, $fileComment, $gpFlags, $gzType, $timestamp, $fileCRC32, $gzLength, $dataLength, self::EXT_FILE_ATTR_FILE); - - print ($gzData); - - return TRUE; - } - - /** - * Add the content to a directory. - * - * @author Adam Schmalhofer - * @author A. Grandt - * - * @param String $realPath Path on the file system. - * @param String $zipPath Filepath and name to be used in the archive. - * @param bool $recursive Add content recursively, default is TRUE. - * @param bool $followSymlinks Follow and add symbolic links, if they are accessible, default is TRUE. - * @param array &$addedFiles Reference to the added files, this is used to prevent duplicates, efault is an empty array. - * If you start the function by parsing an array, the array will be populated with the realPath - * and zipPath kay/value pairs added to the archive by the function. - */ - public function addDirectoryContent($realPath, $zipPath, $recursive = TRUE, $followSymlinks = TRUE, &$addedFiles = array()) { - if (file_exists($realPath) && !isset($addedFiles[realpath($realPath)])) { - if (is_dir($realPath)) { - $this->addDirectory($zipPath); - } - - $addedFiles[realpath($realPath)] = $zipPath; - - $iter = new DirectoryIterator($realPath); - foreach ($iter as $file) { - if ($file->isDot()) { - continue; - } - $newRealPath = $file->getPathname(); - $newZipPath = self::pathJoin($zipPath, $file->getFilename()); - - if (file_exists($newRealPath) && ($followSymlinks === TRUE || !is_link($newRealPath))) { - if ($file->isFile()) { - $addedFiles[realpath($newRealPath)] = $newZipPath; - $this->addLargeFile($newRealPath, $newZipPath); - } else if ($recursive === TRUE) { - $this->addDirectoryContent($newRealPath, $newZipPath, $recursive); - } else { - $this->addDirectory($zipPath); - } - } - } - } - } - - /** - * Add a file to the archive at the specified location and file name. - * - * @param string $dataFile File name/path. - * @param string $filePath Filepath and name to be used in the archive. - * @param int $timestamp (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used. - * @param string $fileComment (Optional) Comment to be added to the archive for this file. To use fileComment, timestamp must be given. - * @return bool $success - */ - public function addLargeFile($dataFile, $filePath, $timestamp = 0, $fileComment = null) { - if ($this->isFinalized) { - return FALSE; - } - - if (is_string($dataFile) && is_file($dataFile)) { - $this->processFile($dataFile, $filePath, $timestamp, $fileComment); - } else if (is_resource($dataFile) && get_resource_type($dataFile) == "stream") { - $fh = $dataFile; - $this->openStream($filePath, $timestamp, $fileComment); - - while (!feof($fh)) { - $this->addStreamData(fread($fh, $this->streamChunkSize)); - } - $this->closeStream($this->addExtraField); - } - return TRUE; - } - - /** - * Create a stream to be used for large entries. - * - * @param string $filePath Filepath and name to be used in the archive. - * @param int $timestamp (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used. - * @param string $fileComment (Optional) Comment to be added to the archive for this file. To use fileComment, timestamp must be given. - * @return bool $success - */ - public function openStream($filePath, $timestamp = 0, $fileComment = null) { - if (!function_exists('sys_get_temp_dir')) { - die ("ERROR: Zip " . self::VERSION . " requires PHP version 5.2.1 or above if large files are used."); - } - - if ($this->isFinalized) { - return FALSE; - } - - if (strlen($this->streamFilePath) > 0) { - closeStream(); - } - - $this->streamFile = tempnam(sys_get_temp_dir(), 'ZipStream'); - $this->streamData = fopen($this->streamFile, "wb"); - $this->streamFilePath = $filePath; - $this->streamTimestamp = $timestamp; - $this->streamFileComment = $fileComment; - $this->streamFileLength = 0; - - return TRUE; - } - - /** - * Add data to the open stream. - * - * @param String $data - * @return $length bytes added or FALSE if the archive is finalized or there are no open stream. - */ - public function addStreamData($data) { - if ($this->isFinalized || strlen($this->streamFilePath) == 0) { - return FALSE; - } - - $length = fwrite($this->streamData, $data, strlen($data)); - if ($length != strlen($data)) { - die ("

Length mismatch

\n"); - } - $this->streamFileLength += $length; - - return $length; - } - - /** - * Close the current stream. - * - * @return bool $success - */ - public function closeStream() { - if ($this->isFinalized || strlen($this->streamFilePath) == 0) { - return FALSE; - } - - fflush($this->streamData); - fclose($this->streamData); - - $this->processFile($this->streamFile, $this->streamFilePath, $this->streamTimestamp, $this->streamFileComment); - - $this->streamData = null; - $this->streamFilePath = null; - $this->streamTimestamp = null; - $this->streamFileComment = null; - $this->streamFileLength = 0; - - // Windows is a little slow at times, so a millisecond later, we can unlink this. - unlink($this->streamFile); - - $this->streamFile = null; - - return TRUE; - } - - private function processFile($dataFile, $filePath, $timestamp = 0, $fileComment = null) { - if ($this->isFinalized) { - return FALSE; - } - - $tempzip = tempnam(sys_get_temp_dir(), 'ZipStream'); - - $zip = new ZipArchive; - if ($zip->open($tempzip) === TRUE) { - $zip->addFile($dataFile, 'file'); - $zip->close(); - } - - $file_handle = fopen($tempzip, "rb"); - $stats = fstat($file_handle); - $eof = $stats['size']-72; - - fseek($file_handle, 6); - - $gpFlags = fread($file_handle, 2); - $gzType = fread($file_handle, 2); - fread($file_handle, 4); - $fileCRC32 = fread($file_handle, 4); - $v = unpack("Vval", fread($file_handle, 4)); - $gzLength = $v['val']; - $v = unpack("Vval", fread($file_handle, 4)); - $dataLength = $v['val']; - - $this->buildZipEntry($filePath, $fileComment, $gpFlags, $gzType, $timestamp, $fileCRC32, $gzLength, $dataLength, self::EXT_FILE_ATTR_FILE); - - fseek($file_handle, 34); - $pos = 34; - - while (!feof($file_handle) && $pos < $eof) { - $datalen = $this->streamChunkSize; - if ($pos + $this->streamChunkSize > $eof) { - $datalen = $eof-$pos; - } - echo fread($file_handle, $datalen); - $pos += $datalen; - flush(); - } - - fclose($file_handle); - unlink($tempzip); - } - - /** - * Close the archive. - * A closed archive can no longer have new files added to it. - * @return bool $success - */ - public function finalize() { - if (!$this->isFinalized) { - if (strlen($this->streamFilePath) > 0) { - $this->closeStream(); - } - - $cdRecSize = pack("v", sizeof($this->cdRec)); - - $cd = implode("", $this->cdRec); - print($cd); - print(self::ZIP_END_OF_CENTRAL_DIRECTORY); - print($cdRecSize.$cdRecSize); - print(pack("VV", strlen($cd), $this->offset)); - if (!empty($this->zipComment)) { - print(pack("v", strlen($this->zipComment))); - print($this->zipComment); - } else { - print("\x00\x00"); - } - - flush(); - - $this->isFinalized = TRUE; - $cd = null; - $this->cdRec = null; - - return TRUE; - } - return FALSE; - } - - /** - * Calculate the 2 byte dostime used in the zip entries. - * - * @param int $timestamp - * @return 2-byte encoded DOS Date - */ - private function getDosTime($timestamp = 0) { - $timestamp = (int)$timestamp; - $oldTZ = @date_default_timezone_get(); - date_default_timezone_set('UTC'); - $date = ($timestamp == 0 ? getdate() : getdate($timestamp)); - date_default_timezone_set($oldTZ); - if ($date["year"] >= 1980) { - return pack("V", (($date["mday"] + ($date["mon"] << 5) + (($date["year"]-1980) << 9)) << 16) | - (($date["seconds"] >> 1) + ($date["minutes"] << 5) + ($date["hours"] << 11))); - } - return "\x00\x00\x00\x00"; - } - - /** - * Build the Zip file structures - * - * @param String $filePath - * @param String $fileComment - * @param String $gpFlags - * @param String $gzType - * @param int $timestamp - * @param string $fileCRC32 - * @param int $gzLength - * @param int $dataLength - * @param integer $extFileAttr Use self::EXT_FILE_ATTR_FILE for files, self::EXT_FILE_ATTR_DIR for Directories. - */ - private function buildZipEntry($filePath, $fileComment, $gpFlags, $gzType, $timestamp, $fileCRC32, $gzLength, $dataLength, $extFileAttr) { - $filePath = str_replace("\\", "/", $filePath); - $fileCommentLength = (empty($fileComment) ? 0 : strlen($fileComment)); - $timestamp = (int)$timestamp; - $timestamp = ($timestamp == 0 ? time() : $timestamp); - - $dosTime = $this->getDosTime($timestamp); - $tsPack = pack("V", $timestamp); - - $ux = "\x75\x78\x0B\x00\x01\x04\xE8\x03\x00\x00\x04\x00\x00\x00\x00"; - - if (!isset($gpFlags) || strlen($gpFlags) != 2) { - $gpFlags = "\x00\x00"; - } - - $isFileUTF8 = mb_check_encoding($filePath, "UTF-8") && !mb_check_encoding($filePath, "ASCII"); - $isCommentUTF8 = !empty($fileComment) && mb_check_encoding($fileComment, "UTF-8") && !mb_check_encoding($fileComment, "ASCII"); - if ($isFileUTF8 || $isCommentUTF8) { - $flag = 0; - $gpFlagsV = unpack("vflags", $gpFlags); - if (isset($gpFlagsV['flags'])) { - $flag = $gpFlagsV['flags']; - } - $gpFlags = pack("v", $flag | (1 << 11)); - } - - $header = $gpFlags . $gzType . $dosTime. $fileCRC32 - . pack("VVv", $gzLength, $dataLength, strlen($filePath)); // File name length - - $zipEntry = self::ZIP_LOCAL_FILE_HEADER; - $zipEntry .= self::ATTR_VERSION_TO_EXTRACT; - $zipEntry .= $header; - $zipEntry .= $this->addExtraField ? "\x1C\x00" : "\x00\x00"; // Extra field length - $zipEntry .= $filePath; // FileName - // Extra fields - if ($this->addExtraField) { - $zipEntry .= "\x55\x54\x09\x00\x03" . $tsPack . $tsPack . $ux; - } - - print($zipEntry); - - $cdEntry = self::ZIP_CENTRAL_FILE_HEADER; - $cdEntry .= self::ATTR_MADE_BY_VERSION; - $cdEntry .= ($dataLength === 0 ? "\x0A\x00" : self::ATTR_VERSION_TO_EXTRACT); - $cdEntry .= $header; - $cdEntry .= $this->addExtraField ? "\x18\x00" : "\x00\x00"; // Extra field length - $cdEntry .= pack("v", $fileCommentLength); // File comment length - $cdEntry .= "\x00\x00"; // Disk number start - $cdEntry .= "\x00\x00"; // internal file attributes - $cdEntry .= $extFileAttr; // External file attributes - $cdEntry .= pack("V", $this->offset); // Relative offset of local header - $cdEntry .= $filePath; // FileName - // Extra fields - if ($this->addExtraField) { - $cdEntry .= "\x55\x54\x05\x00\x03" . $tsPack . $ux; - } - - if (!empty($fileComment)) { - $cdEntry .= $fileComment; // Comment - } - - $this->cdRec[] = $cdEntry; - $this->offset += strlen($zipEntry) + $gzLength; - } - - /** - * Join $file to $dir path, and clean up any excess slashes. - * - * @param String $dir - * @param String $file - */ - public static function pathJoin($dir, $file) { - if (empty($dir) || empty($file)) { - return self::getRelativePath($dir . $file); - } - return self::getRelativePath($dir . '/' . $file); - } - - /** - * Clean up a path, removing any unnecessary elements such as /./, // or redundant ../ segments. - * If the path starts with a "/", it is deemed an absolute path and any /../ in the beginning is stripped off. - * The returned path will not end in a "/". - * - * @param String $path The path to clean up - * @return String the clean path - */ - public static function getRelativePath($path) { - $path = preg_replace("#/+\.?/+#", "/", str_replace("\\", "/", $path)); - $dirs = explode("/", rtrim(preg_replace('#^(?:\./)+#', '', $path), '/')); - - $offset = 0; - $sub = 0; - $subOffset = 0; - $root = ""; - - if (empty($dirs[0])) { - $root = "/"; - $dirs = array_splice($dirs, 1); - } else if (preg_match("#[A-Za-z]:#", $dirs[0])) { - $root = strtoupper($dirs[0]) . "/"; - $dirs = array_splice($dirs, 1); - } - - $newDirs = array(); - foreach ($dirs as $dir) { - if ($dir !== "..") { - $subOffset--; - $newDirs[++$offset] = $dir; - } else { - $subOffset++; - if (--$offset < 0) { - $offset = 0; - if ($subOffset > $sub) { - $sub++; - } - } - } - } - - if (empty($root)) { - $root = str_repeat("../", $sub); - } - return $root . implode("/", array_slice($newDirs, 0, $offset)); - } + const VERSION = 1.37; + + const ZIP_LOCAL_FILE_HEADER = "\x50\x4b\x03\x04"; // Local file header signature + const ZIP_CENTRAL_FILE_HEADER = "\x50\x4b\x01\x02"; // Central file header signature + const ZIP_END_OF_CENTRAL_DIRECTORY = "\x50\x4b\x05\x06\x00\x00\x00\x00"; //end of Central directory record + + const EXT_FILE_ATTR_DIR = "\x10\x00\xFF\x41"; + const EXT_FILE_ATTR_FILE = "\x00\x00\xFF\x81"; + + const ATTR_VERSION_TO_EXTRACT = "\x14\x00"; // Version needed to extract + const ATTR_MADE_BY_VERSION = "\x1E\x03"; // Made By Version + + private $zipMemoryThreshold = 1048576; // Autocreate tempfile if the zip data exceeds 1048576 bytes (1 MB) + + private $zipComment = null; + private $cdRec = array(); // central directory + private $offset = 0; + private $isFinalized = FALSE; + private $addExtraField = TRUE; + + private $streamChunkSize = 16384; // 65536; + private $streamFilePath = null; + private $streamTimeStamp = null; + private $streamComment = null; + private $streamFile = null; + private $streamData = null; + private $streamFileLength = 0; + + /** + * Constructor. + * + * @param String $archiveName Name to send to the HTTP client. + * @param String $contentType Content mime type. Optional, defaults to "application/zip". + */ + function __construct($archiveName = "", $contentType = "application/zip") { + if (!function_exists('sys_get_temp_dir')) { + die ("ERROR: ZipStream " . self::VERSION . " requires PHP version 5.2.1 or above."); + } + + $headerFile = null; + $headerLine = null; + if (!headers_sent($headerFile, $headerLine) or die("

Error: Unable to send file $archiveName. HTML Headers have already been sent from $headerFile in line $headerLine

")) { + if ((ob_get_contents() === FALSE || ob_get_contents() == '') or die("\n

Error: Unable to send file $archiveName.epub. Output buffer contains the following text (typically warnings or errors):
" . ob_get_contents() . "

")) { + if (ini_get('zlib.output_compression')) { + ini_set('zlib.output_compression', 'Off'); + } + + header('Pragma: public'); + header("Last-Modified: " . gmdate("D, d M Y H:i:s T")); + header("Expires: 0"); + header("Accept-Ranges: bytes"); + //header("Connection: Keep-Alive"); + header("Content-Type: " . $contentType); + header('Content-Disposition: attachment; filename="' . $archiveName . '";'); + header("Content-Transfer-Encoding: binary"); + flush(); + } + } + } + + function __destruct() { + $this->isFinalized = TRUE; + $this->cdRec = null; + exit; + } + + /** + * Extra fields on the Zip directory records are Unix time codes needed for compatibility on the default Mac zip archive tool. + * These are enabled as default, as they do no harm elsewhere and only add 26 bytes per file added. + * + * @param bool $setExtraField TRUE (default) will enable adding of extra fields, anything else will disable it. + */ + function setExtraField($setExtraField = TRUE) { + $this->addExtraField = ($setExtraField === TRUE); + } + + /** + * Set Zip archive comment. + * + * @param string $newComment New comment. null to clear. + * @return bool $success + */ + public function setComment($newComment = null) { + if ($this->isFinalized) { + return FALSE; + } + $this->zipComment = $newComment; + + return TRUE; + } + + /** + * Add an empty directory entry to the zip archive. + * Basically this is only used if an empty directory is added. + * + * @param string $directoryPath Directory Path and name to be added to the archive. + * @param int $timestamp (Optional) Timestamp for the added directory, if omitted or set to 0, the current time will be used. + * @param string $fileComment (Optional) Comment to be added to the archive for this directory. To use fileComment, timestamp must be given. + * @return bool $success + */ + public function addDirectory($directoryPath, $timestamp = 0, $fileComment = null) { + if ($this->isFinalized) { + return FALSE; + } + + $directoryPath = str_replace("\\", "/", $directoryPath); + $directoryPath = rtrim($directoryPath, "/"); + + if (strlen($directoryPath) > 0) { + $this->buildZipEntry($directoryPath.'/', $fileComment, "\x00\x00", "\x00\x00", $timestamp, "\x00\x00\x00\x00", 0, 0, self::EXT_FILE_ATTR_DIR); + return TRUE; + } + return FALSE; + } + + /** + * Add a file to the archive at the specified location and file name. + * + * @param string $data File data. + * @param string $filePath Filepath and name to be used in the archive. + * @param int $timestamp (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used. + * @param string $fileComment (Optional) Comment to be added to the archive for this file. To use fileComment, timestamp must be given. + * @return bool $success + */ + public function addFile($data, $filePath, $timestamp = 0, $fileComment = null) { + if ($this->isFinalized) { + return FALSE; + } + + if (is_resource($data) && get_resource_type($data) == "stream") { + $this->addLargeFile($data, $filePath, $timestamp, $fileComment); + return FALSE; + } + + $gzType = "\x08\x00"; // Compression type 8 = deflate + $gpFlags = "\x00\x00"; // General Purpose bit flags for compression type 8 it is: 0=Normal, 1=Maximum, 2=Fast, 3=super fast compression. + $dataLength = strlen($data); + $fileCRC32 = pack("V", crc32($data)); + + $gzData = gzcompress($data); + $gzData = substr(substr($gzData, 0, strlen($gzData) - 4), 2); // gzcompress adds a 2 byte header and 4 byte CRC we can't use. + // The 2 byte header does contain useful data, though in this case the 2 parameters we'd be interrested in will always be 8 for compression type, and 2 for General purpose flag. + $gzLength = strlen($gzData); + + if ($gzLength >= $dataLength) { + $gzLength = $dataLength; + $gzData = $data; + $gzType = "\x00\x00"; // Compression type 0 = stored + $gpFlags = "\x00\x00"; // Compression type 0 = stored + } + + $this->buildZipEntry($filePath, $fileComment, $gpFlags, $gzType, $timestamp, $fileCRC32, $gzLength, $dataLength, self::EXT_FILE_ATTR_FILE); + + print ($gzData); + + return TRUE; + } + + /** + * Add the content to a directory. + * + * @author Adam Schmalhofer + * @author A. Grandt + * + * @param String $realPath Path on the file system. + * @param String $zipPath Filepath and name to be used in the archive. + * @param bool $recursive Add content recursively, default is TRUE. + * @param bool $followSymlinks Follow and add symbolic links, if they are accessible, default is TRUE. + * @param array &$addedFiles Reference to the added files, this is used to prevent duplicates, efault is an empty array. + * If you start the function by parsing an array, the array will be populated with the realPath + * and zipPath kay/value pairs added to the archive by the function. + */ + public function addDirectoryContent($realPath, $zipPath, $recursive = TRUE, $followSymlinks = TRUE, &$addedFiles = array()) { + if (file_exists($realPath) && !isset($addedFiles[realpath($realPath)])) { + if (is_dir($realPath)) { + $this->addDirectory($zipPath); + } + + $addedFiles[realpath($realPath)] = $zipPath; + + $iter = new DirectoryIterator($realPath); + foreach ($iter as $file) { + if ($file->isDot()) { + continue; + } + $newRealPath = $file->getPathname(); + $newZipPath = self::pathJoin($zipPath, $file->getFilename()); + + if (file_exists($newRealPath) && ($followSymlinks === TRUE || !is_link($newRealPath))) { + if ($file->isFile()) { + $addedFiles[realpath($newRealPath)] = $newZipPath; + $this->addLargeFile($newRealPath, $newZipPath); + } else if ($recursive === TRUE) { + $this->addDirectoryContent($newRealPath, $newZipPath, $recursive); + } else { + $this->addDirectory($zipPath); + } + } + } + } + } + + /** + * Add a file to the archive at the specified location and file name. + * + * @param string $dataFile File name/path. + * @param string $filePath Filepath and name to be used in the archive. + * @param int $timestamp (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used. + * @param string $fileComment (Optional) Comment to be added to the archive for this file. To use fileComment, timestamp must be given. + * @return bool $success + */ + public function addLargeFile($dataFile, $filePath, $timestamp = 0, $fileComment = null) { + if ($this->isFinalized) { + return FALSE; + } + + if (is_string($dataFile) && is_file($dataFile)) { + $this->processFile($dataFile, $filePath, $timestamp, $fileComment); + } else if (is_resource($dataFile) && get_resource_type($dataFile) == "stream") { + $fh = $dataFile; + $this->openStream($filePath, $timestamp, $fileComment); + + while (!feof($fh)) { + $this->addStreamData(fread($fh, $this->streamChunkSize)); + } + $this->closeStream($this->addExtraField); + } + return TRUE; + } + + /** + * Create a stream to be used for large entries. + * + * @param string $filePath Filepath and name to be used in the archive. + * @param int $timestamp (Optional) Timestamp for the added file, if omitted or set to 0, the current time will be used. + * @param string $fileComment (Optional) Comment to be added to the archive for this file. To use fileComment, timestamp must be given. + * @return bool $success + */ + public function openStream($filePath, $timestamp = 0, $fileComment = null) { + if (!function_exists('sys_get_temp_dir')) { + die ("ERROR: Zip " . self::VERSION . " requires PHP version 5.2.1 or above if large files are used."); + } + + if ($this->isFinalized) { + return FALSE; + } + + if (strlen($this->streamFilePath) > 0) { + closeStream(); + } + + $this->streamFile = tempnam(sys_get_temp_dir(), 'ZipStream'); + $this->streamData = fopen($this->streamFile, "wb"); + $this->streamFilePath = $filePath; + $this->streamTimestamp = $timestamp; + $this->streamFileComment = $fileComment; + $this->streamFileLength = 0; + + return TRUE; + } + + /** + * Add data to the open stream. + * + * @param String $data + * @return $length bytes added or FALSE if the archive is finalized or there are no open stream. + */ + public function addStreamData($data) { + if ($this->isFinalized || strlen($this->streamFilePath) == 0) { + return FALSE; + } + + $length = fwrite($this->streamData, $data, strlen($data)); + if ($length != strlen($data)) { + die ("

Length mismatch

\n"); + } + $this->streamFileLength += $length; + + return $length; + } + + /** + * Close the current stream. + * + * @return bool $success + */ + public function closeStream() { + if ($this->isFinalized || strlen($this->streamFilePath) == 0) { + return FALSE; + } + + fflush($this->streamData); + fclose($this->streamData); + + $this->processFile($this->streamFile, $this->streamFilePath, $this->streamTimestamp, $this->streamFileComment); + + $this->streamData = null; + $this->streamFilePath = null; + $this->streamTimestamp = null; + $this->streamFileComment = null; + $this->streamFileLength = 0; + + // Windows is a little slow at times, so a millisecond later, we can unlink this. + unlink($this->streamFile); + + $this->streamFile = null; + + return TRUE; + } + + private function processFile($dataFile, $filePath, $timestamp = 0, $fileComment = null) { + if ($this->isFinalized) { + return FALSE; + } + + $tempzip = tempnam(sys_get_temp_dir(), 'ZipStream'); + + $zip = new ZipArchive; + if ($zip->open($tempzip) === TRUE) { + $zip->addFile($dataFile, 'file'); + $zip->close(); + } + + $file_handle = fopen($tempzip, "rb"); + $stats = fstat($file_handle); + $eof = $stats['size']-72; + + fseek($file_handle, 6); + + $gpFlags = fread($file_handle, 2); + $gzType = fread($file_handle, 2); + fread($file_handle, 4); + $fileCRC32 = fread($file_handle, 4); + $v = unpack("Vval", fread($file_handle, 4)); + $gzLength = $v['val']; + $v = unpack("Vval", fread($file_handle, 4)); + $dataLength = $v['val']; + + $this->buildZipEntry($filePath, $fileComment, $gpFlags, $gzType, $timestamp, $fileCRC32, $gzLength, $dataLength, self::EXT_FILE_ATTR_FILE); + + fseek($file_handle, 34); + $pos = 34; + + while (!feof($file_handle) && $pos < $eof) { + $datalen = $this->streamChunkSize; + if ($pos + $this->streamChunkSize > $eof) { + $datalen = $eof-$pos; + } + echo fread($file_handle, $datalen); + $pos += $datalen; + flush(); + } + + fclose($file_handle); + unlink($tempzip); + } + + /** + * Close the archive. + * A closed archive can no longer have new files added to it. + * @return bool $success + */ + public function finalize() { + if (!$this->isFinalized) { + if (strlen($this->streamFilePath) > 0) { + $this->closeStream(); + } + + $cdRecSize = pack("v", sizeof($this->cdRec)); + + $cd = implode("", $this->cdRec); + print($cd); + print(self::ZIP_END_OF_CENTRAL_DIRECTORY); + print($cdRecSize.$cdRecSize); + print(pack("VV", strlen($cd), $this->offset)); + if (!empty($this->zipComment)) { + print(pack("v", strlen($this->zipComment))); + print($this->zipComment); + } else { + print("\x00\x00"); + } + + flush(); + + $this->isFinalized = TRUE; + $cd = null; + $this->cdRec = null; + + return TRUE; + } + return FALSE; + } + + /** + * Calculate the 2 byte dostime used in the zip entries. + * + * @param int $timestamp + * @return 2-byte encoded DOS Date + */ + private function getDosTime($timestamp = 0) { + $timestamp = (int)$timestamp; + $oldTZ = @date_default_timezone_get(); + date_default_timezone_set('UTC'); + $date = ($timestamp == 0 ? getdate() : getdate($timestamp)); + date_default_timezone_set($oldTZ); + if ($date["year"] >= 1980) { + return pack("V", (($date["mday"] + ($date["mon"] << 5) + (($date["year"]-1980) << 9)) << 16) | + (($date["seconds"] >> 1) + ($date["minutes"] << 5) + ($date["hours"] << 11))); + } + return "\x00\x00\x00\x00"; + } + + /** + * Build the Zip file structures + * + * @param String $filePath + * @param String $fileComment + * @param String $gpFlags + * @param String $gzType + * @param int $timestamp + * @param string $fileCRC32 + * @param int $gzLength + * @param int $dataLength + * @param integer $extFileAttr Use self::EXT_FILE_ATTR_FILE for files, self::EXT_FILE_ATTR_DIR for Directories. + */ + private function buildZipEntry($filePath, $fileComment, $gpFlags, $gzType, $timestamp, $fileCRC32, $gzLength, $dataLength, $extFileAttr) { + $filePath = str_replace("\\", "/", $filePath); + $fileCommentLength = (empty($fileComment) ? 0 : strlen($fileComment)); + $timestamp = (int)$timestamp; + $timestamp = ($timestamp == 0 ? time() : $timestamp); + + $dosTime = $this->getDosTime($timestamp); + $tsPack = pack("V", $timestamp); + + $ux = "\x75\x78\x0B\x00\x01\x04\xE8\x03\x00\x00\x04\x00\x00\x00\x00"; + + if (!isset($gpFlags) || strlen($gpFlags) != 2) { + $gpFlags = "\x00\x00"; + } + + $isFileUTF8 = mb_check_encoding($filePath, "UTF-8") && !mb_check_encoding($filePath, "ASCII"); + $isCommentUTF8 = !empty($fileComment) && mb_check_encoding($fileComment, "UTF-8") && !mb_check_encoding($fileComment, "ASCII"); + if ($isFileUTF8 || $isCommentUTF8) { + $flag = 0; + $gpFlagsV = unpack("vflags", $gpFlags); + if (isset($gpFlagsV['flags'])) { + $flag = $gpFlagsV['flags']; + } + $gpFlags = pack("v", $flag | (1 << 11)); + } + + $header = $gpFlags . $gzType . $dosTime. $fileCRC32 + . pack("VVv", $gzLength, $dataLength, strlen($filePath)); // File name length + + $zipEntry = self::ZIP_LOCAL_FILE_HEADER; + $zipEntry .= self::ATTR_VERSION_TO_EXTRACT; + $zipEntry .= $header; + $zipEntry .= $this->addExtraField ? "\x1C\x00" : "\x00\x00"; // Extra field length + $zipEntry .= $filePath; // FileName + // Extra fields + if ($this->addExtraField) { + $zipEntry .= "\x55\x54\x09\x00\x03" . $tsPack . $tsPack . $ux; + } + + print($zipEntry); + + $cdEntry = self::ZIP_CENTRAL_FILE_HEADER; + $cdEntry .= self::ATTR_MADE_BY_VERSION; + $cdEntry .= ($dataLength === 0 ? "\x0A\x00" : self::ATTR_VERSION_TO_EXTRACT); + $cdEntry .= $header; + $cdEntry .= $this->addExtraField ? "\x18\x00" : "\x00\x00"; // Extra field length + $cdEntry .= pack("v", $fileCommentLength); // File comment length + $cdEntry .= "\x00\x00"; // Disk number start + $cdEntry .= "\x00\x00"; // internal file attributes + $cdEntry .= $extFileAttr; // External file attributes + $cdEntry .= pack("V", $this->offset); // Relative offset of local header + $cdEntry .= $filePath; // FileName + // Extra fields + if ($this->addExtraField) { + $cdEntry .= "\x55\x54\x05\x00\x03" . $tsPack . $ux; + } + + if (!empty($fileComment)) { + $cdEntry .= $fileComment; // Comment + } + + $this->cdRec[] = $cdEntry; + $this->offset += strlen($zipEntry) + $gzLength; + } + + /** + * Join $file to $dir path, and clean up any excess slashes. + * + * @param String $dir + * @param String $file + */ + public static function pathJoin($dir, $file) { + if (empty($dir) || empty($file)) { + return self::getRelativePath($dir . $file); + } + return self::getRelativePath($dir . '/' . $file); + } + + /** + * Clean up a path, removing any unnecessary elements such as /./, // or redundant ../ segments. + * If the path starts with a "/", it is deemed an absolute path and any /../ in the beginning is stripped off. + * The returned path will not end in a "/". + * + * @param String $path The path to clean up + * @return String the clean path + */ + public static function getRelativePath($path) { + $path = preg_replace("#/+\.?/+#", "/", str_replace("\\", "/", $path)); + $dirs = explode("/", rtrim(preg_replace('#^(?:\./)+#', '', $path), '/')); + + $offset = 0; + $sub = 0; + $subOffset = 0; + $root = ""; + + if (empty($dirs[0])) { + $root = "/"; + $dirs = array_splice($dirs, 1); + } else if (preg_match("#[A-Za-z]:#", $dirs[0])) { + $root = strtoupper($dirs[0]) . "/"; + $dirs = array_splice($dirs, 1); + } + + $newDirs = array(); + foreach ($dirs as $dir) { + if ($dir !== "..") { + $subOffset--; + $newDirs[++$offset] = $dir; + } else { + $subOffset++; + if (--$offset < 0) { + $offset = 0; + if ($subOffset > $sub) { + $sub++; + } + } + } + } + + if (empty($root)) { + $root = str_repeat("../", $sub); + } + return $root . implode("/", array_slice($newDirs, 0, $offset)); + } } -?> \ No newline at end of file +?> diff --git a/app/ResourceLogItem.php b/app/ResourceLogItem.php index d61669f5..78b0e835 100644 --- a/app/ResourceLogItem.php +++ b/app/ResourceLogItem.php @@ -57,13 +57,13 @@ class ResourceLogItem extends Model DB::table($resourceTable)->whereId($resourceId)->update([ $countColumn => DB::raw('(SELECT - COUNT(id) - FROM - resource_log_items - WHERE ' . + COUNT(id) + FROM + resource_log_items + WHERE ' . $resourceIdColumn . ' = ' . $resourceId . ' - AND - log_type = ' . $logType . ')') + AND + log_type = ' . $logType . ')') ]); if (Auth::check()) { @@ -71,15 +71,15 @@ class ResourceLogItem extends Model DB::table('resource_users')->whereId($resourceUserId)->update([ $countColumn => DB::raw('(SELECT - COUNT(id) - FROM - resource_log_items - WHERE - user_id = ' . Auth::user()->id . ' - AND ' . + COUNT(id) + FROM + resource_log_items + WHERE + user_id = ' . Auth::user()->id . ' + AND ' . $resourceIdColumn . ' = ' . $resourceId . ' - AND - log_type = ' . $logType . ')') + AND + log_type = ' . $logType . ')') ]); } } diff --git a/app/Track.php b/app/Track.php index 3fd8fb60..817c0f78 100644 --- a/app/Track.php +++ b/app/Track.php @@ -127,10 +127,10 @@ class Track extends Model ::published() ->listed() ->join(DB::raw(' - ( SELECT `track_id`, `created_at` - FROM `resource_log_items` - WHERE track_id IS NOT NULL AND log_type = 3 AND `created_at` > now() - INTERVAL 1 DAY - ) AS ranged_plays'), + ( SELECT `track_id`, `created_at` + FROM `resource_log_items` + WHERE track_id IS NOT NULL AND log_type = 3 AND `created_at` > now() - INTERVAL 1 DAY + ) AS ranged_plays'), 'tracks.id', '=', 'ranged_plays.track_id') ->groupBy('id') ->orderBy('plays', 'desc') @@ -598,9 +598,9 @@ class Track extends Model 'copyright' => ['© ' . $this->year . ' ' . $this->user->display_name], 'publisher' => ['Pony.fm - https://pony.fm/'], 'encoded_by' => ['https://pony.fm/'], -// 'url_artist' => [$this->user->url], -// 'url_source' => [$this->url], -// 'url_file' => [$this->url], +// 'url_artist' => [$this->user->url], +// 'url_source' => [$this->url], +// 'url_file' => [$this->url], 'url_publisher' => ['https://pony.fm/'] ]; diff --git a/config/newrelic.php b/config/newrelic.php index 46a27527..a9430448 100644 --- a/config/newrelic.php +++ b/config/newrelic.php @@ -2,41 +2,41 @@ return array( - /* - |-------------------------------------------------------------------------- - | Default NewRelic Integration Settings - |-------------------------------------------------------------------------- - */ + /* + |-------------------------------------------------------------------------- + | Default NewRelic Integration Settings + |-------------------------------------------------------------------------- + */ - /* - * Will automatically name transactions in NewRelic, - * using the Laravel route name, action or request. - * - * Set this to false to use the NewRelic default naming - * scheme, or to set your own in your application. - */ - 'auto_name_transactions' => true, + /* + * Will automatically name transactions in NewRelic, + * using the Laravel route name, action or request. + * + * Set this to false to use the NewRelic default naming + * scheme, or to set your own in your application. + */ + 'auto_name_transactions' => true, - /* - * Define the name used when automatically naming transactions. - * a token string: - * a pattern you define yourself, available tokens: - * {controller} = Controller@action or Closure@path - * {method} = GET / POST / etc. - * {route} = route name if named, otherwise same as {controller} - * {path} = the registered route path (includes variable names) - * {uri} = the actual URI requested - * anything that is not a matched token will remain a string literal - * example: - * "GET /world" with pattern 'hello {path} you really {method} me' would return: - * 'hello /world you really GET me' - */ - 'name_provider' => '{uri} {route}', + /* + * Define the name used when automatically naming transactions. + * a token string: + * a pattern you define yourself, available tokens: + * {controller} = Controller@action or Closure@path + * {method} = GET / POST / etc. + * {route} = route name if named, otherwise same as {controller} + * {path} = the registered route path (includes variable names) + * {uri} = the actual URI requested + * anything that is not a matched token will remain a string literal + * example: + * "GET /world" with pattern 'hello {path} you really {method} me' would return: + * 'hello /world you really GET me' + */ + 'name_provider' => '{uri} {route}', - /* - * Will cause an exception to be thrown if the NewRelic - * PHP agent is not found / installed - */ - 'throw_if_not_installed' => false, + /* + * Will cause an exception to be thrown if the NewRelic + * PHP agent is not found / installed + */ + 'throw_if_not_installed' => false, ); diff --git a/config/poniverse.php b/config/poniverse.php index 15cab0bf..ff60876d 100644 --- a/config/poniverse.php +++ b/config/poniverse.php @@ -1,12 +1,12 @@ 1, - 'urls' => [ - 'api' => env('PONI_API_URL', 'https://api.poniverse.net/v1/'), - 'register' => env('PONI_REGISTER_URL', 'https://poniverse.net/register?site=pony.fm'), - 'auth' => env('PONI_AUTH_URL', 'https://poniverse.net/oauth/authorize'), - 'token' => env('PONI_TOKEN_URL', 'https://poniverse.net/oauth/access_token') - ], - 'client_id' => env('PONI_CLIENT_ID'), - 'secret' => env('PONI_CLIENT_SECRET') + 'version' => 1, + 'urls' => [ + 'api' => env('PONI_API_URL', 'https://api.poniverse.net/v1/'), + 'register' => env('PONI_REGISTER_URL', 'https://poniverse.net/register?site=pony.fm'), + 'auth' => env('PONI_AUTH_URL', 'https://poniverse.net/oauth/authorize'), + 'token' => env('PONI_TOKEN_URL', 'https://poniverse.net/oauth/access_token') + ], + 'client_id' => env('PONI_CLIENT_ID'), + 'secret' => env('PONI_CLIENT_SECRET') ]; diff --git a/database/migrations/2013_09_10_014644_create_latest_column.php b/database/migrations/2013_09_10_014644_create_latest_column.php index d76b3b1c..c33269ad 100644 --- a/database/migrations/2013_09_10_014644_create_latest_column.php +++ b/database/migrations/2013_09_10_014644_create_latest_column.php @@ -11,24 +11,24 @@ class CreateLatestColumn extends Migration }); DB::update(' - UPDATE - tracks - SET - is_latest = true - WHERE - ( - SELECT - t2.id - FROM - (SELECT id, user_id FROM tracks WHERE published_at IS NOT NULL AND deleted_at IS NULL) AS t2 - WHERE - t2.user_id = tracks.user_id - ORDER BY - created_at DESC - LIMIT 1 - ) = tracks.id - AND - published_at IS NOT NULL'); + UPDATE + tracks + SET + is_latest = true + WHERE + ( + SELECT + t2.id + FROM + (SELECT id, user_id FROM tracks WHERE published_at IS NOT NULL AND deleted_at IS NULL) AS t2 + WHERE + t2.user_id = tracks.user_id + ORDER BY + created_at DESC + LIMIT 1 + ) = tracks.id + AND + published_at IS NOT NULL'); } public function down() @@ -37,4 +37,4 @@ class CreateLatestColumn extends Migration $table->dropColumn('is_latest'); }); } -} \ No newline at end of file +} diff --git a/database/migrations/2013_09_24_055911_track_is_listed.php b/database/migrations/2013_09_24_055911_track_is_listed.php index 25d8caa8..75f4b822 100644 --- a/database/migrations/2013_09_24_055911_track_is_listed.php +++ b/database/migrations/2013_09_24_055911_track_is_listed.php @@ -11,10 +11,10 @@ class TrackIsListed extends Migration }); DB::update(' - UPDATE - tracks - SET - is_listed = true'); + UPDATE + tracks + SET + is_listed = true'); } public function down() @@ -23,4 +23,4 @@ class TrackIsListed extends Migration $table->dropColumn('is_listed'); }); } -} \ No newline at end of file +} diff --git a/public/.htaccess b/public/.htaccess index e0f22378..5a35bec2 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -14,10 +14,10 @@ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] - RewriteRule ^(.*\.(?:coffee))$ /asset.php?type=coffee&file=/$1 [L,QSA,NC] - RewriteRule ^(.*\.(?:less))$ /asset.php?type=less&file=/$1 [L,QSA,NC] + RewriteRule ^(.*\.(?:coffee))$ /asset.php?type=coffee&file=/$1 [L,QSA,NC] + RewriteRule ^(.*\.(?:less))$ /asset.php?type=less&file=/$1 [L,QSA,NC] - XSendFile On - \ No newline at end of file + XSendFile On + diff --git a/public/images/fm_logo_white.svg b/public/images/fm_logo_white.svg index 9865df0a..ad9938c0 100644 --- a/public/images/fm_logo_white.svg +++ b/public/images/fm_logo_white.svg @@ -1,76 +1,76 @@ - - - - - - - + + + + + + + + ]> + xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="690px" height="137px" + viewBox="0 0 690 137" enable-background="new 0 0 690 137" xml:space="preserve"> - - - - - - - background - - - - Layer 1 - - - + + + + + + + background + + + + Layer 1 + + + - - eJztvWd38rq2MHo/rzH4D5AKobnQ02khCUlISCONUJyEhBYDa691PtzfftVsy8ayZeA5d79jvGed + <![CDATA[ + eJztvWd38rq2MHo/rzH4D5AKobnQ02khCUlISCONUJyEhBYDa691PtzfftVsy8ayZeA5d79jvGed nQfL8pzS1NRs0pQ2A7V69Lg7aitROSb4fX9tbhZUpTUdqTk/Kvaf9vuzyVSFRcGbkF9MxQRY6/g0 0yQ17xV10hsNc+hdTIJvy/D74Gn1QpRSIX8wBMtue9O+Ako/Bs3+6HMUm/z9GdLxge+LrSl4nYqL ybgkiEm/KOQSgr92geq0hn+3JpPe/ygQi5yRYWF+NBt2e8PP/OifnD8qSSl/UvQnUmm/mEVNrPRu @@ -142,9 +142,9 @@ dnSenRxkKnsPsfLoKXFfUl+ehOJTuXFb3j/e74g7x+khQSNveOscJBrun6omApH7t9NANBPNBMKd WB32KwPLSoFIs5sMhHo//UBomu/BzoXoziUiN/BXHrTk5Rh15CBb2fg2ugTQoF5NAq/bRWn7YK1o qRWLTzIn0uF65Q08nvSF7lajqHWkOlHV3cm9+tLPnAvxRB3T1SAV+HLzUT66DgYhmu6WiIhxZQye +lrYOYrJ1cwsfHAS2DIGA2FNjG7qQxbWN/W1+VW3YNV7kznZf0/+7owFW6xvqacaCw== - - - a2W9344/2WPdCzxP1u8bNYjGtrvX+9sHucLzmR3W8G4nscfAmlpfv3+6TFqwIjQIcaLxJJTzqStb + + + a2W9344/2WPdCzxP1u8bNYjGtrvX+9sHucLzmR3W8G4nscfAmlpfv3+6TFqwIjQIcaLxJJTzqStb rGvl78zGUN6t2WEVyh+dChPrlpRolPD0tOluotEVTk7Uhn1fy793UuG2Dcc1MZob1+1BjmCtbW8j rBgNGVpZvY9/IayAM9sl89A+q6/F+xrEGppnqMRrYhq7i9pjHVfOABoLYgNr6lLYXWdh7ahvGfHR HutlaWf9NzW7MLACNAbiyfo4X2ZhrRxKQ/HJHmsi1Ajv9u8ubbGulVvwpAALYnpoz6/zDKyp9c1k @@ -216,9 +216,9 @@ HIE3WbChuWT48DYMe9L37CV4z910P8bACzT22sciRHPJ//FINHkZaOZ4MT4s07SJCqdguaTvcJm5 FWuo2CZpyZj2fKl7DnKDAQCNjZs/iOa56CqrPyt2/qDdnlsOf3B66JJ8YtjVBgB6TRrB2PIOwwTg YCLYnONicXH14WaRxS1ljzFKtHFbmVtYcXDUmGl/tvPWIgVcKcIdiGBG1d0S9ub0HcOegV1KWLo0 v0vV7IA5pRAEi6o1U/d18jm1o7qPyvQyW5gMhgbK1FOAI0Sbgy65ei4CiJ2WNbc5aQ== - - - YTvt+5Q59405r0sBV1Jxz1u7LU4Up32feosFOWSwmVeBAB/M+Z6cfOCeo2dqk08/5NS2WZ6iNw5t + + + YTvt+5Q59405r0sBV1Jxz1u7LU4Up32feosFOWSwmVeBAB/M+Z6cfOCeo2dqk08/5NS2WZ6iNw5t QpssVsNVTtEbn37iGF+zvEVvrG6UOW68P7VGb2Ba1DLRG4rTBmdLR2/kjVxww87TMwkbTq/izHv0 hh0XGJwtHb0BnUsEHbaM8OfDcUZvfE7nQKF8uGWjNzAZTqaCkIvuSzrjiN6QeeOaK8iO3nBlB+mW DSSQpwQhx40XcYsh7dMyvVxSY7kM6XPmnguflwzJ3LXLQDI9h/kdXfLhXZojmZXj2LNzY5cucwcx @@ -290,9 +290,9 @@ tAde44de91zqwkNn44fa/bDchYcGwe1Sg71GB5kXHnrPxV3owkNbKLoods5Y8XDh4eI7umwuPFw0 Vd9HMiSXvvDQNB/nbjvEaFZw4aGWVWd/2yGRactfeOi8iQobtyu48NDZu9eItrLEK/vbDj3EOs1E s154uLjv6enCQ5Y8xLcdrmqLYsH5tkOf5Wj9hS88dL7tkJgcy1946Jyka6+kF7jw0Pm2Qzc7jT9J 1/G2QzoIudSFh4tYNgtceMgcTbQAZF76doLmcuEh177O5S88dNYVKKRqVRfKdN52Aw== - - - ZWxdQdTE3DYSPRysWTbCx10ubo0IgzIHee+839+cRIlTSSiuGltCXmCAagVDAJjWacNDmggoP0HP + + + ZWxdQdTE3DYSPRysWTbCx10ubo0IgzIHee+839+cRIlTSSiuGltCXmCAagVDAJjWacNDmggoP0HP w2qtDQuEpACUZXNSUymo6sFN7yg+3Ts7FjMPdWn7YK2IqsCsrkr4ttZSA5sv4a0AjBoFtt8qX4HY /vdxePfgNxve271phG97PyOhVPqOC6XvaE4on18fQ0VQHvWqwsl1NipUTy+bQnXw8Slc9ZUvoX4h Z4Xb0969cDf5+hDuhWlfuH/bnwkP0fug8BS5Cwmv7bUr4e3t8UNo3shT4V1+3BbeL4LXqqqW4urk @@ -364,9 +364,9 @@ knSKx8Yh73Q1Saeat8bMO11N0ikMQjrmnS6SdCpV0za77XCW534DSxcg1o+Rqb6jEbI+JlVgwstB sgGzMRNBgCYIZ1BzqhGtsg2vV/mF4ilMxBOYN5ZU+cYohphS2j4KvMJmoUOaI0iOA9baO433Hqcx zK29SC6M8mOB3Cid2Z0AKB/eX55ryaGxLbx3EJ7nF+zekeRTizhDESAgybRGnxMBELkTYW/O40Za p0mSVQUh2T6Hs+ocmhyUJDnJ/6b0tM4dvYchfNsxHhEgv3BZa625hqUWElTAKvrGuQ== - - - pZVoGQqbS4ppoZI2RJd+0OH/e+D7KyOkRX9GFiV//GbWV9QrtffZG/qBitr1/RU/PhXFu2F3VFYV + + + pZVoGQqbS4ppoZI2RJd+0OH/e+D7KyOkRX9GFiV//GbWV9QrtffZG/qBitr1/RU/PhXFu2F3VFYV 5Vb5Z1ocdWYDZTj15/zx43rh9DSTLCqdUVfxR/DAvBtsESUtJgFE+lwUU2QRy4viR/bkp7J+s98q fgiNA+vOhpBc2Ucpoz6csbSH06EiX70vuIchFgjPcnWY8FQMRIULCTGh3flLVJz4KTV42ou+l0fp B1no0jNR2215sN8+jowvz47Os5ODTGXvIVYePSXuS+rLk1B8Kjduy/vH+x3ECfNnu1SzrA6TLu28 @@ -438,12 +438,12 @@ eZYeYAoK5s5lU7qzGQX2nf4cFTXTRRTSWtxRLzINqF4qwzrpJIp0ECB6C7Qi9AUQYySwplfUjTgE RLYJWlKlRos0SEazrR3DvY5CPiKRM3qKYDWqRVgBCkFjzjR+IiTPGDFqUdZEnBE+lTNGNyXcjoQe y8sYoXtosMlaqEyrmKYiHig0DoqQt4q/SCGxjNoOnrB/qH0qaQZeQtcTuBSL6YQRRIelOGpnKpVl I85LkEtazCdBDG5QlNBCgAJFB7o0rUM0lRJdFUURJTygRCWiiiRIpS0qzI9RgQyeKA== - - - 60DxuIk4DgWZXNTaCxASKokalWUJq5aozkgUy0nEvoUUSZJB1GJKFDVx+MkYGxEZwWTgwVvcsFRS + + + 60DxuIk4DgWZXNTaCxASKokalWUJq5aozkgUy0nEvoUUSZJB1GJKFDVx+MkYGxEZwWTgwVvcsFRS D+UBSFmtVFvtALzih5KPAJE1cyZldBQRiTQoq/cECRSNy8GzoE8Tqo2i1grUX/Csxc5kvEhCk89j bFZcIpLPjUNYSlPyosm6YVkAbnX0OVoVWNYHVXhaCtxnVBp20eJxFO6926y1PpVbtdXrw21Hn5PW 34q/NRyOpq2pMgav/J+qMpmOVMU/+Rr9B5bAj/QPNjdLV2XfX/8fDbPQ6A== - + ]]> diff --git a/public/template.php b/public/template.php index cacc5516..5d9e3711 100644 --- a/public/template.php +++ b/public/template.php @@ -1,3 +1,3 @@ -
  • Tracks
  • -
  • Albums
  • -
  • Playlists
  • -
  • Settings
  • +
  • Tracks
  • +
  • Albums
  • +
  • Playlists
  • +
  • Settings
  • diff --git a/public/templates/account/album.html b/public/templates/account/album.html index 3616740a..1b41c092 100644 --- a/public/templates/account/album.html +++ b/public/templates/account/album.html @@ -1,49 +1,49 @@
    - -
    -
    - - -
    {{errors.title}}
    -
    -
    - - -
    {{errors.description}}
    -
    -
    - - -
    -
    - Add Tracks - -
    - -
    + +
    +
    + + +
    {{errors.title}}
    +
    +
    + + +
    {{errors.description}}
    +
    +
    + + +
    +
    + Add Tracks + +
    + +
    -
      -
    • -
      - - - {{track.title}} -
      -
    • -
    -
    -
    - \ No newline at end of file +
      +
    • +
      + + + {{track.title}} +
      +
    • +
    +
    +
    + diff --git a/public/templates/account/albums.html b/public/templates/account/albums.html index 2fb1cddf..9954f07d 100644 --- a/public/templates/account/albums.html +++ b/public/templates/account/albums.html @@ -1,28 +1,28 @@
    - + - \ No newline at end of file + +
    + diff --git a/public/templates/account/playlists.html b/public/templates/account/playlists.html index 86bec588..32ebf64e 100644 --- a/public/templates/account/playlists.html +++ b/public/templates/account/playlists.html @@ -1,22 +1,22 @@ diff --git a/public/templates/account/settings.html b/public/templates/account/settings.html index b88f1283..ca8269c4 100644 --- a/public/templates/account/settings.html +++ b/public/templates/account/settings.html @@ -1,36 +1,36 @@ diff --git a/public/templates/artists/content.html b/public/templates/artists/content.html index 5813bb2c..85134e00 100644 --- a/public/templates/artists/content.html +++ b/public/templates/artists/content.html @@ -1,14 +1,14 @@
    -

    Albums

    - +

    Albums

    +
    -

    Singles

    - +

    Singles

    +
    -

    Part of an Album

    - -
    \ No newline at end of file +

    Part of an Album

    + + diff --git a/public/templates/artists/favourites.html b/public/templates/artists/favourites.html index 79a4da17..d20670fc 100644 --- a/public/templates/artists/favourites.html +++ b/public/templates/artists/favourites.html @@ -1,10 +1,10 @@
    -
    -

    Tracks

    - -
    -
    -

    Albums

    - -
    -
    \ No newline at end of file +
    +

    Tracks

    + +
    +
    +

    Albums

    + +
    + diff --git a/public/templates/artists/index.html b/public/templates/artists/index.html index e6eb5e8c..076124d0 100644 --- a/public/templates/artists/index.html +++ b/public/templates/artists/index.html @@ -1,11 +1,11 @@ diff --git a/public/templates/artists/list.html b/public/templates/artists/list.html index abdebf1b..b18a502f 100644 --- a/public/templates/artists/list.html +++ b/public/templates/artists/list.html @@ -1,21 +1,21 @@
    - -
    \ No newline at end of file + + diff --git a/public/templates/artists/profile.html b/public/templates/artists/profile.html index d2d78d72..db0494ba 100644 --- a/public/templates/artists/profile.html +++ b/public/templates/artists/profile.html @@ -1,16 +1,16 @@
    -
    -
    -

    Bio

    -
    -

    -
    -
    +
    +
    +

    Bio

    +
    +

    +
    +
    - -
    -
    -

    Recent Tracks

    - -
    -
    \ No newline at end of file + +
    +
    +

    Recent Tracks

    + +
    + diff --git a/public/templates/auth/login.html b/public/templates/auth/login.html index e7d40ead..c4465df5 100644 --- a/public/templates/auth/login.html +++ b/public/templates/auth/login.html @@ -1,7 +1,7 @@
    -

    Login

    -
    - Only user accounts that were created as of the launch of the pre-release will be available. -
    - -
    \ No newline at end of file +

    Login

    +
    + Only user accounts that were created as of the launch of the pre-release will be available. +
    + + diff --git a/public/templates/auth/register.html b/public/templates/auth/register.html index 14f4780a..8c2c6357 100644 --- a/public/templates/auth/register.html +++ b/public/templates/auth/register.html @@ -1,4 +1,4 @@
    -

    Register!

    - -
    \ No newline at end of file +

    Register!

    + + diff --git a/public/templates/content/_layout.html b/public/templates/content/_layout.html index 50eb4e54..df7b72a9 100644 --- a/public/templates/content/_layout.html +++ b/public/templates/content/_layout.html @@ -1,8 +1,8 @@ - \ No newline at end of file + diff --git a/public/templates/dashboard/index.html b/public/templates/dashboard/index.html index 723a0ad7..3eb1447c 100644 --- a/public/templates/dashboard/index.html +++ b/public/templates/dashboard/index.html @@ -1,24 +1,24 @@
    -
    -

    - see more - The newest tunes -

    - -
    +
    +

    + see more + The newest tunes +

    + +
    - + -
    -

    - follow @ponyfm - Pony.fm news -

    +
    +

    + follow @ponyfm + Pony.fm news +

    -
    +
    diff --git a/public/templates/directives/albums-list.html b/public/templates/directives/albums-list.html index d26d0e9e..49913048 100644 --- a/public/templates/directives/albums-list.html +++ b/public/templates/directives/albums-list.html @@ -1,21 +1,21 @@ diff --git a/public/templates/directives/comments.html b/public/templates/directives/comments.html index c4b189ca..d6b9f08f 100644 --- a/public/templates/directives/comments.html +++ b/public/templates/directives/comments.html @@ -1,22 +1,22 @@
    -

    All Comments ({{resource.comments.length}})

    -
    -
    - -
    -
    -
      -
    • - There are no comments yet! -
    • -
    • - -
      - - -
      -
      -
      -
    • -
    -
    \ No newline at end of file +

    All Comments ({{resource.comments.length}})

    +
    +
    + +
    +
    +
      +
    • + There are no comments yet! +
    • +
    • + +
      + + +
      +
      +
      +
    • +
    + diff --git a/public/templates/directives/favourite-button.html b/public/templates/directives/favourite-button.html index e1fddc8a..88d5f9b4 100644 --- a/public/templates/directives/favourite-button.html +++ b/public/templates/directives/favourite-button.html @@ -1,10 +1,10 @@ - - Favourite This! - - - - In Your Favourites - - - \ No newline at end of file + + Favourite This! + + + + In Your Favourites + + + diff --git a/public/templates/directives/image-upload.html b/public/templates/directives/image-upload.html index 8d201e20..e9cec93e 100644 --- a/public/templates/directives/image-upload.html +++ b/public/templates/directives/image-upload.html @@ -1,20 +1,20 @@
    -
    -

    - Image must be a PNG that is at least 350x350.
    - -

    - -
    -
      -
    • - -
    • -
    -
    -
    {{error}}
    -
    \ No newline at end of file +
    +

    + Image must be a PNG that is at least 350x350.
    + +

    + +
    +
      +
    • + +
    • +
    +
    +
    {{error}}
    + diff --git a/public/templates/directives/player.html b/public/templates/directives/player.html index 0acfb0b2..107b65a0 100644 --- a/public/templates/directives/player.html +++ b/public/templates/directives/player.html @@ -1,38 +1,38 @@
    -
      -
    • - {{player.currentTrack.progressSeconds | secondsDisplay}} / - {{player.currentTrack.duration | secondsDisplay}} -
    • -
    • -
    • - - - - -
    • -
    • -
    • - - - -
      - -
      -
    • -
    -
    -
    - -
    - +
      +
    • + {{player.currentTrack.progressSeconds | secondsDisplay}} / + {{player.currentTrack.duration | secondsDisplay}} +
    • +
    • +
    • + + + + +
    • +
    • +
    • + + + +
      + +
      +
    • +
    +
    +
    + +
    +
    diff --git a/public/templates/directives/playlists-list.html b/public/templates/directives/playlists-list.html index 086e53d6..4ea764f1 100644 --- a/public/templates/directives/playlists-list.html +++ b/public/templates/directives/playlists-list.html @@ -1,21 +1,21 @@ diff --git a/public/templates/directives/track-player.html b/public/templates/directives/track-player.html index de778725..aadf3ecf 100644 --- a/public/templates/directives/track-player.html +++ b/public/templates/directives/track-player.html @@ -1,7 +1,7 @@
    - - - - - -
    \ No newline at end of file + + + + + + diff --git a/public/templates/directives/tracks-list.html b/public/templates/directives/tracks-list.html index da0645e6..e45ae81b 100644 --- a/public/templates/directives/tracks-list.html +++ b/public/templates/directives/tracks-list.html @@ -1,27 +1,27 @@ \ No newline at end of file +
  • +
    + + + + + +
    +
    + + +
    + + {{track.title}} + + {{track.stats.favourites}}f + {{track.stats.comments}}c + {{track.stats.plays}}p + + {{track.user.name}} / {{track.genre.name}} + +
  • +
  • + No tracks found... +
  • + diff --git a/public/templates/errors/500.html b/public/templates/errors/500.html index 821737f8..4b1bc5b1 100644 --- a/public/templates/errors/500.html +++ b/public/templates/errors/500.html @@ -1,3 +1,3 @@

    500 buckets of oats on the wall.

    -

    Something went wrong on our servers while we were processing your request. We're really sorry about this, and will work hard to get this resolved as soon as possible.

    -

    In any case, we're sorry this happened. Perhaps you would like to go to our home page?

    \ No newline at end of file +

    Something went wrong on our servers while we were processing your request. We're really sorry about this, and will work hard to get this resolved as soon as possible.

    +

    In any case, we're sorry this happened. Perhaps you would like to go to our home page?

    diff --git a/public/templates/favourites/_layout.html b/public/templates/favourites/_layout.html index 5f6096d3..349aaefc 100644 --- a/public/templates/favourites/_layout.html +++ b/public/templates/favourites/_layout.html @@ -1,14 +1,14 @@
    - + - + -
    -		$state = {{$state.current.name}}
    -		$stateParams = {{$stateParams}}
    -	
    -
    \ No newline at end of file +
    +        $state = {{$state.current.name}}
    +        $stateParams = {{$stateParams}}
    +    
    + diff --git a/public/templates/favourites/albums.html b/public/templates/favourites/albums.html index 76f13c39..fb7e2ed1 100644 --- a/public/templates/favourites/albums.html +++ b/public/templates/favourites/albums.html @@ -1,3 +1,3 @@
    - -
    \ No newline at end of file + + diff --git a/public/templates/favourites/playlists.html b/public/templates/favourites/playlists.html index 19b6d3f9..76615fb0 100644 --- a/public/templates/favourites/playlists.html +++ b/public/templates/favourites/playlists.html @@ -1,3 +1,3 @@
    - -
    \ No newline at end of file + + diff --git a/public/templates/favourites/tracks.html b/public/templates/favourites/tracks.html index 45e52838..6f12f17a 100644 --- a/public/templates/favourites/tracks.html +++ b/public/templates/favourites/tracks.html @@ -1,3 +1,3 @@
    - -
    \ No newline at end of file + + diff --git a/public/templates/home/index.html b/public/templates/home/index.html index c101cc24..4b0e6a4a 100644 --- a/public/templates/home/index.html +++ b/public/templates/home/index.html @@ -1,33 +1,33 @@
    -
    -

    - see more - The newest tunes -

    - -
    +
    +

    + see more + The newest tunes +

    + +
    - + -
    -

    Welcome to Pony.fm

    -

    The pony fan music site. By bronies, for bronies.

    -

    - We provide a comprehensive set of free tools to host, distribute, and catalogue your music, integrated with a rich community experience for artists and listeners alike. -

    -

    - Features include unlimited downloads, unlimited uploads, lossless uploads and much more! Click here for more details! -

    +
    +

    Welcome to Pony.fm

    +

    The pony fan music site. By bronies, for bronies.

    +

    + We provide a comprehensive set of free tools to host, distribute, and catalogue your music, integrated with a rich community experience for artists and listeners alike. +

    +

    + Features include unlimited downloads, unlimited uploads, lossless uploads and much more! Click here for more details! +

    -

    - read all - Pony.fm news -

    +

    + read all + Pony.fm news +

    -
    +
    diff --git a/public/templates/pages/about.html b/public/templates/pages/about.html index a7aaf32c..5228b209 100644 --- a/public/templates/pages/about.html +++ b/public/templates/pages/about.html @@ -1,26 +1,26 @@
    -

    What exactly is Pony.fm, anyway?

    -
    -

    Some My Little Pony: Friendship is Magic fans - typically referred to as "bronies" are the musical type, and show their appreciation for the show by pouring their talent into fan music. -

    The brony fan music community is diverse, spanning genres from symphonic metal to trance and everything in between. But most importantly, the community creates music.

    -

    A lot of music.

    -

    All this music has to go somewhere. YouTube, SoundCloud, and Bandcamp are popular outlets that many brony musicians use to host their tunes. But no mainstream sites are specifically designed for our fandom's needs, and they're not particularly helpful if, as a listener, you're looking for pony fan music.

    -

    That's where Pony.fm comes in. Pony.fm is a community, hosting service, and music database rolled into one, with a generous dash of pony on top.

    +

    What exactly is Pony.fm, anyway?

    +
    +

    Some My Little Pony: Friendship is Magic fans - typically referred to as "bronies" are the musical type, and show their appreciation for the show by pouring their talent into fan music. +

    The brony fan music community is diverse, spanning genres from symphonic metal to trance and everything in between. But most importantly, the community creates music.

    +

    A lot of music.

    +

    All this music has to go somewhere. YouTube, SoundCloud, and Bandcamp are popular outlets that many brony musicians use to host their tunes. But no mainstream sites are specifically designed for our fandom's needs, and they're not particularly helpful if, as a listener, you're looking for pony fan music.

    +

    That's where Pony.fm comes in. Pony.fm is a community, hosting service, and music database rolled into one, with a generous dash of pony on top.

    -

    So it's SoundCloud with ponies?

    -

    Eenope!

    -

    Pony.fm is an original project. Although it takes inspiration from a number of well-known services for the general public, Pony.fm is not specifically modeled after any one of them. As a fan site itself, Pony.fm is an experience all its own.

    -

    Simply put, "Pony.fm is Pony.fm."

    +

    So it's SoundCloud with ponies?

    +

    Eenope!

    +

    Pony.fm is an original project. Although it takes inspiration from a number of well-known services for the general public, Pony.fm is not specifically modeled after any one of them. As a fan site itself, Pony.fm is an experience all its own.

    +

    Simply put, "Pony.fm is Pony.fm."

    -

    What makes Pony.fm special?

    -

    Pony.fm is a service created by bronies, for bronies. Every inch of the Pony.fm experience is crafted with ponies and bronies in mind. Some of the features necessarily resemble what you may find on other sites - lossless uploads, for example - but some features are specific to the pony fan music community.

    -

    Created as a service for the fandom, Pony.fm aims to be the one-stop shop for all things pony music, for artists and listeners alike.

    +

    What makes Pony.fm special?

    +

    Pony.fm is a service created by bronies, for bronies. Every inch of the Pony.fm experience is crafted with ponies and bronies in mind. Some of the features necessarily resemble what you may find on other sites - lossless uploads, for example - but some features are specific to the pony fan music community.

    +

    Created as a service for the fandom, Pony.fm aims to be the one-stop shop for all things pony music, for artists and listeners alike.

    -

    What does MLP Forums have to do with Pony.fm?

    -

    MLP Forums and Pony.fm share an owner, and each encompasses a different segment of the global My Little Pony: Friendship is Magic community. Put together, both sites are able to offer a richer "supercommunity" experience than either site could offer on its own.

    +

    What does MLP Forums have to do with Pony.fm?

    +

    MLP Forums and Pony.fm share an owner, and each encompasses a different segment of the global My Little Pony: Friendship is Magic community. Put together, both sites are able to offer a richer "supercommunity" experience than either site could offer on its own.

    -

    Who is behind Pony.fm?

    -

    Pony.fm was created by Feld0, a pony-loving teenager who heard the call of code. Recognizing the need for a true pony-specific music hosting site, and realizing that MLP Forums provided him with the resources he needed to make it happen, he created a blank text file and started pumping code into his computer.

    +

    Who is behind Pony.fm?

    +

    Pony.fm was created by Feld0, a pony-loving teenager who heard the call of code. Recognizing the need for a true pony-specific music hosting site, and realizing that MLP Forums provided him with the resources he needed to make it happen, he created a blank text file and started pumping code into his computer.

    The site is now maintained by him and Nelson LaQuet as part of the Poniverse network.

    -
    -
    \ No newline at end of file +
    + diff --git a/public/templates/pages/faq.html b/public/templates/pages/faq.html index 4696b413..7aafdc13 100644 --- a/public/templates/pages/faq.html +++ b/public/templates/pages/faq.html @@ -1,77 +1,77 @@
    -

    Pony.fm FAQ

    -
    - +

    Pony.fm FAQ

    +
    + - -

    Why doesn't Pony.fm support MP3 files?

    -

    MP3 encoding is "lossy." Lossy means that, during the encoding process, quality gets sacrificed for a decrease in size.

    -

    Pony.fm does not provide only MP3's; it also provides OGG's and lossless FLAC's. Uploading a lossless file puts a "perfect" copy of your track in Pony.fm's file store, which can be offered up for download on its own for audiophiles who like CD or better-than-CD sound quality, but starting from a lossless original also allows Pony.fm to transcode a song to other lossy formats with only one degree of loss.

    + +

    Why doesn't Pony.fm support MP3 files?

    +

    MP3 encoding is "lossy." Lossy means that, during the encoding process, quality gets sacrificed for a decrease in size.

    +

    Pony.fm does not provide only MP3's; it also provides OGG's and lossless FLAC's. Uploading a lossless file puts a "perfect" copy of your track in Pony.fm's file store, which can be offered up for download on its own for audiophiles who like CD or better-than-CD sound quality, but starting from a lossless original also allows Pony.fm to transcode a song to other lossy formats with only one degree of loss.

    -

    Pony.fm accepts a lossless upload, which is converted to FLAC (if it isn't already FLAC) for storage. This leaves a "perfect," unblemished copy of the track in Pony.fm's file store.

    -

    An MP3 file can be created from the FLAC. Minimal quality is lost because creating an MP3 from the FLAC is as good as creating an MP3 directly from your DAW.

    -

    An OGG Vorbis file can be created from the FLAC. Minimal quality is lost because Pony.fm has a lossless copy of the track on file; thus, we don't have the "recompressing a compressed MP3" issue that is present if Pony.fm's "master file" was an MP3.

    +

    Pony.fm accepts a lossless upload, which is converted to FLAC (if it isn't already FLAC) for storage. This leaves a "perfect," unblemished copy of the track in Pony.fm's file store.

    +

    An MP3 file can be created from the FLAC. Minimal quality is lost because creating an MP3 from the FLAC is as good as creating an MP3 directly from your DAW.

    +

    An OGG Vorbis file can be created from the FLAC. Minimal quality is lost because Pony.fm has a lossless copy of the track on file; thus, we don't have the "recompressing a compressed MP3" issue that is present if Pony.fm's "master file" was an MP3.

    - -

    Why isn't my file being accepted for Upload?

    -

    Pony.fm analyzes all uploads to determine their format and check it against a whitelist; the file extension is ignored. Unfortunately, slight variations in AIFF and WAV files exist that need to be individually whitelisted.

    -

    The alpha should have nailed most of these by now, but if there are some that still are not being accepted, contact an admin with the specific file details and they will try to add them to the White List.

    + +

    Why isn't my file being accepted for Upload?

    +

    Pony.fm analyzes all uploads to determine their format and check it against a whitelist; the file extension is ignored. Unfortunately, slight variations in AIFF and WAV files exist that need to be individually whitelisted.

    +

    The alpha should have nailed most of these by now, but if there are some that still are not being accepted, contact an admin with the specific file details and they will try to add them to the White List.

    - -

    How do I Upload a song?

    -

    At the top right of your screen there should be a button titled "Upload" next to the "send feedback" one. Select the Upload button and a drop down menu will appear, select the first option titled "Track Uploader". You should now be on a screen displaying the uploader. Select the Green button titled "Add Files" and select your song from your computer. The track should now start its download.

    -

    Please be aware that Pony.fm doesn't support MP3 uploads.

    + +

    How do I Upload a song?

    +

    At the top right of your screen there should be a button titled "Upload" next to the "send feedback" one. Select the Upload button and a drop down menu will appear, select the first option titled "Track Uploader". You should now be on a screen displaying the uploader. Select the Green button titled "Add Files" and select your song from your computer. The track should now start its download.

    +

    Please be aware that Pony.fm doesn't support MP3 uploads.

    - -

    How do you set an avatar?

    -

    Avatars in Pony.fm use a free service called Gravatar. To learn more about it, and setup your own Gravatar account, click here!

    + +

    How do you set an avatar?

    +

    Avatars in Pony.fm use a free service called Gravatar. To learn more about it, and setup your own Gravatar account, click here!

    - -

    Why the connection to MLP Forums?

    -

    MLP Forums is one of the web's largest and most well known My Little Pony: Friendship is Magic forum communities. Formally linking the two sites together paves the way for a rich, cross-site community experience. Members of one site can easily jump into the other without the hassle of managing yet another account, and content can seamlessly be brought from MLP Forums to Pony.fm and vice versa in meaningful ways.

    + +

    Why the connection to MLP Forums?

    +

    MLP Forums is one of the web's largest and most well known My Little Pony: Friendship is Magic forum communities. Formally linking the two sites together paves the way for a rich, cross-site community experience. Members of one site can easily jump into the other without the hassle of managing yet another account, and content can seamlessly be brought from MLP Forums to Pony.fm and vice versa in meaningful ways.

    - -

    How do I send Feedback to the Developers?

    -

    At the top of your page should be a nifty little button to the left of the upload button that says "Send Feedback".

    -

    Click this and a form will pop up, just follow the two simple instructions and enter the information needed and click "submit".

    -

    All feedback is greatly appreciated on Pony FM and we do our hardest to keep this site functional and to keep all of you happy.

    + +

    How do I send Feedback to the Developers?

    +

    At the top of your page should be a nifty little button to the left of the upload button that says "Send Feedback".

    +

    Click this and a form will pop up, just follow the two simple instructions and enter the information needed and click "submit".

    +

    All feedback is greatly appreciated on Pony FM and we do our hardest to keep this site functional and to keep all of you happy.

    - -

    What is the "Poniverse" and what does Pony FM have to do with it?

    -

    The Poniverse is a network that links together several Brony sites ,such as MLP Forums, together to form a super community of sorts that provides sites that satisfy everyone's needs.

    -

    Pony FM is just one of those sites and sets out to provide Brony Musicians with their own special corner to share their work with others and to receive feedback from other musicians, and in lots of cases to form collaborations that can end up in great partnerships.

    + +

    What is the "Poniverse" and what does Pony FM have to do with it?

    +

    The Poniverse is a network that links together several Brony sites ,such as MLP Forums, together to form a super community of sorts that provides sites that satisfy everyone's needs.

    +

    Pony FM is just one of those sites and sets out to provide Brony Musicians with their own special corner to share their work with others and to receive feedback from other musicians, and in lots of cases to form collaborations that can end up in great partnerships.

    - -

    Can I view any site statistics?

    -

    You sure can!

    -

    At the bottom left of your screen there is a small button that says Site Stats that's nestled just below a button for Pony.fm Forum.

    -

    Click on the "Site Stats" button and you will be taken to a screen that shows you graphs depicting the number of Track Views, Track Downloads, Track Plays and User Registrations.

    + +

    Can I view any site statistics?

    +

    You sure can!

    +

    At the bottom left of your screen there is a small button that says Site Stats that's nestled just below a button for Pony.fm Forum.

    +

    Click on the "Site Stats" button and you will be taken to a screen that shows you graphs depicting the number of Track Views, Track Downloads, Track Plays and User Registrations.

    - -

    How do I get in contact with other Musicians on Pony.fm?

    -

    On each user's screen there is a nifty little section where you can leave comments. This is used best for providing feedback and to show them your support, but if you plan on trying to start a collaboration and would prefer a more private means of communication, underneath the user Bio, there is a "send a message" which will utilise the "Personal Messenger" from MLP Forums to allow you to send a message to that artist.

    + +

    How do I get in contact with other Musicians on Pony.fm?

    +

    On each user's screen there is a nifty little section where you can leave comments. This is used best for providing feedback and to show them your support, but if you plan on trying to start a collaboration and would prefer a more private means of communication, underneath the user Bio, there is a "send a message" which will utilise the "Personal Messenger" from MLP Forums to allow you to send a message to that artist.

    - -

    How do I report someone?

    -

    At the current time a report feature isn't quite installed into the site, however, email feld0@pony.fm and he would be glad to handle any moderating issues that you have. But to reiterate what was said before, there IS a report function in the works.

    + +

    How do I report someone?

    +

    At the current time a report feature isn't quite installed into the site, however, email feld0@pony.fm and he would be glad to handle any moderating issues that you have. But to reiterate what was said before, there IS a report function in the works.

    - -

    How do I download an artist' song?

    -

    Click on the song that you are looking to download and you will notice to the right of the screen is a button titled "Downloads".

    -

    Click this button and you will be brought a drop down menu with FLAC, MP3, OGG, AAC and ALAC file types for you to download.

    -

    Select your preferred file type to start the download and it should all be smooth sailing from there.

    -
    -
    -
    \ No newline at end of file + +

    How do I download an artist' song?

    +

    Click on the song that you are looking to download and you will notice to the right of the screen is a button titled "Downloads".

    +

    Click this button and you will be brought a drop down menu with FLAC, MP3, OGG, AAC and ALAC file types for you to download.

    +

    Select your preferred file type to start the download and it should all be smooth sailing from there.

    + + + diff --git a/public/templates/partials/album-share-dialog.html b/public/templates/partials/album-share-dialog.html index 09ba06b2..6db8069e 100644 --- a/public/templates/partials/album-share-dialog.html +++ b/public/templates/partials/album-share-dialog.html @@ -1,13 +1,13 @@ diff --git a/public/templates/partials/auth/login.html b/public/templates/partials/auth/login.html index 93cc5f98..171fe3a0 100644 --- a/public/templates/partials/auth/login.html +++ b/public/templates/partials/auth/login.html @@ -1,27 +1,27 @@
    -
      -
    • - {{message}} -
    • -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - - -
    -
    -
    \ No newline at end of file +
      +
    • + {{message}} +
    • +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + + +
    +
    + diff --git a/public/templates/partials/credits-dialog.html b/public/templates/partials/credits-dialog.html index 16723161..7371b35e 100644 --- a/public/templates/partials/credits-dialog.html +++ b/public/templates/partials/credits-dialog.html @@ -1,15 +1,15 @@ diff --git a/public/templates/partials/playlist-dialog.html b/public/templates/partials/playlist-dialog.html index 0d16fe21..4c4502b6 100644 --- a/public/templates/partials/playlist-dialog.html +++ b/public/templates/partials/playlist-dialog.html @@ -1,39 +1,39 @@
    - - - -
    \ No newline at end of file + + + + diff --git a/public/templates/partials/playlist-share-dialog.html b/public/templates/partials/playlist-share-dialog.html index 08135445..3f24115b 100644 --- a/public/templates/partials/playlist-share-dialog.html +++ b/public/templates/partials/playlist-share-dialog.html @@ -1,13 +1,13 @@ diff --git a/public/templates/partials/track-share-dialog.html b/public/templates/partials/track-share-dialog.html index f256b16d..d47977ce 100644 --- a/public/templates/partials/track-share-dialog.html +++ b/public/templates/partials/track-share-dialog.html @@ -1,19 +1,19 @@ diff --git a/public/templates/playlists/index.html b/public/templates/playlists/index.html index e6eb5e8c..076124d0 100644 --- a/public/templates/playlists/index.html +++ b/public/templates/playlists/index.html @@ -1,11 +1,11 @@ diff --git a/public/templates/playlists/list.html b/public/templates/playlists/list.html index 19b6d3f9..76615fb0 100644 --- a/public/templates/playlists/list.html +++ b/public/templates/playlists/list.html @@ -1,3 +1,3 @@
    - -
    \ No newline at end of file + + diff --git a/public/templates/playlists/show.html b/public/templates/playlists/show.html index a11b50da..4dcf9a69 100644 --- a/public/templates/playlists/show.html +++ b/public/templates/playlists/show.html @@ -1,52 +1,52 @@
    - + -
    -

    -

    - created by: -

    -
    +
    +

    +

    + created by: +

    +
    -
    -
    - +
    +
    + - + -
      -
    • Created:
    • -
    • Views:
    • -
    • Downloads:
    • -
    • Favourites:
    • -
    -
    +
      +
    • Created:
    • +
    • Views:
    • +
    • Downloads:
    • +
    • Favourites:
    • +
    +
    -
    -
    -

    Description

    -

    -
    +
    +
    +

    Description

    +

    +
    -

    Tracks

    - +

    Tracks

    + - -
    -
    -
    \ No newline at end of file + +
    +
    + diff --git a/public/templates/tracks/index.html b/public/templates/tracks/index.html index f057b4e8..9f4dc91c 100644 --- a/public/templates/tracks/index.html +++ b/public/templates/tracks/index.html @@ -1,72 +1,72 @@ - \ No newline at end of file + diff --git a/public/templates/tracks/list.html b/public/templates/tracks/list.html index 45e52838..6f12f17a 100644 --- a/public/templates/tracks/list.html +++ b/public/templates/tracks/list.html @@ -1,3 +1,3 @@
    - -
    \ No newline at end of file + + diff --git a/public/templates/tracks/show.html b/public/templates/tracks/show.html index a9ec30ef..8fce26d1 100644 --- a/public/templates/tracks/show.html +++ b/public/templates/tracks/show.html @@ -1,79 +1,79 @@
    - + -
    - -

    -

    - - from: - +
    + +

    +

    + + from: + - by: -

    -
    + by: +

    +
    -
    -
    - +
    +
    + - + -
      -
    • Published:
    • -
    • Views:
    • -
    • Plays:
    • -
    • Downloads:
    • -
    • Favourites:
    • -
    -
    -
    -
    -

    Description

    -

    -
    +
      +
    • Published:
    • +
    • Views:
    • +
    • Plays:
    • +
    • Downloads:
    • +
    • Favourites:
    • +
    +
    +
    +
    +

    Description

    +

    +
    -
    -

    Lyrics

    - -
    +
    +

    Lyrics

    + +
    - -
    -
    -
    \ No newline at end of file + +
    +
    + diff --git a/public/templates/uploader/index.html b/public/templates/uploader/index.html index 3ee7d0c7..6139d8bd 100644 --- a/public/templates/uploader/index.html +++ b/public/templates/uploader/index.html @@ -1,32 +1,32 @@
    -
    -

    Drop files here to begin your upload!

    -
    +
    +

    Drop files here to begin your upload!

    +
    -

    FLAC, WAV, and AIFF files will be accepted. Each file can be up to 200 MB in size.

    +

    FLAC, WAV, and AIFF files will be accepted. Each file can be up to 200 MB in size.

    -

    Tracks must be a minimum of 30 seconds long.

    +

    Tracks must be a minimum of 30 seconds long.

    -

    Please note that you need to publish your tracks after uploading them before they will become available to the public.

    +

    Please note that you need to publish your tracks after uploading them before they will become available to the public.

    -
      -
    • -

      - - Processing - Uploading - Error - {{upload.name}} - - {{upload.error}} - - - - Publish - - {{upload.name}} - -

      -
      -
    • -
    -
    \ No newline at end of file +
      +
    • +

      + + Processing + Uploading + Error + {{upload.name}} - + {{upload.error}} + + + + Publish + + {{upload.name}} + +

      +
      +
    • +
    + diff --git a/resources/assets/scripts/app/app.coffee b/resources/assets/scripts/app/app.coffee index 4af1110e..c840074b 100644 --- a/resources/assets/scripts/app/app.coffee +++ b/resources/assets/scripts/app/app.coffee @@ -3,248 +3,248 @@ window.pfm.preloaders = {} module = angular.module 'ponyfm', ['ui.bootstrap', 'ui.state', 'ui.date', 'ui.sortable', 'pasvaz.bindonce', 'angularytics'] if window.pfm.environment == 'production' - module.run [ - 'Angularytics', - (analytics) -> - analytics.init() - ] + module.run [ + 'Angularytics', + (analytics) -> + analytics.init() + ] module.config [ - '$locationProvider', '$stateProvider', '$dialogProvider', 'AngularyticsProvider', '$httpProvider', '$sceDelegateProvider' - (location, state, $dialogProvider, analytics, $httpProvider, $sceDelegateProvider) -> + '$locationProvider', '$stateProvider', '$dialogProvider', 'AngularyticsProvider', '$httpProvider', '$sceDelegateProvider' + (location, state, $dialogProvider, analytics, $httpProvider, $sceDelegateProvider) -> - $httpProvider.interceptors.push [ - -> - request: (config) -> - return config if !(/^\/?templates\//.test config.url) - config.url += '?' + Math.ceil(Math.random() * 1000000) - return config - ] + $httpProvider.interceptors.push [ + -> + request: (config) -> + return config if !(/^\/?templates\//.test config.url) + config.url += '?' + Math.ceil(Math.random() * 1000000) + return config + ] - # This fixes resource loading on IE - $sceDelegateProvider.resourceUrlWhitelist [ - 'self', - '/templates/directives/*' - ] + # This fixes resource loading on IE + $sceDelegateProvider.resourceUrlWhitelist [ + 'self', + '/templates/directives/*' + ] - if window.pfm.environment == 'production' - analytics.setEventHandlers ['Google'] + if window.pfm.environment == 'production' + analytics.setEventHandlers ['Google'] - # Errors - state.state 'errors-404', - url: '/errors/not-found' - templateUrl: '/templates/errors/404.html' + # Errors + state.state 'errors-404', + url: '/errors/not-found' + templateUrl: '/templates/errors/404.html' - state.state 'errors-500', - url: '/errors/server' - templateUrl: '/templates/errors/500.html' + state.state 'errors-500', + url: '/errors/server' + templateUrl: '/templates/errors/500.html' - state.state 'errors-403', - url: '/errors/not-authorized' - templateUrl: '/templates/errors/403.html' + state.state 'errors-403', + url: '/errors/not-authorized' + templateUrl: '/templates/errors/403.html' - state.state 'errors-400', - url: '/errors/invalid' - templateUrl: '/templates/errors/400.html' + state.state 'errors-400', + url: '/errors/invalid' + templateUrl: '/templates/errors/400.html' - # Upload + # Upload - state.state 'uploader', - url: '/account/uploader' - templateUrl: '/templates/uploader/index.html' - controller: 'uploader' + state.state 'uploader', + url: '/account/uploader' + templateUrl: '/templates/uploader/index.html' + controller: 'uploader' - # Account + # Account - state.state 'account', - url: '/account' - abstract: true - templateUrl: '/templates/account/_layout.html' + state.state 'account', + url: '/account' + abstract: true + templateUrl: '/templates/account/_layout.html' - state.state 'account.settings', - url: '' - templateUrl: '/templates/account/settings.html' - controller: 'account-settings' + state.state 'account.settings', + url: '' + templateUrl: '/templates/account/settings.html' + controller: 'account-settings' - state.state 'account.tracks', - url: '/tracks' - templateUrl: '/templates/account/tracks.html' - controller: 'account-tracks' + state.state 'account.tracks', + url: '/tracks' + templateUrl: '/templates/account/tracks.html' + controller: 'account-tracks' - state.state 'account.tracks.edit', - url: '/edit/:track_id' - templateUrl: '/templates/account/track.html' - controller: 'account-track' + state.state 'account.tracks.edit', + url: '/edit/:track_id' + templateUrl: '/templates/account/track.html' + controller: 'account-track' - state.state 'account.albums', - url: '/albums' - templateUrl: '/templates/account/albums.html' - controller: 'account-albums' + state.state 'account.albums', + url: '/albums' + templateUrl: '/templates/account/albums.html' + controller: 'account-albums' - state.state 'account.albums.create', - url: '/create' - templateUrl: '/templates/account/album.html' - controller: 'account-albums-edit' + state.state 'account.albums.create', + url: '/create' + templateUrl: '/templates/account/album.html' + controller: 'account-albums-edit' - state.state 'account.albums.edit', - url: '/edit/:album_id' - templateUrl: '/templates/account/album.html' - controller: 'account-albums-edit' + state.state 'account.albums.edit', + url: '/edit/:album_id' + templateUrl: '/templates/account/album.html' + controller: 'account-albums-edit' - state.state 'account.playlists', - url: '/playlists' - templateUrl: '/templates/account/playlists.html' - controller: 'account-playlists' + state.state 'account.playlists', + url: '/playlists' + templateUrl: '/templates/account/playlists.html' + controller: 'account-playlists' - state.state 'favourites', - url: '/account/favourites' - abstract: true - templateUrl: '/templates/favourites/_layout.html' + state.state 'favourites', + url: '/account/favourites' + abstract: true + templateUrl: '/templates/favourites/_layout.html' - state.state 'favourites.tracks', - url: '/tracks' - templateUrl: '/templates/favourites/tracks.html' - controller: 'favourites-tracks' + state.state 'favourites.tracks', + url: '/tracks' + templateUrl: '/templates/favourites/tracks.html' + controller: 'favourites-tracks' - state.state 'favourites.playlists', - url: '/playlists' - templateUrl: '/templates/favourites/playlists.html' - controller: 'favourites-playlists' + state.state 'favourites.playlists', + url: '/playlists' + templateUrl: '/templates/favourites/playlists.html' + controller: 'favourites-playlists' - state.state 'favourites.albums', - url: '/albums' - templateUrl: '/templates/favourites/albums.html' - controller: 'favourites-albums' + state.state 'favourites.albums', + url: '/albums' + templateUrl: '/templates/favourites/albums.html' + controller: 'favourites-albums' - # Tracks + # Tracks - state.state 'content', - abstract: true - templateUrl: '/templates/content/_layout.html' + state.state 'content', + abstract: true + templateUrl: '/templates/content/_layout.html' - state.state 'content.tracks', - templateUrl: '/templates/tracks/index.html' - controller: 'tracks' - url: '/tracks' - abstract: true + state.state 'content.tracks', + templateUrl: '/templates/tracks/index.html' + controller: 'tracks' + url: '/tracks' + abstract: true - state.state 'content.tracks.list', - url: '^/tracks?filter&page' - templateUrl: '/templates/tracks/list.html' - controller: 'tracks-list' + state.state 'content.tracks.list', + url: '^/tracks?filter&page' + templateUrl: '/templates/tracks/list.html' + controller: 'tracks-list' - state.state 'content.track', - url: '/tracks/{id:[^\-]+}-{slug}' - templateUrl: '/templates/tracks/show.html' - controller: 'track' + state.state 'content.track', + url: '/tracks/{id:[^\-]+}-{slug}' + templateUrl: '/templates/tracks/show.html' + controller: 'track' - # Albums + # Albums - state.state 'content.albums', - url: '/albums' - templateUrl: '/templates/albums/index.html' - controller: 'albums' - abstract: true + state.state 'content.albums', + url: '/albums' + templateUrl: '/templates/albums/index.html' + controller: 'albums' + abstract: true - state.state 'content.albums.list', - url: '?page' - templateUrl: '/templates/albums/list.html' - controller: 'albums-list' + state.state 'content.albums.list', + url: '?page' + templateUrl: '/templates/albums/list.html' + controller: 'albums-list' - state.state 'content.album', - url: '/albums/{id:[^\-]+}-{slug}' - templateUrl: '/templates/albums/show.html' - controller: 'album' + state.state 'content.album', + url: '/albums/{id:[^\-]+}-{slug}' + templateUrl: '/templates/albums/show.html' + controller: 'album' - # Playlists + # Playlists - state.state 'content.playlists', - url: '/playlists' - templateUrl: '/templates/playlists/index.html' - controller: 'playlists' - abstract: true + state.state 'content.playlists', + url: '/playlists' + templateUrl: '/templates/playlists/index.html' + controller: 'playlists' + abstract: true - state.state 'content.playlists.list', - url: '?page' - controller: 'playlists-list' - templateUrl: '/templates/playlists/list.html' + state.state 'content.playlists.list', + url: '?page' + controller: 'playlists-list' + templateUrl: '/templates/playlists/list.html' - state.state 'content.playlist', - url: '/playlist/{id:[^\-]+}-{slug}' - templateUrl: '/templates/playlists/show.html' - controller: 'playlist' + state.state 'content.playlist', + url: '/playlist/{id:[^\-]+}-{slug}' + templateUrl: '/templates/playlists/show.html' + controller: 'playlist' - # Artists + # Artists - state.state 'content.artists', - url: '/artists' - templateUrl: '/templates/artists/index.html' - controller: 'artists' - abstract: true + state.state 'content.artists', + url: '/artists' + templateUrl: '/templates/artists/index.html' + controller: 'artists' + abstract: true - state.state 'content.artists.list', - url: '?page' - templateUrl: '/templates/artists/list.html' - controller: 'artists-list' + state.state 'content.artists.list', + url: '?page' + templateUrl: '/templates/artists/list.html' + controller: 'artists-list' - # Pages + # Pages - state.state 'faq', - url: '/faq' - templateUrl: '/templates/pages/faq.html' + state.state 'faq', + url: '/faq' + templateUrl: '/templates/pages/faq.html' - state.state 'about', - url: '/about' - templateUrl: '/templates/pages/about.html' + state.state 'about', + url: '/about' + templateUrl: '/templates/pages/about.html' - # Auth + # Auth - state.state 'login', - url: '/login' - templateUrl: '/templates/auth/login.html' - controller: 'login' + state.state 'login', + url: '/login' + templateUrl: '/templates/auth/login.html' + controller: 'login' - state.state 'register', - url: '/register' - templateUrl: '/templates/auth/register.html' + state.state 'register', + url: '/register' + templateUrl: '/templates/auth/register.html' - # Hompage + # Hompage - if window.pfm.auth.isLogged - state.state 'home', - url: '/' - templateUrl: '/templates/dashboard/index.html' - controller: 'dashboard' - else - state.state 'home', - url: '/' - templateUrl: '/templates/home/index.html' - controller: 'home' + if window.pfm.auth.isLogged + state.state 'home', + url: '/' + templateUrl: '/templates/dashboard/index.html' + controller: 'dashboard' + else + state.state 'home', + url: '/' + templateUrl: '/templates/home/index.html' + controller: 'home' - # Final catch-all for aritsts - state.state 'content.artist', - url: '^/{slug}' - templateUrl: '/templates/artists/_show_layout.html' - abstract: true - controller: 'artist' + # Final catch-all for aritsts + state.state 'content.artist', + url: '^/{slug}' + templateUrl: '/templates/artists/_show_layout.html' + abstract: true + controller: 'artist' - state.state 'content.artist.profile', - url: '' - templateUrl: '/templates/artists/profile.html' - controller: 'artist-profile' + state.state 'content.artist.profile', + url: '' + templateUrl: '/templates/artists/profile.html' + controller: 'artist-profile' - state.state 'content.artist.content', - url: '/content' - templateUrl: '/templates/artists/content.html' - controller: 'artist-content' + state.state 'content.artist.content', + url: '/content' + templateUrl: '/templates/artists/content.html' + controller: 'artist-content' - state.state 'content.artist.favourites', - url: '/favourites' - templateUrl: '/templates/artists/favourites.html' - controller: 'artist-favourites' + state.state 'content.artist.favourites', + url: '/favourites' + templateUrl: '/templates/artists/favourites.html' + controller: 'artist-favourites' - location.html5Mode(true); - $dialogProvider.options - dialogFade: true - backdropClick: false + location.html5Mode(true); + $dialogProvider.options + dialogFade: true + backdropClick: false ] diff --git a/resources/assets/scripts/app/controllers/account-albums-edit.coffee b/resources/assets/scripts/app/controllers/account-albums-edit.coffee index 1a99f97e..5115b31c 100644 --- a/resources/assets/scripts/app/controllers/account-albums-edit.coffee +++ b/resources/assets/scripts/app/controllers/account-albums-edit.coffee @@ -1,143 +1,143 @@ window.pfm.preloaders['account-albums-edit'] = [ - 'account-tracks', 'account-albums', '$state' - (tracks, albums, $state) -> - defs = [tracks.refresh()] - if $state.params.album_id - defs.push albums.getEdit($state.params.album_id, true) + 'account-tracks', 'account-albums', '$state' + (tracks, albums, $state) -> + defs = [tracks.refresh()] + if $state.params.album_id + defs.push albums.getEdit($state.params.album_id, true) - $.when.all defs + $.when.all defs ] angular.module('ponyfm').controller "account-albums-edit", [ - '$scope', '$state', '$dialog', 'account-albums' - ($scope, $state, $dialog, albums) -> - $scope.isNew = $state.params.album_id == undefined - $scope.data.isEditorOpen = true - $scope.errors = {} - $scope.isDirty = false - $scope.album = {} - $scope.isSaving = false - $scope.tracks = [] - $scope.trackIds = {} + '$scope', '$state', '$dialog', 'account-albums' + ($scope, $state, $dialog, albums) -> + $scope.isNew = $state.params.album_id == undefined + $scope.data.isEditorOpen = true + $scope.errors = {} + $scope.isDirty = false + $scope.album = {} + $scope.isSaving = false + $scope.tracks = [] + $scope.trackIds = {} - $scope.toggleTrack = (track) -> - if $scope.trackIds[track.id] - delete $scope.trackIds[track.id] - $scope.tracks.splice ($scope.tracks.indexOf track), 1 - else - $scope.trackIds[track.id] = track - $scope.tracks.push track + $scope.toggleTrack = (track) -> + if $scope.trackIds[track.id] + delete $scope.trackIds[track.id] + $scope.tracks.splice ($scope.tracks.indexOf track), 1 + else + $scope.trackIds[track.id] = track + $scope.tracks.push track - $scope.isDirty = true + $scope.isDirty = true - $scope.sortTracks = () -> - $scope.isDirty = true + $scope.sortTracks = () -> + $scope.isDirty = true - $scope.touchModel = -> $scope.isDirty = true + $scope.touchModel = -> $scope.isDirty = true - $scope.setCover = (image, type) -> - delete $scope.album.cover_id - delete $scope.album.cover + $scope.setCover = (image, type) -> + delete $scope.album.cover_id + delete $scope.album.cover - if image == null - $scope.album.remove_cover = true - else if type == 'file' - $scope.album.cover = image - else if type == 'gallery' - $scope.album.cover_id = image.id + if image == null + $scope.album.remove_cover = true + else if type == 'file' + $scope.album.cover = image + else if type == 'gallery' + $scope.album.cover_id = image.id - $scope.isDirty = true + $scope.isDirty = true - $scope.$on '$destroy', -> $scope.data.isEditorOpen = false + $scope.$on '$destroy', -> $scope.data.isEditorOpen = false - $scope.saveAlbum = -> - return if !$scope.isNew && !$scope.isDirty + $scope.saveAlbum = -> + return if !$scope.isNew && !$scope.isDirty - url = - if $scope.isNew - '/api/web/albums/create' - else - '/api/web/albums/edit/' + $state.params.album_id + url = + if $scope.isNew + '/api/web/albums/create' + else + '/api/web/albums/edit/' + $state.params.album_id - xhr = new XMLHttpRequest() - xhr.onload = -> $scope.$apply -> - $scope.isSaving = false - response = $.parseJSON(xhr.responseText) - if xhr.status != 200 - $scope.errors = {} - _.each response.errors, (value, key) -> $scope.errors[key] = value.join ', ' - return + xhr = new XMLHttpRequest() + xhr.onload = -> $scope.$apply -> + $scope.isSaving = false + response = $.parseJSON(xhr.responseText) + if xhr.status != 200 + $scope.errors = {} + _.each response.errors, (value, key) -> $scope.errors[key] = value.join ', ' + return - $scope.$emit 'album-updated' + $scope.$emit 'album-updated' - if $scope.isNew - $scope.isDirty = false - $scope.$emit 'album-created' - $state.transitionTo 'account.albums.edit', {album_id: response.id} - else - $scope.isDirty = false - $scope.data.selectedAlbum.title = $scope.album.title - $scope.data.selectedAlbum.covers.normal = response.real_cover_url + if $scope.isNew + $scope.isDirty = false + $scope.$emit 'album-created' + $state.transitionTo 'account.albums.edit', {album_id: response.id} + else + $scope.isDirty = false + $scope.data.selectedAlbum.title = $scope.album.title + $scope.data.selectedAlbum.covers.normal = response.real_cover_url - formData = new FormData() + formData = new FormData() - _.each $scope.album, (value, name) -> - if name == 'cover' - return if value == null - if typeof(value) == 'object' - formData.append name, value, value.name - else - formData.append name, value + _.each $scope.album, (value, name) -> + if name == 'cover' + return if value == null + if typeof(value) == 'object' + formData.append name, value, value.name + else + formData.append name, value - formData.append 'track_ids', _.map($scope.tracks, (t) -> t.id).join() + formData.append 'track_ids', _.map($scope.tracks, (t) -> t.id).join() - xhr.open 'POST', url, true - xhr.setRequestHeader 'X-CSRF-Token', pfm.token - $scope.isSaving = true - xhr.send formData + xhr.open 'POST', url, true + xhr.setRequestHeader 'X-CSRF-Token', pfm.token + $scope.isSaving = true + xhr.send formData - $scope.deleteAlbum = () -> - $dialog.messageBox('Delete ' + $scope.album.title, 'Are you sure you want to delete "' + $scope.album.title + '"? This cannot be undone.', [ - {result: 'ok', label: 'Yes', cssClass: 'btn-danger'}, {result: 'cancel', label: 'No', cssClass: 'btn-primary'} - ]).open().then (res) -> - return if res == 'cancel' - $.post('/api/web/albums/delete/' + $scope.album.id, {_token: window.pfm.token}) - .then -> $scope.$apply -> - $scope.$emit 'album-deleted' - $state.transitionTo 'account.albums' + $scope.deleteAlbum = () -> + $dialog.messageBox('Delete ' + $scope.album.title, 'Are you sure you want to delete "' + $scope.album.title + '"? This cannot be undone.', [ + {result: 'ok', label: 'Yes', cssClass: 'btn-danger'}, {result: 'cancel', label: 'No', cssClass: 'btn-primary'} + ]).open().then (res) -> + return if res == 'cancel' + $.post('/api/web/albums/delete/' + $scope.album.id, {_token: window.pfm.token}) + .then -> $scope.$apply -> + $scope.$emit 'album-deleted' + $state.transitionTo 'account.albums' - $scope.setCover = (image, type) -> - delete $scope.album.cover_id - delete $scope.album.cover + $scope.setCover = (image, type) -> + delete $scope.album.cover_id + delete $scope.album.cover - if image == null - $scope.album.remove_cover = true - else if type == 'file' - $scope.album.cover = image - else if type == 'gallery' - $scope.album.cover_id = image.id + if image == null + $scope.album.remove_cover = true + else if type == 'file' + $scope.album.cover = image + else if type == 'gallery' + $scope.album.cover_id = image.id - $scope.isDirty = true + $scope.isDirty = true - if !$scope.isNew - albums.getEdit($state.params.album_id).done (album) -> - $scope.album = - id: album.id - title: album.title - description: album.description - remove_cover: false - cover: album.cover_url + if !$scope.isNew + albums.getEdit($state.params.album_id).done (album) -> + $scope.album = + id: album.id + title: album.title + description: album.description + remove_cover: false + cover: album.cover_url - $scope.tracks = [] - $scope.tracks.push track for track in album.tracks - $scope.trackIds[track.id] = track for track in album.tracks + $scope.tracks = [] + $scope.tracks.push track for track in album.tracks + $scope.trackIds[track.id] = track for track in album.tracks - else - $scope.album = - title: '' - description: '' + else + $scope.album = + title: '' + description: '' - $scope.$on '$locationChangeStart', (e) -> - return if !$scope.isDirty - e.preventDefault() if !confirm('Are you sure you want to leave this page without saving your changes?') + $scope.$on '$locationChangeStart', (e) -> + return if !$scope.isDirty + e.preventDefault() if !confirm('Are you sure you want to leave this page without saving your changes?') ] diff --git a/resources/assets/scripts/app/controllers/account-albums.coffee b/resources/assets/scripts/app/controllers/account-albums.coffee index b75344ec..1f2e666f 100644 --- a/resources/assets/scripts/app/controllers/account-albums.coffee +++ b/resources/assets/scripts/app/controllers/account-albums.coffee @@ -1,47 +1,47 @@ window.pfm.preloaders['account-albums'] = [ - 'account-tracks', 'account-albums' - (tracks, albums) -> - $.when.all [tracks.refresh('published=true&in_album=false', true), albums.refresh(true)] + 'account-tracks', 'account-albums' + (tracks, albums) -> + $.when.all [tracks.refresh('published=true&in_album=false', true), albums.refresh(true)] ] angular.module('ponyfm').controller "account-albums", [ - '$scope', '$state', 'account-albums', 'account-tracks' - ($scope, $state, albums, tracks) -> + '$scope', '$state', 'account-albums', 'account-tracks' + ($scope, $state, albums, tracks) -> - $scope.albums = [] - $scope.data = - isEditorOpen: false - selectedAlbum: null - tracksDb: [] + $scope.albums = [] + $scope.data = + isEditorOpen: false + selectedAlbum: null + tracksDb: [] - selectAlbum = (album) -> $scope.data.selectedAlbum = album + selectAlbum = (album) -> $scope.data.selectedAlbum = album - updateTracks = (tracks) -> - $scope.data.tracksDb.push track for track in tracks + updateTracks = (tracks) -> + $scope.data.tracksDb.push track for track in tracks - tracks.refresh('published=true&in_album=false').done updateTracks + tracks.refresh('published=true&in_album=false').done updateTracks - albumsDb = {} + albumsDb = {} - updateAlbums = (albums) -> - $scope.albums.length = 0 + updateAlbums = (albums) -> + $scope.albums.length = 0 - for album in albums - $scope.albums.push album - albumsDb[album.id] = album + for album in albums + $scope.albums.push album + albumsDb[album.id] = album - if $state.params.album_id - selectAlbum albumsDb[$state.params.album_id] + if $state.params.album_id + selectAlbum albumsDb[$state.params.album_id] - albums.refresh().done updateAlbums + albums.refresh().done updateAlbums - $scope.$on '$stateChangeSuccess', () -> - if $state.params.album_id - selectAlbum albumsDb[$state.params.album_id] - else - selectAlbum null + $scope.$on '$stateChangeSuccess', () -> + if $state.params.album_id + selectAlbum albumsDb[$state.params.album_id] + else + selectAlbum null - $scope.$on 'album-created', () -> albums.refresh(true).done(updateAlbums) - $scope.$on 'album-deleted', () -> albums.refresh(true).done(updateAlbums) - $scope.$on 'album-updated', () -> tracks.refresh('published=true&in_album=false', true).done updateTracks -] \ No newline at end of file + $scope.$on 'album-created', () -> albums.refresh(true).done(updateAlbums) + $scope.$on 'album-deleted', () -> albums.refresh(true).done(updateAlbums) + $scope.$on 'album-updated', () -> tracks.refresh('published=true&in_album=false', true).done updateTracks +] diff --git a/resources/assets/scripts/app/controllers/account-image-select.coffee b/resources/assets/scripts/app/controllers/account-image-select.coffee index 6ec95c22..84343137 100644 --- a/resources/assets/scripts/app/controllers/account-image-select.coffee +++ b/resources/assets/scripts/app/controllers/account-image-select.coffee @@ -1,10 +1,10 @@ angular.module('ponyfm').controller "account-image-select", [ - '$scope' - ($scope) -> - $scope.images = [] - $scope.isLoading = true + '$scope' + ($scope) -> + $scope.images = [] + $scope.isLoading = true - $.getJSON('/api/web/images/owned').done (images) -> $scope.$apply -> - $scope.images = images - $scope.isLoading = false -] \ No newline at end of file + $.getJSON('/api/web/images/owned').done (images) -> $scope.$apply -> + $scope.images = images + $scope.isLoading = false +] diff --git a/resources/assets/scripts/app/controllers/account-playlists.coffee b/resources/assets/scripts/app/controllers/account-playlists.coffee index ae7865d7..1f6153e6 100644 --- a/resources/assets/scripts/app/controllers/account-playlists.coffee +++ b/resources/assets/scripts/app/controllers/account-playlists.coffee @@ -1,44 +1,44 @@ window.pfm.preloaders['account-playlists'] = [ - 'playlists' - (playlists) -> playlists.refreshOwned true + 'playlists' + (playlists) -> playlists.refreshOwned true ] angular.module('ponyfm').controller "account-playlists", [ - '$scope', 'auth', '$dialog', 'playlists' - ($scope, auth, $dialog, playlists) -> - $scope.playlists = [] + '$scope', 'auth', '$dialog', 'playlists' + ($scope, auth, $dialog, playlists) -> + $scope.playlists = [] - loadPlaylists = (playlists) -> - $scope.playlists.push playlist for playlist in playlists + loadPlaylists = (playlists) -> + $scope.playlists.push playlist for playlist in playlists - playlists.refreshOwned().done loadPlaylists + playlists.refreshOwned().done loadPlaylists - $scope.editPlaylist = (playlist) -> - dialog = $dialog.dialog - templateUrl: '/templates/partials/playlist-dialog.html' - controller: 'playlist-form' - resolve: { - playlist: () -> angular.copy playlist - } + $scope.editPlaylist = (playlist) -> + dialog = $dialog.dialog + templateUrl: '/templates/partials/playlist-dialog.html' + controller: 'playlist-form' + resolve: { + playlist: () -> angular.copy playlist + } - dialog.open() + dialog.open() - $scope.togglePlaylistPin = (playlist) -> - playlist.is_pinned = !playlist.is_pinned; - playlists.editPlaylist playlist + $scope.togglePlaylistPin = (playlist) -> + playlist.is_pinned = !playlist.is_pinned; + playlists.editPlaylist playlist - $scope.deletePlaylist = (playlist) -> - $dialog.messageBox('Delete ' + playlist.title, 'Are you sure you want to delete "' + playlist.title + '"? This cannot be undone.', [ - {result: 'ok', label: 'Yes', cssClass: 'btn-danger'}, - {result: 'cancel', label: 'No', cssClass: 'btn-primary'} - ]).open().then (res) -> - return if res == 'cancel' - playlists.deletePlaylist(playlist).done -> - $scope.playlists.splice _.indexOf($scope.playlists, (p) -> p.id == playlist.id), 1 + $scope.deletePlaylist = (playlist) -> + $dialog.messageBox('Delete ' + playlist.title, 'Are you sure you want to delete "' + playlist.title + '"? This cannot be undone.', [ + {result: 'ok', label: 'Yes', cssClass: 'btn-danger'}, + {result: 'cancel', label: 'No', cssClass: 'btn-primary'} + ]).open().then (res) -> + return if res == 'cancel' + playlists.deletePlaylist(playlist).done -> + $scope.playlists.splice _.indexOf($scope.playlists, (p) -> p.id == playlist.id), 1 - $scope.$on 'playlist-updated', (e, playlist) -> - index = _.indexOf($scope.playlists, (p) -> p.id == playlist.id) - content = $scope.playlists[index] - _.each playlist, (value, name) -> content[name] = value - $scope.playlists.sort (left, right) -> left.title.localeCompare right.title -] \ No newline at end of file + $scope.$on 'playlist-updated', (e, playlist) -> + index = _.indexOf($scope.playlists, (p) -> p.id == playlist.id) + content = $scope.playlists[index] + _.each playlist, (value, name) -> content[name] = value + $scope.playlists.sort (left, right) -> left.title.localeCompare right.title +] diff --git a/resources/assets/scripts/app/controllers/account-settings.coffee b/resources/assets/scripts/app/controllers/account-settings.coffee index 82a53ffb..0e1ef492 100644 --- a/resources/assets/scripts/app/controllers/account-settings.coffee +++ b/resources/assets/scripts/app/controllers/account-settings.coffee @@ -1,63 +1,63 @@ angular.module('ponyfm').controller "account-settings", [ - '$scope', 'auth' - ($scope, auth) -> - $scope.settings = {} - $scope.errors = {} - $scope.isDirty = false + '$scope', 'auth' + ($scope, auth) -> + $scope.settings = {} + $scope.errors = {} + $scope.isDirty = false - $scope.touchModel = () -> - $scope.isDirty = true + $scope.touchModel = () -> + $scope.isDirty = true - $scope.refresh = () -> - $.getJSON('/api/web/account/settings') - .done (res) -> $scope.$apply -> - $scope.settings = res + $scope.refresh = () -> + $.getJSON('/api/web/account/settings') + .done (res) -> $scope.$apply -> + $scope.settings = res - $scope.setAvatar = (image, type) -> - delete $scope.settings.avatar_id - delete $scope.settings.avatar + $scope.setAvatar = (image, type) -> + delete $scope.settings.avatar_id + delete $scope.settings.avatar - if type == 'file' - $scope.settings.avatar = image - else if type == 'gallery' - $scope.settings.avatar_id = image.id + if type == 'file' + $scope.settings.avatar = image + else if type == 'gallery' + $scope.settings.avatar_id = image.id - $scope.isDirty = true + $scope.isDirty = true - $scope.updateAccount = () -> - return if !$scope.isDirty + $scope.updateAccount = () -> + return if !$scope.isDirty - xhr = new XMLHttpRequest() - xhr.onload = -> $scope.$apply -> - $scope.isSaving = false - response = $.parseJSON(xhr.responseText) - if xhr.status != 200 - $scope.errors = {} - _.each response.errors, (value, key) -> $scope.errors[key] = value.join ', ' - return + xhr = new XMLHttpRequest() + xhr.onload = -> $scope.$apply -> + $scope.isSaving = false + response = $.parseJSON(xhr.responseText) + if xhr.status != 200 + $scope.errors = {} + _.each response.errors, (value, key) -> $scope.errors[key] = value.join ', ' + return - $scope.isDirty = false - $scope.errors = {} - $scope.refresh() + $scope.isDirty = false + $scope.errors = {} + $scope.refresh() - formData = new FormData() + formData = new FormData() - _.each $scope.settings, (value, name) -> - if name == 'avatar' - return if value == null - if typeof(value) == 'object' - formData.append name, value, value.name - else - formData.append name, value + _.each $scope.settings, (value, name) -> + if name == 'avatar' + return if value == null + if typeof(value) == 'object' + formData.append name, value, value.name + else + formData.append name, value - xhr.open 'POST', '/api/web/account/settings/save', true - xhr.setRequestHeader 'X-CSRF-Token', pfm.token - $scope.isSaving = true - xhr.send formData + xhr.open 'POST', '/api/web/account/settings/save', true + xhr.setRequestHeader 'X-CSRF-Token', pfm.token + $scope.isSaving = true + xhr.send formData - $scope.refresh() + $scope.refresh() - $scope.$on '$stateChangeStart', (e) -> - return if $scope.selectedTrack == null || !$scope.isDirty - e.preventDefault() if !confirm('Are you sure you want to leave this page without saving your changes?') + $scope.$on '$stateChangeStart', (e) -> + return if $scope.selectedTrack == null || !$scope.isDirty + e.preventDefault() if !confirm('Are you sure you want to leave this page without saving your changes?') ] diff --git a/resources/assets/scripts/app/controllers/account-track.coffee b/resources/assets/scripts/app/controllers/account-track.coffee index 1e3c3f7c..5ec46aef 100644 --- a/resources/assets/scripts/app/controllers/account-track.coffee +++ b/resources/assets/scripts/app/controllers/account-track.coffee @@ -1,146 +1,146 @@ window.pfm.preloaders['account-track'] = [ - 'account-tracks', 'account-albums', 'taxonomies', '$state' - (tracks, albums, taxonomies, state) -> - $.when.all [albums.refresh(), taxonomies.refresh(), tracks.getEdit(state.params.track_id, true)] + 'account-tracks', 'account-albums', 'taxonomies', '$state' + (tracks, albums, taxonomies, state) -> + $.when.all [albums.refresh(), taxonomies.refresh(), tracks.getEdit(state.params.track_id, true)] ] angular.module('ponyfm').controller "account-track", [ - '$scope', '$state', 'taxonomies', '$dialog', 'account-albums', 'account-tracks', 'images' - ($scope, $state, taxonomies, $dialog, albums, tracks, images) -> - $scope.isDirty = false - $scope.isSaving = false - $scope.taxonomies = taxonomies - $scope.selectedSongsTitle = 'None' - $scope.selectedSongs = {} - $scope.albums = [] - $scope.selectedAlbum = null + '$scope', '$state', 'taxonomies', '$dialog', 'account-albums', 'account-tracks', 'images' + ($scope, $state, taxonomies, $dialog, albums, tracks, images) -> + $scope.isDirty = false + $scope.isSaving = false + $scope.taxonomies = taxonomies + $scope.selectedSongsTitle = 'None' + $scope.selectedSongs = {} + $scope.albums = [] + $scope.selectedAlbum = null - albumsDb = {} - albums.refresh().done (albums) -> - $scope.albums.legnth = 0 - albumsDb = {} - for album in albums - albumsDb[album.id] = album - $scope.albums.push album + albumsDb = {} + albums.refresh().done (albums) -> + $scope.albums.legnth = 0 + albumsDb = {} + for album in albums + albumsDb[album.id] = album + $scope.albums.push album - $scope.selectAlbum = (album) -> - $scope.selectedAlbum = album - $scope.edit.album_id = if album then album.id else null - $scope.isDirty = true + $scope.selectAlbum = (album) -> + $scope.selectedAlbum = album + $scope.edit.album_id = if album then album.id else null + $scope.isDirty = true - $scope.setCover = (image, type) -> - delete $scope.edit.cover_id - delete $scope.edit.cover + $scope.setCover = (image, type) -> + delete $scope.edit.cover_id + delete $scope.edit.cover - if image == null - $scope.edit.remove_cover = true - else if type == 'file' - $scope.edit.cover = image - else if type == 'gallery' - $scope.edit.cover_id = image.id + if image == null + $scope.edit.remove_cover = true + else if type == 'file' + $scope.edit.cover = image + else if type == 'gallery' + $scope.edit.cover_id = image.id - $scope.isDirty = true + $scope.isDirty = true - updateSongDisplay = () -> - if _.size $scope.selectedSongs - $scope.selectedSongsTitle = (_.map _.values($scope.selectedSongs), (s) -> s.title).join(', ') - else - $scope.selectedSongsTitle = 'None' + updateSongDisplay = () -> + if _.size $scope.selectedSongs + $scope.selectedSongsTitle = (_.map _.values($scope.selectedSongs), (s) -> s.title).join(', ') + else + $scope.selectedSongsTitle = 'None' - $scope.toggleSong = (song) -> - $scope.isDirty = true - if $scope.selectedSongs[song.id] - delete $scope.selectedSongs[song.id] - else - $scope.selectedSongs[song.id] = song + $scope.toggleSong = (song) -> + $scope.isDirty = true + if $scope.selectedSongs[song.id] + delete $scope.selectedSongs[song.id] + else + $scope.selectedSongs[song.id] = song - updateSongDisplay() + updateSongDisplay() - $scope.updateIsVocal = () -> - delete $scope.errors.lyrics if !$scope.edit.is_vocal + $scope.updateIsVocal = () -> + delete $scope.errors.lyrics if !$scope.edit.is_vocal - $scope.updateTrack = () -> - xhr = new XMLHttpRequest() - xhr.onload = -> $scope.$apply -> - $scope.isSaving = false - if xhr.status != 200 - errors = - if xhr.getResponseHeader('content-type') == 'application/json' - $.parseJSON(xhr.responseText).errors - else - ['There was an unknown error!'] + $scope.updateTrack = () -> + xhr = new XMLHttpRequest() + xhr.onload = -> $scope.$apply -> + $scope.isSaving = false + if xhr.status != 200 + errors = + if xhr.getResponseHeader('content-type') == 'application/json' + $.parseJSON(xhr.responseText).errors + else + ['There was an unknown error!'] - $scope.errors = {} - _.each errors, (value, key) -> $scope.errors[key] = value.join ', ' - return + $scope.errors = {} + _.each errors, (value, key) -> $scope.errors[key] = value.join ', ' + return - track = $.parseJSON(xhr.responseText) + track = $.parseJSON(xhr.responseText) - trackDbItem = $scope.data.selectedTrack - trackDbItem.title = $scope.edit.title - trackDbItem.is_explicit = $scope.edit.is_explicit - trackDbItem.is_vocal = $scope.edit.is_vocal - trackDbItem.genre_id = $scope.edit.genre_id - trackDbItem.is_published = true - trackDbItem.cover_url = track.real_cover_url - $scope.isDirty = false - $scope.errors = {} - images.refresh true + trackDbItem = $scope.data.selectedTrack + trackDbItem.title = $scope.edit.title + trackDbItem.is_explicit = $scope.edit.is_explicit + trackDbItem.is_vocal = $scope.edit.is_vocal + trackDbItem.genre_id = $scope.edit.genre_id + trackDbItem.is_published = true + trackDbItem.cover_url = track.real_cover_url + $scope.isDirty = false + $scope.errors = {} + images.refresh true - formData = new FormData(); - _.each $scope.edit, (value, name) -> - if name == 'cover' - return if value == null - if typeof(value) == 'object' - formData.append name, value, value.name - else if value != null - formData.append name, value + formData = new FormData(); + _.each $scope.edit, (value, name) -> + if name == 'cover' + return if value == null + if typeof(value) == 'object' + formData.append name, value, value.name + else if value != null + formData.append name, value - if parseInt($scope.edit.track_type_id) == 2 - formData.append 'show_song_ids', _.map(_.values($scope.selectedSongs), (s) -> s.id).join() + if parseInt($scope.edit.track_type_id) == 2 + formData.append 'show_song_ids', _.map(_.values($scope.selectedSongs), (s) -> s.id).join() - xhr.open 'POST', '/api/web/tracks/edit/' + $scope.edit.id, true - xhr.setRequestHeader 'X-CSRF-Token', pfm.token - $scope.isSaving = true - xhr.send formData + xhr.open 'POST', '/api/web/tracks/edit/' + $scope.edit.id, true + xhr.setRequestHeader 'X-CSRF-Token', pfm.token + $scope.isSaving = true + xhr.send formData - tracks.getEdit($state.params.track_id).done (track) -> - $scope.edit = - id: track.id - title: track.title - description: track.description - lyrics: track.lyrics - is_explicit: track.is_explicit - is_downloadable: track.is_downloadable - is_vocal: track.is_vocal - license_id: track.license_id - genre_id: track.genre_id - track_type_id: track.track_type_id - released_at: if track.released_at then track.released_at.date else '' - remove_cover: false - cover: track.cover_url - album_id: track.album_id - is_published: track.is_published - is_listed: track.is_listed + tracks.getEdit($state.params.track_id).done (track) -> + $scope.edit = + id: track.id + title: track.title + description: track.description + lyrics: track.lyrics + is_explicit: track.is_explicit + is_downloadable: track.is_downloadable + is_vocal: track.is_vocal + license_id: track.license_id + genre_id: track.genre_id + track_type_id: track.track_type_id + released_at: if track.released_at then track.released_at.date else '' + remove_cover: false + cover: track.cover_url + album_id: track.album_id + is_published: track.is_published + is_listed: track.is_listed - $scope.selectedAlbum = if track.album_id then albumsDb[track.album_id] else null - $scope.selectedSongs = {} - $scope.selectedSongs[song.id] = song for song in track.show_songs - updateSongDisplay() + $scope.selectedAlbum = if track.album_id then albumsDb[track.album_id] else null + $scope.selectedSongs = {} + $scope.selectedSongs[song.id] = song for song in track.show_songs + updateSongDisplay() - $scope.touchModel = -> $scope.isDirty = true + $scope.touchModel = -> $scope.isDirty = true - $scope.deleteTrack = (track) -> - $dialog.messageBox('Delete ' + track.title, 'Are you sure you want to delete "' + track.title + '"? This cannot be undone.', [ - {result: 'ok', label: 'Yes', cssClass: 'btn-danger'}, {result: 'cancel', label: 'No', cssClass: 'btn-primary'} - ]).open().then (res) -> - return if res == 'cancel' - $.post('/api/web/tracks/delete/' + track.id, {_token: window.pfm.token}) - .then -> $scope.$apply -> - $scope.$emit 'track-deleted' - $state.transitionTo 'account.tracks' + $scope.deleteTrack = (track) -> + $dialog.messageBox('Delete ' + track.title, 'Are you sure you want to delete "' + track.title + '"? This cannot be undone.', [ + {result: 'ok', label: 'Yes', cssClass: 'btn-danger'}, {result: 'cancel', label: 'No', cssClass: 'btn-primary'} + ]).open().then (res) -> + return if res == 'cancel' + $.post('/api/web/tracks/delete/' + track.id, {_token: window.pfm.token}) + .then -> $scope.$apply -> + $scope.$emit 'track-deleted' + $state.transitionTo 'account.tracks' - $scope.$on '$locationChangeStart', (e) -> - return if !$scope.isDirty - e.preventDefault() if !confirm('Are you sure you want to leave this page without saving your changes?') + $scope.$on '$locationChangeStart', (e) -> + return if !$scope.isDirty + e.preventDefault() if !confirm('Are you sure you want to leave this page without saving your changes?') ] diff --git a/resources/assets/scripts/app/controllers/account-tracks.coffee b/resources/assets/scripts/app/controllers/account-tracks.coffee index 6c1db3c0..d6e88591 100644 --- a/resources/assets/scripts/app/controllers/account-tracks.coffee +++ b/resources/assets/scripts/app/controllers/account-tracks.coffee @@ -1,44 +1,44 @@ window.pfm.preloaders['account-tracks'] = [ - 'account-tracks', 'account-albums', 'taxonomies' - (tracks, albums, taxonomies) -> - $.when.all [tracks.refresh(null, true), albums.refresh(true), taxonomies.refresh()] + 'account-tracks', 'account-albums', 'taxonomies' + (tracks, albums, taxonomies) -> + $.when.all [tracks.refresh(null, true), albums.refresh(true), taxonomies.refresh()] ] angular.module('ponyfm').controller "account-tracks", [ - '$scope', '$state', 'taxonomies', '$dialog', 'lightbox', 'account-albums', 'account-tracks' - ($scope, $state, taxonomies, $dialog, lightbox, albums, tracks) -> - $scope.data = - selectedTrack: null + '$scope', '$state', 'taxonomies', '$dialog', 'lightbox', 'account-albums', 'account-tracks' + ($scope, $state, taxonomies, $dialog, lightbox, albums, tracks) -> + $scope.data = + selectedTrack: null - $scope.tracks = [] + $scope.tracks = [] - tracksDb = {} + tracksDb = {} - setTracks = (tracks) -> - $scope.tracks.length = 0 - tracksDb = {} - for track in tracks - tracksDb[track.id] = track - $scope.tracks.push track + setTracks = (tracks) -> + $scope.tracks.length = 0 + tracksDb = {} + for track in tracks + tracksDb[track.id] = track + $scope.tracks.push track - if $state.params.track_id - $scope.data.selectedTrack = tracksDb[$state.params.track_id] + if $state.params.track_id + $scope.data.selectedTrack = tracksDb[$state.params.track_id] - tracks.refresh().done setTracks + tracks.refresh().done setTracks - $scope.refreshList = () -> - tracks.refresh().done setTracks + $scope.refreshList = () -> + tracks.refresh().done setTracks - $scope.selectTrack = (track) -> - $scope.data.selectedTrack = track + $scope.selectTrack = (track) -> + $scope.data.selectedTrack = track - $scope.$on '$stateChangeSuccess', () -> - if $state.params.track_id - $scope.selectTrack tracksDb[$state.params.track_id] - else - $scope.selectTrack null + $scope.$on '$stateChangeSuccess', () -> + if $state.params.track_id + $scope.selectTrack tracksDb[$state.params.track_id] + else + $scope.selectTrack null - $scope.$on 'track-deleted', () -> - tracks.clearCache() - $scope.refreshList() -] \ No newline at end of file + $scope.$on 'track-deleted', () -> + tracks.clearCache() + $scope.refreshList() +] diff --git a/resources/assets/scripts/app/controllers/album.coffee b/resources/assets/scripts/app/controllers/album.coffee index 032cffcd..7f023f5e 100644 --- a/resources/assets/scripts/app/controllers/album.coffee +++ b/resources/assets/scripts/app/controllers/album.coffee @@ -1,27 +1,27 @@ window.pfm.preloaders['album'] = [ - 'albums', '$state', 'playlists' - (albums, $state, playlists) -> - $.when.all [albums.fetch $state.params.id, playlists.refreshOwned(true)] + 'albums', '$state', 'playlists' + (albums, $state, playlists) -> + $.when.all [albums.fetch $state.params.id, playlists.refreshOwned(true)] ] angular.module('ponyfm').controller "album", [ - '$scope', 'albums', '$state', 'playlists', 'auth', '$dialog' - ($scope, albums, $state, playlists, auth, $dialog) -> - album = null + '$scope', 'albums', '$state', 'playlists', 'auth', '$dialog' + ($scope, albums, $state, playlists, auth, $dialog) -> + album = null - albums.fetch($state.params.id).done (albumResponse) -> - $scope.album = albumResponse.album - album = albumResponse.album + albums.fetch($state.params.id).done (albumResponse) -> + $scope.album = albumResponse.album + album = albumResponse.album - $scope.playlists = [] + $scope.playlists = [] - $scope.share = () -> - dialog = $dialog.dialog - templateUrl: '/templates/partials/album-share-dialog.html', - controller: ['$scope', ($scope) -> $scope.album = album; $scope.close = () -> dialog.close()] - dialog.open() + $scope.share = () -> + dialog = $dialog.dialog + templateUrl: '/templates/partials/album-share-dialog.html', + controller: ['$scope', ($scope) -> $scope.album = album; $scope.close = () -> dialog.close()] + dialog.open() - if auth.data.isLogged - playlists.refreshOwned().done (lists) -> - $scope.playlists.push list for list in lists -] \ No newline at end of file + if auth.data.isLogged + playlists.refreshOwned().done (lists) -> + $scope.playlists.push list for list in lists +] diff --git a/resources/assets/scripts/app/controllers/albums-list.coffee b/resources/assets/scripts/app/controllers/albums-list.coffee index f67357b5..51f9793d 100644 --- a/resources/assets/scripts/app/controllers/albums-list.coffee +++ b/resources/assets/scripts/app/controllers/albums-list.coffee @@ -1,12 +1,12 @@ window.pfm.preloaders['albums-list'] = [ - 'albums', '$state' - (albums, $state) -> - albums.fetchList($state.params.page, true) + 'albums', '$state' + (albums, $state) -> + albums.fetchList($state.params.page, true) ] angular.module('ponyfm').controller "albums-list", [ - '$scope', 'albums', '$state' - ($scope, albums, $state) -> - albums.fetchList($state.params.page).done (list) -> - $scope.albums = list.albums -] \ No newline at end of file + '$scope', 'albums', '$state' + ($scope, albums, $state) -> + albums.fetchList($state.params.page).done (list) -> + $scope.albums = list.albums +] diff --git a/resources/assets/scripts/app/controllers/albums.coffee b/resources/assets/scripts/app/controllers/albums.coffee index 9c4c5507..b42b151e 100644 --- a/resources/assets/scripts/app/controllers/albums.coffee +++ b/resources/assets/scripts/app/controllers/albums.coffee @@ -1,22 +1,22 @@ angular.module('ponyfm').controller "albums", [ - '$scope', 'albums', '$state' - ($scope, albums, $state) -> + '$scope', 'albums', '$state' + ($scope, albums, $state) -> - refreshPages = (list) -> - $scope.albums = list.albums - $scope.currentPage = parseInt(list.current_page) - $scope.totalPages = parseInt(list.total_pages) + refreshPages = (list) -> + $scope.albums = list.albums + $scope.currentPage = parseInt(list.current_page) + $scope.totalPages = parseInt(list.total_pages) - delete $scope.nextPage - delete $scope.prevPage - $scope.nextPage = $scope.currentPage + 1 if $scope.currentPage < $scope.totalPages - $scope.prevPage = $scope.currentPage - 1 if $scope.currentPage > 1 - $scope.pages = [1..$scope.totalPages] + delete $scope.nextPage + delete $scope.prevPage + $scope.nextPage = $scope.currentPage + 1 if $scope.currentPage < $scope.totalPages + $scope.prevPage = $scope.currentPage - 1 if $scope.currentPage > 1 + $scope.pages = [1..$scope.totalPages] - albums.fetchList($state.params.page).done refreshPages - $scope.$on 'albums-feteched', (e, list) -> refreshPages(list) + albums.fetchList($state.params.page).done refreshPages + $scope.$on 'albums-feteched', (e, list) -> refreshPages(list) - $scope.gotoPage = (page) -> - return if !page - $state.transitionTo 'content.albums.list', {page: page} -] \ No newline at end of file + $scope.gotoPage = (page) -> + return if !page + $state.transitionTo 'content.albums.list', {page: page} +] diff --git a/resources/assets/scripts/app/controllers/application.coffee b/resources/assets/scripts/app/controllers/application.coffee index 501414d2..3d6fe041 100644 --- a/resources/assets/scripts/app/controllers/application.coffee +++ b/resources/assets/scripts/app/controllers/application.coffee @@ -1,85 +1,85 @@ angular.module('ponyfm').controller "application", [ - '$scope', 'auth', '$location', 'upload', '$state', '$stateParams', '$injector', '$rootScope', 'playlists' - ($scope, auth, $location, upload, $state, $stateParams, $injector, $rootScope, playlists) -> - $scope.auth = auth.data - $scope.$state = $state - $scope.$stateParams = $stateParams - $scope.isPinnedPlaylistSelected = false - $loadingElement = null - loadingStateName = null + '$scope', 'auth', '$location', 'upload', '$state', '$stateParams', '$injector', '$rootScope', 'playlists' + ($scope, auth, $location, upload, $state, $stateParams, $injector, $rootScope, playlists) -> + $scope.auth = auth.data + $scope.$state = $state + $scope.$stateParams = $stateParams + $scope.isPinnedPlaylistSelected = false + $loadingElement = null + loadingStateName = null - if window.pfm.error - $state.transitionTo 'errors-' + window.pfm.error + if window.pfm.error + $state.transitionTo 'errors-' + window.pfm.error - $rootScope.safeApply = (fn) -> - phase = $rootScope.$$phase - if (phase == '$apply' || phase == 'digest') - fn() - return + $rootScope.safeApply = (fn) -> + phase = $rootScope.$$phase + if (phase == '$apply' || phase == 'digest') + fn() + return - $rootScope.$apply fn + $rootScope.$apply fn - $scope.logout = () -> - auth.logout().done -> location.reload() + $scope.logout = () -> + auth.logout().done -> location.reload() - $scope.isActive = (loc) -> $location.path() == loc - $scope.$on '$viewContentLoaded', () -> - window.setTimeout (-> window.handleResize()), 0 + $scope.isActive = (loc) -> $location.path() == loc + $scope.$on '$viewContentLoaded', () -> + window.setTimeout (-> window.handleResize()), 0 - if $loadingElement - $loadingElement.removeClass 'loading' - $loadingElement = null + if $loadingElement + $loadingElement.removeClass 'loading' + $loadingElement = null - $scope.stateIncludes = (state) -> - if $loadingElement - newParts = state.split '.' - oldParts = loadingStateName.split '.' - for i in [0..newParts.length] - continue if !newParts[i] - return false if newParts[i] != oldParts[i] + $scope.stateIncludes = (state) -> + if $loadingElement + newParts = state.split '.' + oldParts = loadingStateName.split '.' + for i in [0..newParts.length] + continue if !newParts[i] + return false if newParts[i] != oldParts[i] - return true - else - $state.includes(state) + return true + else + $state.includes(state) - statesPreloaded = {} - $scope.$on '$stateChangeStart', (e, newState, newParams, oldState, oldParams) -> - $scope.isPinnedPlaylistSelected = false + statesPreloaded = {} + $scope.$on '$stateChangeStart', (e, newState, newParams, oldState, oldParams) -> + $scope.isPinnedPlaylistSelected = false - if newState.name == 'content.playlist' - $scope.isPinnedPlaylistSelected = playlists.isPlaylistPinned newParams.id + if newState.name == 'content.playlist' + $scope.isPinnedPlaylistSelected = playlists.isPlaylistPinned newParams.id - return if !oldState || !newState.controller + return if !oldState || !newState.controller - preloader = window.pfm.preloaders[newState.controller] - return if !preloader + preloader = window.pfm.preloaders[newState.controller] + return if !preloader - if statesPreloaded[newState] - delete statesPreloaded[newState] - return + if statesPreloaded[newState] + delete statesPreloaded[newState] + return - e.preventDefault() - loadingStateName = newState.name + e.preventDefault() + loadingStateName = newState.name - selector = '' - newParts = newState.name.split '.' - oldParts = oldState.name.split '.' - zipped = _.zip(newParts, oldParts) - for i in [0..zipped.length] - break if !zipped[i] || zipped[i][0] != zipped[i][1] - selector += ' ui-view ' + selector = '' + newParts = newState.name.split '.' + oldParts = oldState.name.split '.' + zipped = _.zip(newParts, oldParts) + for i in [0..zipped.length] + break if !zipped[i] || zipped[i][0] != zipped[i][1] + selector += ' ui-view ' - selector += ' ui-view ' if newState.name != oldState.name + selector += ' ui-view ' if newState.name != oldState.name - $loadingElement = $ selector - $loadingElement.addClass 'loading' + $loadingElement = $ selector + $loadingElement.addClass 'loading' - stateToInject = angular.copy newState - stateToInject.params = newParams - try - $injector.invoke(preloader, null, {$state: stateToInject}).then -> - statesPreloaded[newState] = true - $state.transitionTo newState, newParams - catch error - $state.transitionTo newState, newParams -] \ No newline at end of file + stateToInject = angular.copy newState + stateToInject.params = newParams + try + $injector.invoke(preloader, null, {$state: stateToInject}).then -> + statesPreloaded[newState] = true + $state.transitionTo newState, newParams + catch error + $state.transitionTo newState, newParams +] diff --git a/resources/assets/scripts/app/controllers/artist-content.coffee b/resources/assets/scripts/app/controllers/artist-content.coffee index 9cd93197..f07d8540 100644 --- a/resources/assets/scripts/app/controllers/artist-content.coffee +++ b/resources/assets/scripts/app/controllers/artist-content.coffee @@ -1,13 +1,13 @@ window.pfm.preloaders['artist-content'] = [ - 'artists', '$state' - (artists, $state) -> - $.when.all [artists.fetch($state.params.slug), artists.fetchContent($state.params.slug, true)] + 'artists', '$state' + (artists, $state) -> + $.when.all [artists.fetch($state.params.slug), artists.fetchContent($state.params.slug, true)] ] angular.module('ponyfm').controller "artist-content", [ - '$scope', 'artists', '$state' - ($scope, artists, $state) -> - artists.fetchContent($state.params.slug) - .done (artistResponse) -> - $scope.content = artistResponse -] \ No newline at end of file + '$scope', 'artists', '$state' + ($scope, artists, $state) -> + artists.fetchContent($state.params.slug) + .done (artistResponse) -> + $scope.content = artistResponse +] diff --git a/resources/assets/scripts/app/controllers/artist-favourites.coffee b/resources/assets/scripts/app/controllers/artist-favourites.coffee index c8a28768..562994a1 100644 --- a/resources/assets/scripts/app/controllers/artist-favourites.coffee +++ b/resources/assets/scripts/app/controllers/artist-favourites.coffee @@ -1,12 +1,12 @@ window.pfm.preloaders['artist-favourites'] = [ - 'artists', '$state' - (artists, $state) -> - $.when.all [artists.fetch($state.params.slug), artists.fetchFavourites($state.params.slug, true)] + 'artists', '$state' + (artists, $state) -> + $.when.all [artists.fetch($state.params.slug), artists.fetchFavourites($state.params.slug, true)] ] angular.module('ponyfm').controller "artist-favourites", [ - '$scope', 'artists', '$state' - ($scope, artists, $state) -> - artists.fetchFavourites($state.params.slug).done (artistResponse) -> - $scope.favourites = artistResponse -] \ No newline at end of file + '$scope', 'artists', '$state' + ($scope, artists, $state) -> + artists.fetchFavourites($state.params.slug).done (artistResponse) -> + $scope.favourites = artistResponse +] diff --git a/resources/assets/scripts/app/controllers/artist-profile.coffee b/resources/assets/scripts/app/controllers/artist-profile.coffee index 1b72a20a..04c97db8 100644 --- a/resources/assets/scripts/app/controllers/artist-profile.coffee +++ b/resources/assets/scripts/app/controllers/artist-profile.coffee @@ -1,10 +1,10 @@ window.pfm.preloaders['artist-profile'] = [ - 'artists', '$state' - (artists, $state) -> - artists.fetch $state.params.slug, true + 'artists', '$state' + (artists, $state) -> + artists.fetch $state.params.slug, true ] angular.module('ponyfm').controller "artist-profile", [ - '$scope', 'artists', '$state' - ($scope, artists, $state) -> -] \ No newline at end of file + '$scope', 'artists', '$state' + ($scope, artists, $state) -> +] diff --git a/resources/assets/scripts/app/controllers/artist.coffee b/resources/assets/scripts/app/controllers/artist.coffee index 0b51c66e..8e001549 100644 --- a/resources/assets/scripts/app/controllers/artist.coffee +++ b/resources/assets/scripts/app/controllers/artist.coffee @@ -1,17 +1,17 @@ window.pfm.preloaders['artist'] = [ - 'artists', '$state' - (artists, $state) -> - artists.fetch $state.params.slug, true + 'artists', '$state' + (artists, $state) -> + artists.fetch $state.params.slug, true ] angular.module('ponyfm').controller "artist", [ - '$scope', 'artists', '$state', 'follow' - ($scope, artists, $state, follow) -> - artists.fetch($state.params.slug) - .done (artistResponse) -> - $scope.artist = artistResponse.artist + '$scope', 'artists', '$state', 'follow' + ($scope, artists, $state, follow) -> + artists.fetch($state.params.slug) + .done (artistResponse) -> + $scope.artist = artistResponse.artist - $scope.toggleFollow = () -> - follow.toggle('artist', $scope.artist.id).then (res) -> - $scope.artist.user_data.is_following = res.is_followed -] \ No newline at end of file + $scope.toggleFollow = () -> + follow.toggle('artist', $scope.artist.id).then (res) -> + $scope.artist.user_data.is_following = res.is_followed +] diff --git a/resources/assets/scripts/app/controllers/artists-list.coffee b/resources/assets/scripts/app/controllers/artists-list.coffee index 859afbd9..82a07574 100644 --- a/resources/assets/scripts/app/controllers/artists-list.coffee +++ b/resources/assets/scripts/app/controllers/artists-list.coffee @@ -1,12 +1,12 @@ window.pfm.preloaders['artists-list'] = [ - 'artists', '$state' - (artists, $state) -> - artists.fetchList($state.params.page, true) + 'artists', '$state' + (artists, $state) -> + artists.fetchList($state.params.page, true) ] angular.module('ponyfm').controller "artists-list", [ - '$scope', 'artists', '$state' - ($scope, artists, $state) -> - artists.fetchList($state.params.page).done (list) -> - $scope.artists = list.artists -] \ No newline at end of file + '$scope', 'artists', '$state' + ($scope, artists, $state) -> + artists.fetchList($state.params.page).done (list) -> + $scope.artists = list.artists +] diff --git a/resources/assets/scripts/app/controllers/artists.coffee b/resources/assets/scripts/app/controllers/artists.coffee index 18f0e7e3..b05f426b 100644 --- a/resources/assets/scripts/app/controllers/artists.coffee +++ b/resources/assets/scripts/app/controllers/artists.coffee @@ -1,22 +1,22 @@ angular.module('ponyfm').controller "artists", [ - '$scope', 'artists', '$state' - ($scope, artists, $state) -> + '$scope', 'artists', '$state' + ($scope, artists, $state) -> - refreshPages = (list) -> - $scope.artists = list.artists - $scope.currentPage = parseInt(list.current_page) - $scope.totalPages = parseInt(list.total_pages) + refreshPages = (list) -> + $scope.artists = list.artists + $scope.currentPage = parseInt(list.current_page) + $scope.totalPages = parseInt(list.total_pages) - delete $scope.nextPage - delete $scope.prevPage - $scope.nextPage = $scope.currentPage + 1 if $scope.currentPage < $scope.totalPages - $scope.prevPage = $scope.currentPage - 1 if $scope.currentPage > 1 - $scope.pages = [1..$scope.totalPages] + delete $scope.nextPage + delete $scope.prevPage + $scope.nextPage = $scope.currentPage + 1 if $scope.currentPage < $scope.totalPages + $scope.prevPage = $scope.currentPage - 1 if $scope.currentPage > 1 + $scope.pages = [1..$scope.totalPages] - artists.fetchList($state.params.page).done refreshPages - $scope.$on 'artists-feteched', (e, list) -> refreshPages(list) + artists.fetchList($state.params.page).done refreshPages + $scope.$on 'artists-feteched', (e, list) -> refreshPages(list) - $scope.gotoPage = (page) -> - return if !page - $state.transitionTo 'content.artists.list', {page: page} -] \ No newline at end of file + $scope.gotoPage = (page) -> + return if !page + $state.transitionTo 'content.artists.list', {page: page} +] diff --git a/resources/assets/scripts/app/controllers/credits.coffee b/resources/assets/scripts/app/controllers/credits.coffee index 11303d6c..9d8bab1c 100644 --- a/resources/assets/scripts/app/controllers/credits.coffee +++ b/resources/assets/scripts/app/controllers/credits.coffee @@ -1,5 +1,5 @@ angular.module('ponyfm').controller "credits", [ - '$scope', 'dialog', - ($scope, dialog) -> - $scope.close = () -> dialog.close(null) + '$scope', 'dialog', + ($scope, dialog) -> + $scope.close = () -> dialog.close(null) ] diff --git a/resources/assets/scripts/app/controllers/dashboard.coffee b/resources/assets/scripts/app/controllers/dashboard.coffee index 5e4a385c..3b592deb 100644 --- a/resources/assets/scripts/app/controllers/dashboard.coffee +++ b/resources/assets/scripts/app/controllers/dashboard.coffee @@ -1,15 +1,15 @@ window.pfm.preloaders['dashboard'] = [ - 'dashboard' - (dashboard) -> dashboard.refresh(true) + 'dashboard' + (dashboard) -> dashboard.refresh(true) ] angular.module('ponyfm').controller "dashboard", [ - '$scope', 'dashboard', 'auth', '$http' - ($scope, dashboard, auth, $http) -> - $scope.recentTracks = null - $scope.popularTracks = null + '$scope', 'dashboard', 'auth', '$http' + ($scope, dashboard, auth, $http) -> + $scope.recentTracks = null + $scope.popularTracks = null - dashboard.refresh().done (res) -> - $scope.recentTracks = res.recent_tracks - $scope.popularTracks = res.popular_tracks + dashboard.refresh().done (res) -> + $scope.recentTracks = res.recent_tracks + $scope.popularTracks = res.popular_tracks ] diff --git a/resources/assets/scripts/app/controllers/favourites-albums.coffee b/resources/assets/scripts/app/controllers/favourites-albums.coffee index c1c8cbf9..26689d1d 100644 --- a/resources/assets/scripts/app/controllers/favourites-albums.coffee +++ b/resources/assets/scripts/app/controllers/favourites-albums.coffee @@ -1,12 +1,12 @@ window.pfm.preloaders['favourites-albums'] = [ - 'favourites' - (favourites) -> - favourites.fetchAlbums(true) + 'favourites' + (favourites) -> + favourites.fetchAlbums(true) ] angular.module('ponyfm').controller "favourites-albums", [ - '$scope', 'favourites' - ($scope, favourites) -> - favourites.fetchAlbums().done (res) -> - $scope.albums = res.albums -] \ No newline at end of file + '$scope', 'favourites' + ($scope, favourites) -> + favourites.fetchAlbums().done (res) -> + $scope.albums = res.albums +] diff --git a/resources/assets/scripts/app/controllers/favourites-playlists.coffee b/resources/assets/scripts/app/controllers/favourites-playlists.coffee index 0f041875..9d4302e5 100644 --- a/resources/assets/scripts/app/controllers/favourites-playlists.coffee +++ b/resources/assets/scripts/app/controllers/favourites-playlists.coffee @@ -1,12 +1,12 @@ window.pfm.preloaders['favourites-playlists'] = [ - 'favourites' - (favourites) -> - favourites.fetchPlaylists(true) + 'favourites' + (favourites) -> + favourites.fetchPlaylists(true) ] angular.module('ponyfm').controller "favourites-playlists", [ - '$scope', 'favourites' - ($scope, favourites) -> - favourites.fetchPlaylists().done (res) -> - $scope.playlists = res.playlists -] \ No newline at end of file + '$scope', 'favourites' + ($scope, favourites) -> + favourites.fetchPlaylists().done (res) -> + $scope.playlists = res.playlists +] diff --git a/resources/assets/scripts/app/controllers/favourites-tracks.coffee b/resources/assets/scripts/app/controllers/favourites-tracks.coffee index 8a2ccdd4..359b3d00 100644 --- a/resources/assets/scripts/app/controllers/favourites-tracks.coffee +++ b/resources/assets/scripts/app/controllers/favourites-tracks.coffee @@ -1,12 +1,12 @@ window.pfm.preloaders['favourites-tracks'] = [ - 'favourites' - (favourites) -> - favourites.fetchTracks(true) + 'favourites' + (favourites) -> + favourites.fetchTracks(true) ] angular.module('ponyfm').controller "favourites-tracks", [ - '$scope', 'favourites' - ($scope, favourites) -> - favourites.fetchTracks().done (res) -> - $scope.tracks = res.tracks -] \ No newline at end of file + '$scope', 'favourites' + ($scope, favourites) -> + favourites.fetchTracks().done (res) -> + $scope.tracks = res.tracks +] diff --git a/resources/assets/scripts/app/controllers/home.coffee b/resources/assets/scripts/app/controllers/home.coffee index aa1c47f0..86cb03f4 100644 --- a/resources/assets/scripts/app/controllers/home.coffee +++ b/resources/assets/scripts/app/controllers/home.coffee @@ -1,15 +1,15 @@ window.pfm.preloaders['home'] = [ - 'dashboard' - (dashboard) -> dashboard.refresh(true) + 'dashboard' + (dashboard) -> dashboard.refresh(true) ] angular.module('ponyfm').controller "home", [ - '$scope', 'dashboard' - ($scope, dashboard) -> - $scope.recentTracks = null - $scope.popularTracks = null + '$scope', 'dashboard' + ($scope, dashboard) -> + $scope.recentTracks = null + $scope.popularTracks = null - dashboard.refresh().done (res) -> - $scope.recentTracks = res.recent_tracks - $scope.popularTracks = res.popular_tracks + dashboard.refresh().done (res) -> + $scope.recentTracks = res.recent_tracks + $scope.popularTracks = res.popular_tracks ] diff --git a/resources/assets/scripts/app/controllers/login.coffee b/resources/assets/scripts/app/controllers/login.coffee index 780aee1d..c0225112 100644 --- a/resources/assets/scripts/app/controllers/login.coffee +++ b/resources/assets/scripts/app/controllers/login.coffee @@ -1,18 +1,18 @@ angular.module('ponyfm').controller "login", [ - '$scope', 'auth' - ($scope, auth) -> + '$scope', 'auth' + ($scope, auth) -> - $scope.messages = [] + $scope.messages = [] - $scope.login = - remember: true + $scope.login = + remember: true - submit: () -> - $scope.messages = [] + submit: () -> + $scope.messages = [] - auth.login(this.email, this.password, this.remember) - .done -> - location.reload() - .fail (messages) -> - $scope.messages = _.values messages -] \ No newline at end of file + auth.login(this.email, this.password, this.remember) + .done -> + location.reload() + .fail (messages) -> + $scope.messages = _.values messages +] diff --git a/resources/assets/scripts/app/controllers/playlist-form.coffee b/resources/assets/scripts/app/controllers/playlist-form.coffee index ba2e6a4a..f5b50622 100644 --- a/resources/assets/scripts/app/controllers/playlist-form.coffee +++ b/resources/assets/scripts/app/controllers/playlist-form.coffee @@ -1,27 +1,27 @@ angular.module('ponyfm').controller "playlist-form", [ - '$scope', 'dialog', 'playlists', 'playlist' - ($scope, dialog, playlists, playlist) -> - $scope.isLoading = false - $scope.form = playlist - $scope.isNew = playlist.id == undefined + '$scope', 'dialog', 'playlists', 'playlist' + ($scope, dialog, playlists, playlist) -> + $scope.isLoading = false + $scope.form = playlist + $scope.isNew = playlist.id == undefined - $scope.errors = {} + $scope.errors = {} - $scope.createPlaylist = () -> - $scope.isLoading = true - def = - if $scope.isNew - playlists.createPlaylist($scope.form) - else - playlists.editPlaylist($scope.form) + $scope.createPlaylist = () -> + $scope.isLoading = true + def = + if $scope.isNew + playlists.createPlaylist($scope.form) + else + playlists.editPlaylist($scope.form) - def - .done (res) -> - dialog.close(res) + def + .done (res) -> + dialog.close(res) - .fail (errors)-> - $scope.errors = errors - $scope.isLoading = false + .fail (errors)-> + $scope.errors = errors + $scope.isLoading = false - $scope.close = () -> dialog.close(null) + $scope.close = () -> dialog.close(null) ] diff --git a/resources/assets/scripts/app/controllers/playlist.coffee b/resources/assets/scripts/app/controllers/playlist.coffee index 425ff2f0..12ba0583 100644 --- a/resources/assets/scripts/app/controllers/playlist.coffee +++ b/resources/assets/scripts/app/controllers/playlist.coffee @@ -1,21 +1,21 @@ window.pfm.preloaders['playlist'] = [ - '$state', 'playlists' - ($state, playlists) -> - playlists.fetch $state.params.id, true + '$state', 'playlists' + ($state, playlists) -> + playlists.fetch $state.params.id, true ] angular.module('ponyfm').controller 'playlist', [ - '$scope', '$state', 'playlists', '$dialog' - ($scope, $state, playlists, $dialog) -> - playlist = null + '$scope', '$state', 'playlists', '$dialog' + ($scope, $state, playlists, $dialog) -> + playlist = null - playlists.fetch($state.params.id).done (playlistResponse) -> - $scope.playlist = playlistResponse - playlist = playlistResponse + playlists.fetch($state.params.id).done (playlistResponse) -> + $scope.playlist = playlistResponse + playlist = playlistResponse - $scope.share = () -> - dialog = $dialog.dialog - templateUrl: '/templates/partials/playlist-share-dialog.html', - controller: ['$scope', ($scope) -> $scope.playlist = playlist; $scope.close = () -> dialog.close()] - dialog.open() -] \ No newline at end of file + $scope.share = () -> + dialog = $dialog.dialog + templateUrl: '/templates/partials/playlist-share-dialog.html', + controller: ['$scope', ($scope) -> $scope.playlist = playlist; $scope.close = () -> dialog.close()] + dialog.open() +] diff --git a/resources/assets/scripts/app/controllers/playlists-list.coffee b/resources/assets/scripts/app/controllers/playlists-list.coffee index fa36631c..553cde1d 100644 --- a/resources/assets/scripts/app/controllers/playlists-list.coffee +++ b/resources/assets/scripts/app/controllers/playlists-list.coffee @@ -1,12 +1,12 @@ window.pfm.preloaders['playlists-list'] = [ - 'playlists', '$state' - (playlists, $state) -> - playlists.fetchList($state.params.page, true) + 'playlists', '$state' + (playlists, $state) -> + playlists.fetchList($state.params.page, true) ] angular.module('ponyfm').controller "playlists-list", [ - '$scope', 'playlists', '$state', - ($scope, playlists, $state) -> - playlists.fetchList($state.params.page).done (searchResults) -> - $scope.playlists = searchResults.playlists -] \ No newline at end of file + '$scope', 'playlists', '$state', + ($scope, playlists, $state) -> + playlists.fetchList($state.params.page).done (searchResults) -> + $scope.playlists = searchResults.playlists +] diff --git a/resources/assets/scripts/app/controllers/playlists.coffee b/resources/assets/scripts/app/controllers/playlists.coffee index 622c3748..a2957ee7 100644 --- a/resources/assets/scripts/app/controllers/playlists.coffee +++ b/resources/assets/scripts/app/controllers/playlists.coffee @@ -1,22 +1,22 @@ angular.module('ponyfm').controller "playlists", [ - '$scope', 'playlists', '$state' - ($scope, playlists, $state) -> + '$scope', 'playlists', '$state' + ($scope, playlists, $state) -> - refreshPages = (list) -> - $scope.playlists = list.playlists - $scope.currentPage = parseInt(list.current_page) - $scope.totalPages = parseInt(list.total_pages) + refreshPages = (list) -> + $scope.playlists = list.playlists + $scope.currentPage = parseInt(list.current_page) + $scope.totalPages = parseInt(list.total_pages) - delete $scope.nextPage - delete $scope.prevPage - $scope.nextPage = $scope.currentPage + 1 if $scope.currentPage < $scope.totalPages - $scope.prevPage = $scope.currentPage - 1 if $scope.currentPage > 1 - $scope.pages = [1..$scope.totalPages] + delete $scope.nextPage + delete $scope.prevPage + $scope.nextPage = $scope.currentPage + 1 if $scope.currentPage < $scope.totalPages + $scope.prevPage = $scope.currentPage - 1 if $scope.currentPage > 1 + $scope.pages = [1..$scope.totalPages] - playlists.fetchList($state.params.page).done refreshPages - $scope.$on 'playlists-feteched', (e, list) -> refreshPages(list) + playlists.fetchList($state.params.page).done refreshPages + $scope.$on 'playlists-feteched', (e, list) -> refreshPages(list) - $scope.gotoPage = (page) -> - return if !page - $state.transitionTo 'content.playlists.list', {page: page} -] \ No newline at end of file + $scope.gotoPage = (page) -> + return if !page + $state.transitionTo 'content.playlists.list', {page: page} +] diff --git a/resources/assets/scripts/app/controllers/sidebar.coffee b/resources/assets/scripts/app/controllers/sidebar.coffee index 5cc2393d..edbe957d 100644 --- a/resources/assets/scripts/app/controllers/sidebar.coffee +++ b/resources/assets/scripts/app/controllers/sidebar.coffee @@ -1,50 +1,50 @@ angular.module('ponyfm').controller "sidebar", [ - '$scope', '$dialog', 'playlists' - ($scope, $dialog, playlists) -> - $scope.playlists = playlists.pinnedPlaylists + '$scope', '$dialog', 'playlists' + ($scope, $dialog, playlists) -> + $scope.playlists = playlists.pinnedPlaylists - $scope.createPlaylist = () -> - dialog = $dialog.dialog - templateUrl: '/templates/partials/playlist-dialog.html' - controller: 'playlist-form' - resolve: { - playlist: () -> - is_public: true - is_pinned: true - name: '' - description: '' - } + $scope.createPlaylist = () -> + dialog = $dialog.dialog + templateUrl: '/templates/partials/playlist-dialog.html' + controller: 'playlist-form' + resolve: { + playlist: () -> + is_public: true + is_pinned: true + name: '' + description: '' + } - dialog.open() + dialog.open() - $scope.editPlaylist = (playlist) -> - dialog = $dialog.dialog - templateUrl: '/templates/partials/playlist-dialog.html' - controller: 'playlist-form' - resolve: { - playlist: () -> angular.copy playlist - } + $scope.editPlaylist = (playlist) -> + dialog = $dialog.dialog + templateUrl: '/templates/partials/playlist-dialog.html' + controller: 'playlist-form' + resolve: { + playlist: () -> angular.copy playlist + } - dialog.open() + dialog.open() - $scope.unpinPlaylist = (playlist) -> - playlist.is_pinned = false; - playlists.editPlaylist playlist + $scope.unpinPlaylist = (playlist) -> + playlist.is_pinned = false; + playlists.editPlaylist playlist - $scope.deletePlaylist = (playlist) -> - $dialog.messageBox('Delete ' + playlist.title, 'Are you sure you want to delete "' + playlist.title + '"? This cannot be undone.', [ - {result: 'ok', label: 'Yes', cssClass: 'btn-danger'}, - {result: 'cancel', label: 'No', cssClass: 'btn-primary'} - ]).open().then (res) -> - return if res == 'cancel' - playlists.deletePlaylist playlist + $scope.deletePlaylist = (playlist) -> + $dialog.messageBox('Delete ' + playlist.title, 'Are you sure you want to delete "' + playlist.title + '"? This cannot be undone.', [ + {result: 'ok', label: 'Yes', cssClass: 'btn-danger'}, + {result: 'cancel', label: 'No', cssClass: 'btn-primary'} + ]).open().then (res) -> + return if res == 'cancel' + playlists.deletePlaylist playlist - $scope.showCredits = () -> - dialog = $dialog.dialog - templateUrl: '/templates/partials/credits-dialog.html' - controller: 'credits' + $scope.showCredits = () -> + dialog = $dialog.dialog + templateUrl: '/templates/partials/credits-dialog.html' + controller: 'credits' - dialog.open() + dialog.open() ] diff --git a/resources/assets/scripts/app/controllers/track.coffee b/resources/assets/scripts/app/controllers/track.coffee index 339e41db..9ea1a3ce 100644 --- a/resources/assets/scripts/app/controllers/track.coffee +++ b/resources/assets/scripts/app/controllers/track.coffee @@ -1,59 +1,59 @@ window.pfm.preloaders['track'] = [ - 'tracks', '$state', 'playlists' - (tracks, $state, playlists) -> - $.when.all [tracks.fetch $state.params.id, playlists.refreshOwned(true)] + 'tracks', '$state', 'playlists' + (tracks, $state, playlists) -> + $.when.all [tracks.fetch $state.params.id, playlists.refreshOwned(true)] ] angular.module('ponyfm').controller "track", [ - '$scope', 'tracks', '$state', 'playlists', 'auth', 'favourites', '$dialog' - ($scope, tracks, $state, playlists, auth, favourites, $dialog) -> - track = null + '$scope', 'tracks', '$state', 'playlists', 'auth', 'favourites', '$dialog' + ($scope, tracks, $state, playlists, auth, favourites, $dialog) -> + track = null - tracks.fetch($state.params.id).done (trackResponse) -> - $scope.track = trackResponse.track - track = trackResponse.track + tracks.fetch($state.params.id).done (trackResponse) -> + $scope.track = trackResponse.track + track = trackResponse.track - $scope.playlists = [] + $scope.playlists = [] - if auth.data.isLogged - playlists.refreshOwned().done (lists) -> - $scope.playlists.push list for list in lists + if auth.data.isLogged + playlists.refreshOwned().done (lists) -> + $scope.playlists.push list for list in lists - $scope.favouriteWorking = false + $scope.favouriteWorking = false - $scope.toggleFavourite = (track) -> - $scope.favouriteWorking = true - favourites.toggle('track', track.id).done (res) -> - track.is_favourited = res.is_favourited - $scope.favouriteWorking = false + $scope.toggleFavourite = (track) -> + $scope.favouriteWorking = true + favourites.toggle('track', track.id).done (res) -> + track.is_favourited = res.is_favourited + $scope.favouriteWorking = false - $scope.share = () -> - dialog = $dialog.dialog - templateUrl: '/templates/partials/track-share-dialog.html', - controller: ['$scope', ($scope) -> $scope.track = track; $scope.close = () -> dialog.close()] - dialog.open() + $scope.share = () -> + dialog = $dialog.dialog + templateUrl: '/templates/partials/track-share-dialog.html', + controller: ['$scope', ($scope) -> $scope.track = track; $scope.close = () -> dialog.close()] + dialog.open() - $scope.addToNewPlaylist = () -> - dialog = $dialog.dialog - templateUrl: '/templates/partials/playlist-dialog.html' - controller: 'playlist-form' - resolve: { - playlist: () -> - is_public: true - is_pinned: true - name: '' - description: '' - } + $scope.addToNewPlaylist = () -> + dialog = $dialog.dialog + templateUrl: '/templates/partials/playlist-dialog.html' + controller: 'playlist-form' + resolve: { + playlist: () -> + is_public: true + is_pinned: true + name: '' + description: '' + } - dialog.open().then (playlist) -> - return if !playlist + dialog.open().then (playlist) -> + return if !playlist - playlists.addTrackToPlaylist playlist.id, $scope.track.id - $state.transitionTo 'playlist', {id: playlist.id} + playlists.addTrackToPlaylist playlist.id, $scope.track.id + $state.transitionTo 'playlist', {id: playlist.id} - $scope.addToPlaylist = (playlist) -> - return if playlist.message + $scope.addToPlaylist = (playlist) -> + return if playlist.message - playlists.addTrackToPlaylist(playlist.id, $scope.track.id).done (res) -> - playlist.message = res.message -] \ No newline at end of file + playlists.addTrackToPlaylist(playlist.id, $scope.track.id).done (res) -> + playlist.message = res.message +] diff --git a/resources/assets/scripts/app/controllers/tracks-list.coffee b/resources/assets/scripts/app/controllers/tracks-list.coffee index ca60a20e..0552e2b7 100644 --- a/resources/assets/scripts/app/controllers/tracks-list.coffee +++ b/resources/assets/scripts/app/controllers/tracks-list.coffee @@ -1,17 +1,17 @@ window.pfm.preloaders['tracks-list'] = [ - 'tracks', '$state' - (tracks, $state) -> - tracks.loadFilters().then(-> - tracks.mainQuery.fromFilterString($state.params.filter) - tracks.mainQuery.setPage $state.params.page || 1 + 'tracks', '$state' + (tracks, $state) -> + tracks.loadFilters().then(-> + tracks.mainQuery.fromFilterString($state.params.filter) + tracks.mainQuery.setPage $state.params.page || 1 - tracks.mainQuery.fetch() - ) + tracks.mainQuery.fetch() + ) ] angular.module('ponyfm').controller "tracks-list", [ - '$scope', 'tracks', '$state', - ($scope, tracks, $state) -> - tracks.mainQuery.fetch().done (searchResults) -> - $scope.tracks = searchResults.tracks -] \ No newline at end of file + '$scope', 'tracks', '$state', + ($scope, tracks, $state) -> + tracks.mainQuery.fetch().done (searchResults) -> + $scope.tracks = searchResults.tracks +] diff --git a/resources/assets/scripts/app/controllers/tracks.coffee b/resources/assets/scripts/app/controllers/tracks.coffee index cd065811..2f3052fd 100644 --- a/resources/assets/scripts/app/controllers/tracks.coffee +++ b/resources/assets/scripts/app/controllers/tracks.coffee @@ -1,45 +1,45 @@ window.pfm.preloaders['tracks'] = [ - 'tracks', '$state' - (tracks) -> - tracks.loadFilters() + 'tracks', '$state' + (tracks) -> + tracks.loadFilters() ] angular.module('ponyfm').controller "tracks", [ - '$scope', 'tracks', '$state' - ($scope, tracks, $state) -> - $scope.recentTracks = null - $scope.query = tracks.mainQuery - $scope.filters = tracks.filters + '$scope', 'tracks', '$state' + ($scope, tracks, $state) -> + $scope.recentTracks = null + $scope.query = tracks.mainQuery + $scope.filters = tracks.filters - $scope.toggleListFilter = (filter, id) -> - $scope.query.toggleListFilter filter, id - $state.transitionTo 'content.tracks.list', {filter: $scope.query.toFilterString()} + $scope.toggleListFilter = (filter, id) -> + $scope.query.toggleListFilter filter, id + $state.transitionTo 'content.tracks.list', {filter: $scope.query.toFilterString()} - $scope.setFilter = (filter, value) -> - $scope.query.setFilter filter, value - $state.transitionTo 'content.tracks.list', {filter: $scope.query.toFilterString()} + $scope.setFilter = (filter, value) -> + $scope.query.setFilter filter, value + $state.transitionTo 'content.tracks.list', {filter: $scope.query.toFilterString()} - $scope.setListFilter = (filter, id) -> - $scope.query.setListFilter filter, id - $state.transitionTo 'content.tracks.list', {filter: $scope.query.toFilterString()} + $scope.setListFilter = (filter, id) -> + $scope.query.setListFilter filter, id + $state.transitionTo 'content.tracks.list', {filter: $scope.query.toFilterString()} - $scope.clearFilter = (filter) -> - $scope.query.clearFilter filter - $state.transitionTo 'content.tracks.list', {filter: $scope.query.toFilterString()} + $scope.clearFilter = (filter) -> + $scope.query.clearFilter filter + $state.transitionTo 'content.tracks.list', {filter: $scope.query.toFilterString()} - tracks.mainQuery.listen (searchResults) -> - $scope.tracks = searchResults.tracks - $scope.currentPage = parseInt(searchResults.current_page) - $scope.totalPages = parseInt(searchResults.total_pages) - delete $scope.nextPage - delete $scope.prevPage + tracks.mainQuery.listen (searchResults) -> + $scope.tracks = searchResults.tracks + $scope.currentPage = parseInt(searchResults.current_page) + $scope.totalPages = parseInt(searchResults.total_pages) + delete $scope.nextPage + delete $scope.prevPage - $scope.nextPage = $scope.currentPage + 1 if $scope.currentPage < $scope.totalPages - $scope.prevPage = $scope.currentPage - 1 if $scope.currentPage > 1 - $scope.pages = [1..$scope.totalPages] + $scope.nextPage = $scope.currentPage + 1 if $scope.currentPage < $scope.totalPages + $scope.prevPage = $scope.currentPage - 1 if $scope.currentPage > 1 + $scope.pages = [1..$scope.totalPages] - $scope.gotoPage = (page) -> - $state.transitionTo 'content.tracks.list', {filter: $state.params.filter, page: page} + $scope.gotoPage = (page) -> + $state.transitionTo 'content.tracks.list', {filter: $state.params.filter, page: page} - $scope.$on '$destroy', -> tracks.mainQuery = tracks.createQuery() -] \ No newline at end of file + $scope.$on '$destroy', -> tracks.mainQuery = tracks.createQuery() +] diff --git a/resources/assets/scripts/app/controllers/uploader.coffee b/resources/assets/scripts/app/controllers/uploader.coffee index caa0ba99..9edfb473 100644 --- a/resources/assets/scripts/app/controllers/uploader.coffee +++ b/resources/assets/scripts/app/controllers/uploader.coffee @@ -1,5 +1,5 @@ angular.module('ponyfm').controller "uploader", [ - '$scope', 'auth', 'upload', '$state' - ($scope, auth, upload, $state) -> - $scope.data = upload -] \ No newline at end of file + '$scope', 'auth', 'upload', '$state' + ($scope, auth, upload, $state) -> + $scope.data = upload +] diff --git a/resources/assets/scripts/app/directives/albums-list.coffee b/resources/assets/scripts/app/directives/albums-list.coffee index bf3880d4..542fe136 100644 --- a/resources/assets/scripts/app/directives/albums-list.coffee +++ b/resources/assets/scripts/app/directives/albums-list.coffee @@ -1,13 +1,13 @@ angular.module('ponyfm').directive 'pfmAlbumsList', () -> - restrict: 'E' - replace: true - templateUrl: '/templates/directives/albums-list.html' - scope: - albums: '=albums', - class: '@class' + restrict: 'E' + replace: true + templateUrl: '/templates/directives/albums-list.html' + scope: + albums: '=albums', + class: '@class' - controller: [ - '$scope', 'auth' - ($scope, auth) -> - $scope.auth = auth.data - ] \ No newline at end of file + controller: [ + '$scope', 'auth' + ($scope, auth) -> + $scope.auth = auth.data + ] diff --git a/resources/assets/scripts/app/directives/comments.coffee b/resources/assets/scripts/app/directives/comments.coffee index 01934b4e..ee0f2ee2 100644 --- a/resources/assets/scripts/app/directives/comments.coffee +++ b/resources/assets/scripts/app/directives/comments.coffee @@ -1,28 +1,28 @@ angular.module('ponyfm').directive 'pfmComments', () -> - restrict: 'E' - templateUrl: '/templates/directives/comments.html' - scope: - resource: '=resource', - type: '@type' + restrict: 'E' + templateUrl: '/templates/directives/comments.html' + scope: + resource: '=resource', + type: '@type' - controller: [ - '$scope', 'comments', 'auth' - ($scope, comments, auth) -> + controller: [ + '$scope', 'comments', 'auth' + ($scope, comments, auth) -> - $scope.isWorking = false - $scope.content = '' - $scope.auth = auth.data + $scope.isWorking = false + $scope.content = '' + $scope.auth = auth.data - refresh = () -> - comments.fetchList($scope.type, $scope.resource.id, true).done (comments) -> - $scope.resource.comments.length = 0 - $scope.resource.comments.push comment for comment in comments.list - $scope.isWorking = false + refresh = () -> + comments.fetchList($scope.type, $scope.resource.id, true).done (comments) -> + $scope.resource.comments.length = 0 + $scope.resource.comments.push comment for comment in comments.list + $scope.isWorking = false - $scope.addComment = () -> - content = $scope.content - $scope.content = '' - $scope.isWorking = true - comments.addComment($scope.type, $scope.resource.id, content).done () -> - refresh() - ] \ No newline at end of file + $scope.addComment = () -> + content = $scope.content + $scope.content = '' + $scope.isWorking = true + comments.addComment($scope.type, $scope.resource.id, content).done () -> + refresh() + ] diff --git a/resources/assets/scripts/app/directives/eat-click.coffee b/resources/assets/scripts/app/directives/eat-click.coffee index dc5904b7..6c7fa7ac 100644 --- a/resources/assets/scripts/app/directives/eat-click.coffee +++ b/resources/assets/scripts/app/directives/eat-click.coffee @@ -1,4 +1,4 @@ angular.module('ponyfm').directive 'pfmEatClick', () -> - (scope, element) -> - $(element).click (e) -> - e.preventDefault() + (scope, element) -> + $(element).click (e) -> + e.preventDefault() diff --git a/resources/assets/scripts/app/directives/favouriteButton.coffee b/resources/assets/scripts/app/directives/favouriteButton.coffee index 05a1eed5..7325d430 100644 --- a/resources/assets/scripts/app/directives/favouriteButton.coffee +++ b/resources/assets/scripts/app/directives/favouriteButton.coffee @@ -1,21 +1,21 @@ angular.module('ponyfm').directive 'pfmFavouriteButton', () -> - restrict: 'E' - templateUrl: '/templates/directives/favourite-button.html' - scope: - resource: '=resource', - class: '@class', - type: '@type' - replace: true + restrict: 'E' + templateUrl: '/templates/directives/favourite-button.html' + scope: + resource: '=resource', + class: '@class', + type: '@type' + replace: true - controller: [ - '$scope', 'favourites', 'auth' - ($scope, favourites, auth) -> - $scope.auth = auth.data + controller: [ + '$scope', 'favourites', 'auth' + ($scope, favourites, auth) -> + $scope.auth = auth.data - $scope.isWorking = false - $scope.toggleFavourite = () -> - $scope.isWorking = true - favourites.toggle($scope.type, $scope.resource.id).done (res) -> - $scope.isWorking = false - $scope.resource.user_data.is_favourited = res.is_favourited - ] \ No newline at end of file + $scope.isWorking = false + $scope.toggleFavourite = () -> + $scope.isWorking = true + favourites.toggle($scope.type, $scope.resource.id).done (res) -> + $scope.isWorking = false + $scope.resource.user_data.is_favourited = res.is_favourited + ] diff --git a/resources/assets/scripts/app/directives/image-upload.coffee b/resources/assets/scripts/app/directives/image-upload.coffee index 7fbef992..27f481e0 100644 --- a/resources/assets/scripts/app/directives/image-upload.coffee +++ b/resources/assets/scripts/app/directives/image-upload.coffee @@ -1,86 +1,86 @@ angular.module('ponyfm').directive 'pfmImageUpload', () -> - $image = null - $uploader = null + $image = null + $uploader = null - restrict: 'E' - templateUrl: '/templates/directives/image-upload.html' - scope: - setImage: '=setImage' - image: '=image' + restrict: 'E' + templateUrl: '/templates/directives/image-upload.html' + scope: + setImage: '=setImage' + image: '=image' - compile: (element) -> - $image = element.find 'img' - $uploader = element.find 'input' + compile: (element) -> + $image = element.find 'img' + $uploader = element.find 'input' - controller: [ - 'images', '$scope', 'lightbox' - (images, $scope, lightbox) -> - $scope.imageObject = null - $scope.imageFile = null - $scope.imageUrl = null - $scope.isImageLoaded = false - $scope.error = null + controller: [ + 'images', '$scope', 'lightbox' + (images, $scope, lightbox) -> + $scope.imageObject = null + $scope.imageFile = null + $scope.imageUrl = null + $scope.isImageLoaded = false + $scope.error = null - $scope.$watch 'image', (val) -> - $scope.imageObject = $scope.imageFile = $scope.imageUrl = null - $scope.isImageLoaded = false - return if !val + $scope.$watch 'image', (val) -> + $scope.imageObject = $scope.imageFile = $scope.imageUrl = null + $scope.isImageLoaded = false + return if !val - $scope.imageUrl = val - $image.attr 'src', val - $scope.isImageLoaded = true + $scope.imageUrl = val + $image.attr 'src', val + $scope.isImageLoaded = true - $image.load () -> $scope.$apply -> - $scope.isImageLoaded = true - window.setTimeout (() -> window.alignVertically($image)), 0 + $image.load () -> $scope.$apply -> + $scope.isImageLoaded = true + window.setTimeout (() -> window.alignVertically($image)), 0 - images.refresh().done (images) -> $scope.images = images + images.refresh().done (images) -> $scope.images = images - $scope.previewImage = () -> - return if !$scope.isImageLoaded + $scope.previewImage = () -> + return if !$scope.isImageLoaded - if $scope.imageObject - lightbox.openImageUrl $scope.imageObject.urls.normal - else if $scope.imageFile - lightbox.openDataUrl $image.attr 'src' - else if $scope.imageUrl - lightbox.openImageUrl $scope.imageUrl + if $scope.imageObject + lightbox.openImageUrl $scope.imageObject.urls.normal + else if $scope.imageFile + lightbox.openDataUrl $image.attr 'src' + else if $scope.imageUrl + lightbox.openImageUrl $scope.imageUrl - $scope.uploadImage = () -> - $uploader.trigger 'click' + $scope.uploadImage = () -> + $uploader.trigger 'click' - $scope.clearImage = () -> - $scope.imageObject = $scope.imageFile = $scope.imageUrl = null - $scope.isImageLoaded = false - $scope.setImage null + $scope.clearImage = () -> + $scope.imageObject = $scope.imageFile = $scope.imageUrl = null + $scope.isImageLoaded = false + $scope.setImage null - $scope.selectGalleryImage = (image) -> - $scope.imageObject = image - $scope.imageFile = null - $scope.imageUrl = image.urls.small - $image.attr 'src', image.urls.small - $scope.isImageLoaded = true - $scope.setImage image, 'gallery' + $scope.selectGalleryImage = (image) -> + $scope.imageObject = image + $scope.imageFile = null + $scope.imageUrl = image.urls.small + $image.attr 'src', image.urls.small + $scope.isImageLoaded = true + $scope.setImage image, 'gallery' - $scope.setImageFile = (input) -> - $scope.$apply -> - file = input.files[0] - $scope.imageObject = null - $scope.imageFile = file + $scope.setImageFile = (input) -> + $scope.$apply -> + file = input.files[0] + $scope.imageObject = null + $scope.imageFile = file - if file.type != 'image/png' - $scope.error = 'Image must be a png!' - $scope.isImageLoaded = false - $scope.imageObject = $scope.imageFile = $scope.imageUrl = null - return + if file.type != 'image/png' + $scope.error = 'Image must be a png!' + $scope.isImageLoaded = false + $scope.imageObject = $scope.imageFile = $scope.imageUrl = null + return - $scope.error = null - $scope.setImage file, 'file' + $scope.error = null + $scope.setImage file, 'file' - reader = new FileReader() - reader.onload = (e) -> $scope.$apply -> - $image[0].src = e.target.result - $scope.isImageLoaded = true + reader = new FileReader() + reader.onload = (e) -> $scope.$apply -> + $image[0].src = e.target.result + $scope.isImageLoaded = true - reader.readAsDataURL file - ] \ No newline at end of file + reader.readAsDataURL file + ] diff --git a/resources/assets/scripts/app/directives/player.coffee b/resources/assets/scripts/app/directives/player.coffee index 29db05b4..83e1bb82 100644 --- a/resources/assets/scripts/app/directives/player.coffee +++ b/resources/assets/scripts/app/directives/player.coffee @@ -1,74 +1,74 @@ angular.module('ponyfm').directive 'pfmPlayer', () -> - $element = null + $element = null - restrict: 'E' - templateUrl: '/templates/directives/player.html' - scope: {} - replace: true + restrict: 'E' + templateUrl: '/templates/directives/player.html' + scope: {} + replace: true - compile: (element) -> - $element = element + compile: (element) -> + $element = element - controller: [ - '$scope', 'player', 'auth' - ($scope, player, auth) -> - $scope.player = player - $scope.auth = auth.data - $scope.playPause = () -> - $scope.player.playPause() + controller: [ + '$scope', 'player', 'auth' + ($scope, player, auth) -> + $scope.player = player + $scope.auth = auth.data + $scope.playPause = () -> + $scope.player.playPause() - $scope.playNext = () -> - $scope.player.playNext() + $scope.playNext = () -> + $scope.player.playNext() - $scope.playPrev = () -> - $scope.player.playPrev() + $scope.playPrev = () -> + $scope.player.playPrev() - $scope.seek = (e) -> - $transport = $ '.transport' - percent = ((e.pageX - $transport.offset().left) / $transport.width()) - duration = parseFloat($scope.player.currentTrack.duration) + $scope.seek = (e) -> + $transport = $ '.transport' + percent = ((e.pageX - $transport.offset().left) / $transport.width()) + duration = parseFloat($scope.player.currentTrack.duration) - $scope.player.seek percent * duration * 1000 + $scope.player.seek percent * duration * 1000 - isSliding = false - $slider = $element.find('.volume-slider') - $knob = $element.find('.volume-slider .knob') - $bar = $element.find('.volume-slider .bar') + isSliding = false + $slider = $element.find('.volume-slider') + $knob = $element.find('.volume-slider .knob') + $bar = $element.find('.volume-slider .bar') - player.readyDef.done -> - initialY = (180 - (180 * (player.volume / 100))) - 7.5 - $knob.css {top: initialY} + player.readyDef.done -> + initialY = (180 - (180 * (player.volume / 100))) - 7.5 + $knob.css {top: initialY} - moveVolumeSlider = (absoluteY) -> - newY = absoluteY - $bar.offset().top; - maxY = $bar.height() - ($knob.height() / 2) - 8 + moveVolumeSlider = (absoluteY) -> + newY = absoluteY - $bar.offset().top; + maxY = $bar.height() - ($knob.height() / 2) - 8 - newY = 0 if newY < 0 - newY = maxY if newY > maxY + newY = 0 if newY < 0 + newY = maxY if newY > maxY - percent = 100 - ((newY / maxY) * 100) - $scope.player.setVolume percent - $knob.css {top: newY} + percent = 100 - ((newY / maxY) * 100) + $scope.player.setVolume percent + $knob.css {top: newY} - $knob.click (e) -> - e.preventDefault() - e.stopPropagation() + $knob.click (e) -> + e.preventDefault() + e.stopPropagation() - $slider.click (e) -> $scope.$apply -> moveVolumeSlider(e.pageY - 8) + $slider.click (e) -> $scope.$apply -> moveVolumeSlider(e.pageY - 8) - $(document).mousemove (e) -> - return if !isSliding - moveVolumeSlider(e.pageY - 8) + $(document).mousemove (e) -> + return if !isSliding + moveVolumeSlider(e.pageY - 8) - $knob.mousedown (e) -> - e.preventDefault() - e.stopPropagation() - isSliding = true - $slider.parent().addClass('keep-open') + $knob.mousedown (e) -> + e.preventDefault() + e.stopPropagation() + isSliding = true + $slider.parent().addClass('keep-open') - $(document).mouseup (e) -> - e.preventDefault() - e.stopPropagation() - isSliding = false - $slider.parent().removeClass('keep-open') - ] \ No newline at end of file + $(document).mouseup (e) -> + e.preventDefault() + e.stopPropagation() + isSliding = false + $slider.parent().removeClass('keep-open') + ] diff --git a/resources/assets/scripts/app/directives/playlists-list.coffee b/resources/assets/scripts/app/directives/playlists-list.coffee index 2f18ce15..066fcf72 100644 --- a/resources/assets/scripts/app/directives/playlists-list.coffee +++ b/resources/assets/scripts/app/directives/playlists-list.coffee @@ -1,13 +1,13 @@ angular.module('ponyfm').directive 'pfmPlaylistsList', () -> - restrict: 'E' - replace: true - templateUrl: '/templates/directives/playlists-list.html' - scope: - playlists: '=playlists', - class: '@class' + restrict: 'E' + replace: true + templateUrl: '/templates/directives/playlists-list.html' + scope: + playlists: '=playlists', + class: '@class' - controller: [ - '$scope', 'auth' - ($scope, auth) -> - $scope.auth = auth.data - ] \ No newline at end of file + controller: [ + '$scope', 'auth' + ($scope, auth) -> + $scope.auth = auth.data + ] diff --git a/resources/assets/scripts/app/directives/popup.coffee b/resources/assets/scripts/app/directives/popup.coffee index 1541e715..e3d89402 100644 --- a/resources/assets/scripts/app/directives/popup.coffee +++ b/resources/assets/scripts/app/directives/popup.coffee @@ -1,86 +1,86 @@ angular.module('ponyfm').directive 'pfmPopup', () -> - (scope, element, attrs) -> - align = 'left' - elementId = attrs.pfmPopup - if elementId.indexOf ',' != -1 - parts = elementId.split ',' - elementId = parts[0] - align = parts[1] + (scope, element, attrs) -> + align = 'left' + elementId = attrs.pfmPopup + if elementId.indexOf ',' != -1 + parts = elementId.split ',' + elementId = parts[0] + align = parts[1] - $popup = $ '#' + attrs.pfmPopup - $element = $ element - $positionParent = null - open = false + $popup = $ '#' + attrs.pfmPopup + $element = $ element + $positionParent = null + open = false - documentClickHandler = () -> - return if !open - $popup.removeClass 'open' - open = false + documentClickHandler = () -> + return if !open + $popup.removeClass 'open' + open = false - calculatePosition = -> - $popup.parents().each () -> - $this = $ this - $positionParent = $this if $positionParent == null && ($this.css('position') == 'relative' || $this.is 'body') + calculatePosition = -> + $popup.parents().each () -> + $this = $ this + $positionParent = $this if $positionParent == null && ($this.css('position') == 'relative' || $this.is 'body') - position = $element.offset() - parentPosition = $positionParent.offset() + position = $element.offset() + parentPosition = $positionParent.offset() - windowWidth = $(window).width() - 15 - left = position.left - right = left + $popup.width() + windowWidth = $(window).width() - 15 + left = position.left + right = left + $popup.width() - if align == 'left' && right > windowWidth - left -= right - windowWidth - else if align == 'right' - left -= $popup.outerWidth() - $element.outerWidth() + if align == 'left' && right > windowWidth + left -= right - windowWidth + else if align == 'right' + left -= $popup.outerWidth() - $element.outerWidth() - height = 'auto' - top = position.top + $element.height() + 10 - bottom = top + $popup.height() - windowHeight = $(window).height() - if bottom > windowHeight - height = windowHeight - top; + height = 'auto' + top = position.top + $element.height() + 10 + bottom = top + $popup.height() + windowHeight = $(window).height() + if bottom > windowHeight + height = windowHeight - top; - return { - left: left - parentPosition.left - top: top - parentPosition.top, - height: height - 15} + return { + left: left - parentPosition.left + top: top - parentPosition.top, + height: height - 15} - windowResizeHandler = () -> - return if !open - $popup.css 'height', 'auto' - position = calculatePosition() - $popup.css - left: position.left - top: position.top - height: position.height + windowResizeHandler = () -> + return if !open + $popup.css 'height', 'auto' + position = calculatePosition() + $popup.css + left: position.left + top: position.top + height: position.height - $(document.body).bind 'click', documentClickHandler - $(window).bind 'resize', windowResizeHandler + $(document.body).bind 'click', documentClickHandler + $(window).bind 'resize', windowResizeHandler - $(element).click (e) -> - e.preventDefault() - e.stopPropagation() + $(element).click (e) -> + e.preventDefault() + e.stopPropagation() - if open - open = false - $popup.removeClass 'open' - return + if open + open = false + $popup.removeClass 'open' + return - $popup.addClass 'open' + $popup.addClass 'open' - $popup.css 'height', 'auto' - window.setTimeout (-> - position = calculatePosition() - $popup.css - left: position.left - top: position.top - height: position.height + $popup.css 'height', 'auto' + window.setTimeout (-> + position = calculatePosition() + $popup.css + left: position.left + top: position.top + height: position.height - open = true - ), 0 + open = true + ), 0 - scope.$on '$destroy', () -> - $(document.body).unbind 'click', documentClickHandler - $(window).unbind 'click', windowResizeHandler + scope.$on '$destroy', () -> + $(document.body).unbind 'click', documentClickHandler + $(window).unbind 'click', windowResizeHandler diff --git a/resources/assets/scripts/app/directives/progress-bar.coffee b/resources/assets/scripts/app/directives/progress-bar.coffee index 7443035e..827c99cf 100644 --- a/resources/assets/scripts/app/directives/progress-bar.coffee +++ b/resources/assets/scripts/app/directives/progress-bar.coffee @@ -1,5 +1,5 @@ angular.module('ponyfm').directive 'pfmProgressBar', () -> - (scope, element, attrs) -> - scope.$watch attrs.pfmProgressBar, (val) -> - return if !val? - $(element).css 'width', val + '%' \ No newline at end of file + (scope, element, attrs) -> + scope.$watch attrs.pfmProgressBar, (val) -> + return if !val? + $(element).css 'width', val + '%' diff --git a/resources/assets/scripts/app/directives/scroll-recorder.coffee b/resources/assets/scripts/app/directives/scroll-recorder.coffee index 130d40f5..6a1b6db0 100644 --- a/resources/assets/scripts/app/directives/scroll-recorder.coffee +++ b/resources/assets/scripts/app/directives/scroll-recorder.coffee @@ -1,28 +1,28 @@ angular.module('ponyfm').directive 'pfmScrollRecorder', () -> - (scope, element, attrs) -> - timeout = null - onScroll = null - lastInView = null + (scope, element, attrs) -> + timeout = null + onScroll = null + lastInView = null - element.scroll (e) -> - (window.clearTimeout timeout) if timeout - timeout = window.setTimeout (-> onScroll e), 500 + element.scroll (e) -> + (window.clearTimeout timeout) if timeout + timeout = window.setTimeout (-> onScroll e), 500 - onScroll = (e) -> scope.safeApply -> - items = element.find 'li:not(.empty)' - itemHeight = (items.eq 0).height() - itemsArray = items.get() + onScroll = (e) -> scope.safeApply -> + items = element.find 'li:not(.empty)' + itemHeight = (items.eq 0).height() + itemsArray = items.get() - elementViewTop = element.offset().top - elementViewBottom = elementViewTop + element.height() + elementViewTop = element.offset().top + elementViewBottom = elementViewTop + element.height() - for i in [itemsArray.length - 1..0] - listItem = $ itemsArray[i] + for i in [itemsArray.length - 1..0] + listItem = $ itemsArray[i] - listItemTop = listItem.offset().top + itemHeight - isInView = listItemTop > elementViewTop && listItemTop < elementViewBottom - if isInView - lastInView = listItem - break + listItemTop = listItem.offset().top + itemHeight + isInView = listItemTop > elementViewTop && listItemTop < elementViewBottom + if isInView + lastInView = listItem + break - scope.$emit 'element-in-view', angular.element(lastInView).scope() \ No newline at end of file + scope.$emit 'element-in-view', angular.element(lastInView).scope() diff --git a/resources/assets/scripts/app/directives/share-buttons.coffee b/resources/assets/scripts/app/directives/share-buttons.coffee index 9a756ff0..4bb90bb5 100644 --- a/resources/assets/scripts/app/directives/share-buttons.coffee +++ b/resources/assets/scripts/app/directives/share-buttons.coffee @@ -1,6 +1,6 @@ angular.module('ponyfm').directive 'pfmShareButtons', () -> - (scope, element) -> - window.setTimeout((-> - Tumblr.activate_share_on_tumblr_buttons() - FB.XFBML.parse(null, -> element.addClass('loaded')) - ), 0) \ No newline at end of file + (scope, element) -> + window.setTimeout((-> + Tumblr.activate_share_on_tumblr_buttons() + FB.XFBML.parse(null, -> element.addClass('loaded')) + ), 0) diff --git a/resources/assets/scripts/app/directives/src-loader.coffee b/resources/assets/scripts/app/directives/src-loader.coffee index ebcd595a..7c4246ad 100644 --- a/resources/assets/scripts/app/directives/src-loader.coffee +++ b/resources/assets/scripts/app/directives/src-loader.coffee @@ -1,25 +1,25 @@ angular.module('ponyfm').directive 'pfmSrcLoader', () -> - (scope, element, attrs) -> - size = attrs.pfmSrcSize || 'normal' - element.css {opacity: .5} + (scope, element, attrs) -> + size = attrs.pfmSrcSize || 'normal' + element.css {opacity: .5} - update = (val) -> - element.attr 'src', '/images/icons/loading_' + size + '.png' + update = (val) -> + element.attr 'src', '/images/icons/loading_' + size + '.png' - image = element.clone() - image.removeAttr 'pfm-src-loader' - image.removeAttr 'pfm-src-size' + image = element.clone() + image.removeAttr 'pfm-src-loader' + image.removeAttr 'pfm-src-size' - # If the given value is null, don't bother trying to - # load something - it will result in an HTTP error. - if val - image[0].onload = -> - element.attr 'src', val - element.css {opacity: 0} - element.animate {opacity: 1}, 250 + # If the given value is null, don't bother trying to + # load something - it will result in an HTTP error. + if val + image[0].onload = -> + element.attr 'src', val + element.css {opacity: 0} + element.animate {opacity: 1}, 250 - image[0].src = val + image[0].src = val - update scope.$eval attrs.pfmSrcLoader + update scope.$eval attrs.pfmSrcLoader - scope.$watch attrs.pfmSrcLoader, update + scope.$watch attrs.pfmSrcLoader, update diff --git a/resources/assets/scripts/app/directives/track-player.coffee b/resources/assets/scripts/app/directives/track-player.coffee index a7791c4b..1826d3a1 100644 --- a/resources/assets/scripts/app/directives/track-player.coffee +++ b/resources/assets/scripts/app/directives/track-player.coffee @@ -1,14 +1,14 @@ angular.module('ponyfm').directive 'pfmTrackPlayer', () -> - restrict: 'E' - templateUrl: '/templates/directives/track-player.html' - scope: - track: '=track', - class: '@class' - replace: true + restrict: 'E' + templateUrl: '/templates/directives/track-player.html' + scope: + track: '=track', + class: '@class' + replace: true - controller: [ - '$scope', 'player' - ($scope, player) -> - $scope.play = () -> - player.playTracks [$scope.track], 0 - ] \ No newline at end of file + controller: [ + '$scope', 'player' + ($scope, player) -> + $scope.play = () -> + player.playTracks [$scope.track], 0 + ] diff --git a/resources/assets/scripts/app/directives/tracks-list.coffee b/resources/assets/scripts/app/directives/tracks-list.coffee index b30fc7c6..0a1feb9d 100644 --- a/resources/assets/scripts/app/directives/tracks-list.coffee +++ b/resources/assets/scripts/app/directives/tracks-list.coffee @@ -1,21 +1,21 @@ angular.module('ponyfm').directive 'pfmTracksList', () -> - restrict: 'E' - templateUrl: '/templates/directives/tracks-list.html' - replace: true - scope: - tracks: '=tracks', - class: '@class' + restrict: 'E' + templateUrl: '/templates/directives/tracks-list.html' + replace: true + scope: + tracks: '=tracks', + class: '@class' - controller: [ - '$scope', 'favourites', 'player', 'auth' - ($scope, favourites, player, auth) -> - $scope.auth = auth.data + controller: [ + '$scope', 'favourites', 'player', 'auth' + ($scope, favourites, player, auth) -> + $scope.auth = auth.data - $scope.toggleFavourite = (track) -> - favourites.toggle('track', track.id).done (res) -> - track.user_data.is_favourited = res.is_favourited + $scope.toggleFavourite = (track) -> + favourites.toggle('track', track.id).done (res) -> + track.user_data.is_favourited = res.is_favourited - $scope.play = (track) -> - index = _.indexOf $scope.tracks, (t) -> t.id == track.id - player.playTracks $scope.tracks, index - ] \ No newline at end of file + $scope.play = (track) -> + index = _.indexOf $scope.tracks, (t) -> t.id == track.id + player.playTracks $scope.tracks, index + ] diff --git a/resources/assets/scripts/app/directives/uploader.coffee b/resources/assets/scripts/app/directives/uploader.coffee index fb817b72..12887c7a 100644 --- a/resources/assets/scripts/app/directives/uploader.coffee +++ b/resources/assets/scripts/app/directives/uploader.coffee @@ -1,20 +1,20 @@ angular.module('ponyfm').directive 'uploader', [ - 'upload' - (upload) -> (scope, element) -> - $dropzone = $(element) + 'upload' + (upload) -> (scope, element) -> + $dropzone = $(element) - $dropzone[0].addEventListener 'dragover', (e) -> - e.preventDefault() - $dropzone.addClass 'file-over' + $dropzone[0].addEventListener 'dragover', (e) -> + e.preventDefault() + $dropzone.addClass 'file-over' - $dropzone[0].addEventListener 'dragleave', (e) -> - e.preventDefault() - $dropzone.removeClass 'file-over' + $dropzone[0].addEventListener 'dragleave', (e) -> + e.preventDefault() + $dropzone.removeClass 'file-over' - $dropzone[0].addEventListener 'drop', (e) -> - e.preventDefault() - $dropzone.removeClass 'file-over' + $dropzone[0].addEventListener 'drop', (e) -> + e.preventDefault() + $dropzone.removeClass 'file-over' - files = e.target.files || e.dataTransfer.files - scope.$apply -> upload.upload files -] \ No newline at end of file + files = e.target.files || e.dataTransfer.files + scope.$apply -> upload.upload files +] diff --git a/resources/assets/scripts/app/filters/length.coffee b/resources/assets/scripts/app/filters/length.coffee index 34ec4680..878d0370 100644 --- a/resources/assets/scripts/app/filters/length.coffee +++ b/resources/assets/scripts/app/filters/length.coffee @@ -1,3 +1,3 @@ angular.module('ponyfm').filter 'pfmLength', () -> - (input) -> - input.length \ No newline at end of file + (input) -> + input.length diff --git a/resources/assets/scripts/app/filters/moment-from-now.coffee b/resources/assets/scripts/app/filters/moment-from-now.coffee index f258d5c6..fa67acc0 100644 --- a/resources/assets/scripts/app/filters/moment-from-now.coffee +++ b/resources/assets/scripts/app/filters/moment-from-now.coffee @@ -1,3 +1,3 @@ angular.module('ponyfm').filter 'momentFromNow', () -> - (input) -> - moment.utc(input).fromNow() + (input) -> + moment.utc(input).fromNow() diff --git a/resources/assets/scripts/app/filters/newlines.coffee b/resources/assets/scripts/app/filters/newlines.coffee index 38f18ace..d8e2b207 100644 --- a/resources/assets/scripts/app/filters/newlines.coffee +++ b/resources/assets/scripts/app/filters/newlines.coffee @@ -1,4 +1,4 @@ angular.module('ponyfm').filter 'newlines', () -> - (input) -> - return '' if !input - input.replace(/\n/g, '
    ') \ No newline at end of file + (input) -> + return '' if !input + input.replace(/\n/g, '
    ') diff --git a/resources/assets/scripts/app/filters/noHTML.coffee b/resources/assets/scripts/app/filters/noHTML.coffee index b00fd36f..3b2fe4af 100644 --- a/resources/assets/scripts/app/filters/noHTML.coffee +++ b/resources/assets/scripts/app/filters/noHTML.coffee @@ -1,7 +1,7 @@ angular.module('ponyfm').filter 'noHTML', () -> - (input) -> - return '' if !input + (input) -> + return '' if !input - input.replace(/&/g, '&') - .replace(/>/g, '>') - .replace(//g, '>') + .replace(/ 0 || value > -offset) - value += offset; - if (value === 0 && offset == -12 ) value = 12; - return padNumber(value, size, trim); - }; - } + function dateGetter(name, size, offset, trim) { + offset = offset || 0; + return function(date) { + var value = date['get' + name](); + if (offset > 0 || value > -offset) + value += offset; + if (value === 0 && offset == -12 ) value = 12; + return padNumber(value, size, trim); + }; + } - function dateStrGetter(name, shortForm) { - return function(date, formats) { - var value = date['get' + name](); - var get = uppercase(shortForm ? ('SHORT' + name) : name); + function dateStrGetter(name, shortForm) { + return function(date, formats) { + var value = date['get' + name](); + var get = uppercase(shortForm ? ('SHORT' + name) : name); - return formats[get][value]; - }; - } + return formats[get][value]; + }; + } - function timeZoneGetter(date) { - var zone = -1 * date.getTimezoneOffset(); - var paddedZone = (zone >= 0) ? "+" : ""; + function timeZoneGetter(date) { + var zone = -1 * date.getTimezoneOffset(); + var paddedZone = (zone >= 0) ? "+" : ""; - paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) + - padNumber(Math.abs(zone % 60), 2); + paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) + + padNumber(Math.abs(zone % 60), 2); - return paddedZone; - } + return paddedZone; + } - function ampmGetter(date, formats) { - return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1]; - } + function ampmGetter(date, formats) { + return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1]; + } - var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; - function jsonStringToDate(string) { - var match; - if (match = string.match(R_ISO8601_STR)) { - var date = new Date(0), - tzHour = 0, - tzMin = 0, - dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear, - timeSetter = match[8] ? date.setUTCHours : date.setHours; + var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; + function jsonStringToDate(string) { + var match; + if (match = string.match(R_ISO8601_STR)) { + var date = new Date(0), + tzHour = 0, + tzMin = 0, + dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear, + timeSetter = match[8] ? date.setUTCHours : date.setHours; - if (match[9]) { - tzHour = int(match[9] + match[10]); - tzMin = int(match[9] + match[11]); - } - dateSetter.call(date, int(match[1]), int(match[2]) - 1, int(match[3])); - var h = int(match[4]||0) - tzHour; - var m = int(match[5]||0) - tzMin; - var s = int(match[6]||0); - var ms = Math.round(parseFloat('0.' + (match[7]||0)) * 1000); - timeSetter.call(date, h, m, s, ms); - return date; - } - return string; - } + if (match[9]) { + tzHour = int(match[9] + match[10]); + tzMin = int(match[9] + match[11]); + } + dateSetter.call(date, int(match[1]), int(match[2]) - 1, int(match[3])); + var h = int(match[4]||0) - tzHour; + var m = int(match[5]||0) - tzMin; + var s = int(match[6]||0); + var ms = Math.round(parseFloat('0.' + (match[7]||0)) * 1000); + timeSetter.call(date, h, m, s, ms); + return date; + } + return string; + } - return function(date, format) { - var text = '', - parts = [], - fn, match; + return function(date, format) { + var text = '', + parts = [], + fn, match; - if (typeof(date) == 'object' && date.date) { - date = date.date; - } + if (typeof(date) == 'object' && date.date) { + date = date.date; + } - format = format || 'mediumDate'; - format = $locale.DATETIME_FORMATS[format] || format; - if (isString(date)) { - if (NUMBER_STRING.test(date)) { - date = int(date); - } else { - date = jsonStringToDate(date); - } - } + format = format || 'mediumDate'; + format = $locale.DATETIME_FORMATS[format] || format; + if (isString(date)) { + if (NUMBER_STRING.test(date)) { + date = int(date); + } else { + date = jsonStringToDate(date); + } + } - if (isNumber(date)) { - date = new Date(date); - } + if (isNumber(date)) { + date = new Date(date); + } - if (!isDate(date)) { - return date; - } + if (!isDate(date)) { + return date; + } - while(format) { - match = DATE_FORMATS_SPLIT.exec(format); - if (match) { - parts = concat(parts, match, 1); - format = parts.pop(); - } else { - parts.push(format); - format = null; - } - } + while(format) { + match = DATE_FORMATS_SPLIT.exec(format); + if (match) { + parts = concat(parts, match, 1); + format = parts.pop(); + } else { + parts.push(format); + format = null; + } + } - forEach(parts, function(value){ - fn = DATE_FORMATS[value]; - text += fn ? fn(date, $locale.DATETIME_FORMATS) - : value.replace(/(^'|'$)/g, '').replace(/''/g, "'"); - }); + forEach(parts, function(value){ + fn = DATE_FORMATS[value]; + text += fn ? fn(date, $locale.DATETIME_FORMATS) + : value.replace(/(^'|'$)/g, '').replace(/''/g, "'"); + }); - return text; - }; - }]); \ No newline at end of file + return text; + }; + }]); diff --git a/resources/assets/scripts/app/filters/seconds-display.coffee b/resources/assets/scripts/app/filters/seconds-display.coffee index 3714841b..3c15fcea 100644 --- a/resources/assets/scripts/app/filters/seconds-display.coffee +++ b/resources/assets/scripts/app/filters/seconds-display.coffee @@ -1,20 +1,20 @@ angular.module('ponyfm').filter 'secondsDisplay', () -> - (input) -> - sec_num = parseInt(input, 10) - return '00:00' if !sec_num + (input) -> + sec_num = parseInt(input, 10) + return '00:00' if !sec_num - hours = Math.floor(sec_num / 3600) - minutes = Math.floor((sec_num - (hours * 3600)) / 60) - seconds = sec_num - (hours * 3600) - (minutes * 60) + hours = Math.floor(sec_num / 3600) + minutes = Math.floor((sec_num - (hours * 3600)) / 60) + seconds = sec_num - (hours * 3600) - (minutes * 60) - if (hours < 10) - hours = "0" + hours - if (minutes < 10) - minutes = "0" + minutes - if (seconds < 10) - seconds = "0" + seconds + if (hours < 10) + hours = "0" + hours + if (minutes < 10) + minutes = "0" + minutes + if (seconds < 10) + seconds = "0" + seconds - time = '' - time += hours + ':' if hours != "00" - time += minutes + ':' + seconds; - return time; \ No newline at end of file + time = '' + time += hours + ':' if hours != "00" + time += minutes + ':' + seconds; + return time; diff --git a/resources/assets/scripts/app/filters/trust.coffee b/resources/assets/scripts/app/filters/trust.coffee index 500f377d..9c472905 100644 --- a/resources/assets/scripts/app/filters/trust.coffee +++ b/resources/assets/scripts/app/filters/trust.coffee @@ -1,7 +1,7 @@ angular.module('ponyfm').filter 'trust', [ - '$sce' - ($sce) -> - (input) -> - console.log input - $sce.trustAsHtml input -] \ No newline at end of file + '$sce' + ($sce) -> + (input) -> + console.log input + $sce.trustAsHtml input +] diff --git a/resources/assets/scripts/app/services/account-albums.coffee b/resources/assets/scripts/app/services/account-albums.coffee index 6a381458..ceca4338 100644 --- a/resources/assets/scripts/app/services/account-albums.coffee +++ b/resources/assets/scripts/app/services/account-albums.coffee @@ -1,27 +1,27 @@ angular.module('ponyfm').factory('account-albums', [ - '$rootScope', '$http' - ($rootScope, $http) -> - def = null - albums = [] + '$rootScope', '$http' + ($rootScope, $http) -> + def = null + albums = [] - self = - getEdit: (id, force) -> - url = '/api/web/albums/edit/' + id - force = force || false - return albums[id] if !force && albums[id] + self = + getEdit: (id, force) -> + url = '/api/web/albums/edit/' + id + force = force || false + return albums[id] if !force && albums[id] - editDef = new $.Deferred() - albums[id] = editDef - $http.get(url).success (album) -> editDef.resolve album - editDef.promise() + editDef = new $.Deferred() + albums[id] = editDef + $http.get(url).success (album) -> editDef.resolve album + editDef.promise() - refresh: (force) -> - force = force || false - return def if !force && def - def = new $.Deferred() - $http.get('/api/web/albums/owned').success (ownedAlbums) -> - def.resolve(ownedAlbums) - def.promise() + refresh: (force) -> + force = force || false + return def if !force && def + def = new $.Deferred() + $http.get('/api/web/albums/owned').success (ownedAlbums) -> + def.resolve(ownedAlbums) + def.promise() - self -]) \ No newline at end of file + self +]) diff --git a/resources/assets/scripts/app/services/account-tracks.coffee b/resources/assets/scripts/app/services/account-tracks.coffee index 7f4dc51f..723cd9c2 100644 --- a/resources/assets/scripts/app/services/account-tracks.coffee +++ b/resources/assets/scripts/app/services/account-tracks.coffee @@ -1,31 +1,31 @@ angular.module('ponyfm').factory('account-tracks', [ - '$rootScope', '$http' - ($rootScope, $http) -> - cache = {} + '$rootScope', '$http' + ($rootScope, $http) -> + cache = {} - self = - clearCache: () -> cache = {} + self = + clearCache: () -> cache = {} - getEdit: (id, force) -> - url = '/api/web/tracks/edit/' + id - force = force || false - return cache[url] if !force && cache[url] + getEdit: (id, force) -> + url = '/api/web/tracks/edit/' + id + force = force || false + return cache[url] if !force && cache[url] - def = new $.Deferred() - cache[url] = def - $http.get(url).success (track) -> def.resolve track - def.promise() + def = new $.Deferred() + cache[url] = def + $http.get(url).success (track) -> def.resolve track + def.promise() - refresh: (query, force) -> - query = query || 'created_at,desc' - url = '/api/web/tracks/owned?' + query - force = force || false - return cache[url] if !force && cache[url] + refresh: (query, force) -> + query = query || 'created_at,desc' + url = '/api/web/tracks/owned?' + query + force = force || false + return cache[url] if !force && cache[url] - def = new $.Deferred() - cache[url] = def - $http.get(url).success (tracks) -> def.resolve tracks - def.promise() + def = new $.Deferred() + cache[url] = def + $http.get(url).success (tracks) -> def.resolve tracks + def.promise() - self -]) \ No newline at end of file + self +]) diff --git a/resources/assets/scripts/app/services/albums.coffee b/resources/assets/scripts/app/services/albums.coffee index 33ed63ec..50339bb1 100644 --- a/resources/assets/scripts/app/services/albums.coffee +++ b/resources/assets/scripts/app/services/albums.coffee @@ -1,32 +1,32 @@ angular.module('ponyfm').factory('albums', [ - '$rootScope', '$http' - ($rootScope, $http) -> - albumPages = [] - albums = {} + '$rootScope', '$http' + ($rootScope, $http) -> + albumPages = [] + albums = {} - self = - filters: {} + self = + filters: {} - fetchList: (page, force) -> - force = force || false - page = 1 if !page - return albumPages[page] if !force && albumPages[page] - albumsDef = new $.Deferred() - $http.get('/api/web/albums?page=' + page).success (albums) -> - albumsDef.resolve albums - $rootScope.$broadcast 'albums-feteched', albums + fetchList: (page, force) -> + force = force || false + page = 1 if !page + return albumPages[page] if !force && albumPages[page] + albumsDef = new $.Deferred() + $http.get('/api/web/albums?page=' + page).success (albums) -> + albumsDef.resolve albums + $rootScope.$broadcast 'albums-feteched', albums - albumPages[page] = albumsDef.promise() + albumPages[page] = albumsDef.promise() - fetch: (id, force) -> - force = force || false - id = 1 if !id - return albums[id] if !force && albums[id] - albumsDef = new $.Deferred() - $http.get('/api/web/albums/' + id + '?log=true').success (albums) -> - albumsDef.resolve albums + fetch: (id, force) -> + force = force || false + id = 1 if !id + return albums[id] if !force && albums[id] + albumsDef = new $.Deferred() + $http.get('/api/web/albums/' + id + '?log=true').success (albums) -> + albumsDef.resolve albums - albums[id] = albumsDef.promise() + albums[id] = albumsDef.promise() - self -]) \ No newline at end of file + self +]) diff --git a/resources/assets/scripts/app/services/artists.coffee b/resources/assets/scripts/app/services/artists.coffee index b3e8ee27..1fe07566 100644 --- a/resources/assets/scripts/app/services/artists.coffee +++ b/resources/assets/scripts/app/services/artists.coffee @@ -1,60 +1,60 @@ angular.module('ponyfm').factory('artists', [ - '$rootScope', '$http' - ($rootScope, $http) -> - artistPage = [] - artists = {} - artistContent = {} - artistFavourites = {} + '$rootScope', '$http' + ($rootScope, $http) -> + artistPage = [] + artists = {} + artistContent = {} + artistFavourites = {} - self = - filters: {} + self = + filters: {} - fetchList: (page, force) -> - force = force || false - page = 1 if !page - return artistPage[page] if !force && artistPage[page] - artistsDef = new $.Deferred() - $http.get('/api/web/artists?page=' + page).success (albums) -> - artistsDef.resolve albums - $rootScope.$broadcast 'artists-feteched', albums + fetchList: (page, force) -> + force = force || false + page = 1 if !page + return artistPage[page] if !force && artistPage[page] + artistsDef = new $.Deferred() + $http.get('/api/web/artists?page=' + page).success (albums) -> + artistsDef.resolve albums + $rootScope.$broadcast 'artists-feteched', albums - artistPage[page] = artistsDef.promise() + artistPage[page] = artistsDef.promise() - fetch: (slug, force) -> - force = force || false - slug = 1 if !slug - return artists[slug] if !force && artists[slug] - artistsDef = new $.Deferred() - $http.get('/api/web/artists/' + slug) - .success (albums) -> - artistsDef.resolve albums - .catch () -> - artistsDef.reject() + fetch: (slug, force) -> + force = force || false + slug = 1 if !slug + return artists[slug] if !force && artists[slug] + artistsDef = new $.Deferred() + $http.get('/api/web/artists/' + slug) + .success (albums) -> + artistsDef.resolve albums + .catch () -> + artistsDef.reject() - artists[slug] = artistsDef.promise() + artists[slug] = artistsDef.promise() - fetchContent: (slug, force) -> - force = force || false - slug = 1 if !slug - return artistContent[slug] if !force && artistContent[slug] - artistsDef = new $.Deferred() - $http.get('/api/web/artists/' + slug + '/content') - .success (albums) -> - artistsDef.resolve albums - .catch () -> - artistsDef.reject() + fetchContent: (slug, force) -> + force = force || false + slug = 1 if !slug + return artistContent[slug] if !force && artistContent[slug] + artistsDef = new $.Deferred() + $http.get('/api/web/artists/' + slug + '/content') + .success (albums) -> + artistsDef.resolve albums + .catch () -> + artistsDef.reject() - artistContent[slug] = artistsDef.promise() + artistContent[slug] = artistsDef.promise() - fetchFavourites: (slug, force) -> - force = force || false - slug = 1 if !slug - return artistFavourites[slug] if !force && artistFavourites[slug] - artistsDef = new $.Deferred() - $http.get('/api/web/artists/' + slug + '/favourites').success (albums) -> - artistsDef.resolve albums + fetchFavourites: (slug, force) -> + force = force || false + slug = 1 if !slug + return artistFavourites[slug] if !force && artistFavourites[slug] + artistsDef = new $.Deferred() + $http.get('/api/web/artists/' + slug + '/favourites').success (albums) -> + artistsDef.resolve albums - artistFavourites[slug] = artistsDef.promise() + artistFavourites[slug] = artistsDef.promise() - self -]) \ No newline at end of file + self +]) diff --git a/resources/assets/scripts/app/services/auth.coffee b/resources/assets/scripts/app/services/auth.coffee index 05083a9e..76b665fc 100644 --- a/resources/assets/scripts/app/services/auth.coffee +++ b/resources/assets/scripts/app/services/auth.coffee @@ -1,18 +1,18 @@ angular.module('ponyfm').factory('auth', [ - '$rootScope' - ($rootScope) -> - data: {isLogged: window.pfm.auth.isLogged, user: window.pfm.auth.user} - login: (email, password, remember) -> - def = new $.Deferred() - $.post('/api/web/auth/login', {email: email, password: password, remember: remember, _token: pfm.token}) - .done -> - $rootScope.$apply -> def.resolve() + '$rootScope' + ($rootScope) -> + data: {isLogged: window.pfm.auth.isLogged, user: window.pfm.auth.user} + login: (email, password, remember) -> + def = new $.Deferred() + $.post('/api/web/auth/login', {email: email, password: password, remember: remember, _token: pfm.token}) + .done -> + $rootScope.$apply -> def.resolve() - .fail (res) -> - $rootScope.$apply -> def.reject res.responseJSON.messages + .fail (res) -> + $rootScope.$apply -> def.reject res.responseJSON.messages - def.promise() + def.promise() - logout: -> $.post('/api/web/auth/logout', {_token: pfm.token}) + logout: -> $.post('/api/web/auth/logout', {_token: pfm.token}) ]) diff --git a/resources/assets/scripts/app/services/comments.coffee b/resources/assets/scripts/app/services/comments.coffee index 0033f1a1..8fa58439 100644 --- a/resources/assets/scripts/app/services/comments.coffee +++ b/resources/assets/scripts/app/services/comments.coffee @@ -1,27 +1,27 @@ angular.module('ponyfm').factory('comments', [ - '$rootScope', '$http' - ($rootScope, $http) -> - commentCache = [] + '$rootScope', '$http' + ($rootScope, $http) -> + commentCache = [] - self = - filters: {} + self = + filters: {} - addComment: (resourceType, resourceId, content) -> - commentDef = new $.Deferred() - $http.post('/api/web/comments/' + resourceType + '/' + resourceId, {content: content, _token: pfm.token}).success (comment) -> - commentDef.resolve comment + addComment: (resourceType, resourceId, content) -> + commentDef = new $.Deferred() + $http.post('/api/web/comments/' + resourceType + '/' + resourceId, {content: content, _token: pfm.token}).success (comment) -> + commentDef.resolve comment - commentDef.promise() + commentDef.promise() - fetchList: (resourceType, resourceId, force) -> - key = resourceType + '-' + resourceId - force = force || false - return commentCache[key] if !force && commentCache[key] - commentDef = new $.Deferred() - $http.get('/api/web/comments/' + resourceType + '/' + resourceId).success (comments) -> - commentDef.resolve comments + fetchList: (resourceType, resourceId, force) -> + key = resourceType + '-' + resourceId + force = force || false + return commentCache[key] if !force && commentCache[key] + commentDef = new $.Deferred() + $http.get('/api/web/comments/' + resourceType + '/' + resourceId).success (comments) -> + commentDef.resolve comments - commentCache[key] = commentDef.promise() + commentCache[key] = commentDef.promise() - self -]) \ No newline at end of file + self +]) diff --git a/resources/assets/scripts/app/services/dashboard.coffee b/resources/assets/scripts/app/services/dashboard.coffee index bab002fd..c8a364a0 100644 --- a/resources/assets/scripts/app/services/dashboard.coffee +++ b/resources/assets/scripts/app/services/dashboard.coffee @@ -1,16 +1,16 @@ angular.module('ponyfm').factory('dashboard', [ - '$rootScope', '$http' - ($rootScope, $http) -> - def = null + '$rootScope', '$http' + ($rootScope, $http) -> + def = null - self = - refresh: (force) -> - force = force || false - return def if !force && def - def = new $.Deferred() - $http.get('/api/web/dashboard').success (dashboardContent) -> - def.resolve(dashboardContent) - def.promise() + self = + refresh: (force) -> + force = force || false + return def if !force && def + def = new $.Deferred() + $http.get('/api/web/dashboard').success (dashboardContent) -> + def.resolve(dashboardContent) + def.promise() - self -]) \ No newline at end of file + self +]) diff --git a/resources/assets/scripts/app/services/favourites.coffee b/resources/assets/scripts/app/services/favourites.coffee index a242c3ef..9e55ceab 100644 --- a/resources/assets/scripts/app/services/favourites.coffee +++ b/resources/assets/scripts/app/services/favourites.coffee @@ -1,41 +1,41 @@ angular.module('ponyfm').factory('favourites', [ - '$rootScope', '$http' - ($rootScope, $http) -> - tracksDef = null - playlistsDef = null - albumsDef = null + '$rootScope', '$http' + ($rootScope, $http) -> + tracksDef = null + playlistsDef = null + albumsDef = null - self = - toggle: (type, id) -> - def = new $.Deferred() - $http.post('/api/web/favourites/toggle', {type: type, id: id, _token: pfm.token}).success (res) -> - def.resolve res + self = + toggle: (type, id) -> + def = new $.Deferred() + $http.post('/api/web/favourites/toggle', {type: type, id: id, _token: pfm.token}).success (res) -> + def.resolve res - def.promise() + def.promise() - fetchTracks: (force) -> - return tracksDef if !force && tracksDef - tracksDef = new $.Deferred() - $http.get('/api/web/favourites/tracks').success (res) -> - tracksDef.resolve res + fetchTracks: (force) -> + return tracksDef if !force && tracksDef + tracksDef = new $.Deferred() + $http.get('/api/web/favourites/tracks').success (res) -> + tracksDef.resolve res - tracksDef + tracksDef - fetchAlbums: (force) -> - return albumsDef if !force && albumsDef - albumsDef = new $.Deferred() - $http.get('/api/web/favourites/albums').success (res) -> - albumsDef.resolve res + fetchAlbums: (force) -> + return albumsDef if !force && albumsDef + albumsDef = new $.Deferred() + $http.get('/api/web/favourites/albums').success (res) -> + albumsDef.resolve res - albumsDef + albumsDef - fetchPlaylists: (force) -> - return playlistsDef if !force && playlistsDef - playlistsDef = new $.Deferred() - $http.get('/api/web/favourites/playlists').success (res) -> - playlistsDef.resolve res + fetchPlaylists: (force) -> + return playlistsDef if !force && playlistsDef + playlistsDef = new $.Deferred() + $http.get('/api/web/favourites/playlists').success (res) -> + playlistsDef.resolve res - playlistsDef + playlistsDef - self -]) \ No newline at end of file + self +]) diff --git a/resources/assets/scripts/app/services/follow.coffee b/resources/assets/scripts/app/services/follow.coffee index f91b16eb..a2209aba 100644 --- a/resources/assets/scripts/app/services/follow.coffee +++ b/resources/assets/scripts/app/services/follow.coffee @@ -1,13 +1,13 @@ angular.module('ponyfm').factory('follow', [ - '$rootScope', '$http' - ($rootScope, $http) -> - self = - toggle: (type, id) -> - def = new $.Deferred() - $http.post('/api/web/follow/toggle', {type: type, id: id, _token: pfm.token}).success (res) -> - def.resolve res + '$rootScope', '$http' + ($rootScope, $http) -> + self = + toggle: (type, id) -> + def = new $.Deferred() + $http.post('/api/web/follow/toggle', {type: type, id: id, _token: pfm.token}).success (res) -> + def.resolve res - def.promise() + def.promise() - self -]) \ No newline at end of file + self +]) diff --git a/resources/assets/scripts/app/services/images.coffee b/resources/assets/scripts/app/services/images.coffee index 33b74522..b270e72a 100644 --- a/resources/assets/scripts/app/services/images.coffee +++ b/resources/assets/scripts/app/services/images.coffee @@ -1,25 +1,25 @@ angular.module('ponyfm').factory('images', [ - '$rootScope' - ($rootScope) -> - def = null - self = - images: [] - isLoading: true - refresh: (force) -> - return def if !force && def - def = new $.Deferred() + '$rootScope' + ($rootScope) -> + def = null + self = + images: [] + isLoading: true + refresh: (force) -> + return def if !force && def + def = new $.Deferred() - self.images = [] - self.isLoading = true + self.images = [] + self.isLoading = true - $.getJSON('/api/web/images/owned').done (images) -> $rootScope.$apply -> - self.images = images - self.isLoading = false - def.resolve images + $.getJSON('/api/web/images/owned').done (images) -> $rootScope.$apply -> + self.images = images + self.isLoading = false + def.resolve images - return def + return def - self.refresh() - return self + self.refresh() + return self ]) diff --git a/resources/assets/scripts/app/services/lightbox.coffee b/resources/assets/scripts/app/services/lightbox.coffee index b4598e73..8dc40362 100644 --- a/resources/assets/scripts/app/services/lightbox.coffee +++ b/resources/assets/scripts/app/services/lightbox.coffee @@ -1,13 +1,13 @@ angular.module('ponyfm').factory('lightbox', [ - () -> - openDataUrl: (src) -> - $.colorbox - html: '' - transition: 'none' + () -> + openDataUrl: (src) -> + $.colorbox + html: '' + transition: 'none' - openImageUrl: (src) -> - $.colorbox - href: src - transition: 'none' + openImageUrl: (src) -> + $.colorbox + href: src + transition: 'none' ]) diff --git a/resources/assets/scripts/app/services/player.coffee b/resources/assets/scripts/app/services/player.coffee index 31c94fd4..e88ae731 100644 --- a/resources/assets/scripts/app/services/player.coffee +++ b/resources/assets/scripts/app/services/player.coffee @@ -1,142 +1,142 @@ angular.module('ponyfm').factory('player', [ - '$rootScope' - ($rootScope) -> - readyDef = new $.Deferred() + '$rootScope' + ($rootScope) -> + readyDef = new $.Deferred() - play = (track) -> - self.currentTrack = track - $rootScope.$broadcast 'player-starting-track', track + play = (track) -> + self.currentTrack = track + $rootScope.$broadcast 'player-starting-track', track - streams = [] - streams.push track.streams.mp3 - streams.push track.streams.ogg if track.streams.ogg - streams.push track.streams.aac if track.streams.aac + streams = [] + streams.push track.streams.mp3 + streams.push track.streams.ogg if track.streams.ogg + streams.push track.streams.aac if track.streams.aac - track.progress = 0 - track.progressSeconds = 0 - track.loadingProgress = 0 + track.progress = 0 + track.progressSeconds = 0 + track.loadingProgress = 0 - self.currentSound = soundManager.createSound - url: streams, - volume: self.volume + self.currentSound = soundManager.createSound + url: streams, + volume: self.volume - whileloading: () -> $rootScope.safeApply -> - track.loadingProgress = (self.currentSound.bytesLoaded / self.currentSound.bytesTotal) * 100 + whileloading: () -> $rootScope.safeApply -> + track.loadingProgress = (self.currentSound.bytesLoaded / self.currentSound.bytesTotal) * 100 - whileplaying: () -> $rootScope.safeApply -> - track.progressSeconds = self.currentSound.position / 1000 - track.progress = (self.currentSound.position / (track.duration * 1000)) * 100 + whileplaying: () -> $rootScope.safeApply -> + track.progressSeconds = self.currentSound.position / 1000 + track.progress = (self.currentSound.position / (track.duration * 1000)) * 100 - onfinish: () -> $rootScope.safeApply -> - track.isPlaying = false - self.playNext() + onfinish: () -> $rootScope.safeApply -> + track.isPlaying = false + self.playNext() - onstop: () -> $rootScope.safeApply -> - track.isPlaying = false - self.isPlaying = false + onstop: () -> $rootScope.safeApply -> + track.isPlaying = false + self.isPlaying = false - onplay: () -> $rootScope.safeApply -> - track.isPlaying = true + onplay: () -> $rootScope.safeApply -> + track.isPlaying = true - onresume: () -> $rootScope.safeApply -> - track.isPlaying = true + onresume: () -> $rootScope.safeApply -> + track.isPlaying = true - onpause: () -> $rootScope.safeApply -> - track.isPlaying = false + onpause: () -> $rootScope.safeApply -> + track.isPlaying = false - track.isPlaying = true - self.isPlaying = true - self.currentSound.play() + track.isPlaying = true + self.isPlaying = true + self.currentSound.play() - updateCanGo = () -> - self.canGoNext = self.playlistIndex < self.playlist.length - 1 - self.canGoPrev = self.playlistIndex > 0 + updateCanGo = () -> + self.canGoNext = self.playlistIndex < self.playlist.length - 1 + self.canGoPrev = self.playlistIndex > 0 - self = - ready: false - isPlaying: false - currentTrack: null - currentSound: null - playlist: [] - playlistIndex: 0 - volume: 0 - readyDef: readyDef.promise() - canGoPrev: false - canGoNext: false + self = + ready: false + isPlaying: false + currentTrack: null + currentSound: null + playlist: [] + playlistIndex: 0 + volume: 0 + readyDef: readyDef.promise() + canGoPrev: false + canGoNext: false - playPause: () -> - return if !self.ready - return if !self.isPlaying + playPause: () -> + return if !self.ready + return if !self.isPlaying - if self.currentSound.paused - self.currentSound.play() - else - self.currentSound.pause() + if self.currentSound.paused + self.currentSound.play() + else + self.currentSound.pause() - playNext: () -> - return if !self.canGoNext + playNext: () -> + return if !self.canGoNext - self.currentSound.stop() if self.currentSound != null - self.playlistIndex++ - if self.playlistIndex >= self.playlist.length - self.playlist.length = 0 - self.currentTrack = null - self.currentSong = null - self.isPlaying = false - return + self.currentSound.stop() if self.currentSound != null + self.playlistIndex++ + if self.playlistIndex >= self.playlist.length + self.playlist.length = 0 + self.currentTrack = null + self.currentSong = null + self.isPlaying = false + return - play self.playlist[self.playlistIndex] - updateCanGo() + play self.playlist[self.playlistIndex] + updateCanGo() - playPrev: () -> - return if !self.canGoPrev + playPrev: () -> + return if !self.canGoPrev - self.currentSound.stop() if self.currentSound != null - self.playlistIndex-- + self.currentSound.stop() if self.currentSound != null + self.playlistIndex-- - if self.playlistIndex < 0 - self.playlist.length = 0 - self.currentTrack = null - self.currentSong = null - self.isPlaying = false - return + if self.playlistIndex < 0 + self.playlist.length = 0 + self.currentTrack = null + self.currentSong = null + self.isPlaying = false + return - play self.playlist[self.playlistIndex] - updateCanGo() + play self.playlist[self.playlistIndex] + updateCanGo() - seek: (progress) -> - return if !self.currentSound - self.currentSound.setPosition(progress) + seek: (progress) -> + return if !self.currentSound + self.currentSound.setPosition(progress) - setVolume: (theVolume) -> - theVolume = 100 if theVolume > 100 - self.currentSound.setVolume(theVolume) if self.currentSound - $.cookie('pfm-volume', theVolume) - self.volume = theVolume + setVolume: (theVolume) -> + theVolume = 100 if theVolume > 100 + self.currentSound.setVolume(theVolume) if self.currentSound + $.cookie('pfm-volume', theVolume) + self.volume = theVolume - playTracks: (tracks, index) -> - return if !self.ready - return if tracks.length == 0 + playTracks: (tracks, index) -> + return if !self.ready + return if tracks.length == 0 - if tracks[index].isPlaying - self.playPause() - return + if tracks[index].isPlaying + self.playPause() + return - self.currentSound.stop() if self.currentSound != null + self.currentSound.stop() if self.currentSound != null - $rootScope.$broadcast 'player-stopping-playlist' - self.playlist.length = 0 - self.playlist.push track for track in tracks - self.playlistIndex = index + $rootScope.$broadcast 'player-stopping-playlist' + self.playlist.length = 0 + self.playlist.push track for track in tracks + self.playlistIndex = index - $rootScope.$broadcast 'player-starting-playlist', tracks - play tracks[index] - updateCanGo() + $rootScope.$broadcast 'player-starting-playlist', tracks + play tracks[index] + updateCanGo() - pfm.soundManager.done () -> - self.ready = true - self.setVolume($.cookie('pfm-volume') || 100) - readyDef.resolve() + pfm.soundManager.done () -> + self.ready = true + self.setVolume($.cookie('pfm-volume') || 100) + readyDef.resolve() - self -]) \ No newline at end of file + self +]) diff --git a/resources/assets/scripts/app/services/playlists.coffee b/resources/assets/scripts/app/services/playlists.coffee index b11efb82..b6fa0dde 100644 --- a/resources/assets/scripts/app/services/playlists.coffee +++ b/resources/assets/scripts/app/services/playlists.coffee @@ -1,133 +1,133 @@ angular.module('ponyfm').factory('playlists', [ - '$rootScope', '$state', '$http', 'auth' - ($rootScope, $state, $http, auth) -> - playlistDef = null - playlists = {} - playlistPages = [] + '$rootScope', '$state', '$http', 'auth' + ($rootScope, $state, $http, auth) -> + playlistDef = null + playlists = {} + playlistPages = [] - self = - pinnedPlaylists: [] + self = + pinnedPlaylists: [] - fetchList: (page, force) -> - force = force || false - page = 1 if !page - return playlistPages[page] if !force && playlistPages[page] - playlistDef = new $.Deferred() - $http.get('/api/web/playlists?page=' + page).success (playlists) -> - playlistDef.resolve playlists - $rootScope.$broadcast 'playlists-feteched', playlists + fetchList: (page, force) -> + force = force || false + page = 1 if !page + return playlistPages[page] if !force && playlistPages[page] + playlistDef = new $.Deferred() + $http.get('/api/web/playlists?page=' + page).success (playlists) -> + playlistDef.resolve playlists + $rootScope.$broadcast 'playlists-feteched', playlists - playlistPages[page] = playlistDef.promise() + playlistPages[page] = playlistDef.promise() - fetch: (id, force) -> - force = force || false - return playlists[id] if !force && playlists[id] - def = new $.Deferred() - $http.get('/api/web/playlists/' + id + '?log=true').success (playlist) -> - def.resolve playlist + fetch: (id, force) -> + force = force || false + return playlists[id] if !force && playlists[id] + def = new $.Deferred() + $http.get('/api/web/playlists/' + id + '?log=true').success (playlist) -> + def.resolve playlist - playlists[id] = def.promise() + playlists[id] = def.promise() - isPlaylistPinned: (id) -> - _.find(self.pinnedPlaylists, (p) -> `p.id == id`) != undefined + isPlaylistPinned: (id) -> + _.find(self.pinnedPlaylists, (p) -> `p.id == id`) != undefined - refreshOwned: (force) -> - force = force || false - return playlistDef if !force && playlistDef + refreshOwned: (force) -> + force = force || false + return playlistDef if !force && playlistDef - playlistDef = new $.Deferred() + playlistDef = new $.Deferred() - if auth.data.isLogged - $http.get('/api/web/playlists/owned').success (playlists) -> - playlistDef.resolve playlists - else - playlistDef.resolve [] + if auth.data.isLogged + $http.get('/api/web/playlists/owned').success (playlists) -> + playlistDef.resolve playlists + else + playlistDef.resolve [] - playlistDef + playlistDef - addTrackToPlaylist: (playlistId, trackId) -> - def = new $.Deferred() - $http.post('/api/web/playlists/' + playlistId + '/add-track', {track_id: trackId, _token: pfm.token}).success (res) -> - def.resolve(res) + addTrackToPlaylist: (playlistId, trackId) -> + def = new $.Deferred() + $http.post('/api/web/playlists/' + playlistId + '/add-track', {track_id: trackId, _token: pfm.token}).success (res) -> + def.resolve(res) - def + def - refresh: () -> - if auth.data.isLogged - $.getJSON('/api/web/playlists/pinned') - .done (playlists) -> $rootScope.$apply -> - self.pinnedPlaylists.length = 0 - self.pinnedPlaylists.push playlist for playlist in playlists + refresh: () -> + if auth.data.isLogged + $.getJSON('/api/web/playlists/pinned') + .done (playlists) -> $rootScope.$apply -> + self.pinnedPlaylists.length = 0 + self.pinnedPlaylists.push playlist for playlist in playlists - deletePlaylist: (playlist) -> - def = new $.Deferred() - $.post('/api/web/playlists/delete/' + playlist.id, {_token: window.pfm.token}) - .then -> $rootScope.$apply -> - if _.some(self.pinnedPlaylists, (p) -> p.id == playlist.id) - currentIndex = _.indexOf(self.pinnedPlaylists, (t) -> t.id == playlist.id) - self.pinnedPlaylists.splice currentIndex, 1 + deletePlaylist: (playlist) -> + def = new $.Deferred() + $.post('/api/web/playlists/delete/' + playlist.id, {_token: window.pfm.token}) + .then -> $rootScope.$apply -> + if _.some(self.pinnedPlaylists, (p) -> p.id == playlist.id) + currentIndex = _.indexOf(self.pinnedPlaylists, (t) -> t.id == playlist.id) + self.pinnedPlaylists.splice currentIndex, 1 - if $state.is('playlist') && $state.params.id == playlist.id - $state.transitionTo 'home' + if $state.is('playlist') && $state.params.id == playlist.id + $state.transitionTo 'home' - def.resolve() + def.resolve() - def + def - editPlaylist: (playlist) -> - def = new $.Deferred() - playlist._token = pfm.token - $.post('/api/web/playlists/edit/' + playlist.id, playlist) - .done (res) -> - $rootScope.$apply -> - currentIndex = _.indexOf(self.pinnedPlaylists, (t) -> t.id == playlist.id) - isPinned = _.some(self.pinnedPlaylists, (p) -> p.id == playlist.id) + editPlaylist: (playlist) -> + def = new $.Deferred() + playlist._token = pfm.token + $.post('/api/web/playlists/edit/' + playlist.id, playlist) + .done (res) -> + $rootScope.$apply -> + currentIndex = _.indexOf(self.pinnedPlaylists, (t) -> t.id == playlist.id) + isPinned = _.some(self.pinnedPlaylists, (p) -> p.id == playlist.id) - if res.is_pinned && !isPinned - self.pinnedPlaylists.push res - self.pinnedPlaylists.sort (left, right) -> left.title.localeCompare right.title - currentIndex = _.indexOf(self.pinnedPlaylists, (t) -> t.id == playlist.id) - else if !res.is_pinned && isPinned - self.pinnedPlaylists.splice currentIndex, 1 - currentIndex = _.indexOf(self.pinnedPlaylists, (t) -> t.id == playlist.id) + if res.is_pinned && !isPinned + self.pinnedPlaylists.push res + self.pinnedPlaylists.sort (left, right) -> left.title.localeCompare right.title + currentIndex = _.indexOf(self.pinnedPlaylists, (t) -> t.id == playlist.id) + else if !res.is_pinned && isPinned + self.pinnedPlaylists.splice currentIndex, 1 + currentIndex = _.indexOf(self.pinnedPlaylists, (t) -> t.id == playlist.id) - if res.is_pinned - current = self.pinnedPlaylists[currentIndex] - _.forEach res, (value, name) -> current[name] = value - self.pinnedPlaylists.sort (left, right) -> left.title.localeCompare right.title + if res.is_pinned + current = self.pinnedPlaylists[currentIndex] + _.forEach res, (value, name) -> current[name] = value + self.pinnedPlaylists.sort (left, right) -> left.title.localeCompare right.title - def.resolve res - $rootScope.$broadcast 'playlist-updated', res + def.resolve res + $rootScope.$broadcast 'playlist-updated', res - .fail (res)-> - $rootScope.$apply -> - errors = {} - _.each res.responseJSON.errors, (value, key) -> errors[key] = value.join ', ' - def.reject errors + .fail (res)-> + $rootScope.$apply -> + errors = {} + _.each res.responseJSON.errors, (value, key) -> errors[key] = value.join ', ' + def.reject errors - def + def - createPlaylist: (playlist) -> - def = new $.Deferred() - playlist._token = pfm.token - $.post('/api/web/playlists/create', playlist) - .done (res) -> - $rootScope.$apply -> - if res.is_pinned - self.pinnedPlaylists.push res - self.pinnedPlaylists.sort (left, right) -> left.title.localeCompare right.title + createPlaylist: (playlist) -> + def = new $.Deferred() + playlist._token = pfm.token + $.post('/api/web/playlists/create', playlist) + .done (res) -> + $rootScope.$apply -> + if res.is_pinned + self.pinnedPlaylists.push res + self.pinnedPlaylists.sort (left, right) -> left.title.localeCompare right.title - def.resolve res + def.resolve res - .fail (res)-> - $rootScope.$apply -> - errors = {} - _.each res.responseJSON.errors, (value, key) -> errors[key] = value.join ', ' - def.reject errors + .fail (res)-> + $rootScope.$apply -> + errors = {} + _.each res.responseJSON.errors, (value, key) -> errors[key] = value.join ', ' + def.reject errors - def + def - self.refresh() - self + self.refresh() + self ]) diff --git a/resources/assets/scripts/app/services/taxonomies.coffee b/resources/assets/scripts/app/services/taxonomies.coffee index c2e50395..4ed7fafc 100644 --- a/resources/assets/scripts/app/services/taxonomies.coffee +++ b/resources/assets/scripts/app/services/taxonomies.coffee @@ -1,38 +1,38 @@ angular.module('ponyfm').factory('taxonomies', [ - '$rootScope', '$http' - ($rootScope, $http) -> - def = null + '$rootScope', '$http' + ($rootScope, $http) -> + def = null - self = - trackTypes: [] - trackTypesWithTracks: [] - licenses: [] - genres: [] - genresWithTracks: [] - showSongs: [] - showSongsWithTracks: [] - refresh: () -> - return def.promise() if def != null + self = + trackTypes: [] + trackTypesWithTracks: [] + licenses: [] + genres: [] + genresWithTracks: [] + showSongs: [] + showSongsWithTracks: [] + refresh: () -> + return def.promise() if def != null - def = new $.Deferred() - $http.get('/api/web/taxonomies/all') - .success (taxonomies) -> - for t in taxonomies.track_types - self.trackTypes.push t - self.trackTypesWithTracks.push t if t.track_count > 0 + def = new $.Deferred() + $http.get('/api/web/taxonomies/all') + .success (taxonomies) -> + for t in taxonomies.track_types + self.trackTypes.push t + self.trackTypesWithTracks.push t if t.track_count > 0 - for t in taxonomies.genres - self.genres.push t - self.genresWithTracks.push t if t.track_count > 0 + for t in taxonomies.genres + self.genres.push t + self.genresWithTracks.push t if t.track_count > 0 - for t in taxonomies.show_songs - self.showSongs.push t - self.showSongsWithTracks.push t if t.track_count > 0 + for t in taxonomies.show_songs + self.showSongs.push t + self.showSongsWithTracks.push t if t.track_count > 0 - self.licenses.push t for t in taxonomies.licenses - def.resolve self + self.licenses.push t for t in taxonomies.licenses + def.resolve self - def.promise() + def.promise() - self -]) \ No newline at end of file + self +]) diff --git a/resources/assets/scripts/app/services/tracks.coffee b/resources/assets/scripts/app/services/tracks.coffee index 8cd161fa..4b4a81c8 100644 --- a/resources/assets/scripts/app/services/tracks.coffee +++ b/resources/assets/scripts/app/services/tracks.coffee @@ -1,230 +1,230 @@ angular.module('ponyfm').factory('tracks', [ - '$rootScope', '$http', 'taxonomies' - ($rootScope, $http, taxonomies) -> - filterDef = null - trackCache = {} + '$rootScope', '$http', 'taxonomies' + ($rootScope, $http, taxonomies) -> + filterDef = null + trackCache = {} - class Query - cachedDef: null - page: 1 - listeners: [] + class Query + cachedDef: null + page: 1 + listeners: [] - constructor: (@availableFilters) -> - @filters = {} - @hasLoadedFilters = false - @resetFilters() + constructor: (@availableFilters) -> + @filters = {} + @hasLoadedFilters = false + @resetFilters() - resetFilters: -> - _.each @availableFilters, (filter, name) => - if filter.type == 'single' - @filters[name] = _.find filter.values, (f) -> f.isDefault - else - @filters[name] = {title: 'Any', selectedArray: [], selectedObject: {}} + resetFilters: -> + _.each @availableFilters, (filter, name) => + if filter.type == 'single' + @filters[name] = _.find filter.values, (f) -> f.isDefault + else + @filters[name] = {title: 'Any', selectedArray: [], selectedObject: {}} - isIdSelected: (type, id) -> - @filters[type].selectedObject[id] != undefined + isIdSelected: (type, id) -> + @filters[type].selectedObject[id] != undefined - listen: (listener) -> - @listeners.push listener - @cachedDef.done listener if @cachedDef + listen: (listener) -> + @listeners.push listener + @cachedDef.done listener if @cachedDef - setListFilter: (type, id) -> - @cachedDef = null - @page = 1 - filterToAdd = _.find @availableFilters[type].values, (f) -> `f.id == id` - return if !filterToAdd + setListFilter: (type, id) -> + @cachedDef = null + @page = 1 + filterToAdd = _.find @availableFilters[type].values, (f) -> `f.id == id` + return if !filterToAdd - filter = @filters[type] - filter.selectedArray = [filterToAdd] - filter.selectedObject = {} - filter.selectedObject[id] = filterToAdd - filter.title = filterToAdd.title + filter = @filters[type] + filter.selectedArray = [filterToAdd] + filter.selectedObject = {} + filter.selectedObject[id] = filterToAdd + filter.title = filterToAdd.title - clearFilter: (type) -> - @cachedDef = null - @page = 1 - filter = @availableFilters[type] + clearFilter: (type) -> + @cachedDef = null + @page = 1 + filter = @availableFilters[type] - if filter.type == 'single' - @filters[type] = _.find filter.values, (f) -> f.isDefault - else - currentFilter = @filters[type] - currentFilter.selectedArray = [] - currentFilter.selectedObject = {} - currentFilter.title = 'Any' + if filter.type == 'single' + @filters[type] = _.find filter.values, (f) -> f.isDefault + else + currentFilter = @filters[type] + currentFilter.selectedArray = [] + currentFilter.selectedObject = {} + currentFilter.title = 'Any' - toggleListFilter: (type, id) -> - @cachedDef = null - @page = 1 - filter = @filters[type] + toggleListFilter: (type, id) -> + @cachedDef = null + @page = 1 + filter = @filters[type] - if filter.selectedObject[id] - delete filter.selectedObject[id] - filter.selectedArray.splice _.indexOf(filter.selectedArray, (f) -> f.id == id), 1 - else - filterToAdd = _.find @availableFilters[type].values, (f) -> `f.id == id` - return if !filterToAdd - filter.selectedObject[id] = filterToAdd - filter.selectedArray.push filterToAdd + if filter.selectedObject[id] + delete filter.selectedObject[id] + filter.selectedArray.splice _.indexOf(filter.selectedArray, (f) -> f.id == id), 1 + else + filterToAdd = _.find @availableFilters[type].values, (f) -> `f.id == id` + return if !filterToAdd + filter.selectedObject[id] = filterToAdd + filter.selectedArray.push filterToAdd - if filter.selectedArray.length == 0 - filter.title = 'Any' - else if filter.selectedArray.length == 1 - filter.title = filter.selectedArray[0].title - else - filter.title = filter.selectedArray.length + ' selected' + if filter.selectedArray.length == 0 + filter.title = 'Any' + else if filter.selectedArray.length == 1 + filter.title = filter.selectedArray[0].title + else + filter.title = filter.selectedArray.length + ' selected' - setPage: (page) -> - @page = page - @cachedDef = null + setPage: (page) -> + @page = page + @cachedDef = null - setFilter: (type, value) -> - @cachedDef = null - @page = 1 - @filters[type] = value + setFilter: (type, value) -> + @cachedDef = null + @page = 1 + @filters[type] = value - toFilterString: -> - parts = [] - _.each @availableFilters, (filter, name) => - filterName = filter.name - if filter.type == 'single' - return if @filters[name].query == '' - parts.push(filterName + '-' + @filters[name].query) - else - return if @filters[name].selectedArray.length == 0 - parts.push(filterName + '-' + _.map(@filters[name].selectedArray, (f) -> f.id).join '-') + toFilterString: -> + parts = [] + _.each @availableFilters, (filter, name) => + filterName = filter.name + if filter.type == 'single' + return if @filters[name].query == '' + parts.push(filterName + '-' + @filters[name].query) + else + return if @filters[name].selectedArray.length == 0 + parts.push(filterName + '-' + _.map(@filters[name].selectedArray, (f) -> f.id).join '-') - return parts.join '!' + return parts.join '!' - fromFilterString: (str) -> - @hasLoadedFilters = true - @cachedDef = null - @resetFilters() + fromFilterString: (str) -> + @hasLoadedFilters = true + @cachedDef = null + @resetFilters() - filters = (str || "").split '!' - for queryFilter in filters - parts = queryFilter.split '-' - queryName = parts[0] + filters = (str || "").split '!' + for queryFilter in filters + parts = queryFilter.split '-' + queryName = parts[0] - filterName = null - filter = null + filterName = null + filter = null - for name,f of @availableFilters - continue if f.name != queryName - filterName = name - filter = f + for name,f of @availableFilters + continue if f.name != queryName + filterName = name + filter = f - return if !filter + return if !filter - if filter.type == 'single' - filterToSet = _.find filter.values, (f) -> f.query == parts[1] - filterToSet = (_.find filter.values, (f) -> f.isDefault) if filterToSet == null - @setFilter filterName, filterToSet - else - @toggleListFilter filterName, id for id in _.rest parts, 1 + if filter.type == 'single' + filterToSet = _.find filter.values, (f) -> f.query == parts[1] + filterToSet = (_.find filter.values, (f) -> f.isDefault) if filterToSet == null + @setFilter filterName, filterToSet + else + @toggleListFilter filterName, id for id in _.rest parts, 1 - fetch: () -> - return @cachedDef if @cachedDef - @cachedDef = new $.Deferred() - trackDef = @cachedDef + fetch: () -> + return @cachedDef if @cachedDef + @cachedDef = new $.Deferred() + trackDef = @cachedDef - query = '/api/web/tracks?' - parts = ['page=' + @page] - _.each @availableFilters, (filter, name) => - if filter.type == 'single' - parts.push @filters[name].filter - else - queryName = filter.filterName - for item in @filters[name].selectedArray - parts.push queryName + "[]=" + item.id + query = '/api/web/tracks?' + parts = ['page=' + @page] + _.each @availableFilters, (filter, name) => + if filter.type == 'single' + parts.push @filters[name].filter + else + queryName = filter.filterName + for item in @filters[name].selectedArray + parts.push queryName + "[]=" + item.id - query += parts.join '&' - $http.get(query).success (tracks) => - @tracks = tracks - for listener in @listeners - listener tracks + query += parts.join '&' + $http.get(query).success (tracks) => + @tracks = tracks + for listener in @listeners + listener tracks - trackDef.resolve tracks + trackDef.resolve tracks - trackDef.promise() + trackDef.promise() - self = - filters: {} + self = + filters: {} - fetch: (id, force) -> - force = force || false - return trackCache[id] if !force && trackCache[id] - trackDef = new $.Deferred() - $http.get('/api/web/tracks/' + id + '?log=true').success (track) -> - trackDef.resolve track + fetch: (id, force) -> + force = force || false + return trackCache[id] if !force && trackCache[id] + trackDef = new $.Deferred() + $http.get('/api/web/tracks/' + id + '?log=true').success (track) -> + trackDef.resolve track - trackCache[id] = trackDef.promise() + trackCache[id] = trackDef.promise() - createQuery: -> new Query self.filters + createQuery: -> new Query self.filters - loadFilters: -> - return filterDef if filterDef + loadFilters: -> + return filterDef if filterDef - filterDef = new $.Deferred() - self.filters.isVocal = - type: 'single' - name: 'vocal' - values: [ - {title: 'Either', query: '', isDefault: true, filter: ''}, - {title: 'Yes', query: 'yes', isDefault: false, filter: 'is_vocal=true'}, - {title: 'No', query: 'no', isDefault: false, filter: 'is_vocal=false'} - ] + filterDef = new $.Deferred() + self.filters.isVocal = + type: 'single' + name: 'vocal' + values: [ + {title: 'Either', query: '', isDefault: true, filter: ''}, + {title: 'Yes', query: 'yes', isDefault: false, filter: 'is_vocal=true'}, + {title: 'No', query: 'no', isDefault: false, filter: 'is_vocal=false'} + ] - self.filters.sort = - type: 'single' - name: 'sort' - values: [ - {title: 'Latest', query: '', isDefault: true, filter: 'order=published_at,desc'}, - {title: 'Most Played', query: 'plays', isDefault: false, filter: 'order=play_count,desc'}, - {title: 'Most Downloaded', query: 'downloads', isDefault: false, filter: 'order=download_count,desc'}, - {title: 'Most Favourited', query: 'favourites', isDefault: false, filter: 'order=favourite_count,desc'} - {title: 'Alphabetical', query: 'alphabetical', isDefault: false, filter: 'order=title,asc'}, - ] + self.filters.sort = + type: 'single' + name: 'sort' + values: [ + {title: 'Latest', query: '', isDefault: true, filter: 'order=published_at,desc'}, + {title: 'Most Played', query: 'plays', isDefault: false, filter: 'order=play_count,desc'}, + {title: 'Most Downloaded', query: 'downloads', isDefault: false, filter: 'order=download_count,desc'}, + {title: 'Most Favourited', query: 'favourites', isDefault: false, filter: 'order=favourite_count,desc'} + {title: 'Alphabetical', query: 'alphabetical', isDefault: false, filter: 'order=title,asc'}, + ] - self.filters.genres = - type: 'list' - name: 'genres' - values: [] - filterName: 'genres' + self.filters.genres = + type: 'list' + name: 'genres' + values: [] + filterName: 'genres' - self.filters.trackTypes = - type: 'list' - name: 'types' - values: [] - filterName: 'types' + self.filters.trackTypes = + type: 'list' + name: 'types' + values: [] + filterName: 'types' - self.filters.showSongs = - type: 'list' - name: 'songs' - values: [] - filterName: 'songs' + self.filters.showSongs = + type: 'list' + name: 'songs' + values: [] + filterName: 'songs' - taxonomies.refresh().done (taxes) -> - for genre in taxes.genresWithTracks - self.filters.genres.values.push - title: genre.name - id: genre.id + taxonomies.refresh().done (taxes) -> + for genre in taxes.genresWithTracks + self.filters.genres.values.push + title: genre.name + id: genre.id - for type in taxes.trackTypesWithTracks - self.filters.trackTypes.values.push - title: type.title - id: type.id + for type in taxes.trackTypesWithTracks + self.filters.trackTypes.values.push + title: type.title + id: type.id - for song in taxes.showSongsWithTracks - self.filters.showSongs.values.push - title: song.title - id: song.id + for song in taxes.showSongsWithTracks + self.filters.showSongs.values.push + title: song.title + id: song.id - self.mainQuery = self.createQuery() - filterDef.resolve self + self.mainQuery = self.createQuery() + filterDef.resolve self - filterDef.promise() + filterDef.promise() - self + self ]) diff --git a/resources/assets/scripts/app/services/upload.coffee b/resources/assets/scripts/app/services/upload.coffee index d7ed71a0..34f08b72 100644 --- a/resources/assets/scripts/app/services/upload.coffee +++ b/resources/assets/scripts/app/services/upload.coffee @@ -1,51 +1,51 @@ angular.module('ponyfm').factory('upload', [ - '$rootScope' - ($rootScope) -> - self = - queue: [] + '$rootScope' + ($rootScope) -> + self = + queue: [] - upload: (files) -> - _.each files, (file) -> - upload = - name: file.name - progress: 0 - uploadedSize: 0 - size: file.size - index: self.queue.length - isUploading: true - success: false - error: null + upload: (files) -> + _.each files, (file) -> + upload = + name: file.name + progress: 0 + uploadedSize: 0 + size: file.size + index: self.queue.length + isUploading: true + success: false + error: null - self.queue.push upload - $rootScope.$broadcast 'upload-added', upload + self.queue.push upload + $rootScope.$broadcast 'upload-added', upload - xhr = new XMLHttpRequest() - xhr.upload.onprogress = (e) -> - $rootScope.$apply -> - upload.uploadedSize = e.loaded - upload.progress = e.loaded / upload.size * 100 - $rootScope.$broadcast 'upload-progress', upload + xhr = new XMLHttpRequest() + xhr.upload.onprogress = (e) -> + $rootScope.$apply -> + upload.uploadedSize = e.loaded + upload.progress = e.loaded / upload.size * 100 + $rootScope.$broadcast 'upload-progress', upload - xhr.onload = -> $rootScope.$apply -> - upload.isUploading = false - if xhr.status != 200 - error = - if xhr.getResponseHeader('content-type') == 'application/json' - $.parseJSON(xhr.responseText).errors.track.join ', ' - else - 'There was an unknown error!' + xhr.onload = -> $rootScope.$apply -> + upload.isUploading = false + if xhr.status != 200 + error = + if xhr.getResponseHeader('content-type') == 'application/json' + $.parseJSON(xhr.responseText).errors.track.join ', ' + else + 'There was an unknown error!' - upload.error = error - $rootScope.$broadcast 'upload-error', [upload, error] - else - upload.success = true - upload.trackId = $.parseJSON(xhr.responseText).id + upload.error = error + $rootScope.$broadcast 'upload-error', [upload, error] + else + upload.success = true + upload.trackId = $.parseJSON(xhr.responseText).id - $rootScope.$broadcast 'upload-finished', upload - formData = new FormData(); - formData.append('track', file); + $rootScope.$broadcast 'upload-finished', upload + formData = new FormData(); + formData.append('track', file); - xhr.open 'POST', '/api/web/tracks/upload', true - xhr.setRequestHeader 'X-CSRF-Token', pfm.token - xhr.send formData + xhr.open 'POST', '/api/web/tracks/upload', true + xhr.setRequestHeader 'X-CSRF-Token', pfm.token + xhr.send formData ]) diff --git a/resources/assets/styles/account-content.less b/resources/assets/styles/account-content.less index 80e07e72..f2907eb9 100644 --- a/resources/assets/styles/account-content.less +++ b/resources/assets/styles/account-content.less @@ -10,58 +10,58 @@ ul.playlists { margin-top: 10px; li { - overflow: hidden; - margin: 0px; - padding: 0px; - height: 40px; - border-bottom: 1px solid #ddd; + overflow: hidden; + margin: 0px; + padding: 0px; + height: 40px; + border-bottom: 1px solid #ddd; - img { - border-right: 1px solid #ddd; - padding: 0px; - display: block; - height: 40px; - width: 40px; - float: left; - } + img { + border-right: 1px solid #ddd; + padding: 0px; + display: block; + height: 40px; + width: 40px; + float: left; + } - .btn-group { - float: right; - display: block; - margin-top: 7px; - margin-right: 7px; + .btn-group { + float: right; + display: block; + margin-top: 7px; + margin-right: 7px; - .btn { - .border-radius(0px); - } - } + .btn { + .border-radius(0px); + } + } - a.main { - display: block; - text-decoration: none; - color: #444; + a.main { + display: block; + text-decoration: none; + color: #444; - .is-public { - display: block; - float: right; - font-weight: bold; - margin-top: 10px; - margin-right: 10px; - font-size: 8pt; - } + .is-public { + display: block; + float: right; + font-weight: bold; + margin-top: 10px; + margin-right: 10px; + font-size: 8pt; + } - .title { - .ellipsis(); - margin-left: 50px; - line-height: 40px; - height: 40px; - display: block; - } + .title { + .ellipsis(); + margin-left: 50px; + line-height: 40px; + height: 40px; + display: block; + } - &:hover { - background: #eee; - } - } + &:hover { + background: #eee; + } + } } } @@ -71,65 +71,65 @@ ul.playlists { overflow-y: auto; ul { - list-style: none; - padding: 0px; - margin: 0px; + list-style: none; + padding: 0px; + margin: 0px; - li { - margin: 0px; - float: left; - width: 20%; - cursor: pointer; + li { + margin: 0px; + float: left; + width: 20%; + cursor: pointer; - img { - .transition(all 400ms); - display: block; - width: 100px; - height: 100px; - } + img { + .transition(all 400ms); + display: block; + width: 100px; + height: 100px; + } - &:hover { - img { - opacity: .8; - } - } - } + &:hover { + img { + opacity: .8; + } + } + } } } html { .two-pane-view.closed { - .account-albums-listing { - li { - .box-sizing(border-box); - width: 20%; + .account-albums-listing { + li { + .box-sizing(border-box); + width: 20%; - a { - padding: 15px; + a { + padding: 15px; - .image { - .img-polaroid(); - position: relative; - left: -5px; - width: 100%; - height: auto; - float: none; - } + .image { + .img-polaroid(); + position: relative; + left: -5px; + width: 100%; + height: auto; + float: none; + } - .title { - margin: 0px; - font-size: 12pt; - padding: 0px; - margin-top: 5px; - } + .title { + margin: 0px; + font-size: 12pt; + padding: 0px; + margin-top: 5px; + } - .published { - margin: 0px; - padding: 0px; - } - } - } - } + .published { + margin: 0px; + padding: 0px; + } + } + } + } } } @@ -140,222 +140,222 @@ html { list-style: none; li { - .box-sizing(border-box); + .box-sizing(border-box); - padding: 0px; - margin: 0px; - line-height: normal; + padding: 0px; + margin: 0px; + line-height: normal; - &.empty { - .alert(); - float: none !important; - width: auto !important; - display: block; - padding: 5px; - font-size: 9pt; - } + &.empty { + .alert(); + float: none !important; + width: auto !important; + display: block; + padding: 5px; + font-size: 9pt; + } - &.is-not-published a { - background: fadeout(@yellow, 90%); - } + &.is-not-published a { + background: fadeout(@yellow, 90%); + } - &.selected, &.selected:hover { - a { - background: @pfm-purple; - cursor: default; - color: #fff; + &.selected, &.selected:hover { + a { + background: @pfm-purple; + cursor: default; + color: #fff; - .published { - color: #eee; - } - } - } + .published { + color: #eee; + } + } + } - a { - .transition(350px ease-out all); + a { + .transition(350px ease-out all); - display: block; - margin: 0px; - padding: 5px; - font-size: 9pt; - font-weight: normal; - overflow: hidden; + display: block; + margin: 0px; + padding: 5px; + font-size: 9pt; + font-weight: normal; + overflow: hidden; - .image { - width: 32px; - height: 32px; - float: left; - display: block; - } + .image { + width: 32px; + height: 32px; + float: left; + display: block; + } - .title { - .ellipsis(); - display: block; - margin-left: 37px; - } + .title { + .ellipsis(); + display: block; + margin-left: 37px; + } - .published { - display: block; - color: #777; - margin-left: 37px; - font-size: 8pt; - } + .published { + display: block; + color: #777; + margin-left: 37px; + font-size: 8pt; + } - &:hover { - background: #ddd; - text-decoration: none; - } - } + &:hover { + background: #ddd; + text-decoration: none; + } + } } } .two-pane-view { .list { - .dropdowns { - margin-top: 0px; - } + .dropdowns { + margin-top: 0px; + } } .editor { - display: none; + display: none; - .album-track-listing { - padding: 0px; - clear: both; - margin: 0px; - margin-top: 10px; - list-style: none; + .album-track-listing { + padding: 0px; + clear: both; + margin: 0px; + margin-top: 10px; + list-style: none; - li { - overflow: hidden; - line-height: normal; - padding: 0px; - margin: 0px; - font-size: 8pt; - border-bottom: 1px dashed #ddd; + li { + overflow: hidden; + line-height: normal; + padding: 0px; + margin: 0px; + font-size: 8pt; + border-bottom: 1px dashed #ddd; - div { - padding: 2px; - } + div { + padding: 2px; + } - span { - display: block; - float: left; - margin-left: 5px; - margin-top: 2px; - } + span { + display: block; + float: left; + margin-left: 5px; + margin-top: 2px; + } - .btn { - line-height: normal; - padding: 2px 5px; - margin: 0px; - } + .btn { + line-height: normal; + padding: 2px 5px; + margin: 0px; + } - &.ui-sortable-helper { - #gradient>.vertical(@dropdownLinkBackgroundHover, darken(@dropdownLinkBackgroundHover, 5%)); - border: none; - color: #fff; - } + &.ui-sortable-helper { + #gradient>.vertical(@dropdownLinkBackgroundHover, darken(@dropdownLinkBackgroundHover, 5%)); + border: none; + color: #fff; + } - &.ui-sortable-placeholder { - background: @yellow; - } - } - } + &.ui-sortable-placeholder { + background: @yellow; + } + } + } - .show-songs, .album { - .btn { - display: block; - float: none; - } - } + .show-songs, .album { + .btn { + display: block; + float: none; + } + } - .show-songs, .album, .track-selector { - .btn { - .border-radius(0px); - padding: 3px 10px; - font-size: 8pt; - text-align: left; - } + .show-songs, .album, .track-selector { + .btn { + .border-radius(0px); + padding: 3px 10px; + font-size: 8pt; + text-align: left; + } - .error { - margin-top: 10px; - } + .error { + margin-top: 10px; + } - .pfm-popup { - width: 300px; + .pfm-popup { + width: 300px; - ul { - margin: 0px; - padding: 0px; - list-style: none; + ul { + margin: 0px; + padding: 0px; + list-style: none; - li { - margin: 0px; - padding: 0px; + li { + margin: 0px; + padding: 0px; - a { - .ellipsis(); - display: block; - padding: 3px 10px; - font-size: 8pt; - color: #333333; + a { + .ellipsis(); + display: block; + padding: 3px 10px; + font-size: 8pt; + color: #333333; - &:hover { - #gradient>.vertical(@dropdownLinkBackgroundHover, darken(@dropdownLinkBackgroundHover, 5%)); - text-decoration: none; - color: @dropdownLinkColorHover; - } - } + &:hover { + #gradient>.vertical(@dropdownLinkBackgroundHover, darken(@dropdownLinkBackgroundHover, 5%)); + text-decoration: none; + color: @dropdownLinkColorHover; + } + } - &.selected { - a { - #gradient>.vertical(@green, darken(@green, 5%)); - color: #fff; - font-weight: bold; + &.selected { + a { + #gradient>.vertical(@green, darken(@green, 5%)); + color: #fff; + font-weight: bold; - &:hover { - #gradient>.vertical(fadeout(@green, 20%), fadeout(darken(@green, 5%), 20%)); - } - } - } - } - } - } - } + &:hover { + #gradient>.vertical(fadeout(@green, 20%), fadeout(darken(@green, 5%), 20%)); + } + } + } + } + } + } + } } &.closed { - .account-tracks-listing, .account-albums-listing { - .clearfix(); + .account-tracks-listing, .account-albums-listing { + .clearfix(); - li { - float: left; - width: 25%; + li { + float: left; + width: 25%; - &.empty { - } - } - } + &.empty { + } + } + } } &.open { - .list { - border-right: 2px solid #ddd; + .list { + border-right: 2px solid #ddd; - width: 250px; - float: left; - } + width: 250px; + float: left; + } - .editor { - margin-left: 260px; - margin-right: 10px; - display: block; + .editor { + margin-left: 260px; + margin-right: 10px; + display: block; - .stretch-to-bottom { - padding-right: 10px; - } - } + .stretch-to-bottom { + padding-right: 10px; + } + } } } @@ -366,53 +366,53 @@ html { list-style: none; li { - float: left; - width: 25%; + float: left; + width: 25%; - > div { - margin: 0px 5px; - border: 1px solid #ddd; - padding: 10px; - cursor: pointer; + > div { + margin: 0px 5px; + border: 1px solid #ddd; + padding: 10px; + cursor: pointer; - strong { - font-size: 9pt; - display: block; - margin: 0px; - margin-bottom: 5px; - padding: 0px; - line-height: normal; - } - } + strong { + font-size: 9pt; + display: block; + margin: 0px; + margin-bottom: 5px; + padding: 0px; + line-height: normal; + } + } - p { - min-height: 120px; - font-size: 9pt; - } + p { + min-height: 120px; + font-size: 9pt; + } - a { - .border-radius(0px); - display: block; - width: auto; - } + a { + .border-radius(0px); + display: block; + width: auto; + } - &.selected { - > div { - cursor: default; - border-color: @blue; - } - } + &.selected { + > div { + cursor: default; + border-color: @blue; + } + } - &:hover > div { - border: 1px solid #3366CC; - } + &:hover > div { + border: 1px solid #3366CC; + } - &:first-child > div { - margin-left: 0px; - } + &:first-child > div { + margin-left: 0px; + } - &:last-child > div { - margin-right: 0px; - } + &:last-child > div { + margin-right: 0px; + } } -} \ No newline at end of file +} diff --git a/resources/assets/styles/base/bootstrap/mixins.less b/resources/assets/styles/base/bootstrap/mixins.less index 79d88921..5463b1fc 100644 --- a/resources/assets/styles/base/bootstrap/mixins.less +++ b/resources/assets/styles/base/bootstrap/mixins.less @@ -317,9 +317,9 @@ // Default value is `visible`, but can be changed to `hidden // See git pull https://github.com/dannykeane/bootstrap.git backface-visibility for examples .backface-visibility(@visibility){ - -webkit-backface-visibility: @visibility; - -moz-backface-visibility: @visibility; - backface-visibility: @visibility; + -webkit-backface-visibility: @visibility; + -moz-backface-visibility: @visibility; + backface-visibility: @visibility; } // Background clipping @@ -634,7 +634,7 @@ .offset (@columns) { margin-left: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) + (@fluidGridGutterWidth*2); - *margin-left: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) - (.5 / @gridRowWidth * 100 * 1%) + (@fluidGridGutterWidth*2) - (.5 / @gridRowWidth * 100 * 1%); + *margin-left: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) - (.5 / @gridRowWidth * 100 * 1%) + (@fluidGridGutterWidth*2) - (.5 / @gridRowWidth * 100 * 1%); } .offsetFirstChild (@columns) { diff --git a/resources/assets/styles/body.less b/resources/assets/styles/body.less index 874b8040..64eba8f8 100644 --- a/resources/assets/styles/body.less +++ b/resources/assets/styles/body.less @@ -5,7 +5,7 @@ a { color: #C2889C; &:hover { - text-decoration: none; + text-decoration: none; } } @@ -14,24 +14,24 @@ a { padding: 10px; h1 { - margin: 1px 1px 5px; - font-size: 15pt; - color: #C2889C; - line-height: normal; - overflow: hidden; - font-weight: normal; + margin: 1px 1px 5px; + font-size: 15pt; + color: #C2889C; + line-height: normal; + overflow: hidden; + font-weight: normal; } } .about-page { h2 { - margin: 0px; - margin-bottom: 5px; - font-size: 13pt; - color: #C2889C; - line-height: normal; - overflow: hidden; - font-weight: normal; + margin: 0px; + margin-bottom: 5px; + font-size: 13pt; + color: #C2889C; + line-height: normal; + overflow: hidden; + font-weight: normal; } } @@ -53,116 +53,116 @@ a { } .reveal { - #gradient>.vertical(rgba(255,255,255,0), rgba(255,255,255,1)); - .box-sizing(border-box); - position: absolute; - top: 0px; - left: 0px; - width: 100%; - height: 100%; - z-index: 400; - border: 2px solid #fff; - cursor: pointer; + #gradient>.vertical(rgba(255,255,255,0), rgba(255,255,255,1)); + .box-sizing(border-box); + position: absolute; + top: 0px; + left: 0px; + width: 100%; + height: 100%; + z-index: 400; + border: 2px solid #fff; + cursor: pointer; - &:hover { - border: 2px solid @blue; - } + &:hover { + border: 2px solid @blue; + } - a { - .box-sizing(border-box); - display: block; - position: absolute; - bottom: 0px; - left: 0px; - width: 100%; - background: #eee; - padding: 3px; - z-index: 500; - text-decoration: none; - font-size: 10pt; - } + a { + .box-sizing(border-box); + display: block; + position: absolute; + bottom: 0px; + left: 0px; + width: 100%; + background: #eee; + padding: 3px; + z-index: 500; + text-decoration: none; + font-size: 10pt; + } } } .details-columns { .left { - margin-right: 310px; - margin-left: 5px; + margin-right: 310px; + margin-left: 5px; } .right { - float: right; - width: 290px; - height: 100%; - padding-right: 10px; + float: right; + width: 290px; + height: 100%; + padding-right: 10px; - img.cover { - .img-polaroid(); - padding: 2px; - } + img.cover { + .img-polaroid(); + padding: 2px; + } - .stats { - list-style: none; - padding: 0px; - margin: 0px; - font-size: 9pt; - color: #555; + .stats { + list-style: none; + padding: 0px; + margin: 0px; + font-size: 9pt; + color: #555; - li { - padding: 5px 0px; - margin: 0px; - border-bottom: 1px solid #ddd; + li { + padding: 5px 0px; + margin: 0px; + border-bottom: 1px solid #ddd; - strong { - color: #111; - } - } - } + strong { + color: #111; + } + } + } } } .comments { form { - margin: 0px; - margin-bottom: 10px; + margin: 0px; + margin-bottom: 10px; - .form-row { - margin: 0px; - } + .form-row { + margin: 0px; + } - input[type=text] { - margin: 0px; - padding: 5px; - } + input[type=text] { + margin: 0px; + padding: 5px; + } } ul { - list-style: none; - margin: 0px; - padding: 0px; + list-style: none; + margin: 0px; + padding: 0px; - li { - line-height: normal; - padding: 5px 0px; - margin: 0px; - overflow: hidden; + li { + line-height: normal; + padding: 5px 0px; + margin: 0px; + overflow: hidden; - img { - .img-polaroid(); - float: left; - padding: 1px; - height: 32px; - width: 32px; - } + img { + .img-polaroid(); + float: left; + padding: 1px; + height: 32px; + width: 32px; + } - .meta { - font-size: 8pt; - padding: 5px 0px; - } + .meta { + font-size: 8pt; + padding: 5px 0px; + } - .content { - margin-left: 42px; - } - } + .content { + margin-left: 42px; + } + } } -} \ No newline at end of file +} diff --git a/resources/assets/styles/components.less b/resources/assets/styles/components.less index 0ecb10c0..cf9bf31f 100644 --- a/resources/assets/styles/components.less +++ b/resources/assets/styles/components.less @@ -14,78 +14,78 @@ margin-bottom: 10px; > li { - float: left; - margin: 0px; - padding: 0px; - margin-right: 10px; - line-height: normal; + float: left; + margin: 0px; + padding: 0px; + margin-right: 10px; + line-height: normal; - > .btn { - float: left; - display: block; - } + > .btn { + float: left; + display: block; + } - > .btn + .btn { - .transition(background 300ms ease-out); + > .btn + .btn { + .transition(background 300ms ease-out); - display: none; - margin: 0px; - } + display: none; + margin: 0px; + } - &.has-filter { - > .btn { - background: @pfm-purple; - color: #fff; - } + &.has-filter { + > .btn { + background: @pfm-purple; + color: #fff; + } - > .btn + .btn { - display: block; - background: darken(@pfm-purple, 20%); + > .btn + .btn { + display: block; + background: darken(@pfm-purple, 20%); - &:hover { - background: darken(@pfm-purple, 40%); - } - } - } + &:hover { + background: darken(@pfm-purple, 40%); + } + } + } - &.open { - > .btn { - background: @pfm-purple; - color: #fff; - } + &.open { + > .btn { + background: @pfm-purple; + color: #fff; + } - .dropdown-menu { - .box-shadow(none); + .dropdown-menu { + .box-shadow(none); - margin: 0px; - border: 2px solid @pfm-purple; + margin: 0px; + border: 2px solid @pfm-purple; - li.selected { - a { - background: @pfm-purple; - color: #fff; - } - } + li.selected { + a { + background: @pfm-purple; + color: #fff; + } + } - li { - a:hover { - background: lighten(@pfm-purple, 5%); - } - } - } - } + li { + a:hover { + background: lighten(@pfm-purple, 5%); + } + } + } + } - > .btn { - border: none; - background: #eee; - font-size: 8pt; - padding: 3px 7px; - text-shadow: none; + > .btn { + border: none; + background: #eee; + font-size: 8pt; + padding: 3px 7px; + text-shadow: none; - &.btn-info { - background: @pfm-purple; - } - } + &.btn-info { + background: @pfm-purple; + } + } } } @@ -100,30 +100,30 @@ font-size: 15px; li { - margin: 0px; - float: left; - line-height: normal; + margin: 0px; + float: left; + line-height: normal; - a { - padding: 5px 13px; - display: block; - color: #555; + a { + padding: 5px 13px; + display: block; + color: #555; - &:hover { - text-decoration: none; - background: #eee; - } - } + &:hover { + text-decoration: none; + background: #eee; + } + } - &.active { - a { - cursor: default; - background: #eee; - color: #000; - border-bottom: 4px solid #C1889E; - margin-bottom: -4px; - } - } + &.active { + a { + cursor: default; + background: #eee; + color: #000; + border-bottom: 4px solid #C1889E; + margin-bottom: -4px; + } + } } } @@ -131,29 +131,29 @@ ui-view { display: block; &:before { - .transition(opacity 250ms); + .transition(opacity 250ms); - opacity: 0; - background: #fff; - content: ' '; - top: 0px; - left: 0px; - z-index: 999; - width: 0px; - height: 0px; - position: absolute; - display: block; - overflow: hidden; + opacity: 0; + background: #fff; + content: ' '; + top: 0px; + left: 0px; + z-index: 999; + width: 0px; + height: 0px; + position: absolute; + display: block; + overflow: hidden; } &.loading { - position: relative; + position: relative; - &:before { - opacity: .8; - width: 100%; - height: 100%; - } + &:before { + opacity: .8; + width: 100%; + height: 100%; + } } } @@ -166,51 +166,51 @@ ui-view { overflow: hidden; li { - float: left; + float: left; - a, button { - .border-radius(0px); - font-size: 9pt; - } + a, button { + .border-radius(0px); + font-size: 9pt; + } - &.delete { - float: right; - } + &.delete { + float: right; + } } } html body { .btn { - .border-radius(0px); + .border-radius(0px); } .btn.btn-primary, .add-btn, .btn-success { - background: @pfm-purple; - color: #fff; + background: @pfm-purple; + color: #fff; } .btn-success.disabled { - background: @pfm-purple; - color: #eee; + background: @pfm-purple; + color: #eee; } .ui-datepicker { - .border-radius(0px); + .border-radius(0px); - font-size: 9pt; - padding: 3px; + font-size: 9pt; + padding: 3px; - .ui-datepicker-header { - .border-radius(0px); - border: none; - border-bottom: 1px solid #777; - margin: -3px; - } + .ui-datepicker-header { + .border-radius(0px); + border: none; + border-bottom: 1px solid #777; + margin: -3px; + } } .alert { - .border-radius(0px); - margin-bottom: 10px; + .border-radius(0px); + margin-bottom: 10px; } } @@ -220,31 +220,31 @@ html .dropdown-menu { overflow-y: auto; > li { - margin: 0px; + margin: 0px; - > a { - padding: 3px 10px; - font-size: 8pt; - } + > a { + padding: 3px 10px; + font-size: 8pt; + } - > .dont-close { - float: right; - display: block; - width: 24px; - text-align: center; - padding: 3px 3px; - } + > .dont-close { + float: right; + display: block; + width: 24px; + text-align: center; + padding: 3px 3px; + } - > .dont-close + a { - margin-right: 30px; - clear: none; - } + > .dont-close + a { + margin-right: 30px; + clear: none; + } - &.selected { - > .dont-close i:before { - content: "\f068"; - } - } + &.selected { + > .dont-close i:before { + content: "\f068"; + } + } } } @@ -258,7 +258,7 @@ html .dropdown-menu { overflow-y: auto; &.open { - display: block; + display: block; } } @@ -266,128 +266,128 @@ html .dropdown-menu { overflow: hidden; .error { - clear: left; - margin-top: 14px; + clear: left; + margin-top: 14px; } input[type=file] { - display: none; + display: none; } .btn { - .border-radius(0px) !important; + .border-radius(0px) !important; } .preview { - .img-polaroid(); - overflow: hidden; - width: 46px; - height: 46px; - float: left; + .img-polaroid(); + overflow: hidden; + width: 46px; + height: 46px; + float: left; - img { - position: relative; - display: block; - width: 100%; - } + img { + position: relative; + display: block; + width: 100%; + } - &.canOpen { - cursor: pointer; + &.canOpen { + cursor: pointer; - &:hover { - border-color: @blue; - border-style: solid; - } - } + &:hover { + border-color: @blue; + border-style: solid; + } + } } p, .btn-group { - color: #555; - margin-left: 60px; - display: block; - margin-bottom: 1px; + color: #555; + margin-left: 60px; + display: block; + margin-bottom: 1px; } p { - font-size: 9pt; + font-size: 9pt; } } .modal { form { - margin: 0px; + margin: 0px; } } html { .modal-backdrop { - background: #fff; + background: #fff; } .modal { - .border-radius(0px); + .border-radius(0px); - border: 2px solid @pfm-purple; + border: 2px solid @pfm-purple; - h2 { - font-size: 12pt; - color: #C2889C; - line-height: normal; - margin-bottom: 5px; + h2 { + font-size: 12pt; + color: #C2889C; + line-height: normal; + margin-bottom: 5px; - small { - font-size: 10pt; - } - } + small { + font-size: 10pt; + } + } } .breadcrumb { - .border-radius(0px); - background: #eee; - margin-bottom: 10px; - font-size: 10pt; + .border-radius(0px); + background: #eee; + margin-bottom: 10px; + font-size: 10pt; } .pagination { - border: none; - background: #eee; - margin: 0px; - margin-bottom: 10px; - padding: 0px; - overflow: hidden; + border: none; + background: #eee; + margin: 0px; + margin-bottom: 10px; + padding: 0px; + overflow: hidden; - ul { - .border-radius(0px); - margin: 5px; - display: block; - overflow: hidden; + ul { + .border-radius(0px); + margin: 5px; + display: block; + overflow: hidden; - > li:first-child > a, > li:last-child > a { - .border-radius(0px); - } + > li:first-child > a, > li:last-child > a { + .border-radius(0px); + } - li { - display: block; - float: left; + li { + display: block; + float: left; - a { - .border-radius(0px); - border: none; - padding: 1px 10px; - display: block; - float: left; - color: @pfm-purple; - } - } + a { + .border-radius(0px); + border: none; + padding: 1px 10px; + display: block; + float: left; + color: @pfm-purple; + } + } - li.active a { - background: #C1889E; - color: #fff; - } - } + li.active a { + background: #C1889E; + color: #fff; + } + } - &.pagination-right { - float: right; - } + &.pagination-right { + float: right; + } } -} \ No newline at end of file +} diff --git a/resources/assets/styles/content.less b/resources/assets/styles/content.less index 33e1e977..385ba462 100644 --- a/resources/assets/styles/content.less +++ b/resources/assets/styles/content.less @@ -4,32 +4,32 @@ @media (max-width: 1300px) and (min-width: 720px) { html { - .albums-listing, .playlists-listing, .artist-listing { - &.two-columns li { - width: auto; - float: none; - } + .albums-listing, .playlists-listing, .artist-listing { + &.two-columns li { + width: auto; + float: none; + } - li { - width: 33.33333%; - } - } + li { + width: 33.33333%; + } + } } } @media (max-width: 720px) { html { - .albums-listing, .playlists-listing, .artist-listing { - &.two-columns li { - width: auto; - float: none; - } + .albums-listing, .playlists-listing, .artist-listing { + &.two-columns li { + width: auto; + float: none; + } - li { - width: auto; - float: none; - } - } + li { + width: auto; + float: none; + } + } } } @@ -40,108 +40,108 @@ overflow: hidden; &.two-columns { - li { - width: 50%; - } + li { + width: 50%; + } } li { - .box-sizing(border-box); - float: left; - width: 25%; - padding: 5px; - line-height: normal; + .box-sizing(border-box); + float: left; + width: 25%; + padding: 5px; + line-height: normal; - a { - background: #eee; - display: block; - overflow: hidden; - position: relative; + a { + background: #eee; + display: block; + overflow: hidden; + position: relative; - img { - display: block; - float: left; - width: 67px; - height: 67px; - background: #ddd; - } + img { + display: block; + float: left; + width: 67px; + height: 67px; + background: #ddd; + } - .info { - margin-left: 72px; - display: block; - } + .info { + margin-left: 72px; + display: block; + } - .title, .published, .stats { - display: block; - color: #444; - padding: 5px; - } + .title, .published, .stats { + display: block; + color: #444; + padding: 5px; + } - .title { - .ellipsis(); + .title { + .ellipsis(); - font-weight: bold; - font-size: 11pt; - padding-left: 3px; - padding-bottom: 0px; - } + font-weight: bold; + font-size: 11pt; + padding-left: 3px; + padding-bottom: 0px; + } - .published { - font-size: 8pt; - color: #555; - } + .published { + font-size: 8pt; + color: #555; + } - .published, .stats { - padding-top: 0px; - } + .published, .stats { + padding-top: 0px; + } - .stats { - font-size: 10pt; - color: #777; - position: absolute; - bottom: 3px; - right: 3px; + .stats { + font-size: 10pt; + color: #777; + position: absolute; + bottom: 3px; + right: 3px; - strong { - font-weight: normal; - } - } + strong { + font-weight: normal; + } + } - &:hover { - text-decoration: none; - background: #ddd; - } - } + &:hover { + text-decoration: none; + background: #ddd; + } + } } } .resource-details { &.track-details { - > header { - h2, h1 { - margin-left: 47px; - } - } + > header { + h2, h1 { + margin-left: 47px; + } + } } &.artist-details { - > header { - .tabs { - clear: left; - margin: 0px; - margin-top: 5px; - border: none; - font-size: 9pt; + > header { + .tabs { + clear: left; + margin: 0px; + margin-top: 5px; + border: none; + font-size: 9pt; - li.active { - a { - border: none; - background: #C1889E; - color: #fff; - } - } - } - } + li.active { + a { + border: none; + background: #C1889E; + color: #fff; + } + } + } + } &.x-archived { background: #eee; @@ -149,76 +149,76 @@ } .share-buttons { - .transition(opacity 250ms ease-out); - margin-top: 5px; - opacity: 0; - overflow: hidden; - height: 28px; + .transition(opacity 250ms ease-out); + margin-top: 5px; + opacity: 0; + overflow: hidden; + height: 28px; - &.loaded { - opacity: 1; - overflow: visible; - } + &.loaded { + opacity: 1; + overflow: visible; + } - .facebook, .twitter { - margin-top: 3px; - } + .facebook, .twitter { + margin-top: 3px; + } } > header { - padding: 5px; - background: #eee; - overflow: hidden; - margin-bottom: 10px; + padding: 5px; + background: #eee; + overflow: hidden; + margin-bottom: 10px; - h1 { - margin: 0px; - } + h1 { + margin: 0px; + } - h2 { - margin: 0px; - padding: 0px; - font-weight: normal; - clear: none; - line-height: normal; - display: block; - float: none; - font-size: 8pt; - color: #777; - border: none; + h2 { + margin: 0px; + padding: 0px; + font-weight: normal; + clear: none; + line-height: normal; + display: block; + float: none; + font-size: 8pt; + color: #777; + border: none; - a { - display: inline; - float: none; - color: #111; - } - } + a { + display: inline; + float: none; + color: #111; + } + } } h2 { - color: #C2889C; - font-size: 10pt; - border-bottom: 2px solid #ddd; - padding: 5px 0px; - margin: 0px; - margin-bottom: 5px; - line-height: normal; + color: #C2889C; + font-size: 10pt; + border-bottom: 2px solid #ddd; + padding: 5px 0px; + margin: 0px; + margin-bottom: 5px; + line-height: normal; } .resource-toolbar { - .clearfix(); + .clearfix(); - background: #eee; - list-style: none; - padding: 0px; - margin: 0px; - margin-bottom: 5px; + background: #eee; + list-style: none; + padding: 0px; + margin: 0px; + margin-bottom: 5px; - > li { - padding: 5px; - float: left; - margin: 0px; - } + > li { + padding: 5px; + float: left; + margin: 0px; + } } } @@ -226,62 +226,62 @@ @media (max-width: 1300px) and (min-width: 720px) { html { - .tracks-listing { - &.four-columns li { - width: 33.333%; - } + .tracks-listing { + &.four-columns li { + width: 33.333%; + } - &.three-columns li { - width: 50%; - } + &.three-columns li { + width: 50%; + } - &.two-columns li { - width: auto; - float: none; - } - } + &.two-columns li { + width: auto; + float: none; + } + } } } @media (max-width: 720px) { html { - .tracks-listing { - &.four-columns li { - width: auto; - float: none; - } + .tracks-listing { + &.four-columns li { + width: auto; + float: none; + } - &.three-columns li { - width: auto; - float: none; - } + &.three-columns li { + width: auto; + float: none; + } - &.two-columns li { - width: auto; - float: none; - } - } + &.two-columns li { + width: auto; + float: none; + } + } } } .tracks-listing.four-columns { li { - float: left; - width: 25%; + float: left; + width: 25%; } } .tracks-listing.three-columns { li { - float: left; - width: 33.3333%; + float: left; + width: 33.3333%; } } .tracks-listing.two-columns { li { - float: left; - width: 50%; + float: left; + width: 50%; } } @@ -296,52 +296,52 @@ html .single-player .play-button { position: relative; .play-button { - .transition(background 250ms ease-out); + .transition(background 250ms ease-out); - position: absolute; - top: 0px; - left: 0px; - width: 100%; - height: 100%; - line-height: 45px; - text-align: center; - font-size: 12pt; - color: #fff; - text-decoration: none; - background: rgba(0, 0, 0, .4); - display: none; - pointer-events: all; + position: absolute; + top: 0px; + left: 0px; + width: 100%; + height: 100%; + line-height: 45px; + text-align: center; + font-size: 12pt; + color: #fff; + text-decoration: none; + background: rgba(0, 0, 0, .4); + display: none; + pointer-events: all; - &:hover { - background: rgba(0, 0, 0, .8); - } + &:hover { + background: rgba(0, 0, 0, .8); + } } img { - display: block; - width: 100%; - pointer-events: none; + display: block; + width: 100%; + pointer-events: none; } } html { li { - &.empty { - .border-radius(0px); - background: lighten(@pfm-purple, 30%); - border: 1px solid lighten(@pfm-purple, 10%); - color: lighten(@pfm-purple, 3%); - float: none !important; - width: auto !important; - display: block; - margin-top: 5px; - padding: 5px; - font-size: 9pt; + &.empty { + .border-radius(0px); + background: lighten(@pfm-purple, 30%); + border: 1px solid lighten(@pfm-purple, 10%); + color: lighten(@pfm-purple, 3%); + float: none !important; + width: auto !important; + display: block; + margin-top: 5px; + padding: 5px; + font-size: 9pt; - &:hover { - background-color: lighten(@pfm-purple, 30%); - } - } + &:hover { + background-color: lighten(@pfm-purple, 30%); + } + } } } @@ -352,109 +352,109 @@ html { overflow: hidden; li { - .box-sizing(border-box); - overflow: hidden; + .box-sizing(border-box); + overflow: hidden; - line-height: normal; - padding: 0px; - padding: 5px 0px; - padding-right: 10px; - position: relative; + line-height: normal; + padding: 0px; + padding: 5px 0px; + padding-right: 10px; + position: relative; - .icons { - float: right; - display: block; - margin-top: 5px; + .icons { + float: right; + display: block; + margin-top: 5px; - i.icon-microphone-off { - opacity: .5; - } + i.icon-microphone-off { + opacity: .5; + } - i.icon-microphone-off, i.icon-microphone { - color: #777; - } + i.icon-microphone-off, i.icon-microphone { + color: #777; + } - a { - text-decoration: none; - } - } + a { + text-decoration: none; + } + } - a.info { - display: block; - margin-left: (@icon-size + 10); + a.info { + display: block; + margin-left: (@icon-size + 10); - &:hover { - text-decoration: none; - } + &:hover { + text-decoration: none; + } - > span { - display: block; - } - } + > span { + display: block; + } + } - .title { - .ellipsis(); + .title { + .ellipsis(); - color: #000; - margin-top: 5px; - } + color: #000; + margin-top: 5px; + } - .artist { - .ellipsis(); - } + .artist { + .ellipsis(); + } - .artist, .stats, .genre, .stats-expanded { - color: #777; - font-size: 80%; - } + .artist, .stats, .genre, .stats-expanded { + color: #777; + font-size: 80%; + } - .stats { - float: right; - padding: 3px; + .stats { + float: right; + padding: 3px; - strong { - color: #C1889E; - } - } + strong { + color: #C1889E; + } + } - .artist, .stats { - margin-top: 2px; - } + .artist, .stats { + margin-top: 2px; + } - &:hover { - background: #dedede; + &:hover { + background: #dedede; - .image { - .play-button { - display: block; - } - } - } + .image { + .play-button { + display: block; + } + } + } - &.is-playing { - background: #ddd; - } + &.is-playing { + background: #ddd; + } - &.has-played { - background: red; - } + &.has-played { + background: red; + } - &.is-favourited { - .icons { - a.icon-favourite { - color: @orange; - text-decoration: none; + &.is-favourited { + .icons { + a.icon-favourite { + color: @orange; + text-decoration: none; - i { - color: #FFD76E; - text-shadow: 0px 0px 2px rgba(0,0,0,0.8); + i { + color: #FFD76E; + text-shadow: 0px 0px 2px rgba(0,0,0,0.8); - &:before { - content: "\f005" - } - } - } - } - } + &:before { + content: "\f005" + } + } + } + } + } } } diff --git a/resources/assets/styles/dashboard.less b/resources/assets/styles/dashboard.less index 5cec0732..45264300 100644 --- a/resources/assets/styles/dashboard.less +++ b/resources/assets/styles/dashboard.less @@ -2,120 +2,120 @@ .dashboard { h1 { - background: @pfm-purple; - color: #fff; - font-size: 10pt; - padding: 5px; - margin: 0px 0px 5px; + background: @pfm-purple; + color: #fff; + font-size: 10pt; + padding: 5px; + margin: 0px 0px 5px; } } @media (max-width: 1300px) and (min-width: 720px) { html .dashboard { - .recent-tracks { - width: 50%; + .recent-tracks { + width: 50%; - .tracks-listing > li:nth-child(1n+15) { - display: none; - } - } + .tracks-listing > li:nth-child(1n+15) { + display: none; + } + } - .popular-tracks { - width: 50%; - float: right; - } + .popular-tracks { + width: 50%; + float: right; + } - .news { - width: 50%; - clear: left; - } + .news { + width: 50%; + clear: left; + } } } @media (max-width: 720px) { html .dashboard { - section { - float: none !important; - width: auto !important; - } + section { + float: none !important; + width: auto !important; + } } } .dashboard { .welcome { - float: none; - width: auto; - margin-bottom: 10px; + float: none; + width: auto; + margin-bottom: 10px; } h1 { - a { - color: #fff; - display: block; - float: right; - font-size: 10pt; - background: darken(@pfm-purple, 20%); - margin: -5px; - margin-left: 0px; - padding: 5px; - } + a { + color: #fff; + display: block; + float: right; + font-size: 10pt; + background: darken(@pfm-purple, 20%); + margin: -5px; + margin-left: 0px; + padding: 5px; + } } section { - .box-sizing(border-box); + .box-sizing(border-box); - padding: 5px; - float: left; + padding: 5px; + float: left; } .recent-tracks { - width: 37.5%; + width: 37.5%; } .popular-tracks { - width: 37.5%; + width: 37.5%; } .news { - width: 25%; + width: 25%; - ul { - list-style: none; - padding: 0px; - margin: 0px; + ul { + list-style: none; + padding: 0px; + margin: 0px; - li { - margin: 0px; - padding: 0px; + li { + margin: 0px; + padding: 0px; - &.read { - a { - background: #eee; - border-left-color: #ddd; - } - } + &.read { + a { + background: #eee; + border-left-color: #ddd; + } + } - a { - .ellipsis(); + a { + .ellipsis(); - color: #000; - display: block; - padding: 5px; - font-size: 10pt; - background: lighten(@pfm-purple, 30%); - border-left: 5px solid @pfm-purple; - margin: 5px 0px; - overflow: hidden; + color: #000; + display: block; + padding: 5px; + font-size: 10pt; + background: lighten(@pfm-purple, 30%); + border-left: 5px solid @pfm-purple; + margin: 5px 0px; + overflow: hidden; - em { - display: block; - color: #444; - float: right; - font-size: 8pt; - font-style: normal; - } - } - } - } + em { + display: block; + color: #444; + float: right; + font-size: 8pt; + font-style: normal; + } + } + } + } } } diff --git a/resources/assets/styles/embed.less b/resources/assets/styles/embed.less index a1b5b8c4..e902fcf7 100644 --- a/resources/assets/styles/embed.less +++ b/resources/assets/styles/embed.less @@ -8,129 +8,129 @@ body { padding: 10px; a { - color: #C2889C; + color: #C2889C; - &:hover { - text-decoration: none; - } + &:hover { + text-decoration: none; + } } } .player { &.playing .play .button i:before { - content: "\f04c"; + content: "\f04c"; } &.favourited .meta .favourite { - color: @orange; - text-decoration: none; + color: @orange; + text-decoration: none; - i { - color: #FFD76E; - text-shadow: 0px 0px 2px rgba(0,0,0,0.8); + i { + color: #FFD76E; + text-shadow: 0px 0px 2px rgba(0,0,0,0.8); - &:before { - content: "\f005" - } - } + &:before { + content: "\f005" + } + } } .play { - .img-polaroid(); + .img-polaroid(); - float: left; - width: 100px; - padding: 3px; - position: relative; - cursor: pointer; + float: left; + width: 100px; + padding: 3px; + position: relative; + cursor: pointer; - img { - display: block; - width: 100px; - height: 100px; - } + img { + display: block; + width: 100px; + height: 100px; + } - &:hover { - .button { - background: rgba(0, 0, 0, 1); - border: 3px solid rgba(255, 255, 255, .9); - } - } + &:hover { + .button { + background: rgba(0, 0, 0, 1); + border: 3px solid rgba(255, 255, 255, .9); + } + } - .button { - .border-radius(60px); - .transition(all 250ms ease-out); + .button { + .border-radius(60px); + .transition(all 250ms ease-out); - border: 3px solid rgba(255, 255, 255, .6); - width: 32px; - height: 32px; - position: absolute; - top: 35px; - left: 35px; - text-align: center; - line-height: 32px; - color: #fff; - background: rgba(0, 0, 0, .4); - } + border: 3px solid rgba(255, 255, 255, .6); + width: 32px; + height: 32px; + position: absolute; + top: 35px; + left: 35px; + text-align: center; + line-height: 32px; + color: #fff; + background: rgba(0, 0, 0, .4); + } } .meta { - margin-left: 115px; - font-size: 11px; + margin-left: 115px; + font-size: 11px; - .favourite { - display: block; - float: right; - font-size: 18px; - margin-top: -3px; - color: #2795b6; + .favourite { + display: block; + float: right; + font-size: 18px; + margin-top: -3px; + color: #2795b6; - &:hover { - text-decoration: none; - } - } + &:hover { + text-decoration: none; + } + } - span { - display: block; - } + span { + display: block; + } - .title { - .ellipsis(); - margin-top: 5px; - font-size: 16px; - } + .title { + .ellipsis(); + margin-top: 5px; + font-size: 16px; + } - .progressbar { - cursor: pointer; - height: 11px; - background: #fff; - border: 1px solid #888; - margin-right: 27px; - position: relative; + .progressbar { + cursor: pointer; + height: 11px; + background: #fff; + border: 1px solid #888; + margin-right: 27px; + position: relative; - .loader, .seeker { - height: 100%; - position: absolute; - top: 0px; - left: 0px; - } + .loader, .seeker { + height: 100%; + position: absolute; + top: 0px; + left: 0px; + } - .loader { - background: #eee; - } + .loader { + background: #eee; + } - .seeker { - background: @pfm-purple; - } - } + .seeker { + background: @pfm-purple; + } + } } .stats { - position: absolute; - bottom: 5px; - right: 5px; - font-size: 8pt; - color: #555; + position: absolute; + bottom: 5px; + right: 5px; + font-size: 8pt; + color: #555; } -} \ No newline at end of file +} diff --git a/resources/assets/styles/forms.less b/resources/assets/styles/forms.less index 4775d55a..3450ccfb 100644 --- a/resources/assets/styles/forms.less +++ b/resources/assets/styles/forms.less @@ -4,27 +4,27 @@ margin-bottom: 10px; .error { - .alert(); - .alert-error(); + .alert(); + .alert-error(); - display: none; - padding: 3px; - font-size: 8pt; + display: none; + padding: 3px; + font-size: 8pt; } .alert { - padding: 3px; - font-size: 8pt; + padding: 3px; + font-size: 8pt; } } .has-error { label { - color: @red; + color: @red; } .error { - display: block; + display: block; } } @@ -48,7 +48,7 @@ input[type="text"], input[type="password"], input[type="date"], textarea, select width: 100%; &:focus { - .box-shadow(none); + .box-shadow(none); } } @@ -60,9 +60,9 @@ select { label { input[type="checkbox"] { - margin: 0px; - margin-top: -2px; - vertical-align: middle; + margin: 0px; + margin-top: -2px; + vertical-align: middle; } } diff --git a/resources/assets/styles/layout.less b/resources/assets/styles/layout.less index 77990e01..d91c58fb 100644 --- a/resources/assets/styles/layout.less +++ b/resources/assets/styles/layout.less @@ -14,77 +14,77 @@ html body { header { > a { - display: block; - float: left; - width: (@pfm-sidebar-size); - height: 64px; - line-height: 42px; - background: #84528A; - color: #fff; - font-size: 24pt; - font-weight: lighter; - position: relative; - z-index: 600; - font-family: 'Josefin Sans', sans-serif; - position: relative; + display: block; + float: left; + width: (@pfm-sidebar-size); + height: 64px; + line-height: 42px; + background: #84528A; + color: #fff; + font-size: 24pt; + font-weight: lighter; + position: relative; + z-index: 600; + font-family: 'Josefin Sans', sans-serif; + position: relative; - &:hover { - background: darken(#84528A, 25%); - color: #fff; - text-decoration: none; - } + &:hover { + background: darken(#84528A, 25%); + color: #fff; + text-decoration: none; + } - img.logo { - padding-left: 6px; + img.logo { + padding-left: 6px; width: 100%; - max-width: 90%; - padding-top: 13px; - max-height: 45% - } + max-width: 90%; + padding-top: 13px; + max-height: 45% + } } .user-details { - float: right; - margin-right: 10px; - margin-top: 9px; + float: right; + margin-right: 10px; + margin-top: 9px; - .avatar { - .img-polaroid(); + .avatar { + .img-polaroid(); - display: block; - float: right; - padding: 2px; - cursor: pointer; + display: block; + float: right; + padding: 2px; + cursor: pointer; - &:hover { - background: #ddd; - } + &:hover { + background: #ddd; + } - span { - font-weight: bold; - display: inline-block; - padding: 0px 3px; - } - } + span { + font-weight: bold; + display: inline-block; + padding: 0px 3px; + } + } - .dropdown-menu { - left: auto; - right: 0px; - } + .dropdown-menu { + left: auto; + right: 0px; + } - .name { - float: left; - height: 44px; - line-height: 44px; - padding-right: 10px; - font-weight: bold; - font-size: 12pt; - } + .name { + float: left; + height: 44px; + line-height: 44px; + padding-right: 10px; + font-weight: bold; + font-size: 12pt; + } - img { - height: 40px; - width: 40px; - } + img { + height: 40px; + width: 40px; + } } } @@ -109,18 +109,18 @@ header { position: relative; li { - margin: 0px; - padding: 0px; - line-height: normal; + margin: 0px; + padding: 0px; + line-height: normal; - &.selected { - background: #fff; + &.selected { + background: #fff; - > a, > a:hover { - cursor: default; - color: #000; - } - } + > a, > a:hover { + cursor: default; + color: #000; + } + } &.x-attribution { position: absolute; @@ -142,75 +142,75 @@ header { } } - h3 { - padding: 10px 25px; - padding-right: 10px; - margin: 0px; - font-size: 10pt; - color: #eee; - background: darken(#515151, 5%); - line-height: normal; + h3 { + padding: 10px 25px; + padding-right: 10px; + margin: 0px; + font-size: 10pt; + color: #eee; + background: darken(#515151, 5%); + line-height: normal; - a { - display: block; - float: right; - width: 20px; - text-align: center; - color: #fff; + a { + display: block; + float: right; + width: 20px; + text-align: center; + color: #fff; - &:hover { - text-decoration: none; - color: #000; - } - } - } + &:hover { + text-decoration: none; + color: #000; + } + } + } - .dropdown-menu a { - color: #000; - } + .dropdown-menu a { + color: #000; + } - &:hover > a.dropdown-toggle { - display: block; - } + &:hover > a.dropdown-toggle { + display: block; + } - > a.dropdown-toggle { - float: right; - padding: 10px 0px; - display: none; - } + > a.dropdown-toggle { + float: right; + padding: 10px 0px; + display: none; + } - > a { - display: block; - padding: 10px 25px; - padding-right: 0px; - overflow: hidden; - color: fadeout(#fff, 20%); + > a { + display: block; + padding: 10px 25px; + padding-right: 0px; + overflow: hidden; + color: fadeout(#fff, 20%); - &:hover { - color: #fff; - } + &:hover { + color: #fff; + } - > i { - display: block; - float: right; - width: 20px; - text-align: center; - margin-right: 10px; - } + > i { + display: block; + float: right; + width: 20px; + text-align: center; + margin-right: 10px; + } - &:hover { - text-decoration: none; - } - } + &:hover { + text-decoration: none; + } + } } li.none { - span { - display: block; - padding: 5px 25px; - color: #555; - font-style: italic; - } + span { + display: block; + padding: 5px 25px; + color: #555; + font-style: italic; + } } } diff --git a/resources/assets/styles/mixins.less b/resources/assets/styles/mixins.less index ddd6434d..fe4291b4 100644 --- a/resources/assets/styles/mixins.less +++ b/resources/assets/styles/mixins.less @@ -4,13 +4,13 @@ list-style: none; li { - margin: 0px; - padding: 0px; - float: left; + margin: 0px; + padding: 0px; + float: left; - a { - display: block; - } + a { + display: block; + } } } @@ -33,51 +33,51 @@ .navigation-list(); li, a { - float: left; + float: left; } } .transform(@string){ -webkit-transform: @string; - -moz-transform: @string; - -ms-transform: @string; - -o-transform: @string; + -moz-transform: @string; + -ms-transform: @string; + -o-transform: @string; } .scale (@factor) { -webkit-transform: scale(@factor); - -moz-transform: scale(@factor); - -ms-transform: scale(@factor); - -o-transform: scale(@factor); + -moz-transform: scale(@factor); + -ms-transform: scale(@factor); + -o-transform: scale(@factor); } .rotate (@deg) { -webkit-transform: rotate(@deg); - -moz-transform: rotate(@deg); - -ms-transform: rotate(@deg); - -o-transform: rotate(@deg); + -moz-transform: rotate(@deg); + -ms-transform: rotate(@deg); + -o-transform: rotate(@deg); } .skew (@deg, @deg2) { -webkit-transform: skew(@deg, @deg2); - -moz-transform: skew(@deg, @deg2); - -ms-transform: skew(@deg, @deg2); - -o-transform: skew(@deg, @deg2); + -moz-transform: skew(@deg, @deg2); + -ms-transform: skew(@deg, @deg2); + -o-transform: skew(@deg, @deg2); } .translate (@x, @y:0) { -webkit-transform: translate(@x, @y); - -moz-transform: translate(@x, @y); - -ms-transform: translate(@x, @y); - -o-transform: translate(@x, @y); + -moz-transform: translate(@x, @y); + -ms-transform: translate(@x, @y); + -o-transform: translate(@x, @y); } .translate3d (@x, @y: 0, @z: 0) { -webkit-transform: translate3d(@x, @y, @z); - -moz-transform: translate3d(@x, @y, @z); - -ms-transform: translate3d(@x, @y, @z); - -o-transform: translate3d(@x, @y, @z); + -moz-transform: translate3d(@x, @y, @z); + -ms-transform: translate3d(@x, @y, @z); + -o-transform: translate3d(@x, @y, @z); } .perspective (@value: 1000) { - -webkit-perspective: @value; - -moz-perspective: @value; - -ms-perspective: @value; - perspective: @value; + -webkit-perspective: @value; + -moz-perspective: @value; + -ms-perspective: @value; + perspective: @value; } .transform-origin (@x:center, @y:center) { -webkit-transform-origin: @x @y; diff --git a/resources/assets/styles/player.less b/resources/assets/styles/player.less index 8f4134a7..af1a5167 100644 --- a/resources/assets/styles/player.less +++ b/resources/assets/styles/player.less @@ -3,7 +3,7 @@ body.is-logged { .track-player { - margin-right: 75px; + margin-right: 75px; } } @@ -11,189 +11,189 @@ body.is-logged { padding: 10px; .image { - float: left; - width: 43px; - height: 43px; - position: relative; - overflow: hidden; - padding: 1px; + float: left; + width: 43px; + height: 43px; + position: relative; + overflow: hidden; + padding: 1px; - img { - .box-shadow(none); + img { + .box-shadow(none); - display: block; - width: 40px; - height: 40px; - padding: 0px; - border: 1px solid #bcbcbc; - } + display: block; + width: 40px; + height: 40px; + padding: 0px; + border: 1px solid #bcbcbc; + } - .loader { - .transition(top 250ms linear); + .loader { + .transition(top 250ms linear); - z-index: 1000; - background: rgba(0, 0, 0, .6); - color: #fff; - position: absolute; - top: -50px; - left: 2px; - width: 42px; - height: 42px; - line-height: 43px; - text-align: center; - font-size: 16px; + z-index: 1000; + background: rgba(0, 0, 0, .6); + color: #fff; + position: absolute; + top: -50px; + left: 2px; + width: 42px; + height: 42px; + line-height: 43px; + text-align: center; + font-size: 16px; - &.showing { - top: 2px; - } - } + &.showing { + top: 2px; + } + } } .inner { - margin-left: 55px; + margin-left: 55px; } .song, .artist { - .ellipsis(); - line-height: normal; - display: block; + .ellipsis(); + line-height: normal; + display: block; - a { - color: #555; + a { + color: #555; - &:hover { - text-decoration: none; - color: #111; - } - } + &:hover { + text-decoration: none; + color: #111; + } + } } .song { - font-weight: bold; + font-weight: bold; } .volume-slider { - display: none; + display: none; } .transport { - .border-radius(4px); + .border-radius(4px); - background: #aaa; - height: 5px; - position: relative; - cursor: pointer; - margin-top: 4px; + background: #aaa; + height: 5px; + position: relative; + cursor: pointer; + margin-top: 4px; - .bar { - z-index: 500; - background: #84528A; - } + .bar { + z-index: 500; + background: #84528A; + } - .loader-bar { - z-index: 200; - background: #ddd; - } + .loader-bar { + z-index: 200; + background: #ddd; + } - .bar, .loader-bar { - .border-radius(4px); + .bar, .loader-bar { + .border-radius(4px); - position: absolute; - top: 0px; - left: 0px; - height: 100%; - } + position: absolute; + top: 0px; + left: 0px; + height: 100%; + } } .buttons { - list-style: none; - margin: 0px; - padding: 0px; - float: right; + list-style: none; + margin: 0px; + padding: 0px; + float: right; - li.status { - font-size: 10pt; - margin-top: 12px; - margin-right: 5px; + li.status { + font-size: 10pt; + margin-top: 12px; + margin-right: 5px; - strong { - font-weight: normal; - } - } + strong { + font-weight: normal; + } + } - li { - line-height: normal; - float: left; - margin: 0px; - padding: 0px; - font-size: 15pt; + li { + line-height: normal; + float: left; + margin: 0px; + padding: 0px; + font-size: 15pt; - > a { - display: block; - padding: 5px 0px; - width: 40px; - text-align: center; - color: #5A5A5A; + > a { + display: block; + padding: 5px 0px; + width: 40px; + text-align: center; + color: #5A5A5A; - &:hover { - text-decoration: none; - background: darken(#eee, 10%); - color: #000; - } - } + &:hover { + text-decoration: none; + background: darken(#eee, 10%); + color: #000; + } + } - &.disabled { - a { - color: #ccc; - cursor: default; + &.disabled { + a { + color: #ccc; + cursor: default; - &:hover { - background: transparent; - color: #ccc; - } - } - } + &:hover { + background: transparent; + color: #ccc; + } + } + } - &.volume { - position: relative; + &.volume { + position: relative; - .volume-slider { - display: none; - z-index: 1000; - position: absolute; - left: 0px; - top: 33px; - width: 100%; - height: 150px; - background: #ddd; + .volume-slider { + display: none; + z-index: 1000; + position: absolute; + left: 0px; + top: 33px; + width: 100%; + height: 150px; + background: #ddd; - .bar { - background: @pfm-purple; - width: 10px; - margin: auto; - height: 100%; - position: relative; - } + .bar { + background: @pfm-purple; + width: 10px; + margin: auto; + height: 100%; + position: relative; + } - .knob { - position: absolute; - top: 0px; - left: -3px; + .knob { + position: absolute; + top: 0px; + left: -3px; - background: darken(@pfm-purple, 20%); - width: 16px; - height: 16px; - } - } + background: darken(@pfm-purple, 20%); + width: 16px; + height: 16px; + } + } - &:hover, &.keep-open { - .volume-slider { - display: block; - } + &:hover, &.keep-open { + .volume-slider { + display: block; + } - background: #ddd; - } - } - } + background: #ddd; + } + } + } } -} \ No newline at end of file +} diff --git a/resources/assets/styles/profiler.less b/resources/assets/styles/profiler.less index ad4c15e0..068ded77 100644 --- a/resources/assets/styles/profiler.less +++ b/resources/assets/styles/profiler.less @@ -1,38 +1,38 @@ html { .profiler-open { - header, .site-body { - margin-right: 403px; - } + header, .site-body { + margin-right: 403px; + } - .profiler { - width: 400px; - height: 100%; - background: rgba(0, 0, 0, .85); - border-left: 3px solid #111; + .profiler { + width: 400px; + height: 100%; + background: rgba(0, 0, 0, .85); + border-left: 3px solid #111; - .buttons { - padding: 5px; - background: #222; + .buttons { + padding: 5px; + background: #222; - .clear-button { - display: block; - } + .clear-button { + display: block; + } - .open-button { - font-size: inherit; - padding: 2px 10px; - text-indent: 0px; + .open-button { + font-size: inherit; + padding: 2px 10px; + text-indent: 0px; - i:before { - content: "\f077"; - } - } - } + i:before { + content: "\f077"; + } + } + } - .requests { - display: block; - } - } + .requests { + display: block; + } + } } } @@ -47,123 +47,123 @@ html { color: #fff; .buttons { - overflow: hidden; + overflow: hidden; - > a { - float: right; - padding: 2px 10px; - background: #e67e22; - color: #fff; + > a { + float: right; + padding: 2px 10px; + background: #e67e22; + color: #fff; - &:hover { - text-decoration: none; - } - } + &:hover { + text-decoration: none; + } + } - .clear-button { - margin-right: 5px; - display: none; - } + .clear-button { + margin-right: 5px; + display: none; + } - .open-button { - font-size: 1pt; - padding: 2px; - text-indent: -1000px; - overflow: hidden; - } + .open-button { + font-size: 1pt; + padding: 2px; + text-indent: -1000px; + overflow: hidden; + } } ul { - list-style: none; - padding: 0px; - margin: 0px; + list-style: none; + padding: 0px; + margin: 0px; - li { - margin: 0px; - padding: 0px; - line-height: normal; - } + li { + margin: 0px; + padding: 0px; + line-height: normal; + } } .requests { - display: none; - position: absolute; - top: 33px; - bottom: 0px; - left: 0px; - right: 0px; - overflow-y: auto; + display: none; + position: absolute; + top: 33px; + bottom: 0px; + left: 0px; + right: 0px; + overflow-y: auto; - > li { + > li { - h3, h4 { - padding: 5px; - margin: 0px; - line-height: normal; - font-size: 8pt; - font-weight: normal; - } + h3, h4 { + padding: 5px; + margin: 0px; + line-height: normal; + font-size: 8pt; + font-weight: normal; + } - h3 { - background: #34495e; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; + h3 { + background: #34495e; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; - .method { - display: block; - float: right; - background: #95a5a6; - padding: 5px; - margin: -5px; - min-width: 50px; - } - } + .method { + display: block; + float: right; + background: #95a5a6; + padding: 5px; + margin: -5px; + min-width: 50px; + } + } - h4 { - padding: 5px; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - cursor: pointer; + h4 { + padding: 5px; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + cursor: pointer; - &.open { - white-space: pre-wrap; - text-overflow: clip; - overflow: visible; - background: #111; - } + &.open { + white-space: pre-wrap; + text-overflow: clip; + overflow: visible; + background: #111; + } - &.log-info { - background: #7f8c8d; - } + &.log-info { + background: #7f8c8d; + } - &.log-warning { - background: #d35400; - } + &.log-warning { + background: #d35400; + } - &.log-error { - background: #c0392b; - } - } + &.log-error { + background: #c0392b; + } + } - .time { - float: right; - padding: 5px; - background: #2c3e50; - display: block; - margin-left: 5px; - } + .time { + float: right; + padding: 5px; + background: #2c3e50; + display: block; + margin-left: 5px; + } - li { - position: relative; - font-family: 'Consolas'; + li { + position: relative; + font-family: 'Consolas'; - .clear { - clear: both; - } - } - } + .clear { + clear: both; + } + } + } } -} \ No newline at end of file +} diff --git a/resources/assets/styles/uploader.less b/resources/assets/styles/uploader.less index f847ba65..88aae8a7 100644 --- a/resources/assets/styles/uploader.less +++ b/resources/assets/styles/uploader.less @@ -2,89 +2,89 @@ .uploader { h1 { - margin: 10px 0px; + margin: 10px 0px; } .dropzone { - border: 2px dotted @pfm-purple; - background: lighten(@pfm-purple, 25%); - padding: 10px; - color: darken(@pfm-purple, 25%); - margin-bottom: 10px; + border: 2px dotted @pfm-purple; + background: lighten(@pfm-purple, 25%); + padding: 10px; + color: darken(@pfm-purple, 25%); + margin-bottom: 10px; - p { - padding: 0px; - margin: 0px; - } + p { + padding: 0px; + margin: 0px; + } - &.file-over { - background: lighten(@pfm-purple, 5%); - } + &.file-over { + background: lighten(@pfm-purple, 5%); + } } .close-button { - .border-radius(0px); - width: auto; - margin-bottom: 10px; - float: none; - display: block; + .border-radius(0px); + width: auto; + margin-bottom: 10px; + float: none; + display: block; } .uploads { - margin: 0px; - padding: 0px; - list-style: none; + margin: 0px; + padding: 0px; + list-style: none; - li { - margin-bottom: 5px; - background: #eee; - font-size: 9pt; - position: relative; - z-index: 1; - color: #444; - border: 2px solid #aaa; + li { + margin-bottom: 5px; + background: #eee; + font-size: 9pt; + position: relative; + z-index: 1; + color: #444; + border: 2px solid #aaa; - p { - margin: 5px; - padding: 0px; - height: 26px; - line-height: 26px; + p { + margin: 5px; + padding: 0px; + height: 26px; + line-height: 26px; - a { - } - } + a { + } + } - .bar { - position: absolute; - bottom: 0px; - left: 0px; - height: 10px; - z-index: -1; - background: @pfm-purple; - display: none; - } + .bar { + position: absolute; + bottom: 0px; + left: 0px; + height: 10px; + z-index: -1; + background: @pfm-purple; + display: none; + } - &.has-error { - border-color: @red; + &.has-error { + border-color: @red; - .bar { - display: none; - } - } + .bar { + display: none; + } + } - &.uploading { - .bar { - display: block; - } - } + &.uploading { + .bar { + display: block; + } + } - &.is-processing { - border-color: @blue; + &.is-processing { + border-color: @blue; - .bar { - display: none; - } - } - } + .bar { + display: none; + } + } + } } -} \ No newline at end of file +} diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 74dcad01..a7514075 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -92,13 +92,13 @@ return [ ], ], - "audio" => "The :attribute must be an audio file.", - "audio_channels" => "The :attribute contains an invalid number of channels.", - "audio_format" => "The :attribute does not contain audio in a valid format.", - "required_when" => "The :attribute field cannot be left blank.", - "sample_rate" => "The :attribute has an invalid sample rate.", - "min_width" => "The :attribute is not wide enough.", - "min_height" => "The :attribute is not tall enough.", + "audio" => "The :attribute must be an audio file.", + "audio_channels" => "The :attribute contains an invalid number of channels.", + "audio_format" => "The :attribute does not contain audio in a valid format.", + "required_when" => "The :attribute field cannot be left blank.", + "sample_rate" => "The :attribute has an invalid sample rate.", + "min_width" => "The :attribute is not wide enough.", + "min_height" => "The :attribute is not tall enough.", "textarea_length" => "The :attribute must be less than 250 characters long.", // @TODO: Figure out how to retrieve the parameter from the validation rule /* diff --git a/resources/views/albums/index.blade.php b/resources/views/albums/index.blade.php index 88c8783d..c3018841 100644 --- a/resources/views/albums/index.blade.php +++ b/resources/views/albums/index.blade.php @@ -1,6 +1,6 @@ @extends('shared._app_layout') @section('app_content') -

    Album Listing!

    -

    This page should be what search engines see

    -@endsection \ No newline at end of file +

    Album Listing!

    +

    This page should be what search engines see

    +@endsection diff --git a/resources/views/albums/show.blade.php b/resources/views/albums/show.blade.php index ff1c68da..5f7c234c 100644 --- a/resources/views/albums/show.blade.php +++ b/resources/views/albums/show.blade.php @@ -1,6 +1,6 @@ @extends('shared._app_layout') @section('app_content') -

    Album!

    -

    This page should be what search engines see

    -@endsection \ No newline at end of file +

    Album!

    +

    This page should be what search engines see

    +@endsection diff --git a/resources/views/artists/index.blade.php b/resources/views/artists/index.blade.php index efc046b9..c51ce652 100644 --- a/resources/views/artists/index.blade.php +++ b/resources/views/artists/index.blade.php @@ -1,6 +1,6 @@ @extends('shared._app_layout') @section('app_content') -

    Artist Listing!

    -

    This page should be what search engines see

    -@endsection \ No newline at end of file +

    Artist Listing!

    +

    This page should be what search engines see

    +@endsection diff --git a/resources/views/artists/profile.blade.php b/resources/views/artists/profile.blade.php index ec68134b..5af894d9 100644 --- a/resources/views/artists/profile.blade.php +++ b/resources/views/artists/profile.blade.php @@ -1,6 +1,6 @@ @extends('shared._app_layout') @section('app_content') -

    Artist Profile!

    -

    This page should be what search engines see

    -@endsection \ No newline at end of file +

    Artist Profile!

    +

    This page should be what search engines see

    +@endsection diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index f9b58441..72cc3afa 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -1,6 +1,6 @@ @extends('shared._app_layout') @section('app_content') -

    Login

    -

    This page should be what search engines see

    -@endsection \ No newline at end of file +

    Login

    +

    This page should be what search engines see

    +@endsection diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 8f70767c..427099a5 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -1,6 +1,6 @@ @extends('shared._app_layout') @section('app_content') -

    Register

    -

    This page should be what search engines see

    -@endsection \ No newline at end of file +

    Register

    +

    This page should be what search engines see

    +@endsection diff --git a/resources/views/errors/400.blade.php b/resources/views/errors/400.blade.php index bfc98077..e285d2ba 100644 --- a/resources/views/errors/400.blade.php +++ b/resources/views/errors/400.blade.php @@ -1,12 +1,12 @@ @extends('shared._app_layout') @section('app_content') -

    400 - Invalid Request

    -

    Your request was invalid.

    +

    400 - Invalid Request

    +

    Your request was invalid.

    @endsection @section('app_scripts') - -@endsection \ No newline at end of file + +@endsection diff --git a/resources/views/errors/403.blade.php b/resources/views/errors/403.blade.php index 3c1d4e61..2acb4622 100644 --- a/resources/views/errors/403.blade.php +++ b/resources/views/errors/403.blade.php @@ -1,12 +1,12 @@ @extends('shared._app_layout') @section('app_content') -

    403 - Not Authorized

    -

    You cannot do this.

    +

    403 - Not Authorized

    +

    You cannot do this.

    @endsection @section('app_scripts') - -@endsection \ No newline at end of file + +@endsection diff --git a/resources/views/errors/404.blade.php b/resources/views/errors/404.blade.php index 05b9d0ed..53d6d4e5 100644 --- a/resources/views/errors/404.blade.php +++ b/resources/views/errors/404.blade.php @@ -1,12 +1,12 @@ @extends('shared._app_layout') @section('app_content') -

    404 - Not Found

    -

    We could not find what you were looking for.

    +

    404 - Not Found

    +

    We could not find what you were looking for.

    @endsection @section('app_scripts') - -@endsection \ No newline at end of file + +@endsection diff --git a/resources/views/errors/500.blade.php b/resources/views/errors/500.blade.php index 809aac05..cecc7832 100644 --- a/resources/views/errors/500.blade.php +++ b/resources/views/errors/500.blade.php @@ -1,12 +1,12 @@ @extends('shared._app_layout') @section('app_content') -

    400 - Server Error

    -

    There was an error in the server.

    +

    400 - Server Error

    +

    There was an error in the server.

    @endsection @section('app_scripts') - -@endsection \ No newline at end of file + +@endsection diff --git a/resources/views/home/index.blade.php b/resources/views/home/index.blade.php index aa6e3cf7..57643d6a 100644 --- a/resources/views/home/index.blade.php +++ b/resources/views/home/index.blade.php @@ -1,12 +1,12 @@ @extends('shared._app_layout') @section('app_content') -

    Welcome to Pony.fm

    -

    The pony fan music site. By bronies, for bronies.

    -

    - We provide a comprehensive set of free tools to host, distribute, and catalogue your music, integrated with a rich community experience for artists and listeners alike. -

    -

    - Features include unlimited downloads, unlimited uploads, lossless uploads and much more! Click here for more details! -

    -@endsection \ No newline at end of file +

    Welcome to Pony.fm

    +

    The pony fan music site. By bronies, for bronies.

    +

    + We provide a comprehensive set of free tools to host, distribute, and catalogue your music, integrated with a rich community experience for artists and listeners alike. +

    +

    + Features include unlimited downloads, unlimited uploads, lossless uploads and much more! Click here for more details! +

    +@endsection diff --git a/resources/views/pages/about.blade.php b/resources/views/pages/about.blade.php index eb7d6bcb..80edb83e 100644 --- a/resources/views/pages/about.blade.php +++ b/resources/views/pages/about.blade.php @@ -1,5 +1,5 @@ @extends('shared._app_layout') @section('app_content') - {{Helpers::template('pages/about.html')}} -@endsection \ No newline at end of file + {{Helpers::template('pages/about.html')}} +@endsection diff --git a/resources/views/pages/faq.blade.php b/resources/views/pages/faq.blade.php index 00ebfbfa..c7abb588 100644 --- a/resources/views/pages/faq.blade.php +++ b/resources/views/pages/faq.blade.php @@ -1,5 +1,5 @@ @extends('shared._app_layout') @section('app_content') - {{Helpers::template('pages/faq.html')}} -@endsection \ No newline at end of file + {{Helpers::template('pages/faq.html')}} +@endsection diff --git a/resources/views/playlists/index.blade.php b/resources/views/playlists/index.blade.php index 4626fe77..430f584a 100644 --- a/resources/views/playlists/index.blade.php +++ b/resources/views/playlists/index.blade.php @@ -1,6 +1,6 @@ @extends('shared._app_layout') @section('app_content') -

    Playlist Listing!

    -

    This page should be what search engines see

    -@endsection \ No newline at end of file +

    Playlist Listing!

    +

    This page should be what search engines see

    +@endsection diff --git a/resources/views/playlists/show.blade.php b/resources/views/playlists/show.blade.php index 51d87fff..0333a696 100644 --- a/resources/views/playlists/show.blade.php +++ b/resources/views/playlists/show.blade.php @@ -1,6 +1,6 @@ @extends('shared._app_layout') @section('app_content') -

    A Playlist!

    -

    This page should be what search engines see

    -@endsection \ No newline at end of file +

    A Playlist!

    +

    This page should be what search engines see

    +@endsection diff --git a/resources/views/shared/_app_layout.blade.php b/resources/views/shared/_app_layout.blade.php index 22904a48..47fddc8b 100644 --- a/resources/views/shared/_app_layout.blade.php +++ b/resources/views/shared/_app_layout.blade.php @@ -2,85 +2,85 @@ @section('content') -
    +
    - + (function(d, s, id){ + var js, fjs = d.getElementsByTagName(s)[0]; + if (d.getElementById(id)) {return;} + js = d.createElement(s); js.id = id; + js.src = "//connect.facebook.net/en_US/all.js"; + fjs.parentNode.insertBefore(js, fjs); + }(document, 'script', 'facebook-jssdk')); + -
    - +
    + - + -
    - @if (Auth::check()) - - @endif - -
    -
    +
    + @if (Auth::check()) + + @endif + +
    +
    -
    - + + @yield('app_content') + +
    @endsection @section('styles') - - - {!! Assets::styleIncludes() !!} + + + {!! Assets::styleIncludes() !!} @endsection @section('scripts') - + }; + @if(config('ponyfm.google_analytics_id')) @endif - {!! Assets::scriptIncludes() !!} + {!! Assets::scriptIncludes() !!} @if (!Config::get("app.debug")) @endif - @yield('app_scripts') + @yield('app_scripts') @endsection diff --git a/resources/views/shared/_layout.blade.php b/resources/views/shared/_layout.blade.php index 49638465..1045fba8 100644 --- a/resources/views/shared/_layout.blade.php +++ b/resources/views/shared/_layout.blade.php @@ -1,17 +1,17 @@ - - - - Pony.fm - - - + + + + Pony.fm + + + - @yield('styles') - - - @yield('content') - @yield('scripts') - - \ No newline at end of file + @yield('styles') + + + @yield('content') + @yield('scripts') + + diff --git a/resources/views/shared/null.blade.php b/resources/views/shared/null.blade.php index 771f9b9d..f14af87e 100644 --- a/resources/views/shared/null.blade.php +++ b/resources/views/shared/null.blade.php @@ -1,5 +1,5 @@ @extends('shared._app_layout') @section('app_content') -

    If you see this page, something went wrong.

    -@endsection \ No newline at end of file +

    If you see this page, something went wrong.

    +@endsection diff --git a/resources/views/tracks/embed.blade.php b/resources/views/tracks/embed.blade.php index 591cef95..01dc870a 100644 --- a/resources/views/tracks/embed.blade.php +++ b/resources/views/tracks/embed.blade.php @@ -1,56 +1,56 @@ - - {{$track->title}} by {{$track->user->display_name}} on Pony.fm - - - - - - - - + + {{$track->title}} by {{$track->user->display_name}} on Pony.fm + + + + + + + + - {!! Assets::styleIncludes('embed') !!} + {!! Assets::styleIncludes('embed') !!} - @if($track->explicit && !(Auth::check() && Auth::user()->can_see_explicit_content)) -
    - Enable explicit content in your account to play this track. -
    - Hosted by Pony.fm -
    -
    - @else -
    -
    -
    - -
    -
    - @if (Auth::check()) - - @endif -
    -
    -
    -
    - {{ $track->title }} - by: {{ $track->user->display_name }} / {{$track->genre->name}} / {!! Helpers::timestamp($track->published_at) !!} -
    -
    - Views: {{ $track->view_count }} / Plays: {{ $track->play_count }} / Downloads: {{ $track->download_count }} / - Hosted by Pony.fm -
    -
    - @endif + @if($track->explicit && !(Auth::check() && Auth::user()->can_see_explicit_content)) +
    + Enable explicit content in your account to play this track. +
    + Hosted by Pony.fm +
    +
    + @else +
    +
    +
    + +
    +
    + @if (Auth::check()) + + @endif +
    +
    +
    +
    + {{ $track->title }} + by: {{ $track->user->display_name }} / {{$track->genre->name}} / {!! Helpers::timestamp($track->published_at) !!} +
    +
    + Views: {{ $track->view_count }} / Plays: {{ $track->play_count }} / Downloads: {{ $track->download_count }} / + Hosted by Pony.fm +
    +
    + @endif - + - {!! Assets::scriptIncludes('embed') !!} + {!! Assets::scriptIncludes('embed') !!} @if(config('ponyfm.google_analytics_id'))