-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathyugioh.js
30 lines (30 loc) · 934 Bytes
/
yugioh.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['react'], function (React) {
return (root.Yugioh = factory(React));
});
} else if (typeof exports === 'object') {
// Node, sorta CommonJS
module.exports = factory(require('react-tools').React);
} else {
// Browser global
root.Yugioh = factory(root.React);
}
}(this, function (React) {
return React.createClass({displayName: "Yugioh",
createLink: function() {
var card = this.props.card.trim().split(' ').map(function(word) {
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
}).join('_');
return 'http://static.api3.studiobebop.net/ygo_data/card_images/' + card + '.jpg';
},
render: function() {
return React.DOM.img({
alt: this.props.card,
className: 'yugioh',
src: this.createLink()
});
}
});
}));