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.78 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  onload_functions.push('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   
 048      if (is_ie && typeof(baseHeight) != 'number')
 049      {
 050          textarea.focus();
 051          baseHeight = doc.selection.createRange().duplicate().boundingHeight;
 052   
 053          if (!document.forms[form_name])
 054          {
 055              document.body.focus();
 056          }
 057      }
 058  }
 059   
 060  /**
 061  * bbstyle
 062  */
 063  function bbstyle(bbnumber)
 064  {    
 065      if (bbnumber != -1)
 066      {
 067          bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]);
 068      } 
 069      else 
 070      {
 071          insert_text('[*]');
 072          document.forms[form_name].elements[text_name].focus();
 073      }
 074  }
 075   
 076  /**
 077  * Apply bbcodes
 078  */
 079  function bbfontstyle(bbopen, bbclose)
 080  {
 081      theSelection = false;
 082   
 083      var textarea = document.forms[form_name].elements[text_name];
 084   
 085      textarea.focus();
 086   
 087      if ((clientVer >= 4) && is_ie && is_win)
 088      {
 089          // Get text selection
 090          theSelection = document.selection.createRange().text;
 091   
 092          if (theSelection)
 093          {
 094              // Add tags around selection
 095              document.selection.createRange().text = bbopen + theSelection + bbclose;
 096              document.forms[form_name].elements[text_name].focus();
 097              theSelection = '';
 098              return;
 099          }
 100      }
 101      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))
 102      {
 103          mozWrap(document.forms[form_name].elements[text_name], bbopen, bbclose);
 104          document.forms[form_name].elements[text_name].focus();
 105          theSelection = '';
 106          return;
 107      }
 108      
 109      //The new position for the cursor after adding the bbcode
 110      var caret_pos = getCaretPosition(textarea).start;
 111      var new_pos = caret_pos + bbopen.length;        
 112   
 113      // Open tag
 114      insert_text(bbopen + bbclose);
 115   
 116      // Center the cursor when we don't have a selection
 117      // Gecko and proper browsers
 118      if (!isNaN(textarea.selectionStart))
 119      {
 120          textarea.selectionStart = new_pos;
 121          textarea.selectionEnd = new_pos;
 122      }    
 123      // IE
 124      else if (document.selection)
 125      {
 126          var range = textarea.createTextRange(); 
 127          range.move("character", new_pos); 
 128          range.select();
 129          storeCaret(textarea);
 130      }
 131   
 132      textarea.focus();
 133      return;
 134  }
 135   
 136  /**
 137  * Insert text at position
 138  */
 139  function insert_text(text, spaces, popup)
 140  {
 141      var textarea;
 142      
 143      if (!popup) 
 144      {
 145          textarea = document.forms[form_name].elements[text_name];
 146      } 
 147      else 
 148      {
 149          textarea = opener.document.forms[form_name].elements[text_name];
 150      }
 151      if (spaces) 
 152      {
 153          text = ' ' + text + ' ';
 154      }
 155      
 156      if (!isNaN(textarea.selectionStart))
 157      {
 158          var sel_start = textarea.selectionStart;
 159          var sel_end = textarea.selectionEnd;
 160   
 161          mozWrap(textarea, text, '')
 162          textarea.selectionStart = sel_start + text.length;
 163          textarea.selectionEnd = sel_end + text.length;
 164      }
 165      else if (textarea.createTextRange && textarea.caretPos)
 166      {
 167          if (baseHeight != textarea.caretPos.boundingHeight) 
 168          {
 169              textarea.focus();
 170              storeCaret(textarea);
 171          }
 172   
 173          var caret_pos = textarea.caretPos;
 174          caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text;
 175      }
 176      else
 177      {
 178          textarea.value = textarea.value + text;
 179      }
 180      if (!popup) 
 181      {
 182          textarea.focus();
 183      }
 184  }
 185   
 186  /**
 187  * Add inline attachment at position
 188  */
 189  function attach_inline(index, filename)
 190  {
 191      insert_text('[attachment=' + index + ']' + filename + '[/attachment]');
 192      document.forms[form_name].elements[text_name].focus();
 193  }
 194   
 195  /**
 196  * Add quote text to message
 197  */
 198  function addquote(post_id, username)
 199  {
 200      var message_name = 'message_' + post_id;
 201      var theSelection = '';
 202      var divarea = false;
 203   
 204      if (document.all)
 205      {
 206          divarea = document.all[message_name];
 207      }
 208      else
 209      {
 210          divarea = document.getElementById(message_name);
 211      }
 212   
 213      // Get text selection - not only the post content :(
 214      if (window.getSelection)
 215      {
 216          theSelection = window.getSelection().toString();
 217      }
 218      else if (document.getSelection)
 219      {
 220          theSelection = document.getSelection();
 221      }
 222      else if (document.selection)
 223      {
 224          theSelection = document.selection.createRange().text;
 225      }
 226   
 227      if (theSelection == '' || typeof theSelection == 'undefined' || theSelection == null)
 228      {
 229          if (divarea.innerHTML)
 230          {
 231              theSelection = divarea.innerHTML.replace(/<br>/ig, '\n');
 232              theSelection = theSelection.replace(/<br\/>/ig, '\n');
 233              theSelection = theSelection.replace(/&lt\;/ig, '<');
 234              theSelection = theSelection.replace(/&gt\;/ig, '>');
 235              theSelection = theSelection.replace(/&amp\;/ig, '&');
 236              theSelection = theSelection.replace(/&nbsp\;/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 + '" style="width: ' + width + 'px; height: ' + height + 'px;">');
 335                  document.write('<a href="#" onclick="bbfontstyle(\'[color=#' + color + ']\', \'[/color]\'); return false;"><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      
 381          // get current selection
 382          var range = document.selection.createRange();
 383   
 384          // a new selection of the whole textarea
 385          var range_all = document.body.createTextRange();
 386          range_all.moveToElementText(txtarea);
 387          
 388          // calculate selection start point by moving beginning of range_all to beginning of range
 389          var sel_start;
 390          for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++)
 391          {        
 392              range_all.moveStart('character', 1);
 393          }
 394      
 395          txtarea.sel_start = sel_start;
 396      
 397          // we ignore the end value for IE, this is already dirty enough and we don't need it
 398          caretPos.start = txtarea.sel_start;
 399          caretPos.end = txtarea.sel_start;            
 400      }
 401   
 402      return caretPos;
 403  }