Permalink
Browse files

My Gallery modules

  • Loading branch information...
0 parents commit e554bef95bdce2f4b9dad6ff68a0595cf8381fe3 @davglass committed Oct 11, 2012
Showing with 8,698 additions and 0 deletions.
  1. 0 build/.keep
  2. 0 src/gallery-badge/README
  3. +21 −0 src/gallery-badge/build.properties
  4. +7 −0 src/gallery-badge/build.xml
  5. +140 −0 src/gallery-badge/js/badge.js
  6. 0 src/gallery-bitly/assets/.keep
  7. +11 −0 src/gallery-bitly/build.json
  8. +20 −0 src/gallery-bitly/build.properties
  9. +7 −0 src/gallery-bitly/build.xml
  10. +108 −0 src/gallery-bitly/build_tmp/gallery-bitly-debug.js
  11. +1 −0 src/gallery-bitly/build_tmp/gallery-bitly-min.js
  12. +107 −0 src/gallery-bitly/build_tmp/gallery-bitly.js
  13. 0 src/gallery-bitly/css/.keep
  14. +10 −0 src/gallery-bitly/docs/component.json
  15. +47 −0 src/gallery-bitly/docs/index.mustache
  16. +103 −0 src/gallery-bitly/js/bitly.js
  17. 0 src/gallery-bitly/meta/.keep
  18. +11 −0 src/gallery-bitly/meta/gallery-bitly.json
  19. +24 −0 src/gallery-bitly/tests/unit/index.html
  20. +15 −0 src/gallery-bitly/tests/unit/js/tests.js
  21. 0 src/gallery-node-reset/README
  22. +22 −0 src/gallery-node-reset/build.properties
  23. +9 −0 src/gallery-node-reset/build.xml
  24. +56 −0 src/gallery-node-reset/js/node-reset.js
  25. +2 −0 src/gallery-oauth/README.md
  26. +28 −0 src/gallery-oauth/build.properties
  27. +8 −0 src/gallery-oauth/build.xml
  28. +126 −0 src/gallery-oauth/js/oauth.js
  29. +21 −0 src/gallery-port/build.properties
  30. +7 −0 src/gallery-port/build.xml
  31. +164 −0 src/gallery-port/js/port.js
  32. +21 −0 src/gallery-simple-editor/build.properties
  33. +7 −0 src/gallery-simple-editor/build.xml
  34. +5,061 −0 src/gallery-simple-editor/js/simple-editor.js
  35. +242 −0 src/gallery-simple-editor/js/toolbar-button.js
  36. +1,737 −0 src/gallery-simple-editor/js/toolbar.js
  37. +21 −0 src/gallery-tabby/build.properties
  38. +7 −0 src/gallery-tabby/build.xml
  39. +53 −0 src/gallery-tabby/js/tabby.js
  40. 0 src/gallery-textarea-counter/README
  41. +22 −0 src/gallery-textarea-counter/build.properties
  42. +9 −0 src/gallery-textarea-counter/build.xml
  43. +154 −0 src/gallery-textarea-counter/js/textarea-counter.js
  44. 0 src/gallery-yql/css/.keep
  45. +10 −0 src/gallery-yql/docs/component.json
  46. +37 −0 src/gallery-yql/docs/index.mustache
  47. +133 −0 src/gallery-yql/js/yql.js
  48. 0 src/gallery-yql/meta/.keep
  49. +11 −0 src/gallery-yql/meta/gallery-yql.json
  50. +61 −0 src/gallery-yql/package.json
  51. +22 −0 src/gallery-yql/tests/unit/index.html
  52. +15 −0 src/gallery-yql/tests/unit/js/tests.js
