popup.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <!DOCTYPE html>
  2. <!--
  3. Copyright 2017 The SwitchyOmega Authors. Please see the AUTHORS file
  4. for details.
  5. This file is part of SwitchyOmega.
  6. SwitchyOmega is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. SwitchyOmega is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with SwitchyOmega. If not, see <http://www.gnu.org/licenses/>.
  16. -->
  17. <html lang="en" ng-app="omegaPopup" ng-controller="PopupCtrl" ng-csp>
  18. <head>
  19. <meta charset="utf-8">
  20. <title>{{'popup_title' | tr}}</title>
  21. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  22. <link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css">
  23. <link rel="stylesheet" href="css/popup.css">
  24. </head>
  25. <body ng-class="{&quot;with-condition-form&quot;: showConditionForm}">
  26. <ul ng-hide="showConditionForm || proxyNotControllable || showRequestInfo" class="popup-menu-nav nav nav-pills nav-stacked">
  27. <li ng-repeat="profile in builtinProfiles" ng-class="{active: isActive(profile.name), &quot;bg-info&quot;: isEffective(profile.name)}" class="profile"><a href="#" role="button" ng-attr-tabindex="{{100 + $index}}" ng-click="applyProfile(profile)" title="{{getProfileTitle(profile)}}" data-shortcut="+{{profile.name}}"><span omega-profile-inline="profile" icon="getIcon(profile)" options="availableProfiles" disp-name="dispNameFilter"></span></a></li>
  28. <li ng-show="!requestInfoProvided &amp;&amp; !!externalProfile" ng-class="{active: isActive(&quot;&quot;), &quot;bg-info&quot;: isEffective(&quot;&quot;)}" class="profile external-profile"><a href="#" role="button" ng-click="nameExternal.open = true" title="{{getProfileTitle(externalProfile)}}" data-shortcut="external">
  29. <form name="nameExternalForm" ng-submit="nameExternalForm.$valid &amp;&amp; saveExternal()"><span omega-profile-icon="externalProfile" icon="getIcon(externalProfile, &quot;normal&quot;)" options="availableProfiles" disp-name="dispNameFilter"></span> <span ng-show="!nameExternal.open">{{'popup_externalProfile' | tr}}</span>
  30. <input ng-show="!!nameExternal.open" ng-model="externalProfile.name" ng-blur="nameExternalForm.$valid &amp;&amp; saveExternal()" placeholder="{{&quot;popup_externalProfileName&quot; | tr}}" ui-validate="validateProfileName" autofocus class="form-control">
  31. </form></a></li>
  32. <li ng-show="!!requestInfoProvided" class="request-info bg-warning"><a href="#" role="button" ng-click="showRequestInfo = true" data-shortcut="requestInfo"><span class="glyphicon glyphicon-warning-sign text-warning"></span> {{'popup_requestErrorCount' | tr:[requestInfo.errorCount]}}</a></li>
  33. <li class="divider"></li>
  34. <li ng-repeat="profile in customProfiles" ng-class="{active: isActive(profile.name), &quot;bg-info&quot;: isEffective(profile.name)}" dropdown class="profile custom-profile"><a href="#" role="button" ng-click="applyProfile(profile)" ng-if="!profile.validResultProfiles" title="{{getProfileTitle(profile)}}"><span omega-profile-inline="profile" icon="getIcon(profile)" options="availableProfiles" disp-name="dispNameFilter"></span></a><a href="#" role="button" ng-click="applyProfile(profile)" ng-if="!!profile.validResultProfiles" title="{{getProfileTitle(profile)}}" class="profile-with-default-edit"><span omega-profile-inline="profile" icon="getIcon(profile)" options="availableProfiles" disp-name="dispNameFilter"></span> [{{profile.defaultProfileName}}]
  35. <button role="button" dropdown-toggle href="#" ng-click="$event.stopPropagation()" class="dropdown-toggle btn btn-default"><span class="glyphicon glyphicon-chevron-down"></span></button></a>
  36. <ul ng-if="!!profile.validResultProfiles" class="dropdown-menu">
  37. <li ng-repeat="p in profile.validResultProfiles" ng-class="{active: p.name == profile.defaultProfileName}"><a href="#" role="button" ng-click="setDefaultProfile(profile.name, p.name)" title="{{getProfileTitle(profile)}}"><span omega-profile-inline="p" options="availableProfiles" disp-name="dispNameFilter"></span></a></li>
  38. </ul>
  39. </li>
  40. <li ng-show="!!currentDomain &amp;&amp; validResultProfiles.length" class="divider"></li>
  41. <li ng-show="!!currentProfileCanAddRule &amp;&amp; !!currentDomain"><a href="#" role="button" ng-click="prepareConditionForm()" data-shortcut="addRule"><span class="glyphicon glyphicon-plus"></span> <span>{{'popup_addCondition' | tr}}</span></a></li>
  42. <li ng-show="!!currentDomain &amp;&amp; validResultProfiles.length" dropdown is-open="tempRuleMenu.open"><a href="#" role="button" dropdown-toggle data-shortcut="tempRule" class="dropdown-toggle"><span class="glyphicon glyphicon-filter"></span> <span class="current-domain">{{currentDomain}}</span><span class="caret"></span></a>
  43. <ul class="dropdown-menu">
  44. <li ng-repeat="profile in validResultProfiles" ng-class="{active: profile.name == currentTempRuleProfile}" ng-show="!!currentTempRuleProfile || validResultProfiles.length == 1 || profile.name != currentProfileName"><a href="#" role="button" ng-click="addTempRule(currentDomain, profile.name)" title="{{getProfileTitle(profile)}}"><span omega-profile-inline="profile" options="availableProfiles" disp-name="dispNameFilter"></span></a></li>
  45. </ul>
  46. </li>
  47. <li class="divider"></li>
  48. <li><a href="#" role="button" ng-click="openOptions()" data-shortcut="option"><span class="glyphicon glyphicon-wrench"></span> <span>{{'popup_showOptions' | tr}}</span></a></li>
  49. </ul>
  50. <form name="conditionForm" style="display: none;" ng-style="{display: showConditionForm ? &quot;block&quot; : &quot;none&quot;}" ng-submit="addCondition(rule.condition, rule.profileName)" class="condition-form">
  51. <fieldset>
  52. <legend>{{'popup_addConditionTo' | tr}} <span class="profile-inline"><span omega-profile-inline="currentProfile" options="availableProfiles" disp-name="dispNameFilter"></span></span>
  53. </legend>
  54. <div class="form-group">
  55. <label>{{'options_conditionType' | tr}}
  56. <button type="button" ng-click="openConditionHelp()" class="btn btn-link btn-sm clear-padding">{{"options_showConditionTypeHelp" | tr}} <span class="glyphicon glyphicon-new-window"></span>
  57. </button>
  58. </label>
  59. <select ng-model="rule.condition.conditionType" class="form-control">
  60. <option value="HostWildcardCondition">{{'condition_HostWildcardCondition' | tr}}</option>
  61. <option value="HostRegexCondition">{{'condition_HostRegexCondition' | tr}}</option>
  62. <option value="UrlWildcardCondition">{{'condition_UrlWildcardCondition' | tr}}</option>
  63. <option value="UrlRegexCondition">{{'condition_UrlRegexCondition' | tr}}</option>
  64. <option value="KeywordCondition">{{'condition_KeywordCondition' | tr}}</option>
  65. </select>
  66. </div>
  67. <div class="form-group">
  68. <label>{{'options_conditionDetails' | tr}}</label>
  69. <input type="text" required ng-model="rule.condition.pattern" autofocus class="form-control condition-details">
  70. </div>
  71. <div class="form-group">
  72. <label>{{'options_resultProfile' | tr}}</label>
  73. <div omega-profile-select="validResultProfiles" ng-model="rule.profileName" disp-name="dispNameFilter" options="availableProfiles"></div>
  74. </div>
  75. <div class="condition-controls">
  76. <button type="button" ng-click="returnToMenu()" class="btn btn-default">{{'dialog_cancel' | tr}}</button>
  77. <button type="submit" ng-disabled="conditionForm.$invalid" class="btn btn-primary">{{'popup_addCondition' | tr}}</button>
  78. </div>
  79. </fieldset>
  80. </form>
  81. <div ng-show="proxyNotControllable" class="proxy-not-controllable">
  82. <p class="text-danger">{{'popup_proxyNotControllable_' + proxyNotControllable | tr}}</p>
  83. <p class="help-block">{{('popup_proxyNotControllableDetails_' + proxyNotControllable | tr) || ('popup_proxyNotControllableDetails' | tr)}}</p>
  84. <p class="proxy-not-controllable-controls">
  85. <button ng-click="closePopup()" class="btn btn-default">{{'dialog_cancel' | tr}}</button>
  86. <button ng-click="openManage()" class="btn btn-primary">{{'popup_proxyNotControllableManage' | tr}}</button>
  87. </p>
  88. </div>
  89. <div ng-show="showRequestInfo" class="request-info-details"></div>
  90. <form style="display: none;" ng-style="{display: showRequestInfo ? &quot;block&quot; : &quot;none&quot;}" ng-submit="addConditionForDomains(domainsForCondition, profileForDomains)" class="request-info-details">
  91. <fieldset>
  92. <legend ng-show="!!currentProfileCanAddRule">{{'popup_addConditionTo' | tr}} <span class="profile-inline"><span omega-profile-inline="currentProfile" options="availableProfiles" disp-name="dispNameFilter"></span></span>
  93. </legend>
  94. <legend ng-show="!currentProfileCanAddRule">{{'popup_requestErrorHeading' | tr}} </legend>
  95. <div class="text-warning">{{'popup_requestErrorWarning' | tr}}</div>
  96. <p class="help-block">{{'popup_requestErrorWarningHelp' | tr}}</p>
  97. <p ng-show="!!currentProfileCanAddRule" class="help-block">{{'popup_requestErrorAddCondition' | tr}} </p>
  98. <div ng-repeat="domain in requestInfo.domains track by domain.domain" class="checkbox">
  99. <label>
  100. <input type="checkbox" ng-model="domainsForCondition[domain.domain]" autofocus ng-if="$index === 0">
  101. <input type="checkbox" ng-model="domainsForCondition[domain.domain]" ng-if="$index &gt; 0"><span class="label label-warning">{{domain.errorCount}}</span> {{domain.domain}}
  102. </label>
  103. </div>
  104. <div ng-show="!!currentProfileCanAddRule" class="form-group">
  105. <label>{{'options_resultProfileForSelectedDomains' | tr}}</label>
  106. <div omega-profile-select="validResultProfiles" ng-model="profileForDomains" disp-name="dispNameFilter" options="availableProfiles"></div>
  107. </div>
  108. <p ng-show="!currentProfileCanAddRule" class="help-block">{{'popup_requestErrorCannotAddCondition' | tr}}</p>
  109. <div class="condition-controls">
  110. <button type="button" ng-click="returnToMenu()" class="btn btn-default">{{'dialog_cancel' | tr}}</button>
  111. <button type="submit" ng-show="!!currentProfileCanAddRule" class="btn btn-primary">{{'popup_addCondition' | tr}}</button>
  112. <button type="button" ng-show="!currentProfileCanAddRule" ng-click="openOptions(&quot;#/general&quot;)" class="btn btn-default pull-right">{{'popup_configureMonitorWebRequests' | tr}}</button>
  113. </div>
  114. </fieldset>
  115. </form>
  116. <script src="js/log_error.js"></script>
  117. <script src="lib/jquery/jquery.min.js"></script>
  118. <script src="lib/angular/angular.min.js"></script>
  119. <script src="lib/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
  120. <script src="lib/angular-ui-utils/validate.min.js"></script>
  121. <script src="js/omega_target_web.js"></script>
  122. <script src="js/omega_decoration.js"></script>
  123. <script src="js/popup.js"></script>
  124. </body>
  125. </html>