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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.ragatouille/
|
| 2 |
+
|
| 3 |
+
# Byte-compiled / optimized / DLL files
|
| 4 |
+
__pycache__/
|
| 5 |
+
*.py[cod]
|
| 6 |
+
*$py.class
|
| 7 |
+
|
| 8 |
+
# C extensions
|
| 9 |
+
*.so
|
| 10 |
+
|
| 11 |
+
# Distribution / packaging
|
| 12 |
+
.Python
|
| 13 |
+
build/
|
| 14 |
+
develop-eggs/
|
| 15 |
+
dist/
|
| 16 |
+
downloads/
|
| 17 |
+
eggs/
|
| 18 |
+
.eggs/
|
| 19 |
+
lib/
|
| 20 |
+
lib64/
|
| 21 |
+
parts/
|
| 22 |
+
sdist/
|
| 23 |
+
var/
|
| 24 |
+
wheels/
|
| 25 |
+
share/python-wheels/
|
| 26 |
+
*.egg-info/
|
| 27 |
+
.installed.cfg
|
| 28 |
+
*.egg
|
| 29 |
+
MANIFEST
|
| 30 |
+
|
| 31 |
+
# PyInstaller
|
| 32 |
+
# Usually these files are written by a python script from a template
|
| 33 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
| 34 |
+
*.manifest
|
| 35 |
+
*.spec
|
| 36 |
+
|
| 37 |
+
# Installer logs
|
| 38 |
+
pip-log.txt
|
| 39 |
+
pip-delete-this-directory.txt
|
| 40 |
+
|
| 41 |
+
# Unit test / coverage reports
|
| 42 |
+
htmlcov/
|
| 43 |
+
.tox/
|
| 44 |
+
.nox/
|
| 45 |
+
.coverage
|
| 46 |
+
.coverage.*
|
| 47 |
+
.cache
|
| 48 |
+
nosetests.xml
|
| 49 |
+
coverage.xml
|
| 50 |
+
*.cover
|
| 51 |
+
*.py,cover
|
| 52 |
+
.hypothesis/
|
| 53 |
+
.pytest_cache/
|
| 54 |
+
cover/
|
| 55 |
+
|
| 56 |
+
# Translations
|
| 57 |
+
*.mo
|
| 58 |
+
*.pot
|
| 59 |
+
|
| 60 |
+
# Django stuff:
|
| 61 |
+
*.log
|
| 62 |
+
local_settings.py
|
| 63 |
+
db.sqlite3
|
| 64 |
+
db.sqlite3-journal
|
| 65 |
+
|
| 66 |
+
# Flask stuff:
|
| 67 |
+
instance/
|
| 68 |
+
.webassets-cache
|
| 69 |
+
|
| 70 |
+
# Scrapy stuff:
|
| 71 |
+
.scrapy
|
| 72 |
+
|
| 73 |
+
# Sphinx documentation
|
| 74 |
+
docs/_build/
|
| 75 |
+
|
| 76 |
+
# PyBuilder
|
| 77 |
+
.pybuilder/
|
| 78 |
+
target/
|
| 79 |
+
|
| 80 |
+
# Jupyter Notebook
|
| 81 |
+
.ipynb_checkpoints
|
| 82 |
+
|
| 83 |
+
# IPython
|
| 84 |
+
profile_default/
|
| 85 |
+
ipython_config.py
|
| 86 |
+
|
| 87 |
+
# pyenv
|
| 88 |
+
# For a library or package, you might want to ignore these files since the code is
|
| 89 |
+
# intended to run in multiple environments; otherwise, check them in:
|
| 90 |
+
# .python-version
|
| 91 |
+
|
| 92 |
+
# pipenv
|
| 93 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
| 94 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
| 95 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
| 96 |
+
# install all needed dependencies.
|
| 97 |
+
#Pipfile.lock
|
| 98 |
+
|
| 99 |
+
# poetry
|
| 100 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
| 101 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
| 102 |
+
# commonly ignored for libraries.
|
| 103 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
| 104 |
+
#poetry.lock
|
| 105 |
+
|
| 106 |
+
# pdm
|
| 107 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
| 108 |
+
#pdm.lock
|
| 109 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
| 110 |
+
# in version control.
|
| 111 |
+
# https://pdm.fming.dev/#use-with-ide
|
| 112 |
+
.pdm.toml
|
| 113 |
+
|
| 114 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
| 115 |
+
__pypackages__/
|
| 116 |
+
|
| 117 |
+
# Celery stuff
|
| 118 |
+
celerybeat-schedule
|
| 119 |
+
celerybeat.pid
|
| 120 |
+
|
| 121 |
+
# SageMath parsed files
|
| 122 |
+
*.sage.py
|
| 123 |
+
|
| 124 |
+
# Environments
|
| 125 |
+
.env
|
| 126 |
+
.venv
|
| 127 |
+
env/
|
| 128 |
+
venv/
|
| 129 |
+
ENV/
|
| 130 |
+
env.bak/
|
| 131 |
+
venv.bak/
|
| 132 |
+
|
| 133 |
+
# Spyder project settings
|
| 134 |
+
.spyderproject
|
| 135 |
+
.spyproject
|
| 136 |
+
|
| 137 |
+
# Rope project settings
|
| 138 |
+
.ropeproject
|
| 139 |
+
|
| 140 |
+
# mkdocs documentation
|
| 141 |
+
/site
|
| 142 |
+
|
| 143 |
+
# mypy
|
| 144 |
+
.mypy_cache/
|
| 145 |
+
.dmypy.json
|
| 146 |
+
dmypy.json
|
| 147 |
+
|
| 148 |
+
# Pyre type checker
|
| 149 |
+
.pyre/
|
| 150 |
+
|
| 151 |
+
# pytype static type analyzer
|
| 152 |
+
.pytype/
|
| 153 |
+
|
| 154 |
+
# Cython debug symbols
|
| 155 |
+
cython_debug/
|
| 156 |
+
|
| 157 |
+
# PyCharm
|
| 158 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
| 159 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
| 160 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
| 161 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
| 162 |
+
#.idea/
|
app.py
CHANGED
|
@@ -1,9 +1,143 @@
|
|
| 1 |
#!/usr/bin/env python
|
| 2 |
|
| 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024 Papers"
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
paper_list = PaperList()
|
| 12 |
+
|
| 13 |
+
DEFAULT_COLUMNS = [
|
| 14 |
+
"Title",
|
| 15 |
+
"Type",
|
| 16 |
+
"Paper page",
|
| 17 |
+
"OpenReview",
|
| 18 |
+
"GitHub",
|
| 19 |
+
"Spaces",
|
| 20 |
+
"Models",
|
| 21 |
+
"Datasets",
|
| 22 |
+
"claimed",
|
| 23 |
+
]
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def update_num_papers(df: pd.DataFrame) -> str:
|
| 27 |
+
return f"{len(df)} / {len(paper_list.df_raw)} ({len(df[df['claimed'].str.contains('✅')])} claimed)"
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def update_df(
|
| 31 |
+
title_search_query: str,
|
| 32 |
+
abstract_search_query: str,
|
| 33 |
+
max_num_to_retrieve: int,
|
| 34 |
+
filter_names: list,
|
| 35 |
+
presentation_type: str,
|
| 36 |
+
column_names: list[str],
|
| 37 |
+
) -> pd.DataFrame:
|
| 38 |
+
return gr.DataFrame(
|
| 39 |
+
value=paper_list.search(
|
| 40 |
+
title_search_query,
|
| 41 |
+
abstract_search_query,
|
| 42 |
+
max_num_to_retrieve,
|
| 43 |
+
filter_names,
|
| 44 |
+
presentation_type,
|
| 45 |
+
column_names,
|
| 46 |
+
),
|
| 47 |
+
datatype=paper_list.get_column_datatypes(column_names),
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
with gr.Blocks(css="style.css") as demo:
|
| 52 |
+
gr.Markdown(DESCRIPTION)
|
| 53 |
+
with gr.Group():
|
| 54 |
+
search_title = gr.Textbox(label="Search title")
|
| 55 |
+
with gr.Row():
|
| 56 |
+
with gr.Column(scale=4):
|
| 57 |
+
search_abstract = gr.Textbox(
|
| 58 |
+
label="Search abstract",
|
| 59 |
+
info="The result may not be accurate as the abstract does not contain all the information.",
|
| 60 |
+
)
|
| 61 |
+
with gr.Column(scale=1):
|
| 62 |
+
max_num_to_retrieve = gr.Slider(
|
| 63 |
+
label="Max number to retrieve",
|
| 64 |
+
info="This is used only for search on abstracts.",
|
| 65 |
+
minimum=1,
|
| 66 |
+
maximum=len(paper_list.df_raw),
|
| 67 |
+
step=1,
|
| 68 |
+
value=100,
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
filter_names = gr.CheckboxGroup(
|
| 72 |
+
label="Filter",
|
| 73 |
+
choices=[
|
| 74 |
+
"Paper page",
|
| 75 |
+
"GitHub",
|
| 76 |
+
"Space",
|
| 77 |
+
"Model",
|
| 78 |
+
"Dataset",
|
| 79 |
+
],
|
| 80 |
+
)
|
| 81 |
+
presentation_type = gr.Radio(
|
| 82 |
+
label="Presentation Type",
|
| 83 |
+
choices=["(ALL)", "Oral", "Spotlight Poster", "Poster"],
|
| 84 |
+
value="(ALL)",
|
| 85 |
+
)
|
| 86 |
+
column_names = gr.CheckboxGroup(label="Columns", choices=paper_list.get_column_names(), value=DEFAULT_COLUMNS)
|
| 87 |
+
|
| 88 |
+
num_papers = gr.Textbox(
|
| 89 |
+
label="Number of papers", value=update_num_papers(paper_list.df_prettified), interactive=False
|
| 90 |
+
)
|
| 91 |
+
df = gr.Dataframe(
|
| 92 |
+
value=paper_list.df_prettified,
|
| 93 |
+
datatype=paper_list.get_column_datatypes(paper_list.get_column_names()),
|
| 94 |
+
type="pandas",
|
| 95 |
+
row_count=(0, "dynamic"),
|
| 96 |
+
interactive=False,
|
| 97 |
+
height=1000,
|
| 98 |
+
elem_id="table",
|
| 99 |
+
wrap=True,
|
| 100 |
+
)
|
| 101 |
+
|
| 102 |
+
inputs = [
|
| 103 |
+
search_title,
|
| 104 |
+
search_abstract,
|
| 105 |
+
max_num_to_retrieve,
|
| 106 |
+
filter_names,
|
| 107 |
+
presentation_type,
|
| 108 |
+
column_names,
|
| 109 |
+
]
|
| 110 |
+
gr.on(
|
| 111 |
+
triggers=[
|
| 112 |
+
search_title.submit,
|
| 113 |
+
search_abstract.submit,
|
| 114 |
+
filter_names.input,
|
| 115 |
+
presentation_type.input,
|
| 116 |
+
column_names.input,
|
| 117 |
+
],
|
| 118 |
+
fn=update_df,
|
| 119 |
+
inputs=inputs,
|
| 120 |
+
outputs=df,
|
| 121 |
+
api_name=False,
|
| 122 |
+
).then(
|
| 123 |
+
fn=update_num_papers,
|
| 124 |
+
inputs=df,
|
| 125 |
+
outputs=num_papers,
|
| 126 |
+
queue=False,
|
| 127 |
+
api_name=False,
|
| 128 |
+
)
|
| 129 |
+
demo.load(
|
| 130 |
+
fn=update_df,
|
| 131 |
+
inputs=inputs,
|
| 132 |
+
outputs=df,
|
| 133 |
+
api_name=False,
|
| 134 |
+
).then(
|
| 135 |
+
fn=update_num_papers,
|
| 136 |
+
inputs=df,
|
| 137 |
+
outputs=num_papers,
|
| 138 |
+
queue=False,
|
| 139 |
+
api_name=False,
|
| 140 |
+
)
|
| 141 |
|
| 142 |
if __name__ == "__main__":
|
| 143 |
+
demo.queue(api_open=False).launch(show_api=False)
|
papers.py
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import operator
|
| 2 |
+
|
| 3 |
+
import datasets
|
| 4 |
+
import pandas as pd
|
| 5 |
+
from huggingface_hub import HfApi
|
| 6 |
+
from ragatouille import RAGPretrainedModel
|
| 7 |
+
|
| 8 |
+
api = HfApi()
|
| 9 |
+
|
| 10 |
+
INDEX_DIR_PATH = ".ragatouille/colbert/indexes/ICLR2024-papers-abstract-index/"
|
| 11 |
+
api.snapshot_download(
|
| 12 |
+
repo_id="ICLR2024/ICLR2024-papers-abstract-index",
|
| 13 |
+
repo_type="dataset",
|
| 14 |
+
local_dir=INDEX_DIR_PATH,
|
| 15 |
+
)
|
| 16 |
+
ABSTRACT_RETRIEVER = RAGPretrainedModel.from_index(INDEX_DIR_PATH)
|
| 17 |
+
# Run once to initialize the retriever
|
| 18 |
+
ABSTRACT_RETRIEVER.search("LLM")
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class PaperList:
|
| 22 |
+
COLUMN_INFO = [
|
| 23 |
+
["Title", "str"],
|
| 24 |
+
["Authors", "str"],
|
| 25 |
+
["Type", "str"],
|
| 26 |
+
["Paper page", "markdown"],
|
| 27 |
+
["OpenReview", "markdown"],
|
| 28 |
+
["GitHub", "markdown"],
|
| 29 |
+
["Spaces", "markdown"],
|
| 30 |
+
["Models", "markdown"],
|
| 31 |
+
["Datasets", "markdown"],
|
| 32 |
+
["claimed", "markdown"],
|
| 33 |
+
]
|
| 34 |
+
|
| 35 |
+
def __init__(self):
|
| 36 |
+
self.df_raw = self.get_df()
|
| 37 |
+
self.df_prettified = self.prettify(self.df_raw)
|
| 38 |
+
|
| 39 |
+
@staticmethod
|
| 40 |
+
def get_df() -> pd.DataFrame:
|
| 41 |
+
df = pd.merge(
|
| 42 |
+
left=datasets.load_dataset("ICLR2024/ICLR2024-papers", split="train").to_pandas(),
|
| 43 |
+
right=datasets.load_dataset("ICLR2024/ICLR2024-num-claimed-papers", split="train").to_pandas(),
|
| 44 |
+
on="id",
|
| 45 |
+
how="left",
|
| 46 |
+
)
|
| 47 |
+
df[["n_authors", "n_linked_authors"]] = df[["n_authors", "n_linked_authors"]].fillna(-1).astype(int)
|
| 48 |
+
df["paper_page"] = df["arxiv_id"].apply(
|
| 49 |
+
lambda arxiv_id: f"https://huggingface.co/papers/{arxiv_id}" if arxiv_id else ""
|
| 50 |
+
)
|
| 51 |
+
return df
|
| 52 |
+
|
| 53 |
+
@staticmethod
|
| 54 |
+
def create_link(text: str, url: str) -> str:
|
| 55 |
+
return f'<a href="{url}" target="_blank">{text}</a>'
|
| 56 |
+
|
| 57 |
+
@staticmethod
|
| 58 |
+
def prettify(df: pd.DataFrame) -> pd.DataFrame:
|
| 59 |
+
rows = []
|
| 60 |
+
for _, row in df.iterrows():
|
| 61 |
+
author_linked = "✅" if row.n_linked_authors > 0 else ""
|
| 62 |
+
n_linked_authors = "" if row.n_linked_authors == -1 else row.n_linked_authors
|
| 63 |
+
n_authors = "" if row.n_authors == -1 else row.n_authors
|
| 64 |
+
claimed_paper = "" if n_linked_authors == "" else f"{n_linked_authors}/{n_authors} {author_linked}"
|
| 65 |
+
|
| 66 |
+
new_row = {
|
| 67 |
+
"Title": row["title"],
|
| 68 |
+
"Authors": ", ".join(row["authors"]),
|
| 69 |
+
"Type": row["type"],
|
| 70 |
+
"Paper page": PaperList.create_link(row["arxiv_id"], row["paper_page"]),
|
| 71 |
+
"OpenReview": PaperList.create_link("OpenReview", row["OpenReview"]),
|
| 72 |
+
"GitHub": "\n".join([PaperList.create_link("GitHub", url) for url in row["GitHub"]]),
|
| 73 |
+
"Spaces": "\n".join([PaperList.create_link("Space", url) for url in row["Space"]]),
|
| 74 |
+
"Models": "\n".join([PaperList.create_link("Model", url) for url in row["Model"]]),
|
| 75 |
+
"Datasets": "\n".join([PaperList.create_link("Dataset", url) for url in row["Dataset"]]),
|
| 76 |
+
"claimed": claimed_paper,
|
| 77 |
+
}
|
| 78 |
+
rows.append(new_row)
|
| 79 |
+
return pd.DataFrame(rows, columns=PaperList.get_column_names())
|
| 80 |
+
|
| 81 |
+
@staticmethod
|
| 82 |
+
def get_column_names():
|
| 83 |
+
return list(map(operator.itemgetter(0), PaperList.COLUMN_INFO))
|
| 84 |
+
|
| 85 |
+
def get_column_datatypes(self, column_names: list[str]) -> list[str]:
|
| 86 |
+
mapping = dict(self.COLUMN_INFO)
|
| 87 |
+
return [mapping[name] for name in column_names]
|
| 88 |
+
|
| 89 |
+
def search(
|
| 90 |
+
self,
|
| 91 |
+
title_search_query: str,
|
| 92 |
+
abstract_search_query: str,
|
| 93 |
+
max_num_to_retrieve: int,
|
| 94 |
+
filter_names: list[str],
|
| 95 |
+
presentation_type: str,
|
| 96 |
+
columns_names: list[str],
|
| 97 |
+
) -> pd.DataFrame:
|
| 98 |
+
df = self.df_raw.copy()
|
| 99 |
+
# As ragatouille uses str for document_id
|
| 100 |
+
df["id"] = df["id"].astype(str)
|
| 101 |
+
|
| 102 |
+
# Filter by title
|
| 103 |
+
df = df[df["title"].str.contains(title_search_query, case=False)]
|
| 104 |
+
|
| 105 |
+
# Filter by presentation type
|
| 106 |
+
if presentation_type != "(ALL)":
|
| 107 |
+
df = df[df["type"] == presentation_type]
|
| 108 |
+
|
| 109 |
+
if "Paper page" in filter_names:
|
| 110 |
+
df = df[df["paper_page"].notnull()]
|
| 111 |
+
if "GitHub" in filter_names:
|
| 112 |
+
df = df[df["GitHub"].apply(len) > 0]
|
| 113 |
+
if "Space" in filter_names:
|
| 114 |
+
df = df[df["Space"].apply(len) > 0]
|
| 115 |
+
if "Model" in filter_names:
|
| 116 |
+
df = df[df["Model"].apply(len) > 0]
|
| 117 |
+
if "Dataset" in filter_names:
|
| 118 |
+
df = df[df["Dataset"].apply(len) > 0]
|
| 119 |
+
|
| 120 |
+
# Filter by abstract
|
| 121 |
+
if abstract_search_query:
|
| 122 |
+
results = ABSTRACT_RETRIEVER.search(abstract_search_query, k=max_num_to_retrieve)
|
| 123 |
+
remaining_ids = set(map(str, df["id"]))
|
| 124 |
+
found_id_set = set()
|
| 125 |
+
found_ids = []
|
| 126 |
+
for x in results:
|
| 127 |
+
paper_id = x["document_id"]
|
| 128 |
+
if paper_id not in remaining_ids:
|
| 129 |
+
continue
|
| 130 |
+
if paper_id in found_id_set:
|
| 131 |
+
continue
|
| 132 |
+
found_id_set.add(paper_id)
|
| 133 |
+
found_ids.append(paper_id)
|
| 134 |
+
df = df[df["id"].isin(found_ids)].set_index("id").reindex(index=found_ids).reset_index()
|
| 135 |
+
|
| 136 |
+
df_prettified = self.prettify(df)
|
| 137 |
+
return df_prettified.loc[:, columns_names]
|
requirements.txt
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
datasets==2.18.0
|
| 2 |
+
#gradio==4.24.0
|
| 3 |
+
huggingface_hub==0.22.2
|
| 4 |
+
pandas==2.2.1
|
| 5 |
+
ragatouille==0.0.8.post2
|
| 6 |
+
tqdm==4.66.2
|
style.css
CHANGED
|
@@ -3,9 +3,19 @@ h1 {
|
|
| 3 |
display: block;
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
background:
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
}
|
|
|
|
| 3 |
display: block;
|
| 4 |
}
|
| 5 |
|
| 6 |
+
body a,
|
| 7 |
+
.contain a,
|
| 8 |
+
#table a {
|
| 9 |
+
background-color: transparent;
|
| 10 |
+
color: #58a6ff;
|
| 11 |
+
text-decoration: none;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
body a:active,
|
| 15 |
+
body a:hover {
|
| 16 |
+
outline-width: 0;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
body a:hover {
|
| 20 |
+
text-decoration: underline;
|
| 21 |
}
|