Use minified js file to improve page load time

This commit is contained in:
= 2012-04-25 09:12:49 +02:00
parent b5defff28c
commit c0646bccb0
5 changed files with 17 additions and 11 deletions

View File

@ -1,6 +1,13 @@
JSON EDITOR ONLINE CHANGELOG
http://jsoneditoronline.org
2012-04-24, version 1.1
- fixed a bug. Dragging an object down which has been expanded and collapsed
again did not work.
- using a minified version of jsoneditor.js, to improve page load time and
save bandwidth.
2012-04-21, version 1.0

View File

@ -29,7 +29,7 @@ the License.
Copyright (C) 2011-2012 Jos de Jong, http://jsoneditoronline.org
@author Jos de Jong, <wjosdejong@gmail.com>
@date 2012-04-21
@date 2012-04-24
-->
<html>
@ -46,7 +46,7 @@ Copyright (C) 2011-2012 Jos de Jong, http://jsoneditoronline.org
<link rel="stylesheet" type="text/css" href="jsoneditor.css">
<link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="jsoneditor.js"></script>
<script type="text/javascript" src="jsoneditor-min.js"></script>
<script type="text/javascript" src="interface.js"></script>
</head>
@ -128,7 +128,7 @@ Copyright (C) 2011-2012 Jos de Jong, http://jsoneditoronline.org
<div id="footer">
<div id="footer-inner">
<a href="http://jsoneditoronline.org" class="footer">JSON Editor Online 1.0</a>
<a href="http://jsoneditoronline.org" class="footer">JSON Editor Online 1.1</a>
&bull;
<a href="changelog.txt" target="_blank" class="footer">Changelog</a>
&bull;

View File

@ -29,7 +29,7 @@ the License.
Copyright (C) 2011-2012 Jos de Jong, http://jsoneditoronline.org
@author Jos de Jong, <wjosdejong@gmail.com>
@date 2012-04-21
@date 2012-04-24
-->
<html>
@ -131,7 +131,7 @@ Copyright (C) 2011-2012 Jos de Jong, http://jsoneditoronline.org
<div id="footer">
<div id="footer-inner">
<a href="http://jsoneditoronline.org" class="footer">JSON Editor Online 1.0</a>
<a href="http://jsoneditoronline.org" class="footer">JSON Editor Online 1.1</a>
&bull;
<a href="changelog.txt" target="_blank" class="footer">Changelog</a>
&bull;

6
jsoneditor-min.js vendored
View File

