Toutim

Une image vaut… et tout le toutim !

Petit essai pour comparer ; tout d’abord l’image :

Code Javascript

Ensuite le code correspondant :

function addTranslationRow(post_id,post_lang,rosetta_id,table) {
	var params = {
		f: 'getTranslationRow',
		xd_check: dotclear.nonce,
		id: post_id,
		lang: post_lang,
		rosetta_id: rosetta_id
	};
	$.get('services.php',params,function(data) {
		if ($('rsp[status=failed]',data).length > 0) {
			// For debugging purpose only:
			// console.log($('rsp',data).attr('message'));
			console.log('Dotclear REST server error');
		} else {
			// ret -> status (true/false)
			// msg -> message to display
			var ret = Number($('rsp>rosetta',data).attr('ret'));
			var msg = $('rsp>rosetta',data).attr('msg');
			if (ret) {
				// Append the new line at the end of the table
				$(table).append(msg);
				// Bind removing translation function
				$(table+' tr:last td:last a').bind('click',function(e){
					removeTranslation($(this));
					e.preventDefault();
				});
				return true;
			}
		}
	});
	return null;
}

Elle fonctionne pas la mal la coloration syntaxique de SublimeText, non ? Mais bon, Yash, c’est tout de même plus pratique pour faire un copié-collé ;-)

Ajouter un commentaire

Les champs suivis d'un * sont obligatoires

Les commentaires peuvent être formatés en utilisant la syntaxe Markdown Extra.

Ajouter un rétrolien

URL de rétrolien : https://open-time.net/trackback/12478

Haut de page