var editor,memory; /* // Uncomment the following code to test the "Timeout Loading Method". // CKEDITOR.loadFullCoreTimeout = 5; window.onload = function() { // Listen to the double click event. if ( window.addEventListener ) document.body.addEventListener( 'dblclick', onDoubleClick, false ); else if ( window.attachEvent ) document.body.attachEvent( 'ondblclick', onDoubleClick ); }; function onDoubleClick( ev ) { // Get the element which fired the event. This is not necessarily the // element to which the event has been attached. var element = ev.target || ev.srcElement; // Find out the div that holds this element. var name; do { element = element.parentNode; } while ( element && ( name = element.nodeName.toLowerCase() ) && ( name != 'div' || element.className.indexOf( 'editable' ) == -1 ) && name != 'body' ); alert(name); if ( name == 'div' && element.className.indexOf( 'editable' ) != -1 ) replaceDiv( element ); else{ replaceDiv(document.getElementById('inlineFrame Example')); } } */ function replaceDiv( div,num ) { myApp.line=63;try{ var tagfct='replaceDiv( div,num )'; var img,imgsave,imgfull,imgnormal,iddivsommaire="iddivsommaire"+num; alert("ljs:64 "+chrrc+div.id+chrrc+iddivsommaire); if(div.id===iddivsommaire){ myApp.line=70; img=document.getElementById('idimgckesomer'+num); imgsave=document.getElementById('idimgckesavesomer'+num); } else{ myApp.line=75; img=document.getElementById('idimgcke'+num); imgsave=document.getElementById('idimgckesave'+num); imgnormal=document.getElementById("idimgckedownscreen."+num); imgfull=document.getElementById("idimgckefullscreen."+num); } if( editor ){ img.style.border=""; imgsave.style.display="none"; editor.destroy(); editor=null; myApp.line=87; if(div.id===iddivsommaire){ div.innerHTML=memory; } if(imgnormal) imgnormal.style.display="none"; if(imgfull) imgfull.style.display="none"; return(true); } myApp.line=96; img.style.border="solid 2px red"; imgsave.style.display="inline"; memory=div.innerHTML; myApp.line=100; if(imgnormal) imgnormal.style.display="none"; myApp.line=102; if(imgfull) imgfull.style.display="inline"; editor = CKEDITOR.replace( div, { uiColor: '#14B8C4', height: 400, ///balloon /* pas de plugin linkballoon extraAllowedContent: 'div', extraPlugins: 'balloontoolbar,linkballoon,image2', //* // on: { // instanceReady: function(evt) { // ///var editor = evt.editor; // // // Register custom context for image widgets on the fly. // editor.balloonToolbars.create({ // buttons: 'Link,Unlink,Image', // widgets: 'image' // }); // } // }, // * / // Toolbar adjustments to simplify the editor. toolbar: [{ name: 'document', items: ['Source', '-', 'Undo', 'Redo'] }, { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', '-', 'RemoveFormat'] }, { name: 'links', items: ['Link', 'Unlink', 'Anchor'] }, { name: 'insert', items: ['Image', 'Format'] }, { name: 'tools', items: ['Maximize', 'ShowBlocks', 'About'] } ], // Load the default contents.css file plus customizations for this sample. contentsCss: [ 'http://cdn.ckeditor.com/4.16.0/full-all/contents.css', 'https://ckeditor.com/docs/ckeditor4/4.16.0/examples/assets/css/widgetstyles.css' ], // Configure the Enhanced Image plugin to use classes instead of styles and to disable the // resizer (because image size is controlled by widget styles or the image takes maximum // 100% of the editor width). image2_alignClasses: ['image-align-left', 'image-align-center', 'image-align-right'], image2_disableResizer: true, */ //balloon on: { instanceReady: function(evt) { // Output self-closing tags the HTML4 way, like
. this.dataProcessor.writer.selfClosingEnd = '>'; // Use line breaks for block elements, tables, and lists. var dtd = CKEDITOR.dtd; for (var e in CKEDITOR.tools.extend({}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent)) { this.dataProcessor.writer.setRules(e, { indent: true, breakBeforeOpen: true, breakAfterOpen: true, breakBeforeClose: true, breakAfterClose: true }); } } }, // Define the toolbar groups as it is a more accessible solution. toolbarGroups: [{ "name": "basicstyles", "groups": ["basicstyles"] }, { "name": "links", "groups": ["links"] }, { "name": "paragraph", "groups": ["list", "blocks"] }, { "name": "document", "groups": ["mode"] }, { "name": "insert", "groups": ["insert"] }, { "name": "styles", "groups": ["styles"] }, { "name": "about", "groups": ["about"] } ], // Remove the redundant buttons from toolbar groups defined above. removeButtons: 'Underline,Strike,Subscript,Superscript,Anchor,Styles,Specialchar' } ); ///alert(editor.style.height); myApp.line=222; if(div.id===iddivsommaire){ ///editor.setData("toto"); /// save_load_file("loadpart","sommaire",1); save_load_file("loadpart","sommaire",num); } }catch(e){if($.isFunction(window.dbgvec))alert(e+chrrc+tagfct+chrrc+'line:'+myApp.line);} } /* editor.on('instanceReady', function() { // Output self-closing tags the HTML4 way, like
. this.dataProcessor.writer.selfClosingEnd = '>'; // Use line breaks for block elements, tables, and lists. var dtd = CKEDITOR.dtd; for (var e in CKEDITOR.tools.extend({}, dtd.$nonBodyContent, dtd.$block, dtd.$listItem, dtd.$tableContent)) { this.dataProcessor.writer.setRules(e, { indent: true, breakBeforeOpen: true, breakAfterOpen: true, breakBeforeClose: true, breakAfterClose: true }); } // Start in source mode. this.setMode('source'); / * // Register custom context for image widgets on the fly. editor.balloonToolbars.create({ buttons: 'Link,Unlink,Image', widgets: 'image' }); * / }); */ function change_page(that,num){ alert("ljs:308 "+that.getAttribute("data-enum")+" - "+that.innerHTML); document.getElementById('idtitleSommaire'+num).innerHTML=that.innerHTML; document.getElementById('idsommaireHidden'+num).value=that.getAttribute("data-enum"); var file=document.getElementById('idfileTextName'+num).value; ////completeurl = '/res/scripts/php/ajax/ajax_texte.php?data='+that.getAttribute("data-enum")+'&file='+file; ///$ i_onclick='fileSelected(this, \''.$ relname.'\');'; // code for Mozilla, etc. var xhr=getXMLHttpRequest(); xhr.onreadystatechange=function(){ var arr=checkXMLHttpRequest(xhr); alert("ljs:253 "+arr[0]+chrrc+xhr.responseText); if(arr[0]){ ///return(true); } }; var formDatas=new FormData(); formDatas.append('file',file); formDatas.append('data',that.getAttribute("data-enum")); sendXMLHttpRequest(xhr,"POST",null,cst['DocumentRoot']+"/res/scripts/php/ajax/ajax_texte.php",formDatas,action); /* var mode=false; if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); xmlhttp.onreadystatechange=function(){ ///var arr=checkXMLHttpRequest(xhr); if(xmlhttp.responseText!=="") alert("ljs:106 "+xmlhttp.responseText); }; xmlhttp.open("POST",completeurl,mode); xmlhttp.send(formDatas); } // code for IE else if (window.ActiveXObject) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP") if (xmlhttp) { xmlhttp.onreadystatechange=function(){ ///var arr=checkXMLHttpRequest(xhr); if(xmlhttp.responseText!=="") alert("ljs:121 "+xmlhttp.responseText); }; xmlhttp.open("POST",completeurl,mode); xmlhttp.send(formDatas); } } */ } function save_load_file(action,part,num) { myApp.line=324;try{ var tagfct='save_load_file(action,part,num)'; // action=savepart var o,file,index,title,content,xhr,arr,formDatas; ///file=document.getElementById('idfileTextName'+(num-1)).value; file=document.getElementById('idfileTextName'+num).value; /////alert("ljs:308 part="+part+chrrc+"num="+num+chrrc+"file="+file); index=document.getElementById('idsommaireHidden'+num).value; o=document.getElementById('idtitleSommaire'+num); if(o)title=o.innerHTML; content=editor.getData(); myApp.line=336; xhr=getXMLHttpRequest(); xhr.onreadystatechange=function(){ arr=checkXMLHttpRequest(xhr); alert("ljs:313 "+arr[0]+chrrc+xhr.responseText); if(arr[0]){ switch(action){ case "savepart": alert("ljs:310 "+chrrc+file+chrrc+index+chrrc+title+chrrc+content);// CKEDITOR.instances. return(false); /// break; case "loadpart": arr[2]=arr[2].replace(",",",
"); editor.setData(arr[2]); break; } } }; formDatas=new FormData(); formDatas.append('file',file); formDatas.append('part',part); formDatas.append('index',index); formDatas.append('title',title); formDatas.append('content',content); sendXMLHttpRequest(xhr,"POST",null,cst['DocumentRoot']+"/res/scripts/php/ajax/ajax_texte.php",formDatas,action); }catch(e){if($.isFunction(window.dbgvec))alert(e+chrrc+tagfct+chrrc+'line:'+myApp.line);} } /* function selectEscapeKey(that) { // focus on the input element that.focus(); that.dispatchEvent(new KeyboardEvent("keypress", {"key":"ESC"})); // add event listeners to the input element that.addEventListener("keypress", (event) => { alert(""+event.key); console.log("You have pressed key: ", event.key); }); ///return browser.actions().sendKeys(protractor.Key.ESCAPE).perform(); } */ function selectEscapeKey(that,num) {///el) { // focus on the input element that.focus(); that.dispatchEvent(new KeyboardEvent("keypress", {"key":"ESC"}));//event.key=ESC // add event listeners to the input element that.addEventListener("keypress", (event) => { ///alert(""+event.key); ///console.log("You have pressed key: ", event.key); }); var imgscreenFull,imgscreen; imgscreenFull=document.getElementById('idimgckefullscreen'+num).style.display="inline"; imgscreen=document.getElementById('imgscreen').style.display="none"; /* /// var requestMethod = el.cancelFullScreen||el.webkitCancelFullScreen||el.mozCancelFullScreen||el.exitFullscreen; var requestMethod = el.cancelFullScreen||el.webkitExitFullscreen||el.mozCancelFullScreen||el.exitFullscreen; if (requestMethod) { // cancel full screen. requestMethod.call(el); } else if (typeof window.ActiveXObject !== "undefined") { // Older IE. var wscript = new ActiveXObject("WScript.Shell"); if (wscript !== null) { wscript.SendKeys("{F11}"); } } */ } ///var elem = document.body; // Make the body go full screen. ///requestFullScreen(elem); function change_menu(that,num){ var href=that.getAttribute("data-href"); var num=that.getAttribute("data-sommaire");//c sommaire=num var file=document.getElementById('idfilePage0').value; ///idfileTextName alert("ljs:389 "+chrrc+href+chrrc+num+chrrc+file); /* var sommaire=that.getAttribute("data-sommaire"); var sHidden=document.getElementById('idsommaireHidden'+num).value; document.getElementById(sHidden).style.display="none"; document.getElementById(sommaire).style.display="block"; document.getElementById('idsommaireHidden'+num).value=sommaire; */ //if(num>0)document.getElementById('horizv2.'+num).innerHTML=file; onglet // achange_menu_config(this); data-href="iddivheader" }