<commit_before>{% load ndf_tags %}
{% load i18n %}
<!-- orgitdown! -->
<script type="text/javascript" src="/static/ndf/orgitdown/jquery.orgitdown-foundation.js"></script>
<script type="text/javascript" src="/home/supriya/Downloads/jquery.caret.1.02.min.js"></script>

<!-- orgitdown! toolbar settings -->
<script type="text/javascript" src="/static/ndf/orgitdown/skins/gstudio/set.js"></script>
<!-- orgitdown! skin -->
<link rel="stylesheet" type="text/css" href="/static/ndf/orgitdown/skins/gstudio/style.css" />

<style type="text/css">


</style

<!-- start of mobwrite -->
{% if node_id %}
	<script src="/static/js/mobwrite/diff_match_patch.js"></script>
	<script src="/static/js/mobwrite/core.js"></script>
	<script src="/static/js/mobwrite/form.js"></script>
	<script src="/static/js/mobwrite/iframe.js"></script>
	<script>
	mobwrite.syncGateway = '/mobwrite/';
        mobwrite.syncUsername = "{{request.user.username}}";
	$(function(){
	        mobwrite.share('{{node_id|mongo_id}}');
		
	});
// ajax call for editing users
        var onlineuser = function() {
        $.ajax({
          url: "{% url 'get_online_editing_user' 'groupid' %}",
          type: "POST",
          data: ({
            editorid: '{{node_id}}',
	    csrfmiddlewaretoken: '{{ csrf_token }}',
          }),
          beforeSend: function() {  },
          error: function(request){
		$("#plistOnlineUser").html("error"); },
          success: function(data) {
		$(".orgitdownLive").show();
		$("#plistOnlineUser").html("");
		$("#listOnlineUser").html("");
		if(data[0] == "No users"){$("#plistOnlineUser").html("No other users editing this resource");}
		else{
			for(var item in data)
			{
			 var li = $("<li class='user'></li>")
                                 .appendTo($("#listOnlineUser"));
			if(data[item]['pro_img'] == "no"){
				itag = $('<i class="fi-torso" style="background-color:#aabb44"></i>')
					.appendTo(li);
				li.append(data[item]['username']); }
			else{
				imgtag = $('<img height="30" width="30" style="margin-right:0.4em;" src='+data[item]['pro_img']+'>')
					.appendTo(li);
				li.append(data[item]['username']);

			}
				
			}
			}
		    }
		
        }); //end of ajax

      };
	setInterval(onlineuser, 5000);
	</script>
{% endif %}
<!-- end of mobwrite -->

{% if node_id %}

<input type="hidden" value="{% check_existence_textObj_mobwrite node_id %}">
<textarea id="{{node_id|mongo_id}}" class="small-12 columns" name="{{var_name}}" placeholder="{{var_placeholder}}" value="{{var_value}}">{{var_value}}</textarea>

{% else %}
<textarea id="orgitdown_{{var_name}}" class="small-12 columns orgedit" name="{{var_name}}" placeholder="{{var_placeholder}}" value="{{var_value}}">{{var_value}}</textarea>

{% endif %}
<script>
{% if node_id %}
  $("#{{node_id|mongo_id}}").orgitdown(mySettings);
{% else %}
  $("#orgitdown_{{var_name}}").orgitdown(mySettings);
{% endif %}


function insertImg(){
  if($("#image_name").val() == "" || $("#image_width").val() == "" || $("#image_url").val() == ""){
          alert("Please fill the input provided");
    }
  else {
  insert_img=("\n#+CAPTION: "+$("#image_name").val()+"\n#+ATTR_HTML: "+$("#image_width").val()+"\n[["+$("#image_url").val()+"]]\n");
  var startPos = $("#{{node_id}}").prop("selectionStart");
  var endPos = $("#{{node_id}}").prop("selectionEnd");
  var content = $("#{{node_id}}").val().substring(0, startPos) + insert_img + $("#{{node_id}}").val().substring(endPos, $("#{{node_id}}").val().length);
  $("#{{node_id}}").val(content);
  $(".close-reveal-modal").trigger("click");
}
}

function myFunction(str){ 
				cite = document.getElementById(str.id).name;
				var txtAreaContainer = $(".orgitdownContainer textarea");
				cursor_position=$(txtAreaContainer).prop('selectionStart')
				string1=txtAreaContainer.val().substring(0,cursor_position);
				string2=txtAreaContainer.val().substring(cursor_position,txtAreaContainer.val().length);
				string3=cite
				string4=string1+string3+string2
				txtAreaContainer.val(string4);
				$('#bib-text').foundation('reveal', 'close');
			}

