From 8007f47c09f0f431ebdcf8d07856af454c3a8bf6 Mon Sep 17 00:00:00 2001 From: eight Date: Sun, 8 Oct 2017 22:08:47 +0800 Subject: [PATCH] Revert "Add: save usercss from multi-section editor" This reverts commit da5626a6d73fdd92eb01d894d8ff186a9fb8aea3. --- _locales/en/messages.json | 8 -------- edit/edit.js | 24 +----------------------- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index c569ab1c..ee2ebe3d 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -787,18 +787,10 @@ "message": "Enter a name.", "description": "Error displayed when user saves without providing a name" }, - "stylePasteMozillaFormat": { - "message": "The code you pasted looks like mozilla format style. Would you like to import it?", - "description": "The confirmation to import mozilla format style from pasted text" - }, "styleSaveLabel": { "message": "Save", "description": "Label for save button for style editing" }, - "styleSaveAsUsercss": { - "message": "The source code contains usercss metadata. Would you like to save the source code as usercss?", - "description": "The confirmation to create usercss from the editor" - }, "styleSectionsTitle": { "message": "Sections", "description": "Title for the style sections section" diff --git a/edit/edit.js b/edit/edit.js index a6417575..9f565714 100644 --- a/edit/edit.js +++ b/edit/edit.js @@ -306,8 +306,7 @@ function setupCodeMirror(textarea, index) { if ( text.includes('@-moz-document') && text.replace(/\/\*[\s\S]*?\*\//g, '') - .match(/@-moz-document[\s\r\n]+(url|url-prefix|domain|regexp)\(/) && - confirm(t('stylePasteMozillaFormat')) + .match(/@-moz-document[\s\r\n]+(url|url-prefix|domain|regexp)\(/) ) { event.preventDefault(); fromMozillaFormat(); @@ -1487,28 +1486,7 @@ function save() { editor.save(); } -function isUsercssSourceCode() { - const sourceCode = editors[0].getValue(); - return /==UserStyle==[\s\S]+==\/UserStyle==/i.test(sourceCode); -} - function saveSectionStyle() { - if (!styleId && isUsercssSourceCode() && confirm(t('styleSaveAsUsercss'))) { - const sourceCode = editors[0].getValue(); - onBackgroundReady() - .then(() => BG.usercssHelper.save({ - reason: 'editSave', - sourceCode, - enabled: $('#enabled').checked - })) - .then(style => { - window.onbeforeunload = null; - location.href = `/edit.html?id=${style.id}`; - }) - .catch(alert); - return; - } - updateLintReportIfEnabled(null, 0); // save the contents of the CodeMirror editors back into the textareas