Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGalina Pankratova
Full Stack JavaScript Techdegree Student 260 Pointsphaser.js displayed with errors on Safari
Hi there. After opening the phaser.js it shows this ugly string of code instead of neat and clear lines we see in the video. Any idea why? Thanks and best regards,
/* Phaser v2.6.2 - http://phaser.io - @photonstorm - (c) 2016 Photon Storm Ltd. */
!function(a){if("object"==typeof exports)module.exports=a();else if("function"==typeof define,1){var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.p2=a()}else define(a)}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){function d(){}var e=a("./Scalar");b.exports=d,d.lineInt=function(a,b,c){c=c||0;var d,f,g,h,i,j,k,l=[0,0];return d=a[1][1]-a[0][1],f=a[0][0]-a[1][0],g=d*a[0][0]+f*a[0][1],h=b[1][1]-b[0][1],i=b[0][0]-b[1][0],j=h*b[0][0]+i*b[0][1],k=d*i-h*f,e.eq(k,0,c)||(l[0]=(i*g-f*j)/k,l[1]=(d*j-h*g)/k),l},d.segmentsIntersect=function(a,b,c,d){var e=b[0]-a[0],f=b[1]-a[1],g=d[0]-c[0],h=d[1]-c[1];if(g*f-h*e==0)return!1;var i=(e*(c[1]-a[1])+f*(a[0]-c[0]))/(g*f-h*e),j=(g*(a[1]-c[1])+h*(c[0]-a[0]))/(h*e-g*f);return i>=0&&i<=1&&j>=0&&j<=1}},{"./Scalar":4}],2:[function(a,b,c){function d(){}b.exports=d,d.area=function(a,b,c){return(b[0]-a[0])(c[1]-a[1])-(c[0]-a[0])(b[1]-a[1])},d.left=function(a,b,c){return d.area(a,b,c)>0},d.leftOn=function(a,b,c){return d.area(a,b,c)>=0},d.right=function(a,b,c){return d.area(a,b,c)<0},d.rightOn=function(a,b,c){return d.area(a,b,c)<=0};var e=[],f=[];d.collinear=function(a,b,c,g){if(g){var h=e,i=f;h[0]=b[0]-a[0],h[1]=b[1]-a[1],i[0]=c[0]-b[0],i[1]=c[1]-b[1];var j=h[0]*i[0]+h[1]*i[1],k=Math.sqrt(h[0]*h[0]+h[1]*h[1]),l=Math.sqrt(i[0]*i[0]+i[1]*i[1]),m=Math.acos(j/(k*l));return m<g}return 0==d.area(a,b,c)},d.sqdist=function(a,b){var c=b[0]-a[0],d=b[1]-a[1];return c*c+d*d}},{}],3:[function(a,b,c){function d(){this.vertices=[]}function e(a,b,c,d,e){e=e||0;var f=b[1]-a[1],g=a[0]-b[0],i=f*a[0]+g*a[1],j=d[1]-c[1],k=c[0]-d[0],l=j*c[0]+k*c[1],m=f*k-j*g;return h.eq(m,0,e)?[0,0]:[(k*i-g*l)/m,(f*l-j*i)/m]}var f=a("./Line"),g=a("./Point"),h=a("./Scalar");b.exports=d,d.prototype.at=function(a){var b=this.vertices,c=b.length;return b[a<0?a%c+c:a%c]},d.prototype.first=function(){return this.vertices[0]},d.prototype.last=function(){return this.vertices[this.vertices.length-1]},d.prototype.clear=function(){this.vertices.length=0},d.prototype.append=function(a,b,c){if("undefined"==typeof b)throw new Error("From is not given!");if("undefined"==typeof c)throw new Error("To is not given!");if(c-1<b)throw new Error("lol1");if(c>a.vertices.length)throw new Error("lol2");if(b<0)throw new Error("lol3");for(var d=b;d<c;d++)this.vertices.push(a.vertices[d])},d.prototype.makeCCW=function(){for(var a=0,b=this.vertices,c=1;c<this.vertices.length;++c)(b[c][1]<b[a][1]||b[c][1]==b[a][1]&&b[c][0]>b[a][0])&&(a=c);g.left(this.at(a-1),this.at(a),this.at(a+1))||this.reverse()},d.prototype.reverse=function(){for(var a=[],b=0,c=this.vertices.length;b!==c;b++)a.push(this.vertices.pop());this.vertices=a},d.prototype.isReflex=function(a){return g.right(this.at(a-1),this.at(a),this.at(a+1))};var i=[],j=[];d.prototype.canSee=function(a,b){var c,d,e=i,h=j;if(g.leftOn(this.at(a+1),this.at(a),this.at(b))&&g.rightOn(this.at(a-1),this.at(a),this.at(b)))return!1;d=g.sqdist(this.at(a),this.at(b));for(var k=0;k!==this.vertices.length;++k)if((k+1)%this.vertices.length!==a&&k!==a&&g.leftOn(this.at(a),this.at(b),this.at(k+1))&&g.rightOn(this.at(a),this.at(b),this.at(k))&&(e[0]=this.at(a),e[1]=this.at(b),h[0]=this.at(k),h[1]=this.at(k+1),c=f.lineInt(e,h),g.sqdist(this.at(a),c)<d))return!1;return!0},d.prototype.copy=function(a,b,c){var e=c||new d;if(e.clear(),a<b)for(var f=a;f<=b;f++)e.vertices.push(this.vertices[f]);else{for(var f=0;f<=b;f++)e.vertices.push(this.vertices[f]);for(var f=a;f<this.vertices.length;f++)e.vertices.push(this.vertices[f])}return e},d.prototype.getCutEdges=function(){for(var a=[],b=[],c=[],e=new d,f=Number.MAX_VALUE,g=0;g<this.vertices.length;++g)if(this.isReflex(g))for(var h=0;h<this.vertices.length;++h)if(this.canSee(g,h)){b=this.copy(g,h,e).getCutEdges(),c=this.copy(h,g,e).getCutEdges();for(var i=0;i<c.length;i++)b.push(c[i]);b.length<f&&(a=b,f=b.length,a.push([this.at(g),this.at(h)]))}return a},d.prototype.decomp=function(){var a=this.getCutEdges();return a.length>0?this.slice(a):[this]},d.prototype.slice=function(a){if(0==a.length)return[this];if(a instanceof Array&&a.length&&a[0]instanceof Array&&2==a[0].length&&a[0][0]instanceof Array){for(var b=[this],c=0;c<a.length;c++)for(var d=a[c],e=0;e<b.length;e++){var f=b[e],g=f.slice(d);if(g){b.splice(e,1),b.push(g[0],g[1]);break}}return b}var d=a,c=this.vertices.indexOf(d[0]),e=this.vertices.indexOf(d[1]);return c!=-1&&e!=-1&&[this.copy(c,e),this.copy(e,c)]},d.prototype.isSimple=function(){for(var a=this.vertices,b=0;b<a.length-1;b++)for(var c=0;c<b-1;c++)if(f.segmentsIntersect(a[b],a[b+1],a[c],a[c+1]))return!1;for(var b=1;b<a.length-2;b++)if(f.segmentsIntersect(a[0],a[a.length-1],a[b],a[b+1]))return!1;return!0},d.prototype.quickDecomp=function(a,b,c,f,h,i){h=h||100,i=i||0,f=f||25,a="undefined"!=typeof a?a:[],b=b||[],c=c||[];var j=[0,0],k=[0,0],l=[0,0],m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=new d,u=new d,v=this,w=this.vertices;if(w.length<3)return a;if(i++,i>h)return console.warn("quickDecomp: max level ("+h+") reached."),a;for(var x=0;x<this.vertices.length;++x)if(v.isReflex(x)){b.push(v.vertices[x]),m=n=Number.MAX_VALUE;for(var y=0;y<this.vertices.length;++y)g.left(v.at(x-1),v.at(x),v.at(y))&&g.rightOn(v.at(x-1),v.at(x),v.at(y-1))&&(l=e(v.at(x-1),v.at(x),v.at(y),v.at(y-1)),g.right(v.at(x+1),v.at(x),l)&&(o=g.sqdist(v.vertices[x],l),o<n&&(n=o,k=l,r=y))),g.left(v.at(x+1),v.at(x),v.at(y+1))&&g.rightOn(v.at(x+1),v.at(x),v.at(y))&&(l=e(v.at(x+1),v.at(x),v.at(y),v.at(y+1)),g.left(v.at(x-1),v.at(x),l)&&(o=g.sqdist(v.vertices[x],l),o<m&&(m=o,j=l,q=y)));if(r==(q+1)%this.vertices.length)l[0]=(k[0]+j[0])/2,l[1]=(k[1]+j[1])/2,c.push(l),x<q?(t.append(v,x,q+1),t.vertices.push(l),u.vertices.push(l),0!=r&&u.append(v,r,v.vertices.length),u.append(v,0,x+1)):(0!=x&&t.append(v,x,v.vertices.length),t.append(v,0,q+1),t.vertices.push(l),u.vertices.push(l),u.append(v,r,x+1));else{if(r>q&&(q+=this.vertices.length),p=Number.MAX_VALUE,q<r)return a;for(var y=r;y<=q;++y)g.leftOn(v.at(x-1),v.at(x),v.at(y))&&g.rightOn(v.at(x+1),v.at(x),v.at(y))&&(o=g.sqdist(v.at(x),v.at(y)),o<p&&(p=o,s=y%this.vertices.length));x<s?(t.append(v,x,s+1),0!=s&&u.append(v,s,w.length),u.append(v,0,x+1)):(0!=x&&t.append(v,x,w.length),t.append(v,0,s+1),u.append(v,s,x+1))}return t.vertices.length<u.vertices.length?(t.quickDecomp(a,b,c,f,h,i),u.quickDecomp(a,b,c,f,h,i)):(u.quickDecomp(a,b,c,f,h,i),t.quickDecomp(a,b,c,f,h,i)),a}return a.push(this),a},d.prototype.removeCollinearPoints=function(a){for(var b=0,c=this.vertices.length-1;this.vertices.length>3&&c>=0;--c)g.collinear(this.at(c-1),this.at(c),this.at(c+1),a)&&(this.vertices.splice(c%this.vertices.length,1),c--,b++);return b}},{"./Line":1,"./Point":2,"./Scalar":4}],4:[function(a,b,c){function d(){}b.exports=d,d.eq=function(a,b,c){return c=c||0,Math.abs(a-b)<c}},{}],5:[function(a,b,c){b.exports={Polygon:a("./Polygon"),Point:a("./Point")}},{"./Point":2,"./Polygon":3}],6:[function(a,b,c){b.exports={name:"p2",version:"0.7.0",description:"A JavaScript 2D physics engine.",author:"Stefan Hedman <schteppe@gmail.com> (http://steffe.se)",keywords:["p2.js","p2","physics","engine","2d"],main:"./src/p2.js",engines:{node:"*"},repository:{type:"git",url:"https://github.com/schteppe/p2.js.git"},bugs:{url:"https://github.com/schteppe/p2.js/issues"},licenses:[{type:"MIT"}],devDependencies:{grunt:"^0.4.5","grunt-contrib-jshint":"^0.11.2","grunt-contrib-nodeunit":"^0.4.1","grunt-contrib-uglify":"~0.4.0","grunt-contrib-watch":"~0.5.0","grunt-browserify":"~2.0.1","grunt-contrib-concat":"^0.4.0"},dependencies:{"poly-decomp":"0.1.0"}}},{}],7:[function(a,b,c){function d(a
1 Answer
toxic
UX Design Techdegree Student 14,790 PointsCan you please show us your code? so it will be easier for us to help you! 🙂
Brent Shields
1,737 PointsBrent Shields
1,737 PointsI have the exact same problem. I just started the first video in this track and haven't done anything except open the workspace and click on a few files in the workspace. phaser.js looks the same to me as in Galena's screenshot above. I'm using Chrome but I'm going to try Firefox next. When I click phaser.js the browser is very slow to display the file and it only lets me scroll down a bit. All the lines seem to be crunched together without any comments after the first line.