Dotclear


Ignore:
Timestamp:
11/17/13 20:25:53 (12 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
2.6
Children:
2567:6c11245cbf04, 2568:61c67a7d17fa
Message:

Add some people in CREDITS, remove trailing spaces and tabs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/js/jsToolBar/jsToolBar.js

    r1759 r2566  
    88 * the Free Software Foundation; either version 2 of the License, or 
    99 * (at your option) any later version. 
    10  *  
     10 * 
    1111 * DotClear is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1313 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    15  *  
     15 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with DotClear; if not, write to the Free Software 
     
    2323function jsToolBar(textarea) { 
    2424     if (!document.createElement) { return; } 
    25       
     25 
    2626     if (!textarea) { return; } 
    27       
     27 
    2828     if ((typeof(document["selection"]) == "undefined") 
    2929     && (typeof(textarea["setSelectionRange"]) == "undefined")) { 
    3030          return; 
    3131     } 
    32       
     32 
    3333     this.textarea = textarea; 
    34       
     34 
    3535     this.editor = document.createElement('div'); 
    3636     this.editor.className = 'jstEditor'; 
    37       
     37 
    3838     this.textarea.parentNode.insertBefore(this.editor,this.textarea); 
    3939     this.editor.appendChild(this.textarea); 
    40       
     40 
    4141     this.toolbar = document.createElement("div"); 
    4242     this.toolbar.className = 'jstElements'; 
    4343     this.editor.parentNode.insertBefore(this.toolbar,this.editor); 
    44       
     44 
    4545     // Dragable resizing (only for gecko) 
    4646     if (navigator.appName == 'Microsoft Internet Explorer') 
    4747     { 
    4848          if (this.editor.addEventListener) 
    49           {          
     49          { 
    5050               this.handle = document.createElement('div'); 
    5151               this.handle.className = 'jstHandle'; 
     
    5656          } 
    5757     } 
    58       
     58 
    5959     this.context = null; 
    60      this.toolNodes = {}; // lorsque la toolbar est dessinée , cet objet est garni  
     60     this.toolNodes = {}; // lorsque la toolbar est dessinée , cet objet est garni 
    6161                         // de raccourcis vers les éléments DOM correspondants aux outils. 
    6262}; 
     
    7070jsButton.prototype.draw = function() { 
    7171     if (!this.scope) return null; 
    72       
     72 
    7373     var button = document.createElement('button'); 
    7474     button.setAttribute('type','button'); 
     
    7878     span.appendChild(document.createTextNode(this.title)); 
    7979     button.appendChild(span); 
    80       
     80 
    8181     if (this.icon != undefined) { 
    8282          button.style.backgroundImage = 'url('+this.icon+')'; 
     
    9999     span.className = 'jstSpacer'; 
    100100     if (this.width) span.style.marginRight = this.width+'px'; 
    101       
     101 
    102102     return span; 
    103103}; 
     
    112112jsCombo.prototype.draw = function() { 
    113113     if (!this.scope || !this.options) return null; 
    114       
     114 
    115115     var select = document.createElement('select'); 
    116116     if (this.className) select.className = className; 
    117117     select.title = this.title; 
    118       
     118 
    119119     for (var o in this.options) { 
    120120          //var opt = this.options[o]; 
     
    124124          select.appendChild(option); 
    125125     } 
    126       
     126 
    127127     var This = this; 
    128128     select.onchange = function() { 
    129           try {  
     129          try { 
    130130               This.fn.call(This.scope, this.value); 
    131131          } catch (e) { alert(e); } 
    132            
     132 
    133133          return false; 
    134134     }; 
    135       
     135 
    136136     return select; 
    137137}; 
     
    142142     mode: 'xhtml', 
    143143     elements: {}, 
    144       
     144 
    145145     getMode: function() { 
    146146          return this.mode; 
    147147     }, 
    148       
     148 
    149149     setMode: function(mode) { 
    150150          this.mode = mode || 'xhtml'; 
    151151     }, 
    152       
     152 
    153153     switchMode: function(mode) { 
    154154          mode = mode || 'xhtml'; 
    155155          this.draw(mode); 
    156156     }, 
    157       
     157 
    158158     button: function(toolName) { 
    159159          var tool = this.elements[toolName]; 
     
    175175     combo: function(toolName) { 
    176176          var tool = this.elements[toolName]; 
    177            
     177 
    178178          if( tool[this.mode] != undefined) { 
    179                 
     179 
    180180               var length = tool[this.mode].list.length; 
    181                 
     181 
    182182               if (typeof tool[this.mode].fn != 'function' || length == 0) { 
    183183                    return null; 
     
    190190                    return new jsCombo(tool.title, options, this, tool[this.mode].fn); 
    191191               } 
    192                 
    193           } 
    194            
     192 
     193          } 
     194 
    195195     }, 
    196196     draw: function(mode) { 
    197197          this.setMode(mode); 
    198            
     198 
    199199          // Empty toolbar 
    200200          while (this.toolbar.hasChildNodes()) { 
     
    202202          } 
    203203          this.toolNodes = {}; // vide les raccourcis DOM/**/ 
    204            
     204 
    205205          // Draw toolbar elements 
    206206          var b, tool, newTool; 
    207            
     207 
    208208          for (var i in this.elements) { 
    209209               b = this.elements[i]; 
    210                 
     210 
    211211               var disabled = 
    212212               b.type == undefined || b.type == '' 
    213213               || (b.disabled != undefined && b.disabled) 
    214214               || (b.context != undefined && b.context != null && b.context != this.context); 
    215                 
     215 
    216216               if (!disabled && typeof this[b.type] == 'function') { 
    217217                    tool = this[b.type](i); 
     
    224224          } 
    225225     }, 
    226       
     226 
    227227     singleTag: function(stag,etag) { 
    228228          stag = stag || null; 
    229229          etag = etag || stag; 
    230            
     230 
    231231          if (!stag || !etag) { return; } 
    232            
     232 
    233233          this.encloseSelection(stag,etag); 
    234234     }, 
    235       
     235 
    236236     encloseSelection: function(prefix, suffix, fn) { 
    237237          this.textarea.focus(); 
    238            
     238 
    239239          prefix = prefix || ''; 
    240240          suffix = suffix || ''; 
    241            
     241 
    242242          var start, end, sel, scrollPos, subst, res; 
    243            
     243 
    244244          if (typeof(document["selection"]) != "undefined") { 
    245245               sel = document.selection.createRange().text; 
     
    250250               sel = this.textarea.value.substring(start, end); 
    251251          } 
    252            
     252 
    253253          if (sel.match(/ $/)) { // exclude ending space char, if any 
    254254               sel = sel.substring(0, sel.length - 1); 
    255255               suffix = suffix + " "; 
    256256          } 
    257            
     257 
    258258          if (typeof(fn) == 'function') { 
    259259               res = (sel) ? fn.call(this,sel) : fn(''); 
     
    261261               res = (sel) ? sel : ''; 
    262262          } 
    263            
     263 
    264264          subst = prefix + res + suffix; 
    265            
     265 
    266266          if (typeof(document["selection"]) != "undefined") { 
    267267               var range = document.selection.createRange().text = subst; 
     
    278278          } 
    279279     }, 
    280       
     280 
    281281     stripBaseURL: function(url) { 
    282282          if (this.base_url != '') { 
     
    286286               } 
    287287          } 
    288            
     288 
    289289          return url; 
    290290     } 
     
    355355// spacer 
    356356jsToolBar.prototype.elements.space0 = { 
    357      type:'space',  
     357     type:'space', 
    358358     format:{ 
    359359          wysiwyg:true, 
     
    425425// spacer 
    426426jsToolBar.prototype.elements.space1 = { 
    427      type:'space',  
     427     type:'space', 
    428428     format:{ 
    429429          wysiwyg:true, 
     
    445445// spacer 
    446446jsToolBar.prototype.elements.space2 = { 
    447      type:'space',  
     447     type:'space', 
    448448     format:{ 
    449449          wysiwyg:true, 
     
    523523// spacer 
    524524jsToolBar.prototype.elements.space3 = { 
    525      type:'space',  
     525     type:'space', 
    526526     format:{ 
    527527          wysiwyg:true, 
     
    542542          href = href || ''; 
    543543          hreflang = hreflang || this.elements.link.default_hreflang; 
    544            
     544 
    545545          href = window.prompt(this.elements.link.href_prompt,href); 
    546546          if (!href) { return false; } 
    547            
     547 
    548548          hreflang = window.prompt(this.elements.link.hreflang_prompt, 
    549549          hreflang); 
    550            
     550 
    551551          return { href: this.stripBaseURL(href), hreflang: hreflang }; 
    552552     } 
     
    560560          stag = stag+'>'; 
    561561          var etag = '</a>'; 
    562            
     562 
    563563          this.encloseSelection(stag,etag); 
    564564     } 
     
    571571          if (link.hreflang) { etag = etag+'|'+link.hreflang; } 
    572572          etag = etag+']'; 
    573            
     573 
    574574          this.encloseSelection(stag,etag); 
    575575     } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map