Verzeichnisstruktur phpBB-3.1.0
- Veröffentlicht
- 27.10.2014
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
ajax.js
01 /* global phpbb */
02
03 (function($) { // Avoid conflicts with other libraries
04
05 'use strict';
06
07 /**
08 * The following callbacks are for reording items. row_down
09 * is triggered when an item is moved down, and row_up is triggered when
10 * an item is moved up. It moves the row up or down, and deactivates /
11 * activates any up / down icons that require it (the ones at the top or bottom).
12 */
13 phpbb.addAjaxCallback('row_down', function(res) {
14 if (typeof res.success === 'undefined' || !res.success) {
15 return;
16 }
17
18 var $firstTr = $(this).parents('tr'),
19 $secondTr = $firstTr.next();
20
21 $firstTr.insertAfter($secondTr);
22 });
23
24 phpbb.addAjaxCallback('row_up', function(res) {
25 if (typeof res.success === 'undefined' || !res.success) {
26 return;
27 }
28
29 var $secondTr = $(this).parents('tr'),
30 $firstTr = $secondTr.prev();
31
32 $secondTr.insertBefore($firstTr);
33 });
34
35 /**
36 * This callback replaces activate links with deactivate links and vice versa.
37 * It does this by replacing the text, and replacing all instances of "activate"
38 * in the href with "deactivate", and vice versa.
39 */
40 phpbb.addAjaxCallback('activate_deactivate', function(res) {
41 var $this = $(this),
42 newHref = $this.attr('href');
43
44 $this.text(res.text);
45
46 if (newHref.indexOf('deactivate') !== -1) {
47 newHref = newHref.replace('deactivate', 'activate');
48 } else {
49 newHref = newHref.replace('activate', 'deactivate');
50 }
51
52 $this.attr('href', newHref);
53 });
54
55 /**
56 * The removes the parent row of the link or form that triggered the callback,
57 * and is good for stuff like the removal of forums.
58 */
59 phpbb.addAjaxCallback('row_delete', function(res) {
60 if (res.SUCCESS !== false) {
61 $(this).parents('tr').remove();
62 }
63 });
64
65
66
67 $('[data-ajax]').each(function() {
68 var $this = $(this),
69 ajax = $this.attr('data-ajax');
70
71 if (ajax !== 'false') {
72 var fn = (ajax !== 'true') ? ajax : null;
73 phpbb.ajaxify({
74 selector: this,
75 refresh: $this.attr('data-refresh') !== undefined,
76 callback: fn
77 });
78 }
79 });
80
81 /**
82 * Automatically resize textarea
83 */
84 $(function() {
85 phpbb.resizeTextArea($('textarea:not(.no-auto-resize)'), {minHeight: 75});
86 });
87
88
89 })(jQuery); // Avoid conflicts with other libraries
90