Permalink
Browse files

DarkTip v1.1.7

- Usage of itemclass/subclass api data resource
- New Module: wow.character.spec: Displays active and inactive talents
spec in detail including glyphs
  • Loading branch information...
1 parent 47580e4 commit c2ca46fcf5db99136c8b8933db3cbd0f9b509dcf @darkspotinthecorner committed Sep 6, 2012
View
@@ -44,7 +44,7 @@ window.DarkTip = {
'version': {
'major': 1,
'minor': 1,
- 'patch': 6
+ 'patch': 7
},
'data': {
View
@@ -102,6 +102,19 @@
<li><span data-darktip="wow.character:eu.gilneas.rhilthesecond(es)">&lt;span data-darktip=&quot;wow.character:eu.gilneas.rhilthesecond(es)&quot;&gt;...&lt;/span&gt;</span></li>
</ul>
<ul class="testbox explicit">
+ <li><h2>Character Spec Tests - Existing</h2></li>
+ <li><span data-darktip="wow.character.spec:eu.die-aldor.slaycy(en)">&lt;span data-darktip=&quot;wow.character.spec:eu.die-aldor.slaycy(en)&quot;&gt;...&lt;/span&gt;</span></li>
+ <li><span data-darktip="wow.character.spec:eu.gilneas.rhil(en)">&lt;span data-darktip=&quot;wow.character.spec:eu.gilneas.rhil(en)&quot;&gt;...&lt;/span&gt;</span></li>
+ <li><span data-darktip="wow.character.spec:eu.gilneas.rhil(de)">&lt;span data-darktip=&quot;wow.character.spec:eu.gilneas.rhil(de)&quot;&gt;...&lt;/span&gt;</span></li>
+ <li><span data-darktip="wow.character.spec:eu.gilneas.rhil(fr)">&lt;span data-darktip=&quot;wow.character.spec:eu.gilneas.rhil(fr)&quot;&gt;...&lt;/span&gt;</span></li>
+ <li><span data-darktip="wow.character.spec:eu.gilneas.rhil(es)">&lt;span data-darktip=&quot;wow.character.spec:eu.gilneas.rhil(es)&quot;&gt;...&lt;/span&gt;</span></li>
+ <li><h2>Character Spec Tests - 404</h2></li>
+ <li><span data-darktip="wow.character.spec:eu.gilneas.rhilthesecond(en)">&lt;span data-darktip=&quot;wow.character.spec:eu.gilneas.rhilthesecond(en)&quot;&gt;...&lt;/span&gt;</span></li>
+ <li><span data-darktip="wow.character.spec:eu.gilneas.rhilthesecond(de)">&lt;span data-darktip=&quot;wow.character.spec:eu.gilneas.rhilthesecond(de)&quot;&gt;...&lt;/span&gt;</span></li>
+ <li><span data-darktip="wow.character.spec:eu.gilneas.rhilthesecond(fr)">&lt;span data-darktip=&quot;wow.character.spec:eu.gilneas.rhilthesecond(fr)&quot;&gt;...&lt;/span&gt;</span></li>
+ <li><span data-darktip="wow.character.spec:eu.gilneas.rhilthesecond(es)">&lt;span data-darktip=&quot;wow.character.spec:eu.gilneas.rhilthesecond(es)&quot;&gt;...&lt;/span&gt;</span></li>
+ </ul>
+ <ul class="testbox explicit">
<li><h2>Character PvP Tests - Existing</h2></li>
<li><span data-darktip="wow.character.pvp:eu.khadgar.Gebru(en)">&lt;span data-darktip=&quot;wow.character.pvp:eu.khadgar.Gebru(en)&quot;&gt;...&lt;/span&gt;</span></li>
<li><span data-darktip="wow.character.pvp:eu.khadgar.Gebru(de)">&lt;span data-darktip=&quot;wow.character.pvp:eu.khadgar.Gebru(de)&quot;&gt;...&lt;/span&gt;</span></li>
@@ -176,6 +189,18 @@
<li><a href="http://eu.battle.net/wow/es/character/gilneas/Mashayayaaaaah/simple">http://eu.battle.net/wow/es/character/gilneas/Mashayayaaaaah/simple</a></li>
</ul>
<ul class="testbox implicit">
+ <li><h2>Character Spec Tests - Existing</h2></li>
+ <li><a href="http://eu.battle.net/wow/en/character/gilneas/Rhil/simple#talents">http://eu.battle.net/wow/en/character/gilneas/Rhil/simple#talents</a></li>
+ <li><a href="http://eu.battle.net/wow/de/character/gilneas/Rhil/simple#talents">http://eu.battle.net/wow/de/character/gilneas/Rhil/simple#talents</a></li>
+ <li><a href="http://eu.battle.net/wow/fr/character/gilneas/Rhil/simple#talents">http://eu.battle.net/wow/fr/character/gilneas/Rhil/simple#talents</a></li>
+ <li><a href="http://eu.battle.net/wow/es/character/gilneas/Rhil/simple#talents">http://eu.battle.net/wow/es/character/gilneas/Rhil/simple#talents</a></li>
+ <li><h2>Character Spec Tests - 404</h2></li>
+ <li><a href="http://eu.battle.net/wow/en/character/gilneas/Mashayayaaaaah/simple#talents">http://eu.battle.net/wow/en/character/gilneas/Mashayayaaaaah/simple#talents</a></li>
+ <li><a href="http://eu.battle.net/wow/de/character/gilneas/Mashayayaaaaah/simple#talents">http://eu.battle.net/wow/de/character/gilneas/Mashayayaaaaah/simple#talents</a></li>
+ <li><a href="http://eu.battle.net/wow/fr/character/gilneas/Mashayayaaaaah/simple#talents">http://eu.battle.net/wow/fr/character/gilneas/Mashayayaaaaah/simple#talents</a></li>
+ <li><a href="http://eu.battle.net/wow/es/character/gilneas/Mashayayaaaaah/simple#talents">http://eu.battle.net/wow/es/character/gilneas/Mashayayaaaaah/simple#talents</a></li>
+ </ul>
+ <ul class="testbox implicit">
<li><h2>Character PvP Tests - Existing</h2></li>
<li><a href="http://eu.battle.net/wow/en/character/khadgar/Gebru/pvp">http://eu.battle.net/wow/en/character/khadgar/Gebru/pvp</a></li>
<li><a href="http://eu.battle.net/wow/de/character/khadgar/Gebru/pvp">http://eu.battle.net/wow/de/character/khadgar/Gebru/pvp</a></li>
@@ -278,6 +303,7 @@
'../modules/wow.item.equipped.js',
'../modules/wow.character.js',
'../modules/wow.character.pvp.js',
+ '../modules/wow.character.spec.js',
'../modules/wow.guild.js',
'../modules/wow.arena.js',
'../modules/wow.achievement.js',
@@ -93,7 +93,7 @@ DarkTip.registerModule('wow.achievement.character', {
'core': (
'<div class="tooltip-achievement">' +
'<img class="icon" src="<%= this["_meta"]["path_host_media"] %>/wow/icons/56/<% if(this["achievement"]["icon"]) { %><%= this["achievement"]["icon"] %><% } else { %>inv_misc_questionmark<% } %>.jpg" />' +
- '<div class="col-70">' +
+ '<div class="col-70">' +
'<div class="headline-right"><span class="icon-achievenemtpoints"><%= this["achievement"]["points"] %></span></div>' +
'<div class="darktip-row headline"><%= this["achievement"]["title"] %></div>' +
'<div class="darktip-row highlight-reduced"><%= this["achievement"]["description"] %></div>' +
@@ -105,7 +105,7 @@ DarkTip.registerModule('wow.achievement.character', {
'<div class="title">404<span class="sub"> / <%= this._loc("not-found") %></span></div>' +
'<div class="darktip-row"><span class="label"><%= this._loc("label.achievement") %></span> <span class="value"><%= this["achievementid"] %></span></div>' +
'<div class="darktip-row"><span class="label"><%= this._loc("label.region") %></span> <span class="value"><%= this["region"] %></span></div>' +
- '</div>'
+ '</div>'
)
},
View
@@ -98,6 +98,8 @@ DarkTip.registerModule('wow.character', {
return false;
}
+ state['data']['character']['talentSpecCount'] = 0;
+
if((typeof state['data']['character'] !== 'undefined') && (typeof state['data']['character']['talents'] !== 'undefined'))
{
for(var i = 0; i < state['data']['character']['talents'].length; i++)
@@ -107,6 +109,11 @@ DarkTip.registerModule('wow.character', {
var maxtier = -1;
var ordered = [];
+ if(typeof cspec['spec'] !== 'undefined')
+ {
+ state['data']['character']['talentSpecCount'] = state['data']['character']['talentSpecCount'] + 1;
+ }
+
if((typeof cspec['talents'] !== 'undefined') && (cspec['talents'].length > 0))
{
for(var j = 0; j < cspec['talents'].length; j++)
@@ -49,18 +49,6 @@ DarkTip.registerModule('wow.character.pvp', {
'condition': true,
'call' : 'http://<%= this["host"] %>/api/wow/character/<%= this["realm"] %>/<%= this["character"] %>?fields=guild,talents,items,pvp&locale=<%= this["locale"] %>'
}
- /*
- 'races' : {
- 'required' : false,
- 'condition': 'character.race',
- 'call' : 'http://<%= this["host"] %>/api/wow/data/character/races?locale=<%= this["locale"] %>'
- },
- 'classes' : {
- 'required' : false,
- 'condition': 'character.class',
- 'call' : 'http://<%= this["host"] %>/api/wow/data/character/classes?locale=<%= this["locale"] %>'
- },
- // */
},
'getParams': {
@@ -117,14 +105,6 @@ DarkTip.registerModule('wow.character.pvp', {
/* --- END extended mode -------------------------------- */
'</div>'
),
- '404': (
- '<div class="tooltip-character tooltip-pvp tooltip-404">' +
- '<div class="title">404<span class="sub"> / <%= this._loc("not-found") %></span></div>' +
- '<div class="darktip-row"><span class="label"><%= this._loc("label.character") %></span> <span class="value"><%= this["character"] %></span></div>' +
- '<div class="darktip-row"><span class="label"><%= this._loc("label.realm") %></span> <span class="value"><%= this["realm"] %></span></div>' +
- '<div class="darktip-row"><span class="label"><%= this._loc("label.region") %></span> <span class="value"><%= this["region"] %></span></div>' +
- '</div>'
- ),
'fragments': {
'arenaTeams': (
'<div class="highlight-weak"><%= this._loc("arenaTeams") %></div>' +
@@ -0,0 +1,210 @@
+/* **************************************************************************
+ * The DarkTip plugin is a javascript based tooltip framework that enables
+ * quick and easy development of modules that hook into specific aspects of a
+ * webpage and display context sensitive tooltips.
+ *
+ * Copyright (C) 2012 Martin Gelder
+ * (darkspotinthecorner {at} gmail {dot} com)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/gpl.html.
+ * ************************************************************************** */
+
+DarkTip.registerModule('wow.character.spec', {
+
+ 'triggers': {
+ 'explicit': {
+ 'match' : /wow\.character.spec:(us|eu|kr|tw|cn)\.([^\.]+)\.([^\(]+)\((en|de|fr|es|ru|ko|zh)\)/i,
+ 'params': {
+ '1': 'region',
+ '2': 'realm',
+ '3': 'character',
+ '4': 'lang'
+ }
+ },
+ 'implicit': {
+ 'match' : /http:\/\/(us\.battle\.net|eu\.battle\.net|kr\.battle\.net|tw\.battle\.net|cn\.battle\.net|www\.battlenet\.com\.cn)\/wow\/(en|de|fr|es|ru|ko|zh)\/character\/([^\/]+)\/([^\/#]+)\/[^#]*#talents/i,
+ 'params': {
+ '1': 'host',
+ '2': 'lang',
+ '3': 'realm',
+ '4': 'character'
+ }
+ }
+ },
+
+ 'queries': {
+ 'character': {
+ 'required' : true,
+ 'condition': true,
+ 'call' : 'http://<%= this["host"] %>/api/wow/character/<%= this["realm"] %>/<%= this["character"] %>?fields=guild,talents&locale=<%= this["locale"] %>'
+ }
+ },
+
+ 'getParams': {
+ 'explicit': function(result) {
+ var params = DarkTip.mapRegex(result, DarkTip._read(DarkTip.route('wow.character.spec', 'triggers.explicit.params')));
+ params['host'] = DarkTip.map('wow', 'maps.region.host', params['region']);
+ params['locale'] = DarkTip.map('wow', 'maps.region+lang.locale', (params['region'] + '+' + params['lang']));
+ return params;
+ },
+ 'implicit': function(result) {
+ var params = DarkTip.mapRegex(result, DarkTip._read(DarkTip.route('wow.character.spec', 'triggers.implicit.params')));
+ console.log(params);
+ params['region'] = DarkTip.map('wow', 'maps.host.region', params['host']);
+ params['locale'] = DarkTip.map('wow', 'maps.region+lang.locale', (params['region'] + '+' + params['lang']));
+ return params;
+ }
+ },
+
+ 'layout': {
+ 'width': {
+ 'core': 380
+ }
+ },
+
+ 'templates': {
+ 'core': (
+ '<div class="tooltip-character tooltip-spec">' +
+ '<img class="icon" src="<%= this["_meta"]["path_host"] %>/static-render/<%= this["_meta"]["region"] %>/<%= this["character"]["thumbnail"] %>?alt=/wow/static/images/2d/avatar/<%= this["character"]["race"] %>-<%= this["character"]["gender"] %>.jpg" />' +
+ /* --- START simple mode -------------------------------- */
+ '<div class="col-98<% if(this["character"]["talentSpecCount"] > 1) { %> darktip-only-s<% } %>">' +
+ '<div class="headline-right">Active Spec</div>' +
+ '<div class="darktip-row headline cclass-<%= this["character"]["class"] %>"><%= this["character"]["name"] %></div>' +
+ '<div class="darktip-row"><%= this._loc("classification") %></div>' +
+ '<%= this._subLoop("templates.fragments.talentSpecActive", this["character"]["talents"]) %>' +
+ '<% if(this["_meta"]["extendedActive"] && (this["character"]["talentSpecCount"] > 1)) { %>' +
+ '<div class="darktip-row info-meta"><%= this._loc("extendedInactive") %></div>' +
+ '<% } else { %>' +
+ '<div class="darktip-row info-meta">No alternate spec available</div>' +
+ '<% } %>' +
+ '</div>' +
+ /* --- END simple mode ---------------------------------- */
+ /* --- START extended mode ------------------------------ */
+ '<% if(this["_meta"]["extendedActive"] && (this["character"]["talentSpecCount"] > 1)) { %>' +
+ '<div class="col-98 darktip-only-x">' +
+ '<div class="headline-right">Inactive Spec</div>' +
+ '<div class="darktip-row headline cclass-<%= this["character"]["class"] %>"><%= this["character"]["name"] %></div>' +
+ '<div class="darktip-row"><%= this._loc("classification") %></div>' +
+ '<%= this._subLoop("templates.fragments.talentSpecInactive", this["character"]["talents"]) %>' +
+ '<div class="darktip-row info-meta"><%= this._loc("extendedActive") %></div>' +
+ '</div>' +
+ '<% } %>' +
+ /* --- END extended mode -------------------------------- */
+ '</div>'
+ ),
+ 'fragments': {
+ 'talentSpecActive': (
+ '<% if(this["selected"]) { %>' +
+ '<%= this._sub("templates.fragments.talentSpec") %>' +
+ '<% } %>'
+ ),
+ 'talentSpecInactive': (
+ '<% if((typeof this["selected"] === "undefined") || (!this["selected"])) { %>' +
+ '<%= this._sub("templates.fragments.talentSpec") %>' +
+ '<% } %>'
+ ),
+ 'talentSpec': (
+ '<% if(this["spec"]) { %>' +
+ '<div class="darktip-row spec block">' +
+ '<img class="icon-18x18" src="<%= this["_meta"]["path_host_media"] %>/wow/icons/18/<% if(this["spec"]["icon"]) { %><%= this["spec"]["icon"] %><% } else { %>inv_misc_questionmark<% } %>.jpg"/> ' +
+ '<%= this["spec"]["name"] %> <span class="role">(<%= this["spec"]["role"] %>)</span>' +
+ '<% if(this["talents"].length > 0) { %>' +
+ '<%= this._subLoop("templates.fragments.talent", this["talents_ordered"]) %>' +
+ '<% } %>' +
+ '</div>' +
+ '<% if(this["glyphs"]) { %>' +
+ '<%= this._sub("templates.fragments.talentSpecGlyphMajor", this["glyphs"]) %>' +
+ '<%= this._sub("templates.fragments.talentSpecGlyphMinor", this["glyphs"]) %>' +
+ '<% } %>' +
+ '<% } %>'
+ ),
+ 'talent': (
+ '<div class="block talent">' +
+ '<img class="icon-10x10" src="<%= this["_meta"]["path_host_media"] %>/wow/icons/18/<% if(this["spell"]["icon"]) { %><%= this["spell"]["icon"] %><% } else { %>inv_misc_questionmark<% } %>.jpg"/> ' +
+ '<%= this["spell"]["name"] %>' +
+ '</div>'
+ ),
+ 'talentSpecGlyphMajor': (
+ '<div class="darktip-row spec block">' +
+ '<% if((this["major"]) && (this["major"].length)) { %>' +
+ '<div class="highlight-weak"><%= this._loc("glyphMajor") %></div>' +
+ '<%= this._subLoop("templates.fragments.glyph", this["major"]) %>' +
+ '<% } else { %>' +
+ '<span class="highlight-weak"><%= this._loc("glyphMajorEmpty") %></span>' +
+ '<% } %>' +
+ '</div>'
+ ),
+ 'talentSpecGlyphMinor': (
+ '<div class="darktip-row spec block">' +
+ '<% if((this["minor"]) && (this["minor"].length)) { %>' +
+ '<div class="highlight-weak"><%= this._loc("glyphMinor") %></div>' +
+ '<%= this._subLoop("templates.fragments.glyph", this["minor"]) %>' +
+ '<% } else { %>' +
+ '<span class="highlight-weak"><%= this._loc("glyphMinorEmpty") %></span>' +
+ '<% } %>' +
+ '</div>'
+ ),
+ 'glyph': (
+ '<div class="block glyph">' +
+ '<img class="icon-10x10" src="<%= this["_meta"]["path_host_media"] %>/wow/icons/18/<% if(this["icon"]) { %><%= this["icon"] %><% } else { %>inv_misc_questionmark<% } %>.jpg"/> ' +
+ '<%= this["name"] %>' +
+ '</div>'
+ )
+ }
+ },
+
+ 'i18n': {
+ 'en_US': {
+ 'loading' : 'Loading character...',
+ 'not-found' : 'Character not found',
+ 'extendedInactive': 'Hold [<%= this["_meta"]["extendedKeyCodeLabel"] %>] for inactive spec',
+ 'extendedActive' : 'Release [<%= this["_meta"]["extendedKeyCodeLabel"] %>] for active spec',
+ 'glyphMajor' : 'Major glyphs:',
+ 'glyphMinor' : 'Minor glyphs:',
+ 'glyphMajorEmpty' : 'No major glyphs used',
+ 'glyphMinorEmpty' : 'No minor glyphs used'
+ },
+ 'de_DE': {
+ 'loading' : 'Lade Charakter...',
+ 'not-found' : 'Charakter nicht gefunden',
+ 'extendedInactive': '[<%= this["_meta"]["extendedKeyCodeLabel"] %>] gedr&uuml;ckt für inaktive Skillung',
+ 'extendedActive' : '[<%= this["_meta"]["extendedKeyCodeLabel"] %>] loslassen für aktive Skillung',
+ 'glyphMajor' : 'Erhebliche Glyphen:',
+ 'glyphMinor' : 'Geringe Glyphen:',
+ 'glyphMajorEmpty' : 'Keine erheblichen Glyphen',
+ 'glyphMinorEmpty' : 'Keine geringen Glyphen'
+ },
+ 'fr_FR': {
+ 'loading' : 'Chargement personnage...',
+ 'not-found' : 'Aucun personnage trouv&eacute;e',
+ 'extendedInactive': 'Maintenez [<%= this["_meta"]["extendedKeyCodeLabel"] %>] pour spec inactive',
+ 'extendedActive' : 'Relâchez [<%= this["_meta"]["extendedKeyCodeLabel"] %>] pour spec actif',
+ 'glyphMajor' : 'Glyphes majeurs:',
+ 'glyphMinor' : 'Glyphes mineurs:',
+ 'glyphMajorEmpty' : 'Pas de glyphes majeurs utilisés',
+ 'glyphMinorEmpty' : 'Pas de glyphes mineurs utilisés'
+ },
+ 'es_ES': {
+ 'loading' : 'Cargando personaje...',
+ 'not-found' : 'Personaje no encontrado',
+ 'extendedInactive': 'Mantenga pulsado [<%= this["_meta"]["extendedKeyCodeLabel"] %>] para spec inactivo',
+ 'extendedActive' : 'Suelte [<%= this["_meta"]["extendedKeyCodeLabel"] %>] para spec activo',
+ 'glyphMajor' : 'Glifos sublimes:',
+ 'glyphMinor' : 'Glifos menores:',
+ 'glyphMajorEmpty' : 'No hay glifos sublimes',
+ 'glyphMinorEmpty' : 'No hay glifos menores'
+ }
+ }
+
+});
View
@@ -254,9 +254,14 @@ body.darktip-extended-mode .darktip-tooltip-wow span.darktip-only-x {
font-size: 80%;
}
-.darktip-tooltip-wow .spec .talent {
- padding-left: 2em;
- font-size: 80%;
+.darktip-tooltip-wow .spec .talent,
+.darktip-tooltip-wow .spec .glyph {
+ padding-left: 10px;
+ font-size: 87%;
+}
+
+.darktip-tooltip-wow .tooltip-spec .spec {
+ padding-top: 4px;
}
.darktip-tooltip-wow .icon {
Oops, something went wrong.

0 comments on commit c2ca46f

Please sign in to comment.