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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

editor.js

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 9.01 KiB


001  /**
002  * bbCode control by subBlue design [ www.subBlue.com ]
003  * Includes unixsafe colour palette selector by SHS`
004  */
005   
006  // Startup variables
007  var imageTag = false;
008  var theSelection = false;
009  var bbcodeEnabled = true;
010   
011  // Check for Browser & Platform for PC & IE specific bits
012  // More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
013  var clientPC = navigator.userAgent.toLowerCase(); // Get client info
014  var clientVer = parseInt(navigator.appVersion, 10); // Get browser version
015   
016  var is_ie = ((clientPC.indexOf('msie') !== -1) && (clientPC.indexOf('opera') === -1));
017  var is_win = ((clientPC.indexOf('win') !== -1) || (clientPC.indexOf('16bit') !== -1));
018  var baseHeight;
019   
020  /**
021  * Shows the help messages in the helpline window
022  */
023  function helpline(help) {
024      document.forms[form_name].helpbox.value = help_line[help];
025  }
026   
027  /**
028  * Fix a bug involving the TextRange object. From
029  * http://www.frostjedi.com/terra/scripts/demo/caretBug.html
030  */ 
031  function initInsertions() {
032      var doc;
033   
034      if (document.forms[form_name]) {
035          doc = document;
036      } else {
037          doc = opener.document;
038      }
039   
040      var textarea = doc.forms[form_name].elements[text_name];
041   
042      if (is_ie && typeof(baseHeight) !== 'number') {
043          textarea.focus();
044          baseHeight = doc.selection.createRange().duplicate().boundingHeight;
045   
046          if (!document.forms[form_name]) {
047              document.body.focus();
048          }
049      }
050  }
051   
052  /**
053  * bbstyle
054  */
055  function bbstyle(bbnumber) {
056      if (bbnumber !== -1) {
057          bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]);
058      } else {
059          insert_text('[*]');
060          document.forms[form_name].elements[text_name].focus();
061      }
062  }
063   
064  /**
065  * Apply bbcodes
066  */
067  function bbfontstyle(bbopen, bbclose) {
068      theSelection = false;
069   
070      var textarea = document.forms[form_name].elements[text_name];
071   
072      textarea.focus();
073   
074      if ((clientVer >= 4) && is_ie && is_win) {
075          // Get text selection
076          theSelection = document.selection.createRange().text;
077   
078          if (theSelection) {
079              // Add tags around selection
080              document.selection.createRange().text = bbopen + theSelection + bbclose;
081              textarea.focus();
082              theSelection = '';
083              return;
084          }
085      } else if (textarea.selectionEnd && (textarea.selectionEnd - textarea.selectionStart > 0)) {
086          mozWrap(textarea, bbopen, bbclose);
087          textarea.focus();
088          theSelection = '';
089          return;
090      }
091   
092      //The new position for the cursor after adding the bbcode
093      var caret_pos = getCaretPosition(textarea).start;
094      var new_pos = caret_pos + bbopen.length;
095   
096      // Open tag
097      insert_text(bbopen + bbclose);
098   
099      // Center the cursor when we don't have a selection
100      // Gecko and proper browsers
101      if (!isNaN(textarea.selectionStart)) {
102          textarea.selectionStart = new_pos;
103          textarea.selectionEnd = new_pos;
104      }
105      // IE
106      else if (document.selection) {
107          var range = textarea.createTextRange(); 
108          range.move("character", new_pos); 
109          range.select();
110          storeCaret(textarea);
111      }
112   
113      textarea.focus();
114      return;
115  }
116   
117  /**
118  * Insert text at position
119  */
120  function insert_text(text, spaces, popup) {
121      var textarea;
122   
123      if (!popup) {
124          textarea = document.forms[form_name].elements[text_name];
125      } else {
126          textarea = opener.document.forms[form_name].elements[text_name];
127      }
128   
129      if (spaces) {
130          text = ' ' + text + ' ';
131      }
132   
133      // Since IE9, IE also has textarea.selectionStart, but it still needs to be treated the old way.
134      // Therefore we simply add a !is_ie here until IE fixes the text-selection completely.
135      if (!isNaN(textarea.selectionStart) && !is_ie) {
136          var sel_start = textarea.selectionStart;
137          var sel_end = textarea.selectionEnd;
138   
139          mozWrap(textarea, text, '');
140          textarea.selectionStart = sel_start + text.length;
141          textarea.selectionEnd = sel_end + text.length;
142      } else if (textarea.createTextRange && textarea.caretPos) {
143          if (baseHeight !== textarea.caretPos.boundingHeight) {
144              textarea.focus();
145              storeCaret(textarea);
146          }
147   
148          var caret_pos = textarea.caretPos;
149          caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) === ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text;
150      } else {
151          textarea.value = textarea.value + text;
152      }
153   
154      if (!popup) {
155          textarea.focus();
156      }
157  }
158   
159  /**
160  * Add inline attachment at position
161  */
162  function attach_inline(index, filename) {
163      insert_text('[attachment=' + index + ']' + filename + '[/attachment]');
164      document.forms[form_name].elements[text_name].focus();
165  }
166   
167  /**
168  * Add quote text to message
169  */
170  function addquote(post_id, username, l_wrote) {
171      var message_name = 'message_' + post_id;
172      var theSelection = '';
173      var divarea = false;
174      var i;
175   
176      if (l_wrote === undefined) {
177          // Backwards compatibility
178          l_wrote = 'wrote';
179      }
180   
181      if (document.all) {
182          divarea = document.all[message_name];
183      } else {
184          divarea = document.getElementById(message_name);
185      }
186   
187      // Get text selection - not only the post content :(
188      // IE9 must use the document.selection method but has the *.getSelection so we just force no IE
189      if (window.getSelection && !is_ie && !window.opera) {
190          theSelection = window.getSelection().toString();
191      } else if (document.getSelection && !is_ie) {
192          theSelection = document.getSelection();
193      } else if (document.selection) {
194          theSelection = document.selection.createRange().text;
195      }
196   
197      if (theSelection === '' || typeof theSelection === 'undefined' || theSelection === null) {
198          if (divarea.innerHTML) {
199              theSelection = divarea.innerHTML.replace(/<br>/ig, '\n');
200              theSelection = theSelection.replace(/<br\/>/ig, '\n');
201              theSelection = theSelection.replace(/&lt\;/ig, '<');
202              theSelection = theSelection.replace(/&gt\;/ig, '>');
203              theSelection = theSelection.replace(/&amp\;/ig, '&');
204              theSelection = theSelection.replace(/&nbsp\;/ig, ' ');
205          } else if (document.all) {
206              theSelection = divarea.innerText;
207          } else if (divarea.textContent) {
208              theSelection = divarea.textContent;
209          } else if (divarea.firstChild.nodeValue) {
210              theSelection = divarea.firstChild.nodeValue;
211          }
212      }
213   
214      if (theSelection) {
215          if (bbcodeEnabled) {
216              insert_text('[quote="' + username + '"]' + theSelection + '[/quote]');
217          } else {
218              insert_text(username + ' ' + l_wrote + ':' + '\n');
219              var lines = split_lines(theSelection);
220              for (i = 0; i < lines.length; i++) {
221                  insert_text('> ' + lines[i] + '\n');
222              }
223          }
224      }
225   
226      return;
227  }
228   
229  function split_lines(text) {
230      var lines = text.split('\n');
231      var splitLines = new Array();
232      var j = 0;
233      var i;
234   
235      for(i = 0; i < lines.length; i++) {
236          if (lines[i].length <= 80) {
237              splitLines[j] = lines[i];
238              j++;
239          } else {
240              var line = lines[i];
241              var splitAt;
242              do {
243                  splitAt = line.indexOf(' ', 80);
244   
245                  if (splitAt === -1) {
246                      splitLines[j] = line;
247                      j++;
248                  } else {
249                      splitLines[j] = line.substring(0, splitAt);
250                      line = line.substring(splitAt);
251                      j++;
252                  }
253              }
254              while(splitAt !== -1);
255          }
256      }
257      return splitLines;
258  }
259   
260  /**
261  * From http://www.massless.org/mozedit/
262  */
263  function mozWrap(txtarea, open, close) {
264      var selLength = (typeof(txtarea.textLength) === 'undefined') ? txtarea.value.length : txtarea.textLength;
265      var selStart = txtarea.selectionStart;
266      var selEnd = txtarea.selectionEnd;
267      var scrollTop = txtarea.scrollTop;
268   
269      var s1 = (txtarea.value).substring(0,selStart);
270      var s2 = (txtarea.value).substring(selStart, selEnd);
271      var s3 = (txtarea.value).substring(selEnd, selLength);
272   
273      txtarea.value = s1 + open + s2 + close + s3;
274      txtarea.selectionStart = selStart + open.length;
275      txtarea.selectionEnd = selEnd + open.length;
276      txtarea.focus();
277      txtarea.scrollTop = scrollTop;
278   
279      return;
280  }
281   
282  /**
283  * Insert at Caret position. Code from
284  * http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
285  */
286  function storeCaret(textEl) {
287      if (textEl.createTextRange && document.selection) {
288          textEl.caretPos = document.selection.createRange().duplicate();
289      }
290  }
291   
292  /**
293  * Caret Position object
294  */
295  function caretPosition() {
296      var start = null;
297      var end = null;
298  }
299   
300  /**
301  * Get the caret position in an textarea
302  */
303  function getCaretPosition(txtarea) {
304      var caretPos = new caretPosition();
305   
306      // simple Gecko/Opera way
307      if (txtarea.selectionStart || txtarea.selectionStart === 0) {
308          caretPos.start = txtarea.selectionStart;
309          caretPos.end = txtarea.selectionEnd;
310      }
311      // dirty and slow IE way
312      else if (document.selection) {
313          // get current selection
314          var range = document.selection.createRange();
315   
316          // a new selection of the whole textarea
317          var range_all = document.body.createTextRange();
318          range_all.moveToElementText(txtarea);
319   
320          // calculate selection start point by moving beginning of range_all to beginning of range
321          var sel_start;
322          for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++) {
323              range_all.moveStart('character', 1);
324          }
325   
326          txtarea.sel_start = sel_start;
327   
328          // we ignore the end value for IE, this is already dirty enough and we don't need it
329          caretPos.start = txtarea.sel_start;
330          caretPos.end = txtarea.sel_start;
331      }
332   
333      return caretPos;
334  }
335   
336  /**
337  * Allow to use tab character when typing code
338  * Keep indentation of last line of code when typing code
339  */
340  (function($) {
341      $(document).ready(function() {
342          var doc, textarea;
343   
344          // find textarea, make sure browser supports necessary functions
345          if (document.forms[form_name]) {
346              doc = document;
347          } else {
348              doc = opener.document;
349          }
350   
351          if (!doc.forms[form_name]) {
352              return;
353          }
354   
355          textarea = doc.forms[form_name].elements[text_name];
356   
357          phpbb.applyCodeEditor(textarea);
358      });
359  })(jQuery);
360   
361