@mfcc64/ytms 19.0.0 → 20.0.2

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 +22 -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.2",
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") {
@@ -191,6 +165,9 @@ import {ShowCQTElement} from "../../showcqt-element@3/showcqt-element.mjs";
191
165
  }
192
166
 
193
167
  set_fixed_style(cqt, 9999999);
168
+ cqt.style.setProperty("user-select", "none");
169
+ cqt.style.setProperty("-webkit-user-select", "none");
170
+
194
171
  let stop_count = 0;
195
172
  const videos = document.getElementsByTagName("video");
196
173
  const require_refresh = ["open.spotify.com", "soundcloud.com"].indexOf(document.location.hostname) < 0;
@@ -809,8 +786,10 @@ import {ShowCQTElement} from "../../showcqt-element@3/showcqt-element.mjs";
809
786
  create_child_checkbox_menu("Transparent", "transparent", (child) => cqt.dataset.opacity = child.checked ? "transparent" : "opaque");
810
787
  create_child_checkbox_menu("Visible", "visible", (child) => {
811
788
  cqt.style.display = child.checked ? "block" : "none";
812
- if (!child.checked)
789
+ if (!child.checked) {
813
790
  coord_line_h.style.display = coord_line_v.style.display = "none";
791
+ cqt.render_clear();
792
+ }
814
793
  update_af_links();
815
794
  });
816
795
 
@@ -943,6 +922,12 @@ import {ShowCQTElement} from "../../showcqt-element@3/showcqt-element.mjs";
943
922
 
944
923
  menu_div.appendChild(menu_table);
945
924
  menu.onclick = function() {
925
+ if (menu_is_hidden && !child_menu.visible.checked) {
926
+ child_menu.visible.checked = true;
927
+ child_menu.visible.onchange();
928
+ return;
929
+ }
930
+
946
931
  menu_is_hidden = !menu_is_hidden;
947
932
  if (menu_is_hidden)
948
933
  menu_div.style.visibility = "hidden";
@@ -950,6 +935,11 @@ import {ShowCQTElement} from "../../showcqt-element@3/showcqt-element.mjs";
950
935
  menu_div.style.visibility = "visible";
951
936
  };
952
937
 
938
+ cqt.addEventListener("dblclick", () => {
939
+ child_menu.visible.checked = false;
940
+ child_menu.visible.onchange();
941
+ });
942
+
953
943
  var hide_menu = !!(get_opt("hide_menu") * 1);
954
944
  menu.style.visibility = hide_menu ? "hidden" : "visible";
955
945
  document.body.insertBefore(menu_div, document.body.firstChild);