Remove Deletion

Completely removes the ability for a user to delete any Events within Google Calendar. This includes Events on their personal calendar.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Remove Deletion
// @namespace    https://almedawaterwell.com/
// @version      0.1
// @description  Completely removes the ability for a user to delete any Events within Google Calendar. This includes Events on their personal calendar.
// @author       Luke Pyburn
// @match        *://calendar.google.com/calendar/u/*
// @run-at       document-idle
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_openInTab
// @grant        GM_setClipboard
// @grant        unsafeWindow
// @license      MIT
// @require      http://code.jquery.com/jquery-3.6.0.min.js
// ==/UserScript==

var $ = window.jQuery;

//Removes trash/delete icon from all Events in quick edit.
window.addEventListener("focusin", function(event) {
    var todelete = document.querySelector('#xDetDlgDelBu');
    todelete.remove();
    console.log("Delete button removed.");
});

//Removes "Delete" as a selectable option in Event Edit's "More Options" drop-down menu.
window.addEventListener("focusin", function(event) {
    var todelete = document.querySelector("#YPCqFe > div > div.JPdR6b.Q3pIde.qjTEB > div > div > span:nth-child(2) > div.uyYuVb.oJeWuf");
    todelete.remove();
    console.log("Delete button removed.");
});

//Junk
// #YPCqFe > div > div.JPdR6b.Q3pIde.qjTEB > div > div > span:nth-child(2)
// z80M1 taKRZe
//  > div > div.JPdR6b.Q3pIde.qjTEB > div > div > span:nth-child(2)
// xDetDlg
// $('uArJ5e Y5FYJe cjq2Db d29e1c M9Bg4d').remove();
// Junk