orange-flickr 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +27 -0
- data/Rakefile +46 -0
- data/lib/orange-flickr.rb +4 -0
- data/lib/orange-flickr/assets/js/yoxview/data/flickr.js +270 -0
- data/lib/orange-flickr/assets/js/yoxview/data/flickr.min.js +19 -0
- data/lib/orange-flickr/assets/js/yoxview/images/empty.gif +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/help_panel.png +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/left.png +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/left_eng.png +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/left_prev.png +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/popup_ajax_loader.gif +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/right.png +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/right_eng.png +0 -0
- data/lib/orange-flickr/assets/js/yoxview/images/sprites.png +0 -0
- data/lib/orange-flickr/assets/js/yoxview/install.htm +116 -0
- data/lib/orange-flickr/assets/js/yoxview/jquery.jsonp-1.0.4.min.js +12 -0
- data/lib/orange-flickr/assets/js/yoxview/jquery.timers-1.2.min.js +11 -0
- data/lib/orange-flickr/assets/js/yoxview/jquery.yoxthumbs.js +207 -0
- data/lib/orange-flickr/assets/js/yoxview/jquery.yoxthumbs.min.js +11 -0
- data/lib/orange-flickr/assets/js/yoxview/jquery.yoxview-1.98.js +1673 -0
- data/lib/orange-flickr/assets/js/yoxview/jquery.yoxview-1.98.min.js +38 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ar.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/bg.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ca.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/cs.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/de.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/en.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/es.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/fr.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/gr.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/he.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ie.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ir.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/it.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ja.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/mk.js +20 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/nl.js +3 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/pl.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/pt-br.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/pt.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ro.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ru.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/sk.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/sl.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/sv.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/tr.js +22 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/ua.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/zh-cn.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/lang/zh-tw.js +21 -0
- data/lib/orange-flickr/assets/js/yoxview/yox.js +179 -0
- data/lib/orange-flickr/assets/js/yoxview/yox.min.js +1 -0
- data/lib/orange-flickr/assets/js/yoxview/yoxview-init.js +47 -0
- data/lib/orange-flickr/assets/js/yoxview/yoxview-nojquery.js +5 -0
- data/lib/orange-flickr/assets/js/yoxview/yoxview.css +218 -0
- data/lib/orange-flickr/plugin.rb +14 -0
- data/lib/orange-flickr/resources/flickr_resource.rb +31 -0
- data/lib/orange-flickr/views/flickr/gallery.haml +4 -0
- data/lib/orange-flickr/views/flickr/photoset.haml +5 -0
- data/spec/orange-flickr_spec.rb +7 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- metadata +164 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 David Haslem
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
= orange-flickr
|
2
|
+
|
3
|
+
Includes snippets for pulling in Flickr photo galleries given an authentication token. You'll need a some info to use it:
|
4
|
+
|
5
|
+
First, I recommend you go register to create a new Flickr app here so you can have your own API key with your own limits. Orange has a flickr api key by default, but it's really easy to get your own:
|
6
|
+
|
7
|
+
http://www.flickr.com/services/apps/create/apply
|
8
|
+
|
9
|
+
Set the "flickr_api_key" option with your new api key. Then get the user nsid for the photosets you want to use. Set the "flickr_nsid" option to that.
|
10
|
+
|
11
|
+
Flickr Photosets are pulled in using yoxview, which is an MIT-licensed jQuery slideshow plugin. Learn more here:
|
12
|
+
|
13
|
+
http://www.yoxigen.com/yoxview/
|
14
|
+
|
15
|
+
== Note on Patches/Pull Requests
|
16
|
+
|
17
|
+
* Fork the project.
|
18
|
+
* Make your feature addition or bug fix.
|
19
|
+
* Add tests for it. This is important so I don't break it in a
|
20
|
+
future version unintentionally.
|
21
|
+
* Commit, do not mess with rakefile, version, or history.
|
22
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
23
|
+
* Send me a pull request. Bonus points for topic branches.
|
24
|
+
|
25
|
+
== Copyright
|
26
|
+
|
27
|
+
Copyright (c) 2010 David Haslem. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "orange-flickr"
|
8
|
+
gem.summary = %Q{A gem that uses FlickRaw to integrate with orange}
|
9
|
+
gem.description = %Q{Adds flickr functionality to Orange}
|
10
|
+
gem.email = "therabidbanana@gmail.com"
|
11
|
+
gem.homepage = "http://orangerb.com"
|
12
|
+
gem.authors = ["David Haslem"]
|
13
|
+
gem.add_dependency "flickraw-cached", ">= 0"
|
14
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
15
|
+
gem.add_development_dependency "yard", ">= 0"
|
16
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
|
+
end
|
18
|
+
Jeweler::GemcutterTasks.new
|
19
|
+
rescue LoadError
|
20
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
|
+
end
|
22
|
+
|
23
|
+
require 'spec/rake/spectask'
|
24
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
25
|
+
spec.libs << 'lib' << 'spec'
|
26
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
27
|
+
end
|
28
|
+
|
29
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
30
|
+
spec.libs << 'lib' << 'spec'
|
31
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
32
|
+
spec.rcov = true
|
33
|
+
end
|
34
|
+
|
35
|
+
task :spec => :check_dependencies
|
36
|
+
|
37
|
+
task :default => :spec
|
38
|
+
|
39
|
+
begin
|
40
|
+
require 'yard'
|
41
|
+
YARD::Rake::YardocTask.new
|
42
|
+
rescue LoadError
|
43
|
+
task :yardoc do
|
44
|
+
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,270 @@
|
|
1
|
+
/*!
|
2
|
+
* Yox Flickr plugin
|
3
|
+
* http://yoxigen.com/yoxview/
|
4
|
+
*
|
5
|
+
* Copyright (c) 2010 Yossi Kolesnicov
|
6
|
+
*
|
7
|
+
* Licensed under the MIT license.
|
8
|
+
* http://www.opensource.org/licenses/mit-license.php
|
9
|
+
*
|
10
|
+
* Date: 17th July, 2010
|
11
|
+
* Version : 1.6
|
12
|
+
*/
|
13
|
+
function yox_flickr()
|
14
|
+
{
|
15
|
+
var $ = jQuery;
|
16
|
+
var flickrUrl = "http://www.flickr.com/";
|
17
|
+
var flickrApiUrl = "http://api.flickr.com/services/rest/";
|
18
|
+
var yoxviewFlickrApikey = "d25ed6ad71472b633b11544a21da4f36";
|
19
|
+
var flickrUserIdRegex = /\d+@N\d+/;
|
20
|
+
var flickrUrlRegex = /http:\/\/(?:www\.)?flickr\.com\/(\w+)\/(?:([^\/]+)\/(?:(\w+)\/?(?:([^\/]+)\/?)?)?)?(?:\?(.*))?/;
|
21
|
+
var self = this;
|
22
|
+
|
23
|
+
var fixedOptions = {
|
24
|
+
api_key: yoxviewFlickrApikey,
|
25
|
+
format: 'json'
|
26
|
+
};
|
27
|
+
|
28
|
+
this.getImagesData = function(options, callback)
|
29
|
+
{
|
30
|
+
var defaults = {
|
31
|
+
imageSize: "medium", // medium/large/original, for large, your images in Flickr must be 1280 in width or more. For original, you must allow originals to be downloaded
|
32
|
+
thumbsize: "smallSquare",
|
33
|
+
setThumbnail: true,
|
34
|
+
setSinglePhotosetThumbnails: true,
|
35
|
+
setTitle: true,
|
36
|
+
method: 'flickr.photosets.getList',
|
37
|
+
extras: 'description'
|
38
|
+
};
|
39
|
+
|
40
|
+
var requireLookup = true;
|
41
|
+
var lookupData = {
|
42
|
+
method: "flickr.urls.lookupUser",
|
43
|
+
onData: function(data)
|
44
|
+
{
|
45
|
+
return {
|
46
|
+
user_id: data.user.id,
|
47
|
+
username: data.user.username._content
|
48
|
+
};
|
49
|
+
}
|
50
|
+
};
|
51
|
+
|
52
|
+
var fromDataUrl = {};
|
53
|
+
|
54
|
+
if (options.dataUrl)
|
55
|
+
{
|
56
|
+
var urlMatch = options.dataUrl.match(flickrUrlRegex);
|
57
|
+
var queryData;
|
58
|
+
if (urlMatch[5])
|
59
|
+
{
|
60
|
+
queryData = Yox.queryToJson(urlMatch[5]);
|
61
|
+
$.extend(fromDataUrl, queryData);
|
62
|
+
}
|
63
|
+
if (urlMatch && urlMatch.length > 1)
|
64
|
+
{
|
65
|
+
if (urlMatch[1] == "search")
|
66
|
+
{
|
67
|
+
fromDataUrl.method = "flickr.photos.search";
|
68
|
+
fromDataUrl.text = queryData.q;
|
69
|
+
if (queryData.w)
|
70
|
+
{
|
71
|
+
queryData.w = queryData.w.replace("%40", "@");
|
72
|
+
if (queryData.w.match(flickrUserIdRegex))
|
73
|
+
fromDataUrl.user_id = queryData.w;
|
74
|
+
}
|
75
|
+
if (!queryData || !queryData.sort)
|
76
|
+
fromDataUrl.sort = "relevance";
|
77
|
+
|
78
|
+
requireLookup = false;
|
79
|
+
}
|
80
|
+
else
|
81
|
+
{
|
82
|
+
switch(urlMatch[3])
|
83
|
+
{
|
84
|
+
case undefined:
|
85
|
+
fromDataUrl.method = "flickr.people.getPublicPhotos";
|
86
|
+
break;
|
87
|
+
case "sets":
|
88
|
+
$.extend(fromDataUrl, {
|
89
|
+
method: urlMatch[4] || (options.dataSourceOptions && options.dataSourceOptions.photoset_id) ? "flickr.photosets.getPhotos" : "flickr.photosets.getList",
|
90
|
+
photoset_id: urlMatch[4]
|
91
|
+
});
|
92
|
+
break;
|
93
|
+
case "galleries":
|
94
|
+
$.extend(fromDataUrl, {
|
95
|
+
method: urlMatch[4] ? "flickr.galleries.getPhotos" : "flickr.galleries.getList",
|
96
|
+
gallery_id: urlMatch[4]
|
97
|
+
});
|
98
|
+
if (urlMatch[4])
|
99
|
+
{
|
100
|
+
requireLookup = true;
|
101
|
+
lookupData = {
|
102
|
+
method: "flickr.urls.lookupGallery",
|
103
|
+
onData: function(data)
|
104
|
+
{
|
105
|
+
return {
|
106
|
+
gallery_id: data.gallery.id,
|
107
|
+
title: data.gallery.title
|
108
|
+
};
|
109
|
+
}
|
110
|
+
};
|
111
|
+
}
|
112
|
+
break;
|
113
|
+
case "collections":
|
114
|
+
$.extend(fromDataUrl, {
|
115
|
+
method: "flickr.collections.getTree",
|
116
|
+
collection_id: urlMatch[4]
|
117
|
+
});
|
118
|
+
break;
|
119
|
+
default:
|
120
|
+
fromDataUrl.method = "flickr.photos.search";
|
121
|
+
break;
|
122
|
+
}
|
123
|
+
$.extend(fromDataUrl, {
|
124
|
+
username: urlMatch[2],
|
125
|
+
type: urlMatch[3]
|
126
|
+
});
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
var datasourceOptions = jQuery.extend({}, defaults, fromDataUrl, options.dataSourceOptions, fixedOptions);
|
132
|
+
|
133
|
+
datasourceOptions.media = "photos";
|
134
|
+
if (datasourceOptions.user && datasourceOptions.photoset_id)
|
135
|
+
datasourceOptions.method = "flickr.photosets.getPhotos";
|
136
|
+
|
137
|
+
var screenSize = screen.width > screen.height ? screen.width : screen.height;
|
138
|
+
|
139
|
+
// Save resources for smaller screens:
|
140
|
+
if (!datasourceOptions.imageSize || (screenSize.width <= 800 && datasourceOptions.imageSize != "medium"))
|
141
|
+
datasourceOptions.imageSize = "medium";
|
142
|
+
|
143
|
+
if (requireLookup)
|
144
|
+
{
|
145
|
+
$.jsonp({
|
146
|
+
url: flickrApiUrl,
|
147
|
+
async: false,
|
148
|
+
dataType: 'jsonp',
|
149
|
+
data: $.extend({ url: options.dataUrl, method: lookupData.method }, fixedOptions),
|
150
|
+
callbackParameter: "jsoncallback",
|
151
|
+
success: function(data)
|
152
|
+
{
|
153
|
+
$.extend(datasourceOptions, lookupData.onData(data));
|
154
|
+
getData();
|
155
|
+
}
|
156
|
+
});
|
157
|
+
}
|
158
|
+
else
|
159
|
+
getData();
|
160
|
+
|
161
|
+
function getData()
|
162
|
+
{
|
163
|
+
var returnData = {};
|
164
|
+
|
165
|
+
if (options.onLoadBegin)
|
166
|
+
options.onLoadBegin();
|
167
|
+
|
168
|
+
$.jsonp({
|
169
|
+
url: flickrApiUrl,
|
170
|
+
async: false,
|
171
|
+
dataType: 'jsonp',
|
172
|
+
data: datasourceOptions,
|
173
|
+
callbackParameter: "jsoncallback",
|
174
|
+
success: function(data)
|
175
|
+
{
|
176
|
+
returnData.images = self.getImagesDataFromJson(data, datasourceOptions);
|
177
|
+
|
178
|
+
if (data.photosets || data.collections)
|
179
|
+
$.extend(returnData, {
|
180
|
+
createGroups: true
|
181
|
+
});
|
182
|
+
|
183
|
+
if (returnData.images.length > 0 && ((datasourceOptions.setThumbnail && !datasourceOptions.setSinglePhotosetThumbnails) || options.isSingleLink))
|
184
|
+
{
|
185
|
+
$.extend(returnData, {
|
186
|
+
isGroup: true,
|
187
|
+
link: getPhotosetUrl(data.photoset.owner, data.photoset.id),
|
188
|
+
thumbnailSrc: options.isSingleLink ? undefined : getImageUrl(data.photoset.photo[0], flickrImageSizes[datasourceOptions.thumbsize]),
|
189
|
+
title: "None"
|
190
|
+
});
|
191
|
+
}
|
192
|
+
|
193
|
+
if (callback)
|
194
|
+
callback(returnData);
|
195
|
+
|
196
|
+
if (options.onLoadComplete)
|
197
|
+
options.onLoadComplete();
|
198
|
+
},
|
199
|
+
error : function(xOptions, textStatus){
|
200
|
+
if (options.onLoadError)
|
201
|
+
options.onLoadError("Flickr plugin encountered an error while retrieving data");
|
202
|
+
}
|
203
|
+
});
|
204
|
+
}
|
205
|
+
}
|
206
|
+
|
207
|
+
|
208
|
+
var flickrImageSizes = {
|
209
|
+
smallSquare : "_s", // 75x75
|
210
|
+
thumbnail : "_t", // 100px
|
211
|
+
small : "_m", // 240px
|
212
|
+
medium : "", // 500px
|
213
|
+
large : "_b", // 1024px
|
214
|
+
original : "_o"
|
215
|
+
};
|
216
|
+
function getImageUrl(photoData, size)
|
217
|
+
{
|
218
|
+
return "http://farm" + photoData.farm + ".static.flickr.com/" + photoData.server + "/" + (photoData.primary || photoData.id) + "_" + photoData.secret + size + ".jpg";
|
219
|
+
}
|
220
|
+
function getPhotosetUrl(userid, photosetId)
|
221
|
+
{
|
222
|
+
return prepareUrl(flickrUrl + "photos/" + userid + "/sets/" + photosetId + "/");
|
223
|
+
}
|
224
|
+
// makes sure a string can be used as a Flickr url
|
225
|
+
function prepareUrl(url)
|
226
|
+
{
|
227
|
+
return url.replace(/\s/g, "_");
|
228
|
+
}
|
229
|
+
this.getImagesDataFromJson = function(data, datasourceOptions)
|
230
|
+
{
|
231
|
+
var isPhotos = data.photoset || data.photos;
|
232
|
+
var photos;
|
233
|
+
if (isPhotos)
|
234
|
+
photos = data.photoset ? data.photoset.photo : data.photos.photo;
|
235
|
+
else if (data.photosets)
|
236
|
+
photos = data.photosets.photoset;
|
237
|
+
else if (data.collections)
|
238
|
+
photos = data.collections.collection[0].set;
|
239
|
+
|
240
|
+
var imagesData = [];
|
241
|
+
var inSet = data.photoset ? "/in/set-" + data.photoset.id : "";
|
242
|
+
|
243
|
+
// Photos:
|
244
|
+
if (photos)
|
245
|
+
{
|
246
|
+
var thumbSuffix = flickrImageSizes[datasourceOptions.thumbsize];
|
247
|
+
var imageSuffix = flickrImageSizes[datasourceOptions.imageSize];
|
248
|
+
|
249
|
+
jQuery.each(photos, function(i, photo){
|
250
|
+
var imageData = {
|
251
|
+
thumbnailSrc : getImageUrl(photo, thumbSuffix),
|
252
|
+
link: prepareUrl(flickrUrl + "photos/" + (photo.owner || datasourceOptions.user_id) + "/" + photo.id + inSet),
|
253
|
+
media: {
|
254
|
+
src: getImageUrl(photo, imageSuffix),
|
255
|
+
title: isPhotos ? photo.title : photo.title._content + (!isPhotos ? " (" + photo.photos + " images)" : ""),
|
256
|
+
alt: photo.title._content || photo.title,
|
257
|
+
description: photo.description ? photo.description._content : undefined
|
258
|
+
}
|
259
|
+
};
|
260
|
+
|
261
|
+
if (!isPhotos)
|
262
|
+
imageData.data = { photoset_id: photo.id };
|
263
|
+
|
264
|
+
imagesData.push(imageData);
|
265
|
+
});
|
266
|
+
}
|
267
|
+
|
268
|
+
return imagesData;
|
269
|
+
}
|
270
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/*!
|
2
|
+
* Yox Flickr plugin
|
3
|
+
* http://yoxigen.com/yoxview/
|
4
|
+
*
|
5
|
+
* Copyright (c) 2010 Yossi Kolesnicov
|
6
|
+
*
|
7
|
+
* Licensed under the MIT license.
|
8
|
+
* http://www.opensource.org/licenses/mit-license.php
|
9
|
+
*
|
10
|
+
* Date: 17th July, 2010
|
11
|
+
* Version : 1.6
|
12
|
+
*/
|
13
|
+
function yox_flickr(){function m(a,j){return"http://farm"+a.farm+".static.flickr.com/"+a.server+"/"+(a.primary||a.id)+"_"+a.secret+j+".jpg"}var g=jQuery,o="http://www.flickr.com/",p="http://api.flickr.com/services/rest/",r=/\d+@N\d+/,s=/http:\/\/(?:www\.)?flickr\.com\/(\w+)\/(?:([^\/]+)\/(?:(\w+)\/?(?:([^\/]+)\/?)?)?)?(?:\?(.*))?/,t=this,q={api_key:"cd6c91f9721f34ead20e6ebe03dd5871",format:"json"};this.getImagesData=function(a,j){function k(){var b={};a.onLoadBegin&&a.onLoadBegin();g.jsonp({url:p,
|
14
|
+
async:false,dataType:"jsonp",data:e,callbackParameter:"jsoncallback",success:function(h){b.images=t.getImagesDataFromJson(h,e);if(h.photosets||h.collections)g.extend(b,{createGroups:true});if(b.images.length>0&&(e.setThumbnail&&!e.setSinglePhotosetThumbnails||a.isSingleLink))g.extend(b,{isGroup:true,link:(o+"photos/"+h.photoset.owner+"/sets/"+h.photoset.id+"/").replace(/\s/g,"_"),thumbnailSrc:a.isSingleLink?undefined:m(h.photoset.photo[0],n[e.thumbsize]),title:"None"});j&&j(b);a.onLoadComplete&&a.onLoadComplete()},
|
15
|
+
error:function(){a.onLoadError&&a.onLoadError("Flickr plugin encountered an error while retrieving data")}})}var i=true,l={method:"flickr.urls.lookupUser",onData:function(b){return{user_id:b.user.id,username:b.user.username._content}}},c={};if(a.dataUrl){var d=a.dataUrl.match(s),f;if(d[5]){f=Yox.queryToJson(d[5]);g.extend(c,f)}if(d&&d.length>1)if(d[1]=="search"){c.method="flickr.photos.search";c.text=f.q;if(f.w){f.w=f.w.replace("%40","@");if(f.w.match(r))c.user_id=f.w}if(!f||!f.sort)c.sort="relevance";
|
16
|
+
i=false}else{switch(d[3]){case undefined:c.method="flickr.people.getPublicPhotos";break;case "sets":g.extend(c,{method:d[4]||a.dataSourceOptions.photoset_id?"flickr.photosets.getPhotos":"flickr.photosets.getList",photoset_id:d[4]});break;case "galleries":g.extend(c,{method:d[4]?"flickr.galleries.getPhotos":"flickr.galleries.getList",gallery_id:d[4]});if(d[4]){i=true;l={method:"flickr.urls.lookupGallery",onData:function(b){return{gallery_id:b.gallery.id,title:b.gallery.title}}}}break;case "collections":g.extend(c,
|
17
|
+
{method:"flickr.collections.getTree",collection_id:d[4]});break;default:c.method="flickr.photos.search";break}g.extend(c,{username:d[2],type:d[3]})}}var e=jQuery.extend({},{imageSize:"medium",thumbsize:"smallSquare",setThumbnail:true,setSinglePhotosetThumbnails:true,setTitle:true,method:"flickr.photosets.getList",extras:"description"},c,a.dataSourceOptions,q);e.media="photos";if(e.user&&e.photoset_id)e.method="flickr.photosets.getPhotos";c=screen.width>screen.height?screen.width:screen.height;if(!e.imageSize||
|
18
|
+
c.width<=800&&e.imageSize!="medium")e.imageSize="medium";i?g.jsonp({url:p,async:false,dataType:"jsonp",data:g.extend({url:a.dataUrl,method:l.method},q),callbackParameter:"jsoncallback",success:function(b){g.extend(e,l.onData(b));k()}}):k()};var n={smallSquare:"_s",thumbnail:"_t",small:"_m",medium:"",large:"_b",original:"_o"};this.getImagesDataFromJson=function(a,j){var k=a.photoset||a.photos,i;if(k)i=a.photoset?a.photoset.photo:a.photos.photo;else if(a.photosets)i=a.photosets.photoset;else if(a.collections)i=
|
19
|
+
a.collections.collection[0].set;var l=[],c=a.photoset?"/in/set-"+a.photoset.id:"";if(i){var d=n[j.thumbsize],f=n[j.imageSize];jQuery.each(i,function(e,b){var h={thumbnailSrc:m(b,d),link:(o+"photos/"+(b.owner||j.user_id)+"/"+b.id+c).replace(/\s/g,"_"),media:{src:m(b,f),title:k?b.title:b.title._content+(!k?" ("+b.photos+" images)":""),alt:b.title._content||b.title,description:b.description?b.description._content:undefined}};if(!k)h.data={photoset_id:b.id};l.push(h)})}return l}};
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,116 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" >
|
3
|
+
<head>
|
4
|
+
<title>YoxView Installation Instructions</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body{ margin-bottom: 1em; font-family: Arial, Sans-Serif; }
|
7
|
+
#main{ width: 800px; margin: 0 auto;}
|
8
|
+
pre{
|
9
|
+
font-family: Courier New;
|
10
|
+
font-size: 10pt;
|
11
|
+
background: #c7d2d8;
|
12
|
+
background: rgba(102, 133, 150, 0.34);
|
13
|
+
border: solid 1px #768ea5;
|
14
|
+
padding: 10px 15px;
|
15
|
+
margin-top: 0.5em;
|
16
|
+
margin-bottom: 2em;
|
17
|
+
color: Black;
|
18
|
+
overflow: auto;
|
19
|
+
-moz-border-radius: 10px;
|
20
|
+
-moz-border-radius-topright: 0;
|
21
|
+
-moz-border-radius-topleft: 0;
|
22
|
+
-webkit-border-radius: 10px;
|
23
|
+
-webkit-border-top-left-radius: 0;
|
24
|
+
-webkit-border-top-right-radius: 0;
|
25
|
+
}
|
26
|
+
a{ color: #0084e0; text-decoration: none;}
|
27
|
+
a:hover{ text-decoration: underline; }
|
28
|
+
p#lastUpdate{ font-size: smaller; margin-top: 2em; color: #666; }
|
29
|
+
</style>
|
30
|
+
</head>
|
31
|
+
<body>
|
32
|
+
<div id="main">
|
33
|
+
<h1>YoxView Installation Instructions</h1>
|
34
|
+
<p>For full usage instruction and information, please refer to the <a href="http://yoxigen.com/yoxview/usage.aspx">
|
35
|
+
YoxView usage page</a>.</p>
|
36
|
+
<a href="#thumbnails">
|
37
|
+
1. Prepare your thumbnails<br />
|
38
|
+
</a><a href="#load">2. Load YoxView</a><br />
|
39
|
+
<a href="#options">
|
40
|
+
3. Options<br />
|
41
|
+
</a><a href="#plugins">
|
42
|
+
4. Plugins (Picasa/Flickr)</a><br /><br />
|
43
|
+
|
44
|
+
<h2 id="installation">Installation</h2>
|
45
|
+
<ol>
|
46
|
+
<li>
|
47
|
+
<h3>Create your thumbnails</h3>
|
48
|
+
Your thumbnails should be placed inside a container and link to their respective full-size images, like this:
|
49
|
+
<pre><div class="yoxview">
|
50
|
+
<a href="img/01.jpg"><img src="img/thumbnails/01.jpg" alt="First" title="First image" /></a>
|
51
|
+
<a href="img/02.jpg"><img src="img/thumbnails/02.jpg" alt="Second" title="Second image" /></a>
|
52
|
+
</div>
|
53
|
+
</pre>
|
54
|
+
<p>The viewer displays the TITLE attribute of the image tag as the image's title inside the viewer, so it's recommended to use it.</p>
|
55
|
+
<p>Note - If you use YoxView's <a href="#plugins">plugins</a> to get your images from Flickr/Picasa, it creates the thumbnails for you, so you can bypass this step.</p>
|
56
|
+
</li>
|
57
|
+
<li>
|
58
|
+
<h3>Include the YoxView script in your page</h3>
|
59
|
+
Put the following line in the HEAD section of your page (just make sure that the
|
60
|
+
SRC points to the correct folder):<br />
|
61
|
+
<pre class="script"><script type="text/javascript" src="yoxview/yoxview-init.js"></script></pre>
|
62
|
+
</li>
|
63
|
+
<li>
|
64
|
+
<h3>Apply YoxView to the element that contains your thumbnails</h3>
|
65
|
+
<ul>
|
66
|
+
<li><h4>Simple use (use if you don't know jQuery or as a shortcut):</h4>
|
67
|
+
First make sure that the element containing your thumbnails has the class "yoxview",
|
68
|
+
like shown above (<div <strong>class="yoxview"</strong>>). Then,
|
69
|
+
open the file yoxview-init.js and uncomment the last line:<br />
|
70
|
+
<pre class="script">LoadScript(yoxviewPath + "yoxview-nojquery.js");</pre>
|
71
|
+
</li>
|
72
|
+
<li>
|
73
|
+
<h4>Regular jQuery plugin use:</h4>
|
74
|
+
(Don't forget to call it from within $(document).ready!)
|
75
|
+
<pre>$("#thumbnails").yoxview([options]);</pre>
|
76
|
+
</li>
|
77
|
+
</ul>
|
78
|
+
</li>
|
79
|
+
</ol>
|
80
|
+
<span class="demo"><strong>Demo</strong>: <a href="http://www.yoxigen.com/yoxview/demo/demo - basic usage.html">Basic installation and usage</a></span>
|
81
|
+
<h2 id="options">3. Options</h2>
|
82
|
+
You can specify options when calling YoxView, either from your script or, if you're using the yoxview-nojquery.js file, from there.
|
83
|
+
<pre>$("#thumbnails").yoxview({
|
84
|
+
backgroundColor: 'Blue',
|
85
|
+
playDelay: 5000
|
86
|
+
});</pre>
|
87
|
+
<span class="demo"><strong>Demo</strong>: <a href="http://www.yoxigen.com/yoxview/demo/demo - customizing with options.html">Using options</a></span><br />
|
88
|
+
For a full list of available options <a href="http://yoxigen.com/yoxview/usage.aspx#options">
|
89
|
+
click here</a>.
|
90
|
+
<h2 id="plugins">4. Plugins</h2>
|
91
|
+
<span class="demo"><strong>Demo</strong>: <a href="http://www.yoxigen.com/yoxview/demo/demo - using plugins.html">Using the YoxView plugins</a></span><br />
|
92
|
+
For complete information and usage instructions for YoxView plugins, <a href="http://yoxigen.com/yoxview/plugins.aspx">
|
93
|
+
click here</a>.
|
94
|
+
<p> YoxView is capable of displaying images from external sources, such as Picasa or Flickr. Images and information about them are retrieved using AJAX (or JSONP) and thumbnails are then created in the page.</p>
|
95
|
+
<p>Images from outside sources can be retrieved using the <em>dataUrl</em> option,
|
96
|
+
by copying a URL from one of the supported data sources.
|
97
|
+
Here's an example of adding an album from picasa to your web page (the scripts can
|
98
|
+
be either in the HEAD or BODY of your page):</p>
|
99
|
+
<pre><script type="text/javascript" src="yoxview/yoxview-init.js"></script>
|
100
|
+
<script type="text/javascript">
|
101
|
+
$(document).ready(function(){
|
102
|
+
$("#yoxview_picasa").yoxview({
|
103
|
+
dataUrl: 'http://picasaweb.google.com/yoxigen/Trips'
|
104
|
+
});
|
105
|
+
});
|
106
|
+
</script>
|
107
|
+
|
108
|
+
<div id="yoxview_picasa"></div></pre>
|
109
|
+
<a href="http://yoxigen.com/yoxview/plugins.aspx#urlsTable">
|
110
|
+
Click here</a> for a full list of supported data URL's.
|
111
|
+
<p id="lastUpdate">
|
112
|
+
Last update to this file: May 20th, 2010
|
113
|
+
</p>
|
114
|
+
</div>
|
115
|
+
</body>
|
116
|
+
</html>
|