Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Merge pull request #648 from zhouyaoji/docs_fix_binders_ex
Browse files Browse the repository at this point in the history
[docs GH 570] Docs fix binders ex: added placeholder for API key and modified YQL query.
  • Loading branch information
Joe Catera committed Oct 19, 2012
2 parents 5a83c42 + f0af949 commit 60107e5
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions docs/dev_guide/code_exs/binding_events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,16 @@ To set up and run ``binding_events``:
.. code-block:: javascript
YUI.add('PagerMojitBinder', function(Y, NAME) {
var API_KEY = '{your_api_key}';
function parseImageId(link) {
var matches = link.match(/com\/(\d+)\/(\d+)_([0-9a-z]+)\.jpg$/);
return matches[2];
}
function parsePage(link) {
var matches = link.match(/page=(\d+)/);
return matches[1];
}
/**
* The PagerMojitBinder module.
* @module PagerMojitBinder
Expand Down Expand Up @@ -801,7 +811,7 @@ To set up and run ``binding_events``:
Y.log('IMAGE ID: ' + imageId);
target.addClass('overlayed');
// Query for the image metadata
var query = 'select * from flickr.photos.info where photo_id="' + imageId + '"';
var query = 'select * from flickr.photos.info where photo_id="' + imageId + '" and api_key="' + API_KEY + '"';
thatNode.one('#display').setContent('Loading ...');
Y.YQL(query, function(raw) {
if (!raw.query.results.photo) {
Expand All @@ -828,14 +838,6 @@ To set up and run ``binding_events``:
thatNode.all('#nav a').on('click', flipper, this);
}
};
function parseImageId(link) {
var matches = link.match(/com\/(\d+)\/(\d+)_([0-9a-z]+)\.jpg$/);
return matches[2];
}
function parsePage(link) {
var matches = link.match(/page=(\d+)/);
return matches[1];
}
}, '0.0.1', {requires: ['yql', 'io', 'dump']});
#. To display links to photos and associated photo data in the rendered template, replace the code
Expand Down

0 comments on commit 60107e5

Please sign in to comment.