Skip to content

Commit

Permalink
updated grunt, fixed a few minor issues, updated some helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
vakata committed Dec 25, 2012
1 parent 1ed13a3 commit a0abd16
Show file tree
Hide file tree
Showing 93 changed files with 569 additions and 383 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/index.json
/index.html
/jstree.sublime-project
/jstree.sublime-workspace
/node_modules
/documentation.bat
113 changes: 80 additions & 33 deletions dist/jstree.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/*! jstree - v1.0.0 - 2012-10-01
* http://jstree.com
* Copyright (c) 2012 Ivan Bozhanov; Licensed MIT, GPL */
/*global XSLTProcessor: false, ActiveXObject: false, console : false */

/*
File: Helper functions
Expand Down Expand Up @@ -1323,7 +1321,7 @@ Functions needed to encode/decode JSON. Based on the jQuery JSON Plugin.
Group: Cookie
A copy of the jQuery cookie plugin.
*/
(function ($) {
(function ($, document, undefined) {
/*
Function: $.vakata.cookie
A function for getting and setting cookies.
Expand All @@ -1334,33 +1332,58 @@ A copy of the jQuery cookie plugin.
Returns:
string - the encoded data
*/
$.vakata.cookie = function (key, value, options) {
var days, t, result, decode;
if (arguments.length > 1 && String(value) !== "[object Object]") {
options = $.extend({}, options);
if(value === null || value === undefined) { options.expires = -1; }
if(typeof options.expires === 'number') { days = options.expires; t = options.expires = new Date(); t.setDate(t.getDate() + days); }
value = String(value);
var raw = function (s) { return s; },
decoded = function (s) { return decodeURIComponent(s.replace(/\+/g, ' ')); };
var config = $.vakata.cookie = function (key, value, options) {
// write
if (value !== undefined) {
options = $.extend({}, config.defaults, options);

if (value === null) {
options.expires = -1;
}

if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}

value = config.json ? $.vakata.json.encode(value) : String(value);

return (document.cookie = [
encodeURIComponent(key), '=',
options.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '',
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
options = value || {};
decode = options.raw ? function (s) { return s; } : decodeURIComponent;
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
// read
var decode = config.raw ? raw : decoded;
var cookies = document.cookie.split('; ');
for (var i = 0, l = cookies.length; i < l; i++) {
var parts = cookies[i].split('=');
if (decode(parts.shift()) === key) {
var cookie = decode(parts.join('='));
return config.json ? $.vakata.json.decode(cookie) : cookie;
}
}
return null;
};
})(jQuery);
config.defaults = {};
$.vakata.removeCookie = function (key, options) {
if ($.cookie(key) !== null) {
$.cookie(key, null, options);
return true;
}
return false;
};
})(jQuery, document);

/*
Group: LocalStorage
Functions for dealing with localStorage with fallback to userData or cookies. A slight modification of jstorage.
*/

(function ($) {
var _storage = {},
_storage_service = {jStorage:"{}"},
Expand Down Expand Up @@ -1512,9 +1535,9 @@ Functions for dealing with localStorage with fallback to userData or cookies. A
$.vakata.storage = {
/*
Variable: $.vakata.storage.version
*string* the version of jstorage used
*string* the version of jstorage used HEAVILY MODIFIED
*/
version: "0.1.6.1",
version: "0.3.0",
/*
Function: $.vakata.storage.set
Set a key to a value
Expand All @@ -1526,10 +1549,16 @@ Functions for dealing with localStorage with fallback to userData or cookies. A
Returns:
_value_
*/
set : function (key, value) {
set : function (key, value, ttl) {
_checkKey(key);
if(typeof value === "object") {
value = json_decode(json_encode(value));
}
_storage[key] = value;
_save();
if(ttl && parseInt(ttl, 10)) {
$.vakata.storage.setTTL(key, parseInt(ttl, 10));
}
return value;
},
/*
Expand Down Expand Up @@ -1598,6 +1627,15 @@ Functions for dealing with localStorage with fallback to userData or cookies. A
}
return false;
},
getTTL: function(key){
var curtime = +new Date(), ttl;
_checkKey(key);
if(key in _storage && _storage.__jstorage_meta.TTL && _storage.__jstorage_meta.TTL[key]) {
ttl = _storage.__jstorage_meta.TTL[key] - curtime;
return ttl || 0;
}
return 0;
},

/*
Function: $.vakata.storage.flush
Expand All @@ -1620,9 +1658,7 @@ Functions for dealing with localStorage with fallback to userData or cookies. A
*object*
*/
storageObj : function(){
function F() {}
F.prototype = _storage;
return new F();
return $.extend(true, {}, _storage);
},
/*
Function: $.vakata.storage.index
Expand Down Expand Up @@ -1714,7 +1750,7 @@ Modifies time elements to a more human readable value. Taken from: https://githu
*/
parse : function (date, compareTo) {
// remove the timezone (always use gmdate on server side)
date = new Date(date.replace(/-/g,"/").replace(/[TZ]/g," ").replace(/\+\d\d\:\d\d$/,''));
date = new Date(date.replace(/-/g,"/").replace(/[TZ]/g," ").replace(/\+\d\d\:\d\d$/,'').replace(/\+\d\d\d\d$/,''));
compareTo = compareTo || new Date();
var lang = $.vakata.pretty_date.lang,
formats = [
Expand Down Expand Up @@ -2084,6 +2120,18 @@ Selection related functions
return _return;
};
})(jQuery);
/*
* jsTree 1.0.0
* http://jstree.com/
*
* Copyright (c) 2011 Ivan Bozhanov (vakata.com)
*
* Licensed same as jquery - under the terms of either the MIT License or the GPL Version 2 License
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/

/*global jQuery, window, document, setTimeout, setInterval, clearTimeout, clearInterval, console */

/* File: jstree.js
Expand Down Expand Up @@ -4037,7 +4085,7 @@ Some static functions and variables, unless you know exactly what you are doing
$(function() {
var css_string = '' +
'.jstree * { -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box; }' +
'.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } ' +
'.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; list-style-image:none; } ' +
'.jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; min-width:18px; } ' +
'.jstree-rtl li { margin-left:0; margin-right:18px; } ' +
'.jstree > ul > li { margin-left:0px; } ' +
Expand Down Expand Up @@ -4129,10 +4177,10 @@ Adds checkboxes to the tree.
toggle_check : function (obj) {
obj = obj.find(' > a > .jstree-checkbox').removeClass('jstree-undetermined').toggleClass('jstree-checked');
if(!obj.hasClass('jstree-checked')) {
this.uncheck_node();
this.uncheck_node(obj);
}
else {
this.check_node();
this.check_node(obj);
}
},
uncheck_all : function (context) {
Expand Down Expand Up @@ -5209,7 +5257,6 @@ This plugin enables state saving between reloads.
/* File: jstree.themes.js
Controls the looks of jstree, without this plugin you will get a functional tree, but it will look just like an ordinary UL list
*/

(function ($) {
var themes_loaded = [];
/*
Expand Down
8 changes: 4 additions & 4 deletions dist/jstree.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/files/jstree-checkbox-js.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

<html><head><title>jstree.checkbox.js - jstree</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/prettify.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>jstree.checkbox.js - jstree</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/prettify.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>

<!-- Generated by Natural Docs, version 1.5 -->
<!-- Generated by Natural Docs, version 1.52 -->
<!-- http://www.naturaldocs.org -->

<!-- saved from url=(0026)http://www.naturaldocs.org -->
Expand All @@ -18,7 +18,7 @@
</div><!--Content-->


<div id=Footer>Copyright &copy; 2010 Ivan Bozhanov&nbsp; &middot;&nbsp; Updated October 1st, 2012&nbsp; &middot;&nbsp; <a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<div id=Footer>Copyright &copy; 2010 Ivan Bozhanov&nbsp; &middot;&nbsp; Updated December 26th, 2012&nbsp; &middot;&nbsp; <a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->


<div id=Menu><div class=MTitle>jstree<div class=MSubTitle>jquery treeview plugin</div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Core</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MFile><a href="jstree-js.html">jstree.js</a></div></div><div class=MEntry><div class=MFile><a href="vakata-js.html">vakata.js</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent2')">Plugins</a><div class=MGroupContent id=MGroupContent2><div class=MEntry><div class=MFile><a href="jstree-html-js.html">jstree.<wbr>html.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-json-js.html">jstree.<wbr>json.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-themes-js.html">jstree.<wbr>themes.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-ui-js.html">jstree.<wbr>ui.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-state-js.html">jstree.<wbr>state.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-contextmenu-js.html">jstree.<wbr>contextmenu.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-hotkeys-js.html">jstree.<wbr>hotkeys.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-sort-js.html">jstree.<wbr>sort.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-dnd-js.html">jstree.<wbr>dnd.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-unique-js.html">jstree.<wbr>unique.js</a></div></div><div class=MEntry><div class=MFile id=MSelected>jstree.<wbr>checkbox.js</div></div><div class=MEntry><div class=MFile><a href="jstree-xml-js.html">jstree.<wbr>xml.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-rules-js.html">jstree.<wbr>rules.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-search-js.html">jstree.<wbr>search.js</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent3')">Index</a><div class=MGroupContent id=MGroupContent3><div class=MEntry><div class=MIndex><a href="../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Events.html">Events</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Files.html">Files</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Functions.html">Functions</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Variables.html">Variables</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Classes.html">Classes</a></div></div></div></div></div><script type="text/javascript"><!--
Expand Down
6 changes: 3 additions & 3 deletions docs/files/jstree-contextmenu-js.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

<html><head><title>jstree.contextmenu.js - jstree</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/prettify.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>jstree.contextmenu.js - jstree</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/prettify.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>

<!-- Generated by Natural Docs, version 1.5 -->
<!-- Generated by Natural Docs, version 1.52 -->
<!-- http://www.naturaldocs.org -->

<!-- saved from url=(0026)http://www.naturaldocs.org -->
Expand All @@ -18,7 +18,7 @@
</div><!--Content-->


<div id=Footer>Copyright &copy; 2010 Ivan Bozhanov&nbsp; &middot;&nbsp; Updated October 1st, 2012&nbsp; &middot;&nbsp; <a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<div id=Footer>Copyright &copy; 2010 Ivan Bozhanov&nbsp; &middot;&nbsp; Updated December 26th, 2012&nbsp; &middot;&nbsp; <a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->


<div id=Menu><div class=MTitle>jstree<div class=MSubTitle>jquery treeview plugin</div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Core</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MFile><a href="jstree-js.html">jstree.js</a></div></div><div class=MEntry><div class=MFile><a href="vakata-js.html">vakata.js</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent2')">Plugins</a><div class=MGroupContent id=MGroupContent2><div class=MEntry><div class=MFile><a href="jstree-html-js.html">jstree.<wbr>html.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-json-js.html">jstree.<wbr>json.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-themes-js.html">jstree.<wbr>themes.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-ui-js.html">jstree.<wbr>ui.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-state-js.html">jstree.<wbr>state.js</a></div></div><div class=MEntry><div class=MFile id=MSelected>jstree.<wbr>contextmenu.js</div></div><div class=MEntry><div class=MFile><a href="jstree-hotkeys-js.html">jstree.<wbr>hotkeys.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-sort-js.html">jstree.<wbr>sort.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-dnd-js.html">jstree.<wbr>dnd.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-unique-js.html">jstree.<wbr>unique.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-checkbox-js.html">jstree.<wbr>checkbox.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-xml-js.html">jstree.<wbr>xml.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-rules-js.html">jstree.<wbr>rules.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-search-js.html">jstree.<wbr>search.js</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent3')">Index</a><div class=MGroupContent id=MGroupContent3><div class=MEntry><div class=MIndex><a href="../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Events.html">Events</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Files.html">Files</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Functions.html">Functions</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Variables.html">Variables</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Classes.html">Classes</a></div></div></div></div></div><script type="text/javascript"><!--
Expand Down
Loading

0 comments on commit a0abd16

Please sign in to comment.