GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — add changes :arrow_heading_up: · avimistry/fullstack-javascript@e171099

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • chapter4
    • chapter4.md
  • chapter6
    • chapter6.md
  • chapter8
    • chapter8.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎chapter4/chapter4.md‎

Copy file name to clipboardExpand all lines: chapter4/chapter4.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1642,7 +1642,7 @@ You should get something like this:
16421642
16431643
define("apple-item.tpl",[],function(){return' <a href="#apples/<%=name%>" target="_blank"> <%=name%> </a>&nbsp;<a class="add-to-cart" href="#">buy</a> '}),define("apple-home.tpl",[],function(){return 'Apple data: <ul class="apples-list"> </ul> <div class="cart-box"></div>'}),define("apple-spinner.tpl",[],function(){return'<img src="img/spinner.gif" width="30"/>'}),define("apple.tpl",[],function(){return'<figure> <img src="<%= attributes.url %>"/> <figcaption><%= attributes.name %></figcaption> </figure>'}),define("apple-item.view",["apple-item.tpl"],function(e){return Backbone.View.extend({tagName:"li",template:_.template(e),events:{"click .add-to-cart":"addToCart"},render:function(){this.$el.html(this.template(this.model.attributes))},addToCart:function(){this.model.collection.trigger("addToCart",this.model)}})}),define("apple-home.view",["apple-home.tpl","apple-item.view"],function(e,t){return Backbone.View.extend({el:"body",listEl:".apples-list",cartEl:".cart-box",template:_.template(e),initialize:function(){this.$el.html(this.template),this.collection.on("addToCart",this.showCart,this)},showCart:function(e){$(this.cartEl).append(e.attributes.name+"<br/>")},render:function(){view=this,this.collection.each(function(e){const i=new t({model:e});i.render(),$(view.listEl).append(i.$el)})}})}),define("apple.view",["apple.tpl","apple-spinner.tpl"],function(e,t){return Backbone.View.extend({initialize:function(){this.model=new(Backbone.Model.extend({})),this.model.on("change",this.render,this),this.on("spinner",this.showSpinner,this)},template:_.template(e),templateSpinner:t,loadApple:function(e){this.trigger("spinner");const t=this;setTimeout(function(){t.model.set(t.collection.where({name:e})[0].attributes)},1e3)},render:function(){const e=this.template(this.model);$("body").html(e)},showSpinner:function(){$("body").html(this.templateSpinner)}})}),define("apples",[],function(){return Backbone.Collection.extend({})}),requirejs.config({urlArgs:"bust="+(new Date).getTime()}),require(["apple-item.tpl","apple-home.tpl","apple-spinner.tpl","apple.tpl","apple-item.view","apple-home.view","apple.view","apples"],function(e,t,i,n,a,l,p,o){const r,s=[{name:"fuji",url:"img/fuji.jpg"},{name:"gala",url:"img/gala.jpg"}],c=Backbone.Router.extend({routes:{"":"home","apples/:appleName":"loadApple"},initialize:function(){const e=new o;e.reset(s),this.homeView=new l({collection:e}),this.appleView=new p({collection:e})},home:function(){this.homeView.render()},loadApple:function(e){this.appleView.loadApple(e)}});$(document).ready(function(){r=new c,Backbone.history.start()})}),define("apple-app",function(){});
16441644
1645-
The file is intentionally not formatted to show how Uglify2 (https://github.com/mishoo/UglifyJS2 ) works. Without the line break escape symbols, the code is on one line. Also notice that variables’ and objects’ names are shortened.
1645+
The file is intentionally not formatted to show how Uglify2 works (<https://npmjs.com/uglify-js> and <http://lisperator.net/uglifyjs>). Without the line break escape symbols, the code is on one line. Also notice that variables’ and objects’ names are shortened.
16461646
16471647
Super Simple Backbone.js Starter Kit
16481648
====================================

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.