aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/adm/style
diff options
context:
space:
mode:
authorCallum Macrae <callum@macr.ae>2014-08-13 22:53:28 +0100
committerCallum Macrae <callum@macr.ae>2014-08-13 22:53:28 +0100
commitd79fec1c3fc57730807700610a69a9cf81df8c0c (patch)
treeefad69731dae4e62bcd9fe6c9fd71a5ce717c83b /phpBB/adm/style
parent340f48fdebd1622de8a44c6fc655e47f61583ca2 (diff)
downloadforums-d79fec1c3fc57730807700610a69a9cf81df8c0c.tar
forums-d79fec1c3fc57730807700610a69a9cf81df8c0c.tar.gz
forums-d79fec1c3fc57730807700610a69a9cf81df8c0c.tar.bz2
forums-d79fec1c3fc57730807700610a69a9cf81df8c0c.tar.xz
forums-d79fec1c3fc57730807700610a69a9cf81df8c0c.zip
[ticket/12982] Refactoring: made JS in adm nice
PHPBB3-12982
Diffstat (limited to 'phpBB/adm/style')
-rw-r--r--phpBB/adm/style/ajax.js33
1 files changed, 16 insertions, 17 deletions
diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js
index 959580d6c2..4ad6b6afa5 100644
--- a/phpBB/adm/style/ajax.js
+++ b/phpBB/adm/style/ajax.js
@@ -1,6 +1,8 @@
+/* global phpbb */
+
(function($) { // Avoid conflicts with other libraries
-"use strict";
+'use strict';
/**
* The following callbacks are for reording items. row_down
@@ -13,11 +15,10 @@ phpbb.addAjaxCallback('row_down', function(res) {
return;
}
- var el = $(this),
- tr = el.parents('tr'),
- trSwap = tr.next();
+ var $firstTr = $(this).parents('tr'),
+ $secondTr = $firstTr.next();
- tr.insertAfter(trSwap);
+ $firstTr.insertAfter($secondTr);
});
phpbb.addAjaxCallback('row_up', function(res) {
@@ -25,11 +26,10 @@ phpbb.addAjaxCallback('row_up', function(res) {
return;
}
- var el = $(this),
- tr = el.parents('tr'),
- trSwap = tr.prev();
+ var $secondTr = $(this).parents('tr'),
+ $firstTr = $secondTr.prev();
- tr.insertBefore(trSwap);
+ $secondTr.insertBefore($firstTr);
});
/**
@@ -38,10 +38,10 @@ phpbb.addAjaxCallback('row_up', function(res) {
* in the href with "deactivate", and vice versa.
*/
phpbb.addAjaxCallback('activate_deactivate', function(res) {
- var el = $(this),
- newHref = el.attr('href');
+ var $this = $(this),
+ newHref = $this.attr('href');
- el.text(res.text);
+ $this.text(res.text);
if (newHref.indexOf('deactivate') !== -1) {
newHref = newHref.replace('deactivate', 'activate');
@@ -49,7 +49,7 @@ phpbb.addAjaxCallback('activate_deactivate', function(res) {
newHref = newHref.replace('activate', 'deactivate');
}
- el.attr('href', newHref);
+ $this.attr('href', newHref);
});
/**
@@ -66,11 +66,10 @@ phpbb.addAjaxCallback('row_delete', function(res) {
$('[data-ajax]').each(function() {
var $this = $(this),
- ajax = $this.attr('data-ajax'),
- fn;
+ ajax = $this.attr('data-ajax');
if (ajax !== 'false') {
- fn = (ajax !== 'true') ? ajax : null;
+ var fn = (ajax !== 'true') ? ajax : null;
phpbb.ajaxify({
selector: this,
refresh: $this.attr('data-refresh') !== undefined,
@@ -82,7 +81,7 @@ $('[data-ajax]').each(function() {
/**
* Automatically resize textarea
*/
-$(document).ready(function() {
+$(function() {
phpbb.resizeTextArea($('textarea:not(.no-auto-resize)'), {minHeight: 75});
});