From a1135ffa3efa49af148434e27de645c6416348df Mon Sep 17 00:00:00 2001 From: FelisCatus Date: Mon, 9 Jan 2017 14:19:08 -0800 Subject: [PATCH] Add alert about full URL limitation. Fix #845. See: https://github.com/FelisCatus/SwitchyOmega/wiki/Chromium-Full-URL-Limitation --- omega-locales/ach/LC_MESSAGES/omega-web.po | 7 +++++++ omega-locales/cs/LC_MESSAGES/omega-web.po | 7 +++++++ omega-locales/de/LC_MESSAGES/omega-web.po | 7 +++++++ omega-locales/en_US/LC_MESSAGES/omega-web.po | 7 +++++++ omega-locales/es_AR/LC_MESSAGES/omega-web.po | 7 +++++++ omega-locales/fa/LC_MESSAGES/omega-web.po | 7 +++++++ omega-locales/fr/LC_MESSAGES/omega-web.po | 7 +++++++ omega-locales/is/LC_MESSAGES/omega-web.po | 7 +++++++ omega-locales/ja/LC_MESSAGES/omega-web.po | 7 +++++++ omega-locales/nb_NO/LC_MESSAGES/omega-web.po | 7 +++++++ omega-locales/pt_BR/LC_MESSAGES/omega-web.po | 7 +++++++ omega-locales/ru/LC_MESSAGES/omega-web.po | 7 +++++++ omega-locales/sk/LC_MESSAGES/omega-web.po | 7 +++++++ omega-locales/sl/LC_MESSAGES/omega-web.po | 7 +++++++ omega-locales/tr/LC_MESSAGES/omega-web.po | 7 +++++++ omega-locales/zh_CN/LC_MESSAGES/omega-web.po | 6 ++++++ omega-locales/zh_TW/LC_MESSAGES/omega-web.po | 6 ++++++ omega-web/src/less/options.less | 13 +++++++++++++ .../src/omega/controllers/switch_profile.coffee | 14 +++++++++++++- omega-web/src/partials/profile_switch.jade | 14 ++++++++++++-- 20 files changed, 155 insertions(+), 3 deletions(-) diff --git a/omega-locales/ach/LC_MESSAGES/omega-web.po b/omega-locales/ach/LC_MESSAGES/omega-web.po index 1dc5fff..81aa847 100644 --- a/omega-locales/ach/LC_MESSAGES/omega-web.po +++ b/omega-locales/ach/LC_MESSAGES/omega-web.po @@ -150,6 +150,13 @@ msgstr "" "The request and its URL don't matter to this condition. " "The result is solely based on the day of the week when the request is sent." +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Full URL matching is no longer possible for https:// " +"URLs as of Chrome 52. " +"" +"Learn more..." + msgid "condition_group_default" msgstr " " diff --git a/omega-locales/cs/LC_MESSAGES/omega-web.po b/omega-locales/cs/LC_MESSAGES/omega-web.po index 446d1b9..6b7bec6 100644 --- a/omega-locales/cs/LC_MESSAGES/omega-web.po +++ b/omega-locales/cs/LC_MESSAGES/omega-web.po @@ -152,6 +152,13 @@ msgstr "" "The request and its URL don't matter to this condition. " "The result is solely based on the day of the week when the request is sent." +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Full URL matching is no longer possible for https:// " +"URLs as of Chrome 52. " +"" +"Learn more..." + msgid "condition_group_default" msgstr " " diff --git a/omega-locales/de/LC_MESSAGES/omega-web.po b/omega-locales/de/LC_MESSAGES/omega-web.po index 2e7caa7..2d4eabe 100644 --- a/omega-locales/de/LC_MESSAGES/omega-web.po +++ b/omega-locales/de/LC_MESSAGES/omega-web.po @@ -155,6 +155,13 @@ msgstr "" "The request and its URL don't matter to this condition. " "The result is solely based on the day of the week when the request is sent." +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Full URL matching is no longer possible for https:// " +"URLs as of Chrome 52. " +"" +"Learn more..." + msgid "condition_group_default" msgstr " " diff --git a/omega-locales/en_US/LC_MESSAGES/omega-web.po b/omega-locales/en_US/LC_MESSAGES/omega-web.po index 2d7a199..b164496 100644 --- a/omega-locales/en_US/LC_MESSAGES/omega-web.po +++ b/omega-locales/en_US/LC_MESSAGES/omega-web.po @@ -151,6 +151,13 @@ msgstr "" "The request and its URL don't matter to this condition. " "The result is solely based on the day of the week when the request is sent." +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Full URL matching is no longer possible for https:// " +"URLs as of Chrome 52. " +"" +"Learn more..." + msgid "condition_group_default" msgstr " " diff --git a/omega-locales/es_AR/LC_MESSAGES/omega-web.po b/omega-locales/es_AR/LC_MESSAGES/omega-web.po index 47373eb..8402583 100644 --- a/omega-locales/es_AR/LC_MESSAGES/omega-web.po +++ b/omega-locales/es_AR/LC_MESSAGES/omega-web.po @@ -154,6 +154,13 @@ msgstr "" "The request and its URL don't matter to this condition. " "The result is solely based on the day of the week when the request is sent." +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Full URL matching is no longer possible for https:// " +"URLs as of Chrome 52. " +"" +"Learn more..." + msgid "condition_group_default" msgstr " " diff --git a/omega-locales/fa/LC_MESSAGES/omega-web.po b/omega-locales/fa/LC_MESSAGES/omega-web.po index 4d3cd99..ea4dc68 100644 --- a/omega-locales/fa/LC_MESSAGES/omega-web.po +++ b/omega-locales/fa/LC_MESSAGES/omega-web.po @@ -158,6 +158,13 @@ msgstr "" "The request and its URL don't matter to this condition. " "The result is solely based on the day of the week when the request is sent." +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Full URL matching is no longer possible for https:// " +"URLs as of Chrome 52. " +"" +"Learn more..." + msgid "condition_group_default" msgstr " " diff --git a/omega-locales/fr/LC_MESSAGES/omega-web.po b/omega-locales/fr/LC_MESSAGES/omega-web.po index f2d5564..d6e730a 100644 --- a/omega-locales/fr/LC_MESSAGES/omega-web.po +++ b/omega-locales/fr/LC_MESSAGES/omega-web.po @@ -152,6 +152,13 @@ msgstr "" "The request and its URL don't matter to this condition. " "The result is solely based on the day of the week when the request is sent." +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Full URL matching is no longer possible for https:// " +"URLs as of Chrome 52. " +"" +"Learn more..." + msgid "condition_group_default" msgstr " " diff --git a/omega-locales/is/LC_MESSAGES/omega-web.po b/omega-locales/is/LC_MESSAGES/omega-web.po index 91779aa..37d827c 100644 --- a/omega-locales/is/LC_MESSAGES/omega-web.po +++ b/omega-locales/is/LC_MESSAGES/omega-web.po @@ -106,6 +106,13 @@ msgstr "Vikudagur" msgid "condition_help_WeekdayCondition" msgstr "" +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Full URL matching is no longer possible for https:// " +"URLs as of Chrome 52. " +"" +"Learn more..." + msgid "condition_group_default" msgstr "" diff --git a/omega-locales/ja/LC_MESSAGES/omega-web.po b/omega-locales/ja/LC_MESSAGES/omega-web.po index c0bf2ed..6dcf26c 100644 --- a/omega-locales/ja/LC_MESSAGES/omega-web.po +++ b/omega-locales/ja/LC_MESSAGES/omega-web.po @@ -148,6 +148,13 @@ msgstr "" "The request and its URL don't matter to this condition. " "The result is solely based on the day of the week when the request is sent." +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Full URL matching is no longer possible for https:// " +"URLs as of Chrome 52. " +"" +"Learn more..." + msgid "condition_group_default" msgstr " " diff --git a/omega-locales/nb_NO/LC_MESSAGES/omega-web.po b/omega-locales/nb_NO/LC_MESSAGES/omega-web.po index 4e3e3c9..3cbb70c 100644 --- a/omega-locales/nb_NO/LC_MESSAGES/omega-web.po +++ b/omega-locales/nb_NO/LC_MESSAGES/omega-web.po @@ -114,6 +114,13 @@ msgstr "Ukedag" msgid "condition_help_WeekdayCondition" msgstr "" +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Full URL matching is no longer possible for https:// " +"URLs as of Chrome 52. " +"" +"Learn more..." + msgid "condition_group_default" msgstr "" diff --git a/omega-locales/pt_BR/LC_MESSAGES/omega-web.po b/omega-locales/pt_BR/LC_MESSAGES/omega-web.po index 3be9cfe..dc91673 100644 --- a/omega-locales/pt_BR/LC_MESSAGES/omega-web.po +++ b/omega-locales/pt_BR/LC_MESSAGES/omega-web.po @@ -151,6 +151,13 @@ msgstr "" "The request and its URL don't matter to this condition. " "The result is solely based on the day of the week when the request is sent." +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Full URL matching is no longer possible for https:// " +"URLs as of Chrome 52. " +"" +"Learn more..." + msgid "condition_group_default" msgstr " " diff --git a/omega-locales/ru/LC_MESSAGES/omega-web.po b/omega-locales/ru/LC_MESSAGES/omega-web.po index 3137b17..0d54d9d 100644 --- a/omega-locales/ru/LC_MESSAGES/omega-web.po +++ b/omega-locales/ru/LC_MESSAGES/omega-web.po @@ -155,6 +155,13 @@ msgstr "" "The request and its URL don't matter to this condition. " "The result is solely based on the day of the week when the request is sent." +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Full URL matching is no longer possible for https:// " +"URLs as of Chrome 52. " +"" +"Learn more..." + msgid "condition_group_default" msgstr " " diff --git a/omega-locales/sk/LC_MESSAGES/omega-web.po b/omega-locales/sk/LC_MESSAGES/omega-web.po index 911fbbd..d7f0cec 100644 --- a/omega-locales/sk/LC_MESSAGES/omega-web.po +++ b/omega-locales/sk/LC_MESSAGES/omega-web.po @@ -105,6 +105,13 @@ msgstr "" msgid "condition_help_WeekdayCondition" msgstr "" +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Full URL matching is no longer possible for https:// " +"URLs as of Chrome 52. " +"" +"Learn more..." + msgid "condition_group_default" msgstr "" diff --git a/omega-locales/sl/LC_MESSAGES/omega-web.po b/omega-locales/sl/LC_MESSAGES/omega-web.po index 225d813..c92c5eb 100644 --- a/omega-locales/sl/LC_MESSAGES/omega-web.po +++ b/omega-locales/sl/LC_MESSAGES/omega-web.po @@ -107,6 +107,13 @@ msgstr "" msgid "condition_help_WeekdayCondition" msgstr "" +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Full URL matching is no longer possible for https:// " +"URLs as of Chrome 52. " +"" +"Learn more..." + msgid "condition_group_default" msgstr "" diff --git a/omega-locales/tr/LC_MESSAGES/omega-web.po b/omega-locales/tr/LC_MESSAGES/omega-web.po index 6c003b5..67b7629 100644 --- a/omega-locales/tr/LC_MESSAGES/omega-web.po +++ b/omega-locales/tr/LC_MESSAGES/omega-web.po @@ -154,6 +154,13 @@ msgstr "" "The request and its URL don't matter to this condition. " "The result is solely based on the day of the week when the request is sent." +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Full URL matching is no longer possible for https:// " +"URLs as of Chrome 52. " +"" +"Learn more..." + msgid "condition_group_default" msgstr "" diff --git a/omega-locales/zh_CN/LC_MESSAGES/omega-web.po b/omega-locales/zh_CN/LC_MESSAGES/omega-web.po index ee29b39..ac0e9bc 100644 --- a/omega-locales/zh_CN/LC_MESSAGES/omega-web.po +++ b/omega-locales/zh_CN/LC_MESSAGES/omega-web.po @@ -134,6 +134,12 @@ msgstr "" "假设在请求发送时是星期X:如果星期X被勾选,则匹配所有请求。否则不匹配任何请求。
" "除了日期以外,在匹配过程中不会参考请求的网址或任何其他信息。" +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Chrome 52 起,https://协议下的完整网址无法正常匹配。" +"" +"更多信息..." + msgid "condition_group_default" msgstr " " diff --git a/omega-locales/zh_TW/LC_MESSAGES/omega-web.po b/omega-locales/zh_TW/LC_MESSAGES/omega-web.po index b9eacd1..699848c 100644 --- a/omega-locales/zh_TW/LC_MESSAGES/omega-web.po +++ b/omega-locales/zh_TW/LC_MESSAGES/omega-web.po @@ -134,6 +134,12 @@ msgstr "" "假設在請求傳送時是星期X:如果星期X被勾選,則匹配所有請求。否則不匹配任何請求。
" "除了日期以外,在匹配過程中不會參考請求的網址或任何其他資訊。" +msgid "condition_alert_fullUrlLimitation" +msgstr "" +"Chrome 52 起,https://協議下的完整網址無法正常匹配。" +"" +"更多信息..." + msgid "condition_group_default" msgstr " " diff --git a/omega-web/src/less/options.less b/omega-web/src/less/options.less index 77d2574..be6eb0d 100644 --- a/omega-web/src/less/options.less +++ b/omega-web/src/less/options.less @@ -463,6 +463,19 @@ main { cursor: move; } +.switch-rule-row td.has-icon { + > .form-control { + display: inline-block; + width: ~"calc(100% - 1.5em)"; + } + + > .glyphicon { + display: block; + float: right; + line-height: 34px; + } +} + .cycle-profile-container { list-style-type: none; min-height: 20px; diff --git a/omega-web/src/omega/controllers/switch_profile.coffee b/omega-web/src/omega/controllers/switch_profile.coffee index 10e196c..5aa55e5 100644 --- a/omega-web/src/omega/controllers/switch_profile.coffee +++ b/omega-web/src/omega/controllers/switch_profile.coffee @@ -116,9 +116,21 @@ angular.module('omega').controller 'SwitchProfileCtrl', ($scope, $rootScope, $scope.showConditionTypes = 0 $scope.hasConditionTypes = 0 + $scope.hasUrlConditions = false + $scope.isUrlConditionType = + 'UrlWildcardCondition': true + 'UrlRegexCondition': true + updateHasConditionTypes = -> - return unless $scope.hasConditionTypes == 0 return unless $scope.profile?.rules? + + $scope.hasUrlConditions = false + for rule in $scope.profile.rules + if $scope.isUrlConditionType[rule.condition.conditionType] + $scope.hasUrlConditions = true + break + + return unless $scope.hasConditionTypes == 0 for rule in $scope.profile.rules # Convert TrueCondition to a HostWildcardCondition with pattern '*'. if rule.condition.conditionType == 'TrueCondition' diff --git a/omega-web/src/partials/profile_switch.jade b/omega-web/src/partials/profile_switch.jade index 2b18e98..dd3dbea 100644 --- a/omega-web/src/partials/profile_switch.jade +++ b/omega-web/src/partials/profile_switch.jade @@ -13,7 +13,12 @@ div(ng-controller='SwitchProfileCtrl') | {{'condition_group_' + group.group | tr}} dl(ng-show='expandedSection.id == $index') dt(ng-repeat-start='type in group.types') {{'condition_' + type | tr}} - dd(ng-repeat-end ng-bind-html='"condition_help_" + type | tr') + dd(ng-repeat-end) + div(ng-bind-html='"condition_help_" + type | tr') + .text-danger(ng-if='isUrlConditionType[type]') + span.glyphicon.glyphicon-alert + = ' ' + span(ng-bind-html='"condition_alert_fullUrlLimitation" | tr') section.settings-group h3 | {{'options_group_switchRules' | tr}} @@ -32,6 +37,10 @@ div(ng-controller='SwitchProfileCtrl') span.glyphicon.glyphicon-remove = ' ' | {{source.error.message}} + .alert.alert-danger(ng-show='!!hasUrlConditions') + span.glyphicon.glyphicon-alert + = ' ' + span(ng-bind-html='"condition_alert_fullUrlLimitation" | tr') .rules-source(ng-show='editSource') textarea.monospace.form-control.width-limit(ng-model='source.code' rows=20 ng-change='source.touched = true; $root.optionsDirty = true') .table-responsive.switch-rules-wrapper(ng-if='loadRules' ng-show='!editSource') @@ -53,9 +62,10 @@ div(ng-controller='SwitchProfileCtrl') tr.switch-rule-row(ng-repeat='rule in profile.rules') td.sort-bar span.glyphicon.glyphicon-sort - td + td(ng-class='{"has-icon": isUrlConditionType[rule.condition.conditionType]}') select.form-control(ng-model='rule.condition.conditionType' ng-options='type.type as ("condition_" + type.type | tr) group by (type.group | tr) for type in conditionTypes') + span.glyphicon.glyphicon-alert.text-danger(ng-if='isUrlConditionType[rule.condition.conditionType]') td(ng-switch='rule.condition.conditionType' ng-class='{"has-warning": conditionHasWarning(rule.condition)}') span(ng-switch-when='FalseCondition') span(ng-show='!!rule.condition.pattern')