From 3ceb6fe707a296ee79e234a2a3e91a00412ac877 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Tue, 7 Jun 2022 00:55:34 +0300 Subject: [PATCH] change download button logic, remove request to github Signed-off-by: R4SAS --- index.html | 153 +++++++++++++++++++++++++---------------------- js/app.js | 56 +++++------------ locales/data.ini | 8 ++- 3 files changed, 101 insertions(+), 116 deletions(-) diff --git a/index.html b/index.html index 7a95ac8..f4353c6 100644 --- a/index.html +++ b/index.html @@ -1,75 +1,84 @@ - - - Invisible Internet Protocol Daemon - - - - - - - - - Fork me on GitHub -
-
-
- -

Invisible Internet Protocol:

-

Network without borders

-

We are building network which helps people to communicate and share information without restrictions.

-

Free from censorship. Free from privacy violations.

-
- Downloads -
- -
-
-
-

i2pd (I2P Daemon) is a full-featured C++ implementation of I2P client

-

I2P (Invisible Internet Protocol) is a universal anonymous network layer. All communications over I2P are anonymous and end-to-end encrypted, participants don't reveal their real IP addresses.

-

I2P client is a software used for building and using anonymous I2P networks. Such networks are commonly used for anonymous peer-to-peer applications (filesharing, cryptocurrencies) and anonymous client-server applications (websites, instant messengers, chat-servers).

-

I2P allows people from all around the world to communicate and share information without restrictions.

-

- If you are interested in deeper technical details, visit - this page. -

-
-

Let's make the world a better place

-

I2P runs and is developed by people like you.

-

You can help to protect our civil rights online, just run I2P node 24/7 and spread the word!

-

Support with coins

-
-

Donations for Purple I2P developing:

-

E-Mail: i2porignal at yandex.ru

-

BTC: 3MDoGJW9TLMTCDGrR9bLgWXfm6sjmgy86f

-

LTC: LKQirrYrDeTuAPnpYq5y7LVKtywfkkHi59

-

ETH: 0x9e5bac70d20d1079ceaa111127f4fb3bccce379d

-

GST: GbD2JSQHBHCKLa9WTHmigJRpyFgmBj4woG

-

DASH: Xw8YUrQpYzP9tZBmbjqxS3M97Q7v3vJKUF

-

ZEC: t1cTckLuXsr1dwVrK4NDzfhehss4NvMadAJ

-

ANC: AQJYweYYUqM1nVfLqfoSMpUMfzxvS4Xd7z

-

XMR: 497pJc7X4xqKvcLBLpSUtRgWqMMyo24u4btCos3cak6gbMkpobgSU6492ztUcUBghyeHpYeczB55s38NpuHoH5WGNSPDRMH

-
-
- -
-
- + + + Invisible Internet Protocol Daemon + + + + + + + + + Fork me on GitHub +
+
+
+ +

Invisible Internet Protocol:

+

Network without borders

+

We are building network which helps people to communicate and share information without restrictions.

+

Free from censorship. Free from privacy violations.

+
+ Downloads +
+ + +
+
+
+

i2pd (I2P Daemon) is a full-featured C++ implementation of I2P client

+

I2P (Invisible Internet Protocol) is a universal anonymous network layer. All communications over I2P are anonymous and end-to-end encrypted, participants don't reveal their real IP addresses.

+

I2P client is a software used for building and using anonymous I2P networks. Such networks are commonly used for anonymous peer-to-peer applications (filesharing, cryptocurrencies) and anonymous client-server applications (websites, instant messengers, chat-servers).

+

I2P allows people from all around the world to communicate and share information without restrictions.

+

+ If you are interested in deeper technical details, visit + this page. +

+
+

Let's make the world a better place

+

I2P runs and is developed by people like you.

+

You can help to protect our civil rights online, just run I2P node 24/7 and spread the word!

+

Support with coins

+
+

Donations for Purple I2P developing:

+

E-Mail: i2porignal at yandex.ru

+

BTC: 3MDoGJW9TLMTCDGrR9bLgWXfm6sjmgy86f

+

LTC: LKQirrYrDeTuAPnpYq5y7LVKtywfkkHi59

+

ETH: 0x9e5bac70d20d1079ceaa111127f4fb3bccce379d

+

GST: GbD2JSQHBHCKLa9WTHmigJRpyFgmBj4woG

+

DASH: Xw8YUrQpYzP9tZBmbjqxS3M97Q7v3vJKUF

+

ZEC: t1cTckLuXsr1dwVrK4NDzfhehss4NvMadAJ

+

ANC: AQJYweYYUqM1nVfLqfoSMpUMfzxvS4Xd7z

+

XMR: 497pJc7X4xqKvcLBLpSUtRgWqMMyo24u4btCos3cak6gbMkpobgSU6492ztUcUBghyeHpYeczB55s38NpuHoH5WGNSPDRMH

