-rw-r--r-- | content/photoset-props.js | 38 | ||||
-rw-r--r-- | content/photoset-props.xul | 1 |
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 | |||
@@ -5,19 +5,17 @@ var psetprops = { | |||
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; |
@@ -32,5 +30,5 @@ var psetprops = { | |||
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( |
@@ -41,14 +39,14 @@ var psetprops = { | |||
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 | ); |
@@ -56,8 +54,8 @@ var psetprops = { | |||
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, |
@@ -68,8 +66,6 @@ var psetprops = { | |||
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; |
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 | |||
@@ -13,4 +13,5 @@ | |||
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 | ||