- YUI GET – Obtains data from public YQL URI (avoids same origin policy issue)
There are two files associated with the widget:
The HTML file displays sample methods for initializing and rendering a YQL widget. See the following example:
Going through the above example, here is the definition for how to format the requests:
Create the container the you would like to drop the widget into (must have an id)
(OPTIONAL) Define the config object. This object has the following available key / value pairs:
- debug (true / false) – If set to true, status messages will be displayed via console.log during widget rendering
Define the YQL query to pass to the public YQL URI.
Define the id of the container you wish to insert the widget into
Push the widget on the stack. If you have multiple widgets to be rendered, you would push each widget on the load stack using push before rendering (as seen on line 9). The push function accepts the following parameters:
- YQL Query (REQUIRED) – The query defined on line 6
- Config (OPTIONAL) – The config object defined on line 4
- Format (REQUIRED) – The content to add for each result into the container defined
- Insert Element (REQUIRED) – The id of the container to insert the widget into
Render all widgets pushed onto the load stack
This project only accepts contributions licensed under the BSD open source license. See the Open Source Initiative’s approved template below.
Each file submitted should contain the following information in the header:
// Created by Jonathan LeBlanc
// Copyright © Jonathan LeBlanc, 2010. All Rights Reserved.
// Licensed under the BSD (revised) open source license.
Below is the Open Source Initiative BSD License Template (http://opensource.org/licenses/bsd-license.php):
Copyright © <2010>, <Jonathan LeBlanc>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of the nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.