| @@ -21,7 +21,7 @@ def get_results(bot, site, query): | |||||
| result = page.copyvio_compare(query.url) | result = page.copyvio_compare(query.url) | ||||
| result.cached = False | result.cached = False | ||||
| else: | else: | ||||
| conn = open_sql_connection(bot, "copyvioCache") | |||||
| conn = open_sql_connection(bot, "cache") | |||||
| if not query.nocache: | if not query.nocache: | ||||
| result = _get_cached_results(page, conn) | result = _get_cached_results(page, conn) | ||||
| if query.nocache or not result: | if query.nocache or not result: | ||||
| @@ -1,93 +0,0 @@ | |||||
| div#cv-result-yes { | |||||
| padding: 5px 10px 0 10px; | |||||
| margin: 0 5px 10px 5px; | |||||
| background-color: #FEE; | |||||
| border: 1px solid #F77; | |||||
| } | |||||
| div#cv-result-no { | |||||
| padding: 5px 10px 0 10px; | |||||
| margin: 0 5px 10px 5px; | |||||
| background-color: #EFE; | |||||
| border: 1px solid #7F7; | |||||
| } | |||||
| div#cv-result-detail { | |||||
| padding: 0 10px 0 10px; | |||||
| margin: 10px 10px 20px 10px; | |||||
| background-color: #F3F3F3; | |||||
| border: 1px solid #AAA; | |||||
| } | |||||
| table#cv-chain-table { | |||||
| width: 100%; | |||||
| border-spacing: 10px; | |||||
| } | |||||
| h2#cv-result-header { | |||||
| margin-bottom: 0; | |||||
| } | |||||
| ul#cv-result-list { | |||||
| margin-top: 0.5em; | |||||
| } | |||||
| ul#cv-result-detail-list { | |||||
| margin-bottom: 0; | |||||
| } | |||||
| a#cv-cached { | |||||
| position: relative; | |||||
| } | |||||
| a#cv-cached span { | |||||
| display: none; | |||||
| position: absolute; | |||||
| top: 20px; | |||||
| left: -50px; | |||||
| width: 500px; | |||||
| padding: 5px; | |||||
| z-index: 1; | |||||
| background: #F3F3F3; | |||||
| border: 1px solid #AAA; | |||||
| color: black; | |||||
| } | |||||
| a:active#cv-cached { color: #040; text-decoration: none; } | |||||
| a:hover#cv-cached { text-decoration: none; } | |||||
| a:hover#cv-cached span { display: block; } | |||||
| div.cv-chain-detail { | |||||
| padding: 0 10px 0 10px; | |||||
| background-color: #FFF; | |||||
| border: 1px solid #BBB; | |||||
| } | |||||
| td.cv-chain-cell { | |||||
| width: 50%; | |||||
| vertical-align: top; | |||||
| } | |||||
| span.cv-hl { | |||||
| background: #FAA; | |||||
| } | |||||
| span.cv-hl-in { | |||||
| background: #FCC; | |||||
| background: -webkit-gradient(linear, 0% 0%, 100% 0%, from(#FFF), to(#FAA)); /* Chrome, Safari 4+ */ | |||||
| background: -webkit-linear-gradient(left, #FFF, #FAA); /* Chrome 10+, Safari 5+ */ | |||||
| background: -moz-linear-gradient(left, #FFF, #FAA); /* Firefox 3.6+ */ | |||||
| background: -ms-linear-gradient(left, #FFF, #FAA); /* IE 10+ */ | |||||
| background: -o-linear-gradient(left, #FFF, #FAA); /* Opera 11.10+ */ | |||||
| background: linear-gradient(left, #FFF, #FAA); | |||||
| } | |||||
| span.cv-hl-out { | |||||
| background: #FCC; | |||||
| background: -webkit-gradient(linear, 0% 0%, 100% 0%, from(#FAA), to(#FFF)); /* Chrome, Safari 4+ */ | |||||
| background: -webkit-linear-gradient(left, #FAA, #FFF); /* Chrome 10+, Safari 5+ */ | |||||
| background: -moz-linear-gradient(left, #FAA, #FFF); /* Firefox 3.6+ */ | |||||
| background: -ms-linear-gradient(left, #FAA, #FFF); /* IE 10+ */ | |||||
| background: -o-linear-gradient(left, #FAA, #FFF); /* Opera 11.10+ */ | |||||
| background: linear-gradient(left, #FAA, #FFF); | |||||
| } | |||||
| @@ -1,46 +0,0 @@ | |||||
| // Partially based on http://www.quirksmode.org/js/cookies.html | |||||
| function get_cookie(name) { | |||||
| var nameEQ = name + "="; | |||||
| var ca = document.cookie.split(";"); | |||||
| for (var i = 0; i < ca.length; i++) { | |||||
| var c = ca[i]; | |||||
| while (c.charAt(0) == " ") { | |||||
| c = c.substring(1, c.length); | |||||
| } | |||||
| if (c.indexOf(nameEQ) == 0) { | |||||
| var value = window.atob(c.substring(nameEQ.length, c.length)); | |||||
| if (value.indexOf("--ets1") == 0) { | |||||
| return value.substring("--ets1".length, value.length); | |||||
| } | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| function set_cookie_with_date(name, value, date) { | |||||
| value = window.btoa("--ets1" + value); | |||||
| var path = window.location.pathname.split("/", 2)[1]; | |||||
| if (date) { | |||||
| var expires = "; expires=" + date.toUTCString(); | |||||
| } | |||||
| else { | |||||
| var expires = ""; | |||||
| } | |||||
| document.cookie = name + "=" + value + expires + "; path=/" + path; | |||||
| } | |||||
| function set_cookie(name, value, days) { | |||||
| if (days) { | |||||
| var date = new Date(); | |||||
| date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); | |||||
| set_cookie_with_date(name, value, date); | |||||
| } | |||||
| else { | |||||
| set_cookie_with_date(name, value); | |||||
| } | |||||
| } | |||||
| function delete_cookie(name) { | |||||
| set_cookie(name, "", -1); | |||||
| } | |||||
| @@ -1,16 +0,0 @@ | |||||
| function copyvio_toggle_details(details) { | |||||
| link = document.getElementById("cv-result-detail-link"); | |||||
| details = document.getElementById("cv-result-detail"); | |||||
| if (link.innerHTML == "Show details:") { | |||||
| details.style.display = "block"; | |||||
| link.innerHTML = "Hide details:"; | |||||
| set_cookie("EarwigCVShowDetails", "True", 1095); | |||||
| } else { | |||||
| details.style.display = "none"; | |||||
| link.innerHTML = "Show details:"; | |||||
| if (get_cookie("EarwigCVShowDetails")) { | |||||
| delete_cookie("EarwigCVShowDetails"); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,26 +0,0 @@ | |||||
| function update_screen_size() { | |||||
| var cache = cache_cookie(); | |||||
| var data = { | |||||
| "width": window.screen.availWidth, | |||||
| "height": window.screen.availHeight | |||||
| } | |||||
| if (!cache || cache["width"] != data["width"] || cache["height"] != data["height"]) { | |||||
| set_cookie("EarwigScreenCache", JSON.stringify(data), 1095); | |||||
| } | |||||
| } | |||||
| function cache_cookie() { | |||||
| var cookie = get_cookie("EarwigScreenCache"); | |||||
| if (cookie) { | |||||
| try { | |||||
| data = JSON.parse(cookie); | |||||
| var width = data.width; | |||||
| var height = data.height; | |||||
| if (width && height) { | |||||
| return {"width": width, "height": height}; | |||||
| } | |||||
| } | |||||
| catch (SyntaxError) {} | |||||
| } | |||||
| return false; | |||||
| } | |||||
| @@ -0,0 +1,90 @@ | |||||
| function copyvio_toggle_details(details) { | |||||
| link = document.getElementById("cv-result-detail-link"); | |||||
| details = document.getElementById("cv-result-detail"); | |||||
| if (link.innerHTML == "Show details:") { | |||||
| details.style.display = "block"; | |||||
| link.innerHTML = "Hide details:"; | |||||
| set_cookie("CopyviosCVShowDetails", "True", 1095); | |||||
| } else { | |||||
| details.style.display = "none"; | |||||
| link.innerHTML = "Show details:"; | |||||
| if (get_cookie("CopyviosCVShowDetails")) { | |||||
| delete_cookie("CopyviosCVShowDetails"); | |||||
| } | |||||
| } | |||||
| } | |||||
| function update_screen_size() { | |||||
| var cache = cache_cookie(); | |||||
| var data = { | |||||
| "width": window.screen.availWidth, | |||||
| "height": window.screen.availHeight | |||||
| } | |||||
| if (!cache || cache["width"] != data["width"] || cache["height"] != data["height"]) { | |||||
| set_cookie("CopyviosScreenCache", JSON.stringify(data), 1095); | |||||
| } | |||||
| } | |||||
| function cache_cookie() { | |||||
| var cookie = get_cookie("CopyviosScreenCache"); | |||||
| if (cookie) { | |||||
| try { | |||||
| data = JSON.parse(cookie); | |||||
| var width = data.width; | |||||
| var height = data.height; | |||||
| if (width && height) { | |||||
| return {"width": width, "height": height}; | |||||
| } | |||||
| } | |||||
| catch (SyntaxError) {} | |||||
| } | |||||
| return false; | |||||
| } | |||||
| // Cookie code partially based on http://www.quirksmode.org/js/cookies.html | |||||
| function get_cookie(name) { | |||||
| var nameEQ = name + "="; | |||||
| var ca = document.cookie.split(";"); | |||||
| for (var i = 0; i < ca.length; i++) { | |||||
| var c = ca[i]; | |||||
| while (c.charAt(0) == " ") { | |||||
| c = c.substring(1, c.length); | |||||
| } | |||||
| if (c.indexOf(nameEQ) == 0) { | |||||
| var value = window.atob(c.substring(nameEQ.length, c.length)); | |||||
| if (value.indexOf("--cpv2") == 0) { | |||||
| return value.substring("--cpv2".length, value.length); | |||||
| } | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| function set_cookie_with_date(name, value, date) { | |||||
| value = window.btoa("--cpv2" + value); | |||||
| var path = window.location.pathname.split("/", 2)[1]; | |||||
| if (date) { | |||||
| var expires = "; expires=" + date.toUTCString(); | |||||
| } | |||||
| else { | |||||
| var expires = ""; | |||||
| } | |||||
| document.cookie = name + "=" + value + expires + "; path=/" + path; | |||||
| } | |||||
| function set_cookie(name, value, days) { | |||||
| if (days) { | |||||
| var date = new Date(); | |||||
| date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); | |||||
| set_cookie_with_date(name, value, date); | |||||
| } | |||||
| else { | |||||
| set_cookie_with_date(name, value); | |||||
| } | |||||
| } | |||||
| function delete_cookie(name) { | |||||
| set_cookie(name, "", -1); | |||||
| } | |||||
| @@ -53,6 +53,27 @@ div#foot-divider { | |||||
| border-bottom: 1px solid #777; | border-bottom: 1px solid #777; | ||||
| } | } | ||||
| div#cv-result-yes { | |||||
| padding: 5px 10px 0 10px; | |||||
| margin: 0 5px 10px 5px; | |||||
| background-color: #FEE; | |||||
| border: 1px solid #F77; | |||||
| } | |||||
| div#cv-result-no { | |||||
| padding: 5px 10px 0 10px; | |||||
| margin: 0 5px 10px 5px; | |||||
| background-color: #EFE; | |||||
| border: 1px solid #7F7; | |||||
| } | |||||
| div#cv-result-detail { | |||||
| padding: 0 10px 0 10px; | |||||
| margin: 10px 10px 20px 10px; | |||||
| background-color: #F3F3F3; | |||||
| border: 1px solid #AAA; | |||||
| } | |||||
| p#heading { | p#heading { | ||||
| font-size: 2.5em; | font-size: 2.5em; | ||||
| font-weight: bold; | font-weight: bold; | ||||
| @@ -70,6 +91,40 @@ table#footer-box { | |||||
| height: 100%; | height: 100%; | ||||
| } | } | ||||
| table#cv-chain-table { | |||||
| width: 100%; | |||||
| border-spacing: 10px; | |||||
| } | |||||
| h2#cv-result-header { | |||||
| margin-bottom: 0; | |||||
| } | |||||
| ul#cv-result-list { | |||||
| margin-top: 0.5em; | |||||
| } | |||||
| ul#cv-result-detail-list { | |||||
| margin-bottom: 0; | |||||
| } | |||||
| a#cv-cached { | |||||
| position: relative; | |||||
| } | |||||
| a#cv-cached span { | |||||
| display: none; | |||||
| position: absolute; | |||||
| top: 20px; | |||||
| left: -50px; | |||||
| width: 500px; | |||||
| padding: 5px; | |||||
| z-index: 1; | |||||
| background: #F3F3F3; | |||||
| border: 1px solid #AAA; | |||||
| color: black; | |||||
| } | |||||
| div.toolbox { | div.toolbox { | ||||
| margin: 15px 0 15px 0; | margin: 15px 0 15px 0; | ||||
| padding: 0 6px 0 6px; | padding: 0 6px 0 6px; | ||||
| @@ -101,6 +156,12 @@ div.indentable { | |||||
| white-space: pre-wrap; | white-space: pre-wrap; | ||||
| } | } | ||||
| div.cv-chain-detail { | |||||
| padding: 0 10px 0 10px; | |||||
| background-color: #FFF; | |||||
| border: 1px solid #BBB; | |||||
| } | |||||
| p.toolname { | p.toolname { | ||||
| font-size: 18px; | font-size: 18px; | ||||
| margin: 6px 0 6px 0; | margin: 6px 0 6px 0; | ||||
| @@ -121,6 +182,35 @@ span.online { | |||||
| font-weight: bold; | font-weight: bold; | ||||
| } | } | ||||
| td.cv-chain-cell { | |||||
| width: 50%; | |||||
| vertical-align: top; | |||||
| } | |||||
| span.cv-hl { | |||||
| background: #FAA; | |||||
| } | |||||
| span.cv-hl-in { | |||||
| background: #FCC; | |||||
| background: -webkit-gradient(linear, 0% 0%, 100% 0%, from(#FFF), to(#FAA)); /* Chrome, Safari 4+ */ | |||||
| background: -webkit-linear-gradient(left, #FFF, #FAA); /* Chrome 10+, Safari 5+ */ | |||||
| background: -moz-linear-gradient(left, #FFF, #FAA); /* Firefox 3.6+ */ | |||||
| background: -ms-linear-gradient(left, #FFF, #FAA); /* IE 10+ */ | |||||
| background: -o-linear-gradient(left, #FFF, #FAA); /* Opera 11.10+ */ | |||||
| background: linear-gradient(left, #FFF, #FAA); | |||||
| } | |||||
| span.cv-hl-out { | |||||
| background: #FCC; | |||||
| background: -webkit-gradient(linear, 0% 0%, 100% 0%, from(#FAA), to(#FFF)); /* Chrome, Safari 4+ */ | |||||
| background: -webkit-linear-gradient(left, #FAA, #FFF); /* Chrome 10+, Safari 5+ */ | |||||
| background: -moz-linear-gradient(left, #FAA, #FFF); /* Firefox 3.6+ */ | |||||
| background: -ms-linear-gradient(left, #FAA, #FFF); /* IE 10+ */ | |||||
| background: -o-linear-gradient(left, #FAA, #FFF); /* Opera 11.10+ */ | |||||
| background: linear-gradient(left, #FAA, #FFF); | |||||
| } | |||||
| span.light { color: #CCC; } | span.light { color: #CCC; } | ||||
| span.medium { color: #AAA; } | span.medium { color: #AAA; } | ||||
| @@ -143,3 +233,7 @@ a.mid:link { color: #AAA; } | |||||
| a.mid:visited { color: #AAA; } | a.mid:visited { color: #AAA; } | ||||
| a.mid:hover { color: #888; } | a.mid:hover { color: #888; } | ||||
| a.mid:active { color: #666; } | a.mid:active { color: #666; } | ||||
| a:active#cv-cached { color: #040; text-decoration: none; } | |||||
| a:hover#cv-cached { text-decoration: none; } | |||||
| a:hover#cv-cached span { display: block; } | |||||