Fernus URL

Fernus tarafından yayınlanan video çözüm kategorilerini link olarak kaydetmenizi ve tek tıkla açmanızı sağlar

  1. // ==UserScript==
  2. // @name Fernus URL
  3. // @description Fernus tarafından yayınlanan video çözüm kategorilerini link olarak kaydetmenizi ve tek tıkla açmanızı sağlar
  4. // @include *.frns.in*
  5. // @require https://code.jquery.com/jquery-2.2.4.min.js
  6. // @grant none
  7. // @version 1.0.2
  8. // @namespace https://greasyfork.org/users/1266596
  9. // ==/UserScript==
  10.  
  11. const fernus_url_script_query = new URLSearchParams(window.location.search);
  12. if (fernus_url_script_query.has("fc")) {
  13. get_contents(fernus_url_script_query.get("fc"));
  14. window["fernus_url_loc"] = `/?fc=${fernus_url_script_query.get("fc")}`;
  15. } else if (fernus_url_script_query.has("fs")) {
  16. get_sources(fernus_url_script_query.get("fs"));
  17. window["fernus_url_loc"] = `/?fs=${fernus_url_script_query.get("fs")}`;
  18. }
  19. $("header")
  20. .first()
  21. .append(
  22. `<button id="frns-url-grab" class="pix-btn btn-outline m-0 mt-1 text-center p-2 float-left" style="color: white !important; width: 110px; height: calc(100% - 15px); position: absolute; top: 5px; left: 7px; z-index: 9999;">🔗 Kaydet</button>`
  23. );
  24. if (navigator["share"]) {
  25. $("header")
  26. .first()
  27. .append(
  28. `<button id="frns-url-share" class="pix-btn btn-outline m-0 mt-1 text-center p-2 float-left" style="color: white !important; width: 110px; height: calc(100% - 15px); position: absolute; top: 5px; left: 125px; z-index: 9999;">🌐 Paylaş</button>`
  29. );
  30. $("#frns-url-share").on("click", function () {
  31. const url = !window["fernus_url_loc"]
  32. ? window.location.origin
  33. : window.location.origin + window["fernus_url_loc"];
  34. try {
  35. navigator.share({
  36. url: url,
  37. });
  38. } catch (err) {}
  39. });
  40. }
  41. const oldgc = get_contents;
  42. const oldgs = get_sources;
  43. window["get_contents"] = function (id) {
  44. window["fernus_url_loc"] = `/?fc=${id}`;
  45. oldgc(id);
  46. };
  47. window["get_sources"] = function (id) {
  48. window["fernus_url_loc"] = `/?fs=${id}`;
  49. oldgs(id);
  50. };
  51. $("#frns-url-grab").on("click", function () {
  52. if (window["fernus_url_loc"]) {
  53. const url = window.location.origin + window["fernus_url_loc"];
  54. try {
  55. navigator.clipboard.writeText(url);
  56. alert("URL panoya kopyalandı!");
  57. } catch (err) {
  58. console.error("Failed to copy: ", err);
  59. }
  60. } else {
  61. try {
  62. navigator.clipboard.writeText(window.location.origin);
  63. alert("URL panoya kopyalandı!");
  64. } catch (err) {}
  65. }
  66. });