Skip to content

Commit

Permalink
distilled
Browse files Browse the repository at this point in the history
  • Loading branch information
Ron Valstar committed Jun 11, 2015
1 parent f56330d commit 5bbd543
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 24 deletions.
19 changes: 17 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ module.exports = function (grunt) {

watch: {
gruntfile: {
files: ['Gruntfile.js', '.jshintrc'],
options: { spawn: false, reload: true }
files: ['Gruntfile.js', '.jshintrc']
,options: { spawn: false, reload: true }
}
,default: {
files: ['src/*.js']
Expand Down Expand Up @@ -98,6 +98,21 @@ module.exports = function (grunt) {
,compress: true
}
}

,connect: {
server: {
options: {
port: 9001
,hostname: 'localhost'
/*,onCreateServer: function (server,connect,options) {
var io = require('socket.io').listen(server);
io.sockets.on('connection',function (socket) {
// do something with socket
});
}*/
}
}
}
,qunit: {
all: { options: { urls: ['http://localhost:9001/test/unit/index.html'] } }
}
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.tinysort.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Does not use the first argument in tinysort.js since that is handled internally by the jQuery selector.
* Sub-selections (option.selector) do not use the jQuery selector syntax but regular CSS3 selector syntax.
* @summary jQuery plugin wrapper for TinySort
* @version 2.2.2
* @version 2.2.4
* @requires tinysort
* @license MIT/GPL
* @author Ron Valstar (http://www.sjeiti.com/)
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.tinysort.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Does not use the first argument in tinysort.js since that is handled internally by the jQuery selector.
* Sub-selections (option.selector) do not use the jQuery selector syntax but regular CSS3 selector syntax.
* @summary jQuery plugin wrapper for TinySort
* @version 2.2.2
* @version 2.2.4
* @requires tinysort
* @license MIT/GPL
* @author Ron Valstar (http://www.sjeiti.com/)
Expand Down
8 changes: 5 additions & 3 deletions dist/tinysort.charorder.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* TinySort CharOrder: a TinySort plugin to sort non-latin characters.
* @summary TinySort CharOrder
* @version 2.2.2
* @version 2.2.4
* @requires tinysort
* @license MIT/GPL
* @author Ron Valstar <[email protected]>
Expand Down Expand Up @@ -66,7 +66,7 @@
orderedCharlist = allCharsList.slice(0); // first set to entire 32-255 charlist
// then loop through the charOrder rule
for (var
charListNotLatin = []
charListNotLatin = []
,addReplacement = function(nonLatin,replacement){
charListNotLatin.push(replacement);
replacements[criterium.cases?nonLatin:nonLatin.toLowerCase()] = replacement;
Expand All @@ -92,7 +92,9 @@
addReplacement(sCode.replace(/[{}]/g,''),lastChar);
}
}
for (j=0,m=replaces.length;j<m;j++) addReplacement(replaces[j],lastChar);
for (j=0,m=replaces.length;j<m;j++) {
addReplacement(replaces[j],lastChar);
}
i += replaces.length+1;
} else if (char==='{') { // find doubles: dž, ss, lj ...
var doubleChars = charOrder.substr(i+1).match(/[^}]*/)[0];
Expand Down
2 changes: 1 addition & 1 deletion dist/tinysort.charorder.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/tinysort.jgz
Original file line number Diff line number Diff line change
@@ -1 +1 @@
!function(a,b){"use strict";function c(){return b}"function"==typeof define&&define.amd?define("tinysort",c):a.tinysort=b}(this,function(){"use strict";function a(a,d){function h(){0===arguments.length?q({}):b(arguments,function(a){q(z(a)?{selector:a}:a)}),n=G.length}function q(a){var b=!!a.selector,d=b&&":"===a.selector[0],e=c(a||{},p);G.push(c({hasSelector:b,hasAttr:!(e.attr===g||""===e.attr),hasData:e.data!==g,hasFilter:d,sortReturnNumber:"asc"===e.order?1:-1},e))}function r(){b(a,function(a,b){B?B!==a.parentNode&&(H=!1):B=a.parentNode;var c=G[0],d=c.hasFilter,e=c.selector,f=!e||d&&a.matchesSelector(e)||e&&a.querySelector(e),g=f?E:F,h={elm:a,pos:b,posn:g.length};D.push(h),g.push(h)}),A=E.slice(0)}function s(){E.sort(t)}function t(a,c){var d=0;for(0!==o&&(o=0);0===d&&n>o;){var g=G[o],h=g.ignoreDashes?l:k;if(b(m,function(a){var b=a.prepare;b&&b(g)}),g.sortFunction)d=g.sortFunction(a,c);else if("rand"==g.order)d=Math.random()<.5?1:-1;else{var i=f,p=y(a,g),q=y(c,g),r=""===p||p===e,s=""===q||q===e;if(p===q)d=0;else if(g.emptyEnd&&(r||s))d=r&&s?0:r?1:-1;else{if(!g.forceStrings){var t=z(p)?p&&p.match(h):f,u=z(q)?q&&q.match(h):f;if(t&&u){var v=p.substr(0,p.length-t[0].length),w=q.substr(0,q.length-u[0].length);v==w&&(i=!f,p=j(t[0]),q=j(u[0]))}}d=p===e||q===e?0:q>p?-1:p>q?1:0}}b(m,function(a){var b=a.sort;b&&(d=b(g,i,p,q,d))}),d*=g.sortReturnNumber,0===d&&o++}return 0===d&&(d=a.pos>c.pos?1:-1),d}function u(){var a=E.length===D.length;if(H&&a)I?E.forEach(function(a,b){a.elm.style.order=b}):B.appendChild(v());else{var b=G[0],c=b.place,d="org"===c,e="start"===c,f="end"===c,g="first"===c,h="last"===c;if(d)E.forEach(w),E.forEach(function(a,b){x(A[b],a.elm)});else if(e||f){var i=A[e?0:A.length-1],j=i.elm.parentNode,k=e?j.firstChild:j.lastChild;k!==i.elm&&(i={elm:k}),w(i),f&&j.appendChild(i.ghost),x(i,v())}else if(g||h){var l=A[g?0:A.length-1];x(w(l),v())}}}function v(){return E.forEach(function(a){C.appendChild(a.elm)}),C}function w(a){var b=a.elm,c=i.createElement("div");return a.ghost=c,b.parentNode.insertBefore(c,b),a}function x(a,b){var c=a.ghost,d=c.parentNode;d.insertBefore(b,c),d.removeChild(c),delete a.ghost}function y(a,b){var c,d=a.elm;return b.selector&&(b.hasFilter?d.matchesSelector(b.selector)||(d=g):d=d.querySelector(b.selector)),b.hasAttr?c=d.getAttribute(b.attr):b.useVal?c=d.value||d.getAttribute("value"):b.hasData?c=d.getAttribute("data-"+b.data):d&&(c=d.textContent),z(c)&&(b.cases||(c=c.toLowerCase()),c=c.replace(/\s+/g," ")),c}function z(a){return"string"==typeof a}z(a)&&(a=i.querySelectorAll(a)),0===a.length&&console.warn("No elements to sort");var A,B,C=i.createDocumentFragment(),D=[],E=[],F=[],G=[],H=!0,I=a.length&&(d===e||d.useFlex!==!1)&&-1!==getComputedStyle(a[0].parentNode,null).display.indexOf("flex");return h.apply(g,Array.prototype.slice.call(arguments,1)),r(),s(),u(),E.map(function(a){return a.elm})}function b(a,b){for(var c,d=a.length,e=d;e--;)c=d-e-1,b(a[c],c)}function c(a,b,c){for(var d in b)(c||a[d]===e)&&(a[d]=b[d]);return a}function d(a,b,c){m.push({prepare:a,sort:b,sortBy:c})}var e,f=!1,g=null,h=window,i=h.document,j=parseFloat,k=/(-?\d+\.?\d*)\s*$/g,l=/(\d+\.?\d*)\s*$/g,m=[],n=0,o=0,p={selector:g,order:"asc",attr:g,data:g,useVal:f,place:"org",returns:f,cases:f,forceStrings:f,ignoreDashes:f,sortFunction:g,useFlex:f,emptyEnd:f};return h.Element&&function(a){a.matchesSelector=a.matchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector||a.webkitMatchesSelector||function(a){for(var b=this,c=(b.parentNode||b.document).querySelectorAll(a),d=-1;c[++d]&&c[d]!=b;);return!!c[d]}}(Element.prototype),c(d,{loop:b}),c(a,{plugin:d,defaults:p})}());
!function(a,b){"use strict";function c(){return b}"function"==typeof define&&define.amd?define("tinysort",c):a.tinysort=b}(this,function(){"use strict";function a(a,d){function h(){0===arguments.length?q({}):b(arguments,function(a){q(z(a)?{selector:a}:a)}),n=G.length}function q(a){var b=!!a.selector,d=b&&":"===a.selector[0],e=c(a||{},p);G.push(c({hasSelector:b,hasAttr:!(e.attr===g||""===e.attr),hasData:e.data!==g,hasFilter:d,sortReturnNumber:"asc"===e.order?1:-1},e))}function r(){b(a,function(a,b){B?B!==a.parentNode&&(H=!1):B=a.parentNode;var c=G[0],d=c.hasFilter,e=c.selector,f=!e||d&&a.matchesSelector(e)||e&&a.querySelector(e),g=f?E:F,h={elm:a,pos:b,posn:g.length};D.push(h),g.push(h)}),A=E.slice(0)}function s(){E.sort(t)}function t(a,c){var d=0;for(0!==o&&(o=0);0===d&&n>o;){var g=G[o],h=g.ignoreDashes?l:k;if(b(m,function(a){var b=a.prepare;b&&b(g)}),g.sortFunction)d=g.sortFunction(a,c);else if("rand"==g.order)d=Math.random()<.5?1:-1;else{var i=f,p=y(a,g),q=y(c,g),r=""===p||p===e,s=""===q||q===e;if(p===q)d=0;else if(g.emptyEnd&&(r||s))d=r&&s?0:r?1:-1;else{if(!g.forceStrings){var t=z(p)?p&&p.match(h):f,u=z(q)?q&&q.match(h):f;if(t&&u){var v=p.substr(0,p.length-t[0].length),w=q.substr(0,q.length-u[0].length);v==w&&(i=!f,p=j(t[0]),q=j(u[0]))}}d=p===e||q===e?0:q>p?-1:p>q?1:0}}b(m,function(a){var b=a.sort;b&&(d=b(g,i,p,q,d))}),d*=g.sortReturnNumber,0===d&&o++}return 0===d&&(d=a.pos>c.pos?1:-1),d}function u(){var a=E.length===D.length;if(H&&a)I?E.forEach(function(a,b){a.elm.style.order=b}):B?B.appendChild(v()):console.warn("parentNode has been removed");else{var b=G[0],c=b.place,d="org"===c,e="start"===c,f="end"===c,g="first"===c,h="last"===c;if(d)E.forEach(w),E.forEach(function(a,b){x(A[b],a.elm)});else if(e||f){var i=A[e?0:A.length-1],j=i.elm.parentNode,k=e?j.firstChild:j.lastChild;k!==i.elm&&(i={elm:k}),w(i),f&&j.appendChild(i.ghost),x(i,v())}else if(g||h){var l=A[g?0:A.length-1];x(w(l),v())}}}function v(){return E.forEach(function(a){C.appendChild(a.elm)}),C}function w(a){var b=a.elm,c=i.createElement("div");return a.ghost=c,b.parentNode.insertBefore(c,b),a}function x(a,b){var c=a.ghost,d=c.parentNode;d.insertBefore(b,c),d.removeChild(c),delete a.ghost}function y(a,b){var c,d=a.elm;return b.selector&&(b.hasFilter?d.matchesSelector(b.selector)||(d=g):d=d.querySelector(b.selector)),b.hasAttr?c=d.getAttribute(b.attr):b.useVal?c=d.value||d.getAttribute("value"):b.hasData?c=d.getAttribute("data-"+b.data):d&&(c=d.textContent),z(c)&&(b.cases||(c=c.toLowerCase()),c=c.replace(/\s+/g," ")),c}function z(a){return"string"==typeof a}z(a)&&(a=i.querySelectorAll(a)),0===a.length&&console.warn("No elements to sort");var A,B,C=i.createDocumentFragment(),D=[],E=[],F=[],G=[],H=!0,I=a.length&&(d===e||d.useFlex!==!1)&&-1!==getComputedStyle(a[0].parentNode,null).display.indexOf("flex");return h.apply(g,Array.prototype.slice.call(arguments,1)),r(),s(),u(),E.map(function(a){return a.elm})}function b(a,b){for(var c,d=a.length,e=d;e--;)c=d-e-1,b(a[c],c)}function c(a,b,c){for(var d in b)(c||a[d]===e)&&(a[d]=b[d]);return a}function d(a,b,c){m.push({prepare:a,sort:b,sortBy:c})}var e,f=!1,g=null,h=window,i=h.document,j=parseFloat,k=/(-?\d+\.?\d*)\s*$/g,l=/(\d+\.?\d*)\s*$/g,m=[],n=0,o=0,p={selector:g,order:"asc",attr:g,data:g,useVal:f,place:"org",returns:f,cases:f,forceStrings:f,ignoreDashes:f,sortFunction:g,useFlex:f,emptyEnd:f};return h.Element&&function(a){a.matchesSelector=a.matchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector||a.webkitMatchesSelector||function(a){for(var b=this,c=(b.parentNode||b.document).querySelectorAll(a),d=-1;c[++d]&&c[d]!=b;);return!!c[d]}}(Element.prototype),c(d,{loop:b}),c(a,{plugin:d,defaults:p})}());
29 changes: 16 additions & 13 deletions dist/tinysort.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* TinySort is a small script that sorts HTML elements. It sorts by text- or attribute value, or by that of one of it's children.
* @summary A nodeElement sorting script.
* @version 2.2.2
* @version 2.2.4
* @license MIT/GPL
* @author Ron Valstar <[email protected]>
* @copyright Ron Valstar <[email protected]>
Expand Down Expand Up @@ -55,7 +55,7 @@
,useFlex:fls
,emptyEnd:fls
}
;undef;
;

/**
* TinySort is a small and simple script that will sort any nodeElment by it's text- or attribute value, or by that of one of it's children.
Expand Down Expand Up @@ -292,7 +292,8 @@
elmObj.elm.style.order = i;
});
} else {
parentNode.appendChild(sortedIntoFragment());
if (parentNode) parentNode.appendChild(sortedIntoFragment());
else console.warn('parentNode has been removed');
}
} else {
var criterium = criteria[0]
Expand Down Expand Up @@ -468,18 +469,20 @@
}

// matchesSelector shim
win.Element && function(ElementPrototype) {
ElementPrototype.matchesSelector = ElementPrototype.matchesSelector ||
ElementPrototype.mozMatchesSelector ||
ElementPrototype.msMatchesSelector ||
ElementPrototype.oMatchesSelector ||
ElementPrototype.webkitMatchesSelector ||
function (selector) {
var node = this, nodes = (node.parentNode || node.document).querySelectorAll(selector), i = -1;
while (nodes[++i] && nodes[i] != node);
win.Element&&(function(ElementPrototype) {
ElementPrototype.matchesSelector = ElementPrototype.matchesSelector
||ElementPrototype.mozMatchesSelector
||ElementPrototype.msMatchesSelector
||ElementPrototype.oMatchesSelector
||ElementPrototype.webkitMatchesSelector
||function (selector) {
var that = this, nodes = (that.parentNode || that.document).querySelectorAll(selector), i = -1;
//jscs:disable requireCurlyBraces
while (nodes[++i] && nodes[i] != that);
//jscs:enable requireCurlyBraces
return !!nodes[i];
};
}(Element.prototype);
})(Element.prototype);

// extend the plugin to expose stuff
extend(plugin,{
Expand Down
4 changes: 2 additions & 2 deletions dist/tinysort.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5bbd543

Please sign in to comment.