+
+
+ +
+
+ diff --git a/js/app.js b/js/app.js index 32151f6..709290c 100644 --- a/js/app.js +++ b/js/app.js @@ -1,49 +1,21 @@ -var url = "https://api.github.com/repos/PurpleI2P/i2pdbrowser/releases/latest"; -//var url = "http://127.0.0.1:9889/latest.json"; +function renderDownloadButton() { + var downloadCount = 0, dl_btn = document.getElementById("dl-btn"), all_dls = document.getElementById("all-dls"); -function renderReleaseInfo(data) { - if (!data) return; - var release = JSON.parse(data); - var downloadCount = 0, dl_btn = document.getElementById("dl-btn"), all_dls = document.getElementById("all-dls"); + if (window.navigator.platform.toUpperCase().startsWith("WIN")) { + dl_btn.innerText = document.webL10n.get("header-dl-btn-bundle", null, "Download I2PdBrowser"); + dl_btn.setAttribute("href", "https://github.com/PurpleI2P/i2pdbrowser/releases/latest"); + all_dls.style.display = "block"; - for (var i = 0; i < release.assets.length; i++) - downloadCount += release.assets[i].download_count; - console.log(release.name+" downloaded "+downloadCount.toLocaleString()+" times."); + } else if (window.navigator.userAgent.toUpperCase().indexOf("ANDROID") !== -1) { + dl_btn.innerText = document.webL10n.get("header.dl-btn-android", null, "Download for Android"); + dl_btn.setAttribute("href", droid_asset[0].browser_download_url); + all_dls.style.display = "block"; - if (window.navigator.platform.toUpperCase().startsWith("WIN")) { - var win_asset = release.assets.filter(function(a) { - if (a.name.startsWith("I2PdBrowser") && a.name.endsWith("exe")) - return true; - }); - - if (win_asset.length > 0) { - dl_btn.innerText = document.webL10n.get("header-dl-btn-windows", null, "Download for Windows"); - dl_btn.setAttribute("href", win_asset[0].browser_download_url); - all_dls.style.display = "block"; - } - /* - } else if (window.navigator.userAgent.toUpperCase().indexOf("ANDROID") !== -1) { - var droid_asset = release.assets.filter(function(a) { - if (a.name.toUpperCase().indexOf("ANDROID") !== -1) return true; - }); - - if (droid_asset.length > 0) { - dl_btn.text(document.webL10n.get("header.dl-btn-android")); - dl_btn.setAttribute("href", droid_asset[0].browser_download_url); - all_dls.show(); - } - */ - } else { - dl_btn.innerText = document.webL10n.get("header-dl-btn", null, "Downloads"); - } + } else { + dl_btn.innerText = document.webL10n.get("header-dl-btn", null, "Downloads"); + } } window.addEventListener('localized', function() { - var httpRequest = new XMLHttpRequest(); - httpRequest.onreadystatechange = function(){ - if (httpRequest.readyState == XMLHttpRequest.DONE) - renderReleaseInfo(httpRequest.responseText); - } - httpRequest.open('GET', url); - httpRequest.send(); + renderDownloadButton(); }, false); diff --git a/locales/data.ini b/locales/data.ini index 4ca6d02..4b3773b 100644 --- a/locales/data.ini +++ b/locales/data.ini @@ -4,9 +4,11 @@ header-slogan = Network without borders header-p1 = We are building network which helps people to communicate and share information without restrictions. header-p2 = Free from censorship. Free from privacy violations. header-dl-btn = Download -header-dl-btn-windows = Download for Windows +header-dl-btn-bundle = Download I2PdBrowser header-dl-btn-android = Download for Android header-dl-all = All downloads +header-dl-android = Android app +header-dl-browser = I2PdBrowser bundle header-docs = Documentation content-how-title = i2pd (I2P Daemon) is a full-featured C++ implementation of I2P client content-how-p1 = I2P (Invisible Internet Protocol) is a universal anonymous network layer. All communications over I2P are anonymous and end-to-end encrypted, participants don't reveal their real IP addresses. @@ -26,9 +28,11 @@ header-slogan = Сеть без границ header-p1 = Мы строим сеть, которая позволяет людям общаться и обмениваться информацией без искусственных преград. header-p2 = Без цензуры. Без нарушений права на частную жизнь. header-dl-btn = Скачать -header-dl-btn-windows = Скачать для Windows +header-dl-btn-bundle = Скачать I2PdBrowser header-dl-btn-android = Скачать для Android header-dl-all = Все загрузки +header-dl-android = Android приложение +header-dl-browser = Комплект I2PdBrowser header-docs = Документация content-how-title = i2pd (I2P Daemon) это полнофункциональная реализация I2P клиента на языке C++ content-how-p1 = I2P (Невидимый Интернет Протокол) это универсальный анонимный сетевой уровень. Все соединения через I2P анонимны и используют сквозное (end-to-end) шифрование, участники не раскрывают свои настоящие IP адреса.