summaryrefslogtreecommitdiffabout
path: root/content/flickr.js
Unidiff
Diffstat (limited to 'content/flickr.js') (more/less context) (ignore whitespace changes)
-rw-r--r--content/flickr.js50
1 files changed, 0 insertions, 50 deletions
diff --git a/content/flickr.js b/content/flickr.js
index 3554796..add628a 100644
--- a/content/flickr.js
+++ b/content/flickr.js
@@ -80,74 +80,24 @@ Photo.prototype = {
80 // TODO: dates/@posted dates/@taken dates/@takengranularity dates/@lastupdate 80 // TODO: dates/@posted dates/@taken dates/@takengranularity dates/@lastupdate
81 // TODO: permissions/@permcomment permsiions/@permaddmeta 81 // TODO: permissions/@permcomment permsiions/@permaddmeta
82 // TODO: editability/@canaddcomment editability/@canaddmeta 82 // TODO: editability/@canaddcomment editability/@canaddmeta
83 // TODO: comments 83 // TODO: comments
84 // TODO: notes/note/@id notes/note/@author notes/note/@authorname 84 // TODO: notes/note/@id notes/note/@author notes/note/@authorname
85 // TODO: notes/note/@x notes/note/@y notes/note/@w notes/note/@h 85 // TODO: notes/note/@x notes/note/@y notes/note/@w notes/note/@h
86 // TODO: notes/note 86 // TODO: notes/note
87 // TODO: tags/tag/@id tags/tag/@author tags/tag/@raw tags/tag 87 // TODO: tags/tag/@id tags/tag/@author tags/tag/@raw tags/tag
88 // TODO: urls/url/@type urls/url 88 // TODO: urls/url/@type urls/url
89 } 89 }
90}; 90};
91 91
92function toutf8(ucode) {
93 var rv = '';
94 for(var i=0;i<ucode.length;++i) {
95 var cc = ucode.charCodeAt(i);
96 if(cc<=0x7F)
97 rv += ucode.charAt(i);
98 else if(cc<=0x7ff)
99 rv += String.fromCharCode(
100 0xc0|((cc>> 6)&0x1f),
101 0x80|( cc &0x3f) );
102 else if(cc<=0xffff)
103 rv += String.fromCharCode(
104 0xe0|((cc>>12)&0x0f),
105 0x80|((cc>> 6)&0x3f),
106 0x80|( cc &0x3f) );
107 else if(cc<=0x1fffff)
108 rv += String.fromCharCode(
109 0xf0|((cc>>18)&0x07),
110 0x80|((cc>>12)&0x3f),
111 0x80|((cc>> 6)&0x3f),
112 0x80|( cc &0x3f) );
113 else if(cc<=0x03ffffff)
114 rv += String.fromCharCode(
115 0xf8|((cc>>24)&0x03),
116 0x80|((cc>>18)&0x3f),
117 0x80|((cc>>12)&0x3f),
118 0x80|((cc>> 6)&0x3f),
119 0x80|( cc &0x3f) );
120 else if(cc<=0x7fffffff)
121 rv += String.fromCharCode(
122 0xfc|((cc>>30)&0x01),
123 0x80|((cc>>24)&0x3f),
124 0x80|((cc>>18)&0x3f),
125 0x80|((cc>>12)&0x3f),
126 0x80|((cc>> 6)&0x3f),
127 0x80|( cc &0x3f) );
128 }
129 return rv;
130}
131function xp_str(xp,x) {
132 var rv = x.evaluate(
133 xp, x, null, XPathResult.STRING_TYPE, null );
134 return rv.stringValue;
135}
136function xp_node(xp,x) {
137 var rv = x.evaluate(
138 xp, x, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null );
139 return rv.singleNodeValue;
140}
141
142function Flickr() { } 92function Flickr() { }
143Flickr.prototype = { 93Flickr.prototype = {
144 94
145 rest_url: 'http://www.flickr.com/services/rest/', 95 rest_url: 'http://www.flickr.com/services/rest/',
146 auth_url: 'http://flickr.com/services/auth/', 96 auth_url: 'http://flickr.com/services/auth/',
147 photo_url: 'http://static.flickr.com/', 97 photo_url: 'http://static.flickr.com/',
148 photos_url: 'http://www.flickr.com/photos/', 98 photos_url: 'http://www.flickr.com/photos/',
149 upload_url: 'http://www.flickr.com/services/upload/', 99 upload_url: 'http://www.flickr.com/services/upload/',
150 100
151 api_sig: function(paramstr) { 101 api_sig: function(paramstr) {
152 return MD5(toutf8(this.api_shs+paramstr)); 102 return MD5(toutf8(this.api_shs+paramstr));
153 }, 103 },