removed CiderContextMenu, cleaned out some unused files
This commit is contained in:
parent
3340fb93df
commit
f02558a9fd
5 changed files with 0 additions and 677 deletions
|
@ -1,78 +1,5 @@
|
|||
Vue.use(VueObserveVisibility);
|
||||
var notyf = new Notyf();
|
||||
// This is going to suck to code
|
||||
var CiderContextMenu = {
|
||||
Menu: function (event) {
|
||||
this.items = []
|
||||
},
|
||||
async Create(event, menudata) {
|
||||
var menuBackground = document.createElement("div");
|
||||
var menu = document.createElement("div");
|
||||
menu.classList.add("context-menu-body");
|
||||
menu.classList.add("context-menu-open");
|
||||
menuBackground.classList.add("context-menu");
|
||||
menu.style.left = 0 + "px";
|
||||
menu.style.top = 0 + "px";
|
||||
menu.style.position = "absolute";
|
||||
menu.style.zIndex = "99909";
|
||||
menu.addEventListener("animationend", function () {
|
||||
menu.classList.remove("context-menu-open");
|
||||
}, {once: true});
|
||||
|
||||
function close() {
|
||||
menuBackground.style.pointerEvents = "none";
|
||||
menu.classList.add("context-menu-close");
|
||||
menu.addEventListener("animationend", function () {
|
||||
menuBackground.remove();
|
||||
menu.remove();
|
||||
}, {once: true});
|
||||
}
|
||||
|
||||
// when menubackground is clicked, remove it
|
||||
menuBackground.addEventListener("click", close);
|
||||
menuBackground.addEventListener("contextmenu", close);
|
||||
|
||||
// add menu to menuBackground
|
||||
menuBackground.appendChild(menu);
|
||||
|
||||
document.body.appendChild(menuBackground);
|
||||
|
||||
if (typeof menudata.items == "object") {
|
||||
menudata.items = Object.values(menudata.items);
|
||||
}
|
||||
|
||||
console.log(menudata);
|
||||
|
||||
// for each item in menudata create a menu item
|
||||
for (var i = 0; i < menudata.items.length; i++) {
|
||||
let item = document.createElement("button")
|
||||
|
||||
if (menudata.items[i]["disabled"] === true) {
|
||||
continue
|
||||
}
|
||||
item.tabIndex = 0
|
||||
item.classList.add("context-menu-item")
|
||||
if (menudata.items[i]["icon"]) {
|
||||
item.innerHTML += `<div class="sidebar-icon">${await app.getSvgIcon(menudata.items[i]["icon"])}</div>`
|
||||
}
|
||||
item.innerHTML += menudata.items[i].name
|
||||
item.onclick = menudata.items[i].action
|
||||
menu.appendChild(item)
|
||||
}
|
||||
menu.style.width = (menu.offsetWidth + 10) + "px";
|
||||
menu.style.left = event.clientX + "px";
|
||||
menu.style.top = event.clientY + "px";
|
||||
// if menu would be off the screen, move it into view, but preserve the width
|
||||
if (menu.offsetLeft + menu.offsetWidth > window.innerWidth) {
|
||||
menu.style.left = (window.innerWidth - menu.offsetWidth) + "px";
|
||||
}
|
||||
if (menu.offsetTop + menu.offsetHeight > window.innerHeight) {
|
||||
menu.style.top = (window.innerHeight - menu.offsetHeight) + "px";
|
||||
}
|
||||
|
||||
return menuBackground;
|
||||
}
|
||||
}
|
||||
|
||||
const MusicKitObjects = {
|
||||
LibraryPlaylist: function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue