diff --git a/cmg/README.md b/cmg/README.md deleted file mode 100644 index a6daaaf..0000000 --- a/cmg/README.md +++ /dev/null @@ -1,16 +0,0 @@ -Push Messaging and Notification Sample -=== - -Learn more at http://www.chromestatus.com/feature/5416033485586432 and http://www.chromestatus.com/feature/5480344312610816 - -To use this sample please do the following: - -1. Create a project in the [Google Developer Console](https://console.developers.google.com) (detailed instructions are availabl at https://developer.android.com/google/gcm/gs.html) -1. Enable GCM support -1. Create a copy of [config.sample.js](config.sample.js) called config.js -1. Create a copy of [manifest.sample.json](manifest.sample.json) called manifest.json -1. Replace `<Your Public API Key ...>` in your new `config.js` file with your own API key from the Google Developer Console project -4. Replace `<Your Project Number ...>` in your new `manifest.json` with your own project number from the Google Developer Console project - -# Related Samples - Push messaging and notifications are built on [service workers](https://github.com/GoogleChrome/samples/tree/gh-pages/service-worker). diff --git a/cmg/analytics.js b/cmg/analytics.js deleted file mode 100644 index c2adf37..0000000 --- a/cmg/analytics.js +++ /dev/null @@ -1,46 +0,0 @@ -/* -This is provided from the sample as well. Its suppose to be from a live link, but i copied and pasted the code over. -*/ - -(function(){var aa=encodeURIComponent,f=window,n=Math;function Pc(a,b){return a.href=b} -var Qc="replace",q="data",m="match",ja="port",u="createElement",id="setAttribute",da="getTime",A="split",B="location",ra="hasOwnProperty",ma="hostname",ga="search",E="protocol",Ab="href",kd="action",G="apply",p="push",h="hash",pa="test",ha="slice",r="cookie",t="indexOf",ia="defaultValue",v="name",y="length",Ga="sendBeacon",z="prototype",la="clientWidth",jd="target",C="call",na="clientHeight",F="substring",oa="navigator",H="join",I="toLowerCase";var $c=function(a){this.w=a||[]};$c[z].set=function(a){this.w[a]=!0};$c[z].encode=function(){for(var a=[],b=0;b<this.w[y];b++)this.w[b]&&(a[n.floor(b/6)]=a[n.floor(b/6)]^1<<b%6);for(b=0;b<a[y];b++)a[b]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".charAt(a[b]||0);return a[H]("")+"~"};var vd=new $c;function J(a){vd.set(a)}var Nd=function(a,b){var c=new $c(Dd(a));c.set(b);a.set(Gd,c.w)},Td=function(a){a=Dd(a);a=new $c(a);for(var b=vd.w[ha](),c=0;c<a.w[y];c++)b[c]=b[c]||a.w[c];return(new $c(b)).encode()},Dd=function(a){a=a.get(Gd);ka(a)||(a=[]);return a};var ea=function(a){return"function"==typeof a},ka=function(a){return"[object Array]"==Object[z].toString[C](Object(a))},qa=function(a){return void 0!=a&&-1<(a.constructor+"")[t]("String")},D=function(a,b){return 0==a[t](b)},sa=function(a){return a?a[Qc](/^[\s\xa0]+|[\s\xa0]+$/g,""):""},ta=function(a){var b=M[u]("img");b.width=1;b.height=1;b.src=a;return b},ua=function(){},K=function(a){if(aa instanceof Function)return aa(a);J(28);return a},L=function(a,b,c,d){try{a.addEventListener?a.addEventListener(b, -c,!!d):a.attachEvent&&a.attachEvent("on"+b,c)}catch(e){J(27)}},wa=function(a,b){if(a){var c=M[u]("script");c.type="text/javascript";c.async=!0;c.src=a;b&&(c.id=b);var d=M.getElementsByTagName("script")[0];d.parentNode.insertBefore(c,d)}},Ud=function(){return"https:"==M[B][E]},xa=function(){var a=""+M[B][ma];return 0==a[t]("www.")?a[F](4):a},ya=function(a){var b=M.referrer;if(/^https?:\/\//i[pa](b)){if(a)return b;a="//"+M[B][ma];var c=b[t](a);if(5==c||6==c)if(a=b.charAt(c+a[y]),"/"==a||"?"==a||""== -a||":"==a)return;return b}},za=function(a,b){if(1==b[y]&&null!=b[0]&&"object"===typeof b[0])return b[0];for(var c={},d=n.min(a[y]+1,b[y]),e=0;e<d;e++)if("object"===typeof b[e]){for(var g in b[e])b[e][ra](g)&&(c[g]=b[e][g]);break}else e<a[y]&&(c[a[e]]=b[e]);return c};var ee=function(){this.keys=[];this.values={};this.m={}};ee[z].set=function(a,b,c){this.keys[p](a);c?this.m[":"+a]=b:this.values[":"+a]=b};ee[z].get=function(a){return this.m[ra](":"+a)?this.m[":"+a]:this.values[":"+a]};ee[z].map=function(a){for(var b=0;b<this.keys[y];b++){var c=this.keys[b],d=this.get(c);d&&a(c,d)}};var O=f,M=document,Mc=function(){for(var a=O[oa].userAgent+(M[r]?M[r]:"")+(M.referrer?M.referrer:""),b=a[y],c=O.history[y];0<c;)a+=c--^b++;return La(a)};var Aa=function(a){var b=O._gaUserPrefs;if(b&&b.ioo&&b.ioo()||a&&!0===O["ga-disable-"+a])return!0;try{var c=O.external;if(c&&c._gaUserPrefs&&"oo"==c._gaUserPrefs)return!0}catch(d){}return!1};var Ca=function(a){var b=[],c=M[r][A](";");a=new RegExp("^\\s*"+a+"=\\s*(.*?)\\s*$");for(var d=0;d<c[y];d++){var e=c[d][m](a);e&&b[p](e[1])}return b},zc=function(a,b,c,d,e,g){e=Aa(e)?!1:eb[pa](M[B][ma])||"/"==c&&vc[pa](d)?!1:!0;if(!e)return!1;b&&1200<b[y]&&(b=b[F](0,1200),J(24));c=a+"="+b+"; path="+c+"; ";g&&(c+="expires="+(new Date((new Date)[da]()+g)).toGMTString()+"; ");d&&"none"!=d&&(c+="domain="+d+";");d=M[r];M.cookie=c;if(!(d=d!=M[r]))a:{a=Ca(a);for(d=0;d<a[y];d++)if(b==a[d]){d=!0;break a}d= -!1}return d},Cc=function(a){return K(a)[Qc](/\(/g,"%28")[Qc](/\)/g,"%29")},vc=/^(www\.)?google(\.com?)?(\.[a-z]{2})?$/,eb=/(^|\.)doubleclick\.net$/i;var oc=function(){return(Ba||Ud()?"https:":"http:")+"//www.google-analytics.com"},Da=function(a){this.name="len";this.message=a+"-8192"},ba=function(a,b,c){c=c||ua;if(2036>=b[y])wc(a,b,c);else if(8192>=b[y])x(a,b,c)||wd(a,b,c)||wc(a,b,c);else throw ge("len",b[y]),new Da(b[y]);},wc=function(a,b,c){var d=ta(a+"?"+b);d.onload=d.onerror=function(){d.onload=null;d.onerror=null;c()}},wd=function(a,b,c){var d=O.XMLHttpRequest;if(!d)return!1;var e=new d;if(!("withCredentials"in e))return!1;e.open("POST", -a,!0);e.withCredentials=!0;e.setRequestHeader("Content-Type","text/plain");e.onreadystatechange=function(){4==e.readyState&&(c(),e=null)};e.send(b);return!0},x=function(a,b,c){if(!O[oa][Ga])return!1;2036>=b[y]&&(a+="?"+b,b="");return O[oa][Ga](a,b)?(c(),!0):!1},ge=function(a,b,c){1<=100*n.random()||Aa("?")||(a=["t=error","_e="+a,"_v=j36","sr=1"],b&&a[p]("_f="+b),c&&a[p]("_m="+K(c[F](0,100))),a[p]("aip=1"),a[p]("z="+fe()),wc(oc()+"/collect",a[H]("&"),ua))};var Ha=function(){this.t=[]};Ha[z].add=function(a){this.t[p](a)};Ha[z].D=function(a){try{for(var b=0;b<this.t[y];b++){var c=a.get(this.t[b]);c&&ea(c)&&c[C](O,a)}}catch(d){}b=a.get(Ia);b!=ua&&ea(b)&&(a.set(Ia,ua,!0),setTimeout(b,10))};function Ja(a){if(100!=a.get(Ka)&&La(P(a,Q))%1E4>=100*R(a,Ka))throw"abort";}function Ma(a){if(Aa(P(a,Na)))throw"abort";}function Oa(){var a=M[B][E];if("http:"!=a&&"https:"!=a)throw"abort";} -function Pa(a){try{O[oa][Ga]?J(42):O.XMLHttpRequest&&"withCredentials"in new O.XMLHttpRequest&&J(40)}catch(b){}a.set(ld,Td(a),!0);a.set(Ac,R(a,Ac)+1);var c=[];Qa.map(function(b,e){if(e.p){var g=a.get(b);void 0!=g&&g!=e[ia]&&("boolean"==typeof g&&(g*=1),c[p](e.p+"="+K(""+g)))}});c[p]("z="+Bd());a.set(Ra,c[H]("&"),!0)} -function Sa(a){var b=P(a,gd)||oc()+"/collect",c=P(a,fa);!c&&a.get(Vd)&&(c="beacon");if(c){var d=P(a,Ra),e=a.get(Ia),e=e||ua;"image"==c?wc(b,d,e):"xhr"==c&&wd(b,d,e)||"beacon"==c&&x(b,d,e)||ba(b,d,e)}else ba(b,P(a,Ra),a.get(Ia));a.set(Ia,ua,!0)}function Hc(a){var b=O.gaData;b&&(b.expId&&a.set(Nc,b.expId),b.expVar&&a.set(Oc,b.expVar))}function cd(){if(O[oa]&&"preview"==O[oa].loadPurpose)throw"abort";}function yd(a){var b=O.gaDevIds;ka(b)&&0!=b[y]&&a.set("&did",b[H](","),!0)} -function vb(a){if(!a.get(Na))throw"abort";};var hd=function(){return n.round(2147483647*n.random())},Bd=function(){try{var a=new Uint32Array(1);O.crypto.getRandomValues(a);return a[0]&2147483647}catch(b){return hd()}},fe=hd;function Ta(a){var b=R(a,Ua);500<=b&&J(15);var c=P(a,Va);if("transaction"!=c&&"item"!=c){var c=R(a,Wa),d=(new Date)[da](),e=R(a,Xa);0==e&&a.set(Xa,d);e=n.round(2*(d-e)/1E3);0<e&&(c=n.min(c+e,20),a.set(Xa,d));if(0>=c)throw"abort";a.set(Wa,--c)}a.set(Ua,++b)};var Ya=function(){this.data=new ee},Qa=new ee,Za=[];Ya[z].get=function(a){var b=$a(a),c=this[q].get(a);b&&void 0==c&&(c=ea(b[ia])?b[ia]():b[ia]);return b&&b.n?b.n(this,a,c):c};var P=function(a,b){var c=a.get(b);return void 0==c?"":""+c},R=function(a,b){var c=a.get(b);return void 0==c||""===c?0:1*c};Ya[z].set=function(a,b,c){if(a)if("object"==typeof a)for(var d in a)a[ra](d)&&ab(this,d,a[d],c);else ab(this,a,b,c)}; -var ab=function(a,b,c,d){if(void 0!=c)switch(b){case Na:wb[pa](c)}var e=$a(b);e&&e.o?e.o(a,b,c,d):a[q].set(b,c,d)},bb=function(a,b,c,d,e){this.name=a;this.p=b;this.n=d;this.o=e;this.defaultValue=c},$a=function(a){var b=Qa.get(a);if(!b)for(var c=0;c<Za[y];c++){var d=Za[c],e=d[0].exec(a);if(e){b=d[1](e);Qa.set(b[v],b);break}}return b},yc=function(a){var b;Qa.map(function(c,d){d.p==a&&(b=d)});return b&&b[v]},S=function(a,b,c,d,e){a=new bb(a,b,c,d,e);Qa.set(a[v],a);return a[v]},cb=function(a,b){Za[p]([new RegExp("^"+ -a+"$"),b])},T=function(a,b,c){return S(a,b,c,void 0,db)},db=function(){};var gb=qa(f.GoogleAnalyticsObject)&&sa(f.GoogleAnalyticsObject)||"ga",Ba=!1,he=S("_br"),hb=T("apiVersion","v"),ib=T("clientVersion","_v");S("anonymizeIp","aip");var jb=S("adSenseId","a"),Va=S("hitType","t"),Ia=S("hitCallback"),Ra=S("hitPayload");S("nonInteraction","ni");S("currencyCode","cu");S("dataSource","ds");var Vd=S("useBeacon",void 0,!1),fa=S("transport");S("sessionControl","sc","");S("sessionGroup","sg");S("queueTime","qt");var Ac=S("_s","_s");S("screenName","cd"); -var kb=S("location","dl",""),lb=S("referrer","dr"),mb=S("page","dp","");S("hostname","dh");var nb=S("language","ul"),ob=S("encoding","de");S("title","dt",function(){return M.title||void 0});cb("contentGroup([0-9]+)",function(a){return new bb(a[0],"cg"+a[1])});var pb=S("screenColors","sd"),qb=S("screenResolution","sr"),rb=S("viewportSize","vp"),sb=S("javaEnabled","je"),tb=S("flashVersion","fl");S("campaignId","ci");S("campaignName","cn");S("campaignSource","cs");S("campaignMedium","cm"); -S("campaignKeyword","ck");S("campaignContent","cc");var ub=S("eventCategory","ec"),xb=S("eventAction","ea"),yb=S("eventLabel","el"),zb=S("eventValue","ev"),Bb=S("socialNetwork","sn"),Cb=S("socialAction","sa"),Db=S("socialTarget","st"),Eb=S("l1","plt"),Fb=S("l2","pdt"),Gb=S("l3","dns"),Hb=S("l4","rrt"),Ib=S("l5","srt"),Jb=S("l6","tcp"),Kb=S("l7","dit"),Lb=S("l8","clt"),Mb=S("timingCategory","utc"),Nb=S("timingVar","utv"),Ob=S("timingLabel","utl"),Pb=S("timingValue","utt");S("appName","an"); -S("appVersion","av","");S("appId","aid","");S("appInstallerId","aiid","");S("exDescription","exd");S("exFatal","exf");var Nc=S("expId","xid"),Oc=S("expVar","xvar"),Rc=S("_utma","_utma"),Sc=S("_utmz","_utmz"),Tc=S("_utmht","_utmht"),Ua=S("_hc",void 0,0),Xa=S("_ti",void 0,0),Wa=S("_to",void 0,20);cb("dimension([0-9]+)",function(a){return new bb(a[0],"cd"+a[1])});cb("metric([0-9]+)",function(a){return new bb(a[0],"cm"+a[1])});S("linkerParam",void 0,void 0,Bc,db);var ld=S("usage","_u"),Gd=S("_um"); -S("forceSSL",void 0,void 0,function(){return Ba},function(a,b,c){J(34);Ba=!!c});var ed=S("_j1","jid");cb("\\&(.*)",function(a){var b=new bb(a[0],a[1]),c=yc(a[0][F](1));c&&(b.n=function(a){return a.get(c)},b.o=function(a,b,g,ca){a.set(c,g,ca)},b.p=void 0);return b}); -var Qb=T("_oot"),dd=S("previewTask"),Rb=S("checkProtocolTask"),md=S("validationTask"),Sb=S("checkStorageTask"),Uc=S("historyImportTask"),Tb=S("samplerTask"),Vb=S("_rlt"),Wb=S("buildHitTask"),Xb=S("sendHitTask"),Vc=S("ceTask"),zd=S("devIdTask"),Cd=S("timingTask"),Ld=S("displayFeaturesTask"),V=T("name"),Q=T("clientId","cid"),Ad=S("userId","uid"),Na=T("trackingId","tid"),U=T("cookieName",void 0,"_ga"),W=T("cookieDomain"),Yb=T("cookiePath",void 0,"/"),Zb=T("cookieExpires",void 0,63072E3),$b=T("legacyCookieDomain"), -Wc=T("legacyHistoryImport",void 0,!0),ac=T("storage",void 0,"cookie"),bc=T("allowLinker",void 0,!1),cc=T("allowAnchor",void 0,!0),Ka=T("sampleRate","sf",100),dc=T("siteSpeedSampleRate",void 0,1),ec=T("alwaysSendReferrer",void 0,!1),gd=S("transportUrl"),Md=S("_r","_r");function X(a,b,c,d){b[a]=function(){try{return d&&J(d),c[G](this,arguments)}catch(b){throw ge("exc",a,b&&b[v]),b;}}};var Od=function(a,b,c){this.V=1E4;this.fa=a;this.$=!1;this.B=b;this.ea=c||1},Ed=function(a,b){var c;if(a.fa&&a.$)return 0;a.$=!0;if(b){if(a.B&&R(b,a.B))return R(b,a.B);if(0==b.get(dc))return 0}if(0==a.V)return 0;void 0===c&&(c=Bd());return 0==c%a.V?n.floor(c/a.V)%a.ea+1:0};var ie=new Od(!0,he,7),je=function(a){if(!Ud()&&!Ba){var b=Ed(ie,a);if(b&&!(!O[oa][Ga]&&4<=b&&6>=b)){var c=(new Date).getHours(),d=[Bd(),Bd(),Bd()][H](".");a=(3==b||5==b?"https:":"http:")+"//www.google-analytics.com/collect?z=br.";a+=[b,"A",c,d][H](".");var e=1!=b%3?"https:":"http:",e=e+"//www.google-analytics.com/collect?z=br.",e=e+[b,"B",c,d][H](".");7==b&&(e=e[Qc]("//www.","//ssl."));c=function(){4<=b&&6>=b?O[oa][Ga](e,""):ta(e)};Bd()%2?(ta(a),c()):(c(),ta(a))}}};function fc(){var a,b,c;if((c=(c=O[oa])?c.plugins:null)&&c[y])for(var d=0;d<c[y]&&!b;d++){var e=c[d];-1<e[v][t]("Shockwave Flash")&&(b=e.description)}if(!b)try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"),b=a.GetVariable("$version")}catch(g){}if(!b)try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"),b="WIN 6,0,21,0",a.AllowScriptAccess="always",b=a.GetVariable("$version")}catch(ca){}if(!b)try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"),b=a.GetVariable("$version")}catch(l){}b&& -(a=b[m](/[\d]+/g))&&3<=a[y]&&(b=a[0]+"."+a[1]+" r"+a[2]);return b||void 0};var gc=function(a,b){var c=n.min(R(a,dc),100);if(!(La(P(a,Q))%100>=c)&&(c={},Ec(c)||Fc(c))){var d=c[Eb];void 0==d||Infinity==d||isNaN(d)||(0<d?(Y(c,Gb),Y(c,Jb),Y(c,Ib),Y(c,Fb),Y(c,Hb),Y(c,Kb),Y(c,Lb),b(c)):L(O,"load",function(){gc(a,b)},!1))}},Ec=function(a){var b=O.performance||O.webkitPerformance,b=b&&b.timing;if(!b)return!1;var c=b.navigationStart;if(0==c)return!1;a[Eb]=b.loadEventStart-c;a[Gb]=b.domainLookupEnd-b.domainLookupStart;a[Jb]=b.connectEnd-b.connectStart;a[Ib]=b.responseStart-b.requestStart; -a[Fb]=b.responseEnd-b.responseStart;a[Hb]=b.fetchStart-c;a[Kb]=b.domInteractive-c;a[Lb]=b.domContentLoadedEventStart-c;return!0},Fc=function(a){if(O.top!=O)return!1;var b=O.external,c=b&&b.onloadT;b&&!b.isValidLoadTime&&(c=void 0);2147483648<c&&(c=void 0);0<c&&b.setPageReadyTime();if(void 0==c)return!1;a[Eb]=c;return!0},Y=function(a,b){var c=a[b];if(isNaN(c)||Infinity==c||0>c)a[b]=void 0},Fd=function(a){return function(b){"pageview"!=b.get(Va)||a.I||(a.I=!0,gc(b,function(b){a.send("timing",b)}))}};var hc=!1,mc=function(a){if("cookie"==P(a,ac)){var b=P(a,U),c=nd(a),d=kc(P(a,Yb)),e=lc(P(a,W)),g=1E3*R(a,Zb),ca=P(a,Na);if("auto"!=e)zc(b,c,d,e,ca,g)&&(hc=!0);else{J(32);var l;a:{c=[];e=xa()[A](".");if(4==e[y]&&(l=e[e[y]-1],parseInt(l,10)==l)){l=["none"];break a}for(l=e[y]-2;0<=l;l--)c[p](e[ha](l)[H]("."));c[p]("none");l=c}for(var k=0;k<l[y];k++)if(e=l[k],a[q].set(W,e),c=nd(a),zc(b,c,d,e,ca,g)){hc=!0;return}a[q].set(W,"auto")}}},nc=function(a){if("cookie"==P(a,ac)&&!hc&&(mc(a),!hc))throw"abort";}, -Yc=function(a){if(a.get(Wc)){var b=P(a,W),c=P(a,$b)||xa(),d=Xc("__utma",c,b);d&&(J(19),a.set(Tc,(new Date)[da](),!0),a.set(Rc,d.R),(b=Xc("__utmz",c,b))&&d[h]==b[h]&&a.set(Sc,b.R))}},nd=function(a){var b=Cc(P(a,Q)),c=ic(P(a,W));a=jc(P(a,Yb));1<a&&(c+="-"+a);return["GA1",c,b][H](".")},Gc=function(a,b,c){for(var d=[],e=[],g,ca=0;ca<a[y];ca++){var l=a[ca];if(l.r[c]==b)d[p](l);else void 0==g||l.r[c]<g?(e=[l],g=l.r[c]):l.r[c]==g&&e[p](l)}return 0<d[y]?d:e},lc=function(a){return 0==a[t](".")?a.substr(1): -a},ic=function(a){return lc(a)[A](".")[y]},kc=function(a){if(!a)return"/";1<a[y]&&a.lastIndexOf("/")==a[y]-1&&(a=a.substr(0,a[y]-1));0!=a[t]("/")&&(a="/"+a);return a},jc=function(a){a=kc(a);return"/"==a?1:a[A]("/")[y]};function Xc(a,b,c){"none"==b&&(b="");var d=[],e=Ca(a);a="__utma"==a?6:2;for(var g=0;g<e[y];g++){var ca=(""+e[g])[A](".");ca[y]>=a&&d[p]({hash:ca[0],R:e[g],O:ca})}return 0==d[y]?void 0:1==d[y]?d[0]:Zc(b,d)||Zc(c,d)||Zc(null,d)||d[0]}function Zc(a,b){var c,d;null==a?c=d=1:(c=La(a),d=La(D(a,".")?a[F](1):"."+a));for(var e=0;e<b[y];e++)if(b[e][h]==c||b[e][h]==d)return b[e]};var od=new RegExp(/^https?:\/\/([^\/:]+)/),pd=/(.*)([?&#])(?:_ga=[^&#]*)(?:&?)(.*)/;function Bc(a){a=a.get(Q);var b=Ic(a,0);return"_ga=1."+K(b+"."+a)}function Ic(a,b){for(var c=new Date,d=O[oa],e=d.plugins||[],c=[a,d.userAgent,c.getTimezoneOffset(),c.getYear(),c.getDate(),c.getHours(),c.getMinutes()+b],d=0;d<e[y];++d)c[p](e[d].description);return La(c[H]("."))}var Dc=function(a){J(48);this.target=a;this.T=!1}; -Dc[z].Q=function(a,b){if(a.tagName){if("a"==a.tagName[I]()){a[Ab]&&Pc(a,qd(this,a[Ab],b));return}if("form"==a.tagName[I]())return rd(this,a)}if("string"==typeof a)return qd(this,a,b)}; -var qd=function(a,b,c){var d=pd.exec(b);d&&3<=d[y]&&(b=d[1]+(d[3]?d[2]+d[3]:""));a=a[jd].get("linkerParam");var e=b[t]("?"),d=b[t]("#");c?b+=(-1==d?"#":"&")+a:(c=-1==e?"?":"&",b=-1==d?b+(c+a):b[F](0,d)+c+a+b[F](d));return b},rd=function(a,b){if(b&&b[kd]){var c=a[jd].get("linkerParam")[A]("=")[1];if("get"==b.method[I]()){for(var d=b.childNodes||[],e=0;e<d[y];e++)if("_ga"==d[e][v]){d[e][id]("value",c);return}d=M[u]("input");d[id]("type","hidden");d[id]("name","_ga");d[id]("value",c);b.appendChild(d)}else"post"== -b.method[I]()&&(b.action=qd(a,b[kd]))}}; -Dc[z].S=function(a,b,c){function d(c){try{c=c||O.event;var d;a:{var g=c[jd]||c.srcElement;for(c=100;g&&0<c;){if(g[Ab]&&g.nodeName[m](/^a(?:rea)?$/i)){d=g;break a}g=g.parentNode;c--}d={}}("http:"==d[E]||"https:"==d[E])&&sd(a,d[ma]||"")&&d[Ab]&&Pc(d,qd(e,d[Ab],b))}catch(w){J(26)}}var e=this;this.T||(this.T=!0,L(M,"mousedown",d,!1),L(M,"touchstart",d,!1),L(M,"keyup",d,!1));if(c){c=function(b){b=b||O.event;if((b=b[jd]||b.srcElement)&&b[kd]){var c=b[kd][m](od);c&&sd(a,c[1])&&rd(e,b)}};for(var g=0;g<M.forms[y];g++)L(M.forms[g], -"submit",c)}};function sd(a,b){if(b==M[B][ma])return!1;for(var c=0;c<a[y];c++)if(a[c]instanceof RegExp){if(a[c][pa](b))return!0}else if(0<=b[t](a[c]))return!0;return!1};var Jd=function(a,b,c){this.U=ed;this.aa=b;(b=c)||(b=(b=P(a,V))&&"t0"!=b?Wd[pa](b)?"_gat_"+Cc(P(a,Na)):"_gat_"+Cc(b):"_gat");this.Y=b},Rd=function(a,b){var c=b.get(Wb);b.set(Wb,function(b){Pd(a,b);var d=c(b);Qd(a,b);return d});var d=b.get(Xb);b.set(Xb,function(b){var c=d(b);Id(a,b);return c})},Pd=function(a,b){b.get(a.U)||("1"==Ca(a.Y)[0]?b.set(a.U,"",!0):b.set(a.U,""+fe(),!0))},Qd=function(a,b){b.get(a.U)&&zc(a.Y,"1",b.get(Yb),b.get(W),b.get(Na),6E5)},Id=function(a,b){if(b.get(a.U)){var c=new ee, -d=function(a){$a(a).p&&c.set($a(a).p,b.get(a))};d(hb);d(ib);d(Na);d(Q);d(a.U);c.set($a(ld).p,Td(b));var e=a.aa;c.map(function(a,b){e+=K(a)+"=";e+=K(""+b)+"&"});e+="z="+fe();ta(e);b.set(a.U,"",!0)}},Wd=/^gtm\d+$/;var fd=function(a,b){var c=a.b;if(!c.get("dcLoaded")){Nd(c,29);b=b||{};var d;b[U]&&(d=Cc(b[U]));d=new Jd(c,"https://stats.g.doubleclick.net/r/collect?t=dc&aip=1&_r=3&",d);Rd(d,c);c.set("dcLoaded",!0)}};var Sd=function(a){var b;b=a.get("dcLoaded")?!1:"cookie"!=a.get(ac)?!1:!0;b&&(Nd(a,51),b=new Jd(a),Pd(b,a),Qd(b,a),a.get(b.U)&&(a.set(Md,1,!0),a.set(gd,oc()+"/r/collect",!0)))};var Lc=function(){var a=O.gaGlobal=O.gaGlobal||{};return a.hid=a.hid||fe()};var ad,bd=function(a,b,c){if(!ad){var d;d=M[B][h];var e=O[v],g=/^#?gaso=([^&]*)/;if(e=(d=(d=d&&d[m](g)||e&&e[m](g))?d[1]:Ca("GASO")[0]||"")&&d[m](/^(?:!([-0-9a-z.]{1,40})!)?([-.\w]{10,1200})$/i))zc("GASO",""+d,c,b,a,0),f._udo||(f._udo=b),f._utcp||(f._utcp=c),a=e[1],wa("https://www.google.com/analytics/web/inpage/pub/inpage.js?"+(a?"prefix="+a+"&":"")+fe(),"_gasojs");ad=!0}};var wb=/^(UA|YT|MO|GP)-(\d+)-(\d+)$/,pc=function(a){function b(a,b){d.b[q].set(a,b)}function c(a,c){b(a,c);d.filters.add(a)}var d=this;this.b=new Ya;this.filters=new Ha;b(V,a[V]);b(Na,sa(a[Na]));b(U,a[U]);b(W,a[W]||xa());b(Yb,a[Yb]);b(Zb,a[Zb]);b($b,a[$b]);b(Wc,a[Wc]);b(bc,a[bc]);b(cc,a[cc]);b(Ka,a[Ka]);b(dc,a[dc]);b(ec,a[ec]);b(ac,a[ac]);b(Ad,a[Ad]);b(hb,1);b(ib,"j36");c(Qb,Ma);c(dd,cd);c(Rb,Oa);c(md,vb);c(Sb,nc);c(Uc,Yc);c(Tb,Ja);c(Vb,Ta);c(Vc,Hc);c(zd,yd);c(Ld,Sd);c(Wb,Pa);c(Xb,Sa);c(Cd,Fd(this)); -Jc(this.b,a[Q]);Kc(this.b);this.b.set(jb,Lc());bd(this.b.get(Na),this.b.get(W),this.b.get(Yb))},Jc=function(a,b){if("cookie"==P(a,ac)){hc=!1;var c;b:{var d=Ca(P(a,U));if(d&&!(1>d[y])){c=[];for(var e=0;e<d[y];e++){var g;g=d[e][A](".");var ca=g.shift();("GA1"==ca||"1"==ca)&&1<g[y]?(ca=g.shift()[A]("-"),1==ca[y]&&(ca[1]="1"),ca[0]*=1,ca[1]*=1,g={r:ca,s:g[H](".")}):g=void 0;g&&c[p](g)}if(1==c[y]){J(13);c=c[0].s;break b}if(0==c[y])J(12);else{J(14);d=ic(P(a,W));c=Gc(c,d,0);if(1==c[y]){c=c[0].s;break b}d= -jc(P(a,Yb));c=Gc(c,d,1);c=c[0]&&c[0].s;break b}}c=void 0}c||(c=P(a,W),d=P(a,$b)||xa(),c=Xc("__utma",d,c),void 0!=c?(J(10),c=c.O[1]+"."+c.O[2]):c=void 0);c&&(a[q].set(Q,c),hc=!0)}c=a.get(cc);if(e=(c=M[B][c?"href":"search"][m]("(?:&|#|\\?)"+K("_ga")[Qc](/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")+"=([^&#]*)"))&&2==c[y]?c[1]:"")a.get(bc)?(c=e[t]("."),-1==c?J(22):(d=e[F](c+1),"1"!=e[F](0,c)?J(22):(c=d[t]("."),-1==c?J(22):(e=d[F](0,c),c=d[F](c+1),e!=Ic(c,0)&&e!=Ic(c,-1)&&e!=Ic(c,-2)?J(23):(J(11),a[q].set(Q, -c)))))):J(21);b&&(J(9),a[q].set(Q,K(b)));a.get(Q)||((c=(c=O.gaGlobal&&O.gaGlobal.vid)&&-1!=c[ga](/^(?:utma\.)?\d+\.\d+$/)?c:void 0)?(J(17),a[q].set(Q,c)):(J(8),a[q].set(Q,[fe()^Mc()&2147483647,n.round((new Date)[da]()/1E3)][H]("."))));mc(a)},Kc=function(a){var b=O[oa],c=O.screen,d=M[B];a.set(lb,ya(a.get(ec)));if(d){var e=d.pathname||"";"/"!=e.charAt(0)&&(J(31),e="/"+e);a.set(kb,d[E]+"//"+d[ma]+e+d[ga])}c&&a.set(qb,c.width+"x"+c.height);c&&a.set(pb,c.colorDepth+"-bit");var c=M.documentElement,g=(e= -M.body)&&e[la]&&e[na],ca=[];c&&c[la]&&c[na]&&("CSS1Compat"===M.compatMode||!g)?ca=[c[la],c[na]]:g&&(ca=[e[la],e[na]]);c=0>=ca[0]||0>=ca[1]?"":ca[H]("x");a.set(rb,c);a.set(tb,fc());a.set(ob,M.characterSet||M.charset);a.set(sb,b&&"function"===typeof b.javaEnabled&&b.javaEnabled()||!1);a.set(nb,(b&&(b.language||b.browserLanguage)||"")[I]());if(d&&a.get(cc)&&(b=M[B][h])){b=b[A](/[?&#]+/);d=[];for(c=0;c<b[y];++c)(D(b[c],"utm_id")||D(b[c],"utm_campaign")||D(b[c],"utm_source")||D(b[c],"utm_medium")||D(b[c], -"utm_term")||D(b[c],"utm_content")||D(b[c],"gclid")||D(b[c],"dclid")||D(b[c],"gclsrc"))&&d[p](b[c]);0<d[y]&&(b="#"+d[H]("&"),a.set(kb,a.get(kb)+b))}};pc[z].get=function(a){return this.b.get(a)};pc[z].set=function(a,b){this.b.set(a,b)};var qc={pageview:[mb],event:[ub,xb,yb,zb],social:[Bb,Cb,Db],timing:[Mb,Nb,Pb,Ob]}; -pc[z].send=function(a){if(!(1>arguments[y])){var b,c;"string"===typeof arguments[0]?(b=arguments[0],c=[][ha][C](arguments,1)):(b=arguments[0]&&arguments[0][Va],c=arguments);b&&(c=za(qc[b]||[],c),c[Va]=b,this.b.set(c,void 0,!0),this.filters.D(this.b),this.b[q].m={},je(this.b))}};var rc=function(a){if("prerender"==M.visibilityState)return!1;a();return!0};var td=/^(?:(\w+)\.)?(?:(\w+):)?(\w+)$/,sc=function(a){if(ea(a[0]))this.u=a[0];else{var b=td.exec(a[0]);null!=b&&4==b[y]&&(this.c=b[1]||"t0",this.e=b[2]||"",this.d=b[3],this.a=[][ha][C](a,1),this.e||(this.A="create"==this.d,this.i="require"==this.d,this.g="provide"==this.d,this.ba="remove"==this.d),this.i&&(3<=this.a[y]?(this.X=this.a[1],this.W=this.a[2]):this.a[1]&&(qa(this.a[1])?this.X=this.a[1]:this.W=this.a[1])));b=a[1];a=a[2];if(!this.d)throw"abort";if(this.i&&(!qa(b)||""==b))throw"abort";if(this.g&& -(!qa(b)||""==b||!ea(a)))throw"abort";if(ud(this.c)||ud(this.e))throw"abort";if(this.g&&"t0"!=this.c)throw"abort";}};function ud(a){return 0<=a[t](".")||0<=a[t](":")};var Yd,Zd,$d;Yd=new ee;$d=new ee;Zd={ec:45,ecommerce:46,linkid:47}; -var ae=function(a){function b(a){var b=(a[ma]||"")[A](":")[0][I](),c=(a[E]||"")[I](),c=1*a[ja]||("http:"==c?80:"https:"==c?443:"");a=a.pathname||"";D(a,"/")||(a="/"+a);return[b,""+c,a]}var c=M[u]("a");Pc(c,M[B][Ab]);var d=(c[E]||"")[I](),e=b(c),g=c[ga]||"",ca=d+"//"+e[0]+(e[1]?":"+e[1]:"");D(a,"//")?a=d+a:D(a,"/")?a=ca+a:!a||D(a,"?")?a=ca+e[2]+(a||g):0>a[A]("/")[0][t](":")&&(a=ca+e[2][F](0,e[2].lastIndexOf("/"))+"/"+a);Pc(c,a);d=b(c);return{protocol:(c[E]||"")[I](),host:d[0],port:d[1],path:d[2],G:c[ga]|| -"",url:a||""}};var Z={ga:function(){Z.f=[]}};Z.ga();Z.D=function(a){var b=Z.J[G](Z,arguments),b=Z.f.concat(b);for(Z.f=[];0<b[y]&&!Z.v(b[0])&&!(b.shift(),0<Z.f[y]););Z.f=Z.f.concat(b)}; -Z.J=function(a){for(var b=[],c=0;c<arguments[y];c++)try{var d=new sc(arguments[c]);if(d.g)Yd.set(d.a[0],d.a[1]);else{if(d.i){var e=d,g=e.a[0];if(!ea(Yd.get(g))&&!$d.get(g)){Zd[ra](g)&&J(Zd[g]);var ca=e.X;!ca&&Zd[ra](g)?(J(39),ca=g+".js"):J(43);if(ca){ca&&0<=ca[t]("/")||(ca=(Ba||Ud()?"https:":"http:")+"//www.google-analytics.com/plugins/ua/"+ca);var l=ae(ca),e=void 0;var k=l[E],w=M[B][E],e="https:"==k||k==w?!0:"http:"!=k?!1:"http:"==w;var Xd;if(Xd=e){var e=l,be=ae(M[B][Ab]);if(e.G||0<=e.url[t]("?")|| -0<=e.path[t]("://"))Xd=!1;else if(e.host==be.host&&e[ja]==be[ja])Xd=!0;else{var ce="http:"==e[E]?80:443;Xd="www.google-analytics.com"==e.host&&(e[ja]||ce)==ce&&D(e.path,"/plugins/")?!0:!1}}Xd&&(wa(l.url),$d.set(g,!0))}}}b[p](d)}}catch(de){}return b}; -Z.v=function(a){try{if(a.u)a.u[C](O,N.j("t0"));else{var b=a.c==gb?N:N.j(a.c);if(a.A)"t0"==a.c&&N.create[G](N,a.a);else if(a.ba)N.remove(a.c);else if(b)if(a.i){var c;var d=a.a[0],e=a.W;b==N||b.get(V);var g=Yd.get(d);ea(g)?(b.plugins_=b.plugins_||new ee,b.plugins_.get(d)||b.plugins_.set(d,new g(b,e||{})),c=!0):c=!1;if(!c)return!0}else if(a.e){var ca=a.d,l=a.a,k=b.plugins_.get(a.e);k[ca][G](k,l)}else b[a.d][G](b,a.a)}}catch(w){}};var N=function(a){J(1);Z.D[G](Z,[arguments])};N.h={};N.P=[];N.L=0;N.answer=42;var uc=[Na,W,V];N.create=function(a){var b=za(uc,[][ha][C](arguments));b[V]||(b[V]="t0");var c=""+b[V];if(N.h[c])return N.h[c];b=new pc(b);N.h[c]=b;N.P[p](b);return b};N.remove=function(a){for(var b=0;b<N.P[y];b++)if(N.P[b].get(V)==a){N.P.splice(b,1);N.h[a]=null;break}};N.j=function(a){return N.h[a]};N.getAll=function(){return N.P[ha](0)}; -N.N=function(){"ga"!=gb&&J(49);var a=O[gb];if(!a||42!=a.answer){N.L=a&&a.l;N.loaded=!0;var b=O[gb]=N;X("create",b,b.create);X("remove",b,b.remove);X("getByName",b,b.j,5);X("getAll",b,b.getAll,6);b=pc[z];X("get",b,b.get,7);X("set",b,b.set,4);X("send",b,b.send);b=Ya[z];X("get",b,b.get);X("set",b,b.set);if(!Ud()&&!Ba){a:{for(var b=M.getElementsByTagName("script"),c=0;c<b[y]&&100>c;c++){var d=b[c].src;if(d&&0==d[t]("https://www.google-analytics.com/analytics")){J(33);b=!0;break a}}b=!1}b&&(Ba=!0)}Ud()|| -Ba||!Ed(new Od)||(J(36),Ba=!0);(O.gaplugins=O.gaplugins||{}).Linker=Dc;b=Dc[z];Yd.set("linker",Dc);X("decorate",b,b.Q,20);X("autoLink",b,b.S,25);Yd.set("displayfeatures",fd);Yd.set("adfeatures",fd);a=a&&a.q;ka(a)?Z.D[G](N,a):J(50)}};N.k=function(){for(var a=N.getAll(),b=0;b<a[y];b++)a[b].get(V)}; -(function(){var a=N.N;if(!rc(a)){J(16);var b=!1,c=function(){if(!b&&rc(a)){b=!0;var d=c,e=M;e.removeEventListener?e.removeEventListener("visibilitychange",d,!1):e.detachEvent&&e.detachEvent("onvisibilitychange",d)}};L(M,"visibilitychange",c)}})();function La(a){var b=1,c=0,d;if(a)for(b=0,d=a[y]-1;0<=d;d--)c=a.charCodeAt(d),b=(b<<6&268435455)+c+(c<<14),c=b&266338304,b=0!=c?b^c>>21:b;return b};})(window); \ No newline at end of file diff --git a/cmg/config.js b/cmg/config.js deleted file mode 100644 index 345b2ae..0000000 --- a/cmg/config.js +++ /dev/null @@ -1,8 +0,0 @@ -/* -This file sets up a global variable gcmAPIKey, which contains our key. -*/ - -window.GoogleSamples = window.GoogleSamples || {}; -window.GoogleSamples.Config = window.GoogleSamples.Config || { - gcmAPIKey: 'AIzaSyCPjkgseoVp8shXOMwFnGBeEijizpLDXOs' -}; diff --git a/cmg/demo.js b/cmg/demo.js deleted file mode 100644 index 520d8f2..0000000 --- a/cmg/demo.js +++ /dev/null @@ -1,29 +0,0 @@ -/* -This demo provides functionality that output debug messages. -*/ - -'use strict'; - -function Debug() { - -} - -Debug.prototype.log = function() { - var paragraphElement = document.createElement('p'); - paragraphElement.textContent = Array.prototype.join.call(arguments, ''); - document.querySelector('.js-log').appendChild(paragraphElement); -} - -window.addEventListener('load', function() { - var logDiv = document.createElement('div'); - logDiv.classList.add('js-log'); - - var heading = document.createElement('h2'); - heading.textContent = 'Log'; - logDiv.appendChild(heading); - - document.body.appendChild(logDiv); - - window.Demo = window.Demo || {}; - window.Demo.debug = window.Demo.debug || new Debug(); -}); diff --git a/cmg/images/icon-192x192.png b/cmg/images/icon-192x192.png deleted file mode 100644 index f6ba515101d3aed9289c2cfb93374548cb60f07a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1668 zcmV-~27CF5P)<h;3K|Lk000e1NJLTq006)M006)U0{{R3WdfWv0000mP)t-s0000o zao#d<-Y#s}F>l>6ao#a--7#_AGjiYm|NpVc^HGN6>+$@LvF*^__i~--cTM+D00008 zbW%=J0Hf*{JIP>!j`I|!000I1Nkl<Zc-rk<%aY_E3~LCGUS9eCzuhB;DeOc_;+<M_ zo}P-ZWQ6I*XJKJsVPRomVPRpx2*L5NCGe%;7XbzvPau9wu?T#fEdl@A2}GK}z6elo zG=a1TP}pe#VG*E^Xad`BCt#hY|9b-7n80>>ma|WDSwQ;@1nQqTvXJGB;O{12pXRzi z;HQN4Md0={mjwdH&n&kH+@9u|K%l&x<+fl;U`upXi)p)<<_>|twJ;joAjtF>7ak-a z{O35j6q|Hn+RmrBGJpPhn!vVuAnZxY>%t=hys-GgB;+n7mSMX>petE!EdGGIGb_7r zCQnlYf)i>4Do7}U5J#abH?%VlSOqC%@En1eb_N`)ph+2oGzVq55P?G{JaO<Y+(ck3 z{uGH*kWvOc&FNV#IC%iiDM%>;Pas8g_C+a3D}$8g^emTlPtAY%(ZBbX2tbH0Pkau5 zzylge4-k0u4#C||pu*$3cV~u0An=}s(gOtgn>T^(i{pL*@!hGjkmXQpuim`W`w8r? zUY~X$%YpE`f=YXhKr54D4W^(G5c0{LGz(cyMalI~qc!9v%i7z+1dcv73`RpjYdKMd z1`;T(&O=k66*Ss;0|^vGJ7T|bw1NhNGQb2{S3-xsML|*-^fV_KS65pA6eK@WE+m0r z+yO~Lyn>`M=xMHs#vR}_<OKx@WzYz8(YU&X60e}MWe^BVj0<RpR?tAr<qUx=8&}uc z#wzG^8LCQP7#GkGtRSrnO2L|JTwOyER?x7TQU;B{Fs=?kL!^TAGUPddVO&f@yn^&H z%m^HcarLenDFt09!=wV*;_K0A0~KTf@K_UM1@YiC#3_get)W0F$X-L7g6uWqSq0f^ z=s5-1Ysg+f{ISMO4tzGK`73BhSJ2>)tAT@CxqfRLgqhQuBziuuF|U)yeyzWvn^xe@ ztax?us;Y_CjRwblnxQ;Yh&ps5!UGE8ZOt$JKmrs*7lL2<0jDa6DFkm>9UGvaNBV1T z#}`2&6vX$}p_}pr5g`TX{gtyUuc0JYfVcIqED0ZGF5csp!YKmfOTnd0e#5@Q3z1Kr zvtY!1vi3+J@RLKvbR#T1QV8bcbMQ<5Kp{#!-$Dzp^caHkfPqz1e(6ayv9pUzJ^T}D zYQVe!*9~6?esocgrRNJV;ZT4WT7adek?00A&<(z+BzUy}@is`G$FO<60qOghe@;OW zXh47s;^!eapaC5fuz~w`44jqzns2rNGIgwqMlxdL@ScIY_;`AYEiV~)i$DYF!y|~1 z?Hf=TMY7({b|eAikuwk*m?wxT*NNZH_y*L^K39coV4NVjCN+IOvrQ01<jU`7e1f=S z&1z@l9Xi5PnJ&Md@eSx=XX((G!WlH6iKq*BKC?N()H3lrU;~pQOp}Vn?`M1ig5*%% zKcDU3459$K!}c@&2%|fge_^`&2m=pp4{+=r-kqTw!~mGz&-fWihp!O${fti#V-Z36 z`L6veO?3>!GGGU1Z4d+*^m7^jDp=?C@f&U6fu=bad~p}A41ggDP=x$dQL)#?4e;<B z8NYozrt*>C(5rxJUdBIc+(qg>Asd;yETazJCpT6;$h%h>`qeM(qI`B@AbM#jGk7JQ zfw$J&<z?*lz2Ne>-^<Dtut!BiwQ%y`y(~I7PWJSQ$>$j_OAZbb6&~lBKOi62%Wb;- z_^Eq(0p48skeBN;fz3puW(Pn%gqIIt37z&5K0EMUo&-oC+p5{Y{-+)S@KT}q(+Cm% zN+aNv_P==If$zJ*nm_Mly$SB7^3k^hy^BO+`3xlN{pA6ZkDZryVbBd^2M)lqL~+o; zX9qssDF~|e^z2~iWd{__8UJj8K1SO-kR5EcgrqkxzWMWTm#2UcX#N&n4%4au&ELSw zyW|{QKIUHb9|2zFYwzVG{<*b$^rM<noUddDdoOPaU;jXMxYNtKN>|Db_Fj%36;TkI zy_ds@KNYfrxtHCkatY1f66y3^s28ka>*aJ-Z=`$eseTp~78Vx%75oLQplz&$rPpx) O0000<MNUMnLSTYf6cA7V diff --git a/cmg/images/indexwrapper.js b/cmg/images/indexwrapper.js deleted file mode 100644 index 1e9e0f4..0000000 --- a/cmg/images/indexwrapper.js +++ /dev/null @@ -1,87 +0,0 @@ -'use strict'; - -function promisifyRequest(obj) { - return new Promise(function(resolve, reject) { - function onsuccess(event) { - resolve(obj.result); - unlisten(); - } - function onerror(event) { - reject(obj.error); - unlisten(); - } - function unlisten() { - obj.removeEventListener('complete', onsuccess); - obj.removeEventListener('success', onsuccess); - obj.removeEventListener('error', onerror); - obj.removeEventListener('abort', onerror); - } - obj.addEventListener('complete', onsuccess); - obj.addEventListener('success', onsuccess); - obj.addEventListener('error', onerror); - obj.addEventListener('abort', onerror); - }); -} - -function IndexDBWrapper(name, version, upgradeCallback) { - var request = indexedDB.open(name, version); - this.ready = promisifyRequest(request); - request.onupgradeneeded = function(event) { - upgradeCallback(request.result, event.oldVersion); - }; -} - -IndexDBWrapper.supported = 'indexedDB' in self; - -var IndexDBWrapperProto = IndexDBWrapper.prototype; - -IndexDBWrapperProto.transaction = function(stores, modeOrCallback, callback) { - return this.ready.then(function(db) { - var mode = 'readonly'; - - if (modeOrCallback.apply) { - callback = modeOrCallback; - } - else if (modeOrCallback) { - mode = modeOrCallback; - } - - var tx = db.transaction(stores, mode); - var val = callback(tx, db); - var promise = promisifyRequest(tx); - var readPromise; - - if (!val) { - return promise; - } - - if (val[0] && 'result' in val[0]) { - readPromise = Promise.all(val.map(promisifyRequest)); - } - else { - readPromise = promisifyRequest(val); - } - - return promise.then(function() { - return readPromise; - }); - }); -}; - -IndexDBWrapperProto.get = function(store, key) { - return this.transaction(store, function(tx) { - return tx.objectStore(store).get(key); - }); -}; - -IndexDBWrapperProto.put = function(store, key, value) { - return this.transaction(store, 'readwrite', function(tx) { - tx.objectStore(store).put(value, key); - }); -}; - -IndexDBWrapperProto.delete = function(store, key) { - return this.transaction(store, 'readwrite', function(tx) { - tx.objectStore(store).delete(key); - }); -}; \ No newline at end of file diff --git a/cmg/images/sample-serviceworker.js b/cmg/images/sample-serviceworker.js deleted file mode 100644 index d7f0db7..0000000 --- a/cmg/images/sample-serviceworker.js +++ /dev/null @@ -1,140 +0,0 @@ -'use strict'; - -importScripts('/scripts/indexdbwrapper.js'); - -var YAHOO_WEATHER_API_ENDPOINT = 'https://query.yahooapis.com/' + - 'v1/public/yql?q=select%20*%20from%20weather.forecast%20where%' + - '20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where' + - '%20text%3D%22london%2C%20uk%22)&format=json&env=store%3A%2F%2' + - 'Fdatatables.org%2Falltableswithkeys'; -var KEY_VALUE_STORE_NAME = 'key-value-store'; - -var idb; - -// avoid opening idb until first call -function getIdb() { - if (!idb) { - idb = new IndexDBWrapper('key-value-store', 1, function(db) { - db.createObjectStore(KEY_VALUE_STORE_NAME); - }); - } - return idb; -} - -function showNotification(title, body, icon, data) { - var notificationOptions = { - body: body, - icon: icon ? icon : 'images/touch/chrome-touch-icon-192x192.png', - tag: 'simple-push-demo-notification', - data: data - }; - if (self.registration.showNotification) { - self.registration.showNotification(title, notificationOptions); - return; - } else { - new Notification(title, notificationOptions); - } -} - -self.addEventListener('push', function(event) { - console.log('Received a push message', event); - - // Since this is no payload data with the first version - // of Push notifications, here we'll grab some data from - // an API and use it to populate a notification - event.waitUntil( - fetch(YAHOO_WEATHER_API_ENDPOINT).then(function(response) { - if (response.status !== 200) { - console.log('Looks like there was a problem. Status Code: ' + - response.status); - // Throw an error so the promise is rejected and catch() is executed - throw new Error(); - } - - // Examine the text in the response - return response.json().then(function(data) { - // console.log('Data = ', JSON.stringify(data)); - if (data.query.count === 0) { - // Throw an error so the promise is rejected and catch() is executed - throw new Error(); - } - - var title = 'What\'s the weather like in London?'; - var message = data.query.results.channel.item.condition.text; - var icon = data.query.results.channel.image.url || - 'images/touch/chrome-touch-icon-192x192.png'; - var notificationTag = 'simple-push-demo-notification'; - - // Add this to the data of the notification - var urlToOpen = data.query.results.channel.link; - - if (!Notification.prototype.hasOwnProperty('data')) { - // Since Chrome doesn't support data at the moment - // Store the URL in IndexDB - getIdb().put(KEY_VALUE_STORE_NAME, notificationTag, urlToOpen); - } - - var notificationFilter = { - tag: 'simple-push-demo-notification' - }; - - var notificationData = { - url: urlToOpen - }; - - if (self.registration.getNotifications) { - return self.registration.getNotifications(notificationFilter) - .then(function(notifications) { - if (notifications && notifications.length > 0) { - // Start with one to account for the new notification - // we are adding - var notificationCount = 1; - for (var i = 0; i < notifications.length; i++) { - var existingNotification = notifications[i]; - if (existingNotification.data && - existingNotification.data.notoficationCount) { - notificationCount += existingNotification.data.notoficationCount; - } else { - notificationCount++; - } - } - message = 'You have ' + notificationCount + - ' weather updates.'; - notificationData.notificationCount = notificationCount; - } - - return showNotification(title, message, icon, notificationData); - }); - } else { - return showNotification(title, message, icon, notificationData); - } - }); - }).catch(function(err) { - console.error('Unable to retrieve data', err); - - var title = 'An error occured'; - var message = 'We were unable to get the information for this ' + - 'push message'; - - return showNotification(title, message); - }) - ); -}); - -self.addEventListener('notificationclick', function(event) { - console.log('On notification click: ', event); - - if (Notification.prototype.hasOwnProperty('data')) { - console.log('Using Data'); - var url = event.notification.data.url; - event.waitUntil(clients.openWindow(url)); - } else { - event.waitUntil(getIdb().get(KEY_VALUE_STORE_NAME, event.notification.tag).then(function(url) { - // At the moment you cannot open third party URL's, a simple trick - // is to redirect to the desired URL from a URL on your domain - var redirectUrl = '/redirect.html?redirect=' + - url; - return clients.openWindow(redirectUrl); - })); - } -}); diff --git a/cmg/images/sampleindex.html b/cmg/images/sampleindex.html deleted file mode 100644 index e0c512b..0000000 --- a/cmg/images/sampleindex.html +++ /dev/null @@ -1,54 +0,0 @@ -<!doctype html> -<html> -<head> - <meta charset=utf-8> - <meta http-equiv=X-UA-Compatible content="IE=edge"> - <meta name=description content="A front-end template that helps you build fast, modern mobile web apps."> - <meta name=viewport content="width=device-width, initial-scale=1"> - <title>Simple Push Demo</title> - <link rel=manifest href=manifest.json> - <meta name=mobile-web-app-capable content=yes> - <meta name=application-name content="Web Starter Kit"> - <link rel=icon sizes=192x192 href=images/touch/chrome-touch-icon-192x192.png> - <meta name=apple-mobile-web-app-capable content=yes> - <meta name=apple-mobile-web-app-status-bar-style content=black> - <meta name=apple-mobile-web-app-title content="Web Starter Kit"> - <link rel=apple-touch-icon href=images/touch/apple-touch-icon.png> - <meta name=msapplication-TileImage content=images/touch/ms-touch-icon-144x144-precomposed.png> - <meta name=msapplication-TileColor content=#3372DF> - <meta name=theme-color content=#3372DF> - <link rel=stylesheet href=styles/main.css> -</head> -<body> -<header><h1>Push Demo</h1></header> -<main> - <div class=js-push-switch-container><label class="wsk-switch wsk-js-switch wsk-js-ripple-effect" - for=enable-push><input type=checkbox id=enable-push - class="wsk-switch__input js-enable-push" disabled> - <span class=wsk-switch__label>Enable Push Notifications</span></label></div> - <div class=content-overlap-wrapper> - <div class="send-push-options js-send-push-options"> - <p class=center> - <button class="xhr-button js-xhr-button wsk-button wsk-js-button wsk-button--colored wsk-js-ripple-effect"> - Send a Push to GCM via XHR - </button> - </p> - <p class=center>OR</p> - - <p>Copy and paste the following CURL command into your terminal to send a push message to your browser.</p> - - <p class=center> - <button class="copy-curl-button js-copy-curl-button wsk-button wsk-js-button wsk-button--colored wsk-js-ripple-effect"> - Copy CURL Command to Clipboard - </button> - </p> - <code class="curl-code-example js-curl-code"></code></div> - <div class="error-message-container js-error-message-container"><h1 class="error-title js-error-title"></h1> - - <p class="error-message js-error-message"></p></div> - </div> - <p class=center>The Weather API is<br><a href="https://www.yahoo.com/?ilc=401" target=_blank><img - src=https://poweredby.yahoo.com/purple.png width=134 height=29></a></p></main> -<script src=../../scripts/main.min.js></script> -</body> -</html> \ No newline at end of file diff --git a/cmg/images/samplejs.js b/cmg/images/samplejs.js deleted file mode 100644 index 1e9e0f4..0000000 --- a/cmg/images/samplejs.js +++ /dev/null @@ -1,87 +0,0 @@ -'use strict'; - -function promisifyRequest(obj) { - return new Promise(function(resolve, reject) { - function onsuccess(event) { - resolve(obj.result); - unlisten(); - } - function onerror(event) { - reject(obj.error); - unlisten(); - } - function unlisten() { - obj.removeEventListener('complete', onsuccess); - obj.removeEventListener('success', onsuccess); - obj.removeEventListener('error', onerror); - obj.removeEventListener('abort', onerror); - } - obj.addEventListener('complete', onsuccess); - obj.addEventListener('success', onsuccess); - obj.addEventListener('error', onerror); - obj.addEventListener('abort', onerror); - }); -} - -function IndexDBWrapper(name, version, upgradeCallback) { - var request = indexedDB.open(name, version); - this.ready = promisifyRequest(request); - request.onupgradeneeded = function(event) { - upgradeCallback(request.result, event.oldVersion); - }; -} - -IndexDBWrapper.supported = 'indexedDB' in self; - -var IndexDBWrapperProto = IndexDBWrapper.prototype; - -IndexDBWrapperProto.transaction = function(stores, modeOrCallback, callback) { - return this.ready.then(function(db) { - var mode = 'readonly'; - - if (modeOrCallback.apply) { - callback = modeOrCallback; - } - else if (modeOrCallback) { - mode = modeOrCallback; - } - - var tx = db.transaction(stores, mode); - var val = callback(tx, db); - var promise = promisifyRequest(tx); - var readPromise; - - if (!val) { - return promise; - } - - if (val[0] && 'result' in val[0]) { - readPromise = Promise.all(val.map(promisifyRequest)); - } - else { - readPromise = promisifyRequest(val); - } - - return promise.then(function() { - return readPromise; - }); - }); -}; - -IndexDBWrapperProto.get = function(store, key) { - return this.transaction(store, function(tx) { - return tx.objectStore(store).get(key); - }); -}; - -IndexDBWrapperProto.put = function(store, key, value) { - return this.transaction(store, 'readwrite', function(tx) { - tx.objectStore(store).put(value, key); - }); -}; - -IndexDBWrapperProto.delete = function(store, key) { - return this.transaction(store, 'readwrite', function(tx) { - tx.objectStore(store).delete(key); - }); -}; \ No newline at end of file diff --git a/cmg/index.html b/cmg/index.html deleted file mode 100644 index 670a028..0000000 --- a/cmg/index.html +++ /dev/null @@ -1,81 +0,0 @@ -<!doctype html> -<!-- -This is the sample html provided. -It has a button that enable push notification. -If the user's browser supports serviceworker, is chrome 4.2 and above, -and has not accepted the notification before, it should be enabled. ---> -<html lang="en"> - <head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - - <meta name="description" content="Sample illustrating the use of Push Messaing and Notifications."> - - <meta name="viewport" content="width=device-width, initial-scale=1"> - - <title>Push Messaging & Notifications</title> - - <!-- Add to homescreen for Chrome on Android --> - <!-- - <meta name="mobile-web-app-capable" content="yes"> - <link rel="icon" sizes="192x192" href="../images/touch/chrome-touch-icon-192x192.png"> - - <!-- Add to homescreen for Safari on iOS --> - <!-- - <meta name="apple-mobile-web-app-title" content="Push Messaging and Notifications Sample"> - - <meta name="apple-mobile-web-app-capable" content="yes"> - <meta name="apple-mobile-web-app-status-bar-style" content="black"> - <link rel="apple-touch-icon-precomposed" href="../images/apple-touch-icon-precomposed.png"> - - <!-- Tile icon for Win8 (144x144 + tile color) --> - <!-- - <meta name="msapplication-TileImage" content="images/touch/ms-touch-icon-144x144-precomposed.png"> - <meta name="msapplication-TileColor" content="#3372DF"> - <!-- Include manifest file in the page --> - - <!-- This provides the icon when push notification appears, I think.--> - <link rel="manifest" href="manifest.json"> - - </head> - - <body> - <h1>Push Messaging & Notifications</h1> - - <p>Available in <a href="http://www.chromestatus.com/feature/5416033485586432">Chrome 42+</a> & <a href="http://www.chromestatus.com/feature/5480344312610816">Chrome 42+</a></p> - - <p>To use this sample please do the following:</p> - - <ol> - <li>Refer to <a href="https://console.developers.google.com" target="_blank">Google Developer Console</a>.</li> - <li>For API reference and our key and project numbers.</li> - </ol> - - - <p> - <button class="js-push-button" disabled> - Enable Push Messages - </button> - </p> - - <br /> - <br /> - - <h2>cURL Command to Send Push</h2> - <div class="js-curl-command"></div> - - <script src="config.js"></script> - <script src="demo.js"></script> - <script src="main.js"></script> - <script> - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) - })(window,document,'script','analytics.js','ga'); - ga('create', 'UA-53563471-1', 'auto'); - ga('send', 'pageview'); - </script> - <!-- Built with love using Web Starter Kit --> - </body> -</html> diff --git a/cmg/main.js b/cmg/main.js deleted file mode 100644 index 61a7cf7..0000000 --- a/cmg/main.js +++ /dev/null @@ -1,227 +0,0 @@ -/* -This page contains subscribing user's ip to our system. -sendSubscriptionToServer is not implemented yet. -All methods have comments from the sample. -*/ - -'use strict'; - -var API_KEY = window.GoogleSamples.Config.gcmAPIKey; -var GCM_ENDPOINT = 'https://android.googleapis.com/gcm/send'; - -var curlCommandDiv = document.querySelector('.js-curl-command'); -var isPushEnabled = false; - -// This method handles the removal of subscriptionId -// in Chrome 44 by concatenating the subscription Id -// to the subscription endpoint -function endpointWorkaround(pushSubscription) { - // Make sure we only mess with GCM - if (pushSubscription.endpoint.indexOf('https://android.googleapis.com/gcm/send') !== 0) { - return pushSubscription.endpoint; - } - - var mergedEndpoint = pushSubscription.endpoint; - // Chrome 42 + 43 will not have the subscriptionId attached - // to the endpoint. - if (pushSubscription.subscriptionId && - pushSubscription.endpoint.indexOf(pushSubscription.subscriptionId) === -1) { - // Handle version 42 where you have separate subId and Endpoint - mergedEndpoint = pushSubscription.endpoint + '/' + - pushSubscription.subscriptionId; - } - return mergedEndpoint; -} - -function sendSubscriptionToServer(subscription) { - // TODO: Send the subscription.endpoint - // to your server and save it to send a - // push message at a later date - // - // For compatibly of Chrome 43, get the endpoint via - // endpointWorkaround(subscription) - console.log('TODO: Implement sendSubscriptionToServer()'); - - var mergedEndpoint = endpointWorkaround(subscription); - - // This is just for demo purposes / an easy to test by - // generating the appropriate cURL command - showCurlCommand(mergedEndpoint); -} - -// NOTE: This code is only suitable for GCM endpoints, -// When another browser has a working version, alter -// this to send a PUSH request directly to the endpoint -function showCurlCommand(mergedEndpoint) { - // The curl command to trigger a push message straight from GCM - if (mergedEndpoint.indexOf(GCM_ENDPOINT) !== 0) { - window.Demo.debug.log('This browser isn\'t currently ' + - 'supported for this demo'); - return; - } - - var endpointSections = mergedEndpoint.split('/'); - var subscriptionId = endpointSections[endpointSections.length - 1]; - - var curlCommand = 'curl --header "Authorization: key=' + API_KEY + - '" --header Content-Type:"application/json" ' + GCM_ENDPOINT + - ' -d "{\\"registration_ids\\":[\\"' + subscriptionId + '\\"]}"'; - - curlCommandDiv.textContent = curlCommand; -} - -function unsubscribe() { - var pushButton = document.querySelector('.js-push-button'); - pushButton.disabled = true; - curlCommandDiv.textContent = ''; - - navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) { - // To unsubscribe from push messaging, you need get the - // subcription object, which you can call unsubscribe() on. - serviceWorkerRegistration.pushManager.getSubscription().then( - function(pushSubscription) { - // Check we have a subscription to unsubscribe - if (!pushSubscription) { - // No subscription object, so set the state - // to allow the user to subscribe to push - isPushEnabled = false; - pushButton.disabled = false; - pushButton.textContent = 'Enable Push Messages'; - return; - } - - // TODO: Make a request to your server to remove - // the users data from your data store so you - // don't attempt to send them push messages anymore - - // We have a subcription, so call unsubscribe on it - pushSubscription.unsubscribe().then(function(successful) { - pushButton.disabled = false; - pushButton.textContent = 'Enable Push Messages'; - isPushEnabled = false; - }).catch(function(e) { - // We failed to unsubscribe, this can lead to - // an unusual state, so may be best to remove - // the subscription id from your data store and - // inform the user that you disabled push - - window.Demo.debug.log('Unsubscription error: ', e); - pushButton.disabled = false; - }); - }).catch(function(e) { - window.Demo.debug.log('Error thrown while unsubscribing from ' + - 'push messaging.', e); - }); - }); -} - -function subscribe() { - // Disable the button so it can't be changed while - // we process the permission request - var pushButton = document.querySelector('.js-push-button'); - pushButton.disabled = true; - - navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) { - serviceWorkerRegistration.pushManager.subscribe({userVisibleOnly: true}) - .then(function(subscription) { - // The subscription was successful - isPushEnabled = true; - pushButton.textContent = 'Disable Push Messages'; - pushButton.disabled = false; - - // TODO: Send the subscription subscription.endpoint - // to your server and save it to send a push message - // at a later date - return sendSubscriptionToServer(subscription); - }) - .catch(function(e) { - if (Notification.permission === 'denied') { - // The user denied the notification permission which - // means we failed to subscribe and the user will need - // to manually change the notification permission to - // subscribe to push messages - window.Demo.debug.log('Permission for Notifications was denied'); - pushButton.disabled = true; - } else { - // A problem occurred with the subscription, this can - // often be down to an issue or lack of the gcm_sender_id - // and / or gcm_user_visible_only - window.Demo.debug.log('Unable to subscribe to push.', e); - pushButton.disabled = false; - pushButton.textContent = 'Enable Push Messages'; - } - }); - }); -} - -// Once the service worker is registered set the initial state -function initialiseState() { - // Are Notifications supported in the service worker? - if (!('showNotification' in ServiceWorkerRegistration.prototype)) { - window.Demo.debug.log('Notifications aren\'t supported.'); - return; - } - - // Check the current Notification permission. - // If its denied, it's a permanent block until the - // user changes the permission - if (Notification.permission === 'denied') { - window.Demo.debug.log('The user has blocked notifications.'); - return; - } - - // Check if push messaging is supported - if (!('PushManager' in window)) { - window.Demo.debug.log('Push messaging isn\'t supported.'); - return; - } - - // We need the service worker registration to check for a subscription - navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) { - // Do we already have a push message subscription? - serviceWorkerRegistration.pushManager.getSubscription() - .then(function(subscription) { - // Enable any UI which subscribes / unsubscribes from - // push messages. - var pushButton = document.querySelector('.js-push-button'); - pushButton.disabled = false; - - if (!subscription) { - // We aren’t subscribed to push, so set UI - // to allow the user to enable push - return; - } - - // Keep your server in sync with the latest subscription - sendSubscriptionToServer(subscription); - - // Set your UI to show they have subscribed for - // push messages - pushButton.textContent = 'Disable Push Messages'; - isPushEnabled = true; - }) - .catch(function(err) { - window.Demo.debug.log('Error during getSubscription()', err); - }); - }); -} - -window.addEventListener('load', function() { - var pushButton = document.querySelector('.js-push-button'); - pushButton.addEventListener('click', function() { - if (isPushEnabled) { - unsubscribe(); - } else { - subscribe(); - } - }); - - // Check that service workers are supported, if so, progressively - // enhance and add push messaging support, otherwise continue without it. - if ('serviceWorker' in navigator) { - navigator.serviceWorker.register('./service-worker.js') - .then(initialiseState); - } else { - window.Demo.debug.log('Service workers aren\'t supported in this browser.'); - } -}); diff --git a/cmg/manifest.json b/cmg/manifest.json deleted file mode 100644 index ce56698..0000000 --- a/cmg/manifest.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "Push Demo", - "short_name": "Push Demo", - "icons": [{ - "src": "images/icon-192x192.png", - "sizes": "192x192" - }], - "start_url": "./index.html?homescreen=1", - "display": "standalone", - "gcm_sender_id": "45066531702", - - "//": "gcm_user_visible_only is only needed until Chrome 44 is in stable ", - "gcm_user_visible_only": true -} diff --git a/cmg/service-worker.js b/cmg/service-worker.js deleted file mode 100644 index ab3f5d7..0000000 --- a/cmg/service-worker.js +++ /dev/null @@ -1,46 +0,0 @@ -/* -Still not sure what this does, but i think it handles the event -in the background. -*/ - -'use strict'; - -self.addEventListener('push', function(event) { - console.log('Received a push message', event); - - var title = 'Yay a message.'; - var body = 'We have received a push message.'; - var icon = '/images/icon-192x192.png'; - var tag = 'simple-push-demo-notification-tag'; - - event.waitUntil( - self.registration.showNotification(title, { - body: body, - icon: icon, - tag: tag - }) - ); -}); - - -self.addEventListener('notificationclick', function(event) { - console.log('On notification click: ', event.notification.tag); - // Android doesn’t close the notification when you click on it - // See: http://crbug.com/463146 - event.notification.close(); - - // This looks to see if the current is already open and - // focuses if it is - event.waitUntil(clients.matchAll({ - type: "window" - }).then(function(clientList) { - for (var i = 0; i < clientList.length; i++) { - var client = clientList[i]; - if (client.url == '/' && 'focus' in client) - return client.focus(); - } - if (clients.openWindow) - return clients.openWindow('/'); - })); - -}); diff --git a/manifest.json b/manifest.json index 9b9ff50..ff369b0 100644 --- a/manifest.json +++ b/manifest.json @@ -9,5 +9,6 @@ "start_url": "/index.html", "display": "standalone", "gcm_sender_id": "45066531702", - "gcm_user_visible_only": true + "gcm_user_visible_only": true + "permissions": ["gcm"] } diff --git a/scripts/SettingsController.js b/scripts/SettingsController.js index 58e55b3..300b191 100644 --- a/scripts/SettingsController.js +++ b/scripts/SettingsController.js @@ -1,13 +1,45 @@ angular.module('flashy.SettingsController', ['ui.router']). - controller('SettingsController', function($scope) { - - + controller('SettingsController', function($scope, $http) { $scope.changePassword = function(oldPassword, newPassword, confirmedNewPassword) { }; + console.log("checking to see if chrome"); + if (!chrome) { return; } + console.log("chrome"); + $scope.registerCallback = function(registrationId) { + if (chrome.runtime.lastError) { + console.log("Registration failed") + } + + sendRegistrationId(registrationId, function(succeed) { + if (succeed) { + chrome.storage.local.set({registered: true}); + } + }); + }; + function sendRegistrationId(registrationId, callback) { + console.log("registration id: "+registrationId); + $http.post('/api/subscribe/', JSON.stringify({ + 'registration_id': registrationId + })); + callback(true); + } + + console.log(chrome.runtime.onStartup); + chrome.runtime.onStartup.addListener(function() { + chrome.storage.local.get("registered", function(result) { + // If already registered, bail out. + if (result["registered"]) + return; + + // Up to 100 senders are allowed. + var senderIds = ["45066531702"]; + chrome.gcm.register(senderIds, registerCallback); + }); + }); });