mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-01-22 15:08:12 -05:00
Reduce state storage usage for profile.validResultProfiles.
This commit is contained in:
parent
bf82d5a55a
commit
7315d18ed9
@ -297,6 +297,7 @@ class Options
|
||||
if allReferenceSet[key]
|
||||
profiles[key].validResultProfiles =
|
||||
OmegaPac.Profiles.validResultProfilesFor(p, @_options)
|
||||
.map (result) -> result.name
|
||||
if currentIncludable and OmegaPac.Profiles.isIncludable(p)
|
||||
results?.push(p.name)
|
||||
if profile and OmegaPac.Profiles.isInclusive(profile)
|
||||
@ -329,7 +330,7 @@ class Options
|
||||
@_state.set({
|
||||
'currentProfileName': @_currentProfileName
|
||||
'isSystemProfile': @_isSystem
|
||||
'currentProfileCanAddRule': profile.rules?
|
||||
'currentProfileCanAddRule': profile.rules? and not profile.virtualType
|
||||
})
|
||||
@_setAvailableProfiles()
|
||||
|
||||
|
@ -75,27 +75,37 @@ module.controller 'PopupCtrl', ($scope, $window, $q, omegaTarget,
|
||||
proxyNotControllable]) ->
|
||||
$scope.proxyNotControllable = proxyNotControllable
|
||||
return if proxyNotControllable
|
||||
$scope.builtinProfiles = []
|
||||
$scope.customProfiles = []
|
||||
$scope.availableProfiles = availableProfiles
|
||||
charCodeUnderscore = '_'.charCodeAt(0)
|
||||
for own key, profile of availableProfiles
|
||||
if profile.builtin
|
||||
$scope.builtinProfiles.push(profile)
|
||||
else if profile.name.charCodeAt(0) != charCodeUnderscore
|
||||
$scope.customProfiles.push(profile)
|
||||
$scope.customProfiles.sort(profileOrder)
|
||||
$scope.currentProfile = availableProfiles['+' + currentProfileName]
|
||||
$scope.currentProfileName = currentProfileName
|
||||
$scope.isSystemProfile = isSystemProfile
|
||||
$scope.externalProfile = externalProfile
|
||||
refreshOnProfileChange = refreshOnProfileChange
|
||||
$scope.validResultProfiles = []
|
||||
for name in validResultProfiles
|
||||
shown = (name.charCodeAt(0) != charCodeUnderscore or
|
||||
name.charCodeAt(1) != charCodeUnderscore)
|
||||
if shown
|
||||
$scope.validResultProfiles.push(availableProfiles['+' + name])
|
||||
|
||||
charCodeUnderscore = '_'.charCodeAt(0)
|
||||
profilesByNames = (names) ->
|
||||
profiles = []
|
||||
for name in names
|
||||
shown = (name.charCodeAt(0) != charCodeUnderscore or
|
||||
name.charCodeAt(1) != charCodeUnderscore)
|
||||
if shown
|
||||
profiles.push(availableProfiles['+' + name])
|
||||
profiles
|
||||
|
||||
$scope.validResultProfiles = profilesByNames(validResultProfiles)
|
||||
|
||||
$scope.builtinProfiles = []
|
||||
$scope.customProfiles = []
|
||||
for own key, profile of availableProfiles
|
||||
if profile.builtin
|
||||
$scope.builtinProfiles.push(profile)
|
||||
else if profile.name.charCodeAt(0) != charCodeUnderscore
|
||||
$scope.customProfiles.push(profile)
|
||||
if profile.validResultProfiles
|
||||
profile.validResultProfiles =
|
||||
profilesByNames(profile.validResultProfiles)
|
||||
|
||||
$scope.customProfiles.sort(profileOrder)
|
||||
|
||||
omegaTarget.getActivePageInfo().then((info) ->
|
||||
if info
|
||||
|
Loading…
Reference in New Issue
Block a user