Skip to content

Commit

Permalink
4.3.1
Browse files Browse the repository at this point in the history
Fixed subtitles extention
  • Loading branch information
SuperZombi committed Feb 9, 2024
1 parent 1b97fdb commit 7d7c20d
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 56 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.0-blue">
<img align="left" src="https://shields.io/badge/версия-v4.3.1-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.0",
"version": "4.3.1",
"name": "HDrezka Helper",
"description": "__MSG_extDesc__",
"default_locale": "en",
Expand Down
3 changes: 1 addition & 2 deletions chrome/menu/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ <h3>HDrezka Helper</h3>
<svg xmlns="http://www.w3.org/2000/svg" width="23" height="23" viewBox="0 0 24 24"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/></svg>
<span>GitHub</span>
</a>

<img style="margin-top:2px;" src="https://shields.io/badge/__MSG_versionStr__-v4.3.0-blue">
<img style="margin-top:2px;" id="version">
</p>

<script src="options.js"></script>
Expand Down
2 changes: 2 additions & 0 deletions chrome/menu/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ if (darkThemeMq.matches) {
else{
theme = "light"
}
const manifestData = chrome.runtime.getManifest();
document.querySelector("#version").src = `https://shields.io/badge/${chrome.i18n.getMessage("versionStr")}-${manifestData.version}-blue`

function obserse(element, arr){
let els = document.getElementById("main-wraper").getElementsByTagName("label")
Expand Down
47 changes: 25 additions & 22 deletions chrome/myscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ function script(chrome_i18n) {
}
}

function LOADER(){
return `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" height="50px" style="margin:auto;display:block;" >
<g transform="translate(25 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="-0.3s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
<g transform="translate(50 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="-0.16s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
<g transform="translate(75 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="0s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
</svg>`
}

async function createDownloadMenu(array){
if (!document.getElementById("downloadMenu")){
let div = document.createElement("div")
Expand All @@ -125,27 +136,12 @@ function script(chrome_i18n) {
div.style.transform = "scale(0)"
div.style.transformOrigin = "top center"
div.style.transition = "0.5s"

div.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" height="50px" style="margin:auto;display:block;" >
<g transform="translate(25 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="-0.3333333333333333s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
<g transform="translate(50 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="-0.16666666666666666s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
<g transform="translate(75 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="0s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
</svg>`

div.style.userSelect = "none"
div.innerHTML = LOADER();
document.getElementById("send-video-issue").parentNode.appendChild(div)
}
else{
document.getElementById("downloadMenu").innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" height="50px" style="margin:auto;display:block;" >
<g transform="translate(25 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="-0.3333333333333333s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
<g transform="translate(50 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="-0.16666666666666666s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
<g transform="translate(75 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="0s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
</svg>`
document.getElementById("downloadMenu").innerHTML = LOADER();
}

let div_target = document.getElementById("downloadMenu")
Expand Down Expand Up @@ -192,6 +188,7 @@ function script(chrome_i18n) {
}

function makeLink(title, href, size){
let filename = href.split('/').pop()
let a = document.createElement("a")
if (args.downloader_2){
a.title = chrome_i18n.downloadStr
Expand Down Expand Up @@ -267,7 +264,8 @@ function script(chrome_i18n) {
var file = new Blob([xhr.response], { type : 'application/octet-stream' });
let a_el = document.createElement('a')
a_el.href = window.URL.createObjectURL(file);
a_el.download = targetFileName + '.mp4';
let extension = filename.split('.').pop();
a_el.download = `${targetFileName}.${extension}`;
a_el.click();
setTimeout(function(){
close_but.click();
Expand All @@ -280,7 +278,7 @@ function script(chrome_i18n) {
else{
a.href = href
a.target = '_blank'
a.download = "video.mp4"
a.download = filename
a.title = chrome_i18n.downloadLinkDesc
}
a.style.display = "block"
Expand Down Expand Up @@ -325,7 +323,8 @@ function script(chrome_i18n) {
summary.style.color = "aqua";
summary.style.borderRadius = "8px";
summary.style.textAlign = "center";
summary.style.transition = "0.2s"
summary.style.transition = "0.2s";
summary.style.padding = "2px 0";
summary.onmouseover = function(){
summary.style.background = "blueviolet"
}
Expand All @@ -336,6 +335,10 @@ function script(chrome_i18n) {
details.appendChild(summary);
div_.appendChild(details);

let hr = document.createElement("hr");
hr.style.margin = 0;
details.appendChild(hr);

Subtitles.split(",").forEach(async function(e){
let temp = e.split("[")[1].split("]");
let lang = temp[0];
Expand Down Expand Up @@ -403,7 +406,7 @@ function script(chrome_i18n) {
}

function formatBytes(bytes, decimals = 2) {
if (bytes === 0) return '0 Bytes';
if (bytes == 0) return '';
const k = 1024;
const dm = decimals < 0 ? 0 : decimals;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
Expand Down
20 changes: 14 additions & 6 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.0
// @version 4.3.1
// @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.0-blue">
<img style="margin-top:2px;" src="https://shields.io/badge/version-v4.3.1-blue">
</p>
`
div.appendChild(content)
Expand Down Expand Up @@ -497,6 +497,7 @@ async function downloader_wrap(){
div.style.transform = "scale(0)"
div.style.transformOrigin = "top center"
div.style.transition = "0.5s"
div.style.userSelect = "none"

div.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" height="50px" style="margin:auto;display:block;" >
<g transform="translate(25 50)">
Expand Down Expand Up @@ -564,6 +565,7 @@ async function downloader_wrap(){
}

function makeLink(title, href, size){
let filename = href.split('/').pop()
let a = document.createElement("a")
if (args.database.downloader_2){
a.title = args.downloadStr
Expand Down Expand Up @@ -639,7 +641,8 @@ async function downloader_wrap(){
var file = new Blob([xhr.response], { type : 'application/octet-stream' });
let a_el = document.createElement('a')
a_el.href = window.URL.createObjectURL(file);
a_el.download = targetFileName + '.mp4';
let extension = filename.split('.').pop();
a_el.download = `${targetFileName}.${extension}`;
a_el.click();
setTimeout(function(){
close_but.click();
Expand All @@ -652,7 +655,7 @@ async function downloader_wrap(){
else{
a.href = href
a.target = '_blank'
a.download = "video.mp4"
a.download = filename
a.title = args.downloadLinkDesc
}
a.style.display = "block"
Expand Down Expand Up @@ -696,7 +699,7 @@ async function downloader_wrap(){
})
}
function formatBytes(bytes, decimals = 2) {
if (bytes === 0) return '0 Bytes';
if (bytes == 0) return '';
const k = 1024;
const dm = decimals < 0 ? 0 : decimals;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
Expand Down Expand Up @@ -755,7 +758,8 @@ async function downloader_wrap(){
summary.style.color = "aqua";
summary.style.borderRadius = "8px";
summary.style.textAlign = "center";
summary.style.transition = "0.2s"
summary.style.transition = "0.2s";
summary.style.padding = "2px 0";
summary.onmouseover = function(){
summary.style.background = "blueviolet"
}
Expand All @@ -766,6 +770,10 @@ async function downloader_wrap(){
details.appendChild(summary);
div_.appendChild(details);

let hr = document.createElement("hr");
hr.style.margin = 0;
details.appendChild(hr);

Subtitles.split(",").forEach(async function(e){
let temp = e.split("[")[1].split("]");
let lang = temp[0];
Expand Down
49 changes: 25 additions & 24 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.0
// @version 4.3.1
// @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.0-blue">
<img style="margin-top:2px;" src="https://shields.io/badge/version-v4.3.1-blue">
</p>
`
div.appendChild(content)
Expand Down Expand Up @@ -376,6 +376,15 @@ GM_registerMenuCommand(get_message('settings'), ()=>{
setTimeout(()=>{ div.style.right = 0; }, 1)
})

var LOADER = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" height="50px" style="margin:auto;display:block;" >
<g transform="translate(25 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="-0.3s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
<g transform="translate(50 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="-0.16s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
<g transform="translate(75 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="0s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
</svg>`

function main(){
let keys = GM_listValues()
if (db_get("hideVK", true)){
Expand Down Expand Up @@ -474,27 +483,12 @@ async function downloader(){
div.style.transform = "scale(0)"
div.style.transformOrigin = "top center"
div.style.transition = "0.5s"

div.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" height="50px" style="margin:auto;display:block;" >
<g transform="translate(25 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="-0.3333333333333333s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
<g transform="translate(50 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="-0.16666666666666666s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
<g transform="translate(75 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="0s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
</svg>`

div.style.userSelect = "none"
div.innerHTML = LOADER;
document.getElementById("send-video-issue").parentNode.appendChild(div)
}
else{
document.getElementById("downloadMenu").innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" height="50px" style="margin:auto;display:block;" >
<g transform="translate(25 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="-0.3333333333333333s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
<g transform="translate(50 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="-0.16666666666666666s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
<g transform="translate(75 50)">
<circle cx="0" cy="0" r="6" fill="lightblue"><animateTransform attributeName="transform" type="scale" begin="0s" calcMode="spline" keySplines="0.3 0 0.7 1;0.3 0 0.7 1" values="0;1;0" keyTimes="0;0.5;1" dur="1s" repeatCount="indefinite"></animateTransform></circle></g>
</svg>`
document.getElementById("downloadMenu").innerHTML = LOADER;
}

let div_target = document.getElementById("downloadMenu")
Expand Down Expand Up @@ -541,6 +535,7 @@ async function downloader(){
}

function makeLink(title, href, size){
let filename = href.split('/').pop()
let a = document.createElement("a")
if (db_get("downloader_2", false)){
a.title = get_message('downloadStr')
Expand Down Expand Up @@ -616,7 +611,8 @@ async function downloader(){
var file = new Blob([xhr.response], { type : 'application/octet-stream' });
let a_el = document.createElement('a')
a_el.href = window.URL.createObjectURL(file);
a_el.download = targetFileName + '.mp4';
let extension = filename.split('.').pop();
a_el.download = `${targetFileName}.${extension}`;
a_el.click();
setTimeout(function(){
close_but.click();
Expand All @@ -629,7 +625,7 @@ async function downloader(){
else{
a.href = href
a.target = '_blank'
a.download = "video.mp4"
a.download = filename
a.title = get_message('downloadLinkDesc')
}
a.style.display = "block"
Expand Down Expand Up @@ -673,7 +669,7 @@ async function downloader(){
})
}
function formatBytes(bytes, decimals = 2) {
if (bytes === 0) return '0 Bytes';
if (bytes == 0) return '';
const k = 1024;
const dm = decimals < 0 ? 0 : decimals;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
Expand Down Expand Up @@ -732,7 +728,8 @@ async function downloader(){
summary.style.color = "aqua";
summary.style.borderRadius = "8px";
summary.style.textAlign = "center";
summary.style.transition = "0.2s"
summary.style.transition = "0.2s";
summary.style.padding = "2px 0";
summary.onmouseover = function(){
summary.style.background = "blueviolet"
}
Expand All @@ -743,6 +740,10 @@ async function downloader(){
details.appendChild(summary);
div_.appendChild(details);

let hr = document.createElement("hr");
hr.style.margin = 0;
details.appendChild(hr);

Subtitles.split(",").forEach(async function(e){
let temp = e.split("[")[1].split("]");
let lang = temp[0];
Expand Down

0 comments on commit 7d7c20d

Please sign in to comment.