Use Rust and tera to build manage html pages

This commit is contained in:
Folyd 2021-07-10 14:09:34 +08:00
parent 63a76571a1
commit 76b09a6f2b
24 changed files with 652 additions and 173 deletions

3
.gitignore vendored
View file

@ -6,4 +6,5 @@ web-ext-artifacts
node_modules
target
docs/public
manifest.json
manifest.json
extension/manage/

View file

@ -1,85 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rust Search Extension</title>
<script type="text/javascript" src="../libs/calendar-heatmap.js"></script>
<script type="text/javascript" src="../libs/d3.min.js"></script>
<script type="text/javascript" src="../libs/moment.min.js"></script>
<script type="text/javascript" src="../libs/charts.js"></script>
<link rel="stylesheet" href="../libs/calendar-heatmap.css">
<link rel="stylesheet" href="../libs/balloon.min.css">
<link rel="stylesheet" href="../libs/charts.css">
<link rel="stylesheet" href="../generic.css">
<link rel="stylesheet" href="index.css">
<link href="https://fonts.googleapis.com/css?family=Alfa+Slab+One&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600&display=swap" rel="stylesheet">
</head>
<body>
<div class="flex-layout" style="flex-direction: column;">
<div style="width: 61%; display: flex;flex-direction: column;">
<ul class="nav">
<li class="nav-item"><a href="index.html">Home</a></li>
<li class="nav-item"><a href="crates.html">Crate manager</a></li>
<li class="nav-item"><a href="settings.html">Settings</a></li>
</ul>
<div style="padding: 30px 80px; background-color: white;">
<div class="logo flex-layout">
<img src="../icon.png" alt="rust-search-extension-logo"> Rust Search Extension
</div>
<div style="flex-direction: column;" class="flex-layout">
<div class="chart-heatmap"></div>
</div>
<div class="search-time" style="text-align: center;font-size: 20px;">
<b>0</b> searches in total since the first day, approximately saved <b>0 seconds</b>.
<b aria-label="We consider one search save 5 seconds in average, just an estimated value." data-balloon-pos="up" data-balloon-length="large" style="vertical-align: middle" class="tooltip-color">
<img src="info.svg" alt="info">
</b>
</div>
<div id="chart">
<div style="padding: 30px 0;">
<div class="search-stats-graph" style=" height: 8px; width: 100%; display: flex;">
</div>
<div class="search-stats-text" style=" padding: 10px;">
<ol style="display: flex; justify-content: space-around;">
</ol>
</div>
</div>
<div style="display: flex; flex-direction: row-reverse; align-items: flex-start; padding-top: 30px;">
<div>
<div class="" style="padding-bottom: 20px;">
<h3>Searches per weekday</h3>
<div class="chart-histogram-week" style="position: relative;"></div>
</div>
<div class="" style="padding-bottom: 20px;">
<h3>Searches per day of month</h3>
<div class="chart-histogram-date" style="position: relative;"></div>
</div>
<div class="" style="padding-bottom: 20px;">
<h3>Searches per hour (local time)</h3>
<div class="chart-histogram-hour" style="position: relative;"></div>
</div>
</div>
<div class="" style="padding-right: 80px;">
<h3>Top searched crates</h3>
<div class="topCratesData" style="position: relative;box-sizing: border-box;">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript" src="../libs/bar-chart.js"></script>
<script type="text/javascript" src="../core/compat.js"></script>
<script type="text/javascript" src="../statistics.js"></script>
<script type="text/javascript" src="index.js"></script>
</html>

View file

