Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

Add timestamp templates to the download filename #442

Merged
merged 7 commits into from Nov 29, 2019
2 changes: 1 addition & 1 deletion src/_locales/cs/messages.json
Expand Up @@ -187,7 +187,7 @@
"download_filename_format": { "message": "Formát názvu stažených souborů" },
"download_filename_format_parameters": {
"message":
"Můžete použít následující proměnné: <code>{{postedUser}} {{tweetId}} {{fileName}} {{fileExtension}}</code>"
"Můžete použít následující proměnné: <code>{{postedUser}} {{tweetId}} {{fileName}} {{fileExtension}} {{year}} {{month}} {{day}} {{hours}} {{minutes}} {{seconds}}</code>"
},
"ctrl_changes_interactions__enabled": {
"message":
Expand Down
2 changes: 1 addition & 1 deletion src/_locales/de/messages.json
Expand Up @@ -208,7 +208,7 @@
},
"download_filename_format_parameters": {
"message":
"Du kannst die folgenden Variablen verwenden: <code>{{postedUser}} {{fileName}} {{fileExtension}}</code>"
"Du kannst die folgenden Variablen verwenden: <code>{{postedUser}} {{fileName}} {{fileExtension}} {{year}} {{month}} {{day}} {{hours}} {{minutes}} {{seconds}}</code>"
},
"ctrl_changes_interactions__enabled": {
"message":
Expand Down
2 changes: 1 addition & 1 deletion src/_locales/en/messages.json
Expand Up @@ -202,7 +202,7 @@
"download_filename_format": { "message": "Download file name format" },
"download_filename_format_parameters": {
"message":
"You can use the following variables: <code>{{postedUser}} {{tweetId}} {{fileName}} {{fileExtension}}</code>"
"You can use the following variables: <code>{{postedUser}} {{tweetId}} {{fileName}} {{fileExtension}} {{year}} {{month}} {{day}} {{hours}} {{minutes}} {{seconds}}</code>"
},
"ctrl_changes_interactions__enabled": {
"message":
Expand Down
2 changes: 1 addition & 1 deletion src/_locales/fr/messages.json
Expand Up @@ -213,7 +213,7 @@
},
"download_filename_format_parameters": {
"message":
"Vous pouvez utiliser les variables suivantes: <code>{{postedUser}} {{tweetId}} {{fileName}} {{fileExtension}}</code>"
"Vous pouvez utiliser les variables suivantes: <code>{{postedUser}} {{tweetId}} {{fileName}} {{fileExtension}} {{year}} {{month}} {{day}} {{hours}} {{minutes}} {{seconds}}</code>"
},
"ctrl_changes_interactions": {
"message":
Expand Down
2 changes: 1 addition & 1 deletion src/_locales/ja/messages.json
Expand Up @@ -202,7 +202,7 @@
"download_filename_format": { "message": "ダウンロードするファイル名のフォーマット" },
"download_filename_format_parameters": {
"message":
"次の変数が利用できます: <code>{{postedUser}}/{{tweetId}}/{{fileName}}/{{fileExtension}}</code> (それぞれツイートユーザー名/ツイートID/ファイル名/ファイルの拡張子に置換されます)"
"次の変数が利用できます: <code>{{postedUser}} {{tweetId}} {{fileName}} {{fileExtension}} {{year}} {{month}} {{day}} {{hours}} {{minutes}} {{seconds}}</code> (それぞれツイートユーザー名」「ツイートID」「ファイル名」「ファイルの拡張子」ツイートした日時の「年」「月」「日」「時」「分」「秒」に置換されます)"
},
"ctrl_changes_interactions__enabled": {
"message":
Expand Down
2 changes: 1 addition & 1 deletion src/js/background.js
Expand Up @@ -65,7 +65,7 @@ const defaultSettings = {
block_item: false,
download_item: false,
download_filename_format:
'{{postedUser}}-{{tweetId}}-{{fileName}}.{{fileExtension}}',
'{{postedUser}}-{{year}}{{month}}{{day}}-{{hours}}{{minutes}}{{seconds}}-{{tweetId}}-{{fileName}}.{{fileExtension}}',
ctrl_changes_interactions: {
enabled: false,
mode: 'owner',
Expand Down
6 changes: 6 additions & 0 deletions src/js/inject.js
Expand Up @@ -72,6 +72,12 @@ const getMediaParts = (chirp, url) => {
? chirp.retweetedStatus.user.screenName
: chirp.user.screenName,
tweetId: chirp.retweetedStatus ? chirp.retweetedStatus.id : chirp.id,
year: chirp.created.getFullYear(),
month: (chirp.created.getMonth() + 1).toString().padStart(2, '0'),
day: chirp.created.getDate().toString().padStart(2, '0'),
hours: chirp.created.getHours().toString().padStart(2, '0'),
minutes: chirp.created.getMinutes().toString().padStart(2, '0'),
seconds: chirp.created.getSeconds().toString().padStart(2, '0'),
};
};

Expand Down
2 changes: 1 addition & 1 deletion src/options/options.html
Expand Up @@ -273,7 +273,7 @@ <h2 class="section-title" data-lang="sec_content">Content</h2>
<label for="download_filename_format" data-lang="download_filename_format" data-new-feat>Download file name format</label>
<br />
<small data-lang="download_filename_format_parameters">You can use the following variables:
<code>{{postedUser}} {{tweetId}} {{fileName}} {{fileExtension}}</code>
<code>{{postedUser}} {{tweetId}} {{fileName}} {{fileExtension}} {{year}} {{month}} {{day}} {{hours}} {{minutes}} {{seconds}}</code>
</small>
</li>
<li data-setting-name="keep_hashtags">
Expand Down