No changes.
No changes.
@@ -0,0 +1,21 @@
+# Gallery Badge Build Properties
+
+# As long as the 'builder' project is cloned to the default folder
+# next to the 'yui3-gallery' project folder, the 'builddir' property does not
+# need to be changed
+#
+# If the 'builder' project is checked out to an alternate location, this
+# property should be updated to point to the checkout location.
+builddir=../../../builder/componentbuild
+
+# The name of the component. E.g. event, attribute, widget
+component=gallery-badge
+
+# The list of files which should be concatenated to create the component.
+# NOTE: For a css component (e.g. cssfonts, cssgrids etc.) use component.cssfiles instead.
+# component.jsfiles=badge.js, badgeHelperClass.js, badgeSubComponentClass.js
+component.jsfiles=badge.js
+
+# The list of modules this component requires. Used to set up the Y.add module call for YUI 3.
+component.requires=node,event,gallery-yql,stylesheet
+
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- YUI 3 Gallery Component Build File -->
+<project name="Gallery Badge" default="local">
+ <description>Gallery Badge Build File</description>
+ <property file="build.properties" />
+ <import file="${builddir}/3.x/bootstrap.xml" description="Default Build Properties and Targets" />
+</project>
@@ -0,0 +1,140 @@
+
+ var B = function(config) {
+ this._lazyAddAttrs = false;
+ config.node = config.host;
+ B.superclass.constructor.call(this, config);
+ };
+
+ B.NAME = "gallery-badge";
+
+ B.NS = "badge";
+
+ B.ATTRS = {
+ node: {
+ setter: function(node) {
+ return Y.one(node);
+ }
+ },
+ type: {
+ value: 'popular',
+ setter: function(v) {
+ if (v !== 'user') {
+ this.set('username', '');
+ }
+ return v;
+ }
+ },
+ header: {
+ value: '',
+ getter: function() {
+ var h = 'Popular Gallery Items';
+ switch (this.get('type')) {
+ case 'oncdn':
+ h = 'Gallery Items on the CDN';
+ break;
+ case 'featured':
+ h = 'Featured Gallery Items';
+ break;
+ case 'random':
+ h = 'Random Gallery Item';
+ break;
+ case 'user':
+ h = 'My Gallery Items';
+ break;
+ }
+ return h;
+ }
+ },
+ username: {
+ value: '',
+ setter: function(v) {
+ if (v) {
+ this.set('header', 'My Gallery Items');
+ this._setStateVal('type', 'user');
+ }
+ return v;
+ }
+ },
+ render: {
+ value: true
+ },
+ data: {
+ value: {}
+ }
+ };
+
+ Y.extend(B, Y.Base, {
+ buildUI: function(e) {
+ this.set('data', e.data);
+ if (e.data.error) {
+ return;
+ }
+ var data = e.data,
+ type = this.get('type'),
+ header = Y.Node.create('<h2>' + this.get('header') + '</h2>'),
+ node = Y.Node.create('<ul></ul>'),
+ n = this.get('node');
+
+ if (type != 'random') {
+ if (type == 'user') {
+ header = Y.Node.create('<h2><a href="http:/'+'/yuilibrary.com/gallery/user/' + data.userinfo.username + '">' + data.userinfo.fullname + '\'s Gallery Items</a></h2>');
+ }
+ Y.each(data.modules, function(v) {
+ node.append('<li><a href="' + v.url + '">' + v.title + '</a></li>');
+ });
+ } else {
+ node.append('<li><a href="' + data.modules.url + '">' + data.modules.title + '</a></li>');
+ }
+
+ n.set('innerHTML', '');
+ n.append(header);
+ n.append(node);
+ },
+ getSQL: function() {
+ var type = this.get('type'), sql;
+ if (type == 'user') {
+ sql = "select * from yui.gallery.user where (username = '" + this.get('username') + "')";
+ } else {
+ sql = "select * from yui.gallery." + type;
+ }
+ return sql;
+ },
+ updateUserUI: function(e) {
+ if (e.newVal !== '') {
+ this.updateUI();
+ }
+ },
+ updateUI: function(e) {
+ var sql = this.getSQL(), q;
+
+ q = new Y.yql(sql, Y.bind(function(r) {
+ if (r.query && r.query.results && r.query.results.json) {
+ this.fire('dataReturned', { data: r.query.results.json });
+ }
+ }, this), { env: 'http:/'+'/yuilibrary.com/yql/yui.env' });
+
+ },
+ initializer: function() {
+ this.after('typeChange', Y.bind(this.updateUI, this));
+ this.after('usernameChange', Y.bind(this.updateUserUI, this));
+ this.publish('dataReturned', {
+ type: 'datareturned',
+ defaultFn: this.buildUI
+ });
+ if (this.get('render')) {
+ this.render();
+ }
+ },
+ render: function() {
+ this.updateUI();
+ },
+ refresh: function() {
+ this.updateUI();
+ },
+ destructor: function() {
+ this.get('node').set('innerHTML', '');
+ }
+ });
+ Y.namespace('Plugin');
+ Y.Plugin.Badge = B;
+
No changes.
@@ -0,0 +1,11 @@
+{
+ "name": "gallery-bitly",
+ "builds": {
+ "gallery-bitly": {
+ "jsfiles": [
+ "bitly.js"
+ ],
+ "meta": {}
+ }
+ }
+}
@@ -0,0 +1,20 @@
+# bit.ly Build Properties
+
+# As long as the 'builder' project is cloned to the default folder
+# next to the 'yui3-gallery' project folder, the 'builddir' property does not
+# need to be changed
+#
+# If the 'builder' project is checked out to an alternate location, this
+# property should be updated to point to the checkout location.
+builddir=../../../builder/componentbuild
+
+# The name of the component. E.g. event, attribute, widget
+component=gallery-bitly
+
+# The list of files which should be concatenated to create the component.
+# NOTE: For a css component (e.g. cssfonts, cssgrids etc.) use component.cssfiles instead.
+# component.jsfiles=bitly.js, bitlyHelperClass.js, bitlySubComponentClass.js
+component.jsfiles=bitly.js
+
+# The list of modules this component requires. Used to set up the Y.add module call for YUI 3.
+component.requires=base,get
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- YUI 3 Gallery Component Build File -->
+<project name="bit.ly" default="local">
+ <description>bit.ly Build File</description>
+ <property file="build.properties" />
+ <import file="${builddir}/3.x/bootstrap.xml" description="Default Build Properties and Targets" />
+</project>
@@ -0,0 +1,108 @@
+YUI.add('gallery-bitly', function(Y) {
+
+
+
+ var B = function(config) {
+ B.superclass.constructor.call(this, config);
+ };
+
+ B.NAME = 'bitly';
+
+ B.ATTRS = {
+ username: {
+ value: ''
+ },
+ key: {
+ value: ''
+ }
+ };
+
+ Y.extend(B, Y.Base, {
+ api: 'http:/'+'/api.bit.ly/',
+ initializer: function() {
+ if (!this.get('key') || !this.get('username')) {
+ Y.error('You must give a username and an API key. If you do not have an apiKey, sign up for a bitly account and go to your Account page to get your apiKey. (http:/'+'/bit.ly/)');
+ }
+ },
+ destructor: function() {
+ },
+ _buildURL: function(path, param) {
+ return this.api + path + '?version=2.0.1&login=' + this.get('username') + '&apiKey=' + this.get('key') + '&' + param;
+ },
+ _handleAPI: function(name, url, cb) {
+ Y.log('handleAPI: ' + name + ' : ' + url, 'info');
+
+ var stamp = Y.guid().replace(/-/g,'_');
+
+ YUI[stamp] = Y.bind(function(e) {
+ if (e.results) {
+ if (name == 'stats') {
+ this.fire(name, e.results);
+ if (cb) {
+ cb = Y.bind(cb, this);
+ cb(e.results);
+ }
+ } else {
+ Y.each(e.results, function(v) {
+ this.fire(name, v);
+ if (cb) {
+ cb = Y.bind(cb, this);
+ cb(v);
+ }
+ }, this);
+ }
+ }
+ delete YUI[stamp];
+ }, this);
+
+ Y.Get.script(url + '&callback=YUI.' + stamp);
+ },
+ shorten: function(url, cb) {
+ var api = this._buildURL('shorten', 'longUrl=' + encodeURIComponent(url));
+ this._handleAPI('shorten', api, cb);
+ },
+ expand: function(p, cb) {
+ var path = ((p.url) ? 'shortUrl=' + encodeURIComponent(p.url) : 'hash=' + p.hash),
+ api = this._buildURL('expand', path);
+
+ this._handleAPI('expand', api, cb);
+
+ },
+ expandByURL: function(v, cb) {
+ return this.expand({ url: v }, cb);
+ },
+ expandByHash: function(v, cb) {
+ return this.expand({ hash: v }, cb);
+ },
+ info: function(p, cb) {
+ var path = ((p.url) ? 'shortUrl=' + encodeURIComponent(p.url) : 'hash=' + p.hash),
+ api = this._buildURL('info', path);
+
+ this._handleAPI('info', api, cb);
+
+ },
+ infoByURL: function(v, cb) {
+ return this.info({ url: v }, cb);
+ },
+ infoByHash: function(v, cb) {
+ return this.info({ hash: v }, cb);
+ },
+ stats: function(p, cb) {
+ var path = ((p.url) ? 'shortUrl=' + encodeURIComponent(p.url) : 'hash=' + p.hash),
+ api = this._buildURL('stats', path);
+
+ this._handleAPI('stats', api, cb);
+
+ },
+ statsByURL: function(v, cb) {
+ return this.stats({ url: v }, cb);
+ },
+ statsByHash: function(v, cb) {
+ return this.stats({ hash: v }, cb);
+ }
+ });
+
+ Y.bitly = B;
+
+
+}, '@VERSION@' ,{requires:['base','get']});
@@ -0,0 +1 @@
+YUI.add("gallery-bitly",function(a){var b=function(c){b.superclass.constructor.call(this,c);};b.NAME="bitly";b.ATTRS={username:{value:""},key:{value:""}};a.extend(b,a.Base,{api:"http:/"+"/api.bit.ly/",initializer:function(){if(!this.get("key")||!this.get("username")){a.error("You must give a username and an API key. If you do not have an apiKey, sign up for a bitly account and go to your Account page to get your apiKey. (http:/"+"/bit.ly/)");}},destructor:function(){},_buildURL:function(c,d){return this.api+c+"?version=2.0.1&login="+this.get("username")+"&apiKey="+this.get("key")+"&"+d;},_handleAPI:function(e,d,c){var f=a.guid().replace(/-/g,"_");YUI[f]=a.bind(function(g){if(g.results){if(e=="stats"){this.fire(e,g.results);if(c){c=a.bind(c,this);c(g.results);}}else{a.each(g.results,function(h){this.fire(e,h);if(c){c=a.bind(c,this);c(h);}},this);}}delete YUI[f];},this);a.Get.script(d+"&callback=YUI."+f);},shorten:function(d,c){var e=this._buildURL("shorten","longUrl="+encodeURIComponent(d));this._handleAPI("shorten",e,c);},expand:function(f,c){var e=((f.url)?"shortUrl="+encodeURIComponent(f.url):"hash="+f.hash),d=this._buildURL("expand",e);this._handleAPI("expand",d,c);},expandByURL:function(d,c){return this.expand({url:d},c);},expandByHash:function(d,c){return this.expand({hash:d},c);},info:function(f,c){var e=((f.url)?"shortUrl="+encodeURIComponent(f.url):"hash="+f.hash),d=this._buildURL("info",e);this._handleAPI("info",d,c);},infoByURL:function(d,c){return this.info({url:d},c);},infoByHash:function(d,c){return this.info({hash:d},c);},stats:function(f,c){var e=((f.url)?"shortUrl="+encodeURIComponent(f.url):"hash="+f.hash),d=this._buildURL("stats",e);this._handleAPI("stats",d,c);},statsByURL:function(d,c){return this.stats({url:d},c);},statsByHash:function(d,c){return this.stats({hash:d},c);}});a.bitly=b;},"@VERSION@",{requires:["base","get"]});
Oops, something went wrong. Retry.

0 comments on commit e554bef

Please sign in to comment.