1337x - Default descriptions for categories and more

let's you set up default descriptions for categories and other defaults like title, tags etc.

当前为 2017-05-21 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 1337x - Default descriptions for categories and more
  3. // @namespace NotNeo
  4. // @description let's you set up default descriptions for categories and other defaults like title, tags etc.
  5. // @include http*://1337x.to/upload
  6. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  7. // @version 1.2
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. //"Default" of course means that you can change everything in the "upload torrent" section normally, the values just start out with these settings.
  12.  
  13. //--------------------------------
  14. //------------Settings------------
  15. var dName = ""; //put your default name between the quotes. For no default/empty, leave no spaces between the quotes ("") (doublequotes(") inside the name need to be escaped. Check Description tips below)
  16. var dLanguage = "English"; //put the EXACT name of your language (from the dropdown menu) in the quotes
  17. var dDesc = ""; //put your default description between the quotes. For no default/empty, leave no spaces between the quotes (""). (doublequotes(") inside the description need to be escaped. Check tips below)
  18. var dTags = ""; //put your default tags between the quotes. For no default/empty, leave no spaces between the quotes ("") (doublequotes(") inside the tags need to be escaped. Check Description tips below)
  19. var showOnlyUpload = true; // Choose whether to hide the the boxes above the "Upload your files" box.
  20. var descHeight = "250"; //set custom height for the description text box (in px) (1337x default = 115)
  21.  
  22. /*Tips for more complicated descriptions:
  23. - To put text on a new line use the newline character(\n).
  24. This is the firstline.\nThis is the second line.
  25. - To use duoblequotes(") in your desription, you must "escape them", meaning you need to use the escape character(\) in front of them. (the escape characters won't actually show up in the description)
  26. \"this\" will work
  27. "this" will not
  28.  
  29. Example:
  30. var dDesc = "[center][img]https://i.imgur.com/example.jpg[/img]\nSo this is a test\n\nThis should work.\n\"Quotes\" work like this.[/center]\n:smile";
  31.  
  32.  
  33. You can create default descriptions for as many categories as you wish.
  34. Changing the category will insert the default description for that category in to the description box, so make sure you choose the category BEFORE you start editing the description! */
  35. //Remind me? true/false
  36. var reminder = true; /* (red text next to category)
  37. These take priority over the global default description.
  38. Simply type the description between the quotes on the line corresponding to your category id. */
  39.  
  40. //-------------------------------
  41. //-------------------------------
  42.  
  43. ///////////////////////////////////////////////////
  44. //////////Edit main category defaults below///////
  45. /////////////////////////////////////////////////
  46. /*
  47. Descriptions for Main Categories --------( put your custom descriptions in the marked lines in quotes inside the paranthesis after .val.
  48. and then uncomment the line(remove the two forwardslashes at the start of the line) (See example below)
  49.  
  50. Example lines:
  51.  
  52. //$("[name='description']").val(""); // Put your description for "X" here
  53. above line becomes ->
  54. $("[name='description']").val("[center][b]This is my example description for X category[/b][/center]"); // Put your description for "X" here
  55.  
  56. Remember the the rules for creating descriptions. (See settings section above)
  57. */
  58. function catChange() {
  59. setTimeout(function() {
  60. if($("#category").parent().find(".trigger").text() == "Movie") {
  61. //$("[name='description']").val(""); // Put your description for "Movie" here
  62. } else if($("#category").parent().find(".trigger").text() == "Game") {
  63. //$("[name='description']").val(""); // Put your description for "Game" here
  64. } else if($("#category").parent().find(".trigger").text() == "Music") {
  65. //$("[name='description']").val(""); // Put your description for "Music" here
  66. } else if($("#category").parent().find(".trigger").text() == "TV") {
  67. //$("[name='description']").val(""); // Put your description for "TV" here
  68. } else if($("#category").parent().find(".trigger").text() == "Apps") {
  69. //$("[name='description']").val(""); // Put your description for "Apps" here
  70. } else if($("#category").parent().find(".trigger").text() == "Documentaries") {
  71. //$("[name='description']").val(""); // Put your description for "Documentaries" here
  72. } else if($("#category").parent().find(".trigger").text() == "Anime") {
  73. //$("[name='description']").val(""); // Put your description for "Anime" here
  74. } else if($("#category").parent().find(".trigger").text() == "XXX") {
  75. //$("[name='description']").val(""); // Put your description for "XXX" here
  76. } else if($("#category").parent().find(".trigger").text() == "Other") {
  77. //$("[name='description']").val(""); // Put your description for "Other" here
  78. }
  79. subCatChange();
  80. }, 200);
  81. }
  82. ///////////////////////////////////////////////////
  83. //////////Edit main category defaults above///////
  84. /////////////////////////////////////////////////
  85.  
  86.  
  87.  
  88.  
  89. ///////////////////////////////////////////////
  90. ///////Edit sub category defaults below///////
  91. /////////////////////////////////////////////
  92. /*
  93. These will of course replace the description added by the main category.
  94. Descriptions for Sub Categories --------( put your custom descriptions in the marked lines in quotes inside the paranthesis after .val.
  95. and then uncomment the line(remove the two forwardslashes at the start of the line) (See example below)
  96.  
  97. Example lines:
  98.  
  99. //$("[name='description']").val(""); // Put your description for "X" here
  100. above line becomes ->
  101. $("[name='description']").val("[center][b]This is my example description for X subcategory[/b][/center]"); // Put your description for "X" here
  102.  
  103. Remember the the rules for creating descriptions. (See settings section above)
  104. */
  105. function subCatChange() {
  106. setTimeout(function() {
  107. if($("#category").parent().find(".trigger").text() == "Movie") { //------Subcategories of Movie below------
  108. if($("#type").parent().find(".trigger").text() == "DVD") {
  109. //$("[name='description']").val(""); // Put your description for "DVD" here
  110. } else if($("#type").parent().find(".trigger").text() == "Divx/Xvid") {
  111. //$("[name='description']").val(""); // Put your description for "Divx/Xvid" here
  112. } else if($("#type").parent().find(".trigger").text() == "SVCD/VCD") {
  113. //$("[name='description']").val(""); // Put your description for "SVCD/VCD" here
  114. } else if($("#type").parent().find(".trigger").text() == "Dubs/Dual Audio") {
  115. //$("[name='description']").val(""); // Put your description for "Dubs/Dual Audio" here
  116. } else if($("#type").parent().find(".trigger").text() == "HD") {
  117. //$("[name='description']").val(""); // Put your description for "HD" here
  118. } else if($("#type").parent().find(".trigger").text() == "h.264/x264") {
  119. //$("[name='description']").val(""); // Put your description for "h.264/x264" here
  120. } else if($("#type").parent().find(".trigger").text() == "Mp4") {
  121. //$("[name='description']").val(""); // Put your description for "Mp4" here
  122. } else if($("#type").parent().find(".trigger").text() == "3D") {
  123. //$("[name='description']").val(""); // Put your description for "3D" here
  124. }
  125. } else if($("#category").parent().find(".trigger").text() == "Game") { //------Subcategories of Game below------
  126. if($("#type").parent().find(".trigger").text() == "PC Game") {
  127. //$("[name='description']").val(""); // Put your description for "PC Game" here
  128. } else if($("#type").parent().find(".trigger").text() == "PS2") {
  129. //$("[name='description']").val(""); // Put your description for "PS2" here
  130. } else if($("#type").parent().find(".trigger").text() == "PSP") {
  131. //$("[name='description']").val(""); // Put your description for "PSP" here
  132. } else if($("#type").parent().find(".trigger").text() == "Xbox") {
  133. //$("[name='description']").val(""); // Put your description for "Xbox" here
  134. } else if($("#type").parent().find(".trigger").text() == "Xbox360") {
  135. //$("[name='description']").val(""); // Put your description for "Xbox360" here
  136. } else if($("#type").parent().find(".trigger").text() == "PS1") {
  137. //$("[name='description']").val(""); // Put your description for "PS1" here
  138. } else if($("#type").parent().find(".trigger").text() == "Dreamcast") {
  139. //$("[name='description']").val(""); // Put your description for "Dreamcast" here
  140. } else if($("#type").parent().find(".trigger").text() == "Other") {
  141. //$("[name='description']").val(""); // Put your description for "Other" here
  142. } else if($("#type").parent().find(".trigger").text() == "PS3") {
  143. //$("[name='description']").val(""); // Put your description for "PS3" here
  144. } else if($("#type").parent().find(".trigger").text() == "Wii") {
  145. //$("[name='description']").val(""); // Put your description for "Wii" here
  146. } else if($("#type").parent().find(".trigger").text() == "DS") {
  147. //$("[name='description']").val(""); // Put your description for "DS" here
  148. } else if($("#type").parent().find(".trigger").text() == "GameCube") {
  149. //$("[name='description']").val(""); // Put your description for "GameCube" here
  150. }
  151. } else if($("#category").parent().find(".trigger").text() == "Music") { //------Subcategories of Music below------
  152. if($("#type").parent().find(".trigger").text() == "MP3") {
  153. //$("[name='description']").val(""); // Put your description for "MP3" here
  154. } else if($("#type").parent().find(".trigger").text() == "Lossless") {
  155. //$("[name='description']").val(""); // Put your description for "Lossless" here
  156. } else if($("#type").parent().find(".trigger").text() == "DVD") {
  157. //$("[name='description']").val(""); // Put your description for "DVD" here
  158. } else if($("#type").parent().find(".trigger").text() == "Video") {
  159. //$("[name='description']").val(""); // Put your description for "Video" here
  160. } else if($("#type").parent().find(".trigger").text() == "Radio") {
  161. //$("[name='description']").val(""); // Put your description for "Radio" here
  162. } else if($("#type").parent().find(".trigger").text() == "Other") {
  163. //$("[name='description']").val(""); // Put your description for "Other" here
  164. } else if($("#type").parent().find(".trigger").text() == "Album") {
  165. //$("[name='description']").val(""); // Put your description for "Album" here
  166. } else if($("#type").parent().find(".trigger").text() == "Box Set") {
  167. //$("[name='description']").val(""); // Put your description for "Box Set" here
  168. } else if($("#type").parent().find(".trigger").text() == "Discography") {
  169. //$("[name='description']").val(""); // Put your description for "Discography" here
  170. } else if($("#type").parent().find(".trigger").text() == "Single") {
  171. //$("[name='description']").val(""); // Put your description for "Singles" here
  172. } else if($("#type").parent().find(".trigger").text() == "Concerts") {
  173. //$("[name='description']").val(""); // Put your description for "Concerts" here
  174. } else if($("#type").parent().find(".trigger").text() == "AAC") {
  175. //$("[name='description']").val(""); // Put your description for "AAC" here
  176. }
  177. } else if($("#category").parent().find(".trigger").text() == "TV") { //------Subcategories of TV below------
  178. if($("#type").parent().find(".trigger").text() == "DVD") {
  179. //$("[name='description']").val(""); // Put your description for "DVD" here
  180. } else if($("#type").parent().find(".trigger").text() == "Divx/Xvid") {
  181. //$("[name='description']").val(""); // Put your description for "Divx/Xvid" here
  182. } else if($("#type").parent().find(".trigger").text() == "SVCD/VCD") {
  183. //$("[name='description']").val(""); // Put your description for "SVCD/VCD" here
  184. } else if($("#type").parent().find(".trigger").text() == "HD") {
  185. //$("[name='description']").val(""); // Put your description for "HD" here
  186. }
  187. } else if($("#category").parent().find(".trigger").text() == "Apps") { //------Subcategories of Apps below------
  188. if($("#type").parent().find(".trigger").text() == "PC Software") {
  189. //$("[name='description']").val(""); // Put your description for "PC Software" here
  190. } else if($("#type").parent().find(".trigger").text() == "Mac") {
  191. //$("[name='description']").val(""); // Put your description for "Mac" here
  192. } else if($("#type").parent().find(".trigger").text() == "Linux") {
  193. //$("[name='description']").val(""); // Put your description for "Linux" here
  194. } else if($("#type").parent().find(".trigger").text() == "Other") {
  195. //$("[name='description']").val(""); // Put your description for "Other" here
  196. } else if($("#type").parent().find(".trigger").text() == "Android") {
  197. //$("[name='description']").val(""); // Put your description for "Android" here
  198. } else if($("#type").parent().find(".trigger").text() == "iOS") {
  199. //$("[name='description']").val(""); // Put your description for "iOS" here
  200. }
  201. } else if($("#category").parent().find(".trigger").text() == "XXX") { //------Subcategories of XXX below------
  202. if($("#type").parent().find(".trigger").text() == "Video") {
  203. //$("[name='description']").val(""); // Put your description for "Video" here
  204. } else if($("#type").parent().find(".trigger").text() == "Picture") {
  205. //$("[name='description']").val(""); // Put your description for "Picture" here
  206. } else if($("#type").parent().find(".trigger").text() == "Magazine") {
  207. //$("[name='description']").val(""); // Put your description for "Magazine" here
  208. } else if($("#type").parent().find(".trigger").text() == "Hentai") {
  209. //$("[name='description']").val(""); // Put your description for "Hentai" here
  210. } else if($("#type").parent().find(".trigger").text() == "Games") {
  211. //$("[name='description']").val(""); // Put your description for "Games" here
  212. }
  213. } else if($("#category").parent().find(".trigger").text() == "Other") { //------Subcategories of Other below------
  214. if($("#type").parent().find(".trigger").text() == "Emulation") {
  215. //$("[name='description']").val(""); // Put your description for "Emulation" here
  216. } else if($("#type").parent().find(".trigger").text() == "Tutorials") {
  217. //$("[name='description']").val(""); // Put your description for "Tutorials" here
  218. } else if($("#type").parent().find(".trigger").text() == "Sounds") {
  219. //$("[name='description']").val(""); // Put your description for "Sounds" here
  220. } else if($("#type").parent().find(".trigger").text() == "E-Books") {
  221. //$("[name='description']").val(""); // Put your description for "E-Books" here
  222. } else if($("#type").parent().find(".trigger").text() == "Images") {
  223. //$("[name='description']").val(""); // Put your description for "Images" here
  224. } else if($("#type").parent().find(".trigger").text() == "Mobile Phone") {
  225. //$("[name='description']").val(""); // Put your description for "Mobile Phone" here
  226. } else if($("#type").parent().find(".trigger").text() == "Comics") {
  227. //$("[name='description']").val(""); // Put your description for "Comics" here
  228. } else if($("#type").parent().find(".trigger").text() == "Other") {
  229. //$("[name='description']").val(""); // Put your description for "Other" here
  230. } else if($("#type").parent().find(".trigger").text() == "Nulled Script") {
  231. //$("[name='description']").val(""); // Put your description for "Nulled Script" here
  232. } else if($("#type").parent().find(".trigger").text() == "Audiobook") {
  233. //$("[name='description']").val(""); // Put your description for "Audiobook" here
  234. }
  235. }
  236. }, 100);
  237. }
  238. ///////////////////////////////////////////////
  239. ///////Edit sub category defaults above///////
  240. /////////////////////////////////////////////
  241. ////////////////////////////////////////////
  242. ////DO NOT EDIT ANYTHING BELOW THIS LINE///
  243. //////////////////////////////////////////
  244. var isFirefox = typeof InstallTrigger !== 'undefined';
  245.  
  246. $("#category").parent().find(".options").click(function() {
  247. catChange();
  248. });
  249.  
  250. $("#type").parent().find(".options").click(function() {
  251. catChange();
  252. });
  253.  
  254.  
  255.  
  256. $(document).ready(function() {
  257. if(!isFirefox) { //remove fancy textarea if not on firefox
  258. $("[name='description']").next().remove();
  259. $("[name='description']").removeAttr("style");
  260. }
  261. $("[name='description']").attr("style", "margin-top: 0px; margin-bottom: 0px; height: " + descHeight + "px;"); //setting custom height for text box
  262. if (reminder) {
  263. $("small:contains('Please select which category best fits your torrent.')").append(" <p style='color:red'>Choose before editing the description!</p> ");
  264. }
  265. if (showOnlyUpload) {
  266. $("h1:contains(' Want to upload a torrent? No problem! Please use the announce URLs: ')").parent().parent().hide();
  267. $("h1:contains('New upload categories')").parent().parent().hide();
  268. }
  269. $("[name='title']").val(dName); //set default title
  270. $("[name='tags']").val(dTags); //set default tags
  271.  
  272. setTimeout(function(){
  273. $("[name='description']").val(dDesc); //set default description
  274. //setting default Language ---------------------------------------------------
  275. $("#language").parent().find(".options").find("li").each(function() {
  276. $(this).removeAttr("class");
  277. });
  278. $("#language").parent().find(".trigger").text(dLanguage);
  279. $("#language").parent().find(".options").find("li:contains('" + dLanguage + "')").attr("class", "selected");
  280. //----------------------------------------------------------------------------
  281. catChange();
  282. }, 1000);
  283.  
  284. });