$(".orgitdownButton.orgitdownButton6 a").click(function(){
         $.ajax({
                 url: "{% url 'insert_picture' group_id %}",
                 type:"GET",
                 success: function(data) {
                          $('#insert-pic').foundation('reveal', 'open');
              }
          })
        })

$(".orgitdownButton.orgitdownButton10 a").click(function(){
		  $.ajax({
          url: "{% url 'view_articles' group_id %}",
          type:"GET",
          success: function(data) {
                        data = JSON.parse(data);
                        temp = '';
			for(i=0; i<data.length; i++)
			{
				console.log(data.length)
				$.each(data[i], function(j, entry){
						temp += '<dd class="accordion-navigation"><a href="#'+j+'">'+j+'</a><div id="'+j+'" class="content">';
						temp2 = '';
						array=entry
						for(j=0;j<array.length;j++)
						{
							prop=(array[j].name)
							prop2=(array[j].cite)
							temp2 += '<div> <button id="#'+prop+'" name="'+prop2+'" onclick="myFunction(this)">'+ prop +' </button> </div>';
							
						}
						temp2 += '</div></dd>'
						
						temp += temp2;

					})

			}
				
			$('#bib-text').foundation('reveal', 'open');

			document.getElementById("bib1").innerHTML=temp;
			
			
		}

        }); 
		});

</script>

<div id="insert-pic" class="small reveal-modal" data-reveal>
<a class="close-reveal-modal">&#215;</a>
<h3>Add Internal/External Images:</h3> 
<div>
    <label for="name">Image Name</label> 
    <input type="text" name="name" id="image_name" placeholder="Enter name ..." required>
    <label for="width">Width</label>
    <input type="text" name="width" id="image_width" placeholder="Enter width in pixel eg.600..." required>
    <label for="url">URL</label>
    <input type="url" name="url" id="image_url" placeholder="Enter url eg. http:filename.jpg..." required>
  <button type="submit" id="insertimage" onclick="insertImg()"> Add Image</button>
</div>
<dl class="accordion" data-accordion id="pic">
</dl>
</div>


<div id="bib-text" class="reveal-modal" data-reveal>
<dl class="accordion" data-accordion id="bib1">
  
</dl><commit_msg>bug in image overlay resolved<commit_after>{% load ndf_tags %}
{% load i18n %}
<!-- orgitdown! -->
<script type="text/javascript" src="/static/ndf/orgitdown/jquery.orgitdown-foundation.js"></script>
<!-- orgitdown! toolbar settings -->
<script type="text/javascript" src="/static/ndf/orgitdown/skins/gstudio/set.js"></script>
<!-- orgitdown! skin -->
<link rel="stylesheet" type="text/css" href="/static/ndf/orgitdown/skins/gstudio/style.css" />

<style type="text/css">


</style

<!-- start of mobwrite -->
{% if node_id %}
	<script src="/static/js/mobwrite/diff_match_patch.js"></script>
	<script src="/static/js/mobwrite/core.js"></script>
	<script src="/static/js/mobwrite/form.js"></script>
	<script src="/static/js/mobwrite/iframe.js"></script>
	<script>
	mobwrite.syncGateway = '/mobwrite/';
        mobwrite.syncUsername = "{{request.user.username}}";
	$(function(){
	        mobwrite.share('{{node_id|mongo_id}}');
		
	});
// ajax call for editing users
        var onlineuser = function() {
        $.ajax({
          url: "{% url 'get_online_editing_user' 'groupid' %}",
          type: "POST",
          data: ({
            editorid: '{{node_id}}',
	    csrfmiddlewaretoken: '{{ csrf_token }}',
          }),
          beforeSend: function() {  },
          error: function(request){
		$("#plistOnlineUser").html("error"); },
          success: function(data) {
		$(".orgitdownLive").show();
		$("#plistOnlineUser").html("");
		$("#listOnlineUser").html("");
		if(data[0] == "No users"){$("#plistOnlineUser").html("No other users editing this resource");}
		else{
			for(var item in data)
			{
			 var li = $("<li class='user'></li>")
                                 .appendTo($("#listOnlineUser"));
			if(data[item]['pro_img'] == "no"){
				itag = $('<i class="fi-torso" style="background-color:#aabb44"></i>')
					.appendTo(li);
				li.append(data[item]['username']); }
			else{
				imgtag = $('<img height="30" width="30" style="margin-right:0.4em;" src='+data[item]['pro_img']+'>')
					.appendTo(li);
				li.append(data[item]['username']);

			}
				
			}
			}
		    }
		
        }); //end of ajax

      };
	setInterval(onlineuser, 5000);
	</script>
{% endif %}
<!-- end of mobwrite -->

