Permalink
Browse files

Gallery Build Tag: gallery-2011.04.06-19-44

  • Loading branch information...
1 parent d3cbfdb commit bb5f6270fbcbb9d61496f104b5889b2f8145a369 YUI Builder committed Apr 6, 2011
Showing with 2,889 additions and 621 deletions.
  1. +105 −0 build/gallery-audio/gallery-audio-debug.js
  2. +1 −0 build/gallery-audio/gallery-audio-min.js
  3. +105 −0 build/gallery-audio/gallery-audio.js
  4. +12 −5 build/gallery-ellipsis/gallery-ellipsis-debug.js
  5. +1 −1 build/gallery-ellipsis/gallery-ellipsis-min.js
  6. +12 −5 build/gallery-ellipsis/gallery-ellipsis.js
  7. +22 −6 build/gallery-querybuilder/gallery-querybuilder-debug.js
  8. +1 −1 build/gallery-querybuilder/gallery-querybuilder-min.js
  9. +22 −6 build/gallery-querybuilder/gallery-querybuilder.js
  10. +42 −0 build/gallery-recordset-storage-lite/gallery-recordset-storage-lite-debug.js
  11. +1 −0 build/gallery-recordset-storage-lite/gallery-recordset-storage-lite-min.js
  12. +42 −0 build/gallery-recordset-storage-lite/gallery-recordset-storage-lite.js
  13. BIN build/gallery-split-desktop/assets/center-handle.png
  14. BIN build/gallery-split-desktop/assets/drag-here.png
  15. +105 −0 build/gallery-split-desktop/assets/gallery-split-desktop-core.css
  16. BIN build/gallery-split-desktop/assets/pix-blue.gif
  17. BIN build/gallery-split-desktop/assets/split-desktop-demo.png
  18. +402 −0 build/gallery-split-desktop/gallery-split-desktop-debug.js
  19. +1 −0 build/gallery-split-desktop/gallery-split-desktop-min.js
  20. +384 −0 build/gallery-split-desktop/gallery-split-desktop.js
  21. +815 −298 build/gallery-yui-slideshow/gallery-yui-slideshow-debug.js
  22. +1 −1 build/gallery-yui-slideshow/gallery-yui-slideshow-min.js
  23. +815 −298 build/gallery-yui-slideshow/gallery-yui-slideshow.js
