1/*! 2 * UEditor 3 * version: ueditor 4 * build: Thu May 29 2014 16:48:20 GMT+0800 (Öйú±ê׼ʱ¼ä) 5 */ 6 7(function(){ 8 9(function(){ 10 UE = window.UE || {}; 11 var isIE = !!window.ActiveXObject; 12 //¶¨Òåutils¹¤¾ß 13 var utils = { 14 removeLastbs : function(url){ 15 return url.replace(/\/$/,'') 16 }, 17 extend : function(t,s){ 18 var a = arguments, 19 notCover = this.isBoolean(a[a.length - 1]) ? a[a.length - 1] : false, 20 len = this.isBoolean(a[a.length - 1]) ? a.length - 1 : a.length; 21 for (var i = 1; i < len; i++) { 22 var x = a[i]; 23 for (var k in x) { 24 if (!notCover || !t.hasOwnProperty(k)) { 25 t[k] = x[k]; 26 } 27 } 28 } 29 return t; 30 }, 31 isIE : isIE, 32 cssRule : isIE ? function(key,style,doc){ 33 var indexList,index; 34 doc = doc || document; 35 if(doc.indexList){ 36 indexList = doc.indexList; 37 }else{ 38 indexList = doc.indexList = {}; 39 } 40 var sheetStyle; 41 if(!indexList[key]){ 42 if(style === undefined){ 43 return '' 44 } 45 sheetStyle = doc.createStyleSheet('',index = doc.styleSheets.length); 46 indexList[key] = index; 47 }else{ 48 sheetStyle = doc.styleSheets[indexList[key]]; 49 } 50 if(style === undefined){ 51 return sheetStyle.cssText 52 } 53 sheetStyle.cssText = sheetStyle.cssText + '\n' + (style || '') 54 } : function(key,style,doc){ 55 doc = doc || document; 56 var head = doc.getElementsByTagName('head')[0],node; 57 if(!(node = doc.getElementById(key))){ 58 if(style === undefined){ 59 return '' 60 } 61 node = doc.createElement('style'); 62 node.id = key; 63 head.appendChild(node) 64 } 65 if(style === undefined){ 66 return node.innerHTML 67 } 68 if(style !== ''){ 69 node.innerHTML = node.innerHTML + '\n' + style; 70 }else{ 71 head.removeChild(node) 72 } 73 }, 74 domReady : function (onready) { 75 var doc = window.document; 76 if (doc.readyState === "complete") { 77 onready(); 78 }else{ 79 if (isIE) { 80 (function () { 81 if (doc.isReady) return; 82 try { 83 doc.documentElement.doScroll("left"); 84 } catch (error) { 85 setTimeout(arguments.callee, 0); 86 return; 87 } 88 onready(); 89 })(); 90 window.attachEvent('onload', function(){ 91 onready() 92 }); 93 } else { 94 doc.addEventListener("DOMContentLoaded", function () { 95 doc.removeEventListener("DOMContentLoaded", arguments.callee, false); 96 onready(); 97 }, false); 98 window.addEventListener('load', function(){onready()}, false); 99 } 100 } 101 102 }, 103 each : function(obj, iterator, context) { 104 if (obj == null) return; 105 if (obj.length === +obj.length) { 106 for (var i = 0, l = obj.length; i < l; i++) { 107 if(iterator.call(context, obj[i], i, obj) === false) 108 return false;
109 } 110 } else { 111 for (var key in obj) { 112 if (obj.hasOwnProperty(key)) { 113 if(iterator.call(context, obj[key], key, obj) === false) 114 return false; 115 } 116 } 117 } 118 }, 119 inArray : function(arr,item){ 120 var index = -1; 121 this.each(arr,function(v,i){ 122 if(v === item){ 123 index = i; 124 return false; 125 } 126 }); 127 return index; 128 }, 129 pushItem : function(arr,item){ 130 if(this.inArray(arr,item)==-1){ 131 arr.push(item) 132 } 133 }, 134 trim: function (str) { 135 return str.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g, ''); 136 }, 137 indexOf: function (array, item, start) { 138 var index = -1; 139 start = this.isNumber(start) ? start : 0; 140 this.each(array, function (v, i) { 141 if (i >= start && v === item) { 142 index = i; 143 return false; 144 } 145 }); 146 return index; 147 }, 148 hasClass: function (element, className) { 149 className = className.replace(/(^[ ]+)|([ ]+$)/g, '').replace(/[ ]{2,}/g, ' ').split(' '); 150 for (var i = 0, ci, cls = element.className; ci = className[i++];) { 151 if (!new RegExp('\\b' + ci + '\\b', 'i').test(cls)) { 152 return false; 153 } 154 } 155 return i - 1 == className.length; 156 }, 157 addClass:function (elm, classNames) { 158 if(!elm)return; 159 classNames = this.trim(classNames).replace(/[ ]{2,}/g,' ').split(' '); 160 for(var i = 0,ci,cls = elm.className;ci=classNames[i++];){ 161 if(!new RegExp('\\b' + ci + '\\b').test(cls)){ 162 cls += ' ' + ci; 163 } 164 } 165 elm.className = utils.trim(cls); 166 }, 167 removeClass:function (elm, classNames) { 168 classNames = this.isArray(classNames) ? classNames : 169 this.trim(classNames).replace(/[ ]{2,}/g,' ').split(' '); 170 for(var i = 0,ci,cls = elm.className;ci=classNames[i++];){ 171 cls = cls.replace(new RegExp('\\b' + ci + '\\b'),'') 172 } 173 cls = this.trim(cls).replace(/[ ]{2,}/g,' '); 174 elm.className = cls; 175 !cls && elm.removeAttribute('className'); 176 }, 177 on: function (element, type, handler) { 178 var types = this.isArray(type) ? type : type.split(/\s+/), 179 k = types.length; 180 if (k) while (k--) { 181 type = types[k]; 182 if (element.addEventListener) { 183 element.addEventListener(type, handler, false); 184 } else { 185 if (!handler._d) { 186 handler._d = { 187 els : [] 188 }; 189 } 190 var key = type + handler.toString(),index = utils.indexOf(handler._d.els,element); 191 if (!handler._d[key] || index == -1) { 192 if(index == -1){ 193 handler._d.els.push(element); 194 } 195 if(!handler._d[key]){ 196 handler._d[key] = function (evt) { 197 return handler.call(evt.srcElement, evt || window.event); 198 }; 199 } 200 201 202 element.attachEvent('on' + type, handler._d[key]); 203 } 204 } 205 } 206 element = null; 207 }, 208 off: function (element, type, handler) { 209 var types = this.isArray(type) ? type : type.split(/\s+/), 210 k = types.length; 211 if (k) while (k--) { 212 type = types[k]; 213 if (element.removeEventListener) { 214 element.removeEventListener(type, handler, false); 215 } else { 216 var key = type + handler.toString(); 217 try{ 218 element.detachEvent('on' + type, handler._d ? handler._d[key] : handler); 219 }catch(e){} 220 if (handler._d && handler._d[key]) { 221 var index = utils.indexOf(handler._d.els,element); 222 if(index!=-1){ 223 handler._d.els.splice(index,1); 224 } 225 handler._d.els.length == 0 && delete handler._d[key]; 226 } 227 } 228 } 229 }, 230 loadFile : function () { 231 var tmpList = []; 232 function getItem(doc,obj){ 233 try{ 234 for(var i= 0,ci;ci=tmpList[i++];){ 235 if(ci.doc === doc && ci.url == (obj.src || obj.href)){ 236 return ci; 237 } 238 } 239 }catch(e){ 240 return null; 241 } 242 243 } 244 return function (doc, obj, fn) { 245 var item = getItem(doc,obj); 246 if (item) { 247 if(item.ready){ 248 fn && fn(); 249 }else{ 250 item.funs.push(fn) 251 } 252 return; 253 } 254 tmpList.push({ 255 doc:doc, 256 url:obj.src||obj.href, 257 funs:[fn] 258 }); 259 if (!doc.body) { 260 var html = []; 261 for(var p in obj){ 262 if(p == 'tag')continue; 263 html.push(p + '="' + obj[p] + '"') 264 } 265 doc.write('<' + obj.tag + ' ' + html.join(' ') + ' ></'+obj.tag+'>'); 266 return; 267 } 268 if (obj.id && doc.getElementById(obj.id)) { 269 return; 270 } 271 var element = doc.createElement(obj.tag); 272 delete obj.tag; 273 for (var p in obj) { 274 element.setAttribute(p, obj[p]); 275 } 276 element.onload = element.onreadystatechange = function () { 277 if (!this.readyState || /loaded|complete/.test(this.readyState)) { 278 item = getItem(doc,obj); 279 if (item.funs.length > 0) { 280 item.ready = 1; 281 for (var fi; fi = item.funs.pop();) { 282 fi(); 283 } 284 } 285 element.onload = element.onreadystatechange = null; 286 } 287 }; 288 element.onerror = function(){ 289 throw Error('The load '+(obj.href||obj.src)+' fails,check the url') 290 }; 291 doc.getElementsByTagName("head")[0].appendChild(element); 292 } 293 }() 294 }; 295 utils.each(['String', 'Function', 'Array', 'Number', 'RegExp', 'Object','Boolean'], function (v) { 296 utils['is' + v] = function (obj) { 297 return Object.prototype.toString.apply(obj) == '[object ' + v + ']'; 298 } 299 }); 300 var parselist = {}; 301 UE.parse = { 302 register : function(parseName,fn){ 303 parselist[parseName] = fn; 304 }, 305 load : function(opt){ 306 utils.each(parselist,function(v){ 307 v.call(opt,utils); 308 }) 309 } 310 }; 311 uParse = function(selector,opt){ 312 utils.domReady(function(){ 313 var contents; 314 if(document.querySelectorAll){ 315 contents = document.querySelectorAll(selector) 316 }else{ 317 if(/^#/.test(selector)){ 318 contents = [document.getElementById(selector.replace(/^#/,''))] 319 }else if(/^\./.test(selector)){ 320 var contents = []; 321 utils.each(document.getElementsByTagName('*'),function(node){ 322 if(node.className && new RegExp('\\b' + selector.replace(/^\./,'') + '\\b','i').test(node.className)){ 323 contents.push(node) 324 } 325 }) 326 }else{ 327 contents = document.getElementsByTagName(selector) 328 } 329 } 330 utils.each(contents,function(v){ 331 UE.parse.load(utils.extend({root:v,selector:selector},opt)) 332 }) 333 }) 334 } 335})(); 336 337UE.parse.register('insertcode',function(utils){ 338 var pres = this.root.getElementsByTagName('pre'); 339 if(pres.length){ 340 if(typeof XRegExp == "undefined"){ 341 var jsurl,cssurl; 342 if(this.rootPath !== undefined){ 343 jsurl = utils.removeLastbs(this.rootPath) + '/third-party/SyntaxHighlighter/shCore.js'; 344 cssurl = utils.removeLastbs(this.rootPath) + '/third-party/SyntaxHighlighter/shCoreDefault.css'; 345 }else{ 346 jsurl = this.highlightJsUrl; 347 cssurl = this.highlightCssUrl; 348 } 349 utils.loadFile(document,{ 350 id : "syntaxhighlighter_css", 351 tag : "link", 352 rel : "stylesheet", 353 type : "text/css", 354 href : cssurl 355 }); 356 utils.loadFile(document,{ 357 id : "syntaxhighlighter_js", 358 src : jsurl, 359 tag : "script", 360 type : "text/javascript", 361 defer : "defer" 362 },function(){ 363 utils.each(pres,function(pi){ 364 if(pi && /brush/i.test(pi.className)){ 365 SyntaxHighlighter.highlight(pi); 366 } 367 }); 368 }); 369 }else{ 370 utils.each(pres,function(pi){ 371 if(pi && /brush/i.test(pi.className)){ 372 SyntaxHighlighter.highlight(pi); 373 } 374 }); 375 } 376 } 377 378}); 379UE.parse.register('table', function (utils) { 380 var me = this, 381 root = this.root, 382 tables = root.getElementsByTagName('table'); 383 if (tables.length) { 384 var selector = this.selector; 385 //×·¼ÓĬÈϵıí¸ñÑùʽ 386 utils.cssRule('table', 387 selector + ' table.noBorderTable td,' + 388 selector + ' table.noBorderTable th,' + 389 selector + ' table.noBorderTable caption{border:1px dashed #ddd !important}' + 390 selector + ' table.sortEnabled tr.firstRow th,' + selector + ' table.sortEnabled tr.firstRow td{padding-right:20px; background-repeat: no-repeat;' + 391 'background-position: center right; background-image:url(' + this.rootPath + 'themes/default/images/sortable.png);}' + 392 selector + ' table.sortEnabled tr.firstRow th:hover,' + selector + ' table.sortEnabled tr.firstRow td:hover{background-color: #EEE;}' + 393 selector + ' table{margin-bottom:10px;border-collapse:collapse;display:table;}' + 394 selector + ' td,' + selector + ' th{ padding: 5px 10px;border: 1px solid #DDD;}' + 395 selector + ' caption{border:1px dashed #DDD;border-bottom:0;padding:3px;text-align:center;}' + 396 selector + ' th{border-top:1px solid #BBB;background:#F7F7F7;}' + 397 selector + ' table tr.firstRow th{border-top:2px solid #BBB;background:#F7F7F7;}' + 398 selector + ' tr.ue-table-interlace-color-single td{ background: #fcfcfc; }' + 399 selector + ' tr.ue-table-interlace-color-double td{ background: #f7faff; }' + 400 selector + ' td p{margin:0;padding:0;}', 401 document); 402 //Ìî³ä¿ÕµÄµ¥Ôª¸ñbackground:white; 403 404 utils.each('td th caption'.split(' '), function (tag) { 405 var cells = root.getElementsByTagName(tag); 406 cells.length && utils.each(cells, function (node) { 407 if (!node.firstChild) { 408 node.innerHTML = ' '; 409 410 } 411 }) 412 }); 413 414 //±í¸ñ¿ÉÅÅÐò 415 var tables = root.getElementsByTagName('table'); 416 utils.each(tables, function (table) { 417 if (/\bsortEnabled\b/.test(table.className)) { 418 utils.on(table, 'click', function(e){ 419 var target = e.target || e.srcElement, 420 cell = findParentByTagName(target, ['td', 'th']); 421 var table = findParentByTagName(target, 'table'), 422 colIndex = utils.indexOf(table.rows[0].cells, cell), 423 sortType = table.getAttribute('data-sort-type'); 424 if(colIndex != -1) { 425 sortTable(table, colIndex, me.tableSortCompareFn || sortType); 426 updateTable(table); 427 } 428 }); 429 } 430 }); 431 432 //°´ÕÕ±êÇ©Ãû²éÕÒ¸¸½Úµã 433 function findParentByTagName(target, tagNames) { 434 var i, current = target; 435 tagNames = utils.isArray(tagNames) ? tagNames:[tagNames]; 436 while(current){ 437 for(i = 0;i < tagNames.length; i++) { 438 if(current.tagName == tagNames[i].toUpperCase()) return current; 439 } 440 current = current.parentNode; 441 } 442 return null; 443 } 444 //±í¸ñÅÅÐò 445 function sortTable(table, sortByCellIndex, compareFn) { 446 var rows = table.rows, 447 trArray = [], 448 flag = rows[0].cells[0].tagName === "TH", 449 lastRowIndex = 0; 450 451 for (var i = 0,len = rows.length; i < len; i++) { 452 trArray[i] = rows[i]; 453 } 454 455 var Fn = { 456 'reversecurrent': function(td1,td2){ 457 return 1; 458 }, 459 'orderbyasc': function(td1,td2){ 460 var value1 = td1.innerText||td1.textContent, 461 value2 = td2.innerText||td2.textContent; 462 return value1.localeCompare(value2); 463 }, 464 'reversebyasc': function(td1,td2){ 465 var value1 = td1.innerHTML, 466 value2 = td2.innerHTML; 467 return value2.localeCompare(value1); 468 }, 469 'orderbynum': function(td1,td2){ 470 var value1 = td1[utils.isIE ? 'innerText':'textContent'].match(/\d+/), 471 value2 = td2[utils.isIE ? 'innerText':'textContent'].match(/\d+/); 472 if(value1) value1 = +value1[0]; 473 if(value2) value2 = +value2[0]; 474 return (value1||0) - (value2||0); 475 }, 476 'reversebynum': function(td1,td2){ 477 var value1 = td1[utils.isIE ? 'innerText':'textContent'].match(/\d+/), 478 value2 = td2[utils.isIE ? 'innerText':'textContent'].match(/\d+/); 479 if(value1) value1 = +value1[0]; 480 if(value2) value2 = +value2[0]; 481 return (value2||0) - (value1||0); 482 } 483 }; 484 485 //¶Ô±í¸ñÉèÖÃÅÅÐòµÄ±ê¼Çdata-sort-type 486 table.setAttribute('data-sort-type', compareFn && typeof compareFn === "string" && Fn[compareFn] ? compareFn:''); 487 488 //th²»²ÎÓëÅÅÐò 489 flag && trArray.splice(0, 1); 490 trArray
490= sort(trArray,function (tr1, tr2) { 491 var result; 492 if (compareFn && typeof compareFn === "function") { 493 result = compareFn.call(this, tr1.cells[sortByCellIndex], tr2.cells[sortByCellIndex]); 494 } else if (compareFn && typeof compareFn === "number") { 495 result = 1; 496 } else if (compareFn && typeof compareFn === "string" && Fn[compareFn]) { 497 result = Fn[compareFn].call(this, tr1.cells[sortByCellIndex], tr2.cells[sortByCellIndex]); 498 } else { 499 result = Fn['orderbyasc'].call(this, tr1.cells[sortByCellIndex], tr2.cells[sortByCellIndex]); 500 } 501 return result; 502 }); 503 var fragment = table.ownerDocument.createDocumentFragment(); 504 for (var j = 0, len = trArray.length; j < len; j++) { 505 fragment.appendChild(trArray[j]); 506 } 507 var tbody = table.getElementsByTagName("tbody")[0]; 508 if(!lastRowIndex){ 509 tbody.appendChild(fragment); 510 }else{ 511 tbody.insertBefore(fragment,rows[lastRowIndex- range.endRowIndex + range.beginRowIndex - 1]) 512 } 513 } 514 //ðÅÝÅÅÐò 515 function sort(array, compareFn){ 516 compareFn = compareFn || function(item1, item2){ return item1.localeCompare(item2);}; 517 for(var i= 0,len = array.length; i<len; i++){ 518 for(var j = i,length = array.length; j<length; j++){ 519 if(compareFn(array[i], array[j]) > 0){ 520 var t = array[i]; 521 array[i] = array[j]; 522 array[j] = t; 523 } 524 } 525 } 526 return array; 527 } 528 //¸üбí¸ñ 529 function updateTable(table) { 530 //¸øµÚÒ»ÐÐÉèÖÃfirstRowµÄÑùʽÃû³Æ,ÔÚÅÅÐòͼ±êµÄÑùʽÉÏʹÓõ½ 531 if(!utils.hasClass(table.rows[0], "firstRow")) { 532 for(var i = 1; i< table.rows.length; i++) { 533 utils.removeClass(table.rows[i], "firstRow"); 534 } 535 utils.addClass(table.rows[0], "firstRow"); 536 } 537 } 538 } 539}); 540UE.parse.register('charts',function( utils ){ 541 542 utils.cssRule('chartsContainerHeight','.edui-chart-container { height:'+(this.chartContainerHeight||300)+'px}'); 543 var resourceRoot = this.rootPath, 544 containers = this.root, 545 sources = null; 546 547 //²»´æÔÚÖ¸¶¨µÄ¸ù·¾¶£¬ ÔòÖ±½ÓÍ˳ö 548 if ( !resourceRoot ) { 549 return; 550 } 551 552 if ( sources = parseSources() ) { 553 554 loadResources(); 555 556 } 557 558 559 function parseSources () { 560 561 if ( !containers ) { 562 return null; 563 } 564 565 return extractChartData( containers ); 566 567 } 568 569 /** 570 * ÌáÈ¡Êý¾Ý 571 */ 572 function extractChartData ( rootNode ) { 573 574 var data = [], 575 tables = rootNode.getElementsByTagName( "table" ); 576 577 for ( var i = 0, tableNode; tableNode = tables[ i ]; i++ ) { 578 579 if ( tableNode.getAttribute( "data-chart" ) !== null ) { 580 581 data.push( formatData( tableNode ) ); 582 583 } 584 585 } 586 587 return data.length ? data : null; 588 589 } 590 591 function formatData ( tableNode ) { 592 593 var meta = tableNode.getAttribute( "data-chart" ), 594 metaConfig = {}, 595 data = []; 596 597 //ÌáÈ¡tableÊý¾Ý 598 for ( var i = 0, row; row = tableNode.rows[ i ]; i++ ) { 599 600 var rowData = []; 601 602 for ( var j = 0, cell; cell = row.cells[ j ]; j++ ) { 603 604 var value = ( cell.innerText || cell.textContent || '' ); 605 rowData.push( cell.tagName == 'TH' ? value:(value | 0) ); 606 607 } 608 609 data.push( rowData ); 610 611 } 612 613 //½âÎöÔªÐÅÏ¢ 614 meta = meta.split( ";" ); 615 for ( var i = 0, metaData; metaData = meta[ i ]; i++ ) { 616 617 metaData = metaData.split( ":" ); 618 metaConfig[ metaData[ 0 ] ] = metaData[ 1 ]; 619 620 } 621 622 623 return { 624 table: tableNode, 625 meta: metaConfig, 626 data: data 627 }; 628 629 } 630 631 //¼ÓÔØ×ÊÔ´ 632 function loadResources () { 633 634 loadJQuery(); 635 636 } 637 638 function loadJQuery () { 639 640 //²»´æÔÚjquery£¬ Ôò¼ÓÔØjquery 641 if ( !window.jQuery ) { 642 643 utils.loadFile(document,{ 644 src : resourceRoot + "/third-party/jquery-1.10.2.min.js", 645 tag : "script", 646 type : "text/javascript", 647 defer : "defer" 648 },function(){ 649 650 loadHighcharts(); 651 652 }); 653 654 } else { 655 656 loadHighcharts(); 657 658 } 659 660 } 661 662 function loadHighcharts () { 663 664 //²»´æÔÚHighcharts£¬ Ôò¼ÓÔØHighcharts 665 if ( !window.Highcharts ) { 666 667 utils.loadFile(document,{ 668 src : resourceRoot + "/third-party/highcharts/highcharts.js", 669 tag : "script", 670 type : "text/javascript", 671 defer : "defer" 672 },function(){ 673 674 loadTypeConfig(); 675 676 }); 677 678 } else { 679 680 loadTypeConfig(); 681 682 } 683 684 } 685 686 //¼ÓÔØÍ¼±í²îÒ컯ÅäÖÃÎļþ 687 function loadTypeConfig () { 688 689 utils.loadFile(document,{ 690 src : resourceRoot + "/dialogs/charts/chart.config.js", 691 tag : "script", 692 type : "text/javascript", 693 defer : "defer" 694 },function(){ 695 696 render(); 697 698 }); 699 700 } 701 702 //äÖȾͼ±í 703 function render () { 704 705 var config = null, 706 chartConfig = null, 707 container = null; 708 709 for ( var i = 0, len = sources.length; i < len; i++ ) { 710 711 config = sources[ i ]; 712 713 chartConfig = analysisConfig( config ); 714 715 container = createContainer( config.table ); 716 717 renderChart( container, typeConfig[ config.meta.chartType ], chartConfig ); 718 719 } 720 721 722 } 723 724 /** 725 * äÖȾͼ±í
726 * @param container ͼ±íÈÝÆ÷½Úµã¶ÔÏó 727 * @param typeConfig ͼ±íÀàÐÍÅäÖà 728 * @param config ͼ±íͨÓÃÅäÖà 729 * */ 730 function renderChart ( container, typeConfig, config ) { 731 732 733 $( container ).highcharts( $.extend( {}, typeConfig, { 734 735 credits: { 736 enabled: false 737 }, 738 exporting: { 739 enabled: false 740 }, 741 title: { 742 text: config.title, 743 x: -20 //center 744 }, 745 subtitle: { 746 text: config.subTitle, 747 x: -20 748 }, 749 xAxis: { 750 title: { 751 text: config.xTitle 752 }, 753 categories: config.categories 754 }, 755 yAxis: { 756 title: { 757 text: config.yTitle 758 }, 759 plotLines: [{ 760 value: 0, 761 width: 1, 762 color: '#808080' 763 }] 764 }, 765 tooltip: { 766 enabled: true, 767 valueSuffix: config.suffix 768 }, 769 legend: { 770 layout: 'vertical', 771 align: 'right', 772 verticalAlign: 'middle', 773 borderWidth: 1 774 }, 775 series: config.series 776 777 } )); 778 779 } 780 781 /** 782 * ´´½¨Í¼±íµÄÈÝÆ÷ 783 * д´½¨µÄÈÝÆ÷»áÌæ»»µô¶ÔÓ¦µÄtable¶ÔÏó 784 * */ 785 function createContainer ( tableNode ) { 786 787 var container = document.createElement( "div" ); 788 container.className = "edui-chart-container"; 789 790 tableNode.parentNode.replaceChild( container, tableNode ); 791 792 return container; 793 794 } 795 796 //¸ù¾Ýconfig½âÎö³öÕýÈ·µÄÀà±ðºÍͼ±íÊý¾ÝÐÅÏ¢ 797 function analysisConfig ( config ) { 798 799 var series = [], 800 //Êý¾ÝÀà±ð 801 categories = [], 802 result = [], 803 data = config.data, 804 meta = config.meta; 805 806 //Êý¾Ý¶ÔÆë·½Ê½ÎªÏà·´µÄ·½Ê½£¬ ÐèÒª·´×ªÊý¾Ý 807 if ( meta.dataFormat != "1" ) { 808 809 for ( var i = 0, len = data.length; i < len ; i++ ) { 810 811 for ( var j = 0, jlen = data[ i ].length; j < jlen; j++ ) { 812 813 if ( !result[ j ] ) { 814 result[ j ] = []; 815 } 816 817 result[ j ][ i ] = data[ i ][ j ]; 818 819 } 820 821 } 822 823 data = result; 824 825 } 826 827 result = {}; 828 829 //ÆÕͨͼ±í 830 if ( meta.chartType != typeConfig.length - 1 ) { 831 832 categories = data[ 0 ].slice( 1 ); 833 834 for ( var i = 1, curData; curData = data[ i ]; i++ ) { 835 series.push( { 836 name: curData[ 0 ], 837 data: curData.slice( 1 ) 838 } ); 839 } 840 841 result.series = series; 842 result.categories = categories; 843 result.title = meta.title; 844 result.subTitle = meta.subTitle; 845 result.xTitle = meta.xTitle; 846 result.yTitle = meta.yTitle; 847 result.suffix = meta.suffix; 848 849 } else { 850 851 var curData = []; 852 853 for ( var i = 1, len = data[ 0 ].length; i < len; i++ ) { 854 855 curData.push( [ data[ 0 ][ i ], data[ 1 ][ i ] | 0 ] ); 856 857 } 858 859 //±ýͼ 860 series[ 0 ] = { 861 type: 'pie', 862 name: meta.tip, 863 data: curData 864 }; 865 866 result.series = series; 867 result.title = meta.title; 868 result.suffix = meta.suffix; 869 870 } 871 872 return result; 873 874 } 875 876}); 877UE.parse.register('background', function (utils) { 878 var me = this, 879 root = me.root, 880 p = root.getElementsByTagName('p'), 881 styles; 882 883 for (var i = 0,ci; ci = p[i++];) { 884 styles = ci.getAttribute('data-background'); 885 if (styles){ 886 ci.parentNode.removeChild(ci); 887 } 888 } 889 890 //×·¼ÓĬÈϵıí¸ñÑùʽ 891 styles && utils.cssRule('ueditor_background', me.selector + '{' + styles + '}', document); 892}); 893UE.parse.register('list',function(utils){ 894 var customCss = [], 895 customStyle = { 896 'cn' : 'cn-1-', 897 'cn1' : 'cn-2-', 898 'cn2' : 'cn-3-', 899 'num' : 'num-1-', 900 'num1' : 'num-2-', 901 'num2' : 'num-3-', 902 'dash' : 'dash', 903 'dot' : 'dot' 904 }; 905 906 907 utils.extend(this,{ 908 liiconpath : 'http://bs.baidu.com/listicon/', 909 listDefaultPaddingLeft : '2.5' 910 }); 911 912 var root = this.root, 913 ols = root.getElementsByTagName('ol'), 914 uls = root.getElementsByTagName('ul'), 915 selector = this.selector; 916 917 if(ols.length){ 918 applyStyle.call(this,ols); 919 } 920 921 if(uls.length){ 922 applyStyle.call(this,uls); 923 } 924 925 if(ols.length || uls.length){ 926 customCss.push(selector +' .list-paddingleft-1{padding-left:0}'); 927 customCss.push(selector +' .list-paddingleft-2{padding-left:'+ this.listDefaultPaddingLeft+'em}'); 928 customCss.push(selector +' .list-paddingleft-3{padding-left:'+ this.listDefaultPaddingLeft*2+'em}'); 929 930 utils.cssRule('list', selector +' ol,'+selector +' ul{margin:0;padding:0;} '+selector +' li{clear:both;}'+customCss.join('\n'), document); 931 } 932 function applyStyle(nodes){ 933 var T = this; 934 utils.each(nodes,function(list){ 935 if(list.className && /custom_/i.test(list.className)){ 936 var listStyle = list.className.match(/custom_(\w+)/)[1]; 937 if(listStyle == 'dash' || listStyle == 'dot'){ 938 utils.pushItem(customCss,selector +' li.list-' + customStyle[listStyle] + '{background-image:url(' + T.liiconpath +customStyle[listStyle]+'.gif)}'); 939 utils.pushItem(customCss,selector +' ul.custom_'+listStyle+'{list-style:none;} '+ selector +' ul.custom_'+listStyle+' li{background-position:0 3px;background-repeat:no-repeat}'); 940 941 }else{ 942 var index = 1; 943 utils.each(list.childNodes,function(li){ 944 if(li.tagName == 'LI'){ 945 utils.pushItem(customCss,selector + ' li.list-' + customStyle[listStyle] + index + '{background-image:url(' + T.liiconpath + 'list-'+customStyle[listStyle] +index + '.gif)}'); 946 index++; 947 } 948 }); 949 utils.pushItem(customCss,selector + ' ol.custom_'+listStyle+'{list-style:none;}'+selector+' ol.custom_'+listStyle+' li{background-position:0 3px;background-repeat:no-repeat}'); 950 } 951 switch(listStyle){ 952 case 'cn': 953 utils.pushItem(customCss,selector + ' li.list-'+listStyle+'-paddingleft-1{padding-left:25px}'); 954 utils.pushItem(customCss,selector + ' li.list-'+listStyle+'-paddingleft-2{padding-left:40px}'); 955 utils.pushItem(customCss,selector + ' li.list-'+listStyle+'-paddingleft-3{padding-left:55px}'); 956 break; 957 case 'cn1': 958 utils.pushItem(customCss,selector + ' li.list-'+listStyle+'-paddingleft-1{padding-left:30px}'); 959 utils.pushItem(customCss,selector + ' li.list-'+listStyle+'-paddingleft-2{padding-left:40px}'); 960 utils.pushItem(customCss,selector + ' li.list-'+listStyle+'-paddingleft-3{padding-left:55px}'); 961 break; 962 case 'cn2': 963 utils.pushItem(customCss,selector + ' li.list-'+listStyle+'-paddingleft-1{padding-left:40px}'); 964 utils.pushItem(customCss,selector + ' li.list-'+listStyle+'-paddingleft-2{padding-left:55px}'); 965 utils.pushItem(customCss,selector + ' li.list-'+listStyle+'-paddingleft-3{padding-left:68px}'); 966 break; 967 case 'num': 968 case 'num1': 969 utils.pushItem(customCss,selector + ' li.list-'+listStyle+'-paddingleft-1{padding-left:25px}'); 970 break; 971 case 'num2': 972 utils.pushItem(customCss,selector + ' li.list-'+listStyle+'-paddingleft-1{padding-left:35px}'); 973 utils.pushItem(customCss,selector + ' li.list-'+listStyle+'-paddingleft-2{padding-left:40px}'); 974 break; 975 case 'dash': 976 utils.pushItem(customCss,selector + ' li.list-'+listStyle+'-paddingleft{padding-left:35px}'); 977 break; 978 case 'dot': 979 utils.pushItem(customCss,selector + ' li.list-'+listStyle+'-paddingleft{padding-left:20px}'); 980 } 981 } 982 }); 983 } 984 985 986}); 987UE.parse.register('vedio',function(utils){ 988 var video = this.root.getElementsByTagName('video'), 989 audio = this.root.getElementsByTagName('audio'); 990 991 document.createElement('video');document.createElement('audio'); 992 if(video.length || audio.length){ 993 var sourcePath = utils.removeLastbs(this.rootPath), 994 jsurl = sourcePath + '/third-party/video-js/video.js', 995 cssurl = sourcePath + '/third-party/video-js/video-js.min.css', 996 swfUrl = sourcePath + '/third-party/video-js/video-js.swf'; 997 998 if(window.videojs) { 999 videojs.autoSetup(); 1000 } else { 1001 utils.loadFile(document,{ 1002 id : "video_css", 1003 tag : "link", 1004 rel : "stylesheet", 1005 type : "text/css", 1006 href : cssurl 1007 }); 1008 utils.loadFile(document,{ 1009 id : "video_js", 1010 src : jsurl, 1011 tag : "script", 1012 type : "text/javascript" 1013 },function(){ 1014 videojs.options.flash.swf = swfUrl; 1015 videojs.autoSetup(); 1016 }); 1017 } 1018 1019 } 1020}); 1021 1022})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.