@ -1,78 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rust Search Statistics</title>
<link rel="stylesheet" href="../generic.css">
<link rel="stylesheet" href="index.css">
<link rel="stylesheet" href="text.css">
<link href="https://fonts.googleapis.com/css?family=Alfa+Slab+One&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600&display=swap" rel="stylesheet">
</head>
<body>
<div class="toast"></div>
<div class="flex-layout" style="flex-direction: column;">
<div style="width: 61%; display: flex;flex-direction: column;">
<ul class="nav">
<li class="nav-item"><a href="index.html">Home</a></li>
<li class="nav-item"><a href="crates.html">Crate manager</a></li>
<li class="nav-item"><a href="settings.html">Settings</a></li>
</ul>
<div style="padding: 30px 80px; background-color: white;">
<div class="logo flex-layout">
<img src="../icon.png" alt="rust-search-extension-logo"> Rust Search Extension
</div>
<div style="margin-top: 20px" class="flex-vertical">
<div>
Enable auto update
<span aria-label="Whether auto opens the index update page when the browser launch (default false). At any time, you can use the `:update` command to sync the latest index." data-balloon-pos="up" data-balloon-length="large" style="vertical-align: middle">
<img style="vertical-align: middle;width: 15px;margin-right: 5px;" src="info.svg"
alt="info">
</span>
<label class="toggle">
<input type="checkbox" id="auto-update">
<span class="slider"></span>
</label>
</div>
</div>
<div style="margin-top: 20px" class="flex-vertical">
<div>
Enable offline mode
<span aria-label="Please check the FAQ if you are a Firefox user." data-balloon-pos="up" data-balloon-length="large" style="vertical-align: middle">
<img style="vertical-align: middle;width: 15px;margin-right: 5px;" src="info.svg"
alt="info">
</span>
<label class="toggle">
<input type="checkbox" id="offline-mode">
<span class="slider"></span>
</label>
</div>
<input type="text" class="offline-doc-path" placeholder="Input the local doc path">
<small class="offline-doc-message"></small>
</div>
<div style="margin-top: 10px">
<label>Crate registry</label>
<select name="crate-registry">
<option value="crates.io">crates.io</option>
<option value="lib.rs">lib.rs</option>
</select>
</div>
<div style="margin-top: 30px; font-size: 11px;text-align: center">
<a href="https://rust.extension.sh" target="_blank">Website</a>
<a href="https://rust.extension.sh/changelog/" target="_blank">Changelog</a>
<a href="https://github.com/huhu/rust-search-extension" target="_blank">Github</a>
</div>
</div>
</div>
</div>
</body>
<script src="../core/compat.js"></script>
<script src="../core/toast.js"></script>
<script src="../settings.js"></script>
<script src="settings.js"></script>
</html>

468
manage/Cargo.lock generated Normal file
View file

