This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { parseResponse } from "core/request/RequestService"; | |
import { getService } from "core/servicesProvider"; | |
import { RequestMiddleware } from "core/request/RequestMiddleware"; | |
export default abstract class BaseResource extends Resource { | |
static async useFetchInit(init: RequestInit): Promise<RequestInit> { | |
let preparedOptions: RequestInit = init; | |
const middlewares = | |
getService<RequestMiddleware[]>("DefaultRequestMiddlewares") ?? []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findPlaylist(compare) { | |
let pageToken; | |
while(true) { | |
const list = YouTube.Playlists.list(['snippet'], { | |
"maxResults": 50, | |
"mine": true, | |
...(pageToken && { pageToken }) | |
}); | |
const item = list.items.find((row) => compare && compare(row)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const translate = (x, y) => `transform: translate(${x}px, ${y}px)`; | |
const show = (element) => { | |
const rect = element?.getBoundingClientRect(); | |
let opacity = 0; | |
if (rect) { | |
opacity = 1; | |
leftTop.setAttribute('style', translate(rect.left, rect.top)); | |
leftBottom.setAttribute('style', translate(rect.left, rect.bottom)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const checkHref = (element) => { | |
const tag = element.tagName; | |
return !(tag === 'A' || tag === 'AREA') || element.href; | |
}; | |
const onFocus = (event) => { | |
if ( | |
event?.target?.tabIndex > -1 | |
&& current !== event.target | |
) { | |
// skip anchors and areas without href and disabled items |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('focus', onFocus, true); | |
document.addEventListener('blur', onBlur, true); | |
document.addEventListener('pointerenter', onFocus, true); | |
document.addEventListener('pointerleave', onBlur, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.border { | |
position: absolute; | |
top: -4px; | |
left: -4px; | |
transform: translate(-20px, -20px); | |
transition: transform; | |
transition-duration: 0.1s; | |
border-style: solid; | |
border-width: 1px; | |
border-color: red; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="overlay" id="overlay"> | |
<div class="border border--leftTop" id="leftTop"></div> | |
<div class="border border--leftBottom" id="leftBottom"></div> | |
<div class="border border--rightTop" id="rightTop"></div> | |
<div class="border border--rightBottom" id="rightBottom"></div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.overlay { | |
pointer-events: none; | |
position: absolute; | |
top: 0; | |
bottom: 0; | |
left: 0; | |
right: 0; | |
z-index: 1000; | |
transition: opacity 0.1s; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
const calc = (src, dest, graph) => { | |
const length = graph.length; | |
const distance = new Array(length).fill(Infinity); | |
const parents = []; | |
const visited = []; | |
let l = length; | |
let node; | |
distance[src] = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function addAll() { | |
let neededVideoId = localStorage.getItem('_lastVideoId'); | |
neededVideoId = neededVideoId || prompt('Enter id of the last video, or keep empty', ''); | |
const delay = (ms = 100) => new Promise((resolve) => { | |
setTimeout(() => { | |
resolve(true); | |
}, ms) | |
}); | |
const eventMouseEnter = new Event('mouseenter', { |
NewerOlder