author | Michael Krelin <hacker@klever.net> | 2006-09-29 23:02:49 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2006-09-29 23:02:49 (UTC) |
commit | 74a277c2d7ac5416c3b55565e6d5e8e5a15b389d (patch) (unidiff) | |
tree | 755ac7da52079e87a29b68191e66d7e1d7c0a766 | |
parent | 3cf3cf1000ce6b27ac622c75fc3d114874e2f3a8 (diff) | |
download | fireflix-74a277c2d7ac5416c3b55565e6d5e8e5a15b389d.zip fireflix-74a277c2d7ac5416c3b55565e6d5e8e5a15b389d.tar.gz fireflix-74a277c2d7ac5416c3b55565e6d5e8e5a15b389d.tar.bz2 |
code beauty: mass-assignment of xul elements to member variables
git-svn-id: http://svn.klever.net/kin/fireflix/trunk@169 fe716a7a-6dde-0310-88d9-d003556173a8
-rw-r--r-- | content/fireflix.js | 36 | ||||
-rw-r--r-- | content/util.js | 9 |
2 files changed, 23 insertions, 22 deletions
diff --git a/content/fireflix.js b/content/fireflix.js index daf4929..98b6d41 100644 --- a/content/fireflix.js +++ b/content/fireflix.js | |||
@@ -12,16 +12,12 @@ function splitascii(s) { | |||
12 | var fireflix = { | 12 | var fireflix = { |
13 | flickr: new Flickr(), | 13 | flickr: new Flickr(), |
14 | init: function() { | 14 | init: function() { |
15 | this.cmd_auth_auth = document.getElementById('cmd_auth_auth'); | 15 | pull_elements(this,document,[ |
16 | this.cmd_auth_done = document.getElementById('cmd_auth_done'); | 16 | 'cmd_auth_auth','cmd_auth_done','cmd_auth_unauth', |
17 | this.cmd_auth_unauth = document.getElementById('cmd_auth_unauth'); | 17 | 'menu_auth_done','b_auth','b_auth_done','auth_info', |
18 | this.menu_auth_done = document.getElementById('menu_auth_done'); | 18 | 'loc_strings','cmd_set_props' |
19 | this.b_auth = document.getElementById('b_auth'); | 19 | ]); |
20 | this.b_auth_done = document.getElementById('b_auth_done'); | ||
21 | this.auth_info = document.getElementById('auth_info'); | ||
22 | this.loc_strings = document.getElementById('loc_strings'); | ||
23 | this.build_menus(); | 20 | this.build_menus(); |
24 | this.cmd_set_props = document.getElementById('cmd_set_props'); | ||
25 | this.foundphotos.init(this); | 21 | this.foundphotos.init(this); |
26 | this.photosets.init(this); | 22 | this.photosets.init(this); |
27 | this.photoset.init(this); | 23 | this.photoset.init(this); |
@@ -312,12 +308,10 @@ var fireflix = { | |||
312 | fireflix: null, | 308 | fireflix: null, |
313 | init: function(f) { | 309 | init: function(f) { |
314 | this.fireflix=f; | 310 | this.fireflix=f; |
315 | this.upload_filename = document.getElementById('upload_filename'); | 311 | pull_elements(this,document,[ |
316 | this.upload_title = document.getElementById('upload_title'); | 312 | 'upload_filename','upload_title','upload_file_preview', |
317 | this.upload_file_preview = document.getElementById('upload_file_preview'); | 313 | 'upload_file_props','upload_progress','upload_tags' |
318 | this.upload_file_props = document.getElementById('upload_file_props'); | 314 | ]); |
319 | this.upload_progress = document.getElementById('upload_progress'); | ||
320 | this.upload_tags = document.getElementById('upload_tags'); | ||
321 | }, | 315 | }, |
322 | files: new Array(), | 316 | files: new Array(), |
323 | rowCount: 0, | 317 | rowCount: 0, |
@@ -691,14 +685,12 @@ var fireflix = { | |||
691 | fireflix: null, | 685 | fireflix: null, |
692 | init: function(f) { | 686 | init: function(f) { |
693 | this.fireflix = f; | 687 | this.fireflix = f; |
694 | this.search_for = document.getElementById('search_for'); | 688 | pull_elements(this,document,[ |
695 | this.search_tags= document.getElementById('search_tags'); | 689 | 'search_for','search_tags','search_mine', |
696 | this.search_mine = document.getElementById('search_mine'); | 690 | 'searchresult_props','search_photo', |
691 | 'searchresult_title','searchresult_description' | ||
692 | ]); | ||
697 | document.getElementById('searchresults').view = this; | 693 | document.getElementById('searchresults').view = this; |
698 | this.searchresult_props = document.getElementById('searchresult_props'); | ||
699 | this.search_photo = document.getElementById('search_photo'); | ||
700 | this.searchresult_title = document.getElementById('searchresult_title'); | ||
701 | this.searchresult_description = document.getElementById('searchresult_description'); | ||
702 | }, | 694 | }, |
703 | photos: new Array(), | 695 | photos: new Array(), |
704 | rowCount: 0, | 696 | rowCount: 0, |
diff --git a/content/util.js b/content/util.js index 5af0978..c4af09e 100644 --- a/content/util.js +++ b/content/util.js | |||
@@ -59,3 +59,12 @@ function xp_node(xp,x) { | |||
59 | return rv.singleNodeValue; | 59 | return rv.singleNodeValue; |
60 | } | 60 | } |
61 | 61 | ||
62 | /* | ||
63 | * pull in elements into documents as a member variables | ||
64 | */ | ||
65 | function pull_elements(th,d,els) { | ||
66 | for(var e in els) { | ||
67 | var en=els[e]; | ||
68 | th[en] = d.getElementById(en); | ||
69 | } | ||
70 | } | ||