/** @title */
window.foo;
// Check for the various File API support.
if (window.File && window.FileReader && window.FileList && window.Blob)
{
// Great success! All the File APIs are supported.
} else
{
alert('The File APIs are not fully supported so some widgets cannot load properly. Please upgrade your browser.');
}
/**
* @class
* widget which allows a user to customize an image list component
* @param {Object} params set of parameters to supply
* @param.$domE {HtmlElement} the DOMelement that this image frame lister is associated with
* @param.selectFn {Function} function to call when an image is selected(img data is sent as an object to the fn)
**/
var ImgFrameLister = function(params)
{
var that = this; //the magical JS reference to myself! :D
//find/define DOM elements
this.$domE = params.$domE; //parent given with params
this.$uploader;
this.$thumbList;
this.$thumbScroller;
this.imgFrames = [];
this.selectFn = params.selectFn || undefined;
YUI().use('node', 'scrollview',
function(Y)
{
var yDomE = Y.one(that.$domE);
that.$uploader = yDomE.one('.img_uploader')._node;
that.$thumbList= yDomE.one('.thumb_list')._node;
that.$thumbList.setAttribute('id', 'thumb_list_1');
that.$uploader.disabled = false;
that.$uploader.addEventListener('change', that, false);
that.scrollView = new Y.ScrollView(
{
srcNode: '#' + that.$thumbList.id,
height: (that.$domE.offsetHeight - that.$uploader.offsetHeight),
flick: {
minDistance:5,
minVelocity:0.3,
axis: "y"
}
});
window.foo = that.scrollView;
that.scrollView.scrollbars.show();
that.scrollView.render();
});
window.addEventListener('resize', function(){that.refreshListView();}, true);
}
ImgFrameLister.prototype =
{
refreshListView : function()
{
console.log(this);
var that = this;
//clear and then create the images in the Thumbnail...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.