A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 

103 行
3.0 KiB

  1. function copyvio_toggle_details() {
  2. link = document.getElementById("cv-chain-link");
  3. table = document.getElementById("cv-chain-table");
  4. if (link.innerHTML == "Hide comparison:") {
  5. table.style.display = "none";
  6. link.innerHTML = "Show comparison:";
  7. set_cookie("CopyviosHideComparison", "True", 1095);
  8. } else {
  9. table.style.display = "table";
  10. link.innerHTML = "Hide comparison:";
  11. if (get_cookie("CopyviosHideComparison"))
  12. delete_cookie("CopyviosHideComparison");
  13. }
  14. }
  15. function update_screen_size() {
  16. var cache = cache_cookie();
  17. var data = {
  18. "width": window.screen.availWidth,
  19. "height": window.screen.availHeight
  20. }
  21. if (!cache || cache["width"] != data["width"] || cache["height"] != data["height"]) {
  22. set_cookie("CopyviosScreenCache", JSON.stringify(data), 1095);
  23. }
  24. }
  25. function cache_cookie() {
  26. var cookie = get_cookie("CopyviosScreenCache");
  27. if (cookie) {
  28. try {
  29. data = JSON.parse(cookie);
  30. var width = data.width;
  31. var height = data.height;
  32. if (width && height) {
  33. return {"width": width, "height": height};
  34. }
  35. }
  36. catch (SyntaxError) {}
  37. }
  38. return false;
  39. }
  40. // Cookie code partially based on http://www.quirksmode.org/js/cookies.html
  41. function get_cookie(name) {
  42. var nameEQ = name + "=";
  43. var ca = document.cookie.split(";");
  44. for (var i = 0; i < ca.length; i++) {
  45. var c = ca[i];
  46. while (c.charAt(0) == " ") {
  47. c = c.substring(1, c.length);
  48. }
  49. if (c.indexOf(nameEQ) == 0) {
  50. var value = window.atob(c.substring(nameEQ.length, c.length));
  51. if (value.indexOf("--cpv2") == 0) {
  52. return value.substring("--cpv2".length, value.length);
  53. }
  54. }
  55. }
  56. return null;
  57. }
  58. function set_cookie_with_date(name, value, date) {
  59. value = window.btoa("--cpv2" + value);
  60. var path = window.location.pathname.split("/", 2)[1];
  61. if (date) {
  62. var expires = "; expires=" + date.toUTCString();
  63. }
  64. else {
  65. var expires = "";
  66. }
  67. document.cookie = name + "=" + value + expires + "; path=/" + path;
  68. }
  69. function set_cookie(name, value, days) {
  70. if (days) {
  71. var date = new Date();
  72. date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
  73. set_cookie_with_date(name, value, date);
  74. }
  75. else {
  76. set_cookie_with_date(name, value);
  77. }
  78. }
  79. function delete_cookie(name) {
  80. set_cookie(name, "", -1);
  81. }
  82. $(document).ready(function() {
  83. $("#action-search").change(function() {
  84. $(".cv-search").prop("disabled", false);
  85. $(".cv-compare").prop("disabled", true);
  86. });
  87. $("#action-compare").change(function() {
  88. $(".cv-search").prop("disabled", true);
  89. $(".cv-compare").prop("disabled", false);
  90. });
  91. if ($("#action-search" ).is(":checked")) $("#action-search" ).change();
  92. if ($("#action-compare").is(":checked")) $("#action-compare").change();
  93. });