Ajout d'un premier jet d'éditeur Js de LightScript
This commit is contained in:
parent
4e4508c4fd
commit
da96de2f14
|
@ -50,59 +50,3 @@ function flash_close(element) {
|
|||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
Send post ajax request to url defined in action.
|
||||
Callback the function defined in the callback attribute from the submit type.
|
||||
*/
|
||||
/* We don't need Ajax at that time. Maybe later
|
||||
function ajaxWrapper(evt){
|
||||
evt.preventDefault();
|
||||
var elems = evt.target;
|
||||
var params = "";
|
||||
// do not embed submit value (-1)
|
||||
for(i = 0; i < elems.length-1; i++){
|
||||
if(params) params += "&";
|
||||
params += encodeURIComponent(elems[i].name)+"="+encodeURIComponent(elems[i].value);
|
||||
}
|
||||
const req = new XMLHttpRequest();
|
||||
req.open("POST", evt.target.action, true);
|
||||
req.setRequestHeader('Content-Type',"application/x-www-form-urlencoded");
|
||||
req.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
req.onreadystatechange = function(){
|
||||
if(req.readyState == 4 && (req.status == 200 || req.status == 0)){
|
||||
var fn = window[elems[elems.length-1].getAttribute("callback")];
|
||||
if(typeof fn == 'function'){
|
||||
fn(req.responseText);
|
||||
}
|
||||
}
|
||||
}
|
||||
req.send(params);
|
||||
}
|
||||
|
||||
// Add event listener on submit for all form with class with-ajax.
|
||||
|
||||
window.onload = function(){
|
||||
|
||||
var ele;
|
||||
var elems = document.getElementsByClassName('with-ajax');
|
||||
for(i = 0; i < elems.length; i++){
|
||||
ele = elems[i];
|
||||
if(ele.addEventListener){ // Normal people
|
||||
ele.addEventListener("submit", ajaxWrapper, false);
|
||||
}else if(ele.attachEvent){ // Retarded user using IE
|
||||
ele.attachEvent("onsubmit", ajaxWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
if(getCookie('pc_notif') == 'true')
|
||||
document.getElementsByClassName('alert')[0].parentNode.removeChild(document.getElementsByClassName('alert')[0]);
|
||||
if(getCookie('pc_notif_2') == 'true')
|
||||
document.getElementsByClassName('alert')[0].parentNode.removeChild(document.getElementsByClassName('alert')[0]);
|
||||
|
||||
}
|
||||
|
||||
function login(response){
|
||||
alert(response);
|
||||
}
|
||||
//*/
|
|
@ -1,3 +1,3 @@
|
|||
<script type="text/javascript" src={{url_for('static', filename = 'scripts/trigger_menu.js')}}></script>
|
||||
<script type="text/javascript" src={{url_for('static', filename = 'scripts/smartphone_patch.js')}}></script>
|
||||
<script type="text/javascript" src={{url_for('static', filename = 'scripts/pc-utils.js')}}></script>
|
||||
{% for s in scripts %}
|
||||
<script type="text/javascript" src={{url_for('static', filename=s)}}></script>
|
||||
{% endfor %}
|
||||
|
|
|
@ -2,23 +2,23 @@
|
|||
<div class="editor">
|
||||
{{ field.label if label }}
|
||||
<div class="buttons">
|
||||
<button type="button" title="Gras"><img src="{{ url_for('static', filename = 'icons/editor/format-bold.svg') }}" alt="Gras" /></button>
|
||||
<button type="button" title="Italique"><img src="{{ url_for('static', filename = 'icons/editor/format-italic.svg') }}" alt="Italique" /></button>
|
||||
<button type="button" title="Souligné"><img src="{{ url_for('static', filename = 'icons/editor/format-underline.svg') }}" alt="Souligné" /></button>
|
||||
<button type="button" title="Barré"><img src="{{ url_for('static', filename = 'icons/editor/format-strikethrough.svg') }}" alt="Barré" /></button>
|
||||
<button type="button" title="Gras" onclick="edit(this, 'bold')"><img src="{{ url_for('static', filename = 'icons/editor/format-bold.svg') }}" alt="Gras" /></button>
|
||||
<button type="button" title="Italique" onclick="edit(this, 'italic')"><img src="{{ url_for('static', filename = 'icons/editor/format-italic.svg') }}" alt="Italique" /></button>
|
||||
<button type="button" title="Souligné" onclick="edit(this, 'underline')"><img src="{{ url_for('static', filename = 'icons/editor/format-underline.svg') }}" alt="Souligné" /></button>
|
||||
<button type="button" title="Barré" onclick="edit(this, 'strikethrough')"><img src="{{ url_for('static', filename = 'icons/editor/format-strikethrough.svg') }}" alt="Barré" /></button>
|
||||
|
||||
<button type="button" title="Titre 1"><img src="{{ url_for('static', filename = 'icons/editor/format-header-1.svg') }}" alt="Titre 1" /></button>
|
||||
<button type="button" title="Titre 2"><img src="{{ url_for('static', filename = 'icons/editor/format-header-2.svg') }}" alt="Titre 2" /></button>
|
||||
<button type="button" title="Titre 3"><img src="{{ url_for('static', filename = 'icons/editor/format-header-3.svg') }}" alt="Titre 3" /></button>
|
||||
<button type="button" title="Titre 1" onclick="edit(this, 'h1')"><img src="{{ url_for('static', filename = 'icons/editor/format-header-1.svg') }}" alt="Titre 1" /></button>
|
||||
<button type="button" title="Titre 2" onclick="edit(this, 'h2')"><img src="{{ url_for('static', filename = 'icons/editor/format-header-2.svg') }}" alt="Titre 2" /></button>
|
||||
<button type="button" title="Titre 3" onclick="edit(this, 'h3')"><img src="{{ url_for('static', filename = 'icons/editor/format-header-3.svg') }}" alt="Titre 3" /></button>
|
||||
|
||||
<button type="button" title="Liste à puces"><img src="{{ url_for('static', filename = 'icons/editor/format-list-bulleted.svg') }}" alt="Liste à puces" /></button>
|
||||
<button type="button" title="Liste numérotée"><img src="{{ url_for('static', filename = 'icons/editor/format-list-numbered.svg') }}" alt="Liste numérotée" /></button>
|
||||
<button type="button" title="Liste à puces" onclick="edit(this, 'list-bulleted')"><img src="{{ url_for('static', filename = 'icons/editor/format-list-bulleted.svg') }}" alt="Liste à puces" /></button>
|
||||
<button type="button" title="Liste numérotée" onclick="edit(this, 'list-numbered')"><img src="{{ url_for('static', filename = 'icons/editor/format-list-numbered.svg') }}" alt="Liste numérotée" /></button>
|
||||
|
||||
<button type="button" title="Citation"><img src="{{ url_for('static', filename = 'icons/editor/format-quote-close.svg') }}" alt="Citation" /></button>
|
||||
<button type="button" title="Code"><img src="{{ url_for('static', filename = 'icons/editor/code-braces.svg') }}" alt="Code" /></button>
|
||||
<button type="button" title="Spoiler"><img src="{{ url_for('static', filename = 'icons/editor/comment-alert-outline.svg') }}" alt="Spoiler" /></button>
|
||||
<button type="button" title="Citation" onclick="edit(this, 'quote')"><img src="{{ url_for('static', filename = 'icons/editor/format-quote-close.svg') }}" alt="Citation" /></button>
|
||||
<button type="button" title="Code" onclick="edit(this, 'code')"><img src="{{ url_for('static', filename = 'icons/editor/code-braces.svg') }}" alt="Code" /></button>
|
||||
<button type="button" title="Spoiler" onclick="edit(this, 'spoiler')"><img src="{{ url_for('static', filename = 'icons/editor/comment-alert-outline.svg') }}" alt="Spoiler" /></button>
|
||||
|
||||
<button type="button" title="Lien"><img src="{{ url_for('static', filename = 'icons/editor/link-variant.svg') }}" alt="Lien" /></button>
|
||||
<button type="button" title="Lien" onclick="edit(this, 'link')"><img src="{{ url_for('static', filename = 'icons/editor/link-variant.svg') }}" alt="Lien" /></button>
|
||||
</div>
|
||||
{{ field() }}
|
||||
{% for error in field.errors %}
|
||||
|
|
|
@ -23,10 +23,13 @@ def render(*args, styles=[], scripts=[], **kwargs):
|
|||
'css/footer.css',
|
||||
'css/flash.css',
|
||||
'css/responsive.css',
|
||||
'css/table.css'
|
||||
'css/table.css',
|
||||
]
|
||||
scripts_ = [
|
||||
|
||||
'scripts/trigger_menu.js',
|
||||
'scripts/pc-utils.js',
|
||||
'scripts/smartphone_patch.js',
|
||||
'scripts/editor.js',
|
||||
]
|
||||
|
||||
for s in styles:
|
||||
|
|
Loading…
Reference in New Issue