From 93d1d89fb2aa4d943ef31091228818576f876dc5 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Tue, 22 Jan 2019 01:43:56 +0800 Subject: [PATCH 1/4] Simplify the `if` structure remark: Customize a function to avoid "Line exceeds maximum allowed length" --- .../src/module/tabs.coffee | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/omega-target-chromium-extension/src/module/tabs.coffee b/omega-target-chromium-extension/src/module/tabs.coffee index 508e73e..5ad46ac 100644 --- a/omega-target-chromium-extension/src/module/tabs.coffee +++ b/omega-target-chromium-extension/src/module/tabs.coffee @@ -25,18 +25,15 @@ class ChromeTabs tabs.forEach (tab) => @_dirtyTabs[tab.id] = tab.id @onUpdated tab.id, {}, tab if tab.active - if chrome.action.setPopup? - chrome.action.setTitle({title: action.title}) - else - chrome.action.setTitle({title: action.shortTitle}) + title = if @_canSetPopup() then action.title else action.shortTitle + chrome.action.setTitle({title: title}) @setIcon(action.icon) onUpdated: (tabId, changeInfo, tab) -> if @_dirtyTabs.hasOwnProperty(tab.id) delete @_dirtyTabs[tab.id] - else if not changeInfo.url? - if changeInfo.status? and changeInfo.status != 'loading' - return + else if not changeInfo.url? and changeInfo.status == "complete" + return @processTab(tab, changeInfo) processTab: (tab, changeInfo) -> @@ -58,10 +55,8 @@ class ChromeTabs @clearIcon tab.id return @setIcon(action.icon, tab.id) - if chrome.action.setPopup? - chrome.action.setTitle({title: action.title, tabId: tab.id}) - else - chrome.action.setTitle({title: action.shortTitle, tabId: tab.id}) + title = if @_canSetPopup() then action.title else action.shortTitle + return chrome.action.setTitle({title: title, tabId: tab.id}) ).catch((e) -> console.log('error:', e) ) @@ -77,17 +72,15 @@ class ChromeTabs setIcon: (icon, tabId) -> return unless icon? - if tabId? - params = { - imageData: icon - tabId: tabId - } - else - params = { - imageData: icon - } + params = { + imageData: icon + } + params.tabId = tabId if tabId? @_chromeSetIcon(params) + _canSetPopup: -> + chrome.action.setPopup? + _chromeSetIcon: (params) -> try chrome.action.setIcon?(params, @ignoreError) From 1cd4470a390b8621f4df39368b839669f67dd286 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sat, 26 Jan 2019 04:05:30 +0800 Subject: [PATCH 2/4] Expand popup height when dropdown listed This also allows to 'add' while the dropdown list are expanded. --- omega-web/src/less/popup.less | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/omega-web/src/less/popup.less b/omega-web/src/less/popup.less index 2649651..ca1fef7 100644 --- a/omega-web/src/less/popup.less +++ b/omega-web/src/less/popup.less @@ -86,6 +86,10 @@ li > a { box-shadow: none !important; } +ul.dropdown-menu { + position: relative; +} + li .dropdown-menu { position: static; top: initial; From cfd30ea809707910677c1246f515bb5679ada12b Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sat, 26 Jan 2019 03:38:09 +0800 Subject: [PATCH 3/4] Allow to copy text in disabled textarea --- omega-web/src/partials/profile_pac.jade | 2 +- omega-web/src/partials/profile_rule_list.jade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/omega-web/src/partials/profile_pac.jade b/omega-web/src/partials/profile_pac.jade index 9367e24..9e445f5 100644 --- a/omega-web/src/partials/profile_pac.jade +++ b/omega-web/src/partials/profile_pac.jade @@ -37,4 +37,4 @@ div(ng-controller='PacProfileCtrl') p.alert.alert-danger.width-limit(ng-show='profile.pacUrl && !profile.lastUpdate') | {{'options_pacScriptObsolete' | tr}} textarea.monospace.form-control.width-limit(ng-model='profile.pacScript' rows=20 - ng-disabled='pacUrlCtrl.ctrl.$invalid || !!profile.pacUrl') + ng-readonly='pacUrlCtrl.ctrl.$invalid || !!profile.pacUrl') diff --git a/omega-web/src/partials/profile_rule_list.jade b/omega-web/src/partials/profile_rule_list.jade index 1d895ce..e9e489a 100644 --- a/omega-web/src/partials/profile_rule_list.jade +++ b/omega-web/src/partials/profile_rule_list.jade @@ -28,5 +28,5 @@ div(ng-controller='RuleListProfileCtrl') ladda='updatingProfile[profile.name]' data-spinner-color="#000000") | #[span.glyphicon.glyphicon-download-alt] {{'options_downloadProfileNow' | tr}} textarea.monospace.form-control.width-limit(ng-model='profile.ruleList' rows=20 - ng-disabled='!!profile.sourceUrl') + ng-readonly='!!profile.sourceUrl') From 6a586254768b3bb27c1007118385c00e95c7b310 Mon Sep 17 00:00:00 2001 From: sn-o-w Date: Tue, 7 May 2024 02:45:07 +0300 Subject: [PATCH 4/4] Add localizable 'Actions' string in options --- omega-web/src/options.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omega-web/src/options.jade b/omega-web/src/options.jade index 0383143..84cbc7f 100644 --- a/omega-web/src/options.jade +++ b/omega-web/src/options.jade @@ -48,7 +48,7 @@ html(lang='en' ng-controller='MasterCtrl' ng-csp) = ' ' span {{'options_newProfile' | tr}} li.divider - li.nav-header Actions + li.nav-header {{'options_navHeader_actions' | tr}} li a.btn-default.btn.align-initial(role='button' ng-click='applyOptions()' ng-class='{"btn-success": optionsDirty}')