Skip to content

Commit

Permalink
4.3.2
Browse files Browse the repository at this point in the history
Fixed filesize
  • Loading branch information
SuperZombi committed Feb 15, 2024
1 parent 7d7c20d commit 6570fe4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 42 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


<p align="right">
<img align="left" src="https://shields.io/badge/версия-v4.3.1-blue">
<img align="left" src="https://shields.io/badge/версия-v4.3.2-blue">
<a href="#донат"><img src="https://shields.io/badge/💲-Поддержать-2ea043"></a>
</p>

Expand Down
2 changes: 1 addition & 1 deletion chrome/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"manifest_version": 3,
"version": "4.3.1",
"version": "4.3.2",
"name": "HDrezka Helper",
"description": "__MSG_extDesc__",
"default_locale": "en",
Expand Down
20 changes: 7 additions & 13 deletions chrome/myscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,19 +389,13 @@ function script(chrome_i18n) {
}


async function getFileSize(url)
{
return new Promise((resolve, reject) => {
fetch(url, {headers: {Range: "bytes=0-0"}})
var http = new XMLHttpRequest();
http.open('HEAD', url, true);
http.onreadystatechange = function() {
if (this.readyState == this.DONE && this.status === 200) {
resolve(this.getResponseHeader('content-length'))
}
};
http.onerror = function(){resolve(false)}
http.send();
async function getFileSize(url) {
return new Promise(async (resolve) => {
let controller = new AbortController();
fetch(url, {signal: controller.signal}).then(resp=>{
resolve(resp.headers.get('Content-Length'))
controller.abort();
}).catch(_=>{resolve(0)})
})
}

Expand Down
23 changes: 9 additions & 14 deletions github/hdrezka_helper_ipad.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name HDrezka Helper (IPAD)
// @version 4.3.1
// @version 4.3.2
// @description Adds a «Download» button below the video. Export favorites and more.
// @author Super Zombi
// @match https://hdrezka.cm/*
Expand Down Expand Up @@ -259,7 +259,7 @@ GM_registerMenuCommand(get_message('settings'), ()=>{
<span style="margin-left:5px; color: blue;">GitHub</span>
</a>
<img style="margin-top:2px;" src="https://shields.io/badge/version-v4.3.1-blue">
<img style="margin-top:2px;" src="https://shields.io/badge/version-v4.3.2-blue">
</p>
`
div.appendChild(content)
Expand Down Expand Up @@ -684,18 +684,13 @@ async function downloader_wrap(){
a.appendChild(span2)
return a;
}
async function getFileSize(url){
return new Promise((resolve, reject) => {
fetch(url, {headers: {Range: "bytes=0-0"}})
var http = new XMLHttpRequest();
http.open('HEAD', url, true);
http.onreadystatechange = function() {
if (this.readyState == this.DONE && this.status === 200) {
resolve(this.getResponseHeader('content-length'))
}
};
http.onerror = function(){resolve(false)}
http.send();
async function getFileSize(url) {
return new Promise(async (resolve) => {
let controller = new AbortController();
fetch(url, {signal: controller.signal}).then(resp=>{
resolve(resp.headers.get('Content-Length'))
controller.abort();
}).catch(_=>{resolve(0)})
})
}
function formatBytes(bytes, decimals = 2) {
Expand Down
21 changes: 8 additions & 13 deletions hdrezka_helper.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name HDrezka Helper
// @version 4.3.1
// @version 4.3.2
// @description Adds a «Download» button below the video. Export favorites and more.
// @author Super Zombi
// @match https://hdrezka.cm/*
Expand Down Expand Up @@ -259,7 +259,7 @@ GM_registerMenuCommand(get_message('settings'), ()=>{
<span style="margin-left:5px; color: blue;">GitHub</span>
</a>
<img style="margin-top:2px;" src="https://shields.io/badge/version-v4.3.1-blue">
<img style="margin-top:2px;" src="https://shields.io/badge/version-v4.3.2-blue">
</p>
`
div.appendChild(content)
Expand Down Expand Up @@ -655,17 +655,12 @@ async function downloader(){
return a;
}
async function getFileSize(url) {
return new Promise((resolve, reject) => {
fetch(url, {headers: {Range: "bytes=0-0"}})
var http = new XMLHttpRequest();
http.open('HEAD', url, true);
http.onreadystatechange = function() {
if (this.readyState == this.DONE && this.status === 200) {
resolve(this.getResponseHeader('content-length'))
}
};
http.onerror = function(){resolve(false)}
http.send();
return new Promise(async (resolve) => {
let controller = new AbortController();
fetch(url, {signal: controller.signal}).then(resp=>{
resolve(resp.headers.get('Content-Length'))
controller.abort();
}).catch(_=>{resolve(0)})
})
}
function formatBytes(bytes, decimals = 2) {
Expand Down

0 comments on commit 6570fe4

Please sign in to comment.