Redacted.CH :: Artist Focus & HTML5 Upload Form Validation

Type directly the artist you are looking for without clicking on "artist" field in the header

当前为 2019-07-26 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Redacted.CH :: Artist Focus & HTML5 Upload Form Validation
  3. // @description Type directly the artist you are looking for without clicking on "artist" field in the header
  4. // @include http*://*redacted.ch/*
  5. // @version 1.6
  6. // @icon https://redacted.ch/favicon.ico
  7. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
  8. // @grant GM_getValue
  9. // @namespace https://greasyfork.org/users/2290
  10. // ==/UserScript==
  11.  
  12.  
  13. // Get Document URL
  14. var url = document.URL;
  15. // Get the PHP page
  16. var elem = url.split('/');
  17. var page = elem[3];
  18.  
  19. var page_detect = false;
  20.  
  21. var pageid = page.split("?")[0];
  22. var page = pageid;
  23.  
  24. // Upload Page
  25. if(page == "upload.php"){
  26. page_detect = true;
  27. $("#artist").focus();
  28. // Add HTML5 Form validation
  29. $('#file').prop('required',true);
  30. $('#artist').prop('required',true);
  31. $('#title').prop('required',true);
  32. $('#year').prop('required',true);
  33. $('#releasetype').prop('required',true);
  34. $("#releasetype").val('0');
  35. $('#format').prop('required',true);
  36. $('#bitrate').prop('required',true);
  37. $('#media').prop('required',true);
  38. $('#tags').prop('required',true);
  39. $('#album_desc').prop('required',true);
  40. }
  41.  
  42. // Top 10 Page
  43. if(page == "top10.php"){
  44. page_detect = true;
  45. if(url.indexOf("#") != -1){
  46. }
  47. // No achor, we focus the artist field
  48. else {
  49. $("#tags").focus();
  50. }
  51. }
  52.  
  53. // Torrents Page
  54. if(page == "torrents.php"){
  55. page_detect = true;
  56. if(url.indexOf("#") != -1){
  57. }
  58. // No achor, we focus the artist field
  59. else {
  60. $("#torrentssearch").focus();
  61. }
  62. }
  63.  
  64. // Requests Page
  65. if(page == "requests.php"){
  66. page_detect = true;
  67. if(url.indexOf("#") != -1){
  68. }
  69. // No achor, we focus the artist field
  70. else {
  71. $("#requestssearch").focus();
  72. }
  73. }
  74.  
  75. // Forums Page
  76. if(page == "forums.php" || page == "userhistory.php"){
  77. page_detect = true;
  78. if(url.indexOf("#") != -1){
  79. }
  80. // No achor, we focus the artist field
  81. else {
  82. $("#forumssearch").focus();
  83. }
  84. }
  85.  
  86. if(page == "log.php"){
  87. page_detect = true;
  88. if(url.indexOf("#") != -1){
  89. }
  90. // No achor, we focus the artist field
  91. else {
  92. $("#logsearch").focus();
  93. }
  94. }
  95.  
  96. // Friends Page
  97. if(page == "friends.php"){
  98. page_detect = true;
  99. if(url.indexOf("#") != -1){
  100. }
  101. // No achor, we focus the artist field
  102. else {
  103. $("#userssearch").focus();
  104. }
  105. }
  106.  
  107. // Logchecker Page
  108. if(page == "logchecker.php"){
  109. page_detect = true;
  110. if(url.indexOf("#") != -1){
  111. }
  112. // No achor, we focus the artist field
  113. else {
  114. $("#log_contents").focus();
  115. }
  116. }
  117.  
  118. // Focus to the artist search field (by default)
  119. if(page_detect == false){
  120. if(url.indexOf("#") != -1){
  121. }
  122. // No achor, we focus the artist field
  123. else {
  124. $("#artistsearch").focus();
  125. }
  126. }