Commits

Sylvain Rouquette committed 6342376

fixed title. fixed rune update

Comments (0)

Files changed (3)

 	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
 	<script type="text/javascript" src="js/tooltips.js"></script>
 	<script type="text/javascript" src="js/main.js"></script>
-	<title>Diablo3 Skill Filter</title>
+	<title>Diablo3 Build Planner</title>
 </head>
 <body>
 <div id="wrapper">
 })(jQuery);
 
 
+function hashToPos(element) {
+	return HASH.indexOf(element.attr('data-hash'));
+}
+
+
 function bindSkills() {
 	$('#filter .skills a').live('click', function() {
 		var skill = $(this).parents('.skill').clone();
 
 		var build_skill = $('#build .skills [data-skill="'+skill.attr('data-skill')+'"]');
 		if (build_skill.length) {
+			build_skill.find('a').attr('href', $(this).attr('href'));
+			build_skill.find('.rune_name').html(g_classes[g_current_class]
+				.skills[hashToPos(skill.find('.desc'))]
+				.runes[hashToPos(skill.find('.d3-icon-rune'))].name);
 			build_skill.find('.runes').replaceWith(skill.find('.runes'));
 		}
 		else if ($('#build .skills').children().length >= 6)
 			return false;
-		else
+		else {
+			skill.attr('href', $(this).attr('href'));
 			$('#build .skills').append(skill);
+		}
 		refreshUrl();
 		return false;
 	});
 						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('{href_rune_'+rune+'}', link + '/active/' + obj.slug + '#' + rune_type)
 							   .replace('{hash_rune_'+rune+'}', obj.runes[rune].hash)
 							   .replace('{rune_name}', obj.runes[rune].name);
 					}
 					}
 				}
 				if (single_rune)
-					li = li.replace('{href_skill}', link + '/active/' + obj.slug + '/' + rune_type);
+					li = li.replace('{href_skill}', link + '/active/' + obj.slug + '#' + rune_type);
 				else
 					li = li.replace('{href_skill}', link + '/active/' + obj.slug)
 
 	params += '!' + runes;
 	$('#bnet_calc').attr('href', CALC_URL + params);
 	window.history.replaceState(null, null, '?' + params);
+	document.title = $('#class_selector [value="'+g_current_class+'"]').html() + ' - Diablo3 Build Planner';
 }
 
 				type: 'skill'
 			}
 		},
-		// class/{classSlug}/active/{skillSlug}/{runeType}
+		// class/{classSlug}/active/{skillSlug}#{runeType}
 		{
-			regex: new RegExp('^class/([^/]+)/active/([^/]+)/([^#\\?]+)$'),
+			regex: new RegExp('^class/([^/]+)/active/([^/]+)#([^#\\?]+)$'),
 			params: {
 				type: 'skill'
 			}