From f76a76267a0cda15fed675e05e45386cb0eaf222 Mon Sep 17 00:00:00 2001 From: mi-yo Date: Wed, 15 Apr 2020 22:41:22 +0900 Subject: [PATCH] Revert "Feature/tb68" --- content/prefutil.js | 3 +- content/setting.js | 65 ++++++++++++------------------------------- content/setting.xul | 21 +++++++++----- content/settingadd.js | 21 -------------- install.rdf | 4 +-- 5 files changed, 35 insertions(+), 79 deletions(-) diff --git a/content/prefutil.js b/content/prefutil.js index 32c2607..3224e60 100644 --- a/content/prefutil.js +++ b/content/prefutil.js @@ -15,8 +15,7 @@ if("undefined" == typeof(SubjectCleanerPrefUtil)){ }, getDefaultRemovalList : function(){ try{ - return JSON.parse("[{\"removalString\":\"\\\\[\\\\w+:\\\\d+\\\\](\\\\s|)\",\"caseSensitive\":false,\"regexp\":true},{\"removalString\":\"\\\\sRe:+\",\"caseSensitive\":false,\"regexp\":true}]"); - //return JSON.parse(SubjectCleanerPrefUtil.PREF_DEFAULT.getComplexValue(SubjectCleanerPrefUtil.PREF_KEY_REMOVALLIST, SubjectCleanerPrefUtil.getInterfaceComplexValueAtype()).data); + return JSON.parse(SubjectCleanerPrefUtil.PREF_DEFAULT.getComplexValue(SubjectCleanerPrefUtil.PREF_KEY_REMOVALLIST, SubjectCleanerPrefUtil.getInterfaceComplexValueAtype()).data); }catch(e){ console.log(e); return new Array(); diff --git a/content/setting.js b/content/setting.js index 764cc11..2d19068 100644 --- a/content/setting.js +++ b/content/setting.js @@ -14,19 +14,6 @@ if("undefined" == typeof(SubjectCleanerSetting)){ document.getElementById("test").addEventListener("command", SubjectCleanerSetting.test, true); document.getElementById("default").addEventListener("command", SubjectCleanerSetting.default, true); document.getElementById("autoRemove").addEventListener("CheckboxStateChange", SubjectCleanerSetting.setAutoFocusStatus, true); - - document.addEventListener("dialogaccept", function(event) { - let ret = SubjectCleanerSetting.doOK(); - if (ret == -1) { //onAccept()がエラーを返したときに、ダイアログを閉じない場合 - event.preventDefault(); - } -}); - document.addEventListener("dialogcancel", function(event) { - let ret = SubjectCleanerSetting.doCancel(); - if (ret == -1) { //onAccept()がエラーを返したときに、ダイアログを閉じない場合 - event.preventDefault(); - } -}); SubjectCleanerSetting.fill( SubjectCleanerPrefUtil.getRemovalList(), @@ -35,23 +22,19 @@ if("undefined" == typeof(SubjectCleanerSetting)){ }, setSelectedItem : function(item){ - var removalList = document.getElementById("removalList"); - - SubjectCleanerSetting.selectedItem = removalList.selectedItem;//item; + SubjectCleanerSetting.selectedItem = item; }, getRemovalList : function(){ var removalList = new Array(); var nodes = document.getElementById("removalList").childNodes; - - for(var i=0; i 0){ - var removalList = document.getElementById("removalList"); var listItem = SubjectCleanerSetting.createListItem( addDialogDto.removal.removalString, @@ -115,18 +87,18 @@ if("undefined" == typeof(SubjectCleanerSetting)){ }, edit : function(event){ - var listCells = SubjectCleanerSetting.selectedItem.children; + var listCells = SubjectCleanerSetting.selectedItem.childNodes; var removal = {}; - removal.removalString = SubjectCleanerSetting.selectedItem.children[0].value; - removal.caseSensitive = JSON.parse(SubjectCleanerSetting.selectedItem.children[1].checked); - removal.regexp = JSON.parse(SubjectCleanerSetting.selectedItem.children[2].checked); + removal.removalString = listCells[0].getAttribute("label"); + removal.caseSensitive = JSON.parse(listCells[1].getAttribute("checked")); + removal.regexp = JSON.parse(listCells[2].getAttribute("checked")); var addDialogDto = new SubjectCleanerSetting.AddDialogDto(removal); window.openDialog("chrome://subjectcleaner/content/settingadd.xul", "SubjectCleanerSettingDialog", "chrome,modal,titlebar,centerscreen", addDialogDto); if(addDialogDto.confirmOK){ if(addDialogDto.removal.removalString.length > 0){ - listCells[0].setAttribute("value", addDialogDto.removal.removalString); + listCells[0].setAttribute("label", addDialogDto.removal.removalString); listCells[1].setAttribute("checked", addDialogDto.removal.caseSensitive); listCells[2].setAttribute("checked", addDialogDto.removal.regexp); } @@ -138,7 +110,7 @@ if("undefined" == typeof(SubjectCleanerSetting)){ var removeIndex = removalList.selectedIndex; var nextSelectedIndex = (removeIndex > 0) ? removeIndex - 1 : 0; removalList.scrollToIndex(nextSelectedIndex); - removalList.getItemAtIndex(removeIndex).remove(); + removalList.removeItemAt(removeIndex); removalList.selectedIndex = nextSelectedIndex; }, @@ -162,12 +134,11 @@ if("undefined" == typeof(SubjectCleanerSetting)){ }, fill : function(removalList, autoRemove, autoFocus){ - var viewRemovalList = document.getElementById("removalList"); if(removalList !== null && removalList.length !== 0){ var itemCount = viewRemovalList.itemCount; for(var i=itemCount-1; i>=0; i--){ - viewRemovalList.getItemAtIndex(i).remove(); + viewRemovalList.removeItemAt(i); } for(var i=0; i - - - - - - - + + + + + + + + + + + + + +