Location: PHPKode > scripts > ezStats for PlayStation Network > ezStats2_psn/admin/templates/editplayer.html
<script type="text/javascript" charset="utf-8">
	(function($) {
		$.extend({
			load_player: function() {
				$.ajax({
					type:     "POST",
					url:      "action.php",
					dataType: "html",
					data: {
						sid: "$sid",
						action: "load_player"
					},
					error: function(data) {
						if (data && data.responseText) $('aside').text("").html(data.responseText).fadeIn();
					},
					success: function(data) {
						$('#playerlist').find('tbody').html(data);
					}
				});
			},
			
			edit_player: function(elem) {
				$.ajax({
					type:     "POST",
					url:      "action.php",
					dataType: "json",
					data: {
						action: "edit_player",
						sid:    "$sid",
						input:  {
							name:  elem.attr("name"),
							id:    elem.attr("playerid"),
							value: elem.val()
						}
					},
					beforeSend: function() {
						$('aside').stop(true, true).hide().text('%saving% ...').fadeIn();
					},
					error: function(data) {
						if (data && data.responseText)
							$('aside').text("").html(data.responseText).fadeIn();
					},
					success:    function(data) {
						if (data && data.message) 
							 $('aside').text(data.message);
						else $('aside').fadeOut();
					}
				});
			},
			
			delete_player: function(input) {
				$.ajax({
					type:     "POST",
					url:      "action.php",
					dataType: "json",
					data: {
						sid: "$sid",
						action: "delete_player",
						input: input
					},
					error: function(data) {
						if (data && data.responseText) $('aside').text("").html(data.responseText).fadeIn();
					},
					success: function(data) {
						// Ergebnis ausgeben
						if (data && data.message) {
							$('aside').stop(true, true).hide().text(data.message).fadeIn().delay(2000).fadeOut();
						}
						
						// Spieleruebersicht aktualisieren, falls Funktion geladen wurde
						if (typeof $.load_player() == "function") $.load_player();
					}
				});
			}
		});
	})(jQuery);
	
	
	$(document).ready(function(){
		// Spieleruebersicht aktualisieren
		$.load_player();
		
		// Standardvariable
		var list = $('#playerlist');
		
		// Tooltipp auf alle title-Attribute
		list.find('[title]').tooltip({width: "300px"});
		
		// Automatische Anpassung der Eingabefelder auf den Text
		// Speichern der Eingabe in die Eingabefelder
		list.find('input')
			.live("click", function() {
				$(this).auto_size_input();
			})
			.live("keyup change", function(e) {
				$.edit_player($(this));
			});
		
		// Loeschfunktion aktivieren
		list.find('[action=delete]').live("click", function(e) {
			e.preventDefault();
			var link = $(this);
			
			link
				.addClass("delete")
				.text(link.attr("delphrase"))
				.mouseout(function() {
					$(this)
						.removeClass("delete")
						.text(link.attr("defphrase"))
						.unbind();
				})
				.click(function() {
					$.delete_player({
						id:   link.attr("playerid"),
						name: link.attr("playername")
					});
				});
			
		});
	});
</script>

<section id="playerlist">
	<h1>%edit_player%</h1>
	<table class="playerlist">
		<thead>
			<tr>
				<th></th>
				<th class="tleft">%name%</th>
				<th class="tleft">%jid%</th>
				<th>%nickname% <span class="info" title="%nickname_info%"></span></th>
				<th>%custom1% <span class="info" title="%custom1_info%"></span></th>
				<th>%last_update% <span class="info" title="%last_update_info%"></span></th>
				<th></th>
			</tr>
		</thead>
		<tbody>
		</tbody>
	</table>
</section>
Return current item: ezStats for PlayStation Network