@ -0,0 +1,468 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
dependencies = [
"memchr",
]
[[package]]
name = "bitflags"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
name = "block-buffer"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
dependencies = [
"block-padding",
"byte-tools",
"byteorder",
"generic-array",
]
[[package]]
name = "block-padding"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5"
dependencies = [
"byte-tools",
]
[[package]]
name = "bstr"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279"
dependencies = [
"memchr",
]
[[package]]
name = "byte-tools"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
[[package]]
name = "byteorder"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "crossbeam-utils"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db"
dependencies = [
"cfg-if",
"lazy_static",
]
[[package]]
name = "digest"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
dependencies = [
"generic-array",
]
[[package]]
name = "fake-simd"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "generic-array"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd"
dependencies = [
"typenum",
]
[[package]]
name = "globset"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd"
dependencies = [
"aho-corasick",
"bstr",
"fnv",
"log",
"regex",
]
[[package]]
name = "globwalk"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc"
dependencies = [
"bitflags",
"ignore",
"walkdir",
]
[[package]]
name = "ignore"
version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d"
dependencies = [
"crossbeam-utils",
"globset",
"lazy_static",
"log",
"memchr",
"regex",
"same-file",
"thread_local",
"walkdir",
"winapi-util",
]
[[package]]
name = "itoa"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "log"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
dependencies = [
"cfg-if",
]
[[package]]
name = "manage"
version = "0.1.0"
dependencies = [
"tera",
]
[[package]]
name = "maplit"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
[[package]]
name = "memchr"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
[[package]]
name = "once_cell"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
[[package]]
name = "opaque-debug"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]]
name = "pest"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53"
dependencies = [
"ucd-trie",
]
[[package]]
name = "pest_derive"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0"
dependencies = [
"pest",
"pest_generator",
]
[[package]]
name = "pest_generator"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55"
dependencies = [
"pest",
"pest_meta",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "pest_meta"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d"
dependencies = [
"maplit",
"pest",
"sha-1",
]
[[package]]
name = "proc-macro2"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038"
dependencies = [
"unicode-xid",
]
[[package]]
name = "quote"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
dependencies = [
"proc-macro2",
]
[[package]]
name = "regex"
version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "ryu"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
[[package]]
name = "same-file"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
dependencies = [
"winapi-util",
]
[[package]]
name = "serde"
version = "1.0.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03"
[[package]]
name = "serde_json"
version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
dependencies = [
"itoa",
"ryu",
"serde",
]
[[package]]
name = "sha-1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df"
dependencies = [
"block-buffer",
"digest",
"fake-simd",
"opaque-debug",
]
[[package]]
name = "syn"
version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
name = "tera"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7571541dff0e57eaa2e931249f0d7489eb2b24b6b105546f8c2f1a47f15aaa3a"
dependencies = [
"globwalk",
"lazy_static",
"pest",
"pest_derive",
"regex",
"serde",
"serde_json",
"unic-segment",
]
[[package]]
name = "thread_local"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd"
dependencies = [
"once_cell",
]
[[package]]
name = "typenum"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06"
[[package]]
name = "ucd-trie"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
[[package]]
name = "unic-char-property"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221"
dependencies = [
"unic-char-range",
]
[[package]]
name = "unic-char-range"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc"
[[package]]
name = "unic-common"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc"
[[package]]
name = "unic-segment"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4ed5d26be57f84f176157270c112ef57b86debac9cd21daaabbe56db0f88f23"
dependencies = [
"unic-ucd-segment",
]
[[package]]
name = "unic-ucd-segment"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2079c122a62205b421f499da10f3ee0f7697f012f55b675e002483c73ea34700"
dependencies = [
"unic-char-property",
"unic-char-range",
"unic-ucd-version",
]
[[package]]
name = "unic-ucd-version"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4"
dependencies = [
"unic-common",
]
[[package]]
name = "unicode-xid"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "walkdir"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
dependencies = [
"same-file",
"winapi",
"winapi-util",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

10
manage/Cargo.toml Normal file
View file

@ -0,0 +1,10 @@
[package]
name = "manage"
version = "0.1.0"
authors = ["Folyd <lyshuhow@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tera = { version = "1.12", default-features = false }

46
manage/src/main.rs Normal file
View file

@ -0,0 +1,46 @@
//! Build manage directory html pages.
use std::{error::Error, fs, io::Write, path::PathBuf};
use tera::{Context, Tera};
pub type Result<T> = std::result::Result<T, Box<dyn Error>>;
const TEMPLATES: [&str; 3] = ["index.html", "crates.html", "settings.html"];
const ASSETS: [&str; 3] = ["css", "js", "static"];
const BUILD_DIR: &str = "../extension/manage";
fn main() -> Result<()> {
copy_asset()?;
let tera = Tera::new("templates/*.html")?;
let context = Context::new();
for template in TEMPLATES.iter() {
let mut buf = vec![];
tera.render_to(template, &context, &mut buf)?;
let path = format!("{}/{}", BUILD_DIR, template);
fs::File::create(&path)?.write_all(&buf)?;
}
Ok(())
}
fn copy_asset() -> Result<()> {
for asset in ASSETS.iter() {
let path = format!("templates/{}", asset);
for entry in fs::read_dir(&path)? {
let entry = entry?;
let from = entry.path();
if let Some(file_name) = from.file_name() {
let mut to = PathBuf::new();
to.push(format!("{}/{}", BUILD_DIR, asset));
if !to.exists() {
fs::create_dir_all(&to)?;
}
to.push(file_name.to_string_lossy().to_string());
fs::copy(from, to)?;
}
}
}
Ok(())
}

View file

@ -5,14 +5,15 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rust Search Extension</title>
<link rel="stylesheet" href="./css/balloon.min.css">
<link rel="stylesheet" href="../generic.css">
<link rel="stylesheet" href="index.css">
<link rel="stylesheet" href="text.css">
<link rel="stylesheet" href="./css/index.css">
<link rel="stylesheet" href="./css/text.css">
<link href="https://fonts.googleapis.com/css?family=Alfa+Slab+One&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600&display=swap" rel="stylesheet">
{% block head %}
{% endblock %}
</head>
<body>
<div class="flex-layout" style="flex-direction: column;">
<div style="width: 61%; display: flex;flex-direction: column;">
@ -25,13 +26,12 @@
<div class="logo flex-layout">
<img src="../icon.png" alt="rust-search-extension-logo"> Rust Search Extension
</div>
<ul class="crate-list">
</ul>
{% block content %}
{% endblock %}
</div>
</div>
</div>
<script src="../crate-manager.js"></script>
<script src="crates.js"></script>
{% block js %}
{% endblock %}
</body>
</html>

View file

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block content %}
<ul class="crate-list"></ul>
{% endblock %}
{% block js %}
<script src="../crate-manager.js"></script>
<script src="./js/crates.js"></script>
{% endblock %}

View file

@ -0,0 +1,62 @@
{% extends "base.html" %}
{% block head %}
<script type="text/javascript" src="./js/calendar-heatmap.js"></script>
<script type="text/javascript" src="./js/d3.min.js"></script>
<script type="text/javascript" src="./js/moment.min.js"></script>
<script type="text/javascript" src="./js/charts.js"></script>
<link rel="stylesheet" href="./css/calendar-heatmap.css">
<link rel="stylesheet" href="./css/charts.css">
{% endblock head %}
{% block content %}
<div style="flex-direction: column;" class="flex-layout">
<div class="chart-heatmap"></div>
</div>
<div class="search-time" style="text-align: center;font-size: 20px;">
<b>0</b> searches in total since the first day, approximately saved <b>0 seconds</b>.
<b aria-label="We consider one search save 5 seconds in average, just an estimated value." data-balloon-pos="up" data-balloon-length="large" style="vertical-align: middle" class="tooltip-color">
<img src="./static/info.svg" alt="info">
</b>
</div>
<div id="chart">
<div style="padding: 30px 0;">
<div class="search-stats-graph" style=" height: 8px; width: 100%; display: flex;">
</div>
<div class="search-stats-text" style=" padding: 10px;">
<ol style="display: flex; justify-content: space-around;">
</ol>
</div>
</div>
<div style="display: flex; flex-direction: row-reverse; align-items: flex-start; padding-top: 30px;">
<div>
<div class="" style="padding-bottom: 20px;">
<h3>Searches per weekday</h3>
<div class="chart-histogram-week" style="position: relative;"></div>
</div>
<div class="" style="padding-bottom: 20px;">
<h3>Searches per day of month</h3>
<div class="chart-histogram-date" style="position: relative;"></div>
</div>
<div class="" style="padding-bottom: 20px;">
<h3>Searches per hour (local time)</h3>
<div class="chart-histogram-hour" style="position: relative;"></div>
</div>
</div>
<div class="" style="padding-right: 80px;">
<h3>Top searched crates</h3>
<div class="topCratesData" style="position: relative;box-sizing: border-box;">
</div>
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script type="text/javascript" src="./js/bar-chart.js"></script>
<script type="text/javascript" src="../core/compat.js"></script>
<script type="text/javascript" src="../statistics.js"></script>
<script type="text/javascript" src="./js/index.js"></script>
{% endblock %}

View file

@ -0,0 +1,45 @@
{% extends "base.html" %}
{% block content %}
<div style="margin-top: 20px" class="flex-vertical">
<div>
Enable auto update
<span aria-label="Whether auto opens the index update page when the browser launch (default false). At any time, you can use the `:update` command to sync the latest index." data-balloon-pos="up" data-balloon-length="large" style="vertical-align: middle">
<img style="vertical-align: middle;width: 15px;margin-right: 5px;" src="./static/info.svg" alt="info">
</span>
<label class="toggle">
<input type="checkbox" id="auto-update">
<span class="slider"></span>
</label>
</div>
</div>
<div style="margin-top: 20px" class="flex-vertical">
<div>
Enable offline mode
<span aria-label="Please check the FAQ if you are a Firefox user." data-balloon-pos="up" data-balloon-length="large" style="vertical-align: middle">
<img style="vertical-align: middle;width: 15px;margin-right: 5px;" src="./static/info.svg" alt="info">
</span>
<label class="toggle">
<input type="checkbox" id="offline-mode">
<span class="slider"></span>
</label>
</div>
<input type="text" class="offline-doc-path" placeholder="Input the local doc path">
<small class="offline-doc-message"></small>
</div>
<div style="margin-top: 10px">
<label>Crate registry</label>
<select name="crate-registry">
<option value="crates.io">crates.io</option>
<option value="lib.rs">lib.rs</option>
</select>
</div>
<div class="toast"></div>
{% endblock %}
{% block js %}
<script src="../core/compat.js"></script>
<script src="../core/toast.js"></script>
<script src="../settings.js"></script>
<script src="./js/settings.js"></script>
{% endblock %}

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB