<!-- it needs jquery to work
<script src="//code.jquery.com/jquery-2.1.4.js" type="text/javascript"></script>
-->
<script src="{{ STATIC_URL }}js/jquery.json.js" type="text/javascript"></script>
<script src="{{ STATIC_URL }}js/jquery.inplaceeditform.js" type="text/javascript"></script>
<script src="{{ STATIC_URL }}js/jquery.inplaceeditform.hooks.js" type="text/javascript"></script>

{% if activate_inplaceedit %}
    <script type="text/javascript">
        var isIE = function () {
            if(typeof jQuery!== typeof undefined && jQuery.browser === undefined){
                jQuery.browser = { msie : true};
        }};
    </script>
    <!--[if IE]>
        <script type="text/javascript">
            isIE(); /* IE <= 9*/
        </script>
    <![endif]-->
    <!--[if !IE]><!-->
        <script type="text/javascript"> 
            if (/*@cc_on!@*/false) { 
                isIE(); /* IE 10*/
            }
        </script>
    <!--<![endif]-->
    <script type="text/javascript">
        (function($){
            $(document).ready(function () {
                var options = {"getFieldUrl": "{{ inplace_get_field_url }}",
                               "saveURL": "{{ inplace_save_url }}",
                               "successText": "{{ success_text }}",
                               "eventInplaceEdit": "{{ event }}",
                               "disableClick": {{ disable_click }},
                               "autoSave": {{ auto_save }},
                               "unsavedChanges": "{{ unsaved_changes }}",
                               "enableClass": "{{ enable_class }}",
                               "fieldTypes": "{{ field_types }}",
                               "focusWhenEditing": {{ focus_when_editing }}};
                {% include "inplaceeditform/inc.extra_options.html" %}
                var inplaceManager = $(".inplaceedit").inplaceeditform(options);
                {% if not toolbar %}
                    inplaceManager.enable();
                {% else %}
                    if ($(".inplaceedit").size()) {
                        {% include "inplaceeditform/inc.inplace_toolbar.html" %}
                    }
                {% endif %}

        });
    })(jQuery);
    </script>
    {% include "inplaceeditform/inc.csrf_token.html" %}
    {{ inplace_js_extra|safe }}
{% endif %}
