Last active
August 29, 2015 14:19
-
-
Save mashiro/01aab6f617647078aa62 to your computer and use it in GitHub Desktop.
More editable miniparse.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
font-family: "Meiryo"; | |
font-size: 12px; | |
font-weight: normal; | |
box-sizing: border-box; | |
} | |
html { | |
height: 100%; | |
overflow: hidden; | |
background-color: transparent; | |
} | |
body { | |
margin: 0; | |
padding: 0; | |
} | |
th { text-align: center; } | |
td { text-align: right; } | |
.text-left { text-align: left; } | |
.text-center { text-align: center; } | |
.text-right { text-align: right; } | |
.text-lowercase { text-transform: lowercase; } | |
.text-uppercase { text-transform: uppercase; } | |
.text-capitalize { text-transform: capitalize; } | |
.blue { | |
color: #E2EBF5; | |
text-shadow: -1px 0 3px #217AA2, 0 1px 3px #217AA2, 1px 0 3px #217AA2, 0 -1px 3px #217AA2; | |
} | |
.gold { | |
color: #DED7BE; | |
text-shadow: -1px 0 2px #795516, 0 1px 2px #795516, 1px 0 2px #795516, 0 -1px 2px #795516; | |
} | |
.resize-handle { | |
background-image: url(handle.png); | |
background-position: bottom right; | |
background-repeat: no-repeat; | |
box-sizing: border-box; | |
} | |
#miniparse .outer { | |
height: 100%; | |
padding: 10px; | |
} | |
#miniparse .inner { | |
position: relative; | |
padding: 10px; | |
} | |
#miniparse .inner .background { | |
position: absolute; | |
left: 0; | |
right: 0; | |
top: 0; | |
bottom: 0; | |
background-color: rgba(0, 0, 0, 0.5); | |
-webkit-filter: blur(5px); | |
z-index: -1; | |
} | |
#toggle-collapse { | |
cursor: pointer; | |
float: right; | |
} | |
#combatants { | |
table-layout: auto; | |
width: 100%; | |
border-collapse: collapse; | |
} | |
#encounter, | |
#combatants th { | |
white-space: nowrap; | |
} | |
#combatants td { | |
overflow: hidden; | |
white-space: nowrap; | |
text-overflow: ellipsis; | |
max-width: 20ex; | |
} | |
#combatants thead { | |
border-bottom: 1px solid #DED7BE; | |
} | |
#combatants tr.you { | |
background-color: rgba(255,255,255,0.2); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>miniparse</title> | |
<link rel="stylesheet" href="miniparse.css"> | |
</head> | |
<body id="miniparse" v-class="resize-handle: !locked"> | |
<div class="outer"> | |
<div class="inner"> | |
<div class="background"></div> | |
<div v-if="!updated" class="gold"> | |
<span>No data to show.</span> | |
</div> | |
<div v-if="updated"> | |
<div id="encounter" class="gold"> | |
<span>{{encounter.title}} / Time: {{encounter.duration}} / DPS: {{encounter.ENCDPS}}</span> | |
<span id="toggle-collapse" v-on="click: toggleCollapse()">{{collapsed ? "▲" : "▼"}}</span> | |
</div> | |
<table id="combatants" v-show="!collapsed"> | |
<thead class="gold"> | |
<tr> | |
<th class="text-left">Name</th> | |
<th>Job</th> | |
<th>DPS</th> | |
<th>HPS</th> | |
</tr> | |
</thead> | |
<tbody class="blue"> | |
<tr v-repeat="combatant: combatants" v-combatant="combatant"> | |
<td class="text-left">{{combatant.name}}</td> | |
<td class="text-center text-uppercase">{{combatant.job}}</td> | |
<td>{{combatant.encdps}}</td> | |
<td>{{combatant.enchps}}</td> | |
</tr> | |
</tbody> | |
</table> | |
</div> | |
</div> | |
</div> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/0.12.7/vue.min.js"></script> | |
<script src="miniparse.js"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vue.directive('combatant', { | |
update: function(value) { | |
if (value.name === 'YOU' || value.name === 'Mashiro Amahane') { | |
this.el.classList.add('you'); | |
} | |
var ds = this.el.dataset; | |
ds.deaths = value.deaths; | |
} | |
}); | |
var miniparse = new Vue({ | |
el: '#miniparse', | |
data: { | |
updated: false, | |
locked: false, | |
collapsed: false, | |
encounter: null, | |
combatants: null | |
}, | |
attached: function() { | |
document.addEventListener('onOverlayDataUpdate', this.update); | |
document.addEventListener('onOverlayStateUpdate', this.updateState); | |
}, | |
detached: function() { | |
document.removeEventListener('onOverlayStateUpdate', this.updateState); | |
document.removeEventListener('onOverlayDataUpdate', this.update); | |
}, | |
methods: { | |
update: function(e) { | |
this.updated = true; | |
this.encounter = e.detail.Encounter; | |
this.combatants = []; | |
for (var name in e.detail.Combatant) { | |
var combatant = e.detail.Combatant[name]; | |
combatant.name = name; | |
combatant.job = combatant.Job.toLowerCase(); | |
this.combatants.push(combatant); | |
} | |
}, | |
updateState: function(e) { | |
this.locked = e.detail.isLocked; | |
}, | |
toggleCollapse: function() { | |
this.collapsed = !this.collapsed; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment