mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-01-22 23:08:13 -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]
|
if allReferenceSet[key]
|
||||||
profiles[key].validResultProfiles =
|
profiles[key].validResultProfiles =
|
||||||
OmegaPac.Profiles.validResultProfilesFor(p, @_options)
|
OmegaPac.Profiles.validResultProfilesFor(p, @_options)
|
||||||
|
.map (result) -> result.name
|
||||||
if currentIncludable and OmegaPac.Profiles.isIncludable(p)
|
if currentIncludable and OmegaPac.Profiles.isIncludable(p)
|
||||||
results?.push(p.name)
|
results?.push(p.name)
|
||||||
if profile and OmegaPac.Profiles.isInclusive(profile)
|
if profile and OmegaPac.Profiles.isInclusive(profile)
|
||||||
@ -329,7 +330,7 @@ class Options
|
|||||||
@_state.set({
|
@_state.set({
|
||||||
'currentProfileName': @_currentProfileName
|
'currentProfileName': @_currentProfileName
|
||||||
'isSystemProfile': @_isSystem
|
'isSystemProfile': @_isSystem
|
||||||
'currentProfileCanAddRule': profile.rules?
|
'currentProfileCanAddRule': profile.rules? and not profile.virtualType
|
||||||
})
|
})
|
||||||
@_setAvailableProfiles()
|
@_setAvailableProfiles()
|
||||||
|
|
||||||
|
@ -75,27 +75,37 @@ module.controller 'PopupCtrl', ($scope, $window, $q, omegaTarget,
|
|||||||
proxyNotControllable]) ->
|
proxyNotControllable]) ->
|
||||||
$scope.proxyNotControllable = proxyNotControllable
|
$scope.proxyNotControllable = proxyNotControllable
|
||||||
return if proxyNotControllable
|
return if proxyNotControllable
|
||||||
$scope.builtinProfiles = []
|
|
||||||
$scope.customProfiles = []
|
|
||||||
$scope.availableProfiles = availableProfiles
|
$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.currentProfile = availableProfiles['+' + currentProfileName]
|
||||||
$scope.currentProfileName = currentProfileName
|
$scope.currentProfileName = currentProfileName
|
||||||
$scope.isSystemProfile = isSystemProfile
|
$scope.isSystemProfile = isSystemProfile
|
||||||
$scope.externalProfile = externalProfile
|
$scope.externalProfile = externalProfile
|
||||||
refreshOnProfileChange = refreshOnProfileChange
|
refreshOnProfileChange = refreshOnProfileChange
|
||||||
$scope.validResultProfiles = []
|
|
||||||
for name in validResultProfiles
|
charCodeUnderscore = '_'.charCodeAt(0)
|
||||||
|
profilesByNames = (names) ->
|
||||||
|
profiles = []
|
||||||
|
for name in names
|
||||||
shown = (name.charCodeAt(0) != charCodeUnderscore or
|
shown = (name.charCodeAt(0) != charCodeUnderscore or
|
||||||
name.charCodeAt(1) != charCodeUnderscore)
|
name.charCodeAt(1) != charCodeUnderscore)
|
||||||
if shown
|
if shown
|
||||||
$scope.validResultProfiles.push(availableProfiles['+' + name])
|
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) ->
|
omegaTarget.getActivePageInfo().then((info) ->
|
||||||
if info
|
if info
|
||||||
|
Loading…
Reference in New Issue
Block a user