summaryrefslogtreecommitdiffabout
path: root/content
authorMichael Krelin <hacker@klever.net>2006-09-29 23:02:49 (UTC)
committer Michael Krelin <hacker@klever.net>2006-09-29 23:02:49 (UTC)
commit74a277c2d7ac5416c3b55565e6d5e8e5a15b389d (patch) (unidiff)
tree755ac7da52079e87a29b68191e66d7e1d7c0a766 /content
parent3cf3cf1000ce6b27ac622c75fc3d114874e2f3a8 (diff)
downloadfireflix-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
Diffstat (limited to 'content') (more/less context) (ignore whitespace changes)
-rw-r--r--content/fireflix.js36
-rw-r--r--content/util.js9
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
@@ -9,22 +9,18 @@ function splitascii(s) {
9} 9}
10 10
11 11
12var fireflix = { 12var 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);
28 this.uploads.init(this); 24 this.uploads.init(this);
29 this.uploadObserver.init(this); 25 this.uploadObserver.init(this);
30 this.flickr.api_key = '9c43cd66947a57e6f29db1a9da3f72e3'; 26 this.flickr.api_key = '9c43cd66947a57e6f29db1a9da3f72e3';
@@ -309,18 +305,16 @@ var fireflix = {
309 }, 305 },
310 306
311 uploads: { 307 uploads: {
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,
324 getCellText: function(r,c) { 318 getCellText: function(r,c) {
325 var f = this.files[r]; 319 var f = this.files[r];
326 if(c.id=='up_file') return f.file; 320 if(c.id=='up_file') return f.file;
@@ -688,20 +682,18 @@ var fireflix = {
688 * 682 *
689 */ 683 */
690 foundphotos: { 684 foundphotos: {
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,
705 getCellText: function(r,c) { 697 getCellText: function(r,c) {
706 var p = this.photos[r]; 698 var p = this.photos[r];
707 if(c.id=='sr_title') return p.title; 699 if(c.id=='sr_title') return p.title;
diff --git a/content/util.js b/content/util.js
index 5af0978..c4af09e 100644
--- a/content/util.js
+++ b/content/util.js
@@ -56,6 +56,15 @@ function xp_str(xp,x) {
56function xp_node(xp,x) { 56function xp_node(xp,x) {
57 var rv = x.evaluate( 57 var rv = x.evaluate(
58 xp, x, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ); 58 xp, x, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null );
59 return rv.singleNodeValue; 59 return rv.singleNodeValue;
60} 60}
61 61
62/*
63 * pull in elements into documents as a member variables
64 */
65function pull_elements(th,d,els) {
66 for(var e in els) {
67 var en=els[e];
68 th[en] = d.getElementById(en);
69 }
70}