-
Notifications
You must be signed in to change notification settings - Fork 1
/
bf4-rank-element.html
107 lines (84 loc) · 2.8 KB
/
bf4-rank-element.html
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../polymer-jsonp/polymer-jsonp.html">
<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
<!--
Element providing basic rank information for a BF4 soldier.
##### Example
<bf4-rank-element name="BlastW" platform="pc"></bf4-rank-element>
@element bf4-rank-element
@blurb Element providing basic rank information for a BF4 soldier.
@status stable
@homepage http://fagnercarvalho.github.io/bf4-rank-element
-->
<polymer-element name="bf4-rank-element" attributes="name platform">
<template>
<link rel="stylesheet" href="bf4-rank-element.css" />
<polymer-jsonp auto url="http://api.bf4stats.com/api/playerInfo?name={{name}}&plat={{platform}}&output=jsonp&opt=names,imagePaths&callback="
response="{{response}}" on-polymer-response="{{responseHandler}}">
</polymer-jsonp>
<div class="main">
<div class="text">
{{name}}
</div>
<img src="{{rankImage}}" class="rankImage"/>
<div class="text rank">
{{rank}}
</div>
</div>
</template>
<script>
Polymer('bf4-rank-element', {
/**
* `name` attribute sets the BF4 soldier which
* the rank information will be displayed
*
* @attribute name
* @type string
* @default 'BlastW'
*/
name: 'BlastW',
/**
* `platform` attribute sets the selected platform
*
* Options:
* pc
* PC platform
* xbox
* XBOX 360 console platform
* ps3
* Playstation 3 console platform
* xone
* XBOX ONE console platform.
* ps4
* Playstation 4 console platform.
*
* @attribute platform
* @type string
* @default 'pc'
*/
platform: 'pc',
/**
* The soldier's current rank.
*/
rank: '',
/**
* The soldier's current rank image.
*/
rankImage: '',
response: null,
responseHandler: function(){
this.rank = this.response.player.rank.name;
this.rankImage = 'http://files.bf4stats.com/img/' + this.response.player.rank.imgLarge;
}
});
</script>
</polymer-element>