diff --git a/_src/blocks/decode-param/decode-param.css b/_src/blocks/decode-param/decode-param.css deleted file mode 100644 index 7e3aef8a9..000000000 --- a/_src/blocks/decode-param/decode-param.css +++ /dev/null @@ -1,38 +0,0 @@ -.decode-param-container h1 { - font-size: 30px; - margin-bottom: 0; -} - -.decode-param-container h2 { - font-size: 20px; -} - -.decode-param-container h2 strong { - font-weight: 500; -} - -.decode-param-container p { - font-size: 18px; -} - -.decode-param-container img { - width: 90px; -} - -.decode-param-container .upgrade-loader { - width: 160px; - height: 10px; - border: 1px solid #8c8c8c; - border-radius: 10px; - overflow: hidden; - background: #fff; - margin: 24px auto; -} - -.decode-param-container .upgrade-loader-progress { - width: 0; - height: 100%; - background: #1a73e8; - border-radius: 10px; - transition: width 8s linear; -} \ No newline at end of file diff --git a/_src/blocks/decode-param/decode-param.js b/_src/blocks/decode-param/decode-param.js deleted file mode 100644 index a17f8ea1c..000000000 --- a/_src/blocks/decode-param/decode-param.js +++ /dev/null @@ -1,56 +0,0 @@ -const decodeUpgrade = (encoded) => { - if (!encoded) return null; - - try { - let base64 = encoded.replace(/-/g, '+').replace(/_/g, '/'); - - while (base64.length % 4) { - base64 += '='; - } - - return atob(base64); - } catch (error) { - return null; - } -}; - -const getParam = (param) => { - const params = new URLSearchParams(window.location.search); - return params.get(param); -}; - -const createLoader = () => { - const wrapper = document.createElement('div'); - wrapper.className = 'upgrade-loader'; - - const progress = document.createElement('div'); - progress.className = 'upgrade-loader-progress'; - - wrapper.append(progress); - - return wrapper; -}; - -export default function decorate(block) { - const upgrade = getParam('upgrade'); - if (!upgrade) return; - - const redirectUrl = decodeUpgrade(upgrade); - if (!redirectUrl) return; - - const loader = createLoader(); - block.append(loader); - - const progress = loader.querySelector('.upgrade-loader-progress'); - - // reset + trigger animation - progress.style.width = '0'; - setTimeout(() => { - progress.style.transition = 'width 8s linear'; - progress.style.width = '100%'; - }, 50); - - setTimeout(() => { - window.location.href = redirectUrl; - }, 8000); -}