No need to keep these in memory.
This commit is contained in:
parent
e0233198dd
commit
f81fafb375
@ -135,20 +135,21 @@ QR =
|
|||||||
status.disabled = disabled or false
|
status.disabled = disabled or false
|
||||||
|
|
||||||
persona:
|
persona:
|
||||||
name: []
|
|
||||||
email: []
|
|
||||||
sub: []
|
|
||||||
pwd: ''
|
pwd: ''
|
||||||
always: {}
|
always: {}
|
||||||
init: ->
|
init: ->
|
||||||
QR.persona.getPassword()
|
QR.persona.getPassword()
|
||||||
$.get 'QR.personas', Conf['QR.personas'], ({'QR.personas': personas}) ->
|
$.get 'QR.personas', Conf['QR.personas'], ({'QR.personas': personas}) ->
|
||||||
|
types =
|
||||||
|
name: []
|
||||||
|
email: []
|
||||||
|
sub: []
|
||||||
for item in personas.split '\n'
|
for item in personas.split '\n'
|
||||||
QR.persona.parseItem item.trim()
|
QR.persona.parseItem item.trim(), types
|
||||||
for type in ['name', 'email', 'sub']
|
for type, arr of types
|
||||||
QR.persona.loadPersonas type
|
QR.persona.loadPersonas type, arr
|
||||||
return
|
return
|
||||||
parseItem: (item) ->
|
parseItem: (item, types) ->
|
||||||
return if item[0] is '#'
|
return if item[0] is '#'
|
||||||
return unless match = item.match /(name|email|subject|password):"(.*)"/i
|
return unless match = item.match /(name|email|subject|password):"(.*)"/i
|
||||||
[match, type, val] = match
|
[match, type, val] = match
|
||||||
@ -169,11 +170,11 @@ QR =
|
|||||||
if /always/i.test item
|
if /always/i.test item
|
||||||
QR.persona.always[type] = val
|
QR.persona.always[type] = val
|
||||||
|
|
||||||
unless val in QR.persona[type]
|
unless val in types[type]
|
||||||
QR.persona[type].push val
|
types[type].push val
|
||||||
loadPersonas: (type) ->
|
loadPersonas: (type, arr) ->
|
||||||
list = $ "#list-#{type}", QR.nodes.el
|
list = $ "#list-#{type}", QR.nodes.el
|
||||||
for val in QR.persona[type]
|
for val in arr
|
||||||
$.add list, $.el 'option',
|
$.add list, $.el 'option',
|
||||||
textContent: val
|
textContent: val
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user