@ -19,7 +19,7 @@
Copyright (c) 2011-2012 Jos de Jong, http://jsoneditoronline.org
@author Jos de Jong, <wjosdejong@gmail.com>
@date 2012-04-21
@date 2012-04-24
*/
if(!Array.prototype.indexOf)Array.prototype.indexOf=function(a){for(var b=0;b<this.length;b++)if(this[b]==a)return b;return-1};var JSON;JSONEditor=function(a,b){if(!JSON)throw Error("Your browser does not support JSON. \n\nPlease install the newest version of your browser.\n(all modern browsers support JSON).");if(!a)throw Error("No container element provided.");this.container=a;this._createFrame();this._createTable();this.set(b||{})};JSONEditor.focusNode=void 0;
JSONEditor.prototype.set=function(a){this.content.removeChild(this.table);this._setRoot(new JSONEditor.Node({value:a}));this.node.expand(!1);this.content.appendChild(this.table)};JSONEditor.prototype.get=function(){JSONEditor.focusNode&&JSONEditor.focusNode.blur();return this.node?this.node.getValue():{}};JSONEditor.prototype.clear=function(){this.node&&(this.node.collapse(),this.tbody.removeChild(this.node.getDom()),delete this.node)};
@ -46,8 +46,8 @@ JSONEditor.Node.prototype.getDom=function(){var a=this.dom;if(a.tr)return a.tr;a
a.tree=this._createDomTree(a.expand,a.field,a.value);b.appendChild(a.tree);b=document.createElement("td");b.className="jsoneditor-td jsoneditor-td-edit";a.tr.appendChild(b);a.type=this._createDomTypeButton();b.appendChild(a.type);b=document.createElement("td");b.className="jsoneditor-td jsoneditor-td-edit";a.tr.appendChild(b);a.duplicate=this._createDomDuplicateButton();a.duplicate&&b.appendChild(a.duplicate);b=document.createElement("td");b.className="jsoneditor-td jsoneditor-td-edit";a.tr.appendChild(b);
a.remove=this._createDomRemoveButton();a.remove&&b.appendChild(a.remove);this._updateStatus();this.updateDom();return a.tr};
JSONEditor.Node.prototype._onDragStart=function(a){a=a||window.event;JSONEditor.focusNode&&JSONEditor.focusNode.blur();var b=this;if(!this.mousemove)this.mousemove=JSONEditor.Events.addEventListener(document,"mousemove",function(a){b._onDrag(a)});if(!this.mouseup)this.mouseup=JSONEditor.Events.addEventListener(document,"mouseup",function(a){b._onDragEnd(a)});JSONEditor.freezeHighlight=!0;this.oldCursor=document.body.style.cursor;document.body.style.cursor="move";JSONEditor.Events.preventDefault(a)};
JSONEditor.Node.prototype._onDrag=function(a){var a=a||window.event,b=this.dom.tr,c=JSONEditor.getAbsoluteTop(b),d=b.offsetHeight,f=a.pageY||a.clientY+document.body.scrollTop;if(f<c){for(var c=b.previousSibling,b=JSONEditor.getAbsoluteTop(c),e=JSONEditor.getNodeFromTarget(c);c&&f<b;)e=JSONEditor.getNodeFromTarget(c),c=c.previousSibling,b=JSONEditor.getAbsoluteTop(c);if(e)c=e.dom.tr,b=JSONEditor.getAbsoluteTop(c),f>b+d&&(e=void 0);e&&e.parent&&e.parent.moveBefore(this,e)}else if(e=(d=this.append?this.append.getDom():
this.dom.tr)?d.nextSibling:void 0){for(var d=JSONEditor.getAbsoluteTop(e),b=void 0,e=e.nextSibling,g=JSONEditor.getAbsoluteTop(e),g=e?g-d:0;e&&f>c+g;)b=JSONEditor.getNodeFromTarget(e),e=e.nextSibling,g=JSONEditor.getAbsoluteTop(e),g=e?g-d:0;b&&b.parent&&b.parent.moveBefore(this,b)}JSONEditor.Events.preventDefault(a)};
JSONEditor.Node.prototype._onDrag=function(a){var a=a||window.event,b=this.dom.tr,c=JSONEditor.getAbsoluteTop(b),d=b.offsetHeight,f=a.pageY||a.clientY+document.body.scrollTop;if(f<c){for(var c=b.previousSibling,b=JSONEditor.getAbsoluteTop(c),e=JSONEditor.getNodeFromTarget(c);c&&f<b;)e=JSONEditor.getNodeFromTarget(c),c=c.previousSibling,b=JSONEditor.getAbsoluteTop(c);if(e)c=e.dom.tr,b=JSONEditor.getAbsoluteTop(c),f>b+d&&(e=void 0);e&&e.parent&&e.parent.moveBefore(this,e)}else if(e=(d=this.expanded&&
this.append?this.append.getDom():this.dom.tr)?d.nextSibling:void 0){for(var d=JSONEditor.getAbsoluteTop(e),b=void 0,e=e.nextSibling,g=JSONEditor.getAbsoluteTop(e),g=e?g-d:0;e&&f>c+g;)b=JSONEditor.getNodeFromTarget(e),e=e.nextSibling,g=JSONEditor.getAbsoluteTop(e),g=e?g-d:0;b&&b.parent&&b.parent.moveBefore(this,b)}JSONEditor.Events.preventDefault(a)};
JSONEditor.Node.prototype._onDragEnd=function(a){a=a||window.event;document.body.style.cursor=this.oldCursor;delete JSONEditor.freezeHighlight;delete this.oldCursor;this.setHighlight(!1);this.mousemove&&(JSONEditor.Events.removeEventListener(document,"mousemove",this.mousemove),delete this.mousemove);this.mouseup&&(JSONEditor.Events.removeEventListener(document,"mouseup",this.mouseup),delete this.mouseup);JSONEditor.Events.preventDefault(a)};
JSONEditor.Node.prototype._createDomDragArea=function(){if(this.parent){var a=document.createElement("button");a.className="jsoneditor-dragarea";return a}};JSONEditor.Node.prototype._createDomField=function(){return document.createElement("div")};
JSONEditor.Node.prototype.setHighlight=function(a){if(!JSONEditor.freezeHighlight&&this.dom.tr){this.dom.tr.className="jsoneditor-tr"+(a?" jsoneditor-tr-highlight":"");this.append&&this.append.setHighlight(a);var b=this.childs;if(b)for(var c=0,d=b.length;c<d;c++)b[c].setHighlight(a)}};

View File

@ -26,7 +26,7 @@
* Copyright (c) 2011-2012 Jos de Jong, http://jsoneditoronline.org
*
* @author Jos de Jong, <wjosdejong@gmail.com>
* @date 2012-04-21
* @date 2012-04-24
*/
@ -1052,7 +1052,6 @@ JSONEditor.Node.prototype._onDrag = function (event) {
var topThis = JSONEditor.getAbsoluteTop(trThis);
var heightThis = trThis.offsetHeight;
var mouseY = event.pageY || (event.clientY + document.body.scrollTop);
if (mouseY < topThis) {
// move up
var trPrev = trThis.previousSibling;
@ -1078,7 +1077,7 @@ JSONEditor.Node.prototype._onDrag = function (event) {
}
else {
// move down
var trLast = this.append ? this.append.getDom() : this.dom.tr;
var trLast = (this.expanded && this.append) ? this.append.getDom() : this.dom.tr;
var trFirst = trLast ? trLast.nextSibling : undefined;
if (trFirst) {
var topFirst = JSONEditor.getAbsoluteTop(trFirst);