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