Changeset 3880:e6d1f6d9d7df for plugins/dcLegacyEditor/js/jsToolBar
- Timestamp:
- 09/18/18 20:22:10 (7 years ago)
- Branch:
- default
- Location:
- plugins/dcLegacyEditor/js/jsToolBar
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/dcLegacyEditor/js/jsToolBar/jsToolBar.dotclear.js
r3735 r3880 13 13 14 14 this.elements.link.data = {}; 15 varurl = this.elements.link.open_url + args;15 const url = this.elements.link.open_url + args; 16 16 17 17 window.open(url, 'dc_popup', … … 24 24 }; 25 25 jsToolBar.prototype.elements.link.fncall.wiki = function() { 26 vardata = this.elements.link.data;26 const data = this.elements.link.data; 27 27 28 28 if (data.href == '') { … … 30 30 } 31 31 32 varetag = '|' + data.href;32 let etag = '|' + data.href; 33 33 if (data.hreflang) { 34 34 etag += '|' + data.hreflang; … … 43 43 44 44 if (data.content) { 45 this.encloseSelection( '[' + data.content, etag + ']');45 this.encloseSelection(`[${data.content}`, `${etag}]`); 46 46 } else { 47 this.encloseSelection('[', etag + ']');47 this.encloseSelection('[', `${etag}]`); 48 48 } 49 49 }; 50 50 51 51 jsToolBar.prototype.elements.link.fn.xhtml = function() { 52 this.elements.link.popup.call(this, '&hreflang=' + this.elements.link.default_hreflang);52 this.elements.link.popup.call(this, `&hreflang=${this.elements.link.default_hreflang}`); 53 53 }; 54 54 jsToolBar.prototype.elements.link.fncall.xhtml = function() { 55 vardata = this.elements.link.data;55 const data = this.elements.link.data; 56 56 57 57 if (data.href == '') { … … 59 59 } 60 60 61 var stag = '<a href="' + data.href + '"';61 let stag = `<a href="${data.href}"`; 62 62 63 63 if (data.hreflang) { 64 stag += ' hreflang="' + data.hreflang + '"';64 stag += ` hreflang="${data.hreflang}"`; 65 65 } 66 66 if (data.title) { 67 stag += ' title="' + data.title + '"';67 stag += ` title="${data.title}"`; 68 68 } 69 69 stag += '>'; 70 varetag = '</a>';70 const etag = '</a>'; 71 71 72 72 if (data.content) { … … 80 80 81 81 jsToolBar.prototype.elements.link.fn.wysiwyg = function() { 82 var href, title, hreflang; 82 let href; 83 let title; 84 let hreflang; 83 85 href = title = hreflang = ''; 84 86 hreflang = this.elements.link.default_hreflang; … … 92 94 } 93 95 94 this.elements.link.popup.call(this, '&href=' + href + '&hreflang=' + hreflang + '&title=' + title);96 this.elements.link.popup.call(this, `&href=${href}&hreflang=${hreflang}&title=${title}`); 95 97 }; 96 98 jsToolBar.prototype.elements.link.fncall.wysiwyg = function() { 97 vardata = this.elements.link.data;98 99 vara = this.getAncestor();99 const data = this.elements.link.data; 100 101 let a = this.getAncestor(); 100 102 101 103 if (a.tagName == 'a') { … … 123 125 124 126 // Create link 125 varn;127 let n; 126 128 if (data.content) { 127 129 n = document.createTextNode(data.content); … … 137 139 }; 138 140 jsToolBar.prototype.getAncestor = function() { 139 var res = {}; 140 var range, commonAncestorContainer; 141 let res = {}; 142 let range; 143 let commonAncestorContainer; 141 144 142 145 if (this.iwin.getSelection) { //gecko 143 varselection = this.iwin.getSelection();146 const selection = this.iwin.getSelection(); 144 147 range = selection.getRangeAt(0); 145 148 commonAncestorContainer = range.commonAncestorContainer; … … 152 155 } 153 156 154 varancestorTagName = commonAncestorContainer.tagName.toLowerCase();157 let ancestorTagName = commonAncestorContainer.tagName.toLowerCase(); 155 158 while (ancestorTagName != 'a' && ancestorTagName != 'body') { 156 159 commonAncestorContainer = commonAncestorContainer.parentNode; … … 193 196 194 197 this.encloseSelection('', '', function(str) { 195 varalt = (str) ? str : d.title;196 var res = '((' + d.src + '|' + alt;198 const alt = (str) ? str : d.title; 199 let res = `((${d.src}|${alt}`; 197 200 198 201 if (d.alignment == 'left') { … … 207 210 208 211 if (d.description) { 209 res += '|' + d.description;212 res += `|${d.description}`; 210 213 } 211 214 … … 213 216 214 217 if (d.link) { 215 var ltitle = (alt) ? '||' + alt : ''; 216 res = '[' + res + '|' + d.url + ltitle + ']'; 218 res = `[${res}|${d.url}${(alt) ? `||${alt}` : ''}]`; 217 219 } 218 220 … … 224 226 }; 225 227 jsToolBar.prototype.elements.img_select.fncall.xhtml = function() { 226 vard = this.elements.img_select.data;228 const d = this.elements.img_select.data; 227 229 if (d.src == undefined) { 228 230 return; … … 230 232 231 233 this.encloseSelection('', '', function(str) { 232 varalt = (str) ? str : d.title;233 var res = '<img src="' + d.src + '" alt="' + alt.replace('&', '&').replace('>', '>').replace('<', '<').replace('"', '"') + '"';234 const alt = (str) ? str : d.title; 235 let res = `<img src="${d.src}" alt="${alt.replace('&', '&').replace('>', '>').replace('<', '<').replace('"', '"')}"`; 234 236 235 237 if (d.alignment == 'left') { … … 242 244 243 245 if (d.description) { 244 res += ' title="' + d.description.replace('&', '&').replace('>', '>').replace('<', '<').replace('"', '"') + '"';246 res += ` title="${d.description.replace('&', '&').replace('>', '>').replace('<', '<').replace('"', '"')}"`; 245 247 } 246 248 … … 248 250 249 251 if (d.link) { 250 var ltitle = (alt) ? ' title="' + alt.replace('&', '&').replace('>', '>').replace('<', '<').replace('"', '"') + '"': '';251 res = '<a href="' + d.url + '"' + ltitle + '>' + res + '</a>';252 const ltitle = (alt) ? ` title="${alt.replace('&', '&').replace('>', '>').replace('<', '<').replace('"', '"')}"` : ''; 253 res = `<a href="${d.url}"${ltitle}>${res}</a>`; 252 254 } 253 255 … … 257 259 258 260 jsToolBar.prototype.elements.img.fn.wysiwyg = function() { 259 varsrc = this.elements.img.prompt.call(this);261 const src = this.elements.img.prompt.call(this); 260 262 if (!src) { 261 263 return; 262 264 } 263 265 264 varimg = this.iwin.document.createElement('img');266 const img = this.iwin.document.createElement('img'); 265 267 img.src = src; 266 268 img.setAttribute('alt', this.getSelectedText()); … … 273 275 }; 274 276 jsToolBar.prototype.elements.img_select.fncall.wysiwyg = function() { 275 vard = this.elements.img_select.data;276 varalt = (this.getSelectedText()) ? this.getSelectedText() : d.title;277 const d = this.elements.img_select.data; 278 const alt = (this.getSelectedText()) ? this.getSelectedText() : d.title; 277 279 if (d.src == undefined) { 278 280 return; 279 281 } 280 282 281 varimg = this.iwin.document.createElement('img');283 const img = this.iwin.document.createElement('img'); 282 284 img.src = d.src; 283 285 img.setAttribute('alt', alt); … … 316 318 317 319 if (d.link) { 318 vara = this.iwin.document.createElement('a');320 const a = this.iwin.document.createElement('a'); 319 321 a.href = d.url; 320 322 if (alt) { … … 334 336 }; 335 337 jsToolBar.prototype.elements.mp3_insert.fncall.wiki = function() { 336 vard = this.elements.mp3_insert.data;338 const d = this.elements.mp3_insert.data; 337 339 if (d.player == undefined) { 338 340 return; … … 344 346 }; 345 347 jsToolBar.prototype.elements.mp3_insert.fncall.xhtml = function() { 346 vard = this.elements.mp3_insert.data;348 const d = this.elements.mp3_insert.data; 347 349 if (d.player == undefined) { 348 350 return; … … 363 365 }; 364 366 jsToolBar.prototype.elements.flv_insert.fncall.wiki = function() { 365 vard = this.elements.flv_insert.data;367 const d = this.elements.flv_insert.data; 366 368 if (d.player == undefined) { 367 369 return; … … 373 375 }; 374 376 jsToolBar.prototype.elements.flv_insert.fncall.xhtml = function() { 375 vard = this.elements.flv_insert.data;377 const d = this.elements.flv_insert.data; 376 378 if (d.player == undefined) { 377 379 return; -
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 }); -
plugins/dcLegacyEditor/js/jsToolBar/jsToolBar.wysiwyg.js
r3736 r3880 64 64 jsToolBar.prototype.syncContents = function(from) { 65 65 from = from || 'textarea'; 66 varThis = this;66 const This = this; 67 67 if (from == 'textarea') { 68 68 initContent(); 69 69 } else { 70 70 this.validBlockquote(); 71 varhtml = this.applyHtmlFilters(this.ibody.innerHTML);71 let html = this.applyHtmlFilters(this.ibody.innerHTML); 72 72 if (html == '<br />') { 73 73 html = '<p></p>'; … … 86 86 This.ibody.innerHTML = This.applyWysiwygFilters(This.textarea.value); 87 87 if (This.ibody.createTextRange) { //cursor at the begin for IE 88 varIErange = This.ibody.createTextRange();88 const IErange = This.ibody.createTextRange(); 89 89 IErange.execCommand("SelectAll"); 90 90 IErange.collapse(); … … 92 92 } 93 93 } else { 94 varidoc = This.iwin.document;95 varpara = idoc.createElement('p');94 const idoc = This.iwin.document; 95 const para = idoc.createElement('p'); 96 96 para.appendChild(idoc.createElement('br')); 97 97 while (idoc.body.hasChildNodes()) { … … 108 108 }; 109 109 jsToolBar.prototype.applyHtmlFilters = function(str) { 110 for ( varfn in this.htmlFilters) {110 for (let fn in this.htmlFilters) { 111 111 str = this.htmlFilters[fn].call(this, str); 112 112 } … … 115 115 jsToolBar.prototype.wysiwygFilters = {}; 116 116 jsToolBar.prototype.applyWysiwygFilters = function(str) { 117 for ( varfn in this.wysiwygFilters) {117 for (let fn in this.wysiwygFilters) { 118 118 str = this.wysiwygFilters[fn].call(this, str); 119 119 } … … 143 143 */ 144 144 jsToolBar.prototype.initWindow = function() { 145 varThis = this;145 const This = this; 146 146 147 147 this.iframe = document.createElement('iframe'); … … 160 160 161 161 function initIframe() { 162 vardoc = This.iframe.contentWindow.document;162 const doc = This.iframe.contentWindow.document; 163 163 if (!doc) { 164 164 setTimeout(initIframe, 1); … … 167 167 168 168 doc.open(); 169 var html = 170 '<html>\n' + 171 '<head>\n' + 172 '<link rel="stylesheet" href="style/default.css" type="text/css" media="screen" />' + 173 '<style type="text/css">' + This.iframe_css + '</style>\n' + 174 (This.base_url != '' ? '<base href="' + This.base_url + '" />' : '') + 175 '</head>\n' + 176 '<body>\n' + 177 '</body>\n' + 178 '</html>'; 169 const html = 170 `<html> 171 <head> 172 <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" /> 173 <style type="text/css">${This.iframe_css}</style> 174 ${This.base_url != '' ? `<base href="${This.base_url}" />` : ''} 175 </head> 176 <body></body> 177 </html>`; 179 178 180 179 doc.write(html); … … 212 211 } 213 212 214 for ( varevt in This.iwinEvents) {215 varevent = This.iwinEvents[evt];213 for (let evt in This.iwinEvents) { 214 const event = This.iwinEvents[evt]; 216 215 This.addIwinEvent(This.iframe.contentWindow.document, event.type, event.fn, This); 217 216 } … … 227 226 }; 228 227 jsToolBar.prototype.addIwinEvent = function(target, type, fn, scope) { 229 varmyFn = function(e) {228 const myFn = function(e) { 230 229 fn.call(scope, e); 231 230 }; … … 260 259 } 261 260 262 varThis = this;261 const This = this; 263 262 264 263 function setLink(title, link) { 265 varli = document.createElement('li');266 vara;264 const li = document.createElement('li'); 265 let a; 267 266 if (link) { 268 267 a = document.createElement('a'); … … 307 306 this.iwin.document.designMode = 'on'; 308 307 } catch (e) {} // Firefox needs this 309 varThis = this;308 const This = this; 310 309 setTimeout(function() { 311 310 This.iframe.contentWindow.focus(); … … 326 325 }; 327 326 jsToolBar.prototype.resizeDragMove = function(event) { 328 var new_height = (this.dragStartH + event.clientY - this.dragStartY) + 'px';327 const new_height = `${this.dragStartH + event.clientY - this.dragStartY}px`; 329 328 if (this.iframe != undefined) { 330 329 this.iframe.style.height = new_height; … … 338 337 */ 339 338 jsToolBar.prototype.insertNode = function(node) { 340 varrange;339 let range; 341 340 342 341 if (this.iwin.getSelection) { // Gecko 343 varsel = this.iwin.getSelection();342 const sel = this.iwin.getSelection(); 344 343 range = sel.getRangeAt(0); 345 344 … … 366 365 } else { // IE 367 366 // lambda element 368 varp = this.iwin.document.createElement('div');367 const p = this.iwin.document.createElement('div'); 369 368 p.appendChild(node); 370 369 range = this.iwin.document.selection.createRange(); … … 381 380 */ 382 381 jsToolBar.prototype.getSelectedNode = function() { 383 varsel;382 let sel; 384 383 var content; 385 384 if (this.iwin.getSelection) { // Gecko 386 385 sel = this.iwin.getSelection(); 387 varrange = sel.getRangeAt(0);386 const range = sel.getRangeAt(0); 388 387 content = range.cloneContents(); 389 388 } else { // IE 390 389 sel = this.iwin.document.selection; 391 vard = this.iwin.document.createElement('div');390 const d = this.iwin.document.createElement('div'); 392 391 d.innerHTML = sel.createRange().htmlText; 393 392 content = this.iwin.document.createDocumentFragment(); 394 for ( vari = 0; i < d.childNodes.length; i++) {393 for (let i = 0; i < d.childNodes.length; i++) { 395 394 content.appendChild(d.childNodes[i].cloneNode(true)); 396 395 } … … 405 404 return this.iwin.getSelection().toString(); 406 405 } else { // IE 407 varrange = this.iwin.document.selection.createRange();406 const range = this.iwin.document.selection.createRange(); 408 407 return range.text; 409 408 } … … 411 410 412 411 jsToolBar.prototype.replaceNodeByContent = function(node) { 413 varcontent = this.iwin.document.createDocumentFragment();414 for ( vari = 0; i < node.childNodes.length; i++) {412 const content = this.iwin.document.createDocumentFragment(); 413 for (let i = 0; i < node.childNodes.length; i++) { 415 414 content.appendChild(node.childNodes[i].cloneNode(true)); 416 415 } … … 419 418 420 419 jsToolBar.prototype.getBlockLevel = function() { 421 var blockElts = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']; 422 423 var range, commonAncestorContainer; 420 const blockElts = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']; 421 422 let range; 423 let commonAncestorContainer; 424 424 if (this.iwin.getSelection) { //gecko 425 varselection = this.iwin.getSelection();425 const selection = this.iwin.getSelection(); 426 426 range = selection.getRangeAt(0); 427 427 commonAncestorContainer = range.commonAncestorContainer; … … 434 434 } 435 435 436 varancestorTagName = commonAncestorContainer.tagName.toLowerCase();436 let ancestorTagName = commonAncestorContainer.tagName.toLowerCase(); 437 437 while (arrayIndexOf(blockElts, ancestorTagName) == -1 && ancestorTagName != 'body') { 438 438 commonAncestorContainer = commonAncestorContainer.parentNode; … … 443 443 }; 444 444 jsToolBar.prototype.adjustBlockLevelCombo = function() { 445 varblockLevel = this.getBlockLevel();445 const blockLevel = this.getBlockLevel(); 446 446 if (blockLevel !== null) 447 447 this.toolNodes.blocks.value = blockLevel.tagName.toLowerCase(); … … 471 471 */ 472 472 jsToolBar.prototype.tagsoup2xhtml = function(html) { 473 for ( varreg in this.simpleCleanRegex) {473 for (let reg in this.simpleCleanRegex) { 474 474 html = html.replace(this.simpleCleanRegex[reg][0], this.simpleCleanRegex[reg][1]); 475 475 } … … 488 488 489 489 /* IE laisse souvent des attributs sans guillemets */ 490 varmyRegexp = /<[^>]+((\s+\w+\s*=\s*)([^"'][\w~@+$,%\/:.#?=&;!*()-]*))[^>]*?>/;491 varmyQuoteFn = function(str, val1, val2, val3) {492 vartamponRegex = new RegExp(regexpEscape(val1));490 const myRegexp = /<[^>]+((\s+\w+\s*=\s*)([^"'][\w~@+$,%\/:.#?=&;!*()-]*))[^>]*?>/; 491 const myQuoteFn = function(str, val1, val2, val3) { 492 const tamponRegex = new RegExp(regexpEscape(val1)); 493 493 return str.replace(tamponRegex, val2 + '"' + val3 + '"'); 494 494 }; … … 508 508 509 509 /* Trim only if there's no pre tag */ 510 varpattern_pre = /<pre>[\s\S]*<\/pre>/gi;510 const pattern_pre = /<pre>[\s\S]*<\/pre>/gi; 511 511 if (!pattern_pre.test(html)) { 512 512 html = html.replace(/^\s+/gm, ''); … … 517 517 }; 518 518 jsToolBar.prototype.validBlockquote = function() { 519 varblockElts = ['address', 'blockquote', 'dl', 'div', 'fieldset', 'form', 'h1',519 const blockElts = ['address', 'blockquote', 'dl', 'div', 'fieldset', 'form', 'h1', 520 520 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'ol', 'p', 'pre', 'table', 'ul' 521 521 ]; 522 varBQs = this.iwin.document.getElementsByTagName('blockquote');523 varbqChilds;524 varp;525 526 for ( varbq = 0; bq < BQs.length; bq++) {522 const BQs = this.iwin.document.getElementsByTagName('blockquote'); 523 let bqChilds; 524 let p; 525 526 for (let bq = 0; bq < BQs.length; bq++) { 527 527 bqChilds = BQs[bq].childNodes; 528 varfrag = this.iwin.document.createDocumentFragment();529 for ( vari = (bqChilds.length - 1); i >= 0; i--) {528 let frag = this.iwin.document.createDocumentFragment(); 529 for (let i = (bqChilds.length - 1); i >= 0; i--) { 530 530 if (bqChilds[i].nodeType == 1 && // Node.ELEMENT_NODE 531 531 arrayIndexOf(blockElts, bqChilds[i].tagName.toLowerCase()) >= 0) { … … 561 561 562 562 jsToolBar.prototype.removeTextFormating = function(html) { 563 for ( varreg in this.removeFormatRegexp) {563 for (let reg in this.removeFormatRegexp) { 564 564 html = html.replace(this.removeFormatRegexp[reg][0], this.removeFormatRegexp[reg][1]); 565 565 } … … 576 576 fn: function(opt) { 577 577 if (opt == 'none') { 578 varblockLevel = this.getBlockLevel();578 const blockLevel = this.getBlockLevel(); 579 579 if (blockLevel !== null) { 580 580 this.replaceNodeByContent(blockLevel); … … 611 611 612 612 jsToolBar.prototype.elements.quote.fn.wysiwyg = function() { 613 varn = this.getSelectedNode();614 varq = this.iwin.document.createElement('q');613 const n = this.getSelectedNode(); 614 const q = this.iwin.document.createElement('q'); 615 615 q.appendChild(n); 616 616 this.insertNode(q); … … 618 618 619 619 jsToolBar.prototype.elements.code.fn.wysiwyg = function() { 620 varn = this.getSelectedNode();621 varcode = this.iwin.document.createElement('code');620 const n = this.getSelectedNode(); 621 const code = this.iwin.document.createElement('code'); 622 622 code.appendChild(n); 623 623 this.insertNode(code); … … 625 625 626 626 jsToolBar.prototype.elements.mark.fn.wysiwyg = function() { 627 varn = this.getSelectedNode();628 varmark = this.iwin.document.createElement('mark');627 const n = this.getSelectedNode(); 628 const mark = this.iwin.document.createElement('mark'); 629 629 mark.appendChild(n); 630 630 this.insertNode(mark); … … 632 632 633 633 jsToolBar.prototype.elements.br.fn.wysiwyg = function() { 634 varn = this.iwin.document.createElement('br');634 const n = this.iwin.document.createElement('br'); 635 635 this.insertNode(n); 636 636 }; 637 637 638 638 jsToolBar.prototype.elements.blockquote.fn.wysiwyg = function() { 639 varn = this.getSelectedNode();640 varq = this.iwin.document.createElement('blockquote');639 const n = this.getSelectedNode(); 640 const q = this.iwin.document.createElement('blockquote'); 641 641 q.appendChild(n); 642 642 this.insertNode(q); … … 659 659 660 660 jsToolBar.prototype.elements.link.fn.wysiwyg = function() { 661 var href, hreflang; 662 var range, commonAncestorContainer; 661 let href; 662 let hreflang; 663 let range; 664 let commonAncestorContainer; 663 665 if (this.iwin.getSelection) { //gecko 664 varselection = this.iwin.getSelection();666 const selection = this.iwin.getSelection(); 665 667 range = selection.getRangeAt(0); 666 668 commonAncestorContainer = range.commonAncestorContainer; … … 673 675 } 674 676 675 varancestorTagName = commonAncestorContainer.tagName.toLowerCase();677 let ancestorTagName = commonAncestorContainer.tagName.toLowerCase(); 676 678 while (ancestorTagName != 'a' && ancestorTagName != 'body') { 677 679 commonAncestorContainer = commonAncestorContainer.parentNode; … … 707 709 708 710 // Create link 709 varn = this.getSelectedNode();710 vara = this.iwin.document.createElement('a');711 const n = this.getSelectedNode(); 712 const a = this.iwin.document.createElement('a'); 711 713 a.href = href; 712 714 if (hreflang) a.setAttribute('hreflang', hreflang); … … 723 725 jsToolBar.prototype.elements.removeFormat.disabled = !jsToolBar.prototype.can_wwg; 724 726 jsToolBar.prototype.elements.removeFormat.fn.xhtml = function() { 725 varhtml = this.textarea.value;727 let html = this.textarea.value; 726 728 html = this.removeTextFormating(html); 727 729 this.textarea.value = html; 728 730 }; 729 731 jsToolBar.prototype.elements.removeFormat.fn.wysiwyg = function() { 730 varhtml = this.iwin.document.body.innerHTML;732 let html = this.iwin.document.body.innerHTML; 731 733 html = this.removeTextFormating(html); 732 734 this.iwin.document.body.innerHTML = html; … … 738 740 return aArray.indexOf(aValue); 739 741 } else { 740 varindex = -1;741 varl = aArray.length;742 for ( vari = 0; i < l; i++) {742 let index = -1; 743 const l = aArray.length; 744 for (let i = 0; i < l; i++) { 743 745 if (aArray[i] === aValue) { 744 746 index = i; … … 755 757 return true; 756 758 } else if (obj.attachEvent) { 757 varr = obj.attachEvent("on" + evType, fn);759 const r = obj.attachEvent("on" + evType, fn); 758 760 return r; 759 761 } else { … … 767 769 return true; 768 770 } else if (obj.detachEvent) { 769 varr = obj.detachEvent("on" + evType, fn);771 const r = obj.detachEvent("on" + evType, fn); 770 772 return r; 771 773 } else { -
plugins/dcLegacyEditor/js/jsToolBar/popup_link.js
r3735 r3880 13 13 14 14 function sendClose() { 15 varinsert_form = $('#link-insert-form').get(0);15 const insert_form = $('#link-insert-form').get(0); 16 16 if (insert_form == undefined) { return; } 17 17 18 vartb = window.opener.the_toolbar;19 vardata = tb.elements.link.data;18 const tb = window.opener.the_toolbar; 19 const data = tb.elements.link.data; 20 20 21 21 data.href = tb.stripBaseURL(insert_form.elements.href.value); … … 23 23 data.hreflang = insert_form.elements.hreflang.value; 24 24 tb.elements.link.fncall[tb.mode].call(tb); 25 } ;25 } 26 26 }); -
plugins/dcLegacyEditor/js/jsToolBar/popup_media.js
r3725 r3880 15 15 16 16 function sendClose() { 17 varinsert_form = $('#media-insert-form').get(0);17 const insert_form = $('#media-insert-form').get(0); 18 18 if (insert_form == undefined) { 19 19 return; 20 20 } 21 21 22 vartb = window.opener.the_toolbar;23 vartype = insert_form.elements.type.value;24 varmedia_align_grid = {22 const tb = window.opener.the_toolbar; 23 const type = insert_form.elements.type.value; 24 const media_align_grid = { 25 25 left: 'float: left; margin: 0 1em 1em 0;', 26 26 right: 'float: right; margin: 0 0 1em 1em;', 27 27 center: 'text-align: center;' 28 28 }; 29 var align, player; 29 let align; 30 let player; 30 31 31 32 if (type == 'image') { … … 38 39 tb.elements.img_select.data.url = tb.stripBaseURL(insert_form.elements.url.value); 39 40 40 varmedia_legend = $('input[name="legend"]:checked', insert_form).val();41 let media_legend = $('input[name="legend"]:checked', insert_form).val(); 41 42 if (media_legend != '' && media_legend != 'title' && media_legend != 'none') { 42 43 media_legend = 'legend'; … … 55 56 56 57 if (align != undefined && align != 'none') { 57 player = '<div style="' + media_align_grid[align] + '">' + player + '</div>';58 player = `<div style="${media_align_grid[align]}">${player}</div>`; 58 59 } 59 60 … … 62 63 } else if (type == 'flv') // may be all video media, not only flv 63 64 { 64 var oplayer = $( '<div>' + $('#public_player').val() + '</div>');65 var oplayer = $(`<div>${$('#public_player').val()}</div>`); 65 66 var flashvars = $('[name=FlashVars]', oplayer).val(); 66 67 … … 98 99 99 100 if (align != undefined && align != 'none') { 100 player = '<div style="' + media_align_grid[align] + '">' + player + '</div>';101 player = `<div style="${media_align_grid[align]}">${player}</div>`; 101 102 } 102 103 -
plugins/dcLegacyEditor/js/jsToolBar/popup_posts.js
r3735 r3880 9 9 $('#form-entries tr>td.maximal>a').click(function() { 10 10 // Get post_id 11 vartb = window.opener.the_toolbar;12 vardata = tb.elements.link.data;11 const tb = window.opener.the_toolbar; 12 const data = tb.elements.link.data; 13 13 14 14 data.href = tb.stripBaseURL($(this).attr('title'));
Note: See TracChangeset
for help on using the changeset viewer.