summaryrefslogtreecommitdiffabout
path: root/content
authorMichael Krelin <hacker@klever.net>2006-09-30 18:27:38 (UTC)
committer Michael Krelin <hacker@klever.net>2006-09-30 18:27:38 (UTC)
commit01fbc99cb713a0c4656f33949b2949bf7403656b (patch) (unidiff)
tree2ee9c07db4c6c7c329f97e56615672ca2fc3e462 /content
parent4f5e775ff24baf34b3425e93bfeac4a436b4b525 (diff)
downloadfireflix-01fbc99cb713a0c4656f33949b2949bf7403656b.zip
fireflix-01fbc99cb713a0c4656f33949b2949bf7403656b.tar.gz
fireflix-01fbc99cb713a0c4656f33949b2949bf7403656b.tar.bz2
more code beauty/performance enhancements
git-svn-id: http://svn.klever.net/kin/fireflix/trunk@171 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (limited to 'content') (more/less context) (ignore whitespace changes)
-rw-r--r--content/photoset-props.js38
-rw-r--r--content/photoset-props.xul1
2 files changed, 18 insertions, 21 deletions
diff --git a/content/photoset-props.js b/content/photoset-props.js
index 43dc1b9..7c816be 100644
--- a/content/photoset-props.js
+++ b/content/photoset-props.js
@@ -4,21 +4,19 @@ var psetprops = {
4 photoset: null, 4 photoset: null,
5 pripic: null, 5 pripic: null,
6 6
7 settitle: null, setdesc: null,
8 primarypic: null,
9 photos: new Array(), 7 photos: new Array(),
10 init: function() { 8 init: function() {
11 this.fireflix = window.arguments[0]; 9 this.fireflix = window.arguments[0];
12 this.photoset = window.arguments[1]; 10 this.photoset = window.arguments[1];
13 this.settitle = document.getElementById('set_title'); 11 pull_elements(this,document,[
14 this.settitle.value = this.photoset.title; 12 'set_title','set_desc','primary_picture',
15 this.setdesc = document.getElementById('set_desc'); 13 'primary_picture_list'
16 this.setdesc.value = this.photoset.description; 14 ]);
17 this.primarypic = document.getElementById('primary_picture'); 15 this.set_title.value = this.photoset.title;
18 this.primarypic.src = 16 this.set_desc.value = this.photoset.description;
17 this.primary_picture.src =
19 this.fireflix.flickr.get_image_url( this.photoset, 't' ); 18 this.fireflix.flickr.get_image_url( this.photoset, 't' );
20 this.primarypic.hidden = false; 19 this.primary_picture.hidden = false;
21 this.picslist = document.getElementById('primary_picture_list');
22 20
23 var _this = this; 21 var _this = this;
24 this.fireflix.flickr.api_call( 22 this.fireflix.flickr.api_call(
@@ -31,7 +29,7 @@ var psetprops = {
31 var xp = x.evaluate( 29 var xp = x.evaluate(
32 '/rsp/photoset/photo', x, null, 30 '/rsp/photoset/photo', x, null,
33 XPathResult.ORDERED_NODE_ITERATOR_TYPE, null ); 31 XPathResult.ORDERED_NODE_ITERATOR_TYPE, null );
34 _this.picslist.removeAllItems(); _this.photos= new Array(); 32 _this.primary_picture_list.removeAllItems(); _this.photos= new Array();
35 var n; while(n=xp.iterateNext()) { 33 var n; while(n=xp.iterateNext()) {
36 _this.photos.push( 34 _this.photos.push(
37 { 35 {
@@ -40,25 +38,25 @@ var psetprops = {
40 server: n.getAttribute('server') 38 server: n.getAttribute('server')
41 } 39 }
42 ); 40 );
43 var ni = _this.picslist.appendItem( 41 var ni = _this.primary_picture_list.appendItem(
44 n.getAttribute('title'), _this.photos.length-1 42 n.getAttribute('title'), _this.photos.length-1
45 ); 43 );
46 ni.setAttribute('command','cmd_select_picture'); 44 ni.setAttribute('command','cmd_select_picture');
47 if(n.getAttribute('isprimary')==1) { 45 if(n.getAttribute('isprimary')==1) {
48 _this.picslist.selectedItem = ni; 46 _this.primary_picture_list.selectedItem = ni;
49 _this.pripic = _this.photos[_this.photos.length-1]; 47 _this.pripic = _this.photos[_this.photos.length-1];
50 } 48 }
51 } 49 }
52 _this.picslist.hidden = false; 50 _this.primary_picture_list.hidden = false;
53 }, function() { } 51 }, function() { }
54 ); 52 );
55 }, 53 },
56 on_select_picture: function(ev) { 54 on_select_picture: function(ev) {
57 var epic = ev.explicitOriginalTarget; 55 var epic = ev.explicitOriginalTarget;
58 this.picslist.selectedItem = epic; 56 this.primary_picture_list.selectedItem = epic;
59 var pic = this.photos[this.picslist.selectedItem.value]; 57 var pic = this.photos[this.primary_picture_list.selectedItem.value];
60 this.pripic = pic; 58 this.pripic = pic;
61 this.primarypic.src = 59 this.primary_picture.src =
62 this.fireflix.flickr.get_photo_url( 60 this.fireflix.flickr.get_photo_url(
63 pic.server, 61 pic.server,
64 pic.id, 62 pic.id,
@@ -67,10 +65,8 @@ var psetprops = {
67 ); 65 );
68 }, 66 },
69 on_accept: function() { 67 on_accept: function() {
70 this.photoset.title = 68 this.photoset.title = this.set_title.value;
71 document.getElementById('set_title').value; 69 this.photoset.description = this.set_desc.value;
72 this.photoset.description =
73 document.getElementById('set_desc').value;
74 this.photoset.server = this.pripic.server; 70 this.photoset.server = this.pripic.server;
75 this.photoset.primary = this.pripic.id; 71 this.photoset.primary = this.pripic.id;
76 this.photoset.secret = this.pripic.secret; 72 this.photoset.secret = this.pripic.secret;
diff --git a/content/photoset-props.xul b/content/photoset-props.xul
index e8f6d13..2efa9e6 100644
--- a/content/photoset-props.xul
+++ b/content/photoset-props.xul
@@ -12,6 +12,7 @@
12 ondialogaccept="psetprops.on_accept()" 12 ondialogaccept="psetprops.on_accept()"
13 > 13 >
14 14
15 <script src="util.js" type="application/x-javascript"/>
15 <script src="photoset-props.js" type="application/x-javascript"/> 16 <script src="photoset-props.js" type="application/x-javascript"/>
16 17
17 <commandset> 18 <commandset>