[DeviceHome] Don't download library from not manageable CDN 08/264908/1
authorYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 5 Oct 2021 01:22:41 +0000 (18:22 -0700)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 5 Oct 2021 01:27:14 +0000 (18:27 -0700)
The mustache library CDN can't be manageable by Samsung.
So, we can't deal with any network issue of the library repository.

It's safer to keep it in local resource because it's only 6.38KB.

Change-Id: I420c74e68e2ade3424245f66bd99abc11c5ed695
Signed-off-by: Youngsoo Choi <kenshin.choi@samsung.com>
device_home/client/client.html
device_home/client/js/lib/mustache.js [new file with mode: 0644]

index 91f4fab..025676a 100755 (executable)
@@ -14,8 +14,8 @@
        <link rel="stylesheet" href="client/css/style.css" />
        <link rel="manifest" href="client/manifest.webmanifest">
        <link rel="shortcut icon" href="client/images/Icon.png">
-       <script src="https://unpkg.com/mustache@latest" onerror="error(this)"></script>
        <script src="http://taujs.org/1.2.9/mobile/js/tau.min.js" onerror="error(this)"></script>
+       <script src="client/js/lib/mustache.js"></script>
        <script src="client/js/clipping-storage.js" type="module"></script>
        <script src="client/js/app.js" type="module"></script>
        <script src="client/js/myApps.js" type="module"></script>
