A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

copyvios.mako 9.7 KiB

12 vuotta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='Copyvio Detector', add_css=('copyvios.css',), add_js=('copyvios.js',)"/>\
  2. <%namespace module="toolserver.copyvios" import="main, highlight_delta"/>\
  3. <%namespace module="toolserver.misc" import="urlstrip"/>\
  4. <% query, bot, all_langs, all_projects, page, result = main(environ) %>\
  5. % if query.project and query.lang and query.title and not page:
  6. <div class="red-box">
  7. <p>The given site (project=<b><tt>${query.project | h}</tt></b>, language=<b><tt>${query.lang | h}</tt></b>) doesn't seem to exist. It may also be closed or private. <a href="//${query.lang | h}.${query.project | h}.org/">Confirm its URL.</a></p>
  8. </div>
  9. % elif query.project and query.lang and query.title and page and not result:
  10. <div class="red-box">
  11. <p>The given page doesn't seem to exist: <a href="${page.url}">${page.title | h}</a>.</p>
  12. </div>
  13. % endif
  14. <h1>Copyvio Detector</h1>
  15. <p>This tool attempts to detect <a href="//en.wikipedia.org/wiki/WP:COPYVIO">copyright violations</a> 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 <a href="//toolserver.org/~dcoetzee/duplicationdetector/">Duplication Detector</a>. Check out the <a href="//en.wikipedia.org/wiki/User:EarwigBot/Copyvios/FAQ">FAQ</a> for more information and technical details.</p>
  16. <form action="${environ['PATH_INFO']}" method="get">
  17. <table>
  18. <tr>
  19. <td>Site:</td>
  20. <td>
  21. <tt>http://</tt>
  22. <select name="lang">
  23. <% selected_lang = query.orig_lang if query.orig_lang else cookies["EarwigDefaultLang"].value if "EarwigDefaultLang" in cookies else bot.wiki.get_site().lang %>\
  24. % for code, name in all_langs:
  25. % if code == selected_lang:
  26. <option value="${code | h}" selected="selected">${name}</option>
  27. % else:
  28. <option value="${code | h}">${name}</option>
  29. % endif
  30. % endfor
  31. </select>
  32. <tt>.</tt>
  33. <select name="project">
  34. <% selected_project = query.project if query.project else cookies["EarwigDefaultProject"].value if "EarwigDefaultProject" in cookies else bot.wiki.get_site().project %>\
  35. % for code, name in all_projects:
  36. % if code == selected_project:
  37. <option value="${code | h}" selected="selected">${name}</option>
  38. % else:
  39. <option value="${code | h}">${name}</option>
  40. % endif
  41. % endfor
  42. </select>
  43. <tt>.org</tt>
  44. </td>
  45. </tr>
  46. <tr>
  47. <td>Page title:</td>
  48. % if page:
  49. <td><input type="text" name="title" size="60" value="${page.title | h}" /></td>
  50. % elif query.title:
  51. <td><input type="text" name="title" size="60" value="${query.title | h}" /></td>
  52. % else:
  53. <td><input type="text" name="title" size="60" /></td>
  54. % endif
  55. </tr>
  56. <tr>
  57. <td>URL (optional):</td>
  58. % if query.url:
  59. <td><input type="text" name="url" size="120" value="${query.url | h}" /></td>
  60. % else:
  61. <td><input type="text" name="url" size="120" /></td>
  62. % endif
  63. </tr>
  64. % if query.nocache or (result and result.cached):
  65. <tr>
  66. <td>Bypass cache:</td>
  67. % if query.nocache:
  68. <td><input type="checkbox" name="nocache" value="1" checked="checked" /></td>
  69. % else:
  70. <td><input type="checkbox" name="nocache" value="1" /></td>
  71. % endif
  72. </tr>
  73. % endif
  74. <tr>
  75. <td><button type="submit">Submit</button></td>
  76. </tr>
  77. </table>
  78. </form>
  79. % if page and result:
  80. <div class="divider"></div>
  81. <div id="cv-result-${'yes' if result.violation else 'no'}">
  82. % if result.violation:
  83. <h2 id="cv-result-header"><a href="${page.url}">${page.title | h}</a> is a suspected violation of <a href="${result.url | h}">${result.url | urlstrip, h}</a>.</h2>
  84. % else:
  85. <h2 id="cv-result-header">No violations detected in <a href="${page.url}">${page.title | h}</a>.</h2>
  86. % endif
  87. <ul id="cv-result-list">
  88. % if not result.violation and not query.url:
  89. <li>Best match: <a href="${result.url | h}">${result.url | urlstrip, h}</a>.</li>
  90. % endif
  91. <li><b><tt>${round(result.confidence * 100, 1)}%</tt></b> confidence of a violation.</li>
  92. % if result.cached:
  93. <li>Results are <a id="cv-cached" href="#">cached
  94. <span>To save time (and money), this tool will retain the results of checks for up to 72 hours. This includes the URL of the "violated" source, but neither its content nor the content of the article. Future checks on the same page (assuming it remains unchanged) will not involve additional search queries, but a fresh comparison against the source URL will be made. If the page is modified, a new check will be run.</span>
  95. </a> from ${result.cache_time} (${result.cache_age} ago). <a href="${environ['REQUEST_URI'] | h}&amp;nocache=1">Bypass the cache.</a></li>
  96. % else:
  97. <li>Results generated in <tt>${round(result.time, 3)}</tt> seconds using <tt>${result.queries}</tt> queries.</li>
  98. % endif
  99. % if "EarwigCVShowDetails" in cookies and cookies["EarwigCVShowDetails"].value == "True":
  100. <li><a id="cv-result-detail-link" href="#cv-result-detail" onclick="copyvio_toggle_details()">Hide details:</a></li>
  101. % else:
  102. <li><a id="cv-result-detail-link" href="#cv-result-detail" onclick="copyvio_toggle_details()">Show details:</a></li>
  103. % endif
  104. </ul>
  105. % if "EarwigCVShowDetails" in cookies and cookies["EarwigCVShowDetails"].value == "True":
  106. <div id="cv-result-detail" style="display: block;">
  107. % else:
  108. <div id="cv-result-detail" style="display: none;">
  109. % endif
  110. <ul id="cv-result-detail-list">
  111. <li>Trigrams: <i>Article:</i> <tt>${result.article_chain.size()}</tt> / <i>Source:</i> <tt>${result.source_chain.size()}</tt> / <i>Delta:</i> <tt>${result.delta_chain.size()}</tt></li>
  112. % if result.cached:
  113. % if result.queries:
  114. <li>Retrieved from cache in <tt>${round(result.time, 3)}</tt> seconds (originally generated in <tt>${round(result.original_time, 3)}</tt>s using <tt>${result.queries}</tt> queries; <tt>${round(result.original_time - result.time, 3)}</tt>s saved).</li>
  115. % else:
  116. <li>Retrieved from cache in <tt>${round(result.time, 3)}</tt> seconds (originally generated in <tt>${round(result.original_time, 3)}</tt>s; <tt>${round(result.original_time - result.time, 3)}</tt>s saved).</li>
  117. % endif
  118. % endif
  119. % if result.queries:
  120. <li><i>Fun fact:</i> The Wikimedia Foundation paid Yahoo! Inc. <a href="http://info.yahoo.com/legal/us/yahoo/search/bosspricing/details.html">$${result.queries * 0.0008} USD</a> for these results.</li>
  121. % endif
  122. </ul>
  123. <table id="cv-chain-table">
  124. <tr>
  125. <td>Article: <div class="cv-chain-detail">${highlight_delta(result.article_chain, result.delta_chain)}</div></td>
  126. <td>Source: <div class="cv-chain-detail">${highlight_delta(result.source_chain, result.delta_chain)}</div></td>
  127. </tr>
  128. </table>
  129. </div>
  130. </div>
  131. % endif
  132. <%include file="/support/footer.mako" args="environ=environ, cookies=cookies"/>