1///editore review yapmak için 2Ext.override(Ext.form.HtmlEditor,{ 3 //düzeltmeler yapılması için parametrenin truue olması lazım 4 duzeltme:false, 5 //düzeltmelerin kabul edilmesi için parametrenin truue olması lazım 6 kabul:false, 7 //algantagin kaldırılması için bu var 8 kaldir:false, 9 //saÄ düÄmeye basılınca açılan menü 10 bodyContextMenu:null, 11 //ekleme yapıldıÄındaki tag ismi 12 algantag : 'algantag', 13 //silme yapıldıÄındaki tag ismi 14 algantag_sil : 'algantag_sil', 15 //açıklama yapıldıÄındaki tag ismi 16 algantag_blink : 'algantag_blink', 17 //editor de saÄ düÄmeye basıldıÄında contextmenu çıkması için lazım 18 addContextMenu: function(myHandler, myTarget){ 19 20 var stopDefault = function(e){ 21 e.stopEvent(); 22 e.stopPropagation(); 23 } 24 25 Ext.EventManager.addListener(myTarget, 'contextmenu', stopDefault, this, { 26 stopEvent: true, 27 stopPropagation: true, 28 preventDefault: true 29 }); 30 31 if(Ext.isIE){ 32 Ext.EventManager.addListener(myTarget, 'contextmenu', myHandler, this, { 33 //stopEvent: true, 34 //stopPropagation: true, 35 //preventDefault: true 36 buffer: 100 37 }); 38 }else{ 39 Ext.EventManager.addListener(myTarget, 'contextmenu', myHandler, this, { 40 stopEvent: true, 41 stopPropagation: true, 42 preventDefault: true, 43 buffer: 100 44 }); 45 } 46 47 return true; 48 } , 49 //tuÅa basıldıÄında bir fonksiyon çalıÅsın diye bu override ediliyor 50 initEditor : function(){ 51 //Destroying the component during/before initEditor can cause issues. 52 try{ 53 var dbody = this.getEditorBody(), 54 ss = this.el.getStyles('font-size', 'font-family', 'background-image', 'background-repeat', 'background-color', 'color'), 55 doc, 56 fn; 57 58 ss['fontSize'] = '14px'; 59 //ss['lineHeight'] = '150%'; 60 //ss['font-size'] = '14px'; 61 ss['background-attachment'] = 'fixed'; // w3c 62 dbody.bgProperties = 'fixed'; // ie 63 64 Ext.DomHelper.applyStyles(dbody, ss); 65 66 doc = this.getDoc(); 67 68 if(doc){ 69 try{ 70 Ext.EventManager.removeAll(doc); 71 }catch(e){} 72 } 73 74 /* 75 * We need to use createDelegate here, because when using buffer, the delayed task is added 76 * as a property to the function. When the listener is removed, the task is deleted from the function. 77 * Since onEditorEvent is shared on the prototype, if we have multiple html editors, the first time one of the editors 78 * is destroyed, it causes the fn to be deleted from the prototype, which causes errors. Essentially, we're just anonymizing the function. 79 */ 80 fn = this.onEditorEvent.createDelegate(this); 81 Ext.EventManager.on(doc, { 82 mousedown: fn, 83 dblclick: fn, 84 click: fn, 85 keyup: fn, 86 buffer:100 87 }); 88 89 if(Ext.isGecko){ 90 Ext.EventManager.on(doc, 'keypress', this.applyCommand, this); 91 } 92 //if(Ext.isIE || Ext.isWebKit || Ext.isOpera){ 93 Ext.EventManager.on(doc, 'keypress', this.fixKeys, this); 94 if(Ext.isWebKit){ 95 //geri tuÅu için 96 Ext.EventManager.on(doc, 'keydown', this.fixKeys, this); 97 } 98 //} 99 doc.editorInitialized = true; 100 this.initialized = true; 101 this.pushValue(); 102 this.setReadOnly(this.readOnly); 103 this.fireEvent('initialize', this); 104 }catch(e){} 105 106 var editor = this; 107 //saÄ düÄmeye basıldıÄında çıkan menü 108 this.bodyContextMenu = new Ext.menu.Menu({ 109 editor:editor, 110 items:[{ 111 text: 'Kabul Et', 112 handler: function(){ 113 editor.kabulEt(); 114 } 115 },{ 116 text: 'Reddet', 117 handler: function(){ 118 editor.reddet(); 119 } 120 },{text:'Açıklama Ekle', 121 handler:function(){ 122 editor.aciklamaEkle2(); 123 } 124 },{text:'Açıklamayı Sil', 125 handler:function(){ 126 editor.aciklamayiSil(); 127 } 128 },{text:'Tümünü Kabul Et', 129 handler:function(){ 130 editor.tumunuKabulEt(); 131 } 132 },{text:'Kaldır', 133 handler:function(){ 134 editor.kabulEt(); 135 } 136 }] 137 }); 138 139 //saÄ menü çıkması için fonksiyon çaÄrılıyor 140 this.addContextMenu(this.sagMenu, this.getEditorBody()); 141 this.aciklamaIcinDolas(this.getDoc()); 142 }, 143 fixKeys : function(){ // load time branching for fastest keydown performance 144 if(Ext.isGecko){ 145 return function(e){
146 if(this.duzeltme) 147 this.ekleSil(e); 148 } 149 } 150 if(Ext.isIE){ 151 return function(e){ 152 var k = e.getKey(), 153 doc = this.getDoc(), 154 r; 155 if(k == e.TAB){ 156 e.stopEvent(); 157 r = doc.selection.createRange(); 158 if(r){ 159 r.collapse(true); 160 r.pasteHTML(' '); 161 this.deferFocus(); 162 } 163 }else if(k == e.ENTER){ 164 r = doc.selection.createRange(); 165 if(r){ 166 var target = r.parentElement(); 167 if(!target || target.tagName.toLowerCase() != 'li'){ 168 e.stopEvent(); 169 r.pasteHTML('<br />'); 170 r.collapse(false); 171 r.select(); 172 } 173 } 174 } 175 if(this.duzeltme) 176 this.ekleSil(e); 177 }; 178 }else if(Ext.isOpera){ 179 return function(e){ 180 var k = e.getKey(); 181 if(k == e.TAB){ 182 e.stopEvent(); 183 this.win.focus(); 184 this.execCmd('InsertHTML',' '); 185 this.deferFocus(); 186 } 187 if(this.duzeltme) 188 this.ekleSil(e); 189 }; 190 }else if(Ext.isWebKit){ 191 return function(e){ 192 var k = e.getKey(); 193 if(k == e.TAB){ 194 e.stopEvent(); 195 this.execCmd('InsertText','\t'); 196 this.deferFocus(); 197 }else if(k == e.ENTER){ 198 e.stopEvent(); 199 //yazıların sonunda enter karakteri konulduÄunda alt satıra geçmiyordu, çözüldü 200 //yazıların ortasında da enter a basıldıÄında 2 enter ekliyordu, çözüldü 201 var selection = this.win.getSelection(); 202 if(selection.anchorNode == selection.focusNode && (selection.anchorNode.data == null || (selection.anchorNode.data.length == selection.focusOffset && selection.focusOffset == selection.anchorOffset))) 203 this.execCmd('InsertHtml','<br /><br />'); 204 else 205 this.execCmd('InsertHtml','<br />'); 206 this.deferFocus(); 207 } 208 if(this.duzeltme) 209 this.ekleSil(e); 210 }; 211 } 212 }(), 213 tumunuKabulEt:function(){ 214 Ext.getCmp(this.id).setValue(Ext.getCmp(this.id).getValue().replaceAll('<algantag style="color: green;">','')); 215 Ext.getCmp(this.id).setValue(Ext.getCmp(this.id).getValue().replaceAll('</algantag>','')); 216 217 var silinecekler = Ext.getCmp(this.id).getDoc().getElementsByTagName('algantag_sil'); 218 for(var l=0;l< silinecekler.length; l++){ 219 var tag = silinecekler[l]; 220 tag.parentNode.removeChild(tag); 221 } 222 }, 223 224 //silinen veya eklenen tag lerin kabul edilmesi 225 kabulEt:function(){ 226 var win = this.win; 227 var selection = win.getSelection(); 228 var anchorNode = selection.anchorNode; 229 var str = anchorNode.nodeValue; 230 if(str == null || str == '') 231 return; 232 var algan = null; 233 //ekleme yapılmıÅsa tag den önceki ve sonraki algantag leriyle beraber, içlerindeki text alınıp 234 //dıÅındaki tagler siliniyor 235 if((algan = this.alganTagMi(anchorNode)) != null){ 236 var previous = algan.previousElementSibling; 237 while(previous != null && previous.localName == this.algantag){ 238 var prev = previous.previousElementSibling; 239 yeni = document.createTextNode(previous.childNodes[0].nodeValue); 240 previous.parentNode.replaceChild(yeni,previous); 241 previous = prev; 242 } 243 var next = algan.nextElementSibling; 244 yeni = document.createTextNode(str); 245 algan.parentNode.replaceChild(yeni,algan); 246 while(next != null && next.localName == this.algantag){ 247 var next1 = next.nextElementSibling; 248 yeni = document.createTextNode(next.childNodes[0].nodeValue); 249 next.parentNode.replaceChild(yeni,next); 250 next = next1; 251 } 252 }else if(this.alganSilTagMi(anchorNode)){ 253 //silme yapılmıÅsa tag den önceki ve sonraki algantag_sil leriyle beraber, bu node'lar kaldırılıyor 254 while(anchorNode.localName != this.algantag_sil) 255 anchorNode = anchorNode.parentNode; 256 257 var previous = anchorNode.previousElementSibling; 258 while(previous != null && previous.localName == this.algantag_sil){ 259 var prev = previous.previousElementSibling; 260 previous.parentNode.removeChild(previous); 261 previous = prev; 262 } 263 next = anchorNode.nextElementSibling; 264 anchorNode.parentNode.removeChild(anchorNode); 265 while(next != null && next.localName == this.algantag_sil){ 266 var next1 = next.nextElementSibling; 267 next.parentNode.removeChild(next); 268 next = next1; 269 } 270 } 271 }, 272 reddet: function(){ 273 var win = this.win; 274 var selection = win.getSelection(); 275 var anchorNode = selection.anchorNode; 276 var str = anchorNode.nodeValue; 277 if(str == null || str == '') 278 return; 279 var algan = null; 280 if((algan = this.alganTagMi(anchorNode)) != null){ 281 //ekleme yapılan tagler kaldırılıyor 282 var previous = algan.previousElementSibling; 283 while(previous != null && previous.localName == this.algantag){ 284 var prev = previous.previousElementSibling; 285 previous.parentNode.removeChild(previous); 286 previous = prev; 287 } 288 next = algan.nextElementSibling; 289 algan.parentNode.removeChild(algan); 290 while(next != null && next.localName == this.algantag){ 291 var next1 = next.nextElementSibling; 292 next.parentNode.removeChild(next); 293 next = next1; 294 } 295 }else if(this.alganSilTagMi(anchorNode)){
296 //silme yapılan tagler eski haline dönüyor 297 while(anchorNode.localName != this.algantag_sil) 298 anchorNode = anchorNode.parentNode; 299 var previous = anchorNode.previousElementSibling; 300 while(previous != null && previous.localName == this.algantag_sil){ 301 var prev = previous.previousElementSibling; 302 yeni = document.createTextNode(previous.childNodes[0].nodeValue); 303 previous.parentNode.replaceChild(yeni,previous); 304 previous = prev; 305 } 306 var next = anchorNode.nextElementSibling; 307 yeni = document.createTextNode(str); 308 anchorNode.parentNode.replaceChild(yeni,anchorNode); 309 310 while(next != null && next.localName == this.algantag_sil){ 311 var next1 = next.nextElementSibling; 312 yeni = document.createTextNode(next.childNodes[0].nodeValue); 313 next.parentNode.replaceChild(yeni,next); 314 next = next1; 315 } 316 317 } 318 }, 319 aciklamayiSil: function(){ 320 var win = this.win; 321 var selection = win.getSelection(); 322 var anchorNode = selection.anchorNode; 323 var str = anchorNode.nodeValue; 324 if(str == null || str == '') 325 return; 326 if(this.alganBlinkTagMi(anchorNode)){ 327 while(anchorNode.localName != this.algantag_blink) 328 anchorNode = anchorNode.parentNode; 329 anchorNode.win.close(); 330 yeni = document.createTextNode(str); 331 anchorNode.parentNode.replaceChild(yeni,anchorNode); 332 } 333 }, 334 aciklamaEkle2:function(){ 335 var win = this.win; 336 var doc = this.getDoc(); 337 var selection = win.getSelection(); 338 //focusNode seçimin sonu (imlecin bulunduÄu node), anchorNode ise seçimin baÅlangıcı 339 //bu algoritmada ise focusNode seçimin solundaki node, anchorNode ise seçimin saÄındaki node olması lazım 340 //aynı mantıkta offset'ler de düzeltilmeli 341 var focusOffset = selection.focusOffset; 342 var anchorOffset = selection.anchorOffset; 343 var focusNode = selection.focusNode; 344 var anchorNode = selection.anchorNode; 345 if(anchorNode == focusNode){ 346 if(focusOffset > anchorOffset){ 347 var off = focusOffset; 348 focusOffset = anchorOffset; 349 anchorOffset = off; 350 } 351 }else{ 352 if(focusNode.compareDocumentPosition(anchorNode) < anchorNode.compareDocumentPosition(focusNode)){ 353 var off = focusNode; 354 focusNode = anchorNode; 355 anchorNode = off; 356 357 var off = focusOffset; 358 focusOffset = anchorOffset; 359 anchorOffset = off; 360 } 361 anchorNode = focusNode; 362 anchorOffset = focusNode.nodeValue.length; 363 } 364 365 //seçilen aralıÄı algantag_blink içerisine almak 366 var d = doc.createRange(); 367 d.setStart(focusNode,focusOffset); 368 d.setEnd(anchorNode,anchorOffset); 369 370 var p = doc.createElement(this.algantag_blink); 371 p.setAttribute('aciklama',''); 372 p.setAttribute('mouseUstunde',false); 373 p.setAttribute('style','background-color: rgb(255,238,34)'); 374 d.surroundContents(p); 375 this.aciklamaGoster(p); 376 377 //algantag_blink üzerine gelindiÄinde açıklama gözükür 378 Ext.EventManager.on(p, 'mouseover', function(e,node,f){ 379 this.aciklamaGoster(e,node); 380 }, this); 381 }, 382 //bu fonksiyon node'u ve altındaki node'ları gezer algantag_blink ise mouseover olarak aciklamaEkle ekler 383 aciklamaIcinDolas : function(node){ 384 if(node.localName == this.algantag_blink){ 385 node.setAttribute('mouseUstunde',false); 386 Ext.EventManager.on(node, 'mouseover', function(e,node2,f){ 387 this.aciklamaGoster(e,node2); 388 }, this); 389 return ; 390 } 391 for(var l=0; l< node.childNodes.length; l++){ 392 this.aciklamaIcinDolas(node.childNodes[l]); 393 } 394 }, 395 aciklamaGoster : function(e,node){ 396 //node üstüne mouse ile gelindiÄinde çalıÅır 397 //açık olan açıklama varsa kapatılır 398 //bu node'un açıklaması gösterilir 399 if(node.getAttribute('mouseUstunde') == 'true') 400 return; 401 node.setAttribute('mouseUstunde',true); 402 403 for(i=0;i< this.getDoc().getElementsByTagName(this.algantag_blink).length;i++){ 404 var node2=this.getDoc().getElementsByTagName(this.algantag_blink)[i]; 405 if(node2.getAttribute('mouseUstunde') == 'true' && node2 != node){ 406 node2.win.close(); 407 node2.setAttribute('mouseUstunde',false); 408 } 409 } 410 var value1 = node.getAttribute('aciklama'); 411 node.win=new Ext.Window({x:e.xy[0],y:e.xy[1],frame:false,closeAction:'close',layout:'fit',modal:false,plain:false,height:150,width:150,resizable:false,items:[new Ext.FormPanel({items:[{items:[new Ext.form.TextArea({width:145,height:140,id:'aciklama',value:value1, 412 enableKeyEvents:true, 413 listeners:{'keyup':function(c){ node.setAttribute('aciklama',c.getValue());}} 414 })]}]})]}); 415 node.win.show(); 416 Ext.getCmp('aciklama').focus('',20); 417 }, 418 sagMenu : function(e){ 419 //menü çıkacak mı çıkmayacak mı 420 //önce hepsini hide yapıyoruz, sonra teker teker kontrol ediyoruz 421 this.bodyContextMenu.items.itemAt(0).hide(true);//kabul et 422 this.bodyContextMenu.items.itemAt(1).hide(true);//reddet 423 this.bodyContextMenu.items.itemAt(2).hide(true);//açıklama ekle 424 this.bodyContextMenu.items.itemAt(3).hide(true);//açıklamayı sil 425 this.bodyContextMenu.items.itemAt(4).hide(true);//tümünü kabul et 426 this.bodyContextMenu.items.itemAt(5).hide(true);//kaldır 427 428 var that = this; 429 var win = that.win; 430 var selection = win.getSelection(); 431 var anchorNode = selection.anchorNode; 432 var show = false; 433 //eÄer bir alan seçilmiÅse, açıklama ekle butonu gözükür 434 if(this.duzeltme) 435 if(selection.anchorOffset != selection.focusOffset || selection.focusNode != selection.anchorNode){ 436 this.bodyContextMenu.items.itemAt(2).show(true);//açıklama ekle 437 show = true; 438 } 439 //eÄer algantag'in ya da algantag_sil'in üzerinde saÄ düÄmeye basılmıÅsa kabul et ve reddet gözükür 440 if(this.kabul){ 441 if(this.alganTagMi(anchorNode) != null || this.alganSilTagMi(anchorNode)){ 442 this.bodyContextMenu.items.itemAt(0).show(true);//kabul et 443 this.bodyContextMenu.items.itemAt(1).show(true);//reddet 444 show = true; 445 } 446 //eÄer algantag_blink üzerinde ise açıklamayı kaldır gözükür 447 if(this.alganBlinkTagMi(anchorNode)){ 448 this.bodyContextMenu.items.itemAt(3).show(true);//açıklamayı sil 449 show = true; 450 } 451 if(Ext.getCmp(this.id).getValue().indexOf('<algantag style="color: green;">') != -1 || 452 Ext.getCmp(this.id).getValue().indexOf('<algantag_sil style="color: red; text-decoration: line-through;">') != -1){ 453 this.bodyContextMenu.items.itemAt(4).show(true);//tümünü kabul et 454 show = true; 455 } 456 } 457 //hazır form ekranında kırmızı alanların kaldırılması için kullanılıyor 458 if(this.kaldir){ 459 if(this.alganTagMi(anchorNode) != null){ 460 this.bodyContextMenu.items.itemAt(5).show(true);//kaldır 461 show = true; 462 } 463 } 464 if(show){ 465 //menünün nerede gösterileceÄi 466 var f = Ext.getCmp(this.id).getPosition(); 467 this.bodyContextMenu.showAt([f[0]+e.xy[0],f[1]+e.xy[1]]); 468 } 469 }, 470 ekleSil : function(e){
471 this.win.focus(); 472 var doc = this.getDoc(); 473 var win = this.win; 474 475 //https://developer.mozilla.org/en/midas 476 //https://developer.mozilla.org/en/DOM/Selection 477 //https://developer.mozilla.org/en/DOM/range 478 var d = null; 479 var selection = null; 480 var anchorNode = null; 481 if(!Ext.isIE){ 482 d = doc.createRange(); 483 selection = win.getSelection(); 484 anchorNode = selection.anchorNode; 485 } 486 else{ 487 d = doc.selection.createRange(); 488 selection = doc.selection; 489 anchorNode = selection.createRange().parentElement(); 490 } 491 if(e.getKey() == e.BACKSPACE || e.getKey() == e.DELETE){ 492 this.sil(d,selection,anchorNode,e,doc); 493 }else{ 494 if(!Ext.isIE) 495 var str = e.charCode; 496 else 497 var str = e.keyCode; 498 var str2 = str; 499 if(str == 32) 500 str = ' '; 501 else if(e.getKey() == 190){ 502 str = '.'; 503 str2 = '.'; 504 }//190'nın manası . tuÅu 505 else 506 str = String.fromCharCode(str); 507 508 509 //190'nın manası . tuÅu 510 if(str2 != '0'){ 511 if(selection.anchorNode != selection.focusNode || selection.focusOffset != selection.anchorOffset){ 512 this.sil(d,selection,anchorNode,e,doc); 513 } 514 //str = '<algantag><font style="color:green;">'+str+'</font></algantag>'; 515 //190'nın manası . tuÅu 516 if(!e.isSpecialKey() || e.getKey() == 190){ 517 d = doc.createRange(); 518 var focNode = selection.focusNode; 519 var offset = selection.focusOffset; 520 if(this.alganTagMi(focNode) != null){ 521 focNode = this.alganTagMi(focNode).nextSibling; 522 offset = 0; 523 } 524 d.setStart(focNode,offset); 525 d.setEnd(focNode,offset); 526 p = doc.createElement(this.algantag); 527 p.appendChild(document.createTextNode(str)); 528 p.style.color = 'green'; 529 d.insertNode(p); 530 selection.modify('move','forward','character'); 531 e.stopEvent(); 532 } 533 } 534 } 535 }, 536 sil: function(d,selection,anchorNode,e,doc){ 537 var focusOffset = selection.focusOffset;//seçimin bitiÅ noktasındaki node'un offseti 538 var anchorOffset = selection.anchorOffset;//seçimin baÅlangıç noktasındaki node'un offseti 539 if(selection.focusNode == selection.anchorNode){ 540 if(anchorNode.nodeValue == '' || anchorNode.nodeValue == 'undefined' || anchorNode.nodeValue == null){ 541 anchorNode = this.silinmesiGerekenNode(anchorNode,focusOffset,anchorOffset); 542 if(anchorNode == null){ 543 e.stopEvent(); 544 return; 545 } 546 focusOffset = anchorNode.nodeValue.length; 547 anchorOffset = anchorNode.nodeValue.length; 548 } 549 if(focusOffset == 0 && anchorOffset == focusOffset){ 550 e.stopEvent(); 551 return; 552 } 553 if(focusOffset > anchorOffset){ 554 var off = focusOffset; 555 focusOffset = anchorOffset; 556 anchorOffset = off; 557 } 558 var degisecek = anchorNode.data.substr(focusOffset == 0 ? 0 : (focusOffset == anchorOffset?focusOffset - 1 : focusOffset),anch
558orOffset - (focusOffset == 0 ? 0 : (focusOffset == anchorOffset?focusOffset - 1 : focusOffset))); 559 if(degisecek == ''){ 560 e.stopEvent(); 561 return; 562 } 563 d.setStart(anchorNode,focusOffset == 0 ? 0 : (focusOffset == anchorOffset?focusOffset - 1 : focusOffset)); 564 d.setEnd(anchorNode,anchorOffset); 565 var alganNode = this.alganTagMi(anchorNode); 566 if(alganNode != null){ 567 d.deleteContents(); 568 if(anchorNode.nodeValue == ''){ 569 this.silAlganNode(alganNode,anchorNode); 570 } 571 }else if(!this.alganSilTagMi(anchorNode)){ 572 var solNode = anchorNode.previousSibling != null && anchorNode.previousSibling.localName == this.algantag_sil && focusOffset == 1? anchorNode.previousSibling : null; 573 var sagNode = anchorNode.nextSibling != null && anchorNode.nextSibling.localName == this.algantag_sil && focusOffset == anchorNode.data.length? anchorNode.nextSibling : null; 574 //console.log("1"); 575 //console.log(anchorNode.parentNode.childNodes); 576 var f = d.toString(); 577 d.deleteContents(); 578 p = doc.createElement(this.algantag_sil); 579 p.appendChild(document.createTextNode(f)); 580 p.style.color = 'red'; 581 p.style.textDecoration = 'line-through'; 582 d.insertNode(p); 583 //console.log("2"); 584 //console.log(anchorNode.parentNode.childNodes); 585 if(solNode != null && sagNode != null){ 586 p.innerHTML = solNode.innerHTML + f + sagNode.innerHTML; 587 solNode.remove(); 588 sagNode.remove(); 589 }else if(solNode != null || sagNode != null){ 590 if(solNode != null){ 591 p.innerHTML = solNode.innerHTML + f; 592 p.previousSibling.remove(); 593 solNode.remove(); 594 //console.log("3"); 595 //console.log(solNode.parentNode.childNodes); 596 } 597 else{ 598 p.innerHTML = f + sagNode.innerHTML; 599 sagNode.remove(); 600 p.nextSibling.remove(); 601 } 602 } 603 } 604 }else{//focusNode ile anchorNode birbirine eÅit deÄil 605 this.ikiNodeArasındakileriEleAl(selection.focusNode,anchorNode,doc); 606 //focus node sil 607 d = doc.createRange(); 608 d.setStart(selection.focusNode,focusOffset); 609 d.setEnd(selection.focusNode,selection.focusNode.nodeValue.length); 610 if(d.toString() != ''){ 611 var alganNode = this.alganTagMi(selection.focusNode); 612 if(alganNode != null){ 613 d.deleteContents(); 614 if(anchorNode.nodeValue == ''){ 615 this.silAlganNode(alganNode,anchorNode); 616 } 617 }else if(!this.alganSilTagMi(anchorNode)){ 618 var f = d.toString(); 619 d.deleteContents(); 620 p = doc.createElement(this.algantag_sil); 621 p.appendChild(document.createTextNode(f)); 622 p.style.color = 'red'; 623 p.style.textDecoration = 'line-through'; 624 d.insertNode(p); 625 } 626 } 627 //anchorNode u sil 628 d = doc.createRange(); 629 d.setStart(anchorNode,0); 630 d.setEnd(anchorNode,anchorOffset); 631 if(d.toString() != ''){ 632 var alganNode = this.alganTagMi(selection.anchorNode); 633 if(alganNode != null){ 634 d.deleteContents(); 635 if(anchorNode.nodeValue == ''){ 636 this.silAlganNode(alganNode,anchorNode); 637 } 638 }else if(!this.alganSilTagMi(anchorNode)){//silinmiÅi bir kez daha silemezsin 639 var f = d.toString(); 640 d.deleteContents(); 641 p = doc.createElement(this.algantag_sil); 642 p.appendChild(document.createTextNode(f)); 643 p.style.color = 'red'; 644 p.style.textDecoration = 'line-through'; 645 d.insertNode(p); 646 } 647 } 648 } 649 e.stopEvent(); 650 }, 651 652 //buraya verisi boÅ olan node geliyor, ama çocukları olabilir 653 silinmesiGerekenNode : function(anchorNode,focusOffset,anchorOffset){ 654 if(focusOffset != -1){ 655 if(anchorNode.childNodes.length != 0){ 656 anchorNode = this.silinmesiGerekenNode2(anchorNode,focusOffset,anchorOffset); 657 if(anchorNode == null || anchorNode.nodeValue != '') 658 return anchorNode; 659 } 660 } 661 var par = anchorNode.parentNode; 662 if(par == null) 663 return null; 664 var before = null; 665 for(var l=0; l< par.childNodes.length; l++){ 666 if(par.childNodes[l] == anchorNode){ 667 par.removeChild(anchorNode); 668 break; 669 } 670 before = par.childNodes[l]; 671 } 672 if(before == null && (par.nodeValue == '' || par.nodeValue == 'undefined')) 673 return this.silinmesiGerekenNode(par,-1,-1); 674 if(before == null) 675 return before; 676 while(before.nodeValue == null && before.lastChild != null) 677 before = before.lastChild; 678 return before; 679 }, 680 //çocukları olan node geliyor 681 silinmesiGerekenNode2 : function(anchorNode,focusOffset,anchorOffset){ 682 var ret = null; 683 for(var l=0; l< anchorNode.childNodes.length; l++){ 684 if(focusOffset == l+1){ 685 ret = anchorNode.childNodes[l]; 686 break; 687 } 688 } 689 if(ret == null) 690 return null; 691 while(ret.nodeValue == null && ret.firstChild != null) 692 ret = ret.firstChild; 693 return ret; 694 }, 695 alganTagMi : function(anchorNode){ 696 if(anchorNode == null) 697 return null; 698 if(anchorNode.localName == this.algantag) 699 return anchorNode; 700 return this.alganTagMi(anchorNode.parentNode); 701 }, 702 alganSilTagMi : function(anchorNode){ 703 if(anchorNode == null) 704 return false; 705 if(anchorNode.localName == this.algantag_sil) 706 return true; 707 return this.alganSilTagMi(anchorNode.parentNode); 708 }, 709 alganBlinkTagMi : function(anchorNode){ 710 if(anchorNode == null) 711 return false; 712 if(anchorNode.localName == this.algantag_blink) 713 return true; 714 return this.alganBlinkTagMi(anchorNode.parentNode); 715 }, 716 silAlganNode : function(alganNode,anchorNode){ 717 if(anchorNode == alganNode){ 718 if(alganNode.nodeValue == '' || alganNode.nodeValue == null) 719 alganNode.parentNode.removeChild(anchorNode); 720 return; 721 } 722 var par = anchorNode.parentNode; 723 par.removeChild(anchorNode); 724 this.silAlganNode(alganNode,par); 725 }, 726 ikiNodeArasındakileriEleAl : function(focusNode,anchorNode,doc){ 727 var par = anchorNode.parentNode; 728 var focusBulundu = false; 729 var anchorBulundu = false; 730 for(var l=par.childNodes.length-1; l>=0; l--){ 731 if(anchorBulundu && !focusBulundu){ 732 if(par.childNodes[l] == focusNode){ 733 focusBulundu = true; 734 break; 735 } 736 focusBulundu = this.nodelariSil(par.childNodes[l],focusNode,par.childNodes[l].localName == this.algantag,doc); 737 if(focusBulundu) 738 break; 739 if((par.childNodes[l].nodeValue == null || par.childNodes[l].nodeValue == '') && par.childNodes[l].childNodes.length == 0){ 740 par.removeChild(par.childNodes[l]); 741 } 742 }else if(par.childNodes[l] == anchorNode){ 743 anchorBulundu = true; 744 } 745 } 746 if(!focusBulundu){ 747 this.ikiNodeArasındakileriEleAl(focusNode,par,doc); 748 } 749 }, 750 nodelariSil : function(currentNode,focusNode,algantagMi,doc){ 751 for(var l=currentNode.childNodes.length-1;l>0; l--){ 752 if(currentNode.childNodes[l] == focusNode) 753 return true; 754 if((currentNode.childNodes[l].nodeValue == null || currentNode.childNodes[l].nodeValue == '') && currentNode.childNodes[l].childNodes.length == 0){ 755 if(this.icindeFocusVarMi(currentNode.childNodes[l],focusNode)) 756 return true; 757 currentNode.removeChild(currentNode.childNodes[l]); 758 }else if(algantagMi || currentNode.childNodes[l].localName == this.algantag){ 759 if(this.icindeFocusVarMi(currentNode.childNodes[l],focusNode)) 760 return true; 761 currentNode.removeChild(currentNode.childNodes[l]); 762 }else if(currentNode.childNodes[l].localName == this.algantag_sil){ 763 764 }else{ 765 if(currentNode.childNodes[l].nodeValue != null || currentNode.childNodes[l].nodeValue != ''){ 766 d = doc.createRange(); 767 d.setStart(currentNode.childNodes[l],0); 768 d.setEnd(currentNode.childNodes[l],currentNode.childNodes[l].nodeValue.length); 769 var f = d.toString(); 770 d.deleteContents(); 771 p = doc.createElement(this.algantag_sil); 772 p.appendChild(document.createTextNode(f)); 773 p.style.color = 'red'; 774 p.style.textDecoration = 'line-through'; 775 d.insertNode(p); 776 } 777 if(currentNode.childNodes[l].childNodes.length > 0){ 778 focusBulundu = this.nodelariSil(currentNode.childNodes[l],focusNode,false,doc); 779 if(focusBulundu) 780 return true; 781 } 782 } 783 }//for 784 if((currentNode.nodeValue == null || currentNode.nodeValue == '') && currentNode.childNodes.length == 0){ 785 if(this.icindeFocusVarMi(currentNode,focusNode)) 786 return true; 787 currentNode.parentNode.removeChild(currentNode); 788 }else if(algantagMi || currentNode.localName == this.algantag){ 789 if(this.icindeFocusVarMi(currentNode,focusNode)) 790 return true; 791 currentNode.parentNode.removeChild(currentNode); 792 }else if(currentNode.localName == this.algantag_sil){ 793 794 }else{ 795 if(currentNode.nodeValue != null && currentNode.nodeValue != ''){ 796 d = doc.createRange(); 797 d.setStart(currentNode,0); 798 d.setEnd(currentNode,currentNode.nodeValue.length); 799 var f = d.toString(); 800 d.deleteContents(); 801 p = doc.createElement(this.algantag_sil); 802 p.appendChild(document.createTextNode(f)); 803 p.style.color = 'red'; 804 p.style.textDecoration = 'line-through'; 805 d.insertNode(p); 806 } 807 } 808 return false; 809 }, 810 icindeFocusVarMi : function(currentNode,focusNode){ 811 if(currentNode == focusNode) 812 return true; 813 for(var l=0;l< currentNode.childNodes.length;l++){ 814 if(this.icindeFocusVarMi(currentNode.childNodes[l],focusNode)) 815 return true; 816 } 817 return false; 818 } 819});
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.