diff --git a/device_home/client/js/lib/mustache.js b/device_home/client/js/lib/mustache.js
new file mode 100644 (file)
index 0000000..4326b92
--- /dev/null
@@ -0,0 +1 @@
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Mustache=t()}(this,function(){"use strict";var e=Object.prototype.toString,t=Array.isArray||function(t){return"[object Array]"===e.call(t)};function n(e){return"function"==typeof e}function r(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function i(e,t){return null!=e&&"object"==typeof e&&t in e}var o=RegExp.prototype.test;var a=/\S/;function s(e){return!function(e,t){return o.call(e,t)}(a,e)}var c={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};var p=/\s*/,u=/\s+/,l=/\s*=/,h=/\s*\}/,f=/#|\^|\/|>|\{|&|=|!/;function g(e){this.string=e,this.tail=e,this.pos=0}function d(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function v(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}g.prototype.eos=function(){return""===this.tail},g.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},g.prototype.scanUntil=function(e){var t,n=this.tail.search(e);switch(n){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=t.length,t},d.prototype.push=function(e){return new d(e,this)},d.prototype.lookup=function(e){var t,r,o,a=this.cache;if(a.hasOwnProperty(e))t=a[e];else{for(var s,c,p,u=this,l=!1;u;){if(e.indexOf(".")>0)for(s=u.view,c=e.split("."),p=0;null!=s&&p<c.length;)p===c.length-1&&(l=i(s,c[p])||(r=s,o=c[p],null!=r&&"object"!=typeof r&&r.hasOwnProperty&&r.hasOwnProperty(o))),s=s[c[p++]];else s=u.view[e],l=i(u.view,e);if(l){t=s;break}u=u.parent}a[e]=t}return n(t)&&(t=t.call(this.view)),t},v.prototype.clearCache=function(){void 0!==this.templateCache&&this.templateCache.clear()},v.prototype.parse=function(e,n){var i=this.templateCache,o=e+":"+(n||y.tags).join(":"),a=void 0!==i,c=a?i.get(o):void 0;return null==c&&(c=function(e,n){if(!e)return[];var i,o,a,c=!1,d=[],v=[],w=[],m=!1,b=!1,C="",k=0;function x(){if(m&&!b)for(;w.length;)delete v[w.pop()];else w=[];m=!1,b=!1}function E(e){if("string"==typeof e&&(e=e.split(u,2)),!t(e)||2!==e.length)throw new Error("Invalid tags: "+e);i=new RegExp(r(e[0])+"\\s*"),o=new RegExp("\\s*"+r(e[1])),a=new RegExp("\\s*"+r("}"+e[1]))}E(n||y.tags);for(var T,j,U,S,P,V,O=new g(e);!O.eos();){if(T=O.pos,U=O.scanUntil(i))for(var A=0,I=U.length;A<I;++A)s(S=U.charAt(A))?(w.push(v.length),C+=S):(b=!0,c=!0,C+=" "),v.push(["text",S,T,T+1]),T+=1,"\n"===S&&(x(),C="",k=0,c=!1);if(!O.scan(i))break;if(m=!0,j=O.scan(f)||"name",O.scan(p),"="===j?(U=O.scanUntil(l),O.scan(l),O.scanUntil(o)):"{"===j?(U=O.scanUntil(a),O.scan(h),O.scanUntil(o),j="&"):U=O.scanUntil(o),!O.scan(o))throw new Error("Unclosed tag at "+O.pos);if(P=">"==j?[j,U,T,O.pos,C,k,c]:[j,U,T,O.pos],k++,v.push(P),"#"===j||"^"===j)d.push(P);else if("/"===j){if(!(V=d.pop()))throw new Error('Unopened section "'+U+'" at '+T);if(V[1]!==U)throw new Error('Unclosed section "'+V[1]+'" at '+T)}else"name"===j||"{"===j||"&"===j?b=!0:"="===j&&E(U)}if(x(),V=d.pop())throw new Error('Unclosed section "'+V[1]+'" at '+O.pos);return function(e){for(var t,n=[],r=n,i=[],o=0,a=e.length;o<a;++o)switch((t=e[o])[0]){case"#":case"^":r.push(t),i.push(t),r=t[4]=[];break;case"/":i.pop()[5]=t[2],r=i.length>0?i[i.length-1][4]:n;break;default:r.push(t)}return n}(function(e){for(var t,n,r=[],i=0,o=e.length;i<o;++i)(t=e[i])&&("text"===t[0]&&n&&"text"===n[0]?(n[1]+=t[1],n[3]=t[3]):(r.push(t),n=t));return r}(v))}(e,n),a&&i.set(o,c)),c},v.prototype.render=function(e,t,n,r){var i=this.getConfigTags(r),o=this.parse(e,i),a=t instanceof d?t:new d(t,void 0);return this.renderTokens(o,a,n,e,r)},v.prototype.renderTokens=function(e,t,n,r,i){for(var o,a,s,c="",p=0,u=e.length;p<u;++p)s=void 0,"#"===(a=(o=e[p])[0])?s=this.renderSection(o,t,n,r,i):"^"===a?s=this.renderInverted(o,t,n,r,i):">"===a?s=this.renderPartial(o,t,n,i):"&"===a?s=this.unescapedValue(o,t):"name"===a?s=this.escapedValue(o,t,i):"text"===a&&(s=this.rawValue(o)),void 0!==s&&(c+=s);return c},v.prototype.renderSection=function(e,r,i,o,a){var s=this,c="",p=r.lookup(e[1]);if(p){if(t(p))for(var u=0,l=p.length;u<l;++u)c+=this.renderTokens(e[4],r.push(p[u]),i,o,a);else if("object"==typeof p||"string"==typeof p||"number"==typeof p)c+=this.renderTokens(e[4],r.push(p),i,o,a);else if(n(p)){if("string"!=typeof o)throw new Error("Cannot use higher-order sections without the original template");null!=(p=p.call(r.view,o.slice(e[3],e[5]),function(e){return s.render(e,r,i,a)}))&&(c+=p)}else c+=this.renderTokens(e[4],r,i,o,a);return c}},v.prototype.renderInverted=function(e,n,r,i,o){var a=n.lookup(e[1]);if(!a||t(a)&&0===a.length)return this.renderTokens(e[4],n,r,i,o)},v.prototype.indentPartial=function(e,t,n){for(var r=t.replace(/[^ \t]/g,""),i=e.split("\n"),o=0;o<i.length;o++)i[o].length&&(o>0||!n)&&(i[o]=r+i[o]);return i.join("\n")},v.prototype.renderPartial=function(e,t,r,i){if(r){var o=this.getConfigTags(i),a=n(r)?r(e[1]):r[e[1]];if(null!=a){var s=e[6],c=e[5],p=e[4],u=a;0==c&&p&&(u=this.indentPartial(a,p,s));var l=this.parse(u,o);return this.renderTokens(l,t,r,u,i)}}},v.prototype.unescapedValue=function(e,t){var n=t.lookup(e[1]);if(null!=n)return n},v.prototype.escapedValue=function(e,t,n){var r=this.getConfigEscape(n)||y.escape,i=t.lookup(e[1]);if(null!=i)return"number"==typeof i&&r===y.escape?String(i):r(i)},v.prototype.rawValue=function(e){return e[1]},v.prototype.getConfigTags=function(e){return t(e)?e:e&&"object"==typeof e?e.tags:void 0},v.prototype.getConfigEscape=function(e){return e&&"object"==typeof e&&!t(e)?e.escape:void 0};var y={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){w.templateCache=e},get templateCache(){return w.templateCache}},w=new v;return y.clearCache=function(){return w.clearCache()},y.parse=function(e,t){return w.parse(e,t)},y.render=function(e,n,r,i){if("string"!=typeof e)throw new TypeError('Invalid template! Template should be a "string" but "'+(t(o=e)?"array":typeof o)+'" was given as the first argument for mustache#render(template, view, partials)');var o;return w.render(e,n,r,i)},y.escape=function(e){return String(e).replace(/[&<>"'`=\/]/g,function(e){return c[e]})},y.Scanner=g,y.Context=d,y.Writer=v,y});
\ No newline at end of file