MediaWiki:Gadget-jqinlog.basic.js

A Wikipédiából, a szabad enciklopédiából

Megjegyzés: közzététel után frissítened kell a böngésződ gyorsítótárát, hogy lásd a változásokat.

  • Firefox / Safari: tartsd lenyomva a Shift gombot és kattints a Frissítés gombra a címsorban, vagy használd a Ctrl–F5 vagy Ctrl–R (Macen ⌘–R) billentyűkombinációt
  • Google Chrome: használd a Ctrl–Shift–R (Macen ⌘–Shift–R) billentyűkombinációt
  • Internet Explorer / Edge: tartsd nyomva a Ctrl-t, és kattints a Frissítés gombra, vagy nyomj Ctrl–F5-öt
  • Opera: Nyomj Ctrl–F5-öt
/**
 * Basic functions for jQuery inlog.
 * 
 * Load this module with `mw.loader.load( 'ext.gadget.jqinlog.basic' )` or
 * by declaring dependency every time you intend to use jQuery inlog: it's
 * cheap and ensures that you won't call any undefined function even if you
 * don't actually load jQuery inlog.
 */
$.fn.log = function(msg) {
	if (!window.console || !console.log) return;
	if (msg) {
		if (typeof msg == 'string') {
			console.log('%s: %o', msg, this);
		} else {
			console.log('%o -> %o', this, msg);
		}
	} else {
		console.log(this);
	}
	return this;
};

$.startInlog = $.fn.startInlog = function(config) {
	if (!$.inlog) return;
	$.inlog({
		enabled: true,
		thisValue: true
	});
	return this;
};
$.endInlog = $.fn.endInlog = function(config) {
	if (!$.inlog) return;
	$.inlog(false);
	return this;
};