Better pornolab.net posts

Make download link easier to find and click, add a textarea with the torrent title to easily edit a copy, torrent title gets cleaned up (removal of redundant websites, useless tags, characters not allowed in file names, sort performers), add a link you can tab into from the textarea to quickly download the torrent. 2022-02-05 05:39:47

  1. // ==UserScript==
  2. // @name Better pornolab.net posts
  3. // @namespace Violentmonkey Scripts
  4. // @match *://pornolab.net/forum/viewtopic.php
  5. // @grant none
  6. // @version 2.4.1
  7. // @author -
  8. // @description Make download link easier to find and click, add a textarea with the torrent title to easily edit a copy, torrent title gets cleaned up (removal of redundant websites, useless tags, characters not allowed in file names, sort performers), add a link you can tab into from the textarea to quickly download the torrent. 2022-02-05 05:39:47
  9. // @run-at document-idle
  10. // @inject-into page
  11. // ==/UserScript==
  12.  
  13.  
  14. // this.$ = this.jQuery = jQuery.noConflict(true) // disabled because it prevented uncollapsing collapsed posts
  15. $("div#tor-reged").ready(function () {
  16. // make download link easier to find and click
  17. $("div#tor-reged a.dl-stub.dl-link").prepend("Download | ")
  18. $("div#tor-reged p").has("a.dl-stub").has("img").css("width", "100%").css("display", "block")
  19. $("div#tor-reged a.dl-stub").has("img").css("width", "100%").css("display", "block")
  20. $("div#tor-reged a.dl-stub img").css("width", "10em").css("height", "10em").css("image-rendering", "-moz-crisp-edges").css("border", "0.5em solid black").css("border-radius", "1em")
  21. // uncollapse spoilers - shows all the images
  22. $("div.sp-open-all.sp-open-collapsed")[0].click()
  23. // Try the following to stop smoothing in your browser:
  24. // image-rendering: optimizeSpeed; /* STOP SMOOTHING, GIVE ME SPEED */
  25. // image-rendering: -moz-crisp-edges; /* Firefox */
  26. // image-rendering: -o-crisp-edges; /* Opera */
  27. // image-rendering: -webkit-optimize-contrast; /* Chrome (and eventually Safari) */
  28. // image-rendering: pixelated; /* Chrome */
  29. // image-rendering: optimize-contrast; /* CSS3 Proposed */
  30. // -ms-interpolation-mode: nearest-neighbor; /* IE8+ */
  31. var title = $("h1.maintitle a").text()
  32. // $("h1.maintitle a").remove()
  33. function s(text, regex, replacement) {
  34. return text.replace(regex, replacement)
  35. }
  36. title = s(title, / \/ /g, ' ') // Remove slashes, not allowed in file names. Replace with spaces
  37. title = s(title, /\/ /g, ' ') // Remove slashes, not allowed in file names. Replace with spaces
  38. title = s(title, / \//g, ' ') // Remove slashes, not allowed in file names. Replace with spaces
  39. title = s(title, / \| /g, ' ') // Remove pipes. Replace with spaces
  40. title = s(title, / г\./g, '') // Russian cyrillic shorthand for the word "year"
  41. title = s(title, /(19[7-9][0-9])\./g, '$1') // Dot put in Russian after the year. We don't cate about scenes from before 1970...
  42. title = s(title, /(20[0-9][0-9])\./g, '$1') // Dot put in Russian after the year
  43. title = s(title, /´|`|‘|’/g, "'") // Replace unicode apostrophes with ascii apostrophe
  44. title = s(title, /\?/g, "?") // Replace questionmark (illegal in file names) with Unicode full-width question mark (legal in file names)
  45. title = s(title, /,([^ ])/g, ", $1") // Make sure there's a space after every comma
  46. title = s(title, /\)\[/g, ") [") // Add spaces between brackets and parentheses
  47. title = s(title, /\]\(/g, "] (") // Add spaces between brackets and parentheses (note the backslash before the right square bracket ] is unnecessary)
  48. title = s(title, /\]\[/g, "] [") // Add spaces between brackets and parentheses (note the backslash before the right square bracket ] is unnecessary)
  49. title = s(title, /\)\(/g, ") (") // Add spaces between brackets and parentheses
  50. title = s(title, /\] +\[/g, ", ") // Merge contiguous brackets separated by any amount of spaces
  51. // check for split scenes tag
  52. split_scenes = false
  53. matches_split_scenes = title.match(/\(Split Scenes\)/i)
  54. if (matches_split_scenes !== null) {
  55. split_scenes = true
  56. title = s(title, /\(Split Scenes\)/i, " ")
  57. }
  58. title = s(title, /\) \(/g, ", ") // Merge contiguous parentheses separated by any amount of spaces
  59. title = s(title, / +/g, " ") // Merge contiguous spaces
  60. // Fix dates
  61. // Fix dates: dashes to periods
  62. title = s(title, /(\d\d)-(\d\d)-(\d\d)/, function fix_dashes(all, one, two, three) {
  63. return one + "." + two + "." + three
  64. })
  65.  
  66. // Find a four-digit year
  67. year = null
  68. year_short = null
  69. matches = title.match(/[^\d\.](20(\d\d))[^\d\.]/)
  70. if (matches !== null) {
  71. year = matches[1]
  72. year_short = matches[2]
  73. }
  74. function make_year_regex(year_str, surroundings) {
  75. if (surroundings === undefined) {
  76. surroundings = true
  77. }
  78. year_regex_year_at_end = "(\\d\\d)\\.(\\d\\d)\\." + year_str
  79. if (surroundings == true) {
  80. year_regex_year_at_end = "(^|[^\\d])" + year_regex_year_at_end + "($|[^\\d])"
  81. } else {
  82. year_regex_year_at_end = "()" + year_regex_year_at_end + "()" // keep the same amount of groups to make using the matches array easier
  83. }
  84. year_regex_year_at_start = year_str + "\\.(\\d\\d)\\.(\\d\\d)"
  85. if (surroundings == true) {
  86. year_regex_year_at_start = "(^|[^\\d])" + year_regex_year_at_start + "($|[^\\d])"
  87. } else {
  88. year_regex_year_at_start = "()" + year_regex_year_at_start + "()" // keep the same amount of groups to make using the matches array easier
  89. }
  90. // we want to prefer matches where the year is at the end, because that's the more common format
  91. year_regex = new RegExp(year_regex_year_at_end + "|" + year_regex_year_at_start)
  92. return year_regex
  93. }
  94. date_full = null
  95. if ((year !== null ) && (year_short !== null)) {
  96. // Keep old title value to check if anything changed when we lengthened the year
  97. old_title = (' ' + title).slice(1) // create copy
  98. // Upgrade two-digit years to four-digit years
  99. year_regex_short = make_year_regex(year_short)
  100. // note that either the first or second capture group will be == undefined
  101. title = s(title, year_regex_short, function upgrade_short_year(match_all, match_year_at_end_prefix, match_year_at_end_1, match_year_at_end_2, match_year_at_end_suffix, match_year_at_start_prefix, match_year_at_start_1, match_year_at_start_2, match_year_at_start_suffix) {
  102. if(match_year_at_end_1 && match_year_at_end_2) {
  103. return (match_year_at_end_prefix + match_year_at_end_1 + "." + match_year_at_end_2 + "." + year + match_year_at_end_suffix)
  104. }
  105. if(match_year_at_start_1 && match_year_at_start_2) {
  106. return (match_year_at_start_prefix + year + "." + match_year_at_start_1 + "." + match_year_at_start_2 + match_year_at_start_suffix)
  107. }
  108. return match_all
  109. })
  110. year_regex = make_year_regex(year)
  111. matches = title.match(year_regex)
  112. if (matches !== null) {
  113. date_with_surroundings = matches[0]
  114. matches2 = date_with_surroundings.match(make_year_regex(year, false))
  115. if(matches2 !== null) {
  116. date_full = matches2[0]
  117. }
  118. // Get rid of the year-only tag
  119. year_tag_regex = new RegExp("([^\\d])" + year + ", ")
  120. title = s(title, year_tag_regex, function get_rid_of_long_year_tag(match_all, match_prefix) {
  121. return match_prefix
  122. })
  123. }
  124. }
  125. if(date_full !== null) {
  126. // check for RD tag
  127. title = s(title, new RegExp("RD(:|) +" + date_full, 'g'), '')
  128. // check for the date alone
  129. // title = s(title, new RegExp(date_full, 'g'), '')
  130. }
  131. date_in_title = false
  132. // Fix stuff of the form [Foo.com] Performer - Title [Date, tag1, tag2, ...]
  133. // to look like [Foo.com] Performer (Title Date) [tag1, tag2, ...]
  134. matches = title.match(/(\[[^\]]+\] [^\[]+) - ([^\[]+) \[(\d\d\d\d\.\d\d\.\d\d|\d\d\.\d\d\.\d\d\d\d|\d\d\.\d\d\.\d\d), (.*)/)
  135. if (matches !== null) {
  136. title = matches[1] + " (" + matches[2] + " " + matches[3] + ") [" + matches[4]
  137. date_in_title = true
  138. }
  139. // Fix stuff of the form [Foo.com] Performer - Title (Date) [tag1, tag2, ...]
  140. // to look like [Foo.com] Performer (Title Date) [tag1, tag2, ...]
  141. matches = title.match(/(\[[^\]]+\] [^\[]+) - ([^\[]+) \((\d\d\d\d\.\d\d\.\d\d|\d\d\.\d\d\.\d\d\d\d|\d\d\.\d\d\.\d\d)\) \[(.*)/)
  142. if (matches !== null) {
  143. title = matches[1] + " (" + matches[2] + " " + matches[3] + ") [" + matches[4]
  144. date_in_title = true
  145. }
  146. // Parse out parts of torrent's title
  147. matches = title.match(/(?:\[([^\]]+)\] |)([^\[]+) \[(.*)\](.*)/)
  148. if (matches !== null) {
  149. match_websites = matches[1]
  150. if (match_websites === undefined) { // this happens when the torrent doesn't start with [Foo.com, Bar.com]
  151. match_websites = ""
  152. }
  153. match_tags = matches[3]
  154. match_rest = matches[4]
  155. matches2 = match_rest.match(/\(([^)]*,[^)]*)\)/) // match performers: parentheses () inside which there is at least one performer, then a comma, then at least one performer.
  156. match_performers = null
  157. match_performer_scene = null
  158. match_title_multiple_performers = null
  159. multiscene = false
  160. if (matches2 !== null) {
  161. match_performers_str = matches2[1]
  162. match_title_multiple_performers = matches[2]
  163. multiscene = true
  164. } else {
  165. match_performer_scene = matches[2]
  166. }
  167. if(match_websites !== "") {
  168. websites = match_websites.split(" ")
  169. } else {
  170. websites = []
  171. }
  172.  
  173.  
  174. // Canonicize websites (eg add .com)
  175. website_full_domains = {
  176. "SisLovesMe": "SisLovesMe.com",
  177. "TeamSkeet": "TeamSkeet.com",
  178. "IKnowThatGirl": "IKnowThatGirl.com",
  179. }
  180.  
  181. function l(str) {
  182. return str.toLocaleLowerCase()
  183. }
  184.  
  185. websites = websites.map(function canonicize_websites_1(website) {
  186. Object.keys(website_full_domains).map(function canonicize_websites_2(key) {
  187. if (l(key) == l(website)) {
  188. website = website_full_domains[key]
  189. }
  190. })
  191. return website
  192. })
  193.  
  194. // Capitalize websites. capitalize() is used on a single name that might be intercalated with spaces, like "foo bar" => "Foo Bar". You have to map() to use this on an Array of names.
  195.  
  196. // note: capitalize() is used for websites and also used later in tag processing
  197. function capitalize(s) {
  198. const arr = s.split(" ")
  199. const arr2 = arr.map(function capitalize1(word) {
  200. if(((word.toLocaleUpperCase() === word) && (word.length > 4)) || (word.toLocaleLowerCase() === word)) {
  201. // word is all caps and long, or all lower case, fix it
  202. return word.substring(0, 1).toLocaleUpperCase() + l(word.substring(1))
  203. }
  204. return word
  205. })
  206. return arr2.join(" ")
  207. }
  208.  
  209. website_special_capitalization = [
  210. "SisLovesMe.com",
  211. "TeamSkeet.com",
  212. "IKnowThatGirl.com",
  213. ]
  214.  
  215. websites = websites.map(function capitalize_websites(website) {
  216. chunks = website.split(".")
  217. main = capitalize(chunks[0])
  218. chunks[0] = main
  219. website = chunks.join(".")
  220. website_special_capitalization.map(function capitalize_websites_special(special) {
  221. if (l(special) == l(website)) {
  222. website = special
  223. }
  224. })
  225. return website
  226. })
  227.  
  228. websites_redundant = websites.slice(0) // Don't change this, used by tags code later
  229.  
  230. // Remove redundant websites
  231. website_redundancies = {
  232. "SisLovesMe.com": ["TeamSkeet.com"],
  233. "IKnowThatGirl.com": ["Mofos.com"],
  234. }
  235.  
  236. website_redundancies_found = []
  237. websites.map(function remove_redundant_websites_1(website) {
  238. Object.keys(website_redundancies).map(function remove_redundant_websites_2(key) {
  239. if (l(key) == l(website)) {
  240. website_redundancies_found = website_redundancies_found.concat(website_redundancies[key])
  241. }
  242. })
  243. })
  244.  
  245. website_redundancies_found = website_redundancies_found.map(x => l(x))
  246. websites = websites.filter(function remove_found_website_redundancies(website) {
  247. return ! website_redundancies_found.includes(l(website))
  248. })
  249.  
  250. // Remove duplicate websites
  251.  
  252. // note: deduplicate_list() is also used for tags, below.
  253. function deduplicate_list(list) {
  254. list2 = []
  255. list.map(function deduplicate_list_inner(element) {
  256. if (! list2.includes(element)) {
  257. list2.push(element)
  258. }
  259. })
  260. return list2
  261. }
  262. websites = deduplicate_list(websites)
  263.  
  264. // Get rid of shitty tags
  265. const shitty_tags = [
  266. "1 On 1",
  267. "69",
  268. "All Sex",
  269. "Amateur",
  270. "Barefoot",
  271. "Bare Foot",
  272. "BBW",
  273. "Bedroom",
  274. "Bikini",
  275. "Blowjob",
  276. "Blow Job",
  277. "Boy Girl",
  278. "Bralette",
  279. "Camel Toe",
  280. "Casual Wear",
  281. "Caucasian",
  282. "Cinematic - Story",
  283. "Couch",
  284. "Cowgirl",
  285. "Crop Top",
  286. "Cum In Hair",
  287. "Cum In Mouth",
  288. "Cum on Ass",
  289. "Cum on Asshole",
  290. "Cum on Back",
  291. "Cum on Face",
  292. "Cum on Pussy",
  293. "Cum on Stomach",
  294. "Cum on Tits",
  295. "Cum Shot",
  296. "Cumshot Facial",
  297. "Cumshot",
  298. "Curvy",
  299. "Cute Little Butts",
  300. "Deep Throat",
  301. "Deepthroat",
  302. "Dick Play",
  303. "Dildo",
  304. "Disgusted Parenting",
  305. "Doggy",
  306. "Doggystyle",
  307. "Dress",
  308. "Facial",
  309. "Fetish",
  310. "Fingering",
  311. "Fingering (ass)",
  312. "Fingering (asshole)",
  313. "Fingering (pussy)",
  314. "Hand Job",
  315. "HandJob",
  316. "Hardcore",
  317. "Indoor",
  318. "Innie",
  319. "Innie Pussy",
  320. "Interracial",
  321. "Jeans",
  322. "Lingerie",
  323. "Living Room",
  324. "Masturbation",
  325. "Mature",
  326. "Medium Ass",
  327. "Medium Tits",
  328. "Mini Skirt",
  329. "Missionary",
  330. "Natural Tits",
  331. "Outie",
  332. "Outie Pussy",
  333. "Panties",
  334. "Piercings",
  335. "Pussy Licking",
  336. "Reality",
  337. "Reverse Cowgirl",
  338. "Roleplay",
  339. "Shaved Pussy",
  340. "Step Brother",
  341. "Step Bro",
  342. "Step Dad",
  343. "Step Father",
  344. "Swallow Cum",
  345. "Squirt",
  346. "Tank Top",
  347. "Tattoo",
  348. "Thick Top",
  349. "Thong",
  350. "Tit Play",
  351. "Trimmed Pussy",
  352. "Underwear",
  353. "Vibrator",
  354. "Wild",
  355. "White",
  356. ].map(s => l(s))
  357.  
  358. match_tags = s(match_tags, /,([^\ \]])/g, function fix_tag_commas(all, suffix) {
  359. return ", " + suffix
  360. })
  361.  
  362. tags = match_tags.split(", ")
  363. tags = tags.filter(function remove_shitty_tags(tag) {
  364. return ! shitty_tags.includes(l(tag))
  365. })
  366.  
  367. // Make lower-case tags capitalized
  368. tags = tags.map(t => capitalize(t)) // yes, I capitalize later when desynonymizing, so what.
  369.  
  370. // Desynonymize tags
  371. const tag_synonyms = {
  372. "18+ Teens": "Teens",
  373. "18+Teens": "Teens",
  374. "Analingus": "Rimjob",
  375. "Ass Fuck": "Anal",
  376. "Ass Fucking": "Anal",
  377. "Ass Lick": "Rimjob",
  378. "Ass Licking": "Rimjob",
  379. "Asslicking": "Rimjob",
  380. "Family Roleplay": "Family",
  381. "HD Rip": "HDRip",
  382. "HD-Rip": "HDRip",
  383. "Legal Teen": "Teen",
  384. "Legal Teens": "Teens",
  385. "Rim Job": "Rimjob",
  386. "Rimming": "Rimjob",
  387. "Rimjobs": "Rimjob",
  388. "Red Head": "Redhead",
  389. "Stepsis": "Sister",
  390. "Stepsister": "Sister",
  391. "Step Sis": "Sister",
  392. "Step Sister": "Sister",
  393. "Stepmom": "Mom",
  394. "Stepmother": "Mom",
  395. "Step Mom": "Mom",
  396. "Step Mother": "Mom",
  397. "WEB DL": "Web-DL",
  398. "WEB-DL": "Web-DL",
  399. }
  400. tags = tags.map(function desynonymize_tags(tag) {
  401. cap_tag = capitalize(tag)
  402. if (tag_synonyms.hasOwnProperty(cap_tag)) {
  403. return tag_synonyms[cap_tag]
  404. }
  405. return cap_tag
  406. })
  407.  
  408. // Fix capitalization of some tags
  409. tag_special_cap = [
  410. "4K",
  411. "5K",
  412. "6K",
  413. "7K",
  414. "8K",
  415. "9K",
  416. "10K",
  417. "CFNM",
  418. "DAP",
  419. "DP",
  420. "DVDA",
  421. "FFM",
  422. "FMM",
  423. "FFMM",
  424. "FFFM",
  425. "FFFFM",
  426. "FFFFFM",
  427. "FFFFFFM",
  428. "HDRip",
  429. "MILF",
  430. "MILFs",
  431. "POV",
  432. "VR",
  433. "Web-DL",
  434. ]
  435.  
  436. tags = tags.map(function special_tag_capitalization(tag) {
  437. for (var i = 0; i < tag_special_cap.length; i++) {
  438. if (l(tag_special_cap[i]) == l(tag)) {
  439. return tag_special_cap[i]
  440. }
  441. }
  442. return tag
  443. })
  444.  
  445. // Add tags based on other tags
  446. const tag_additions = {
  447. "Sister": ["Incest", "Family", "Taboo"],
  448. "Mom": ["Incest", "Family", "Taboo"],
  449. "Mother": ["Incest", "Family", "Taboo"],
  450. "Family": ["Incest", "Family", "Taboo"],
  451. "Incest": ["Incest", "Family", "Taboo"],
  452. "4K": ["2160p"],
  453. "2160p": ["4K"],
  454. "FFM": ["Threesome"],
  455. "FMM": ["Threesome"],
  456. "Stockings": ["Lingerie"],
  457. }
  458. tags_temp = tags.slice(0) // Shallow copy
  459.  
  460. tags_temp.map(function add_tags_1(tag) {
  461. if (tag_additions.hasOwnProperty(tag)) {
  462. tag_additions[tag].map(function add_tags_2(addition) {
  463. if (!tags.includes(addition)) {
  464. tags.push(addition)
  465. }
  466. })
  467. }
  468. })
  469.  
  470. // Add tags based on websites
  471. const tag_website_additions = {
  472. "SisLovesMe.com": ["Sister", "Incest", "Family", "Taboo", "POV"],
  473. }
  474. websites_redundant.map(function add_tags_website_1(website) {
  475. if (tag_website_additions.hasOwnProperty(website)) {
  476. tag_website_additions[website].map(function add_tags_website_2(addition) {
  477. if (!tags.includes(addition)) {
  478. tags.push(addition)
  479. }
  480. })
  481. }
  482. })
  483. // Sort preferred performers first based on order of preference
  484. const performer_preference = ["Jennifer White", "Karlee Grey", "Alexa Nova"]
  485. if (multiscene == true) {
  486. new_performers_preferred = []
  487. new_performers_other = []
  488. match_performers_split = match_performers_str.split(", ")
  489. // find all preferred performers in the performer list
  490. performer_preference.map(function sort_performers_preferred(performer) {
  491. if(match_performers_split.includes(performer)) {
  492. new_performers_preferred.push(performer)
  493. }
  494. })
  495. // add all performers that are not preferred to the "other" list
  496. match_performers_split.map(function sort_performers_other(performer) {
  497. if(! performer_preference.includes(performer)) {
  498. new_performers_other.push(performer)
  499. }
  500. })
  501. match_performers = [].concat(new_performers_preferred, new_performers_other)
  502. match_performers = match_performers.map(p => capitalize(p)) // capitalize performer names
  503. }
  504. // Add tags based on performers
  505. const tag_performer_additions = {
  506. "Alexa Nova": ["Redhead", "Brunette", "Skinny", "Teen", "Tiny Tits", "Lookalike"],
  507. "Karlee Grey": ["Black Hair", "Latina", "Big Naturals", "Hairy"],
  508. }
  509. Object.keys(tag_performer_additions).map(function add_tags_performer_1(performer) {
  510. if (((multiscene == false) && match_performer_scene.includes(performer)) || ((multiscene == true) && match_performers.includes(performer))) {
  511. tag_performer_additions[performer].map(function add_tags_performer_2(addition) {
  512. if (!tags.includes(addition)) {
  513. tags.push(addition)
  514. }
  515. })
  516. }
  517. })
  518.  
  519. // Deduplicate tags
  520. tags = deduplicate_list(tags)
  521. // Check tags for a year if no other year was found
  522. if (date_full == null) {
  523. tags = tags.filter(function extract_year_from_tags(tag) {
  524. if(/^(20\d\d|19[7-9]\d)$/.test(tag)) {
  525. date_full = tag
  526. return false
  527. }
  528. return true
  529. })
  530. }
  531.  
  532. tag_order_start = [
  533. "Blonde",
  534. "Redhead",
  535. "Black Hair",
  536. "Brunette",
  537. "Latina",
  538. "Asian",
  539. "Black",
  540. "Ebony",
  541. "Skinny",
  542. "Petite",
  543. "Tiny",
  544. "Abs",
  545. "Tiny Tits",
  546. "Big Naturals",
  547. "Natural Tits",
  548. "Big Tits",
  549. "Fake Tits",
  550. "Big Ass",
  551. "Nice Ass",
  552. "Teen",
  553. "Teens",
  554. "Babe",
  555. "MILF",
  556. "MILFs",
  557. "Sister",
  558. "Mother",
  559. "Incest",
  560. "Family",
  561. "Taboo",
  562. "Rimjob",
  563. "Lookalike",
  564. ]
  565. tags_start = []
  566. tags_rest_1 = []
  567. tag_order_start.map(function split_tags_to_start_and_rest_1(start_tag) {
  568. if (tags.includes(start_tag)) {
  569. tags_start.push(start_tag)
  570. }
  571. return start_tag
  572. })
  573. tags.map(function split_tags_to_start_and_rest_2(tag) {
  574. if (!tags_start.includes(tag)) {
  575. tags_rest_1.push(tag)
  576. }
  577. return tag
  578. })
  579.  
  580. tag_order_end = [
  581. "Throatpie",
  582. "Creampie",
  583. "POV",
  584. "HDRip",
  585. "Web-DL",
  586. "4K",
  587. "5K",
  588. "6K",
  589. "7K",
  590. "8K",
  591. "9K",
  592. "10K",
  593. "480p",
  594. "540p",
  595. "720p",
  596. "1080p",
  597. "2160p",
  598. "VR",
  599. ]
  600. tags_end = []
  601. tags_rest_2 = []
  602. tag_order_end.map(function split_tags_to_end_and_rest_1(end_tag) {
  603. if (tags_rest_1.includes(end_tag)) {
  604. tags_end.push(end_tag)
  605. }
  606. return end_tag
  607. })
  608. tags_rest_1.map(function split_tags_to_end_and_rest_2(tag) {
  609. if (!tags_end.includes(tag)) {
  610. tags_rest_2.push(tag)
  611. }
  612. return tag
  613. })
  614.  
  615. tags = [].concat(tags_start, tags_rest_2, tags_end)
  616.  
  617. // Reconstruct title from parts
  618. need_date = (date_full !== null) && (date_in_title == false)
  619. date_full_part = ""
  620. if (need_date) {
  621. date_full_part = " " + date_full
  622. }
  623. if (multiscene == false) {
  624. if (need_date) {
  625. matches = match_performer_scene.match(/\)/)
  626. if(matches !== null) {
  627. match_performer_scene = s(match_performer_scene, /\)/, date_full_part + ")")
  628. } else {
  629. match_performer_scene = match_performer_scene + " (" + date_full + ")"
  630. }
  631. }
  632. title = match_performer_scene + " [" + tags.join(", ") + "]"
  633. } else {
  634. match_performers_str = match_performers.join(", ")
  635. title = match_performers_str + " (" + match_title_multiple_performers + date_full_part + ") [" + tags.join(", ") + "]"
  636. if (split_scenes) {
  637. title = title + " (Split Scenes)"
  638. }
  639. }
  640. if (websites.length > 0) {
  641. title = "[" + websites.join(" ") + "] " + title
  642. }
  643. }
  644. // Get download link
  645. var dl = $("div#tor-reged a.dl-stub.dl-link").attr("href")
  646. // Add title near download link to edit and copy conveniently, and a download link to tab into
  647. $("div#tor-reged").prepend("<div id='better-plab-dl'><p><form><textarea style='font-size: 130%; width: calc(100% - 1em); padding: 0.5em' autocorrect='off' autocomplete='off' autocapitalize='off' spellcheck='false'>" + title + "</textarea></form></p><br/><br/><br/><br/><p><a href='" + dl + "' class='dl-stub dl-link' style='width: 100%; text-align: center; font-size: 7em'>Download Torrent File</a></p><br/><br/><br/><br/></div>")
  648. })