summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Translate/resources/js/ext.translate.hooks.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/Translate/resources/js/ext.translate.hooks.js')
-rw-r--r--www/wiki/extensions/Translate/resources/js/ext.translate.hooks.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/www/wiki/extensions/Translate/resources/js/ext.translate.hooks.js b/www/wiki/extensions/Translate/resources/js/ext.translate.hooks.js
new file mode 100644
index 00000000..a227b304
--- /dev/null
+++ b/www/wiki/extensions/Translate/resources/js/ext.translate.hooks.js
@@ -0,0 +1,37 @@
+/*!
+ * JavaScript hook framework for Translate (since MediaWiki code doesn't
+ * yet have one. See hooks.txt in Translate directory for how to use hooks.
+ *
+ * @author Harry Burt
+ * @license GPL-2.0-or-later
+ * @since 2012-08-22
+ */
+
+( function () {
+ 'use strict';
+
+ mw.translateHooks = {
+ add: function ( name, func ) {
+ showDeprecationWarning();
+
+ mw.hook( name ).add( func );
+ },
+
+ run: function ( /* infinite list of parameters */ ) {
+ var args, name;
+
+ showDeprecationWarning();
+
+ args = Array.prototype.slice.call( arguments );
+ name = args.shift();
+
+ mw.hook( name ).fire( args );
+ }
+ };
+
+ function showDeprecationWarning() {
+ mw.log.warn( '`mw.translateHooks` has been deprecated and will be removed in the ' +
+ 'future. Use `mw.hook` instead. See - ' +
+ 'https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook' );
+ }
+}() );