Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
suwacrab committed Sep 8, 2024
1 parent 4c981dd commit 621bc6f
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3668,26 +3668,26 @@ async function appendTweet(t, timelineContainer, options = {}) {
let a = document.createElement('a');
a.href = URL.createObjectURL(blob);

let ts = new Date(t.created_at).toISOString().split("T")[0];
let extension = 'gif'
let _index = t.extended_entities.media.length > 1 ? "_"+(index+1) : "";
let filename = `${t.user.screen_name}_${ts}_${t.id_str}${_index}.${extension}`;
let filename_template = vars.customDownloadTemplate;

// use the filename from the user's custom download template, if any
if(filename_template && (filename_template.length > 0)) {
const filesave_map = {
"user_screen_name": t.user.screen_name,
"user_name": t.user.name,
"extension": extension,
"timestamp": ts,
"id": t.id_str,
"index": _index,
"filename": url.pathname.substring(url.pathname.lastIndexOf('/') + 1, url.pathname.lastIndexOf('.'))
};
filename = filename_template.replace(/\{([\w]+)\}/g, (_, key) => filesave_map[key]);
}
a.download = filename;
let ts = new Date(t.created_at).toISOString().split("T")[0];
let extension = 'gif'
let _index = t.extended_entities.media.length > 1 ? "_"+(index+1) : "";
let filename = `${t.user.screen_name}_${ts}_${t.id_str}${_index}.${extension}`;
let filename_template = vars.customDownloadTemplate;

// use the filename from the user's custom download template, if any
if(filename_template && (filename_template.length > 0)) {
const filesave_map = {
"user_screen_name": t.user.screen_name,
"user_name": t.user.name,
"extension": extension,
"timestamp": ts,
"id": t.id_str,
"index": _index,
"filename": url.pathname.substring(url.pathname.lastIndexOf('/') + 1, url.pathname.lastIndexOf('.'))
};
filename = filename_template.replace(/\{([\w]+)\}/g, (_, key) => filesave_map[key]);
}
a.download = filename;

document.body.append(a);
a.click();
Expand Down

0 comments on commit 621bc6f

Please sign in to comment.