A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

143 righe
4.1 KiB

  1. function update_screen_size() {
  2. var cache = cache_cookie();
  3. var data = {
  4. "width": window.screen.availWidth,
  5. "height": window.screen.availHeight
  6. }
  7. if (!cache || cache["width"] != data["width"] || cache["height"] != data["height"]) {
  8. set_cookie("CopyviosScreenCache", JSON.stringify(data), 1095);
  9. }
  10. }
  11. function cache_cookie() {
  12. var cookie = get_cookie("CopyviosScreenCache");
  13. if (cookie) {
  14. try {
  15. data = JSON.parse(cookie);
  16. var width = data.width;
  17. var height = data.height;
  18. if (width && height) {
  19. return {"width": width, "height": height};
  20. }
  21. }
  22. catch (SyntaxError) {}
  23. }
  24. return false;
  25. }
  26. // Cookie code partially based on http://www.quirksmode.org/js/cookies.html
  27. function get_cookie(name) {
  28. var nameEQ = name + "=";
  29. var ca = document.cookie.split(";");
  30. for (var i = 0; i < ca.length; i++) {
  31. var c = ca[i];
  32. while (c.charAt(0) == " ") {
  33. c = c.substring(1, c.length);
  34. }
  35. if (c.indexOf(nameEQ) == 0) {
  36. var value = window.atob(c.substring(nameEQ.length, c.length));
  37. if (value.indexOf("--cpv2") == 0) {
  38. return value.substring("--cpv2".length, value.length);
  39. }
  40. }
  41. }
  42. return null;
  43. }
  44. function set_cookie_with_date(name, value, date) {
  45. value = window.btoa("--cpv2" + value);
  46. var path = window.location.pathname.split("/", 2)[1];
  47. if (date) {
  48. var expires = "; expires=" + date.toUTCString();
  49. }
  50. else {
  51. var expires = "";
  52. }
  53. document.cookie = name + "=" + value + expires + "; path=/" + path;
  54. }
  55. function set_cookie(name, value, days) {
  56. if (days) {
  57. var date = new Date();
  58. date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
  59. set_cookie_with_date(name, value, date);
  60. }
  61. else {
  62. set_cookie_with_date(name, value);
  63. }
  64. }
  65. function delete_cookie(name) {
  66. set_cookie(name, "", -1);
  67. }
  68. function toggle_notice() {
  69. var details = $("#notice-collapse-box"),
  70. trigger = $("#notice-collapse-trigger");
  71. if (details.is(":hidden")) {
  72. details.show();
  73. trigger.text("[hide]");
  74. }
  75. else {
  76. details.hide();
  77. trigger.text("[show]");
  78. }
  79. }
  80. function install_notice() {
  81. var details = $("#notice-collapse-box"),
  82. trigger = $("#notice-collapse-trigger");
  83. if (details.length >= 0 && trigger.length >= 0) {
  84. trigger.replaceWith($("<a/>", {
  85. id: "notice-collapse-trigger",
  86. href: "#",
  87. text: "[show]",
  88. click: function() {
  89. toggle_notice();
  90. return false;
  91. }
  92. }));
  93. details.hide();
  94. }
  95. }
  96. $(document).ready(function() {
  97. $("#action-search").change(function() {
  98. $(".cv-search").prop("disabled", false);
  99. $(".cv-compare").prop("disabled", true);
  100. });
  101. $("#action-compare").change(function() {
  102. $(".cv-search").prop("disabled", true);
  103. $(".cv-compare").prop("disabled", false);
  104. });
  105. if ($("#action-search" ).is(":checked")) $("#action-search" ).change();
  106. if ($("#action-compare").is(":checked")) $("#action-compare").change();
  107. $("#cv-form").submit(function() {
  108. if ($("#action-search").is(":checked")) {
  109. var hidden = [
  110. ["engine", "use_engine"], ["links", "use_links"],
  111. ["turnitin", "turnitin"]];
  112. $.each(hidden, function(i, val) {
  113. if ($("#cv-cb-" + val[0]).is(":checked"))
  114. $("#cv-form input[type='hidden'][name='" + val[1] + "']")
  115. .prop("disabled", true);
  116. });
  117. }
  118. });
  119. if ($("#cv-additional").length >= 0) {
  120. $("#cv-additional").css("display", "block");
  121. $(".source-default-hidden").css("display", "none");
  122. $("#show-additional-sources").click(function() {
  123. $(".source-default-hidden").css("display", "");
  124. $("#cv-additional").css("display", "none");
  125. return false;
  126. });
  127. }
  128. install_notice();
  129. });