summaryrefslogtreecommitdiffabout
path: root/content/photoset-props.js
Unidiff
Diffstat (limited to 'content/photoset-props.js') (more/less context) (ignore whitespace changes)
-rw-r--r--content/photoset-props.js38
1 files changed, 17 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
@@ -1,81 +1,77 @@
1 1
2var psetprops = { 2var psetprops = {
3 fireflix: null, 3 fireflix: null,
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(
25 { 23 {
26 method: 'flickr.photosets.getPhotos', 24 method: 'flickr.photosets.getPhotos',
27 auth_token: 'default', 25 auth_token: 'default',
28 photoset_id: this.photoset.id 26 photoset_id: this.photoset.id
29 }, function(xr) { 27 }, function(xr) {
30 var x = xr.responseXML; 28 var x = xr.responseXML;
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 {
38 id: n.getAttribute('id'), 36 id: n.getAttribute('id'),
39 secret: n.getAttribute('secret'), 37 secret: n.getAttribute('secret'),
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,
65 pic.secret, 63 pic.secret,
66 't' 64 't'
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;
77 this.photoset.dirty = true; 73 this.photoset.dirty = true;
78 return; 74 return;
79 } 75 }
80}; 76};
81 77