From 80b7013964ff955779444a86fb87b6b5f56b92f3 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 25 Aug 2013 23:23:29 -0400 Subject: [PATCH] Rename some cookies, streamline HTML, etc. --- pages/copyvios.mako | 142 ------------------------------- pages/index.mako | 168 ++++++++++++++++++++++++++++++------- pages/settings.mako | 16 ++-- pages/support/footer.mako | 39 +++------ pages/support/header.mako | 21 ++--- static/{images => }/background.png | Bin static/style.css | 5 -- 7 files changed, 164 insertions(+), 227 deletions(-) delete mode 100644 pages/copyvios.mako rename static/{images => }/background.png (100%) diff --git a/pages/copyvios.mako b/pages/copyvios.mako deleted file mode 100644 index 50ca7b8..0000000 --- a/pages/copyvios.mako +++ /dev/null @@ -1,142 +0,0 @@ -<%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='Copyvio Detector', add_css=('copyvios.css',), add_js=('copyvios.js',)"/>\ -<%namespace module="toolserver.copyvios" import="main, highlight_delta"/>\ -<%namespace module="toolserver.misc" import="urlstrip"/>\ -<% query, bot, all_langs, all_projects, page, result = main(environ) %>\ - % if query.project and query.lang and query.title and not page: -
-

The given site (project=${query.project | h}, language=${query.lang | h}) doesn't seem to exist. It may also be closed or private. Confirm its URL.

-
- % elif query.project and query.lang and query.title and page and not result: -
-

The given page doesn't seem to exist: ${page.title | h}.

-
- % elif query.project and query.lang and query.title and query.url and page and result == "bad URI": - <% result = None %> -
-

Unsupported URI scheme: ${query.url | h}.

-
- % endif -

Copyvio Detector

-

This tool attempts to detect copyright violations in articles. Simply give the title of the page you want to check and hit Submit. The tool will then search for its content elsewhere on the web and display a report if a similar webpage is found. If you also provide a URL, it will not query any search engines and instead display a report comparing the article to that particular webpage, like the Duplication Detector. Check out the FAQ for more information and technical details.

-

Note: The tool is still in its earliest beta stages. You are completely welcome to use it and provide feedback, but be aware that it may produce strange or broken results.

-
- - - - - - - - % if page: - - % elif query.title: - - % else: - - % endif - - - - % if query.url: - - % else: - - % endif - - % if query.nocache or (result and result.cached): - - - % if query.nocache: - - % else: - - % endif - - % endif - - - -
Site: - http:// - - . - - .org -
Page title:
URL (optional):
Bypass cache:
-
- % if page and result: -
-
- % if result.violation: -

${page.title | h} is a suspected violation of ${result.url | urlstrip, h}.

- % else: -

No violations detected in ${page.title | h}.

- % endif - - % if "EarwigCVShowDetails" in cookies and cookies["EarwigCVShowDetails"].value == "True": -
- % else: - -
- % endif -<%include file="/support/footer.mako" args="environ=environ, cookies=cookies"/> diff --git a/pages/index.mako b/pages/index.mako index 1d9981f..7d7fe5b 100644 --- a/pages/index.mako +++ b/pages/index.mako @@ -1,30 +1,142 @@ -<%! - from os import path - - tools = [ - ("Home", "home", "index", True, None), - ("Settings", "settings", "settings", True, None), - ("DIVIDER"), - ("Copyvio Detector", "copyvios", "copyvios", True, - 'Try to detect copyright violations in articles by searching the web for page content, or compare an article to a specific URL.'), - ] -%>\ -<% - root = path.dirname(environ["SCRIPT_NAME"]) - pretty = path.split(root)[0] -%>\ -<%def name="get_tools()"><% return tools %>\ -<%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='Home', slug='home'"/> -

My Tools

- % for tool in tools: - % if tool != "DIVIDER": - <% name, tool, link, complete, desc = tool %> - % if desc: -
-

${tool}: ${name}

-

${desc}

-
+<%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='Earwig's Copyvio Detector'"/>\ +<%namespace module="copyvios" import="main, highlight_delta"/>\ +<%namespace module="copyvios.misc" import="urlstrip"/>\ +<% query, bot, all_langs, all_projects, page, result = main(environ) %>\ + % if query.project and query.lang and query.title and not page: +
+

The given site (project=${query.project | h}, language=${query.lang | h}) doesn't seem to exist. It may also be closed or private. Confirm its URL.

+
+ % elif query.project and query.lang and query.title and page and not result: +
+

The given page doesn't seem to exist: ${page.title | h}.

+
+ % elif query.project and query.lang and query.title and query.url and page and result == "bad URI": + <% result = None %> +
+

Unsupported URI scheme: ${query.url | h}.

+
+ % endif +

Copyvio Detector

+

This tool attempts to detect copyright violations in articles. Simply give the title of the page you want to check and hit Submit. The tool will then search for its content elsewhere on the web and display a report if a similar webpage is found. If you also provide a URL, it will not query any search engines and instead display a report comparing the article to that particular webpage, like the Duplication Detector. Check out the FAQ for more information and technical details.

