Commits

Sylvain Rouquette committed 4a57071

added rune to skill tooltip

  • Participants
  • Parent commits 39c58a5

Comments (0)

Files changed (4)

 <body>
 <div id="wrapper">
 
+
 <div id="filter">
 	<form id="class_selector">
 		<select>
 				<span class="d3-icon d3-icon-skill d3-icon-skill-42" style="background-image: url(\'{icon_skill}\');">\
 					<span class="frame"/></span>\
 				</span>\
-				<span class="skill_name">{skill}</span>\
+				<span class="legend">\
+					<span class="skill_name">{skill_name}</span>\
+					<span class="rune_name">{rune_name}</span>\
+				</span>\
 			</div>\
 		</a>\
 		<ul class="runes">\
 				<span class="d3-icon d3-icon-trait d3-icon-trait-42" style="background-image: url(\'{icon_skill}\');">\
 					<span class="frame"/></span>\
 				</span>\
-				<span class="skill_name">{skill}</span>\
+				<span class="skill_name">{skill_name}</span>\
 			</div>\
 		</a>\
 	</li>';
 
 
 function refreshSkills(target, skills) {
-	var li;
+	var li, rune_type, single_rune;
 	for (var type in skills) {
 		var ul = '';
 		for (var skill in skills[type]) {
 			if (type == 'skills') {
 				li = FILTER_SKILL_LI.replace('{slug_skill}', obj.slug)
 							 .replace('{hash_skill}', obj.hash)
-							 .replace('{href_skill}', link + '/active/' + obj.slug)
 							 .replace('{icon_skill}', ICON_URL + obj.icon + '.png')
-							 .replace('{skill}', obj.name);
+							 .replace('{skill_name}', obj.name);
+				single_rune = false;
 				for (var rune in obj.runes) {
-					if (obj.runes[rune])
-						li = li.replace('{href_rune_'+rune+'}', RUNE_URL + obj.runes[rune].tooltipParams)
-							   .replace('{type_rune_'+rune+'}', obj.runes[rune].type)
-							   .replace('{hash_rune_'+rune+'}', obj.runes[rune].hash);
-					else
+					if (obj.runes[rune]) {
+						rune_type = obj.runes[rune].type;
+						li = li.replace('{type_rune_'+rune+'}', obj.runes[rune].type)
+							   //.replace('{href_rune_'+rune+'}', RUNE_URL + obj.runes[rune].tooltipParams)
+							   .replace('{href_rune_'+rune+'}', link + '/active/' + obj.slug + '/' + rune_type)
+							   .replace('{hash_rune_'+rune+'}', obj.runes[rune].hash)
+							   .replace('{rune_name}', obj.runes[rune].name);
+					}
+					else {
+						single_rune = true;
 						li = li.replace('rune_'+rune, 'hidden')
+					}
 				}
+				if (single_rune)
+					li = li.replace('{href_skill}', link + '/active/' + obj.slug + '/' + rune_type);
+				else
+					li = li.replace('{href_skill}', link + '/active/' + obj.slug)
+
 			}
 			else {
 				li = FILTER_PASSIVE_LI.replace('{slug_skill}', obj.slug)
 							 .replace('{hash_skill}', obj.hash)
 							 .replace('{href_skill}', link + '/passive/' + obj.slug)
 							 .replace('{icon_skill}', ICON_URL + obj.icon + '.png')
-							 .replace('{skill}', obj.name);
+							 .replace('{skill_name}', obj.name);
 			}
 			ul += li;
 		}

File js/tooltips.js

 				type: 'skill'
 			}
 		},
+		// class/{classSlug}/active/{skillSlug}/{runeType}
+		{
+			regex: new RegExp('^class/([^/]+)/active/([^/]+)/([^#\\?]+)$'),
+			params: {
+				type: 'skill'
+			}
+		},
 		// rune/{skillSlug}/{runeType}
 		{
 			regex: new RegExp('^rune/([^/]+)/([^#\\?]+)$'),
 
 			var folder = RegExp.$1;
 			var key = RegExp.$2;
+			var rune = RegExp.$3;
 
 			if(folder.indexOf('/') != -1 || key.indexOf('/') != -1) { // Folder and key shouldn't contain any slashes
 				continue;
 			params.locale = locale;
 			params.folder = folder;
 			params.key = key;
+			if (rune.length)
+				params.rune = rune;
 
 			// Copy pattern's params
 			for(var i in urlPattern.params) {
 			.replace('{folder}', params.folder)
 			.replace('{key}',    params.key);
 
-		$.getScript(url + '?format=jsonp');
+		if ('rune' in params)
+			$.getScript(url + '?format=jsonp&runeType=' + params.rune);
+		else
+			$.getScript(url + '?format=jsonp');
 	}
 
 	function registerData(data) {
 
 		var params = data.params;
 
+		if (params.type == 'skill') {
+			var rune = data.tooltipHtml.search('class=\"rune-');
+			if (rune > 0)
+				params.rune = data.tooltipHtml.charAt(rune + 12);
+		}
+
 		saveData(params, data);
 
 		if(currentParams != null && getCacheKeyFromParams(params) == getCacheKeyFromParams(currentParams)) {
 	}
 
 	function getCacheKeyFromParams(params) {
+		// rune only
 		if (params.type == 'rune' && 'folder' in params)
 			return [
 				params.region,
 				params.key
 			].join('-');
 
+		// skill + rune
+		if ('rune' in params)
+			return [
+				params.region,
+				params.locale,
+				params.type,
+				params.key,
+				params.rune
+			].join('-');
+
 		return [
 			params.region,
 			params.locale,
 	overflow-y: auto;
 	clear: both;
 }
+#filter .rune_name {
+	display: none;
+}
 .skill {
 	height:	48px;
 	clear: both;
 	position: relative;
 	font-size: 20px;
 }
-.skills .skill_name {
+#build .skill_name, .rune_name {
+	display: block;
+}
+#filter .skills .skill_name {
 	top: -14px;
 }
 .traits .skill_name {
 #build .skills {
 	text-align: left;
 }
-#build .traits {
+#build .legend, #build .traits {
 	display: inline-block;
 }
+#build .legend {
+	position: relative;
+	top: -4px;
+}
 #build .traits li {
 	background-color: #000;
 	display: inline;
 	display: inline;
 	width: auto;
 }
+.rune_name {
+	color: #D7851A;
+}
 ::-webkit-scrollbar {
 	width: 10px;
 	height: 10px;