Difference between revisions of "Template:Team:Judd UK/TEMPLATE"

Line 13: Line 13:
 
     <script src="/Template:Judd_UK/pagelist?action=raw&ctype=text/javascript" async></script>
 
     <script src="/Template:Judd_UK/pagelist?action=raw&ctype=text/javascript" async></script>
 
     <link rel="stylesheet" href="/Template:Judd_UK/Stylesheets/main?action=raw&ctype=text/css">
 
     <link rel="stylesheet" href="/Template:Judd_UK/Stylesheets/main?action=raw&ctype=text/css">
     <script src="/Template:Judd_UK/Scripts/wiki?action=raw&ctype=text/javascript" async></script>
+
     <script src="/Template:Judd_UK/Scripts/wiki?action=raw&ctype=text/javascript" defer></script>
 
<script src="/Template:Judd_UK/Scripts/BSS?action=raw&ctype=text/javascript" defer></script>
 
<script src="/Template:Judd_UK/Scripts/BSS?action=raw&ctype=text/javascript" defer></script>
 
<link rel="stylesheet" href="/Template:Judd_UK/Stylesheets/BSS?action=raw&ctype=text/css">
 
<link rel="stylesheet" href="/Template:Judd_UK/Stylesheets/BSS?action=raw&ctype=text/css">
Line 60: Line 60:
 
     qs(".JC #content-body").contentEditable = 'true';
 
     qs(".JC #content-body").contentEditable = 'true';
 
     qs(".JC #content-body").oninput = function(){
 
     qs(".JC #content-body").oninput = function(){
         qs('textarea').value = "<div>" + qs('.JC #content-body').innerHTML+"<\/div><html><script>window.location='/Team:Judd_UK/" + page.replace("*", "/") + "'<\/script><\/html>";
+
         qs('textarea').value = "<div" + (qs("#content-index").style.display=="none"?"data-wiki='false' data-templated='false'":"")+">" + qs('.JC #content-body').innerHTML+"<\/div><html><script>window.location='/Team:Judd_UK/" + page.replace("*", "/") + "'<\/script><\/html>";
        qsa("img").forEach(function(e){e.oncontextmenu = function(o){o.target.classList.toggle("left");o.preventDefault()}});
+
    };
+
    qs("textarea").oninput = function(){
+
        qs('.JC #content-body').innerHTML = qs('textarea').value;
+
 
         qsa("img").forEach(function(e){e.oncontextmenu = function(o){o.target.classList.toggle("left");o.preventDefault()}});
 
         qsa("img").forEach(function(e){e.oncontextmenu = function(o){o.target.classList.toggle("left");o.preventDefault()}});
 
     };
 
     };
Line 70: Line 66:
 
     AJAX('https://2017.igem.org/Team:Judd_UK/Pages/' + safety +'?action=edit', function(e){
 
     AJAX('https://2017.igem.org/Team:Judd_UK/Pages/' + safety +'?action=edit', function(e){
 
         qs('#ting').innerHTML=e.responseText;
 
         qs('#ting').innerHTML=e.responseText;
         qs('textarea').style.display = "none";
+
         qs('textarea').rows = "10";
 
         qs('#wpSummary').style.display = "none";
 
         qs('#wpSummary').style.display = "none";
 
         qs('.editCheckboxes').style.display = "none";
 
         qs('.editCheckboxes').style.display = "none";
Line 79: Line 75:
 
         qs('.editHelp').style.display = "none";
 
         qs('.editHelp').style.display = "none";
 
         qsa("label")[1].innerHTML="Editing " + safety;
 
         qsa("label")[1].innerHTML="Editing " + safety;
 +
        qs("textarea").oninput = function(){
 +
            qs('.JC #content-body').innerHTML = qs('textarea').value;
 +
            qsa("img").forEach(function(e){e.oncontextmenu = function(o){o.target.classList.toggle("left");o.preventDefault()}});
 +
        };
 
     })
 
     })
 
     }
 
     }

Revision as of 14:29, 13 December 2017

Contents