Permalink
Browse files

pushed in changes from yui3-gallery/gallery-clipboard into repo

  • Loading branch information...
1 parent 67b9a60 commit 48e0d64cdaaf89e00b92755c39b1e4011b0d86d3 @rmsguhan committed Aug 24, 2011
Showing with 24 additions and 26 deletions.
  1. +19 −15 demo/demo_1.html
  2. +5 −11 js/{clipboard-plugin.js → gallery-clipboard.js}
View
@@ -39,7 +39,7 @@
.control {
width:450px;
position:absolute;
- top:100px;
+ top:160px;
left:350px;
}
</style>
@@ -48,14 +48,18 @@
<div class='container'>
<h1 id='title'>Flash clipboard copy demo</h1>
<cite>This demo showcases the ability to create a YUI node and plugin the flash based
- copy to clipboard functionality. The clipboard copy is implemented as a node plugin</cite>
+ copy to clipboard functionality. The clipboard copy is implemented as a node plugin.
+ The clipboard support allows for attaching any event on the flash movie, so you can setup
+ the node to copy the string even on keydown or 'enter'. 'enter' is a custom event created inside
+ the falsh movie, so from JS you can setup to happen on 'enter'</cite>
<hr>
- <div class='button b1'>Some content 1</div>
- <div class='button b2'>Some content 2</div>
+ <div class='button b1'>To see a world in a grain of sand</div>
+ <div class='button b2'>Hold infinity in the palm of your hand</div>
+ <h2></h2>
</div>
<div class='control'>
- <input type='button' class='keyUp' node = 'b1' value='Node1 add Flash Enter event' />
- <input type='button' class='remove-keyUp' node = 'b1' value='Node1 remove Flash Enter event' />
+ <!-- input type='button' class='keyUp' node = 'b1' value='Node1 add Flash Enter event' />
+ <input type='button' class='remove-keyUp' node = 'b1' value='Node1 remove Flash Enter event' /-->
<input type='button' class='mouseOver' node = 'b1' value='Node1 add Flash MouseOver' />
<input type='button' class='remove-mouseOver' node = 'b1' value='Node1 remove Flash MouseOver' />
@@ -71,12 +75,12 @@ <h1 id='title'>Flash clipboard copy demo</h1>
<input type='button' class='clear' value = 'Clear log' />
</div>
<script src="http://yui.yahooapis.com/3.3.0/build/yui/yui.js"></script>
- <script src="../js/clipboard-plugin.js"></script>
+ <script src="../js/gallery-clipboard.js"></script>
<script type='text/javascript'>
document.title = document.getElementById("title").innerHTML;
var MOVIE_PATH = '../assets/';
- YUI().use('comms-ui-clipboard-plugin', function(Y) {
+ YUI().use('gallery-clipboard', function(Y) {
var logit = function(str) {
var log = Y.one("#log"),
@@ -89,36 +93,36 @@ <h1 id='title'>Flash clipboard copy demo</h1>
node2 = Y.one(".b2");
/* Set up Copy on Node 1 */
- node1.plug(Y.comms.ui.ClipBoard, {
+ node1.plug(Y.ClipBoard, {
page : Y.one(".container"),
moviepath : MOVIE_PATH
}).on("clipboard:load", function(e){
logit("Flash Movie Loaded for :"+e.currentTarget.get("className"));
this.on("mouseover", function(ev) {
this.setAttribute("copy", this.get("innerHTML"));
- logit("String set for copy " + this.getAttribute("copy"));
+ logit("Press Enter to copy &quot;" + this.getAttribute("copy")+ "&quot;");
});
this.clipboard.setEvent("enter", function(ev) {
- logit("Clipboard set for : "+this.get("className")+":'"+ev.clipboard+"'");
+ logit("Clipboard now contains - '"+ev.clipboard+"'");
this.clipboard.hide();
}, true);
});
Y.on("clipboard:error", function(e) {
logit("ERROR :"+e.error);
});
/* Set up Copy on Node 2 */
- node2.plug(Y.comms.ui.ClipBoard, {
+ node2.plug(Y.ClipBoard, {
page : Y.one(".container"),
moviepath : MOVIE_PATH
}).on("clipboard:load", function(e){
logit("Flash Movie Loaded for :"+e.currentTarget.get("className"));
this.on("mouseover", function(ev) {
this.setAttribute("copy", this.get("innerHTML"));
- logit("String set for copy " + this.getAttribute("copy"));
+ logit("Click to copy &quot;" + this.getAttribute("copy")+"&quot;");
});
this.clipboard.setEvent("click", function(ev) {
this.clipboard.hide();
- logit("Clipboard set for : "+this.get("className")+":'"+ev.clipboard+"'");
+ logit("Clipboard now contains - '"+ev.clipboard+"'");
}, true);
});
@@ -150,4 +154,4 @@ <h1 id='title'>Flash clipboard copy demo</h1>
</script>
</body>
-</html>
+</html>
@@ -1,3 +1,5 @@
+YUI.add('gallery-clipboard', function(Y) {
+
/*
Copyright (c) 2011, Yahoo! Inc.
All rights reserved.
@@ -33,7 +35,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-YUI.add('gallery-clipboard-plugin', function(Y) {
/**
* Template for embedding the flash movie in the object tag. Mainly for IE browsers
* @property OBJECT_TEMPLATE
@@ -270,7 +271,6 @@ YUI.add('gallery-clipboard-plugin', function(Y) {
*/
_destructor : function() {
var _this = this;
- Y.log("Destructor called for "+ _this._host.get("id"));
_this.get("boundingBox").destroy(true);
FLASHMOVIE_LOADED = false;
loadObj = {};
@@ -334,7 +334,6 @@ YUI.add('gallery-clipboard-plugin', function(Y) {
_this._movie._node.copy(str, _this.get("id"));
} catch(e) {
Y.fire(COMPONENT_NAME+":error", {"error": e.message});
- Y.log("Copy Event Error occured" + e.message);
}
},
/**
@@ -368,7 +367,6 @@ YUI.add('gallery-clipboard-plugin', function(Y) {
}
} catch(e) {
Y.fire(COMPONENT_NAME+":error", {"error": e.message});
- Y.log("Setup Event Error occured" + e.message);
}
},
@@ -400,7 +398,6 @@ YUI.add('gallery-clipboard-plugin', function(Y) {
}
} catch(e) {
Y.fire(COMPONENT_NAME+":error", {"error": e.message});
- Y.log("Remove Event Error occured" + e.message);
}
return true;
},
@@ -461,7 +458,6 @@ YUI.add('gallery-clipboard-plugin', function(Y) {
page.appendChild(wrapper);
movie = _this.get("page").one("#"+id);
loadObj.host = _this._host;
- Y.log("Creating a new flash movie node and attaching to DOM");
}
this.set("boundingBox", movie.get("parentNode"));
movie.setStyle("outline", "none");
@@ -490,10 +486,8 @@ YUI.add('gallery-clipboard-plugin', function(Y) {
} else {
Y.fire(ev, a);
}
- Y.log("Flash Interface callback recieved :"+ev );
} catch(e) {
Y.fire(COMPONENT_NAME+":error", Y.mix({"error": e.message}, a));
- Y.log("Flash Interface Error occured :" +e.message);
}
@@ -521,7 +515,7 @@ YUI.add('gallery-clipboard-plugin', function(Y) {
}
});
- Y.namespace("comms.ui");
- Y.comms.ui.ClipBoard = ClipBoard;
+ Y.ClipBoard = ClipBoard;
+
-}, '0.0.1' ,{requires:['node', 'plugin', "substitute"]});
+}, '@VERSION@' ,{skinnable:false, requires:['node', 'plugin', 'substitute']});

0 comments on commit 48e0d64

Please sign in to comment.