use.html revision ea6060eacdf2c9b092739bdca5533ac8c47e5a58
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html debug="true">
<head>
<title>YUI 3.0</title>
<script type="text/javascript" src="/build3x/yui/yui-debug.js"></script>
<style>
.dd {
padding-left: 20px;
padding: 5px;
margin: 2px;
cursor: move;
background-color: red;
width: 100px;
height: 100px;
zoom: 1;
}
#ddtarg {
top: 200px;
}
</style>
<body>
<input id="button1" type="button" value="Button 1" class="button" />
<input id="button2" type="button" value="Button 2" class="button" />
<input id="text1" type="text" value="something" class="nothing" />
<div id="dd" class="dd"></div>
<div id="ddtarg" class="dd"></div>
<script>
if (typeof loadFirebugConsole == 'function') {
loadFirebugConsole();
}
YUI({
base: '/build3x/',
root: '2.5.2/build/',
insertBefore: 'styleoverrides',
//charset: 'utf-8',
//loadOptional: true,
// combine: true,
filter: 'debug',
// logInclude: { event: true },
timeout: 20000
// }).use('compat', 'dd-dragdrop-all', function(Y) {
}).use('dd', function(Y, result) {
if (!result.success) {
alert('Load failure: ' + result.msg);
return;
}
Y.log('custom event success');
function MyClass(cfg) {
// When constructed, setup the
// initial attributes for the
// instance, by calling the
// protected _initAtts method
this._initAtts(MyClass.ATTRIBUTES, cfg);
}
// Setup static property to hold attribute config
MyClass.ATTRIBUTES = {
// Add 3 attributes, foo, bar and foobar
"foo" : {
value:5
},
"bar" : {
value:"Hello World!"
},
"foobar" : {
value:true
}
};
// Augment custom class with Attribute
Y.augment(MyClass, Y.Attribute);
var o1 = new MyClass();
var print = Y.log;
print("o1 values set during construction:", "header");
print("foo:" + o1.get("foo"));
print("bar:" + o1.get("bar"));
print("foobar:" + o1.get("foobar"));
o1.set("foo", 10);
o1.set("bar", "Hello New World!");
o1.set("foobar", false);
print("o1 new values:", "header");
print("new foo:" + o1.get("foo"));
print("new bar:" + o1.get("bar"));
print("new foobar:" + o1.get("foobar"));
var o2 = new MyClass({
foo: 7,
bar: "Aloha World!",
foobar: false
});
print("o2 values set during construction:", "header");
print("foo:" + o2.get("foo"));
print("bar:" + o2.get("bar"));
print("foobar:" + o2.get("foobar"));
var dd = new Y.DD.Drag({
node: '#dd'
});
var tar = new Y.DD.Drop({
node: '#ddtarg'
});
Y.DD.DDM.on('drag:drop', function(e) {
console.log('DDM:drag:drag :: ', e.target);
});
});
</script>
<style id="styleoverrides">
body {
background-color: #f7f7f7
}
</style>
</head>
<body id="yahoo">
</body>
</html>