{% if node_id %}

<input type="hidden" value="{% check_existence_textObj_mobwrite node_id %}">
<textarea id="{{node_id|mongo_id}}" class="small-12 columns" name="{{var_name}}" placeholder="{{var_placeholder}}" value="{{var_value}}">{{var_value}}</textarea>

{% else %}
<textarea id="orgitdown_{{var_name}}" class="small-12 columns orgedit" name="{{var_name}}" placeholder="{{var_placeholder}}" value="{{var_value}}">{{var_value}}</textarea>

{% endif %}
<script>
{% if node_id %}
  $("#{{node_id|mongo_id}}").orgitdown(mySettings);
{% else %}
  $("#orgitdown_{{var_name}}").orgitdown(mySettings);
{% endif %}


function insertImg(){
  if($("#image_url").val() == ""){
          alert("Please insert an image url");
    }
  else {
  insert_img=("\n#+CAPTION: "+$("#image_name").val()+"\n#+ATTR_HTML: width='"+$("#image_width").val()+"'"+"\n[["+$("#image_url").val()+"]]\n");
  var startPos = $("#{{node_id}}").prop("selectionStart");
  var endPos = $("#{{node_id}}").prop("selectionEnd");
  var content = $("#{{node_id}}").val().substring(0, startPos) + insert_img + $("#{{node_id}}").val().substring(endPos, $("#{{node_id}}").val().length);
  $("#{{node_id}}").val(content);
  $(".close-reveal-modal").trigger("click");
}
}

function myFunction(str){ 
				cite = document.getElementById(str.id).name;
				var txtAreaContainer = $(".orgitdownContainer textarea");
				cursor_position=$(txtAreaContainer).prop('selectionStart')
				string1=txtAreaContainer.val().substring(0,cursor_position);
				string2=txtAreaContainer.val().substring(cursor_position,txtAreaContainer.val().length);
				string3=cite
				string4=string1+string3+string2
				txtAreaContainer.val(string4);
				$('#bib-text').foundation('reveal', 'close');
			}

$(".orgitdownButton.orgitdownButton6 a").click(function(){
         $.ajax({
                 url: "{% url 'insert_picture' group_id %}",
                 type:"GET",
                 success: function(data) {
                          $('#insert-pic').foundation('reveal', 'open');
              }
          })
        })

$(".orgitdownButton.orgitdownButton10 a").click(function(){
		  $.ajax({
          url: "{% url 'view_articles' group_id %}",
          type:"GET",
          success: function(data) {
                        data = JSON.parse(data);
                        temp = '';
			for(i=0; i<data.length; i++)
			{
				console.log(data.length)
				$.each(data[i], function(j, entry){
						temp += '<dd class="accordion-navigation"><a href="#'+j+'">'+j+'</a><div id="'+j+'" class="content">';
						temp2 = '';
						array=entry
						for(j=0;j<array.length;j++)
						{
							prop=(array[j].name)
							prop2=(array[j].cite)
							temp2 += '<div> <button id="#'+prop+'" name="'+prop2+'" onclick="myFunction(this)">'+ prop +' </button> </div>';
							
						}
						temp2 += '</div></dd>'
						
						temp += temp2;

					})

			}
				
			$('#bib-text').foundation('reveal', 'open');

			document.getElementById("bib1").innerHTML=temp;
			
			
		}

        }); 
		});

</script>

<div id="insert-pic" class="small reveal-modal" data-reveal>
<a class="close-reveal-modal">&#215;</a>
<h3>Add Internal/External Images:</h3> 
<div>
    <label>Image Name</label> 
    <input type="text" id="image_name" placeholder="Some description ...">
    <label>Width</label>
    <input type="text" id="image_width" placeholder="Enter width in pixel eg.600...">
    <label>URL</label>
    <input type="text" id="image_url" placeholder="Enter url eg. http:filename.jpg...">
  <button type="submit" id="insertimage" onclick="insertImg()"> Add Image</button>
</div>
<dl class="accordion" data-accordion id="pic">
</dl>
</div>


<div id="bib-text" class="reveal-modal" data-reveal>
<dl class="accordion" data-accordion id="bib1">
  
</dl>
{'fraction_non_alphanumeric': 0.226757555847569, 'fraction_numerical': 0.008459264126149803, 'mean_word_length': 3.4751929437706726, 'pattern_counts': {'":': 0, '<': 145, '<?xml version=': 0, '>': 139, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '370699', 'n_tokens_mistral': 4550, 'n_tokens_neox': 4009, 'n_words': 637}