@mfcc64/ytms 19.0.0 → 20.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/script.mjs +19 -32
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mfcc64/ytms",
3
- "version": "19.0.0",
3
+ "version": "20.0.0",
4
4
  "description": "YouTube Musical Spectrum",
5
5
  "main": "script.mjs",
6
6
  "scripts": {
package/script.mjs CHANGED
@@ -97,7 +97,7 @@ import {ShowCQTElement} from "../../showcqt-element@3/showcqt-element.mjs";
97
97
  af_links.style.padding = "8px";
98
98
  af_links.style.border = "thin solid white";
99
99
  af_links.style.backgroundColor = "#000000DD";
100
- af_links.style.color = "#FFFFFF";
100
+ af_links.style.color = "#dddddd";
101
101
  af_links.style.fontSize = "10pt";
102
102
  af_links.style.right = "8px";
103
103
  af_links.style.bottom = "calc(var(--ytms-cqt-bottom, 0px) + 8px)";
@@ -115,30 +115,14 @@ import {ShowCQTElement} from "../../showcqt-element@3/showcqt-element.mjs";
115
115
  af_links.attachShadow({mode: "open"}).append(
116
116
  e("style",
117
117
  `:host { opacity: 0; max-width: 700px; }
118
+ a, a:visited { color: #ffffff; font-weight: bold; }
119
+ a:hover { color: #ffffa0; }
118
120
  :host(:hover) { opacity: 1; }
119
121
  img { vertical-align: middle; }`),
120
- e("div", {id: "message"},
121
- e("h3", "YouTube Musical Spectrum"),
122
- e("ul",
123
- e("li", "By default, the visualization is visible on YT Music, Spotify, and SoundCloud but hidden on YouTube page."),
124
- e("li", "Press ", e("b", "Ctrl+Alt+G"), " as a shortcut to show/hide visualization. This is equivalent to check/uncheck ", e("b", "Visible"), " setting."),
125
- e("li", "Click the ", e("img", {alt: "YTMS"}, {src: icon_16}), " icon at the top left corner to open/close settings."),
126
- e("li", "Press ", e("b", "Ctrl+Alt+H"), " to open/close settings and show/hide the ", e("img", {alt: "YTMS"}, {src: icon_16}), " icon."),
127
- e("li", "If you want to change the axis, click it."),
128
- e("li", "If you want to make your change persistent, click ", e("b", "Set as Default Settings"), " button."),
129
- e("li", e("b", "New Features:"), " Custom color, custom range," +
130
- " peak color, bar scale, line visualizer, hue rotation, more color presets, horizontal scroll, coordinate line, peak range."),
131
- e("li", e("a", {href: "https://github.com/mfcc64/youtube-musical-spectrum#settings"}, {target: "_blank"}, "Read more..."))
132
- ),
133
- e("p",
134
- e("button", {id: "close_message"}, {style: "cursor: pointer;"}, "Close"),
135
- " (Click the ", e("img", {alt: "YTMS"}, {src: icon_16}), " icon below to reopen again)"
136
- )
137
- ),
138
122
  e("div", {style: "text-align: right;"},
139
- e("img", {alt: "YTMS"}, {src: icon_16}, {style: "curson: pointer;"}, {id: "open_message"}),
123
+ e("img", {alt: "YTMS"}, {src: icon_16}, {style: "curson: pointer;"}),
140
124
  " Support me on ",
141
- e("a", {href: "https://www.youtube.com/@mfcc64"}, {target: "_blank"}, "Youtube"), " ",
125
+ e("a", {href: "https://www.youtube.com/@mfcc64"}, {target: "_blank"}, "YouTube"), " ",
142
126
  e("a", {href: "https://github.com/mfcc64"}, {target: "_blank"}, "GitHub"), " ",
143
127
  e("a", {href: "https://paypal.me/mfcc64"}, {target: "_blank"}, "PayPal"), " ",
144
128
  e("a", {href: "https://saweria.co/mfcc64"}, {target: "_blank"}, "Saweria")
@@ -157,16 +141,6 @@ import {ShowCQTElement} from "../../showcqt-element@3/showcqt-element.mjs";
157
141
  af_links.style.display = !af_links_timeout || (child_menu.visible?.checked ?? true) ? "block" : "none";
158
142
  }
159
143
 
160
- const message_version = 14;
161
- af_links.shadowRoot.getElementById("message").style.display = get_opt("message_version") == message_version ? "none" : "block";
162
- af_links.shadowRoot.getElementById("close_message").addEventListener("click", function() {
163
- set_opt("message_version", message_version);
164
- af_links.shadowRoot.getElementById("message").style.display = "none";
165
- });
166
- af_links.shadowRoot.getElementById("open_message").addEventListener("click", function() {
167
- af_links.shadowRoot.getElementById("message").style.display = "block";
168
- });
169
-
170
144
  const cqt = new ShowCQTElement();
171
145
  let svideos = [];
172
146
  if (document.location.hostname == "soundcloud.com") {
@@ -809,8 +783,10 @@ import {ShowCQTElement} from "../../showcqt-element@3/showcqt-element.mjs";
809
783
  create_child_checkbox_menu("Transparent", "transparent", (child) => cqt.dataset.opacity = child.checked ? "transparent" : "opaque");
810
784
  create_child_checkbox_menu("Visible", "visible", (child) => {
811
785
  cqt.style.display = child.checked ? "block" : "none";
812
- if (!child.checked)
786
+ if (!child.checked) {
813
787
  coord_line_h.style.display = coord_line_v.style.display = "none";
788
+ cqt.render_clear();
789
+ }
814
790
  update_af_links();
815
791
  });
816
792
 
@@ -943,6 +919,12 @@ import {ShowCQTElement} from "../../showcqt-element@3/showcqt-element.mjs";
943
919
 
944
920
  menu_div.appendChild(menu_table);
945
921
  menu.onclick = function() {
922
+ if (menu_is_hidden && !child_menu.visible.checked) {
923
+ child_menu.visible.checked = true;
924
+ child_menu.visible.onchange();
925
+ return;
926
+ }
927
+
946
928
  menu_is_hidden = !menu_is_hidden;
947
929
  if (menu_is_hidden)
948
930
  menu_div.style.visibility = "hidden";
@@ -950,6 +932,11 @@ import {ShowCQTElement} from "../../showcqt-element@3/showcqt-element.mjs";
950
932
  menu_div.style.visibility = "visible";
951
933
  };
952
934
 
935
+ cqt.addEventListener("dblclick", () => {
936
+ child_menu.visible.checked = false;
937
+ child_menu.visible.onchange();
938
+ });
939
+
953
940
  var hide_menu = !!(get_opt("hide_menu") * 1);
954
941
  menu.style.visibility = hide_menu ? "hidden" : "visible";
955
942
  document.body.insertBefore(menu_div, document.body.firstChild);