- Timestamp:
- 09/18/18 20:22:10 (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/dcLegacyEditor/js/jsToolBar/jsToolBar.js
r3735 r3880 24 24 */ 25 25 26 varjsToolBar = function(textarea) {26 const jsToolBar = function(textarea) { 27 27 if (!document.createElement) { 28 28 return; … … 59 59 this.handle = document.createElement('div'); 60 60 this.handle.className = 'jstHandle'; 61 vardragStart = this.resizeDragStart;62 varThis = this;61 const dragStart = this.resizeDragStart; 62 const This = this; 63 63 this.handle.addEventListener('mousedown', function(event) { 64 64 dragStart.call(This, event); … … 73 73 }; 74 74 75 varjsButton = function(title, fn, scope, className, accesskey) {75 const jsButton = function(title, fn, scope, className, accesskey) { 76 76 this.title = title || null; 77 77 this.fn = fn || function() {}; … … 83 83 if (!this.scope) return null; 84 84 85 varbutton = document.createElement('button');85 const button = document.createElement('button'); 86 86 button.setAttribute('type', 'button'); 87 87 if (this.className) button.className = this.className; 88 88 button.title = this.title; 89 89 if (this.accesskey) button.accessKey = this.accesskey; 90 varspan = document.createElement('span');90 const span = document.createElement('span'); 91 91 span.appendChild(document.createTextNode(this.title)); 92 92 button.appendChild(span); … … 96 96 } 97 97 if (typeof(this.fn) == 'function') { 98 varThis = this;98 const This = this; 99 99 button.onclick = function() { 100 100 try { … … 107 107 }; 108 108 109 varjsSpace = function(id) {109 const jsSpace = function(id) { 110 110 this.id = id || null; 111 111 this.width = null; 112 112 }; 113 113 jsSpace.prototype.draw = function() { 114 varspan = document.createElement('span');114 const span = document.createElement('span'); 115 115 if (this.id) span.id = this.id; 116 116 span.appendChild(document.createTextNode(String.fromCharCode(160))); … … 121 121 }; 122 122 123 varjsCombo = function(title, options, scope, fn, className) {123 const jsCombo = function(title, options, scope, fn, className) { 124 124 this.title = title || null; 125 125 this.options = options || null; … … 131 131 if (!this.scope || !this.options) return null; 132 132 133 varselect = document.createElement('select');133 const select = document.createElement('select'); 134 134 if (this.className) select.className = this.className; 135 135 select.title = this.title; 136 136 137 for ( varo in this.options) {137 for (let o in this.options) { 138 138 //var opt = this.options[o]; 139 varoption = document.createElement('option');139 const option = document.createElement('option'); 140 140 option.value = o; 141 141 option.appendChild(document.createTextNode(this.options[o])); … … 143 143 } 144 144 145 varThis = this;145 const This = this; 146 146 select.onchange = function() { 147 147 try { … … 177 177 178 178 button: function(toolName) { 179 vartool = this.elements[toolName];179 const tool = this.elements[toolName]; 180 180 if (typeof tool.fn[this.mode] != 'function') return null; 181 varb = new jsButton(tool.title, tool.fn[this.mode], this, 'jstb_' + toolName, tool.accesskey);181 const b = new jsButton(tool.title, tool.fn[this.mode], this, 'jstb_' + toolName, tool.accesskey); 182 182 if (tool.icon != undefined) { 183 183 b.icon = tool.icon; … … 186 186 }, 187 187 space: function(toolName) { 188 vartool = new jsSpace(toolName);188 const tool = new jsSpace(toolName); 189 189 if (this.elements[toolName].format != undefined && !this.elements[toolName].format[this.mode]) return null; 190 190 if (this.elements[toolName].width !== undefined) { … … 194 194 }, 195 195 combo: function(toolName) { 196 vartool = this.elements[toolName];196 const tool = this.elements[toolName]; 197 197 198 198 if (tool[this.mode] != undefined) { 199 199 200 varlength = tool[this.mode].list.length;200 const length = tool[this.mode].list.length; 201 201 202 202 if (typeof tool[this.mode].fn != 'function' || length == 0) { 203 203 return null; 204 204 } else { 205 varoptions = {};206 for ( vari = 0; i < length; i++) {207 varopt = tool[this.mode].list[i];205 let options = {}; 206 for (let i = 0; i < length; i++) { 207 const opt = tool[this.mode].list[i]; 208 208 options[opt] = tool.options[opt]; 209 209 } … … 224 224 225 225 // Draw toolbar elements 226 var b, tool, newTool; 227 228 for (var i in this.elements) { 226 let b; 227 let tool; 228 let newTool; 229 230 for (let i in this.elements) { 229 231 b = this.elements[i]; 230 232 231 vardisabled =233 const disabled = 232 234 b.type == undefined || b.type == '' || 233 235 (b.disabled != undefined && b.disabled) || … … 262 264 suffix = suffix || ''; 263 265 264 var start, end, sel, scrollPos, subst, res; 266 let start; 267 let end; 268 let sel; 269 let scrollPos; 270 let subst; 271 let res; 265 272 266 273 if (typeof(document.selection) != "undefined") { … … 305 312 stripBaseURL: function(url) { 306 313 if (this.base_url != '') { 307 varpos = url.indexOf(this.base_url);314 const pos = url.indexOf(this.base_url); 308 315 if (pos == 0) { 309 316 url = url.substr(this.base_url.length); … … 321 328 }; 322 329 jsToolBar.prototype.resizeDragStart = function(event) { 323 varThis = this;330 const This = this; 324 331 this.dragStartY = event.clientY; 325 332 this.resizeSetStartH(); … … 364 371 else 365 372 try { 366 this.singleTag( '<' + opt + '>', '</' + opt + '>');373 this.singleTag(`<${opt}>`, `</${opt}>`); 367 374 } catch (e) {} 368 375 this.toolNodes.blocks.value = 'nonebis'; … … 688 695 this.encloseSelection('', '', function(str) { 689 696 if (str) { 690 return '<img src="' + src + '" alt="' + str + '" />';697 return `<img src="${src}" alt="${str}" />`; 691 698 } else { 692 return '<img src="' + src + '" alt="" />';699 return `<img src="${src}" alt="" />`; 693 700 } 694 701 }); … … 700 707 this.encloseSelection('', '', function(str) { 701 708 if (str) { 702 return '((' + src + '|' + str + '))';709 return `((${src}|${str}))`; 703 710 } else { 704 return '((' + src + '))';711 return `((${src}))`; 705 712 } 706 713 });
Note: See TracChangeset
for help on using the changeset viewer.