From b887e1309b35c4d21bc3ae5026a7c8138c08f748 Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Wed, 2 Mar 2016 11:18:52 -0700 Subject: [PATCH] Moved, minified, and renamed defiantJS --- index.php | 2 +- js/defiant-js/defiant-latest.min.js | 9 --------- js/{defiant-js/defiant-latest.js => defiant.js} | 0 js/min/defiant.js | 1 + view/index.php | 2 +- 5 files changed, 3 insertions(+), 11 deletions(-) delete mode 100644 js/defiant-js/defiant-latest.min.js rename js/{defiant-js/defiant-latest.js => defiant.js} (100%) create mode 100644 js/min/defiant.js diff --git a/index.php b/index.php index 7320902..e184238 100644 --- a/index.php +++ b/index.php @@ -279,7 +279,7 @@ require_once(SITE_LOCATION . '/php/notificationconditiontree.php'); - + diff --git a/js/defiant-js/defiant-latest.min.js b/js/defiant-js/defiant-latest.min.js deleted file mode 100644 index bc4476a..0000000 --- a/js/defiant-js/defiant-latest.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Defiant.js v1.2.5 - * Serch JSON structures plus smart templating with XSLT and XPath. - * http://defiantjs.com - * - * Copyright (c) 2013-2015, Hakan Bilgin - * Licensed under the MIT License - */ -if("undefined"==typeof module)var module={exports:void 0};if(module.exports=Defiant=function(){"use strict";var a={is_ie:/msie/i.test(navigator.userAgent),is_safari:/safari/i.test(navigator.userAgent),env:"production",xml_decl:'',namespace:'xmlns:d="defiant-namespace"',tabsize:4,render:function(a,b){var c,d,e,f,g=new XSLTProcessor,h=document.createElement("span"),i={match:"/"};switch(typeof a){case"object":this.extend(i,a),i.data||(i.data=b);break;case"string":i.template=a,i.data=b;break;default:throw"error"}if(i.data=JSON.toXML(i.data),c='//xsl:template[@name="'+i.template+'"]',this.xsl_template||this.gatherTemplates(),i.sorter&&(f=this.node.selectSingleNode(this.xsl_template,c+"//xsl:for-each//xsl:sort"),f&&(i.sorter.order&&f.setAttribute("order",i.sorter.order),i.sorter.select&&f.setAttribute("select",i.sorter.select),f.setAttribute("data-type",i.sorter.type||"text"))),e=this.node.selectSingleNode(this.xsl_template,c),e.setAttribute("match",i.match),g.importStylesheet(this.xsl_template),h.appendChild(g.transformToFragment(i.data,document)),e.removeAttribute("match"),this.is_safari){d=h.getElementsByTagName("script");for(var j=0,k=d.length;k>j;j++)d[j].defer=!0}return h.innerHTML},gatherTemplates:function(){for(var a=document.getElementsByTagName("script"),b="",c=0,d=a.length;d>c;c++)"defiant/xsl-template"===a[c].type&&(b+=a[c].innerHTML);this.xsl_template=this.xmlFromString('"+b.replace(/defiant:(\w+)/g,"$1")+"")},getSnapshot:function(a){return JSON.toXML(a,!0)},xmlFromString:function(a){var b,c;return a=a.replace(/>\s{1,}<"),null===a.trim().match(/<\?xml/)&&(a=this.xml_decl+a),this.is_ie?(c=new ActiveXObject("Msxml2.DOMDocument"),c.loadXML(a),-1===a.indexOf("xsl:stylesheet")&&c.setProperty("SelectionLanguage","XPath")):(b=new DOMParser,c=b.parseFromString(a,"text/xml")),c},extend:function(a,b){for(var c in b)a[c]&&"object"==typeof b[c]?this.extend(a[c],b[c]):a[c]=b[c];return a},node:{}};return a}(this),"undefined"==typeof XSLTProcessor){var XSLTProcessor=function(){};XSLTProcessor.prototype={importStylesheet:function(a){this.xsldoc=a},transformToFragment:function(a){var b=a.transformNode(this.xsldoc),c=document.createElement("span");return c.innerHTML=b,c}}}String.prototype.fill||(String.prototype.fill=function(a,b){var c=this;for(b=b||" ";c.length/,rx_constructor:/<(.+?)( d:contr=".*?")>/,rx_namespace:/ xmlns\:d="defiant\-namespace"/,rx_data:/(<.+?>)(.*?)(<\/d:data>)/i,rx_function:/function (\w+)/i,to_xml:function(a){var b=this.hash_to_xml(null,a);return Defiant.xmlFromString(b)},hash_to_xml:function(a,b,c){var d,e,f,g,h,i,j,k,l=b.constructor===Array,m=[],n=[];for(d in b)if(e=b[d],(null===e||void 0===e||"NaN"===e.toString())&&(e=null),g="@"===d.slice(0,1),h=c?a:d,h==+h&&b.constructor!==Object&&(h="d:item"),null===e?(i=null,j=!1):(i=e.constructor,j=i.toString().match(this.rx_function)[1]),g)n.push(h.slice(1)+'="'+this.escape_xml(e)+'"'),"String"!==j&&n.push("d:"+h.slice(1)+'="'+j+'"');else if(null===e)m.push(this.scalar_to_xml(h,e));else switch(i){case Function:break;case Object:m.push(this.hash_to_xml(h,e));break;case Array:if(d===h){if(f=e.constructor===Array)for(k=e.length;k--;)e[k].constructor===Array&&(f=!0),f||e[k].constructor!==Object||(f=!0);m.push(this.scalar_to_xml(h,e,f));break}case String:if("string"==typeof e&&(e=e.toString().replace(/\&/g,"&").replace(/\r|\n/g," ")),"#text"===h){this.map.push(b),n.push('d:mi="'+this.map.length+'"'),n.push('d:constr="'+j+'"'),m.push(this.escape_xml(e));break}case Number:case Boolean:if("#text"===h&&"String"!==j){this.map.push(b),n.push('d:mi="'+this.map.length+'"'),n.push('d:constr="'+j+'"'),m.push(this.escape_xml(e));break}m.push(this.scalar_to_xml(h,e))}return a||(a="d:data",n.push(Defiant.namespace),l&&n.push('d:constr="Array"')),null===a.match(this.rx_validate_name)&&(n.push('d:name="'+a+'"'),a="d:name"),c?m.join(""):(this.map.push(b),n.push('d:mi="'+this.map.length+'"'),"<"+a+(n.length?" "+n.join(" "):"")+(m.length?">"+m.join("")+"":"/>"))},scalar_to_xml:function(a,b,c){var d,e,f,g="";if(null===a.match(this.rx_validate_name)&&(g+=' d:name="'+a+'"',a="d:name",c=!1),(null===b||"NaN"===b.toString())&&(b=null),null===b)return"<"+a+' d:constr="null"/>';if(1===b.length&&b[0].constructor===Object){d=this.hash_to_xml(!1,b[0]);var h=d.match(this.rx_node),i=d.match(this.rx_constructor);return h=null!==h?h[2].replace(this.rx_namespace,"").replace(/>/,"").replace(/"\/$/,'"'):"",i=null!==i?i[2]:"",d=d.match(this.rx_data),d=null!==d?d[2]:"","<"+a+h+" "+i+' d:type="ArrayItem">'+d+""}return 0===b.length&&b.constructor===Array?"<"+a+' d:constr="Array"/>':c?this.hash_to_xml(a,b,!0):(e=b.constructor,f=e.toString().match(this.rx_function)[1],d=e===Array?this.hash_to_xml("d:item",b,!0):this.escape_xml(b),g+=' d:constr="'+f+'"',this.map.push(b),g+=' d:mi="'+this.map.length+'"',"#text"===a?this.escape_xml(b):"<"+a+g+">"+d+"")},escape_xml:function(a){return String(a).replace(//g,">").replace(/"/g,""").replace(/ /g," ")}},d=c.to_xml.call(c,a);return b?{doc:d,src:a,map:c.map}:(this.search.map=c.map,d)}),JSON.search||(JSON.search=function(a,b,c){"use strict";var d,e,f=a.doc&&a.doc.nodeType,g=f?a.doc:JSON.toXML(a),h=f?a.map:this.search.map,i=f?a.src:a,j=Defiant.node[c?"selectSingleNode":"selectNodes"](g,b.xTransform()),k=[];for(c&&(j=[j]),e=j.length;e--;)switch(j[e].nodeType){case 2:case 3:k.unshift(j[e].nodeValue);break;default:d=+j[e].getAttribute("d:mi"),h[d-1]&&k.unshift(h[d-1])}return"development"===Defiant.env&&(this.trace=JSON.mtrace(i,k,j)),k}),JSON.mtrace||(JSON.mtrace=function(a,b,c){"use strict";for(var d,e,f,g,h,i=window,j=JSON.stringify,k=j(a,null," ").replace(/\t/g,""),l=[],m=0,n=c.length,o=n?c[m].ownerDocument.documentElement:!1,p=(this.search.map,0);n>m;m++){switch(c[m].nodeType){case 2:e=c[m].ownerElement?c[m].ownerElement.getAttribute("d:"+c[m].nodeName):"String",d='"@'+c[m].nodeName+'": '+i[e](b[m]),f=k.indexOf(d),h=0;break;case 3:e=c[m].parentNode.getAttribute("d:constr"),d=i[e](b[m]),d='"'+c[m].parentNode.nodeName+'": '+("Number"===d?d:'"'+d+'"'),f=k.indexOf(d),h=0;break;default:if(c[m]===o)continue;"String"===c[m].getAttribute("d:constr")?(e=c[m].getAttribute("d:constr"),d=i[e](b[m]),d='"'+c[m].nodeName+'": '+("Number"===d?d:'"'+d+'"'),f=k.indexOf(d,p),h=0,p=f+1):(d=j(b[m],null," ").replace(/\t/g,""),f=k.indexOf(d),h=d.match(/\n/g).length)}g=k.substring(0,f).match(/\n/g).length+1,l.push([g,h])}return l}),Defiant.node.selectNodes=function(a,b){if(a.evaluate){for(var c=a.createNSResolver(a.documentElement),d=a.evaluate(b,a,c,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),e=[],f=0,g=d.snapshotLength;g>f;f++)e.push(d.snapshotItem(f));return e}return a.selectNodes(b)},Defiant.node.selectSingleNode=function(a,b){if(a.evaluate){var c=this.selectNodes(a,b);return c.length>0?c[0]:null}return a.selectSingleNode(b)},Defiant.node.prettyPrint=function(a){var b,c,d=Defiant,e=d.tabsize,f=d.xml_decl.toLowerCase();d.is_ie?c=a.xml:(b=new XMLSerializer,c=b.serializeToString(a)),"development"!==d.env&&(c=c.replace(/ \w+\:d=".*?"| d\:\w+=".*?"/g,""));for(var g,h,i=c.trim().replace(/(>)\s*(<)(\/*)/g,"$1\n$2$3"),j=i.split("\n"),k=-1,l=0,m=j.length;m>l;l++)(0!==l||j[l].toLowerCase()!==f)&&(g=null!==j[l].match(/<[A-Za-z_\:]+.*?>/g),h=null!==j[l].match(/<\/[\w\:]+>/g),null!==j[l].match(/<.*?\/>/g)&&(g=h=!0),g&&k++,j[l]=String().fill(k," ")+j[l],g&&h&&k--,!g&&h&&k--);return j.join("\n").replace(/\t/g,String().fill(e," "))},Defiant.node.toJSON=function(a,b){"use strict";var c=function(a){var b,d,e,f,g,h,i,j,k,l,m={},n=window;switch(a.nodeType){case 1:for(g=a.getAttribute("d:constr"),"Array"===g?m=[]:"String"===g&&""===a.textContent&&(m=""),b=a.attributes,j=0,k=b.length;k>j;j++)l=b.item(j),null===l.nodeName.match(/\:d|d\:/g)&&(g=a.getAttribute("d:"+l.nodeName),h=g&&"undefined"!==g?"null"===l.nodeValue?null:n[g]("false"===l.nodeValue?"":l.nodeValue):l.nodeValue,m["@"+l.nodeName]=h);break;case 3:d=a.parentNode.getAttribute("d:type"),h=d?n[d]("false"===a.nodeValue?"":a.nodeValue):a.nodeValue,m=h}if(a.hasChildNodes())for(j=0,k=a.childNodes.length;k>j;j++)if(e=a.childNodes.item(j),f=e.nodeName,b=a.attributes,"d:name"===f&&(f=e.getAttribute("d:name")),"#text"===f)g=a.getAttribute("d:constr"),"undefined"===g&&(g=void 0),i=e.textContent||e.text,h="Boolean"===g&&"false"===i?"":i,g||b.length?g&&1===k?m=n[g](h):a.hasChildNodes()&&b.length<3?m=g?n[g](h):h:m[f]=g?n[g](h):h:m=h;else{if(m[f]){m[f].push?m[f].push(c(e)):m[f]=[m[f],c(e)];continue}switch(g=e.getAttribute("d:constr")){case"null":m.push?m.push(null):m[f]=null;break;case"Array":e.parentNode.firstChild===e&&"Array"===g&&"d:item"!==f?"d:item"===f||"Array"===g?(h=c(e),m[f]=h.length?[h]:h):m[f]=c(e):m.push?m.push(c(e)):m[f]=c(e);break;case"String":case"Number":case"Boolean":i=e.textContent||e.text,h="Boolean"===g&&"false"===i?"":i,m.push?m.push(n[g](h)):m[f]=c(e);break;default:m.push?m.push(c(e)):m[f]=c(e)}}return 1===a.nodeType&&"ArrayItem"===a.getAttribute("d:type")&&(m=[m]),m},d=9===a.nodeType?a.documentElement:a,e=c(d),f=e[d.nodeName];return d===d.ownerDocument.documentElement&&f&&f.constructor===Array&&(e=f),b&&"true"===b.toString()&&(b=" "),b?JSON.stringify(e,null,b):e},"undefined"!=typeof jQuery&&!function(a){"use strict";a.fn.defiant=function(a,b){return this.html(Defiant.render(a,b)),this}}(jQuery); \ No newline at end of file diff --git a/js/defiant-js/defiant-latest.js b/js/defiant.js similarity index 100% rename from js/defiant-js/defiant-latest.js rename to js/defiant.js diff --git a/js/min/defiant.js b/js/min/defiant.js new file mode 100644 index 0000000..5762e0e --- /dev/null +++ b/js/min/defiant.js @@ -0,0 +1 @@ +if("undefined"==typeof module)var module={exports:void 0};if(module.exports=Defiant=function(t,e){"use strict";var r={is_ie:/msie/i.test(navigator.userAgent),is_safari:/safari/i.test(navigator.userAgent),env:"production",xml_decl:'',namespace:'xmlns:d="defiant-namespace"',tabsize:4,render:function(t,e){var r,n,a,s,i=new XSLTProcessor,o=document.createElement("span"),l={match:"/"};switch(typeof t){case"object":this.extend(l,t),l.data||(l.data=e);break;case"string":l.template=t,l.data=e;break;default:throw"error"}if(l.data=JSON.toXML(l.data),r='//xsl:template[@name="'+l.template+'"]',this.xsl_template||this.gatherTemplates(),l.sorter&&(s=this.node.selectSingleNode(this.xsl_template,r+"//xsl:for-each//xsl:sort"),s&&(l.sorter.order&&s.setAttribute("order",l.sorter.order),l.sorter.select&&s.setAttribute("select",l.sorter.select),s.setAttribute("data-type",l.sorter.type||"text"))),a=this.node.selectSingleNode(this.xsl_template,r),a.setAttribute("match",l.match),i.importStylesheet(this.xsl_template),o.appendChild(i.transformToFragment(l.data,document)),a.removeAttribute("match"),this.is_safari){n=o.getElementsByTagName("script");for(var c=0,u=n.length;u>c;c++)n[c].defer=!0}return o.innerHTML},gatherTemplates:function(){for(var t=document.getElementsByTagName("script"),e="",r=0,n=t.length;n>r;r++)"defiant/xsl-template"===t[r].type&&(e+=t[r].innerHTML);this.xsl_template=this.xmlFromString('"+e.replace(/defiant:(\w+)/g,"$1")+"")},getSnapshot:function(t){return JSON.toXML(t,!0)},xmlFromString:function(t){var e,r;return t=t.replace(/>\s{1,}<"),null===t.trim().match(/<\?xml/)&&(t=this.xml_decl+t),this.is_ie?(r=new ActiveXObject("Msxml2.DOMDocument"),r.loadXML(t),-1===t.indexOf("xsl:stylesheet")&&r.setProperty("SelectionLanguage","XPath")):(e=new DOMParser,r=e.parseFromString(t,"text/xml")),r},extend:function(t,e){for(var r in e)t[r]&&"object"==typeof e[r]?this.extend(t[r],e[r]):t[r]=e[r];return t},node:{}};return r}(this),"undefined"==typeof XSLTProcessor){var XSLTProcessor=function(){};XSLTProcessor.prototype={importStylesheet:function(t){this.xsldoc=t},transformToFragment:function(t,e){var r=t.transformNode(this.xsldoc),n=document.createElement("span");return n.innerHTML=r,n}}}String.prototype.fill||(String.prototype.fill=function(t,e){var r=this;for(e=e||" ";r.length/,rx_constructor:/<(.+?)( d:contr=".*?")>/,rx_namespace:/ xmlns\:d="defiant\-namespace"/,rx_data:/(<.+?>)(.*?)(<\/d:data>)/i,rx_function:/function (\w+)/i,to_xml:function(t){var e=this.hash_to_xml(null,t);return Defiant.xmlFromString(e)},hash_to_xml:function(t,e,r){var n,a,s,i,o,l,c,u,h=e.constructor===Array,d=[],m=[];for(n in e)if(a=e[n],null!==a&&void 0!==a&&"NaN"!==a.toString()||(a=null),i="@"===n.slice(0,1),o=r?t:n,o==+o&&e.constructor!==Object&&(o="d:item"),null===a?(l=null,c=!1):(l=a.constructor,c=l.toString().match(this.rx_function)[1]),i)m.push(o.slice(1)+'="'+this.escape_xml(a)+'"'),"String"!==c&&m.push("d:"+o.slice(1)+'="'+c+'"');else if(null===a)d.push(this.scalar_to_xml(o,a));else switch(l){case Function:break;case Object:d.push(this.hash_to_xml(o,a));break;case Array:if(n===o){if(s=a.constructor===Array)for(u=a.length;u--;)a[u].constructor===Array&&(s=!0),s||a[u].constructor!==Object||(s=!0);d.push(this.scalar_to_xml(o,a,s));break}case String:if("string"==typeof a&&(a=a.toString().replace(/\&/g,"&").replace(/\r|\n/g," ")),"#text"===o){this.map.push(e),m.push('d:mi="'+this.map.length+'"'),m.push('d:constr="'+c+'"'),d.push(this.escape_xml(a));break}case Number:case Boolean:if("#text"===o&&"String"!==c){this.map.push(e),m.push('d:mi="'+this.map.length+'"'),m.push('d:constr="'+c+'"'),d.push(this.escape_xml(a));break}d.push(this.scalar_to_xml(o,a))}return t||(t="d:data",m.push(Defiant.namespace),h&&m.push('d:constr="Array"')),null===t.match(this.rx_validate_name)&&(m.push('d:name="'+t+'"'),t="d:name"),r?d.join(""):(this.map.push(e),m.push('d:mi="'+this.map.length+'"'),"<"+t+(m.length?" "+m.join(" "):"")+(d.length?">"+d.join("")+"":"/>"))},scalar_to_xml:function(t,e,r){var n,a,s,i="";if(null===t.match(this.rx_validate_name)&&(i+=' d:name="'+t+'"',t="d:name",r=!1),null!==e&&"NaN"!==e.toString()||(e=null),null===e)return"<"+t+' d:constr="null"/>';if(1===e.length&&e[0].constructor===Object){n=this.hash_to_xml(!1,e[0]);var o=n.match(this.rx_node),l=n.match(this.rx_constructor);return o=null!==o?o[2].replace(this.rx_namespace,"").replace(/>/,"").replace(/"\/$/,'"'):"",l=null!==l?l[2]:"",n=n.match(this.rx_data),n=null!==n?n[2]:"","<"+t+o+" "+l+' d:type="ArrayItem">'+n+""}return 0===e.length&&e.constructor===Array?"<"+t+' d:constr="Array"/>':r?this.hash_to_xml(t,e,!0):(a=e.constructor,s=a.toString().match(this.rx_function)[1],n=a===Array?this.hash_to_xml("d:item",e,!0):this.escape_xml(e),i+=' d:constr="'+s+'"',this.map.push(e),i+=' d:mi="'+this.map.length+'"',"#text"===t?this.escape_xml(e):"<"+t+i+">"+n+"")},escape_xml:function(t){return String(t).replace(//g,">").replace(/"/g,""").replace(/ /g," ")}},n=r.to_xml.call(r,t);return e?{doc:n,src:t,map:r.map}:(this.search.map=r.map,n)}),JSON.search||(JSON.search=function(t,e,r){"use strict";var n,a,s=t.doc&&t.doc.nodeType,i=s?t.doc:JSON.toXML(t),o=s?t.map:this.search.map,l=s?t.src:t,c=Defiant.node[r?"selectSingleNode":"selectNodes"](i,e.xTransform()),u=[];for(r&&(c=[c]),a=c.length;a--;)switch(c[a].nodeType){case 2:case 3:u.unshift(c[a].nodeValue);break;default:n=+c[a].getAttribute("d:mi"),o[n-1]&&u.unshift(o[n-1])}return"development"===Defiant.env&&(this.trace=JSON.mtrace(l,u,c)),u}),JSON.mtrace||(JSON.mtrace=function(t,e,r){"use strict";for(var n,a,s,i,o,l=window,c=JSON.stringify,u=c(t,null," ").replace(/\t/g,""),h=[],d=0,m=r.length,p=m?r[d].ownerDocument.documentElement:!1,f=(this.search.map,0);m>d;d++){switch(r[d].nodeType){case 2:a=r[d].ownerElement?r[d].ownerElement.getAttribute("d:"+r[d].nodeName):"String",n='"@'+r[d].nodeName+'": '+l[a](e[d]),s=u.indexOf(n),o=0;break;case 3:a=r[d].parentNode.getAttribute("d:constr"),n=l[a](e[d]),n='"'+r[d].parentNode.nodeName+'": '+("Number"===n?n:'"'+n+'"'),s=u.indexOf(n),o=0;break;default:if(r[d]===p)continue;"String"===r[d].getAttribute("d:constr")?(a=r[d].getAttribute("d:constr"),n=l[a](e[d]),n='"'+r[d].nodeName+'": '+("Number"===n?n:'"'+n+'"'),s=u.indexOf(n,f),o=0,f=s+1):(n=c(e[d],null," ").replace(/\t/g,""),s=u.indexOf(n),o=n.match(/\n/g).length)}i=u.substring(0,s).match(/\n/g).length+1,h.push([i,o])}return h}),Defiant.node.selectNodes=function(t,e){if(t.evaluate){for(var r=t.createNSResolver(t.documentElement),n=t.evaluate(e,t,r,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),a=[],s=0,i=n.snapshotLength;i>s;s++)a.push(n.snapshotItem(s));return a}return t.selectNodes(e)},Defiant.node.selectSingleNode=function(t,e){if(t.evaluate){var r=this.selectNodes(t,e);return r.length>0?r[0]:null}return t.selectSingleNode(e)},Defiant.node.prettyPrint=function(t){var e,r,n=Defiant,a=n.tabsize,s=n.xml_decl.toLowerCase();n.is_ie?r=t.xml:(e=new XMLSerializer,r=e.serializeToString(t)),"development"!==n.env&&(r=r.replace(/ \w+\:d=".*?"| d\:\w+=".*?"/g,""));for(var i,o,l=r.trim().replace(/(>)\s*(<)(\/*)/g,"$1\n$2$3"),c=l.split("\n"),u=-1,h=0,d=c.length;d>h;h++)0===h&&c[h].toLowerCase()===s||(i=null!==c[h].match(/<[A-Za-z_\:]+.*?>/g),o=null!==c[h].match(/<\/[\w\:]+>/g),null!==c[h].match(/<.*?\/>/g)&&(i=o=!0),i&&u++,c[h]=String().fill(u," ")+c[h],i&&o&&u--,!i&&o&&u--);return c.join("\n").replace(/\t/g,String().fill(a," "))},Defiant.node.toJSON=function(t,e){"use strict";var r=function(t){var e,n,a,s,i,o,l,c,u,h,d={},m=window;switch(t.nodeType){case 1:for(i=t.getAttribute("d:constr"),"Array"===i?d=[]:"String"===i&&""===t.textContent&&(d=""),e=t.attributes,c=0,u=e.length;u>c;c++)h=e.item(c),null===h.nodeName.match(/\:d|d\:/g)&&(i=t.getAttribute("d:"+h.nodeName),o=i&&"undefined"!==i?"null"===h.nodeValue?null:m[i]("false"===h.nodeValue?"":h.nodeValue):h.nodeValue,d["@"+h.nodeName]=o);break;case 3:n=t.parentNode.getAttribute("d:type"),o=n?m[n]("false"===t.nodeValue?"":t.nodeValue):t.nodeValue,d=o}if(t.hasChildNodes())for(c=0,u=t.childNodes.length;u>c;c++)if(a=t.childNodes.item(c),s=a.nodeName,e=t.attributes,"d:name"===s&&(s=a.getAttribute("d:name")),"#text"===s)i=t.getAttribute("d:constr"),"undefined"===i&&(i=void 0),l=a.textContent||a.text,o="Boolean"===i&&"false"===l?"":l,i||e.length?i&&1===u?d=m[i](o):t.hasChildNodes()&&e.length<3?d=i?m[i](o):o:d[s]=i?m[i](o):o:d=o;else{if(d[s]){d[s].push?d[s].push(r(a)):d[s]=[d[s],r(a)];continue}switch(i=a.getAttribute("d:constr")){case"null":d.push?d.push(null):d[s]=null;break;case"Array":a.parentNode.firstChild===a&&"Array"===i&&"d:item"!==s?"d:item"===s||"Array"===i?(o=r(a),d[s]=o.length?[o]:o):d[s]=r(a):d.push?d.push(r(a)):d[s]=r(a);break;case"String":case"Number":case"Boolean":l=a.textContent||a.text,o="Boolean"===i&&"false"===l?"":l,d.push?d.push(m[i](o)):d[s]=r(a);break;default:d.push?d.push(r(a)):d[s]=r(a)}}return 1===t.nodeType&&"ArrayItem"===t.getAttribute("d:type")&&(d=[d]),d},n=9===t.nodeType?t.documentElement:t,a=r(n),s=a[n.nodeName];return n===n.ownerDocument.documentElement&&s&&s.constructor===Array&&(a=s),e&&"true"===e.toString()&&(e=" "),e?JSON.stringify(a,null,e):a},"undefined"!=typeof jQuery&&!function(t){"use strict";t.fn.defiant=function(t,e){return this.html(Defiant.render(t,e)),this}}(jQuery); \ No newline at end of file diff --git a/view/index.php b/view/index.php index 4443340..81847e4 100644 --- a/view/index.php +++ b/view/index.php @@ -139,7 +139,7 @@ catch (PDOException $ex) {} - +