diff --git a/README.md b/README.md
index dbf2992..fc55187 100644
--- a/README.md
+++ b/README.md
@@ -106,6 +106,7 @@ And that's it! you can upload the files to your website, or zip them up and uplo
`file`
> The name of the file in the /media folder
+> Not required if entry is set to "locked"
\
`title` (optional)
@@ -121,12 +122,48 @@ And that's it! you can upload the files to your website, or zip them up and uplo
`type` (optional)
> The type of the media.
> Can be either `"audio"` or `"video"`
-> Defaults to "audio"
+> Defaults to `"audio"`
\
`info` (optional)
> Extra text for this file, such as for lyrics or artist attributions. This will be optionally shown over/under the cover image, or togglable below the track.
+\
+`locked` (optional)
+> If `true`, sets this file as "locked" preventing it from being playable.
+> Can be either `true` or `false`
+> Defaults to `false`
+> Enable this if e.g. you want to show that this file would be available in the purchased download of your album.
+> Note: the `file` field is not required if this is enabled, you shouldn't include the file in the player.
+
+***preview options***
+
+*a preview is a section of a full track, used if e.g. you want to include a snippet of a track that would be available in the purchased download of your album.*
+*note: it is highly recommended that the file you use for a preview track is clipped to the region you want to preview, because the file can be accessed by users. Scritch will support the file in either case, however.*
+
+> e.g. `{"file": "track1.mp3", "title": "Track 1", previewStart: 12, previewEnd: 42, originalDuration: "1:20"}`
+
+\
+`previewStart` (optional, required for preview)
+> The start time for the preview section of the full track.
+> Can be a number of seconds or an H:M:S string, e.g. `125.3`, `"2:05"`, `"00:21:13.5"` are all valid.
+
+\
+`previewEnd` (optional, required for preview)
+> The end time for the preview section of the full track.
+> Can be a number of seconds or an H:M:S string, e.g. `125.3`, `"2:05"`, `"00:21:13.5"` are all valid.
+
+\
+`originalDuration` (optional, required for preview)
+> The duration of the full (unclipped) track.
+> Can be a number of seconds or an H:M:S string, e.g. `125.3`, `"2:05"`, `"00:21:13.5"` are all valid.
+
+\
+`previewFade` (optional)
+> If `true`, the player will automatically fade the audio at the start and end of the preview section.
+> Can be either `true` or `false`
+> Defaults to `true`
+
-----
**theme options**
@@ -166,6 +203,14 @@ And that's it! you can upload the files to your website, or zip them up and uplo
`primaryAltTextColor`
> Color of e.g. the track numbers and duration, and the track info button
+\
+`previewStripeColor1`
+> First color of the striped bar on a preview track.
+
+\
+`previewStripeColor2`
+> Second color of the striped bar on a preview track.
+
\
`linkColor`
> Color of links in text
diff --git a/index.html b/index.html
index 64a3255..20fb3f3 100644
--- a/index.html
+++ b/index.html
@@ -17,7 +17,9 @@
--secondaryColor: #000000;
--highlightColor: rgba(131, 131, 131, 0.3);
--primaryTextColor: #ffffff;
- --primaryAltTextColor: #838383;
+ --primaryAltTextColor: hsl(0, 0%, 51%);
+ --previewStripeColor1: #3f3f3f;
+ --previewStripeColor2: #2c2c2c;
--linkColor: #838383;
--font: sans-serif;
}
@@ -54,7 +56,7 @@
#mainContainer {
position: relative;
display: grid;
- justify-content: space-around;
+ justify-content: space-evenly;
width: 100%;
max-width: 960px;
left: 0;
@@ -112,6 +114,8 @@
#mainContainer #mediaColumn {
grid-row: 2;
grid-column: 1;
+ position: relative;
+ top: 0;
}
}
@@ -122,11 +126,16 @@
grid-row: 1/3;
grid-column: 2;
flex-direction: column;
- position: relative;
+ position: sticky;
+ top: 10px;
+ margin-left: auto;
+ margin-right: auto;
}
#mainContainer.vertical #mediaColumn {
grid-row: 2;
grid-column: 1;
+ position: relative;
+ top: 0;
}
#mainContainer.title-span #mediaColumn {
grid-row: 2/3;
@@ -303,6 +312,7 @@
flex-wrap: wrap;
flex: 1 0;
align-items: center;
+ position: relative;
}
#controls .title {
@@ -319,6 +329,7 @@
display: -webkit-box;
-webkit-box-orient: vertical;
user-select: none;
+ flex-basis: 8px;
}
#controls .riser {
@@ -330,6 +341,7 @@
align-self: end;
color: var(--primaryAltTextColor);
user-select: none;
+ text-align: right;
}
#controls #scrubberTrackContainer {
@@ -341,6 +353,26 @@
cursor: pointer;
touch-action: none;
}
+ #controls #scrubberTrackFull {
+ width: 100%;
+ height: 100%;
+ position: relative;
+ background: repeating-linear-gradient( 135deg, var(--previewStripeColor1), var(--previewStripeColor1) 8px, var(--previewStripeColor2) 8px, var(--previewStripeColor2) 16px);
+ border-radius: 12px;
+ }
+ #controls #scrubberTrackContainer #scrubberTrackPreview {
+ width: 100%;
+ height: 100%;
+ position: relative;
+ }
+ #controls #scrubberTrackContainer.preview #scrubberTrackPreview {
+ border: 2px solid var(--backgroundColor);
+ box-sizing: content-box;
+ top: -2px;
+ left: -2px;
+ margin-right: -4px;
+ border-radius: 12px;
+ }
#controls #scrubberTrack {
background-color: var(--primaryAltColor);
overflow: hidden;
@@ -388,6 +420,9 @@
align-items: center;
user-select: none;
height: 20px;
+ position: absolute;
+ right: 0;
+ bottom: 0;
}
#controls #volumeContainer #volumeTrackContainer {
@@ -458,7 +493,7 @@
border-radius: 6px;
}
.track.locked {
- opacity: 0.35;
+ opacity: 0.5;
}
.track.active:before {
content: '';
@@ -573,6 +608,7 @@
color: var(--primaryAltTextColor);
font-size: 14px;
flex: 0 0 30px;
+ white-space: nowrap;
}
.track .spacer {
flex: 1 1;
@@ -667,10 +703,14 @@