A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 

123 řádky
3.7 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. $("#cv-form").submit(function() {
  94. if ($("#action-search").is(":checked")) {
  95. if ($("#cv-cb-engine").is(":checked"))
  96. $(".cv-search[type='hidden'][name='use_engine'").prop("disabled", true);
  97. if ($("#cv-cb-links").is(":checked"))
  98. $(".cv-search[type='hidden'][name='use_links'").prop("disabled", true);
  99. }
  100. });
  101. if ($("#cv-additional").length) {
  102. $("#cv-additional").css("display", "block");
  103. $(".source-default-hidden").css("display", "none");
  104. $("#show-additional-sources").click(function() {
  105. $(".source-default-hidden").css("display", "");
  106. $("#cv-additional").css("display", "none");
  107. return false;
  108. });
  109. }
  110. });