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.
 
 
 
 
 

107 rivejä
3.2 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. $(document).ready(function() {
  69. $("#action-search").change(function() {
  70. $(".cv-search").prop("disabled", false);
  71. $(".cv-compare").prop("disabled", true);
  72. });
  73. $("#action-compare").change(function() {
  74. $(".cv-search").prop("disabled", true);
  75. $(".cv-compare").prop("disabled", false);
  76. });
  77. if ($("#action-search" ).is(":checked")) $("#action-search" ).change();
  78. if ($("#action-compare").is(":checked")) $("#action-compare").change();
  79. $("#cv-form").submit(function() {
  80. if ($("#action-search").is(":checked")) {
  81. if ($("#cv-cb-engine").is(":checked"))
  82. $(".cv-search[type='hidden'][name='use_engine']").prop("disabled", true);
  83. if ($("#cv-cb-links").is(":checked"))
  84. $(".cv-search[type='hidden'][name='use_links']").prop("disabled", true);
  85. }
  86. });
  87. if ($("#cv-additional").length) {
  88. $("#cv-additional").css("display", "block");
  89. $(".source-default-hidden").css("display", "none");
  90. $("#show-additional-sources").click(function() {
  91. $(".source-default-hidden").css("display", "");
  92. $("#cv-additional").css("display", "none");
  93. return false;
  94. });
  95. }
  96. });