View
105 build/gallery-audio/gallery-audio-debug.js
@@ -0,0 +1,105 @@
+YUI.add('gallery-audio', function(Y) {
+
+'use strict';
+
+var _playable = {};
+
+(function (modernizr) {
+ if (modernizr) {
+ if (modernizr.audio) {
+ _playable.m4a = modernizr.audio.m4a;
+ _playable.mp3 = modernizr.audio.mp3;
+ _playable.ogg = modernizr.audio.ogg;
+ _playable.wav = modernizr.audio.wav;
+ }
+ return;
+ }
+
+ var audioElement = Y.config.doc.createElement('audio');
+
+ if (!audioElement.canPlayType) {
+ return;
+ }
+
+ _playable.m4a = audioElement.canPlayType('audio/x-m4a;') || audioElement.canPlayType('audio/aac;');
+ _playable.mp3 = audioElement.canPlayType('audio/mpeg;');
+ _playable.ogg = audioElement.canPlayType('audio/ogg; codecs="vorbis"');
+ _playable.wav = audioElement.canPlayType('audio/wav; codecs="1"');
+}(Y.Modernizr || Y.config.win.Modernizr));
+
+Y.Audio = {
+ create: function (config) {
+ config = config || {};
+
+ var format,
+ formats = config.format || [
+ 'ogg',
+ 'mp3',
+ 'm4a',
+ 'wav'
+ ],
+ i,
+ length,
+ playable,
+ source = config.baseUrl || '',
+ testFormat;
+
+ if (Y.Lang.isArray(formats)) {
+ for (i = 0, length = formats.length; i < length; i += 1) {
+ testFormat = formats[i];
+ playable = _playable[testFormat];
+
+ if (!playable) {
+ continue;
+ }
+
+ if (playable === 'probably') {
+ format = testFormat;
+ break;
+ }
+
+ if (!format) {
+ format = testFormat;
+ }
+ }
+
+ if (format) {
+ source += '.' + format;
+ }
+ } else if (Y.Lang.isObject(formats)) {
+ for (testFormat in formats) {
+ if (formats.hasOwnProperty(testFormat)) {
+ playable = _playable[testFormat];
+
+ if (!playable) {
+ continue;
+ }
+
+ if (playable === 'probably') {
+ format = testFormat;
+ break;
+ }
+
+ if (!format) {
+ format = testFormat;
+ }
+ }
+ }
+
+ if (format) {
+ source += formats[format];
+ }
+ } else {
+ return null;
+ }
+
+ if (!format) {
+ return null;
+ }
+
+ return Y.Node.create('<audio ' + (config.autoplay ? 'autoplay="true" ' : '') + (config.controls ? 'controls="true"' : '') + (config.loop ? 'loop="true"' : '') + ' preload="' + (config.preload ? config.preload : 'auto') + '" src="' + source + '" />');
+ }
+};
+
+
+}, 'gallery-2011.04.06-19-44' ,{requires:['node'], optional:['gallery-modernizr']});
View
1 build/gallery-audio/gallery-audio-min.js
@@ -0,0 +1 @@
+YUI.add("gallery-audio",function(b){var a={};(function(d){if(d){if(d.audio){a.m4a=d.audio.m4a;a.mp3=d.audio.mp3;a.ogg=d.audio.ogg;a.wav=d.audio.wav;}return;}var c=b.config.doc.createElement("audio");if(!c.canPlayType){return;}a.m4a=c.canPlayType("audio/x-m4a;")||c.canPlayType("audio/aac;");a.mp3=c.canPlayType("audio/mpeg;");a.ogg=c.canPlayType('audio/ogg; codecs="vorbis"');a.wav=c.canPlayType('audio/wav; codecs="1"');}(b.Modernizr||b.config.win.Modernizr));b.Audio={create:function(d){d=d||{};var k,c=d.format||["ogg","mp3","m4a","wav"],e,g,f,h=d.baseUrl||"",j;if(b.Lang.isArray(c)){for(e=0,g=c.length;e<g;e+=1){j=c[e];f=a[j];if(!f){continue;}if(f==="probably"){k=j;break;}if(!k){k=j;}}if(k){h+="."+k;}}else{if(b.Lang.isObject(c)){for(j in c){if(c.hasOwnProperty(j)){f=a[j];if(!f){continue;}if(f==="probably"){k=j;break;}if(!k){k=j;}}}if(k){h+=c[k];}}else{return null;}}if(!k){return null;}return b.Node.create("<audio "+(d.autoplay?'autoplay="true" ':"")+(d.controls?'controls="true"':"")+(d.loop?'loop="true"':"")+' preload="'+(d.preload?d.preload:"auto")+'" src="'+h+'" />');}};},"gallery-2011.04.06-19-44",{requires:["node"],optional:["gallery-modernizr"]});
View
105 build/gallery-audio/gallery-audio.js
@@ -0,0 +1,105 @@
+YUI.add('gallery-audio', function(Y) {
+
+'use strict';
+
+var _playable = {};
+
+(function (modernizr) {
+ if (modernizr) {
+ if (modernizr.audio) {
+ _playable.m4a = modernizr.audio.m4a;
+ _playable.mp3 = modernizr.audio.mp3;
+ _playable.ogg = modernizr.audio.ogg;
+ _playable.wav = modernizr.audio.wav;
+ }
+ return;
+ }
+
+ var audioElement = Y.config.doc.createElement('audio');
+
+ if (!audioElement.canPlayType) {
+ return;
+ }
+
+ _playable.m4a = audioElement.canPlayType('audio/x-m4a;') || audioElement.canPlayType('audio/aac;');
+ _playable.mp3 = audioElement.canPlayType('audio/mpeg;');
+ _playable.ogg = audioElement.canPlayType('audio/ogg; codecs="vorbis"');
+ _playable.wav = audioElement.canPlayType('audio/wav; codecs="1"');
+}(Y.Modernizr || Y.config.win.Modernizr));
+
+Y.Audio = {
+ create: function (config) {
+ config = config || {};
+
+ var format,
+ formats = config.format || [
+ 'ogg',
+ 'mp3',
+ 'm4a',
+ 'wav'
+ ],
+ i,
+ length,
+ playable,
+ source = config.baseUrl || '',
+ testFormat;
+
+ if (Y.Lang.isArray(formats)) {
+ for (i = 0, length = formats.length; i < length; i += 1) {
+ testFormat = formats[i];
+ playable = _playable[testFormat];
+
+ if (!playable) {
+ continue;
+ }
+
+ if (playable === 'probably') {
+ format = testFormat;
+ break;
+ }
+
+ if (!format) {
+ format = testFormat;
+ }
+ }
+
+ if (format) {
+ source += '.' + format;
+ }
+ } else if (Y.Lang.isObject(formats)) {
+ for (testFormat in formats) {
+ if (formats.hasOwnProperty(testFormat)) {
+ playable = _playable[testFormat];
+
+ if (!playable) {
+ continue;
+ }
+
+ if (playable === 'probably') {
+ format = testFormat;
+ break;
+ }
+
+ if (!format) {
+ format = testFormat;
+ }
+ }
+ }
+
+ if (format) {
+ source += formats[format];
+ }
+ } else {
+ return null;
+ }
+
+ if (!format) {
+ return null;
+ }
+
+ return Y.Node.create('<audio ' + (config.autoplay ? 'autoplay="true" ' : '') + (config.controls ? 'controls="true"' : '') + (config.loop ? 'loop="true"' : '') + ' preload="' + (config.preload ? config.preload : 'auto') + '" src="' + source + '" />');
+ }
+};
+
+
+}, 'gallery-2011.04.06-19-44' ,{requires:['node'], optional:['gallery-modernizr']});
View
17 build/gallery-ellipsis/gallery-ellipsis-debug.js
@@ -35,7 +35,10 @@ YUI.add('gallery-ellipsis', function(Y) {
'fudge' : 3,
// target number of lines to wrap
- 'lines' : 1
+ 'lines' : 1,
+
+ // whether or not to remember the original text to able to de-truncate
+ 'remember' : true
});
// console.log(conf);
@@ -45,8 +48,11 @@ YUI.add('gallery-ellipsis', function(Y) {
// the element we're trying to truncate
var yEl = Y.one(node),
+ // the name of the field we use to store using .setData()
+ dataAttrName = 'ellipsis-original-text',
+
// original text
- originalText = yEl.getAttribute('originalText') || yEl.get('text'),
+ originalText = conf.remember && yEl.getData(dataAttrName) || yEl.get('text'),
// keep the current length of the text so far
currentLength = originalText.length,
@@ -155,8 +161,8 @@ YUI.add('gallery-ellipsis', function(Y) {
clone.remove();
// set the original text if we want to ever want to expand past the current truncation
- if (!yEl.getAttribute('originalText')) {
- yEl.setAttribute('originalText', originalText);
+ if (conf.remember && !yEl.getData(dataAttrName)) {
+ yEl.setData(dataAttrName, originalText);
}
// console.log('originalText.length', originalText.length);
@@ -184,4 +190,5 @@ YUI.add('gallery-ellipsis', function(Y) {
Y.NodeList.importMethod(Y.Node.prototype, 'ellipsis');
-}, 'gallery-2011.03.30-19-47' ,{requires:['base','node']});
+
+}, 'gallery-2011.04.06-19-44' ,{requires:['base','node']});
View
2 build/gallery-ellipsis/gallery-ellipsis-min.js
@@ -1 +1 @@
-YUI.add("gallery-ellipsis",function(a){a.DOM.ellipsis=function(e,k){k=k||{};a.mix(k,{"ellipsis":" ...","fudge":3,"lines":1});var j=a.one(e),g=j.getAttribute("originalText")||j.get("text"),h=g.length,f=h,n=a.one(document.createElement(j.get("nodeName"))),b=0.01,m=function(r,q){return Math.abs(r-q)<=b;},c=function(r,q){return r-q>=b;},o=function(r,q){return r-q<=b;},p,i,d,l;n.setStyles({"overflow":"hidden","position":"absolute","visibility":"hidden","display":"block","bottom":"-10px","right":"-10px","width":j.getComputedStyle("width"),"fontSize":j.getComputedStyle("fontSize"),"fontFamily":j.getComputedStyle("fontFamily"),"fontWeight":j.getComputedStyle("fontWeight"),"letterSpacing":j.getComputedStyle("letterSpacing"),"lineHeight":j.getComputedStyle("lineHeight")});n.set("text","some sample text");a.one("body").append(n);p=parseFloat(n.getComputedStyle("height"),10);n.setStyle("overflow","visible");i=k.lines*p;n.set("text",g);d=parseFloat(n.getComputedStyle("height"),10);if(o(d,i)&&g.length===j.get("text").length){n.remove();return;}for(;f>=1;){f=Math.floor(f/2);h+=c(d,i)?-f:+f;n.set("text",g.slice(0,h-k.ellipsis.length)+k.ellipsis);d=parseFloat(n.getComputedStyle("height"),10);if(m(d,i)||o(d,i)){l=h;}}n.remove();if(!j.getAttribute("originalText")){j.setAttribute("originalText",g);}if(g.length===(n.get("text").length-k.ellipsis.length)){j.set("text",g);}else{if("undefined"!==typeof l){j.set("text",g.slice(0,l-k.ellipsis.length-k.fudge)+k.ellipsis);}}return j;};a.Node.importMethod(a.DOM,"ellipsis");a.NodeList.importMethod(a.Node.prototype,"ellipsis");},"gallery-2011.03.30-19-47",{requires:["base","node"]});
+YUI.add("gallery-ellipsis",function(a){a.DOM.ellipsis=function(f,l){l=l||{};a.mix(l,{"ellipsis":" ...","fudge":3,"lines":1,"remember":true});var k=a.one(f),b="ellipsis-original-text",h=l.remember&&k.getData(b)||k.get("text"),i=h.length,g=i,o=a.one(document.createElement(k.get("nodeName"))),c=0.01,n=function(s,r){return Math.abs(s-r)<=c;},d=function(s,r){return s-r>=c;},p=function(s,r){return s-r<=c;},q,j,e,m;o.setStyles({"overflow":"hidden","position":"absolute","visibility":"hidden","display":"block","bottom":"-10px","right":"-10px","width":k.getComputedStyle("width"),"fontSize":k.getComputedStyle("fontSize"),"fontFamily":k.getComputedStyle("fontFamily"),"fontWeight":k.getComputedStyle("fontWeight"),"letterSpacing":k.getComputedStyle("letterSpacing"),"lineHeight":k.getComputedStyle("lineHeight")});o.set("text","some sample text");a.one("body").append(o);q=parseFloat(o.getComputedStyle("height"),10);o.setStyle("overflow","visible");j=l.lines*q;o.set("text",h);e=parseFloat(o.getComputedStyle("height"),10);if(p(e,j)&&h.length===k.get("text").length){o.remove();return;}for(;g>=1;){g=Math.floor(g/2);i+=d(e,j)?-g:+g;o.set("text",h.slice(0,i-l.ellipsis.length)+l.ellipsis);e=parseFloat(o.getComputedStyle("height"),10);if(n(e,j)||p(e,j)){m=i;}}o.remove();if(l.remember&&!k.getData(b)){k.setData(b,h);}if(h.length===(o.get("text").length-l.ellipsis.length)){k.set("text",h);}else{if("undefined"!==typeof m){k.set("text",h.slice(0,m-l.ellipsis.length-l.fudge)+l.ellipsis);}}return k;};a.Node.importMethod(a.DOM,"ellipsis");a.NodeList.importMethod(a.Node.prototype,"ellipsis");},"gallery-2011.04.06-19-44",{requires:["base","node"]});
View
17 build/gallery-ellipsis/gallery-ellipsis.js
@@ -35,7 +35,10 @@ YUI.add('gallery-ellipsis', function(Y) {
'fudge' : 3,
// target number of lines to wrap
- 'lines' : 1
+ 'lines' : 1,
+
+ // whether or not to remember the original text to able to de-truncate
+ 'remember' : true
});
// console.log(conf);
@@ -45,8 +48,11 @@ YUI.add('gallery-ellipsis', function(Y) {
// the element we're trying to truncate
var yEl = Y.one(node),
+ // the name of the field we use to store using .setData()
+ dataAttrName = 'ellipsis-original-text',
+
// original text
- originalText = yEl.getAttribute('originalText') || yEl.get('text'),
+ originalText = conf.remember && yEl.getData(dataAttrName) || yEl.get('text'),
// keep the current length of the text so far
currentLength = originalText.length,
@@ -155,8 +161,8 @@ YUI.add('gallery-ellipsis', function(Y) {
clone.remove();
// set the original text if we want to ever want to expand past the current truncation
- if (!yEl.getAttribute('originalText')) {
- yEl.setAttribute('originalText', originalText);
+ if (conf.remember && !yEl.getData(dataAttrName)) {
+ yEl.setData(dataAttrName, originalText);
}
// console.log('originalText.length', originalText.length);
@@ -184,4 +190,5 @@ YUI.add('gallery-ellipsis', function(Y) {
Y.NodeList.importMethod(Y.Node.prototype, 'ellipsis');
-}, 'gallery-2011.03.30-19-47' ,{requires:['base','node']});
+
+}, 'gallery-2011.04.06-19-44' ,{requires:['base','node']});
View
28 build/gallery-querybuilder/gallery-querybuilder-debug.js
@@ -12,7 +12,9 @@ var has_bubble_problem = (0 < Y.UA.ie && Y.UA.ie < 9);
* <p>The default package provides two data types: String (which can also
* be used for numbers) and Select (which provides a menu of options). The
* plugin API allows defining additional data types, e.g., date range or
- * multi-select. A plugin must implement the following functions:</p>
+ * multi-select. Every plugin must be registered in
+ * <code>Y.QueryBuilder.plugin_mapping</code>. Plugins must implement the
+ * following functions:</p>
*
* <dl>
* <dt><code>constructor(qb, config)</code></dt>
@@ -608,7 +610,7 @@ Y.extend(QueryBuilder, Y.Widget,
return result;
},
- /**********************************************************************
+ /*
* API for plugins
*/
@@ -631,7 +633,7 @@ Y.extend(QueryBuilder, Y.Widget,
this.fire('queryChanged');
},
- /**********************************************************************
+ /*
* Form element names.
*/
@@ -764,7 +766,14 @@ QueryBuilder.String.prototype =
{
if (this.value_input) // could be destroyed
{
- this.value_input.focus();
+ try
+ {
+ this.value_input.focus();
+ }
+ catch (e)
+ {
+ // IE will complain if field is invisible, instead of just ignoring it
+ }
}
});
},
@@ -907,7 +916,14 @@ QueryBuilder.Select.prototype =
/* array */ op_list,
/* array */ value)
{
- this.value_menu.focus();
+ try
+ {
+ this.value_menu.focus();
+ }
+ catch (e)
+ {
+ // IE will complain if field is invisible, instead of just ignoring it
+ }
},
destroy: function()
@@ -972,4 +988,4 @@ QueryBuilder.plugin_mapping =
};
-}, 'gallery-2011.02.16-20-31' ,{optional:['gallery-formmgr','gallery-scrollintoview'], requires:['widget','substitute'], skinnable:true});
+}, 'gallery-2011.04.06-19-44' ,{skinnable:true, optional:['gallery-formmgr','gallery-scrollintoview'], requires:['widget','substitute']});
View
2 build/gallery-querybuilder/gallery-querybuilder-min.js
@@ -1,2 +1,2 @@
YUI.add("gallery-querybuilder",function(a){var d=(0<a.UA.ie&&a.UA.ie<9);function b(k,j,l){if(arguments.length===0){return;}if(!a.FormManager){a.FormManager={row_marker_class:"",status_marker_class:"",required_class:""};}this.var_list=k.slice(0);this.op_list=a.clone(j,true);this.op_list.none=[];this.row_list=[];b.superclass.constructor.call(this,l);}b.NAME="querybuilder";b.ATTRS={chooseVarPrompt:{value:"Choose a Variable",validator:a.Lang.isString,writeOnce:true},fieldPrefix:{value:"",validator:a.Lang.isString,writeOnce:true},pluginConfig:{value:{},validator:a.Lang.isObject,writeOnce:true}};function f(){this.var_list.unshift({name:"yui3-querybuilder-choose-prompt",type:"none",text:this.get("chooseVarPrompt")});}function i(l,m){var k=l.length;for(var j=0;j<k;j++){if(l[j].row==m){return j;}}return -1;}function h(k,j){this.appendNew();}function g(l,k){var j=i(this.row_list,k);if(j>=0){this.remove(j);}}function c(l,k){var j=i(this.row_list,k);if(j>=0){this.update(j);}}function e(j){if(j.keyCode!=13){this._notifyChanged();}}a.extend(b,a.Widget,{initializer:function(j){var k=this.get("fieldPrefix");this.var_menu_name_pattern=k+"query_var_{i}";this.get("pluginConfig").fieldPrefix=k;this.plugin_column_count=0;f.call(this);},renderUI:function(){var j=this.get("contentBox");j.on("change",this._notifyChanged,this);j.on("keyup",e,this);this.table=a.Node.create("<table></table>");j.appendChild(this.table);this.appendNew();},destructor:function(){for(var j=0;j<this.row_list.length;j++){if(this.row_list[j].plugin){this.row_list[j].plugin.destroy();}}this.row_list=null;this.table=null;},reset:function(k,j){this._allow_remove_last_row=true;for(var l=this.row_list.length-1;l>=0;l--){this.remove(l);}this._allow_remove_last_row=false;if(k){this.var_list=k.slice(0);f.call(this);}if(j){this.op_list=a.clone(j,true);this.op_list.none=[];}this.appendNew();},appendNew:function(m,w){if(m&&this.row_list.length==1){var o=this.row_list[0].var_menu;if(o.get("selectedIndex")===0){for(var r=0;r<this.var_list.length;r++){if(this.var_list[r].name==m){o.set("selectedIndex",r);break;}}this.update(0,w);return this.row_list[0].plugin;}}var u=this.row_list.length;var k=a.Node.create("<tbody></tbody>");k.set("className",a.FormManager.row_marker_class);var t=a.Node.create("<tr></tr>");t.set("className",this.getClassName("error"));k.appendChild(t);var l=this._createContainer();l.set("colSpan",1+this.plugin_column_count);l.set("innerHTML",'<p class="'+a.FormManager.status_marker_class+'"></p>');t.appendChild(l);t.appendChild(this._createContainer());var q=a.Node.create("<tr></tr>");q.set("className",this.getClassName("criterion"));k.appendChild(q);var j=this._createContainer();j.set("className",this.getClassName("variable"));q.appendChild(j);j.set("innerHTML",this._variablesMenu(this.variableName(u)));var o=j.one("select");o.on("change",c,this,q);var x=a.Node.getDOMNode(o).options;for(var r=0;r<this.var_list.length;r++){x[r]=new Option(this.var_list[r].text,this.var_list[r].name);if(this.var_list[r].name==m){o.set("selectedIndex",r);}}if(d){o.on("change",this._notifyChanged,this);}var s=this._createContainer();s.set("className",this.getClassName("controls"));s.set("innerHTML",this._rowControls());q.appendChild(s);var n=s.one("."+this.getClassName("insert"));if(n){n.on("click",h,this,q);}var v=s.one("."+this.getClassName("remove"));if(v){v.on("click",g,this,q);}this.table.appendChild(k);var p={body:k,row:q,var_menu:o,control:s,error:l};this.row_list.push(p);this.update(u,w);k.scrollIntoView();return this.row_list[u].plugin;},update:function(u,v){var r=this.row_list[u].row;var t=this.row_list[u].control;this.row_list[u].error.one("."+a.FormManager.status_marker_class).set("innerHTML","");if(this.row_list[u].plugin){this.row_list[u].plugin.destroy();this.row_list[u].plugin=null;}while(r.get("children").size()>2){var m=r.get("children").item(0).next();m.remove(true);}var n=this.row_list[u].var_menu;var l=this.var_list[n.get("selectedIndex")];var w=[];if(l.type!="none"){this.row_list[u].plugin=new b.plugin_mapping[l.type](this,this.get("pluginConfig"));w=this.row_list[u].plugin.create(u,l,this.op_list[l.type],v);}while(w.length<this.plugin_column_count){w.push(this._createContainer());}for(var q=0;q<w.length;q++){r.insertBefore(w[q],t);}if(w.length>this.plugin_column_count){var k=1+w.length;for(var q=0;q<this.row_list.length;q++){var x=this.row_list[q].row;this.row_list[q].error.set("colSpan",k);if(x!=r){var p=this.row_list[q].control;for(var o=this.plugin_column_count;o<w.length;o++){x.insertBefore(this._createContainer(),p);}}}this.plugin_column_count=w.length;}var s=this.row_list[u].plugin;if(s&&a.Lang.isFunction(s.postCreate)){this.row_list[u].plugin.postCreate(u,l,this.op_list[l.type],v);}},remove:function(l){if(this.row_list.length<=0){return false;}if(!this._allow_remove_last_row&&this.row_list.length==1){var k=this.row_list[0].var_menu;k.set("selectedIndex",0);this.update(0);this.fire("queryChanged",{remove:true});return true;}var n=this.row_list[l].body;if(n===null){return false;}if(this.row_list[l].plugin){this.row_list[l].plugin.destroy();}n.remove(true);this.row_list.splice(l,1);for(var j=0;j<this.row_list.length;j++){var k=this.row_list[j].var_menu;k.setAttribute("name",this.variableName(j));var m=this.var_list[k.get("selectedIndex")];if(m.type!="none"){this.row_list[j].plugin.updateName(j);}}this.fire("queryChanged",{remove:true});return true;},getPlugin:function(j){return this.row_list[j].plugin;},toDatabaseQuery:function(){var k=[];for(var m=0;m<this.row_list.length;m++){var p=this.row_list[m];var n=p.plugin;if(n){var o=n.toDatabaseQuery();for(var l=0;l<o.length;l++){k.push([p.var_menu.get("value")].concat(o[l]));}}}return k;},_createContainer:function(){return a.Node.create("<td></td>");},_notifyChanged:function(){this.fire("queryChanged");},variableName:function(j){return a.Lang.substitute(this.var_menu_name_pattern,{i:j});},_variablesMenu:function(k){var j='<select name="{n}" class="formmgr-field {c}" />';return a.Lang.substitute(j,{n:k,c:this.getClassName("field")});
-},_rowControls:function(){var j='<span class="{ci}"></span>'+'<span class="{cr}"></span>';if(!this._controls_markup){this._controls_markup=a.Lang.substitute(j,{ci:this.getClassName("insert"),cr:this.getClassName("remove")});}return this._controls_markup;}});a.QueryBuilder=b;b.String=function(k,j){this.qb=k;this.op_menu_name_pattern=j.field_prefix+"query_op_{i}";this.val_input_name_pattern=j.field_prefix+"query_val_{i}";};b.String.prototype={create:function(o,n,j,p){var m=this.qb._createContainer();m.set("className",this.qb.getClassName("operator"));m.set("innerHTML",this._operationsMenu(this.operationName(o)));this.op_menu=m.one("select");var k=a.Node.getDOMNode(this.op_menu).options;for(var l=0;l<j.length;l++){k[l]=new Option(j[l].text,j[l].value);}p=p||["",""];if(p[0]){this.op_menu.set("value",p[0]);}if(d){this.op_menu.on("change",this.qb._notifyChanged,this.qb);}var q=this.qb._createContainer();q.set("className",this.qb.getClassName("value"));q.set("innerHTML",this._valueInput(this.valueName(o),n.validation));this.value_input=q.one("input");this.value_input.set("value",p[1]);return[m,q];},postCreate:function(l,k,j,m){a.Lang.later(1,this,function(){if(this.value_input){this.value_input.focus();}});},destroy:function(){this.op_menu=null;this.value_input=null;},updateName:function(j){this.op_menu.setAttribute("name",this.operationName(j));this.value_input.setAttribute("name",this.valueName(j));},set:function(j,k){this.op_menu.set("value",k[this.operationName(j)]);this.value_input.set("value",k[this.valueName(j)]);},toDatabaseQuery:function(){return[[this.op_menu.get("value"),this.value_input.get("value")]];},operationName:function(j){return a.Lang.substitute(this.op_menu_name_pattern,{i:j});},valueName:function(j){return a.Lang.substitute(this.val_input_name_pattern,{i:j});},_operationsMenu:function(k){var j='<select name="{n}" class="formmgr-field {c}" />';return a.Lang.substitute(j,{n:k,c:this.qb.getClassName("field")});},_valueInput:function(l,k){var j='<input type="text" name="{n}" class="yiv-required formmgr-field {c}"/>';return a.Lang.substitute(j,{n:l,c:k+" "+this.qb.getClassName("field")});}};b.Select=function(k,j){this.qb=k;this.val_input_name_pattern=j.field_prefix+"query_val_{i}";};b.Select.prototype={create:function(o,n,j,p){var q=this.qb._createContainer();q.set("className",this.qb.getClassName("value"));q.set("innerHTML",this._valuesMenu(this.valueName(o)));this.value_menu=q.one("select");var k=a.Node.getDOMNode(this.value_menu).options;var m=n.value_list;for(var l=0;l<m.length;l++){k[l]=new Option(m[l].text,m[l].value);}if(p){this.value_menu.set("value",p);}if(d){this.value_menu.on("change",this.qb._notifyChanged,this.qb);}this.db_query_equals=j[0];return[q];},postCreate:function(l,k,j,m){this.value_menu.focus();},destroy:function(){this.value_menu=null;},updateName:function(j){this.value_menu.setAttribute("name",this.valueName(j));},set:function(j,k){this.value_menu.set("value",k[this.valueName(j)]);},toDatabaseQuery:function(){return[[this.db_query_equals,this.value_menu.get("value")]];},valueName:function(j){return a.Lang.substitute(this.val_input_name_pattern,{i:j});},_valuesMenu:function(k){var j='<select name="{n}" class="formmgr-field {c}" />';return a.Lang.substitute(j,{n:k,c:this.qb.getClassName("field")});}};b.plugin_mapping={string:b.String,number:b.String,select:b.Select};},"gallery-2011.02.16-20-31",{optional:["gallery-formmgr","gallery-scrollintoview"],requires:["widget","substitute"],skinnable:true});
+},_rowControls:function(){var j='<span class="{ci}"></span>'+'<span class="{cr}"></span>';if(!this._controls_markup){this._controls_markup=a.Lang.substitute(j,{ci:this.getClassName("insert"),cr:this.getClassName("remove")});}return this._controls_markup;}});a.QueryBuilder=b;b.String=function(k,j){this.qb=k;this.op_menu_name_pattern=j.field_prefix+"query_op_{i}";this.val_input_name_pattern=j.field_prefix+"query_val_{i}";};b.String.prototype={create:function(o,n,j,p){var m=this.qb._createContainer();m.set("className",this.qb.getClassName("operator"));m.set("innerHTML",this._operationsMenu(this.operationName(o)));this.op_menu=m.one("select");var k=a.Node.getDOMNode(this.op_menu).options;for(var l=0;l<j.length;l++){k[l]=new Option(j[l].text,j[l].value);}p=p||["",""];if(p[0]){this.op_menu.set("value",p[0]);}if(d){this.op_menu.on("change",this.qb._notifyChanged,this.qb);}var q=this.qb._createContainer();q.set("className",this.qb.getClassName("value"));q.set("innerHTML",this._valueInput(this.valueName(o),n.validation));this.value_input=q.one("input");this.value_input.set("value",p[1]);return[m,q];},postCreate:function(l,k,j,m){a.Lang.later(1,this,function(){if(this.value_input){try{this.value_input.focus();}catch(n){}}});},destroy:function(){this.op_menu=null;this.value_input=null;},updateName:function(j){this.op_menu.setAttribute("name",this.operationName(j));this.value_input.setAttribute("name",this.valueName(j));},set:function(j,k){this.op_menu.set("value",k[this.operationName(j)]);this.value_input.set("value",k[this.valueName(j)]);},toDatabaseQuery:function(){return[[this.op_menu.get("value"),this.value_input.get("value")]];},operationName:function(j){return a.Lang.substitute(this.op_menu_name_pattern,{i:j});},valueName:function(j){return a.Lang.substitute(this.val_input_name_pattern,{i:j});},_operationsMenu:function(k){var j='<select name="{n}" class="formmgr-field {c}" />';return a.Lang.substitute(j,{n:k,c:this.qb.getClassName("field")});},_valueInput:function(l,k){var j='<input type="text" name="{n}" class="yiv-required formmgr-field {c}"/>';return a.Lang.substitute(j,{n:l,c:k+" "+this.qb.getClassName("field")});}};b.Select=function(k,j){this.qb=k;this.val_input_name_pattern=j.field_prefix+"query_val_{i}";};b.Select.prototype={create:function(o,n,j,p){var q=this.qb._createContainer();q.set("className",this.qb.getClassName("value"));q.set("innerHTML",this._valuesMenu(this.valueName(o)));this.value_menu=q.one("select");var k=a.Node.getDOMNode(this.value_menu).options;var m=n.value_list;for(var l=0;l<m.length;l++){k[l]=new Option(m[l].text,m[l].value);}if(p){this.value_menu.set("value",p);}if(d){this.value_menu.on("change",this.qb._notifyChanged,this.qb);}this.db_query_equals=j[0];return[q];},postCreate:function(l,k,j,m){try{this.value_menu.focus();}catch(n){}},destroy:function(){this.value_menu=null;},updateName:function(j){this.value_menu.setAttribute("name",this.valueName(j));},set:function(j,k){this.value_menu.set("value",k[this.valueName(j)]);},toDatabaseQuery:function(){return[[this.db_query_equals,this.value_menu.get("value")]];},valueName:function(j){return a.Lang.substitute(this.val_input_name_pattern,{i:j});},_valuesMenu:function(k){var j='<select name="{n}" class="formmgr-field {c}" />';return a.Lang.substitute(j,{n:k,c:this.qb.getClassName("field")});}};b.plugin_mapping={string:b.String,number:b.String,select:b.Select};},"gallery-2011.04.06-19-44",{skinnable:true,optional:["gallery-formmgr","gallery-scrollintoview"],requires:["widget","substitute"]});
View
28 build/gallery-querybuilder/gallery-querybuilder.js
@@ -12,7 +12,9 @@ var has_bubble_problem = (0 < Y.UA.ie && Y.UA.ie < 9);
* <p>The default package provides two data types: String (which can also
* be used for numbers) and Select (which provides a menu of options). The
* plugin API allows defining additional data types, e.g., date range or
- * multi-select. A plugin must implement the following functions:</p>
+ * multi-select. Every plugin must be registered in
+ * <code>Y.QueryBuilder.plugin_mapping</code>. Plugins must implement the
+ * following functions:</p>
*
* <dl>
* <dt><code>constructor(qb, config)</code></dt>
@@ -608,7 +610,7 @@ Y.extend(QueryBuilder, Y.Widget,
return result;
},
- /**********************************************************************
+ /*
* API for plugins
*/
@@ -631,7 +633,7 @@ Y.extend(QueryBuilder, Y.Widget,
this.fire('queryChanged');
},
- /**********************************************************************
+ /*
* Form element names.
*/
@@ -764,7 +766,14 @@ QueryBuilder.String.prototype =
{
if (this.value_input) // could be destroyed
{
- this.value_input.focus();
+ try
+ {
+ this.value_input.focus();
+ }
+ catch (e)
+ {
+ // IE will complain if field is invisible, instead of just ignoring it
+ }
}
});
},
@@ -907,7 +916,14 @@ QueryBuilder.Select.prototype =
/* array */ op_list,
/* array */ value)
{
- this.value_menu.focus();
+ try
+ {
+ this.value_menu.focus();
+ }
+ catch (e)
+ {
+ // IE will complain if field is invisible, instead of just ignoring it
+ }
},
destroy: function()
@@ -972,4 +988,4 @@ QueryBuilder.plugin_mapping =
};
-}, 'gallery-2011.02.16-20-31' ,{optional:['gallery-formmgr','gallery-scrollintoview'], requires:['widget','substitute'], skinnable:true});
+}, 'gallery-2011.04.06-19-44' ,{skinnable:true, optional:['gallery-formmgr','gallery-scrollintoview'], requires:['widget','substitute']});
View
42 build/gallery-recordset-storage-lite/gallery-recordset-storage-lite-debug.js
@@ -0,0 +1,42 @@
+YUI.add('gallery-recordset-storage-lite', function(Y) {
+
+'use strict';
+
+var _class;
+
+_class = function (config) {
+ _class.superclass.constructor.call(this, config);
+};
+
+_class.NAME = 'RecordsetStorageLite';
+
+_class.NS = 'storageLite';
+
+Y.extend(_class, Y.Plugin.Base, {
+ initializer: function () {
+ this.publish('failure');
+ this.publish('store');
+ },
+ store: function (key) {
+ Y.StorageLite.on('storage-lite:ready', function () {
+ var host = this.get('host'),
+ records = host.getRecordsByIndex(0, host.getLength());
+
+ Y.each(records, function (record, index, records) {
+ records[index] = record.getValue();
+ });
+
+ try {
+ Y.StorageLite.setItem(key, records, true);
+ this.fire('store', {}, key, records);
+ } catch (e) {
+ this.fire('failure', {}, e);
+ }
+ }, this);
+ }
+});
+
+Y.Plugin.RecordsetStorageLite = _class;
+
+
+}, 'gallery-2011.04.06-19-44' ,{requires:['gallery-storage-lite','plugin']});
View
1 build/gallery-recordset-storage-lite/gallery-recordset-storage-lite-min.js
@@ -0,0 +1 @@
+YUI.add("gallery-recordset-storage-lite",function(b){var a;a=function(c){a.superclass.constructor.call(this,c);};a.NAME="RecordsetStorageLite";a.NS="storageLite";b.extend(a,b.Plugin.Base,{initializer:function(){this.publish("failure");this.publish("store");},store:function(c){b.StorageLite.on("storage-lite:ready",function(){var f=this.get("host"),d=f.getRecordsByIndex(0,f.getLength());b.each(d,function(e,i,h){h[i]=e.getValue();});try{b.StorageLite.setItem(c,d,true);this.fire("store",{},c,d);}catch(g){this.fire("failure",{},g);}},this);}});b.Plugin.RecordsetStorageLite=a;},"gallery-2011.04.06-19-44",{requires:["gallery-storage-lite","plugin"]});
View
42 build/gallery-recordset-storage-lite/gallery-recordset-storage-lite.js
@@ -0,0 +1,42 @@
+YUI.add('gallery-recordset-storage-lite', function(Y) {
+
+'use strict';
+
+var _class;
+
+_class = function (config) {
+ _class.superclass.constructor.call(this, config);
+};
+
+_class.NAME = 'RecordsetStorageLite';
+
+_class.NS = 'storageLite';
+
+Y.extend(_class, Y.Plugin.Base, {
+ initializer: function () {
+ this.publish('failure');
+ this.publish('store');
+ },
+ store: function (key) {
+ Y.StorageLite.on('storage-lite:ready', function () {
+ var host = this.get('host'),
+ records = host.getRecordsByIndex(0, host.getLength());
+
+ Y.each(records, function (record, index, records) {
+ records[index] = record.getValue();
+ });
+
+ try {
+ Y.StorageLite.setItem(key, records, true);
+ this.fire('store', {}, key, records);
+ } catch (e) {
+ this.fire('failure', {}, e);
+ }
+ }, this);
+ }
+});
+
+Y.Plugin.RecordsetStorageLite = _class;
+
+
+}, 'gallery-2011.04.06-19-44' ,{requires:['gallery-storage-lite','plugin']});
View
BIN build/gallery-split-desktop/assets/center-handle.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/gallery-split-desktop/assets/drag-here.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
105 build/gallery-split-desktop/assets/gallery-split-desktop-core.css
@@ -0,0 +1,105 @@
+HTML {
+ overflow-y: auto;/* optional hidden XX */
+ display: none;/* set to visible with JS */
+}
+
+/* keeps the whole thing centered */
+#ea_page_wrapper{
+ border: 1px solid #99cccc;
+ width: 960px;
+ top: 0px;
+ padding: 5px;
+ overflow: hidden; /* cover scrollbar on ea_sw-se */
+ position:relative;
+ margin-left: auto !important;
+ margin-right: auto !important;
+
+}
+
+#ea_crown {
+ background-color:#fff;
+ width:100%;
+ border: none;
+ overflow:hidden;/* this is required for float pushing*/
+ position:relative;/* this is required for float pushing*/
+ float:left;/* not needed but possible */
+}
+
+#ea_nw{
+ width:100%;
+ height: 100%;
+ position:absolute;
+ top: 0px;
+ background: transparent url(../../pix-blue.gif) repeat-x bottom;
+
+}
+
+#ea_body_nw{
+ padding-top: 6px;
+ padding-left: 6px;
+ padding-right: 0px;
+ overflow-y:auto;
+ overflow-x:hidden;
+}
+
+#ea_ne{
+ border: none;
+ border-left:none;
+ width:810px;
+ height: 30px;
+ float:right;
+ position:relative;
+ overflow:hidden;
+ background-color: white;
+ /* shift border */
+ padding-left: 12px; /* room for handle */
+ padding-bottom: 10px;
+ padding-top: 0px;
+}
+
+#ea_borders{
+ border-left: 4px solid #99cccc;
+ border-bottom: 4px solid #99cccc;
+ width: 100%;
+ height: 100%;
+ padding-top: 6px;/* padding for text */
+ padding-left: 17px;/* padding for text */
+ padding-right: 7px;/* padding for text */
+
+}
+
+#ea_body_ne{
+ padding-top: 0px;
+ width: 100%;
+ height: 100%;
+ overflow-x:hidden;
+ margin-left: -5px; /* hide the scroll bar */
+}
+
+#ea_main{
+ height: 700px;
+ border: none;
+ clear: both;
+ background-repeat: no-repeat;
+ background: transparent url(../../drag-here.png) no-repeat 162px 7px; /* xx */
+ overflow-y: auto;
+ overflow-x: hidden;
+ width: 981px;/* hide scrollbar behind page_wrapper */
+}
+
+#ea_body_main{
+ padding: 6px;
+}
+
+#ea_handle {
+ cursor: move;
+ position:absolute;
+ bottom:0px;
+ left:0px;
+}
+
+/*
+pushing float layout as in http://www.sitepoint.com/examples/clearing_floats/example2.php
+*/
+
+
View
BIN build/gallery-split-desktop/assets/pix-blue.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN build/gallery-split-desktop/assets/split-desktop-demo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
402 build/gallery-split-desktop/gallery-split-desktop-debug.js
@@ -0,0 +1,402 @@
+YUI.add('gallery-split-desktop', function(Y) {
+
+ var PX = 'px',
+ POUND = '#',
+ HTML = 'HTML',
+ WIDTH = 'width',
+ HEIGHT = 'height',
+ BACKGROUNDIMAGE = 'backgroundImage',
+ BACKGROUNDPOSITION = 'backgroundPosition',
+ PATH_TO_IMAGES = 'assets/',
+ FALLBACK_PATH = '/gallery-split-desktop/',
+ PAGE_DEF_WIDTH = 960,
+ NW_MIN_WIDTH = 150,
+ DEF_MAIN_HEIGHT = 700,
+ DEF_CROWN_HEIGHT = 30,
+ DRAG_HERE_IMG = 'drag-here.png',
+ DRAG_HERE_IMG_URL = PATH_TO_IMAGES + DRAG_HERE_IMG,
+ DRAG_HERE_IMG_LEFT = 162,
+ DRAG_HERE_IMG_TOP = 7,
+ HANDLE_IMG = 'center-handle.png',
+ HANDLE_IMG_TPL = null,
+ HANDLE_ID = 'handle',
+ DEF_PREFIX = 'ea_',
+ ID_OPEN_TPL = 'id="',
+ ID_CLOSE_TPL = '" ',
+ IMG_OPEN_TPL = '<img ',
+ SRC_OPEN_TPL = 'src="',
+ SRC_CLOSE_TPL = '" ',
+ IMG_CLOSE_TPL = '/>',
+ BORDERS_COLOR = POUND + '99cccc',
+ BORDER_PIX_IMG = 'pix-blue.gif',
+ BORDER_PIX_URL = PATH_TO_IMAGES + BORDER_PIX_IMG,
+ FULL_DESKTOP = {
+ wrapper: 'page_wrapper',
+ crown: 'crown',
+ nw: 'nw',
+ nwbody: 'body_nw',
+ ne: 'ne',
+ borders: 'borders',
+ nebody: 'body_ne',
+ main: 'main'
+ },
+ PAGE_WIDTH_CONF = 'pageWidth',
+ BORDERS_COLOR_CONF = 'bordersColor',
+ DRAG_HERE_IMG_CONF = 'dragHereImg',
+ PATH_TO_IMAGES_CONF = 'pathToImages',
+ BORDER_PIX_CONF = 'borderPixImg',
+ HANDLE_IMG_CONF = 'handleImg',
+ DRAG_HERE_LEFT_CONF = 'dragHereLeft',
+ DRAG_HERE_TOP_CONF = 'dragHereTop',
+ MAIN_HEIGHT_CONF = 'mainHeight',
+ CROWN_HEIGHT_CONF = 'crownHeight',
+ PREFIX_CONF = 'prefix',
+ /*
+ default provided here, updated if PREFIX is customized.
+ Corresponding nodes are fetched after configuration based on updated selector
+ */
+ RESIZER_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.ne,
+ SECONDARY_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.nwbody,
+ MAIN_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.main,
+ WRAPPER_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.wrapper,
+ /* static vars used by reposition script */
+ resizerNode = null,
+ secondaryNode = null,
+ mainNode = null,
+ handleImgNode = null,
+ ddHandle = null,
+ started = false,
+ totW = 0,
+ w = 0,
+ h = 0,
+ MARGIN = 5;
+
+ /* class constructor */
+ function SplitDesktop(config) {
+ SplitDesktop.superclass.constructor.apply(this, arguments);
+ }
+
+ SplitDesktop.NAME = "splitDesktop";
+
+
+ SplitDesktop.ATTRS = {
+
+ boundingBox : {
+ value: HTML
+ },
+ contentBox : {
+ value: "page_wrapper"
+ },
+ pageWidth : {
+ value: PAGE_DEF_WIDTH + PX
+ },
+ bodyHeight: {
+ value: DEF_MAIN_HEIGHT + PX
+ },
+ dragHereImg: {
+ value: DRAG_HERE_IMG
+ },
+ pathToImages: {
+ value: PATH_TO_IMAGES
+ },
+ pathToStyles: {
+ value: PATH_TO_IMAGES
+ },
+ pointerLeftPos: {
+ value: DRAG_HERE_IMG_LEFT + PX
+ },
+ pointerTopPos: {
+ value: DRAG_HERE_IMG_TOP + PX
+ },
+ handleImage: {
+ value: HANDLE_IMG
+ },
+ handleId: {
+ value: HANDLE_ID
+ },
+ dragHereImgPath: {
+ value: DRAG_HERE_IMG_URL
+ },
+ defaultPrefix: {
+ value: DEF_PREFIX
+ },
+ mainDivId: {
+ value: FULL_DESKTOP.main
+ },
+ bordersColor: {
+ value: BORDERS_COLOR
+ },
+ borderPixImg: {
+ value: BORDER_PIX_URL
+ },
+ markupIsValidated : {
+ value: null
+ },
+ handleImg: {
+ value: HANDLE_IMG
+ },
+ dragHereLeft: {
+ value: DRAG_HERE_IMG_LEFT + PX
+ },
+ dragHereTop: {
+ value: DRAG_HERE_IMG_TOP + PX
+ },
+ mainHeight: {
+ value: DEF_MAIN_HEIGHT + PX
+ },
+ crownHeight: {
+ value: DEF_CROWN_HEIGHT + PX
+ },
+ prefix: {
+ value: DEF_PREFIX
+ },
+ baseUrl: {
+ getter: '_getBaseUrl',
+ lazyAdd: false
+ }
+ };
+
+
+ Y.extend(SplitDesktop, Y.Widget, {
+
+ initializer: function (config) {
+ var BASE_URL = this.get('baseUrl'),
+ i,
+ HANDLE_IMG_URL = BASE_URL + PATH_TO_IMAGES + HANDLE_IMG;
+
+ HANDLE_IMG_TPL = IMG_OPEN_TPL + ID_OPEN_TPL + DEF_PREFIX + HANDLE_ID + ID_CLOSE_TPL + SRC_OPEN_TPL + HANDLE_IMG_URL + SRC_CLOSE_TPL + IMG_CLOSE_TPL
+
+ Y.log('HANDLE_IMG_TPL ' + HANDLE_IMG_TPL, 'info', SplitDesktop.NAME);
+ for (i in config) {
+ if (config.hasOwnProperty(i)) {
+ Y.log('initializer is checking user config for: ' + i, 'info', SplitDesktop.NAME);
+ switch (i) {
+ case PAGE_WIDTH_CONF:
+ PAGE_DEF_WIDTH = this.get(i);
+ var ne = PAGE_DEF_WIDTH - NW_MIN_WIDTH;/* */
+ /* nw div is always 150 and comes auto from page_wrapper - ne */
+ Y.log('initializer is updating ' + i + ' with: ' + config[i] + PX, 'info', SplitDesktop.NAME);
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.wrapper).setStyle('width', PAGE_DEF_WIDTH);
+ /*adjust ne accordingly */
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.ne).setStyle('width', ne);
+ break;
+ case BORDERS_COLOR_CONF:
+ var c = this.get(BORDERS_COLOR_CONF); /**/
+ Y.log('initializer is updating ' + i + ' with: ' + config[i], 'info', SplitDesktop.NAME);
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.borders).setStyle('borderLeftColor', c).setStyle('borderBottomColor', c);
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.wrapper).setStyle('borderColor', c);
+ break;
+ case DRAG_HERE_IMG_CONF:
+ case PATH_TO_IMAGES_CONF:
+ case BORDER_PIX_CONF:
+ case HANDLE_IMG_CONF:
+ /**
+ If base url is on CDN we will either have inside Y.config a property of 'gallery' or alternatively fullpath.
+ In case we have gallery => assume CDN (Y.Env.cdn is the base url)
+ In case we have fullpath => assume js file is inside root of package basedir (Y.config.fullpath ) is the baseurl
+ */
+ Y.log('initializer is updating ' + i + ' with: ' + config[i], 'info', SplitDesktop.NAME);
+ DRAG_HERE_IMG_URL = this.get(PATH_TO_IMAGES_CONF) + this.get(DRAG_HERE_IMG_CONF);
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.main).setStyle(BACKGROUNDIMAGE, 'url("' + DRAG_HERE_IMG_URL + '")');
+
+ BORDER_PIX_URL = this.get(PATH_TO_IMAGES_CONF) + this.get(BORDER_PIX_CONF);
+
+ if (i === BORDER_PIX_CONF || i === PATH_TO_IMAGES_CONF) {
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.nw).setStyle(BACKGROUNDIMAGE, BORDER_PIX_URL);
+ }
+ /* create handle and place it in resizer div */
+ if (i === HANDLE_IMG_CONF || i === PATH_TO_IMAGES_CONF) {
+ DEF_PREFIX = this.get(PREFIX_CONF);
+ HANDLE_IMG_URL = this.get(PATH_TO_IMAGES_CONF) + this.get(HANDLE_IMG_CONF);
+ HANDLE_IMG_TPL = IMG_OPEN_TPL + ID_OPEN_TPL + DEF_PREFIX + HANDLE_ID + ID_CLOSE_TPL + SRC_OPEN_TPL + HANDLE_IMG_URL + SRC_CLOSE_TPL + IMG_CLOSE_TPL;
+ }
+ break;
+ case DRAG_HERE_LEFT_CONF:
+ Y.log('initializer is updating ' + i + ' with: ' + config[i] + PX, 'info', SplitDesktop.NAME);
+ DEF_PREFIX = this.get(PREFIX_CONF);
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.main).setStyle(BACKGROUNDPOSITION, this.get(DRAG_HERE_LEFT_CONF) + PX + ' ' + this.get(DRAG_HERE_TOP_CONF) + PX);
+ break;
+ case DRAG_HERE_TOP_CONF:
+ Y.log('initializer is updating ' + i + ' with: ' + config[i] + PX, 'info', SplitDesktop.NAME);
+ DEF_PREFIX = this.get(PREFIX_CONF);
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.main).setStyle(BACKGROUNDPOSITION, this.get(DRAG_HERE_LEFT_CONF) + PX + ' ' + this.get(DRAG_HERE_TOP_CONF) + PX);
+ break;
+ case MAIN_HEIGHT_CONF:
+ Y.log('initializer is updating ' + i + ' with: ' + config[i] + PX, 'info', SplitDesktop.NAME);
+ DEF_PREFIX = this.get(PREFIX_CONF);
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.main).setStyle(HEIGHT, this.get(MAIN_HEIGHT_CONF) + PX);
+ break;
+ case CROWN_HEIGHT_CONF:
+ Y.log('initializer is updating ' + i + ' with: ' + config[i] + PX, 'info', SplitDesktop.NAME);
+ DEF_PREFIX = this.get(PREFIX_CONF);
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.ne).setStyle(HEIGHT, this.get(CROWN_HEIGHT_CONF) + PX);
+ break;
+ case PREFIX_CONF:
+ Y.log('initializer is updating ' + i + ' with: ' + config[i], 'info', SplitDesktop.NAME);
+ DEF_PREFIX = this.get(PREFIX_CONF);
+ /* update selectors with new prefix */
+ RESIZER_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.ne;
+ SECONDARY_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.nwbody;
+ MAIN_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.main;
+ WRAPPER_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.wrapper;
+ /* update img tpl with new prefix */
+ HANDLE_IMG_TPL = IMG_OPEN_TPL + ID_OPEN_TPL + DEF_PREFIX + HANDLE_ID + ID_CLOSE_TPL + SRC_OPEN_TPL + HANDLE_IMG_URL + SRC_CLOSE_TPL + IMG_CLOSE_TPL;
+ break;
+ }
+ }
+ }
+
+ /* some events to be used by subclasses to focus on diff areas */
+ this.publish("enterCrown", {
+ defaultFn: this._defEnterCrownFn,
+ bubbles: false
+ });
+
+ this.publish("enterMain", {
+ defaultFn: this._defEnterMainFn,
+ bubbles: false
+ });
+
+ this.publish("enterSecondary", {
+ defaultFn: this._defEnterSecondaryFn,
+ bubbles: false
+ });
+
+ this.publish("enterResizer", {
+ defaultFn: this._defEnterResizerFn,
+ bubbles: false
+ });
+
+ },
+
+ renderUI : function () {
+
+ resizerNode = Y.one(RESIZER_SELECTOR);
+ handleImgNode = Y.Node.create(HANDLE_IMG_TPL, resizerNode);
+ resizerNode.append(handleImgNode);
+ /* make the handle draggable */
+ ddHandle = new Y.DD.Drag({node: POUND + DEF_PREFIX + HANDLE_ID});
+ ddHandle.plug(Y.Plugin.DDConstrained, {
+ constrain2node: WRAPPER_SELECTOR
+ });
+ },
+
+ bindUI : function () {
+
+ ddHandle.on('drag:start', this._onDragStart);
+ ddHandle.on('drag:drag', this._onDragDrag);
+ ddHandle.on('drag:end', this._onDragEnd);
+ },
+
+ syncUI : function () {
+ /* Now make the page visible */
+ Y.one(HTML).setStyle('display', 'block');
+
+ },
+
+ _onDragStart : function (e) {
+ /* remove background from main */
+ mainNode = Y.one(MAIN_SELECTOR);
+ switch (started) {
+ case false:
+ mainNode.setStyle(BACKGROUNDIMAGE, 'none');
+ case true:
+ h = parseInt(resizerNode.getStyle(HEIGHT).toString().replace(PX, ''), 10);
+ w = parseInt(resizerNode.getStyle(WIDTH).toString().replace(PX, ''), 10);
+ started = true;
+ break;
+ }
+ },
+
+ _onDragDrag : function (e) {
+ secondaryNode = Y.one(SECONDARY_SELECTOR);
+ resizerNode = Y.one(RESIZER_SELECTOR);
+
+ /* get values */
+ var deltaW = parseInt(e.info.offset[0], 10),
+ deltaH = parseInt(e.info.offset[1], 10);
+
+ totW = w - deltaW;
+ resizerNode.setStyle(WIDTH, totW);
+ resizerNode.setStyle(HEIGHT, h + deltaH);
+
+ secondaryNode.setStyle(WIDTH, PAGE_DEF_WIDTH - totW + MARGIN);
+ secondaryNode.setStyle(HEIGHT, h + deltaH);
+ },
+
+ _onDragEnd : function (e) {
+ /*
+ reposition to 00 pos in resizer window
+ the window width might have changed from the drag:start due to scrollbars,
+ hence the currrent x y is not necessarily at the bottom left corner of the window
+ */
+ handleImgNode.setStyle('left', 0);
+ handleImgNode.setStyle('bottom', 0);
+ },
+
+ /**
+ * @protected
+ *
+ */
+
+ _defEnterCrownFn : function (e) {
+ this.fire('enterCrown');
+ },
+
+ _defEnterMainFn : function (e) {
+ this.fire('enterMain');
+ },
+
+ _defEnterSecondaryFn : function (e) {
+ this.fire('enterSecondary');
+ },
+
+ _defEnterResizerFn : function (e) {
+ this.fire('enterResizer');
+ },
+
+ _getBaseUrl : function () {
+ Y.log("setting baseurl. Dumping config if Y.dump is present", 'info', SplitDesktop.NAME);
+ if(Y.dump){ Y.log(Y.dump(Y.config))};
+ if(Y.config.modules){
+ if(Y.config.modules['gallery-split-desktop']){
+ /* defined as single module */
+ if(Y.config.modules['gallery-split-desktop'].gallery){
+ /* source is on CDN */
+ Y.log("Baseurl is on CDN for this module");
+ return Y.Env.base + Y.config.modules['gallery-split-desktop'].gallery + '/build';
+
+ }else if(Y.config.modules['gallery-split-desktop'].fullpath){
+ //extract root, assets relative to root
+ Y.log("Baseurl based on fullpath for this module", 'info', SplitDesktop.NAME);
+ var url = Y.config.modules['gallery-split-desktop'].fullpath;
+ return url.substring(0,url.lastIndexOf('/')+1);
+
+ }else if(Y.config.modules.base){
+ Y.log("Baseurl is base this module", 'info', SplitDesktop.NAME);
+ return Y.config.modules.base;
+ }
+ }
+ }else if(Y.config.gallery){
+ /* source is general gallery url */
+ Y.log("Baseurl is on CDN", 'info', SplitDesktop.NAME);
+ return Y.Env.base + Y.config.gallery + '/build';
+
+ }else if(Y.config.fullpath){
+ //extract root, assets relative to root
+ var url = Y.config.fullpath;
+ Y.log("Baseurl based on general fullpath", 'info', SplitDesktop.NAME);
+ return url.substring(0,lastIndexOf('/',url)+1);
+
+ }else{
+ Y.log("Baseurl based on fallback path", 'info', SplitDesktop.NAME);
+ return FALLBACK_PATH;
+ }
+ }
+
+ });//return Y.Env.base + Y.config.gallery + '/build';
+
+ Y.namespace('sdt').SplitDesktop = SplitDesktop;
+
+
+}, 'gallery-2011.04.06-19-44' ,{requires:['widget','dd-constrain']});
View
1 build/gallery-split-desktop/gallery-split-desktop-min.js
@@ -0,0 +1 @@
+YUI.add("gallery-split-desktop",function(b){var af="px",B="#",W="HTML",d="width",J="height",ai="backgroundImage",l="backgroundPosition",i="assets/",m="/gallery-split-desktop/",M=960,I=150,r=700,E=30,p="drag-here.png",t=i+p,U=162,y=7,aa="center-handle.png",k=null,a="handle",C="ea_",z='id="',O='" ',g="<img ",Z='src="',o='" ',s="/>",v=B+"99cccc",D="pix-blue.gif",A=i+D,ab={wrapper:"page_wrapper",crown:"crown",nw:"nw",nwbody:"body_nw",ne:"ne",borders:"borders",nebody:"body_ne",main:"main"},T="pageWidth",S="bordersColor",F="dragHereImg",j="pathToImages",Q="borderPixImg",x="handleImg",f="dragHereLeft",c="dragHereTop",ae="mainHeight",q="crownHeight",G="prefix",ad=B+C+ab.ne,X=B+C+ab.nwbody,L=B+C+ab.main,e=B+C+ab.wrapper,K=null,u=null,n=null,H=null,ac=null,ag=false,ah=0,N=0,V=0,P=5;function R(h){R.superclass.constructor.apply(this,arguments);}R.NAME="splitDesktop";R.ATTRS={boundingBox:{value:W},contentBox:{value:"page_wrapper"},pageWidth:{value:M+af},bodyHeight:{value:r+af},dragHereImg:{value:p},pathToImages:{value:i},pathToStyles:{value:i},pointerLeftPos:{value:U+af},pointerTopPos:{value:y+af},handleImage:{value:aa},handleId:{value:a},dragHereImgPath:{value:t},defaultPrefix:{value:C},mainDivId:{value:ab.main},bordersColor:{value:v},borderPixImg:{value:A},markupIsValidated:{value:null},handleImg:{value:aa},dragHereLeft:{value:U+af},dragHereTop:{value:y+af},mainHeight:{value:r+af},crownHeight:{value:E+af},prefix:{value:C},baseUrl:{getter:"_getBaseUrl",lazyAdd:false}};b.extend(R,b.Widget,{initializer:function(w){var ak=this.get("baseUrl"),Y,h=ak+i+aa;k=g+z+C+a+O+Z+h+o+s;for(Y in w){if(w.hasOwnProperty(Y)){switch(Y){case T:M=this.get(Y);var aj=M-I;b.one(B+C+ab.wrapper).setStyle("width",M);b.one(B+C+ab.ne).setStyle("width",aj);break;case S:var al=this.get(S);b.one(B+C+ab.borders).setStyle("borderLeftColor",al).setStyle("borderBottomColor",al);b.one(B+C+ab.wrapper).setStyle("borderColor",al);break;case F:case j:case Q:case x:t=this.get(j)+this.get(F);b.one(B+C+ab.main).setStyle(ai,'url("'+t+'")');A=this.get(j)+this.get(Q);if(Y===Q||Y===j){b.one(B+C+ab.nw).setStyle(ai,A);}if(Y===x||Y===j){C=this.get(G);h=this.get(j)+this.get(x);k=g+z+C+a+O+Z+h+o+s;}break;case f:C=this.get(G);b.one(B+C+ab.main).setStyle(l,this.get(f)+af+" "+this.get(c)+af);break;case c:C=this.get(G);b.one(B+C+ab.main).setStyle(l,this.get(f)+af+" "+this.get(c)+af);break;case ae:C=this.get(G);b.one(B+C+ab.main).setStyle(J,this.get(ae)+af);break;case q:C=this.get(G);b.one(B+C+ab.ne).setStyle(J,this.get(q)+af);break;case G:C=this.get(G);ad=B+C+ab.ne;X=B+C+ab.nwbody;L=B+C+ab.main;e=B+C+ab.wrapper;k=g+z+C+a+O+Z+h+o+s;break;}}}this.publish("enterCrown",{defaultFn:this._defEnterCrownFn,bubbles:false});this.publish("enterMain",{defaultFn:this._defEnterMainFn,bubbles:false});this.publish("enterSecondary",{defaultFn:this._defEnterSecondaryFn,bubbles:false});this.publish("enterResizer",{defaultFn:this._defEnterResizerFn,bubbles:false});},renderUI:function(){K=b.one(ad);H=b.Node.create(k,K);K.append(H);ac=new b.DD.Drag({node:B+C+a});ac.plug(b.Plugin.DDConstrained,{constrain2node:e});},bindUI:function(){ac.on("drag:start",this._onDragStart);ac.on("drag:drag",this._onDragDrag);ac.on("drag:end",this._onDragEnd);},syncUI:function(){b.one(W).setStyle("display","block");},_onDragStart:function(h){n=b.one(L);switch(ag){case false:n.setStyle(ai,"none");case true:V=parseInt(K.getStyle(J).toString().replace(af,""),10);N=parseInt(K.getStyle(d).toString().replace(af,""),10);ag=true;break;}},_onDragDrag:function(Y){u=b.one(X);K=b.one(ad);var h=parseInt(Y.info.offset[0],10),w=parseInt(Y.info.offset[1],10);ah=N-h;K.setStyle(d,ah);K.setStyle(J,V+w);u.setStyle(d,M-ah+P);u.setStyle(J,V+w);},_onDragEnd:function(h){H.setStyle("left",0);H.setStyle("bottom",0);},_defEnterCrownFn:function(h){this.fire("enterCrown");},_defEnterMainFn:function(h){this.fire("enterMain");},_defEnterSecondaryFn:function(h){this.fire("enterSecondary");},_defEnterResizerFn:function(h){this.fire("enterResizer");},_getBaseUrl:function(){if(b.config.modules){if(b.config.modules["gallery-split-desktop"]){if(b.config.modules["gallery-split-desktop"].gallery){return b.Env.base+b.config.modules["gallery-split-desktop"].gallery+"/build";}else{if(b.config.modules["gallery-split-desktop"].fullpath){var h=b.config.modules["gallery-split-desktop"].fullpath;return h.substring(0,h.lastIndexOf("/")+1);}else{if(b.config.modules.base){return b.config.modules.base;}}}}}else{if(b.config.gallery){return b.Env.base+b.config.gallery+"/build";}else{if(b.config.fullpath){var h=b.config.fullpath;return h.substring(0,lastIndexOf("/",h)+1);}else{return m;}}}}});b.namespace("sdt").SplitDesktop=R;},"gallery-2011.04.06-19-44",{requires:["widget","dd-constrain"]});
View
384 build/gallery-split-desktop/gallery-split-desktop.js
@@ -0,0 +1,384 @@
+YUI.add('gallery-split-desktop', function(Y) {
+
+ var PX = 'px',
+ POUND = '#',
+ HTML = 'HTML',
+ WIDTH = 'width',
+ HEIGHT = 'height',
+ BACKGROUNDIMAGE = 'backgroundImage',
+ BACKGROUNDPOSITION = 'backgroundPosition',
+ PATH_TO_IMAGES = 'assets/',
+ FALLBACK_PATH = '/gallery-split-desktop/',
+ PAGE_DEF_WIDTH = 960,
+ NW_MIN_WIDTH = 150,
+ DEF_MAIN_HEIGHT = 700,
+ DEF_CROWN_HEIGHT = 30,
+ DRAG_HERE_IMG = 'drag-here.png',
+ DRAG_HERE_IMG_URL = PATH_TO_IMAGES + DRAG_HERE_IMG,
+ DRAG_HERE_IMG_LEFT = 162,
+ DRAG_HERE_IMG_TOP = 7,
+ HANDLE_IMG = 'center-handle.png',
+ HANDLE_IMG_TPL = null,
+ HANDLE_ID = 'handle',
+ DEF_PREFIX = 'ea_',
+ ID_OPEN_TPL = 'id="',
+ ID_CLOSE_TPL = '" ',
+ IMG_OPEN_TPL = '<img ',
+ SRC_OPEN_TPL = 'src="',
+ SRC_CLOSE_TPL = '" ',
+ IMG_CLOSE_TPL = '/>',
+ BORDERS_COLOR = POUND + '99cccc',
+ BORDER_PIX_IMG = 'pix-blue.gif',
+ BORDER_PIX_URL = PATH_TO_IMAGES + BORDER_PIX_IMG,
+ FULL_DESKTOP = {
+ wrapper: 'page_wrapper',
+ crown: 'crown',
+ nw: 'nw',
+ nwbody: 'body_nw',
+ ne: 'ne',
+ borders: 'borders',
+ nebody: 'body_ne',
+ main: 'main'
+ },
+ PAGE_WIDTH_CONF = 'pageWidth',
+ BORDERS_COLOR_CONF = 'bordersColor',
+ DRAG_HERE_IMG_CONF = 'dragHereImg',
+ PATH_TO_IMAGES_CONF = 'pathToImages',
+ BORDER_PIX_CONF = 'borderPixImg',
+ HANDLE_IMG_CONF = 'handleImg',
+ DRAG_HERE_LEFT_CONF = 'dragHereLeft',
+ DRAG_HERE_TOP_CONF = 'dragHereTop',
+ MAIN_HEIGHT_CONF = 'mainHeight',
+ CROWN_HEIGHT_CONF = 'crownHeight',
+ PREFIX_CONF = 'prefix',
+ /*
+ default provided here, updated if PREFIX is customized.
+ Corresponding nodes are fetched after configuration based on updated selector
+ */
+ RESIZER_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.ne,
+ SECONDARY_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.nwbody,
+ MAIN_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.main,
+ WRAPPER_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.wrapper,
+ /* static vars used by reposition script */
+ resizerNode = null,
+ secondaryNode = null,
+ mainNode = null,
+ handleImgNode = null,
+ ddHandle = null,
+ started = false,
+ totW = 0,
+ w = 0,
+ h = 0,
+ MARGIN = 5;
+
+ /* class constructor */
+ function SplitDesktop(config) {
+ SplitDesktop.superclass.constructor.apply(this, arguments);
+ }
+
+ SplitDesktop.NAME = "splitDesktop";
+
+
+ SplitDesktop.ATTRS = {
+
+ boundingBox : {
+ value: HTML
+ },
+ contentBox : {
+ value: "page_wrapper"
+ },
+ pageWidth : {
+ value: PAGE_DEF_WIDTH + PX
+ },
+ bodyHeight: {
+ value: DEF_MAIN_HEIGHT + PX
+ },
+ dragHereImg: {
+ value: DRAG_HERE_IMG
+ },
+ pathToImages: {
+ value: PATH_TO_IMAGES
+ },
+ pathToStyles: {
+ value: PATH_TO_IMAGES
+ },
+ pointerLeftPos: {
+ value: DRAG_HERE_IMG_LEFT + PX
+ },
+ pointerTopPos: {
+ value: DRAG_HERE_IMG_TOP + PX
+ },
+ handleImage: {
+ value: HANDLE_IMG
+ },
+ handleId: {
+ value: HANDLE_ID
+ },
+ dragHereImgPath: {
+ value: DRAG_HERE_IMG_URL
+ },
+ defaultPrefix: {
+ value: DEF_PREFIX
+ },
+ mainDivId: {
+ value: FULL_DESKTOP.main
+ },
+ bordersColor: {
+ value: BORDERS_COLOR
+ },
+ borderPixImg: {
+ value: BORDER_PIX_URL
+ },
+ markupIsValidated : {
+ value: null
+ },
+ handleImg: {
+ value: HANDLE_IMG
+ },
+ dragHereLeft: {
+ value: DRAG_HERE_IMG_LEFT + PX
+ },
+ dragHereTop: {
+ value: DRAG_HERE_IMG_TOP + PX
+ },
+ mainHeight: {
+ value: DEF_MAIN_HEIGHT + PX
+ },
+ crownHeight: {
+ value: DEF_CROWN_HEIGHT + PX
+ },
+ prefix: {
+ value: DEF_PREFIX
+ },
+ baseUrl: {
+ getter: '_getBaseUrl',
+ lazyAdd: false
+ }
+ };
+
+
+ Y.extend(SplitDesktop, Y.Widget, {
+
+ initializer: function (config) {
+ var BASE_URL = this.get('baseUrl'),
+ i,
+ HANDLE_IMG_URL = BASE_URL + PATH_TO_IMAGES + HANDLE_IMG;
+
+ HANDLE_IMG_TPL = IMG_OPEN_TPL + ID_OPEN_TPL + DEF_PREFIX + HANDLE_ID + ID_CLOSE_TPL + SRC_OPEN_TPL + HANDLE_IMG_URL + SRC_CLOSE_TPL + IMG_CLOSE_TPL
+
+ for (i in config) {
+ if (config.hasOwnProperty(i)) {
+ switch (i) {
+ case PAGE_WIDTH_CONF:
+ PAGE_DEF_WIDTH = this.get(i);
+ var ne = PAGE_DEF_WIDTH - NW_MIN_WIDTH;/* */
+ /* nw div is always 150 and comes auto from page_wrapper - ne */
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.wrapper).setStyle('width', PAGE_DEF_WIDTH);
+ /*adjust ne accordingly */
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.ne).setStyle('width', ne);
+ break;
+ case BORDERS_COLOR_CONF:
+ var c = this.get(BORDERS_COLOR_CONF); /**/
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.borders).setStyle('borderLeftColor', c).setStyle('borderBottomColor', c);
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.wrapper).setStyle('borderColor', c);
+ break;
+ case DRAG_HERE_IMG_CONF:
+ case PATH_TO_IMAGES_CONF:
+ case BORDER_PIX_CONF:
+ case HANDLE_IMG_CONF:
+ /**
+ If base url is on CDN we will either have inside Y.config a property of 'gallery' or alternatively fullpath.
+ In case we have gallery => assume CDN (Y.Env.cdn is the base url)
+ In case we have fullpath => assume js file is inside root of package basedir (Y.config.fullpath ) is the baseurl
+ */
+ DRAG_HERE_IMG_URL = this.get(PATH_TO_IMAGES_CONF) + this.get(DRAG_HERE_IMG_CONF);
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.main).setStyle(BACKGROUNDIMAGE, 'url("' + DRAG_HERE_IMG_URL + '")');
+
+ BORDER_PIX_URL = this.get(PATH_TO_IMAGES_CONF) + this.get(BORDER_PIX_CONF);
+
+ if (i === BORDER_PIX_CONF || i === PATH_TO_IMAGES_CONF) {
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.nw).setStyle(BACKGROUNDIMAGE, BORDER_PIX_URL);
+ }
+ /* create handle and place it in resizer div */
+ if (i === HANDLE_IMG_CONF || i === PATH_TO_IMAGES_CONF) {
+ DEF_PREFIX = this.get(PREFIX_CONF);
+ HANDLE_IMG_URL = this.get(PATH_TO_IMAGES_CONF) + this.get(HANDLE_IMG_CONF);
+ HANDLE_IMG_TPL = IMG_OPEN_TPL + ID_OPEN_TPL + DEF_PREFIX + HANDLE_ID + ID_CLOSE_TPL + SRC_OPEN_TPL + HANDLE_IMG_URL + SRC_CLOSE_TPL + IMG_CLOSE_TPL;
+ }
+ break;
+ case DRAG_HERE_LEFT_CONF:
+ DEF_PREFIX = this.get(PREFIX_CONF);
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.main).setStyle(BACKGROUNDPOSITION, this.get(DRAG_HERE_LEFT_CONF) + PX + ' ' + this.get(DRAG_HERE_TOP_CONF) + PX);
+ break;
+ case DRAG_HERE_TOP_CONF:
+ DEF_PREFIX = this.get(PREFIX_CONF);
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.main).setStyle(BACKGROUNDPOSITION, this.get(DRAG_HERE_LEFT_CONF) + PX + ' ' + this.get(DRAG_HERE_TOP_CONF) + PX);
+ break;
+ case MAIN_HEIGHT_CONF:
+ DEF_PREFIX = this.get(PREFIX_CONF);
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.main).setStyle(HEIGHT, this.get(MAIN_HEIGHT_CONF) + PX);
+ break;
+ case CROWN_HEIGHT_CONF:
+ DEF_PREFIX = this.get(PREFIX_CONF);
+ Y.one(POUND + DEF_PREFIX + FULL_DESKTOP.ne).setStyle(HEIGHT, this.get(CROWN_HEIGHT_CONF) + PX);
+ break;
+ case PREFIX_CONF:
+ DEF_PREFIX = this.get(PREFIX_CONF);
+ /* update selectors with new prefix */
+ RESIZER_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.ne;
+ SECONDARY_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.nwbody;
+ MAIN_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.main;
+ WRAPPER_SELECTOR = POUND + DEF_PREFIX + FULL_DESKTOP.wrapper;
+ /* update img tpl with new prefix */
+ HANDLE_IMG_TPL = IMG_OPEN_TPL + ID_OPEN_TPL + DEF_PREFIX + HANDLE_ID + ID_CLOSE_TPL + SRC_OPEN_TPL + HANDLE_IMG_URL + SRC_CLOSE_TPL + IMG_CLOSE_TPL;
+ break;
+ }
+ }
+ }
+
+ /* some events to be used by subclasses to focus on diff areas */
+ this.publish("enterCrown", {
+ defaultFn: this._defEnterCrownFn,
+ bubbles: false
+ });
+
+ this.publish("enterMain", {
+ defaultFn: this._defEnterMainFn,
+ bubbles: false
+ });
+
+ this.publish("enterSecondary", {
+ defaultFn: this._defEnterSecondaryFn,
+ bubbles: false
+ });
+
+ this.publish("enterResizer", {
+ defaultFn: this._defEnterResizerFn,
+ bubbles: false
+ });
+
+ },
+
+ renderUI : function () {
+
+ resizerNode = Y.one(RESIZER_SELECTOR);
+ handleImgNode = Y.Node.create(HANDLE_IMG_TPL, resizerNode);
+ resizerNode.append(handleImgNode);
+ /* make the handle draggable */
+ ddHandle = new Y.DD.Drag({node: POUND + DEF_PREFIX + HANDLE_ID});
+ ddHandle.plug(Y.Plugin.DDConstrained, {
+ constrain2node: WRAPPER_SELECTOR
+ });
+ },
+
+ bindUI : function () {
+
+ ddHandle.on('drag:start', this._onDragStart);
+ ddHandle.on('drag:drag', this._onDragDrag);
+ ddHandle.on('drag:end', this._onDragEnd);
+ },
+
+ syncUI : function () {
+ /* Now make the page visible */
+ Y.one(HTML).setStyle('display', 'block');
+
+ },
+
+ _onDragStart : function (e) {
+ /* remove background from main */
+ mainNode = Y.one(MAIN_SELECTOR);
+ switch (started) {
+ case false:
+ mainNode.setStyle(BACKGROUNDIMAGE, 'none');
+ case true:
+ h = parseInt(resizerNode.getStyle(HEIGHT).toString().replace(PX, ''), 10);
+ w = parseInt(resizerNode.getStyle(WIDTH).toString().replace(PX, ''), 10);
+ started = true;
+ break;
+ }
+ },
+
+ _onDragDrag : function (e) {
+ secondaryNode = Y.one(SECONDARY_SELECTOR);
+ resizerNode = Y.one(RESIZER_SELECTOR);
+
+ /* get values */
+ var deltaW = parseInt(e.info.offset[0], 10),
+ deltaH = parseInt(e.info.offset[1], 10);
+
+ totW = w - deltaW;
+ resizerNode.setStyle(WIDTH, totW);
+ resizerNode.setStyle(HEIGHT, h + deltaH);
+
+ secondaryNode.setStyle(WIDTH, PAGE_DEF_WIDTH - totW + MARGIN);
+ secondaryNode.setStyle(HEIGHT, h + deltaH);
+ },
+
+ _onDragEnd : function (e) {
+ /*
+ reposition to 00 pos in resizer window
+ the window width might have changed from the drag:start due to scrollbars,
+ hence the currrent x y is not necessarily at the bottom left corner of the window
+ */
+ handleImgNode.setStyle('left', 0);
+ handleImgNode.setStyle('bottom', 0);
+ },
+
+ /**
+ * @protected
+ *
+ */
+
+ _defEnterCrownFn : function (e) {
+ this.fire('enterCrown');
+ },
+
+ _defEnterMainFn : function (e) {
+ this.fire('enterMain');
+ },
+
+ _defEnterSecondaryFn : function (e) {
+ this.fire('enterSecondary');
+ },
+
+ _defEnterResizerFn : function (e) {
+ this.fire('enterResizer');
+ },
+
+ _getBaseUrl : function () {
+ if(Y.config.modules){
+ if(Y.config.modules['gallery-split-desktop']){
+ /* defined as single module */
+ if(Y.config.modules['gallery-split-desktop'].gallery){
+ /* source is on CDN */
+ return Y.Env.base + Y.config.modules['gallery-split-desktop'].gallery + '/build';
+
+ }else if(Y.config.modules['gallery-split-desktop'].fullpath){
+ //extract root, assets relative to root
+ var url = Y.config.modules['gallery-split-desktop'].fullpath;
+ return url.substring(0,url.lastIndexOf('/')+1);
+
+ }else if(Y.config.modules.base){
+ return Y.config.modules.base;
+ }
+ }
+ }else if(Y.config.gallery){
+ /* source is general gallery url */
+ return Y.Env.base + Y.config.gallery + '/build';
+
+ }else if(Y.config.fullpath){
+ //extract root, assets relative to root
+ var url = Y.config.fullpath;
+ return url.substring(0,lastIndexOf('/',url)+1);
+
+ }else{
+ return FALLBACK_PATH;
+ }
+ }
+
+ });//return Y.Env.base + Y.config.gallery + '/build';
+
+ Y.namespace('sdt').SplitDesktop = SplitDesktop;
+
+
+}, 'gallery-2011.04.06-19-44' ,{requires:['widget','dd-constrain']});
View
1,113 build/gallery-yui-slideshow/gallery-yui-slideshow-debug.js
@@ -1,377 +1,894 @@
YUI.add('gallery-yui-slideshow', function(Y) {
- // Transitions:
-
- Y.Transitions = {
+/**
+ * A simple YUI3 slideshow kit inspired by the jQuery Cycle plugin.
+ * @module gallery-yui-slideshow
+ * @requires widget, transition, event-mouseenter
+ * @author Josh Lizarraga
+ */
- none: {},
- staticTL: {
- from: {
- top: 0,
- left: 0
- },
- to: {
- top: 0,
- left: 0
- }
- },
- staticTR: {
- from: {
- top: 0,
- right: 0
- },
- to: {
- top: 0,
- right: 0
- }
- },
- staticBL: {
- from: {
- bottom: 0,
- left: 0
- },
- to: {
- bottom: 0,
- left: 0
- }
- },
- staticBR: {
- from: {
- bottom: 0,
- right: 0
- },
- to: {
- bottom: 0,
- right: 0
- }
- },
- fadeIn: {
- from: {
- opacity: 0
- },
- to: {
- opacity: 1
- }
- },
- fadeOut: {
- from: {
- opacity: 1
- },
- to: {
- opacity: 0
- }
- },
- swipeInLTR: {
- from: {
- left: function(node){
- return parseInt(-(node.get('parentNode').get('offsetWidth')), 10);
+ /**
+ * @class Slideshow
+ * @constructor
+ * @param {Object} config Widget configuration object.
+ */
+ var Slideshow = function(config){
+
+ Slideshow.superclass.constructor.apply(this, arguments);
+
+ };
+
+ /**
+ * @property NAME
+ * @type String
+ * @default Slideshow
+ */
+ Slideshow.NAME = 'Slideshow';
+
+ // Presets:
+
+ Slideshow.PRESETS = {
+
+ /**
+ * Incoming slide fades in.
+ * Outgoing slide fades out.
+ * @property PRESETS.fade
+ * @type Preset Slide Transition
+ */
+ fade: {
+ slideIn: {
+ before: {
+ opacity: 0
+ },
+ transition: {
+ opacity: 1
}
},
- to: {
- left: 0
- }
- },
- swipeOutLTR: {
- from: {
- left: 0
- },
- to: {
- left: function(node){
- return parseInt(node.get('parentNode').get('offsetWidth'), 10);
+ slideOut: {
+ before: {
+ opacity: 1
+ },
+ transition: {
+ opacity: 0
}
}
},
- swipeInRTL: {
- from: {
- right: function(node){
- return parseInt(-(node.get('parentNode').get('offsetWidth')), 10);
+
+ /**
+ * Both slides slide from top to bottom.
+ * @property PRESETS.slideDown
+ * @type Preset Slide Transition
+ */
+ slideDown: {
+ slideIn: {
+ before: {
+ bottom: 'cH'
+ },
+ transition: {
+ bottom: '0px'
}
},
- to: {
- right: 0
- }
- },
- swipeOutRTL: {
- from: {
- right: 0
- },
- to: {
- right: function(node){
- return parseInt(node.get('parentNode').get('offsetWidth'), 10);
+ slideOut: {
+ before: {
+ bottom: '0px'
+ },
+ transition: {
+ bottom: '-cH'
}
}
},
- swipeInTTB: {
- from: {
- top: function(node){
- return parseInt(-(node.get('parentNode').get('offsetHeight')), 10);
+
+ /**
+ * Both slides slide from right to left.
+ * @property PRESETS.slideRight
+ * @type Preset Slide Transition
+ */
+ slideLeft: {
+ slideIn: {
+ before: {
+ right: '-cW'
+ },
+ transition: {
+ right: '0px'
}
},
- to: {
- top: 0
- }
- },
- swipeOutTTB: {
- from: {
- top: 0
- },
- to: {
- top: function(node){
- return parseInt(node.get('parentNode').get('offsetHeight'), 10);
+ slideOut: {
+ before: {
+ right: '0px'
+ },
+ transition: {
+ right: 'cW'
}
}
},
- swipeInBTT: {
- from: {
- bottom: function(node){
- return parseInt(-(node.get('parentNode').get('offsetHeight')), 10);
+
+ /**
+ * Both slides slide from bottom to top.
+ * @property PRESETS.slideUp
+ * @type Preset Slide Transition
+ */
+ slideUp: {
+ slideIn: {
+ before: {
+ top: 'cH'
+ },
+ transition: {
+ top: '0px'
}
},
- to: {
- bottom: 0
+ slideOut: {
+ before: {
+ top: '0px'
+ },
+ transition: {
+ top: '-cH'
+ }
}
},
- swipeOutBTT: {
- from: {
- bottom: 0
+
+ /**
+ * Both slides slide from left to right.
+ * @property PRESETS.slideRight
+ * @type Preset Slide Transition
+ */
+ slideRight: {
+ slideIn: {
+ before: {
+ left: '-cW'
+ },
+ transition: {
+ left: '0px'
+ }
},
- to: {
- bottom: function(node){
- return parseInt(node.get('parentNode').get('offsetHeight'), 10);
+ slideOut: {
+ before: {
+ left: '0px'
+ },
+ transition: {
+ left: 'cW'
}
}
}
-
- }; // Y.Transitions
+
+ };
- Y.Slideshow = function(pTarget, pConfig){
+ // Attributes:
+
+ Slideshow.ATTRS = {
- // Target:
+ /**
+ * Slides NodeList instance.
+ * @attribute slides
+ * @type NodeList
+ * @default null
+ */
+ slides: {
+ value: null
+ },
- switch(typeof(pTarget)){
-
- case 'string':
-
- this.id = (pTarget.indexOf('#') === 0) ? pTarget : '#' + pTarget;
- this.container = Y.one(this.id);
- break;
-
- case 'object':
-
- if(Y.Lang.isArray(pTarget)){
-
- var oSlideshows = [];
- for(var i=0; i<pTarget.length; i++){
- oSlideshows.push(new Y.Slideshow(pTarget[i], pConfig));
- }
- return oSlideshows;
-
- } else if(!Y.Lang.isUndefined(pTarget._node)){
-
- this.id = (pTarget.get('id') === '') ? Y.guid(): pTarget.get('id');
- pTarget.set('id', this.id);
- this.id = (this.id.indexOf('#') === 0) ? this.id : '#' + this.id;
- this.container = pTarget;
- break;
-
- } else if(!Y.Lang.isUndefined(pTarget.nodeName)){
-
- this.id = (pTarget.id === '') ? Y.guid(): pTarget.id;
- this.id = (this.id.indexOf('#') === 0) ? this.id : '#' + this.id;
- this.container = Y.one(this.id);
- break;
-
- }
-
- default:
-
- return false;
-
- }
+ /**
+ * Current slide index.
+ * @attribute currentIndex
+ * @type Integer
+ * @default 0
+ */
+ currentIndex: {
+ value: 0
+ },
- // Lazy load?
+ /**
+ * Previous slide button Node/NodeList/selector string.
+ * @attribute previousButton
+ * @type Mixed
+ * @default null
+ */
+ previousButton: {
+ value: null
+ },
- if(Y.Lang.isObject(pConfig)){
- if(!Y.Lang.isUndefined(pConfig.lazyLoad)){
- this.container.append(pConfig.lazyLoad);
- }
- }
+ /**
+ * Next slide button Node/NodeList/selector string.
+ * @attribute nextButton
+ * @type Mixed
+ * @default null
+ */
+ nextButton: {
+ value: null
+ },
- // Properties:
+ /**
+ * Pause button Node/NodeList/selector string.
+ * @attribute pauseButton
+ * @type Mixed
+ * @default null
+ */
+ pauseButton: {
+ value: null
+ },
- this.slides = this.container.get('children');
+ /**
+ * Play button Node/NodeList/selector string.
+ * @attribute playButton
+ * @type Mixed
+ * @default null
+ */
+ playButton: {
+ value: null
+ },
- this.zIndex = {
- container: 1,
- slides: 2,
- nextSlide: 3,
- currentSlide: 4
- };
+ /**
+ * Node/selector string for the element whose children correspond to slides.
+ * This setting works best with an ordered list of links.
+ * @attribute pages
+ * @type Mixed
+ * @default null
+ */
+ pages: {
+ value: null
+ },
+
+ /**
+ * Time interval between slide transitions in seconds.
+ * @attribute interval
+ * @type Float
+ * @default 4
+ */
+ interval: {
+ value: 4
+ },
- this.transIn = Y.Transitions.fadeIn;
- this.transOut = Y.Transitions.fadeOut;
+ /**
+ * Set to false to disable autoplay.
+ * @attribute autoplay
+ * @type Boolean
+ * @default true
+ */
+ autoplay: {
+ value: true
+ },
- this.easingIn = Y.Easing.easeOut;
- this.easingOut = Y.Easing.easeOut;
+ /**
+ * Set to false to continue autoplay when the user changes slides.
+ * @attribute pauseOnChange
+ * @type Boolean
+ * @default true
+ */
+ pauseOnChange: {
+ value: true
+ },
- this.currentSlide = 0;
- this.interval = 4000;
- this.duration = 0.5;
+ /**
+ * Set to false to continue playing when the user hovers over the slideshow.
+ * @attribute pauseOnHover
+ * @type Boolean
+ * @default true
+ */
+ pauseOnHover: {
+ value: true
+ },
- this.autoplay = true;
- this.debug = false; // Changes autoplay timer from setInterval to setTimeout.
+ /**
+ * Default duration for slide transitions.
+ * @attribute duration
+ * @type Float
+ * @default null
+ */
+ duration: {
+ value: 0.5
+ },
- this.loop = false;
+ /**
+ * Default slide transition easing.
+ * @attribute easing
+ * @type String
+ * @default ease-out
+ */
+ easing: {
+ value: 'ease-out'
+ },
- this.previousButton = false;
- this.nextButton = false;
- this.playButton = false;
- this.pauseButton = false;
- this.stopOnUser = true;
+ /**
+ * Default slide transition.
+ * @attribute transition
+ * @type Slide Transition
+ * @default Slideshow.PRESETS.fade
+ */
+ transition: {
+ value: Slideshow.PRESETS.fade
+ },
- // Config:
+ /**
+ * Default transIn (incoming slide) "before" settings. Sets z-index to 1.
+ * @attribute transInBefore
+ * @type Object
+ * @default (See source)
+ */
+ transInBefore: {
+ value: {
+ zIndex: 1
+ }
+ },
- if(Y.Lang.isObject(pConfig)){
- for(var i in pConfig){
- if(pConfig.hasOwnProperty(i)){
- this[i] = pConfig[i];
- }
+ /**
+ * Default transIn (incoming slide) "after" settings. Sets z-index to 2.
+ * @attribute transInAfter
+ * @type Object
+ * @default (See source)
+ */
+ transInAfter: {
+ value: {
+ zIndex: 2
}
+ },
+
+ /**
+ * Default transOut (outgoing slide) "before" settings. Sets z-index to 2.
+ * @attribute transOutBefore
+ * @type Object
+ * @default (See source)
+ */
+ transOutBefore: {
+ value: {
+ zIndex: 2
+ }
+ },
+
+ /**
+ * Default transOut (outgoing slide) "after" settings. Sets z-index to -30000.
+ * @attribute transOutAfter
+ * @type Object
+ * @default (See source)
+ */
+ transOutAfter: {
+ value: {
+ zIndex: -30000
+ }
+ },
+
+ /**
+ * Changes timer from setInterval to setTimeout. Can be useful for debugging slide transitions.
+ * @attribute _debug
+ * @protected
+ * @type Boolean
+ * @default false
+ */
+ _debug: {
+ value: false
+ },
+
+ /**
+ * The ID returned by autoplay's setInterval call.
+ * @attribute _intervalID
+ * @protected
+ * @type Integer
+ * @default null
+ */
+ _intervalID: {
+ value: null
+ },
+
+ /**
+ * Paused flag.
+ * @attribute _isPaused
+ * @protected
+ * @type Boolean
+ * @default true
+ */
+ _isPaused: {
+ value: true
}
- var that = this;
+ };
+
+ Y.extend(Slideshow, Y.Widget, {
+
+ // Public methods:
+
+ /**
+ * Advances the slideshow by one slide.
+ * @method next
+ */
+ next: function(){
+
+ if( this.get('pauseOnChange') ){
+
+ this.pause();
+
+ }
+
+ this.slide('next');
+
+ },
+
+ /**
+ * Pauses the slideshow.
+ * @method pause
+ */
+ pause: function(){
+
+ if( !this.get('_isPaused') ){
+
+ window.clearInterval( this.get('_intervalID') );
+
+ this.set('_isPaused', true);
+
+ }
+
+ },
+
+ /**
+ * Plays the slideshow.
+ * @method play
+ */
+ play: function(){
+
+ var $that = this,
+ $function;
+
+ if( this.get('_isPaused') ){
+
+ $function = this.get('_debug') ? 'setTimeout' : 'setInterval' ;
+
+ this.set( '_intervalID', window[$function](function(){
+
+ $that.slide('next');
+
+ }, parseInt( this.get('interval') * 1000, 10 )) );
+
+ this.set('_isPaused', false);
+
+ }
+
+ },
- // Methods:
+ /**
+ * Reverses the slideshow by one slide.
+ * @method previous
+ */
+ previous: function(){
+
+ if( this.get('pauseOnChange') ){
- this.slideChange = function(pWhich){
+ this.pause();
+
+ }
- var oOutAnimObject = { node: this.slides.item(this.currentSlide) };
+ this.slide('previous');
- switch(pWhich){
+ },
+
+ /**
+ * Advances the slideshow to a given slide.
+ * @method slide
+ * @param $which {Mixed} The slide to advance to. Can be a slide index, "next", or "previous".
+ */
+ slide: function($which){
+
+ var $that = this,
+ $currentIndex = this.get('currentIndex'),
+ $slides = this.get('slides'),
+ $slideTransition = this.get('transition'),
+ $outgoingSlide,
+ $incomingSlide;
+
+ $outgoingSlide = $slides.item($currentIndex);
+
+ switch( $which ){
+
case 'next':
- if(this.currentSlide + 1 < this.slides.size()){
- this.currentSlide++;
- } else {
- this.currentSlide = 0;
+
+ if( $currentIndex + 1 < $slides.size() ){
+
+ $currentIndex++;
+
}
+
+ else {
+
+ $currentIndex = 0;
+
+ }
+
break;
+
case 'previous':