+

Note: The tool is still in its earliest beta stages. You are completely welcome to use it and provide feedback, but be aware that it may produce strange or broken results.

+
+ + + + + + + + % if page: + + % elif query.title: + + % else: + + % endif + + + + % if query.url: + + % else: + + % endif + + % if query.nocache or (result and result.cached): + + + % if query.nocache: + + % else: + + % endif + % endif - % endif - % endfor + + + +
Site: + http:// + + . + + .org +
Page title:
URL (optional):
Bypass cache:
+
+ % if page and result: +
+
+ % if result.violation: +

${page.title | h} is a suspected violation of ${result.url | urlstrip, h}.

+ % else: +

No violations detected in ${page.title | h}.

+ % endif + + % if "EarwigCVShowDetails" in cookies and cookies["EarwigCVShowDetails"].value == "True": +
+ % else: + +
+ % endif <%include file="/support/footer.mako" args="environ=environ, cookies=cookies"/> diff --git a/pages/settings.mako b/pages/settings.mako index 0581e5c..b30fcdf 100644 --- a/pages/settings.mako +++ b/pages/settings.mako @@ -1,14 +1,14 @@ -<% bot, status, langs, projects = main(environ, headers, cookies) %>\ -<%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='Settings'"/>\ -<%namespace module="toolserver.settings" import="main"/>\ +<%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='Settings - Earwig's Copyvio Detector'"/>\ +<%namespace module="copyvios.settings" import="main"/>\ <%! from json import dumps, loads %>\ +<% bot, status, langs, projects = main(environ, headers, cookies) %>\ % if status:

${status}

% endif

Settings

-

This page contains some configurable options for this Toolserver site. Settings are saved as cookies. You can view and delete all cookies generated by this site at the bottom of this page.

+

This page contains some configurable options for the copyvio detector. Settings are saved as cookies. You can view and delete all cookies generated by this site at the bottom of this page.

@@ -17,7 +17,7 @@ @@ -68,7 +68,7 @@

Cookies

% if cookies:
http:// .
- <% cookie_order = ["EarwigDefaultProject", "EarwigDefaultLang", "EarwigBackground", "EarwigScreenCache", "EarwigCVShowDetails"] %>\ + <% cookie_order = ["CopyviosDefaultProject", "CopyviosDefaultLang", "CopyviosBackground", "CopyviosShowDetails", "CopyviosScreenCache"] %>\ % for key in [key for key in cookie_order if key in cookies]: <% cookie = cookies[key] %>\ diff --git a/pages/support/footer.mako b/pages/support/footer.mako index 9ecb845..a711d08 100644 --- a/pages/support/footer.mako +++ b/pages/support/footer.mako @@ -1,35 +1,16 @@ <%page args="environ, cookies"/>\ -<%namespace module="toolserver.background" import="get_desc_url"/>\ -<%! - from os import path -%>\ -<% - root = path.dirname(environ["SCRIPT_NAME"]) - pretty = path.split(root)[0] -%>\ +<%namespace module="copyvios.background" import="get_desc_url"/>\
- - - - - - +

Copyright © 2009–2013 Ben Kurtovic • \ + Contact • \ + View Source • \ + % if ("CopyviosBackground" in cookies and cookies["CopyviosBackground"].value in ["potd", "list"]) or "CopyviosBackground" not in cookies: + Background • \ + % endif + Valid XHTML 1.0 Strict +

- \ No newline at end of file + diff --git a/pages/support/header.mako b/pages/support/header.mako index 65f8497..d4f2798 100644 --- a/pages/support/header.mako +++ b/pages/support/header.mako @@ -1,11 +1,9 @@ <%page args="environ, cookies, title, slug=None, add_css=(), add_js=()"/>\ -<%namespace module="toolserver.background" import="set_background"/>\ -<%namespace name="index" file="/index.mako" import="get_tools"/>\ +<%namespace module="copyvios.background" import="set_background"/>\ <%! from os import path %>\ <% - tools = get_tools() root = path.dirname(environ["SCRIPT_NAME"]) this = environ["PATH_INFO"] pretty = path.split(root)[0] @@ -18,20 +16,13 @@ - ${title} - earwig@toolserver - - % for filename in add_css: - - % endfor - - - % for filename in add_js: - - % endfor + ${title} + + - <% selected = cookies["EarwigBackground"].value if "EarwigBackground" in cookies else "plain" %>\ + <% selected = cookies["CopyviosBackground"].value if "CopyviosBackground" in cookies else "plain" %>\ % if selected == "plain": - + % else: <% bg_url = set_background(cookies, selected) %>\ diff --git a/static/images/background.png b/static/background.png similarity index 100% rename from static/images/background.png rename to static/background.png diff --git a/static/style.css b/static/style.css index f6e1211..04b97a3 100644 --- a/static/style.css +++ b/static/style.css @@ -86,11 +86,6 @@ p#links { margin: 8px 0 10px 0; } -table#footer-box { - width: 100%; - height: 100%; -} - table#cv-chain-table { width: 100%; border-spacing: 10px;