From 96774cd2a64ace5fd83bcd5d924fe3f4c969b71c Mon Sep 17 00:00:00 2001 From: Mikhail Kormanowsky Date: Sun, 10 Dec 2017 22:12:53 +0300 Subject: [PATCH] Added missing comma I have missed a f*cking comma --- jextract.js | 2 +- jextract.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jextract.js b/jextract.js index c6d33bf..e4fa51f 100644 --- a/jextract.js +++ b/jextract.js @@ -49,7 +49,7 @@ function jExtract(struct, parent) { }, isFunction = function(v){ return typeof v === "function"; - } + }, jExtractText = function (string) { this._text = string; }, diff --git a/jextract.min.js b/jextract.min.js index dab39da..b25cc0c 100644 --- a/jextract.min.js +++ b/jextract.min.js @@ -1 +1 @@ -function jExtract(t,e){if("function"!=typeof jQuery)throw"jExtract error: jExtract depends on jQuery, but it wasn`t loaded";t=t||{},e=e||$("html");var n=function(t){return e.find(t)},r=function(t){var e,n;return a(t)?e=t:i(t)||(e=t[0],t.length>1&&(n=t.slice(1))),[e,n]},c=function(t){return void 0===t},o=function(t){return"object"==typeof t&&t instanceof Object&&!(t instanceof Array)},u=function(t){return"object"==typeof t&&t instanceof Array},a=function(t){return"string"==typeof t},i=function(t){return u(t)&&!t.length},f=function(t){return"function"==typeof t};return jExtractText=function(t){this._text=t},jExtractElement=function(t){this._jquery=t},result={},jExtractText.prototype.get=function(t){return t=t||!0,t?this._text.trim():this._text},jExtractText.prototype.match=function(t,e){var n=this.get().match(new RegExp(t));return!c(e)&&u(n)&&e in n?n[e]:n},jExtractText.prototype.toInt=function(t){return t=t||!1,!isNaN(parseInt(this.get()))||t?parseInt(this.get()):0},jExtractText.prototype.toFloat=function(t){t=t||!1;var e=this.get().replace(",",".");return!isNaN(parseFloat(e))||t?parseFloat(e):0},jExtractElement.prototype.text=function(){return new jExtractText(this._jquery.text())},jExtractElement.prototype.attr=function(t){return new jExtractText(this._jquery.attr(t))},jExtractElement.prototype.recget=function(t){var e=this;return(t=t.split(".")).forEach(function(t){t in e&&(e=e[t])}),e},$.each(t,function(t,x){if(o(x))result[t]=jExtract(x,e);else{var s,p,l=["text",[]],j=["get",[]],E=!1,h=[];a(x)?s=n(x):(s=n(x[0]),o(x[1])?p=x[1]:u(x[1])&&!i(x[1])?l=r(x[1]):f(x[1])&&(l[0]=x[1]),f(x[2])?j[0]=x[2]:u(x[2])&&!i(x[2])&&(j=r(x[2])),c(x[3])||(E=!!x[3])),s.each(function(t,e){if(c(p)){var n,r,o,u=new jExtractElement($(e));f(l[0])?(n=l[0],r=[u._jquery,s].concat(l[1]),o=null):a(l[0])?(n=u.recget(l[0]),r=l[1],o=u):(n=function(){},o=null,r=[]);var i=n.apply(o,r);i instanceof jExtractText||(i=new jExtractText(i+"")),f(j[0])?(n=j[0],r=[i].concat(j[1]),content=null):a(j[0])?(n=i[j[0]],r=j[1],o=i):(n=function(){},o=null,r=[]),h.push(n.apply(o,r))}else h.push(jExtract(p,$(e)))}),!E&&h.length<2&&(h=h[0]),result[t]=h}}),result} +function jExtract(t,n){if("function"!=typeof jQuery)throw"jExtract error: jExtract depends on jQuery, but it wasn`t loaded";t=t||{},n=n||$("html");var e=function(t){return n.find(t)},r=function(t){var n,e;return c(t)?n=t:a(t)||(n=t[0],t.length>1&&(e=t.slice(1))),[n,e]},o=function(t){return void 0===t},i=function(t){return"object"==typeof t&&t instanceof Object&&!(t instanceof Array)},u=function(t){return"object"==typeof t&&t instanceof Array},c=function(t){return"string"==typeof t},a=function(t){return u(t)&&!t.length},f=function(t){return"function"==typeof t},p=function(t){this._text=t},s=function(t){this._jquery=t},h={};return p.prototype.get=function(t){return t=t||!0,t?this._text.trim():this._text},p.prototype.match=function(t,n){var e=this.get().match(new RegExp(t));return!o(n)&&u(e)&&n in e?e[n]:e},p.prototype.toInt=function(t){return t=t||!1,!isNaN(parseInt(this.get()))||t?parseInt(this.get()):0},p.prototype.toFloat=function(t){t=t||!1;var n=this.get().replace(",",".");return!isNaN(parseFloat(n))||t?parseFloat(n):0},s.prototype.text=function(){return new p(this._jquery.text())},s.prototype.attr=function(t){return new p(this._jquery.attr(t))},s.prototype.recget=function(t){var n=this;return(t=t.split(".")).forEach(function(t){t in n&&(n=n[t])}),n},$.each(t,function(t,l){if(i(l))h[t]=jExtract(l,n);else{var y,j,g=["text",[]],x=["get",[]],v=!1,w=[];c(l)?y=e(l):(y=e(l[0]),i(l[1])?j=l[1]:u(l[1])&&!a(l[1])?g=r(l[1]):f(l[1])&&(g[0]=l[1]),f(l[2])?x[0]=l[2]:u(l[2])&&!a(l[2])&&(x=r(l[2])),o(l[3])||(v=!!l[3])),y.each(function(t,n){if(o(j)){var e,r,i,u=new s($(n));f(g[0])?(e=g[0],r=[u._jquery,y].concat(g[1]),i=null):c(g[0])?(e=u.recget(g[0]),r=g[1],i=u):(e=function(){},i=null,r=[]);var a=e.apply(i,r);a instanceof p||(a=new p(a+"")),f(x[0])?(e=x[0],r=[a].concat(x[1]),content=null):c(x[0])?(e=a[x[0]],r=x[1],i=a):(e=function(){},i=null,r=[]),w.push(e.apply(i,r))}else w.push(jExtract(j,$(n)))}),!v&&w.length<2&&(w=w[0]),h[t]=w}}),h}