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

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

当前为 2017-12-08 提交的版本,查看 最新版本

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