Verzeichnisstruktur phpBB-3.0.0


Veröffentlicht
12.12.2007

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:53 - Dateigröße: 8.72 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   
010  // Check for Browser & Platform for PC & IE specific bits
011  // More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
012  var clientPC = navigator.userAgent.toLowerCase(); // Get client info
013  var clientVer = parseInt(navigator.appVersion); // Get browser version
014   
015  var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == -1));
016  var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1));
017   
018  var baseHeight;
019  window.onload = initInsertions;
020   
021  /**
022  * Shows the help messages in the helpline window
023  */
024  function helpline(help)
025  {
026      document.forms[form_name].helpbox.value = help_line[help];
027  }
028   
029  /**
030  * Fix a bug involving the TextRange object. From
031  * http://www.frostjedi.com/terra/scripts/demo/caretBug.html
032  */ 
033  function initInsertions() 
034  {
035      var doc;
036   
037      if (document.forms[form_name])
038      {
039          doc = document;
040      }
041      else 
042      {
043          doc = opener.document;
044      }
045   
046      var textarea = doc.forms[form_name].elements[text_name];
047      if (is_ie && typeof(baseHeight) != 'number')
048      {    
049          textarea.focus();
050          baseHeight = doc.selection.createRange().duplicate().boundingHeight;
051   
052          if (!document.forms[form_name])
053          {
054              document.body.focus();
055          }
056      }
057  }
058   
059  /**
060  * bbstyle
061  */
062  function bbstyle(bbnumber)
063  {    
064      if (bbnumber != -1)
065      {
066          bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]);
067      } 
068      else 
069      {
070          insert_text('[*]');
071          document.forms[form_name].elements[text_name].focus();
072      }
073  }
074   
075  /**
076  * Apply bbcodes
077  */
078  function bbfontstyle(bbopen, bbclose)
079  {
080      theSelection = false;
081          
082      var textarea = document.forms[form_name].elements[text_name];
083   
084      textarea.focus();
085   
086      if ((clientVer >= 4) && is_ie && is_win)
087      {
088          // Get text selection
089          theSelection = document.selection.createRange().text;
090   
091          if (theSelection)
092          {
093              // Add tags around selection
094              document.selection.createRange().text = bbopen + theSelection + bbclose;
095              document.forms[form_name].elements[text_name].focus();
096              theSelection = '';
097              return;
098          }
099      }
100      else if (document.forms[form_name].elements[text_name].selectionEnd && (document.forms[form_name].elements[text_name].selectionEnd - document.forms[form_name].elements[text_name].selectionStart > 0))
101      {
102          mozWrap(document.forms[form_name].elements[text_name], bbopen, bbclose);
103          document.forms[form_name].elements[text_name].focus();
104          theSelection = '';
105          return;
106      }
107      
108      //The new position for the cursor after adding the bbcode
109      var caret_pos = getCaretPosition(textarea).start;
110      var new_pos = caret_pos + bbopen.length;
111   
112      // Open tag
113      insert_text(bbopen + bbclose);
114   
115      // Center the cursor when we don't have a selection
116      // Gecko and proper browsers
117      if (!isNaN(textarea.selectionStart))
118      {
119          textarea.selectionStart = new_pos;
120          textarea.selectionEnd = new_pos;
121      }    
122      // IE
123      else if (document.selection)
124      {
125          var range = textarea.createTextRange(); 
126          range.move("character", new_pos); 
127          range.select();
128          storeCaret(textarea);
129      }
130   
131      textarea.focus();
132      return;
133  }
134   
135  /**
136  * Insert text at position
137  */
138  function insert_text(text, spaces, popup)
139  {
140      var textarea;
141      
142      if (!popup) 
143      {
144          textarea = document.forms[form_name].elements[text_name];
145      } 
146      else 
147      {
148          textarea = opener.document.forms[form_name].elements[text_name];
149      }
150      if (spaces) 
151      {
152          text = ' ' + text + ' ';
153      }
154      
155      if (!isNaN(textarea.selectionStart))
156      {
157          var sel_start = textarea.selectionStart;
158          var sel_end = textarea.selectionEnd;
159   
160          mozWrap(textarea, text, '')
161          textarea.selectionStart = sel_start + text.length;
162          textarea.selectionEnd = sel_end + text.length;
163      }    
164      
165      else if (textarea.createTextRange && textarea.caretPos)
166      {
167          if (baseHeight != textarea.caretPos.boundingHeight) 
168          {
169              textarea.focus();
170              storeCaret(textarea);
171          }        
172          var caret_pos = textarea.caretPos;
173          caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text;
174          
175      }
176      else
177      {
178          textarea.value = textarea.value + text;
179      }
180      if (!popup) 
181      {
182          textarea.focus();
183      }     
184   
185  }
186   
187  /**
188  * Add inline attachment at position
189  */
190  function attach_inline(index, filename)
191  {
192      insert_text('[attachment=' + index + ']' + filename + '[/attachment]');
193      document.forms[form_name].elements[text_name].focus();
194  }
195   
196  /**
197  * Add quote text to message
198  */
199  function addquote(post_id, username)
200  {
201      var message_name = 'message_' + post_id;
202      var theSelection = '';
203      var divarea = false;
204   
205      if (document.all)
206      {
207          divarea = document.all[message_name];
208      }
209      else
210      {
211          divarea = document.getElementById(message_name);
212      }
213   
214      // Get text selection - not only the post content :(
215      if (window.getSelection)
216      {
217          theSelection = window.getSelection().toString();
218      }
219      else if (document.getSelection)
220      {
221          theSelection = document.getSelection();
222      }
223      else if (document.selection)
224      {
225          theSelection = document.selection.createRange().text;
226      }
227   
228      if (theSelection == '' || typeof theSelection == 'undefined' || theSelection == null)
229      {
230          if (divarea.innerHTML)
231          {
232              theSelection = divarea.innerHTML.replace(/<br>/ig, '\n');
233              theSelection = theSelection.replace(/<br\/>/ig, '\n');
234              theSelection = theSelection.replace(/&lt\;/ig, '<');
235              theSelection = theSelection.replace(/&gt\;/ig, '>');
236              theSelection = theSelection.replace(/&amp\;/ig, '&');
237          }
238          else if (document.all)
239          {
240              theSelection = divarea.innerText;
241          }
242          else if (divarea.textContent)
243          {
244              theSelection = divarea.textContent;
245          }
246          else if (divarea.firstChild.nodeValue)
247          {
248              theSelection = divarea.firstChild.nodeValue;
249          }
250      }
251   
252      if (theSelection)
253      {
254          insert_text('[quote="' + username + '"]' + theSelection + '[/quote]');
255      }
256   
257      return;
258  }
259   
260  /**
261  * From http://www.massless.org/mozedit/
262  */
263  function mozWrap(txtarea, open, close)
264  {
265      var selLength = txtarea.textLength;
266      var selStart = txtarea.selectionStart;
267      var selEnd = txtarea.selectionEnd;
268      var scrollTop = txtarea.scrollTop;
269   
270      if (selEnd == 1 || selEnd == 2) 
271      {
272          selEnd = selLength;
273      }
274   
275      var s1 = (txtarea.value).substring(0,selStart);
276      var s2 = (txtarea.value).substring(selStart, selEnd)
277      var s3 = (txtarea.value).substring(selEnd, selLength);
278   
279      txtarea.value = s1 + open + s2 + close + s3;
280      txtarea.selectionStart = selEnd + open.length + close.length;
281      txtarea.selectionEnd = txtarea.selectionStart;
282      txtarea.focus();
283      txtarea.scrollTop = scrollTop;
284   
285      return;
286  }
287   
288  /**
289  * Insert at Caret position. Code from
290  * http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
291  */
292  function storeCaret(textEl)
293  {
294      if (textEl.createTextRange)
295      {
296          textEl.caretPos = document.selection.createRange().duplicate();
297      }
298  }
299   
300  /**
301  * Color pallette
302  */
303  function colorPalette(dir, width, height)
304  {
305      var r = 0, g = 0, b = 0;
306      var numberList = new Array(6);
307      var color = '';
308   
309      numberList[0] = '00';
310      numberList[1] = '40';
311      numberList[2] = '80';
312      numberList[3] = 'BF';
313      numberList[4] = 'FF';
314   
315      document.writeln('<table cellspacing="1" cellpadding="0" border="0">');
316   
317      for (r = 0; r < 5; r++)
318      {
319          if (dir == 'h')
320          {
321              document.writeln('<tr>');
322          }
323   
324          for (g = 0; g < 5; g++)
325          {
326              if (dir == 'v')
327              {
328                  document.writeln('<tr>');
329              }
330              
331              for (b = 0; b < 5; b++)
332              {
333                  color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
334                  document.write('<td bgcolor="#' + color + '">');
335                  document.write('<a href="#" onclick="bbfontstyle(\'[color=#' + color + ']\', \'[/color]\'); return false;" onmouseover="helpline(\'s\');"  onmouseout="helpline(\'tip\');"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" alt="#' + color + '" title="#' + color + '" /></a>');
336                  document.writeln('</td>');
337              }
338   
339              if (dir == 'v')
340              {
341                  document.writeln('</tr>');
342              }
343          }
344   
345          if (dir == 'h')
346          {
347              document.writeln('</tr>');
348          }
349      }
350      document.writeln('</table>');
351  }
352   
353   
354  /**
355  * Caret Position object
356  */
357  function caretPosition()
358  {
359      var start = null;
360      var end = null;
361  }
362   
363   
364  /**
365  * Get the caret position in an textarea
366  */
367  function getCaretPosition(txtarea)
368  {
369      var caretPos = new caretPosition();
370      
371      // simple Gecko/Opera way
372      if(txtarea.selectionStart || txtarea.selectionStart == 0)
373      {
374          caretPos.start = txtarea.selectionStart;
375          caretPos.end = txtarea.selectionEnd;
376      }
377      // dirty and slow IE way
378      else if(document.selection)
379      {
380          // get current selection
381          var range = document.selection.createRange();
382   
383          // a new selection of the whole textarea
384          var range_all = document.body.createTextRange();
385          range_all.moveToElementText(txtarea);
386          
387          // calculate selection start point by moving beginning of range_all to beginning of range
388          var sel_start;
389          for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++)
390          {        
391              range_all.moveStart('character', 1);
392          }
393      
394          txtarea.sel_start = sel_start;
395      
396          // we ignore the end value for IE, this is already dirty enough and we don't need it
397          caretPos.start = txtarea.sel_start;
398          caretPos.end = txtarea.sel_start;
399      }
400   
401      return caretPos;
402  }