anchor.diff:        if (md.indexOf("|----")>= 0) {
           f.wrap = 'off';
           f.style.fontFamily="monospace"
  -        }
  +      }
         else {
           f.wrap = 'soft';
           f.style.fontFamily = cl.style.fontFamily;
   
  -        }
  -    }
  -
  -    function onchangeFunction(lang) {
  -      var l = lang;
  -      return function() {
  -        onchangeMarkdown("markdown"+l,"preview"+l,"text"+l);
  -      }
  -    }
  -
  -
  +      }
  +    }
  +
  +
  +    function onchangeLEFT() {
  +      onchangeMarkdown("markdownLEFT","previewLEFT","text_left");
  +    }
  +    function onchangeRIGHT() {
  +      onchangeMarkdown("markdownRIGHT", "previewRIGHT", "text_right");
  +    }
       function onchangeMarkdown(mdid,previewid,textid) {
         var md = document.getElementById(mdid).value;
         preview = document.getElementById(previewid);
  -
         text = document.getElementById(textid);
   
   
         checkForTable(mdid);
         FitToContent(mdid);
  -
   
         preview.innerHTML = convert(md);
         var errorOccured= false;
  
positive.code:             button.btn.btn-large.btn-default(type = "button" onclick ="window.onbeforeunload=null; location.href='#{layout.htmlroot}/article/#{article.id}';") Cancel
  
    #doublettes.row
        if articleReferences.count >= 1
          h3
            |Links used in other Post
          div
            table.table.table-striped.table-responsive
              thead
                tr
                  th
                    |link
                  th
                    |article
                  th
                    |Blog
              tbody
                each array,link in articleReferences
                  if (link != "count" )
                    each articleItem,index in array
                      if (articleItem.id != article.id) && (index <5)
                        tr
                          td
                            a(href='#{link}') #{link.substring(0,80)+((link.length>80)?" ....":"")}
                          td
                            a(href='#{layout.htmlroot}/article/'+articleItem.id) #{articleItem.displayTitle()}
                          td= articleItem.blog
                      if (index == 8) 
                        tr
                          td
                            a(href='#{link}') #{link}
                          td
                            |Und #{array.length-5} weitere Artikel.
                  
  
  
      .row.visible-xs
        p
          br
          a(href="#{layout.htmlroot}/changes/log?table=article&oid=#{article.id}") [changes]
      .row.hidden-xs
        if changes
          h3
            |History
          div
            table.table.table-striped.table-responsive
              thead
                tr 
                  th
                   | 
                  th
                   |user
                  th
                   |what
                  th
                   |change
                  th
                   |when
               tbody
                each change, i in changes
                  tr
                    td
                     a(href='#{layout.htmlroot}/changes/' + change.id) 
                        span.glyphicon.glyphicon-info-sign 
                    td= change.user
                    td= change.property
                    td
                      :verbatim
                        !{change.htmlDiffText(100)}
                    td= layout.moment(change.timestamp).fromNow() 
          div
            p
              |only displaying changes 
              span.osmbc-inserted
                |inserted text 
              span.osmbc-deleted
                |removed text
  
  
  block scripts                
    script(src=layout.path("markdown-it")+'/markdown-it.min.js')
  
  
  
negative.code:         text.innerHTML = "<p>Please shorten ["+md.substring(longLink+1,longLink+40)+"...]</p>"
          text.style.backgroundColor ="#FDC6CD";
          errorOccured = true
        }
        // check wether links used are in collection
  
        if (!errorOccured) {
          //preview.style.backgroundColor="";
          text.style.backgroundColor ="";
          text.innerHTML = noTranslationText;
        }
  
  
      }
  
      function generateGoogleTranslateLink(link,lang) {
        var googlelang = lang;
        if (lang === "JP") googlelang = "JA";
        var gtl = "https://translate.google.com/translate?sl=auto&tl="+googlelang+"&u="+link;
  
  
        var gtlMarkdown = "(automatic [translation](##link##))";
        if (googleTranslateText[lang]) gtlMarkdown = googleTranslateText[lang];
  
  
        gtlMarkdown = gtlMarkdown.replace("##link##",gtl);
  
        var dragstartFunction = "dragstart(event,'"+gtlMarkdown+"');";
  
        return '<a href="'+gtl+'" target="_blank" ondragstart="'+dragstartFunction+'" >'+lang+'</a>';
      }
  
      function dragstart(event,text) {
        event.dataTransfer.setData("TEXT", text);
      }
      function onchangeCollection() {
        var clfield = document.getElementById("collection");
        var cl;
        if (clfield) cl = clfield.value;
        var linkArea = document.getElementById("linkArea");
  
        // regexToken = /(((ftp|https?):\/\/)[\-\w@:%​​_\+.~#?!,&\/\/=]+)|((mailto:)?[_​​.\w-]+@([\w][\w\-]+\.)+[a-zA-Z]{2,3})/g;
        regexToken = /(https?:\/\/[^\[\] \n\r()]*)/g
        var linkList;
  
        var result = "";
  
  
        while( (linkList = regexToken.exec(cl)) != null ) {
  
          result += '<a href="'+linkList[0]+'" target="_blank" >'+linkList[0]+'</a>\n';
          leftLang=document.getElementById("left_lang").innerHTML;
          rightLang=document.getElementById("right_lang").innerHTML;
          result += " "+generateGoogleTranslateLink(linkList[0],leftLang);
  
          if (rightLang !== "--" && rightLang !== "") {
            result += " "+generateGoogleTranslateLink(linkList[0],rightLang);
          }
          result +="<br>\n";
  
  
        }
        result = '<p>'+result+'</p>';
        FitToContent("collection");
  
  
        if (linkArea) linkArea.innerHTML = result;
      }
  
  
      var myclick = function (id) {
        image = document.getElementById(id);
        src = image.src;
        src = "![("+id+")]("+src+")";
        clip(src);
        alert(id+ " flag is copied to clipboard");
      }
  
      function ondragstartflag (event,id) {
        image = document.getElementById(id);
        src = image.src;
        src = "![(" + id + ")](" + src + ")";
        event.dataTransfer.setData("TEXT", src);
      }
      function onchangeComment() {
        FitToContent("comment");
      }
      function onChangeField(field) {
        return function () {
          FitToContent(field);
        }
      }
  
      function FitToContent(id, maxHeight)
      {
        textfield = document.getElementById(id);
        if ( !textfield )
          return;
  
  
        textfield.style.height = textfield.style.minHeight;
        var adjustedHeight = textfield.clientHeight;
  
  
        if ( !maxHeight || maxHeight > adjustedHeight )
        {
          adjustedHeight = Math.max(textfield.scrollHeight, adjustedHeight);
          if ( maxHeight )
            adjustedHeight = Math.min(maxHeight, adjustedHeight);
  
          if ( adjustedHeight > textfield.clientHeight ) {
  
            textfield.style.height = adjustedHeight + "px";
  
  
          }
        }
      }
  
  
      function showRL(what) {
        $(".RL").addClass("hidden");
        $(".RL-"+what).removeClass("hidden");
      }
  
      var placeholder = !{JSON.stringify(placeholder.categories)}
  
  
  
  
      function onchangeCategory() {
        var categoryEN = document.getElementById("categoryEN");
        if (!categoryEN) return;
        var c = categoryEN.value;
        if (placeholder[c]) {
          categoryDisplay.innerHTML = placeholder[c];
        }
        showHideUnpublishReason();
      }
      function showHideUnpublishReason() {
        var categoryEN = document.getElementById("categoryEN");
        if (!categoryEN) return;
        var c = document.getElementById("categoryEN").value;
        var b = document.getElementById("blog").value;
        var hidden = true;
        if (c==="--unpublished--") hidden = false;
        if (b==="Trash") hidden = false;
        var unpublishReasonRow = document.getElementById("unpublishReasonRow");
        if (hidden) unpublishReasonRow.classList.add("hidden");
        else unpublishReasonRow.classList.remove("hidden");
  
      }
  
  
  
  