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.
 
 
 
 
 

151 lines
11 KiB

  1. <%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='Earwig\'s Copyvio Detector'"/>\
  2. <%namespace module="copyvios" import="main, highlight_delta"/>\
  3. <%namespace module="copyvios.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><span class="mono">${query.project | h}</span></b>, language=<b><span class="mono">${query.lang | h}</span></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. % elif query.project and query.lang and query.title and query.url and page and result == "bad URI":
  14. <% result = None %>
  15. <div class="red-box">
  16. <p>Unsupported URI scheme: <a href="${query.url | h}">${query.url | h}</a>.</p>
  17. </div>
  18. % endif
  19. <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 or ID of the revision you want to check and hit Submit. The tool will search for similar content elsewhere on the web and display a report if a match 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>
  20. <p><i>Note:</i> The tool is still in beta. You are completely welcome to use it and provide <a href="//en.wikipedia.org/wiki/User_talk:The_Earwig">feedback</a>, but be aware that it may produce strange or broken results.</p>
  21. <form action="${environ['SCRIPT_URL']}" method="get">
  22. <table id="cv-form">
  23. <tr>
  24. <td>Site:</td>
  25. <td colspan="3">
  26. <span class="mono">http://</span>
  27. <select name="lang">
  28. <% selected_lang = query.orig_lang if query.orig_lang else cookies["CopyviosDefaultLang"].value if "CopyviosDefaultLang" in cookies else bot.wiki.get_site().lang %>\
  29. % for code, name in all_langs:
  30. % if code == selected_lang:
  31. <option value="${code | h}" selected="selected">${name}</option>
  32. % else:
  33. <option value="${code | h}">${name}</option>
  34. % endif
  35. % endfor
  36. </select>
  37. <span class="mono">.</span>
  38. <select name="project">
  39. <% selected_project = query.project if query.project else cookies["CopyviosDefaultProject"].value if "CopyviosDefaultProject" in cookies else bot.wiki.get_site().project %>\
  40. % for code, name in all_projects:
  41. % if code == selected_project:
  42. <option value="${code | h}" selected="selected">${name}</option>
  43. % else:
  44. <option value="${code | h}">${name}</option>
  45. % endif
  46. % endfor
  47. </select>
  48. <span class="mono">.org</span>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td id="cv-col1">Page&nbsp;title:</td>
  53. <td id="cv-col2">
  54. % if page:
  55. <input class="cv-text" type="text" name="title" value="${page.title | h}" />
  56. % elif query.title:
  57. <input class="cv-text" type="text" name="title" value="${query.title | h}" />
  58. % else:
  59. <input class="cv-text" type="text" name="title" />
  60. % endif
  61. </td>
  62. <td id="cv-col3">or&nbsp;revision&nbsp;ID:</td>
  63. <td id="cv-col4">
  64. % if query.oldid:
  65. <input class="cv-text" type="text" name="oldid" value="${query.oldid | h}" />
  66. % else:
  67. <input class="cv-text" type="text" name="oldid" />
  68. % endif
  69. </td>
  70. </tr>
  71. <tr>
  72. <td>URL&nbsp;(optional):</td>
  73. <td colspan="3">
  74. % if query.url:
  75. <input class="cv-text" type="text" name="url" value="${query.url | h}" />
  76. % else:
  77. <input class="cv-text" type="text" name="url" />
  78. % endif
  79. </td>
  80. </tr>
  81. % if query.nocache or (result and result.cached):
  82. <tr>
  83. <td>Bypass&nbsp;cache:</td>
  84. <td colspan="3">
  85. % if query.nocache:
  86. <input type="checkbox" name="nocache" value="1" checked="checked" />
  87. % else:
  88. <input type="checkbox" name="nocache" value="1" />
  89. % endif
  90. </td>
  91. </tr>
  92. % endif
  93. <tr>
  94. <td colspan="4">
  95. <button type="submit">Submit</button>
  96. </td>
  97. </tr>
  98. </table>
  99. </form>
  100. % if page and result:
  101. <% show_details = "CopyviosShowDetails" in cookies and cookies["CopyviosShowDetails"].value == "True" %>
  102. <div class="divider"></div>
  103. <div id="cv-result-${'yes' if result.violation else 'no'}">
  104. % if result.violation:
  105. <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>
  106. % else:
  107. <h2 id="cv-result-header">No violations detected in <a href="${page.url}">${page.title | h}</a>.</h2>
  108. % endif
  109. <ul id="cv-result-list">
  110. % if not result.violation and not query.url:
  111. % if result.url:
  112. <li>Best match: <a href="${result.url | h}">${result.url | urlstrip, h}</a>.</li>
  113. % else:
  114. <li>No matches found.</li>
  115. % endif
  116. % endif
  117. <li><b><span class="mono">${round(result.confidence * 100, 1)}%</span></b> confidence of a violation.</li>
  118. % if result.cached:
  119. <li>Results are <a id="cv-cached" href="#">cached
  120. <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>
  121. </a> from ${result.cache_time} (${result.cache_age} ago). <a href="${environ['REQUEST_URI'] | h}&amp;nocache=1">Bypass the cache.</a></li>
  122. % else:
  123. <li>Results generated in <span class="mono">${round(result.time, 3)}</span> seconds using <span class="mono">${result.queries}</span> queries.</li>
  124. % endif
  125. <li><a id="cv-result-detail-link" href="#cv-result-detail" onclick="copyvio_toggle_details()">${"Hide" if show_details else "Show"} details:</a></li>
  126. </ul>
  127. <div id="cv-result-detail" style="display: ${'block' if show_details else 'none'};">
  128. <ul id="cv-result-detail-list">
  129. <li>Trigrams: <i>Article:</i> <span class="mono">${result.article_chain.size()}</span> / <i>Source:</i> <span class="mono">${result.source_chain.size()}</span> / <i>Delta:</i> <span class="mono">${result.delta_chain.size()}</span></li>
  130. % if result.cached:
  131. % if result.queries:
  132. <li>Retrieved from cache in <span class="mono">${round(result.time, 3)}</span> seconds (originally generated in <span class="mono">${round(result.original_time, 3)}</span>s using <span class="mono">${result.queries}</span> queries; <span class="mono">${round(result.original_time - result.time, 3)}</span>s saved).</li>
  133. % else:
  134. <li>Retrieved from cache in <span class="mono">${round(result.time, 3)}</span> seconds (originally generated in <span class="mono">${round(result.original_time, 3)}</span>s; <span class="mono">${round(result.original_time - result.time, 3)}</span>s saved).</li>
  135. % endif
  136. % endif
  137. % if result.queries:
  138. <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>
  139. % endif
  140. </ul>
  141. <table id="cv-chain-table">
  142. <tr>
  143. <td class="cv-chain-cell">Article: <div class="cv-chain-detail"><p>${highlight_delta(result.article_chain, result.delta_chain)}</p></div></td>
  144. <td class="cv-chain-cell">Source: <div class="cv-chain-detail"><p>${highlight_delta(result.source_chain, result.delta_chain)}</p></div></td>
  145. </tr>
  146. </table>
  147. </div>
  148. </div>
  149. % endif
  150. <%include file="/support/footer.mako" args="environ=environ, cookies=cookies"/>