From d6db79a9905ec96a58bac9b1525815127fc8eac6 Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 25 Dec 2021 12:46:00 +0300 Subject: [PATCH] revert right-click or shift-click, 0fec0c61 --- _locales/en/messages.json | 4 ---- manage.html | 2 +- manage/import-export.js | 15 ++++----------- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 8b7c8b64..3e6a9326 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -391,10 +391,6 @@ "excludeStyleByUrlLabel": { "message": "Exclude the current URL" }, - "exportDeduplicate": { - "message": "Shift-click or Right-click will export a smaller file for UserCSS styles.\nSuch styles can be imported only in Stylus 1.5.23 or newer.", - "description": "Tooltip for the button to export all styles in the 'manage' page" - }, "exportLabel": { "message": "Export", "description": "Label for the button to export a style ('edit' page) or all styles ('manage' page)" diff --git a/manage.html b/manage.html index 85b10f2e..c0eddb19 100644 --- a/manage.html +++ b/manage.html @@ -323,7 +323,7 @@

- +
diff --git a/manage/import-export.js b/manage/import-export.js index 77457d2f..16793854 100644 --- a/manage/import-export.js +++ b/manage/import-export.js @@ -14,10 +14,7 @@ */// dom.js 'use strict'; -Object.assign($('#file-all-styles'), { - onclick: exportToFile, - oncontextmenu: exportToFile, -}); +$('#file-all-styles').onclick = exportToFile; $('#unfile-all-styles').onclick = () => importFromFile({fileTypeFilter: '.json'}); Object.assign(document.body, { @@ -328,17 +325,13 @@ async function importFromString(jsonString) { } } -/** @param {MouseEvent} e */ -async function exportToFile(e) { - e.preventDefault(); +async function exportToFile() { await require(['/js/storage-util']); - const shouldClean = e.shiftKey || e.button === 2; - const styles = await API.styles.getAll(); const data = [ Object.assign({ [prefs.STORAGE_KEY]: prefs.values, }, await chromeSync.getLZValues()), - ...shouldClean ? styles.map(cleanupStyle) : styles, + ...(await API.styles.getAll()).map(cleanupStyle), ]; const text = JSON.stringify(data, null, ' '); const type = 'application/json'; @@ -347,7 +340,7 @@ async function exportToFile(e) { download: generateFileName(), type, }).dispatchEvent(new MouseEvent('click')); - /** Stripping `sections`, `null` and empty objects */ + /** strip `sections`, `null` and empty objects */ function cleanupStyle(style) { const copy = {}; for (let [key, val] of Object.entries(style)) {