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
let IMG_CLASS = '.slide_image'; | |
let IMG_URL_ATTR = 'data-full'; | |
let imgName = 0; | |
[...document.querySelectorAll(IMG_CLASS)].map(el => setTimeout(() => { | |
let link = document.createElement('a'); | |
link.download = imgName++; | |
link.href = el.getAttribute(IMG_URL_ATTR) || el.getAttribute('src'); | |
document.body.appendChild(link); | |
link.click(); | |
document.body.removeChild(link); |
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
let hexToRGB = (hex, opacity) => { | |
var r = parseInt(hex.slice(1, 3), 16), | |
g = parseInt(hex.slice(3, 5), 16), | |
b = parseInt(hex.slice(5, 7), 16); | |
return opacity ? 'rgba(' + [r, g, b, opacity].join(',') + ')' : 'rgb(' + [r, g, b].join(',') + ')'; | |
}; |
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
/** | |
* Checks if line is crossed by rectangle | |
* @param x1 most left X of rectangle | |
* @param y1 most left Y of rectangle | |
* @param a side length of rectangle | |
* @param b side length of rectangle | |
* @param degree is an angle to X axis | |
* @param borderX - x coordinate of a line to check crossing | |
* @return {boolean} Returns true if rectangle that described with params x1, y1, a, b, degree is crossing the line. | |
*/ |