A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

script.js 4.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. if ($("#cv-cb-engine").is(":checked"))
  110. $(".cv-search[type='hidden'][name='use_engine']").prop("disabled", true);
  111. if ($("#cv-cb-links").is(":checked"))
  112. $(".cv-search[type='hidden'][name='use_links']").prop("disabled", true);
  113. }
  114. });
  115. if ($("#cv-additional").length >= 0) {
  116. $("#cv-additional").css("display", "block");
  117. $(".source-default-hidden").css("display", "none");
  118. $("#show-additional-sources").click(function() {
  119. $(".source-default-hidden").css("display", "");
  120. $("#cv-additional").css("display", "none");
  121. return false;
  122. });
  123. }
  124. install_notice();
  125. });