From 2f0507f73030d95dac77b7dd2af61cbc9e5e0115 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Fri, 21 Feb 2014 14:21:42 -0800 Subject: [PATCH] Remove TodoMVCs from examples/ Fixes #1154. Added a README to point to TodoMVC's site instead. --- examples/README.md | 5 + examples/todomvc-backbone/README.md | 3 - examples/todomvc-backbone/css/base.css | 556 ------------------ examples/todomvc-backbone/css/bg.png | Bin 2126 -> 0 bytes examples/todomvc-backbone/index.html | 22 - examples/todomvc-backbone/js/app.js | 303 ---------- examples/todomvc-backbone/js/ie.js | 34 -- .../thirdparty/backbone-min.js | 4 - .../thirdparty/backbone.localStorage-min.js | 6 - .../todomvc-backbone/thirdparty/lodash.min.js | 39 -- examples/todomvc-director/README.md | 11 - examples/todomvc-director/bower.json | 9 - examples/todomvc-director/index.html | 24 - examples/todomvc-director/js/app.jsx | 207 ------- examples/todomvc-director/js/footer.jsx | 58 -- examples/todomvc-director/js/todoItem.jsx | 93 --- examples/todomvc-director/js/utils.jsx | 49 -- 17 files changed, 5 insertions(+), 1418 deletions(-) create mode 100644 examples/README.md delete mode 100644 examples/todomvc-backbone/README.md delete mode 100644 examples/todomvc-backbone/css/base.css delete mode 100644 examples/todomvc-backbone/css/bg.png delete mode 100644 examples/todomvc-backbone/index.html delete mode 100644 examples/todomvc-backbone/js/app.js delete mode 100644 examples/todomvc-backbone/js/ie.js delete mode 100644 examples/todomvc-backbone/thirdparty/backbone-min.js delete mode 100644 examples/todomvc-backbone/thirdparty/backbone.localStorage-min.js delete mode 100644 examples/todomvc-backbone/thirdparty/lodash.min.js delete mode 100644 examples/todomvc-director/README.md delete mode 100644 examples/todomvc-director/bower.json delete mode 100644 examples/todomvc-director/index.html delete mode 100644 examples/todomvc-director/js/app.jsx delete mode 100644 examples/todomvc-director/js/footer.jsx delete mode 100644 examples/todomvc-director/js/todoItem.jsx delete mode 100644 examples/todomvc-director/js/utils.jsx diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000000..d18c5bf127 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,5 @@ +# React Examples + +Here are some demo usages of React, with optional [JSX](http://facebook.github.io/react/docs/jsx-in-depth.html) and third-party integration. + +For more fully-featured examples, check out [React TodoMVC](http://todomvc.com/architecture-examples/react/) and [React + Backbone TodoMVC](http://todomvc.com/labs/architecture-examples/react-backbone/). diff --git a/examples/todomvc-backbone/README.md b/examples/todomvc-backbone/README.md deleted file mode 100644 index b2e9210f5a..0000000000 --- a/examples/todomvc-backbone/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# TodoMVC-Backbone - -This is a lightweight version of TodoMVC. Its primary purpose is to demo the Backbone integration rather than being feature-complete (refer to `todomvc-director` for a full TodoMVC-compilant app). diff --git a/examples/todomvc-backbone/css/base.css b/examples/todomvc-backbone/css/base.css deleted file mode 100644 index 8c300228ad..0000000000 --- a/examples/todomvc-backbone/css/base.css +++ /dev/null @@ -1,556 +0,0 @@ -html, -body { - margin: 0; - padding: 0; -} - -button { - margin: 0; - padding: 0; - border: 0; - background: none; - font-size: 100%; - vertical-align: baseline; - font-family: inherit; - color: inherit; - -webkit-appearance: none; - /*-moz-appearance: none;*/ - -ms-appearance: none; - -o-appearance: none; - appearance: none; -} - -body { - font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif; - line-height: 1.4em; - background: #eaeaea url('bg.png'); - color: #4d4d4d; - width: 550px; - margin: 0 auto; - -webkit-font-smoothing: antialiased; - -moz-font-smoothing: antialiased; - -ms-font-smoothing: antialiased; - -o-font-smoothing: antialiased; - font-smoothing: antialiased; -} - -#todoapp { - background: #fff; - background: rgba(255, 255, 255, 0.9); - margin: 130px 0 40px 0; - border: 1px solid #ccc; - position: relative; - border-top-left-radius: 2px; - border-top-right-radius: 2px; - box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2), - 0 25px 50px 0 rgba(0, 0, 0, 0.15); -} - -#todoapp:before { - content: ''; - border-left: 1px solid #f5d6d6; - border-right: 1px solid #f5d6d6; - width: 2px; - position: absolute; - top: 0; - left: 40px; - height: 100%; -} - -#todoapp input::-webkit-input-placeholder { - font-style: italic; -} - -#todoapp input::-moz-placeholder { - font-style: italic; - color: #a9a9a9; -} - -#todoapp h1 { - position: absolute; - top: -120px; - width: 100%; - font-size: 70px; - font-weight: bold; - text-align: center; - color: #b3b3b3; - color: rgba(255, 255, 255, 0.3); - text-shadow: -1px -1px rgba(0, 0, 0, 0.2); - -webkit-text-rendering: optimizeLegibility; - -moz-text-rendering: optimizeLegibility; - -ms-text-rendering: optimizeLegibility; - -o-text-rendering: optimizeLegibility; - text-rendering: optimizeLegibility; -} - -#header { - padding-top: 15px; - border-radius: inherit; -} - -#header:before { - content: ''; - position: absolute; - top: 0; - right: 0; - left: 0; - height: 15px; - z-index: 2; - border-bottom: 1px solid #6c615c; - background: #8d7d77; - background: -webkit-gradient(linear, left top, left bottom, from(rgba(132, 110, 100, 0.8)),to(rgba(101, 84, 76, 0.8))); - background: -webkit-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8)); - background: -moz-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8)); - background: -o-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8)); - background: -ms-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8)); - background: linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8)); - filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#9d8b83', EndColorStr='#847670'); - border-top-left-radius: 1px; - border-top-right-radius: 1px; -} - -#new-todo, -.edit { - position: relative; - margin: 0; - width: 100%; - font-size: 24px; - font-family: inherit; - line-height: 1.4em; - border: 0; - outline: none; - color: inherit; - padding: 6px; - border: 1px solid #999; - box-shadow: inset 0 -1px 5px 0 rgba(0, 0, 0, 0.2); - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - -ms-box-sizing: border-box; - -o-box-sizing: border-box; - box-sizing: border-box; - -webkit-font-smoothing: antialiased; - -moz-font-smoothing: antialiased; - -ms-font-smoothing: antialiased; - -o-font-smoothing: antialiased; - font-smoothing: antialiased; -} - -#new-todo { - padding: 16px 16px 16px 60px; - border: none; - background: rgba(0, 0, 0, 0.02); - z-index: 2; - box-shadow: none; -} - -#main { - position: relative; - z-index: 2; - border-top: 1px dotted #adadad; -} - -label[for='toggle-all'] { - display: none; -} - -#toggle-all { - position: absolute; - top: -42px; - left: -4px; - width: 40px; - text-align: center; - border: none; /* Mobile Safari */ -} - -#toggle-all:before { - content: '»'; - font-size: 28px; - color: #d9d9d9; - padding: 0 25px 7px; -} - -#toggle-all:checked:before { - color: #737373; -} - -#todo-list { - margin: 0; - padding: 0; - list-style: none; -} - -#todo-list li { - position: relative; - font-size: 24px; - border-bottom: 1px dotted #ccc; -} - -#todo-list li:last-child { - border-bottom: none; -} - -#todo-list li.editing { - border-bottom: none; - padding: 0; -} - -#todo-list li.editing .edit { - display: block; - width: 506px; - padding: 13px 17px 12px 17px; - margin: 0 0 0 43px; -} - -#todo-list li.editing .view { - display: none; -} - -#todo-list li .toggle { - text-align: center; - width: 40px; - /* auto, since non-WebKit browsers doesn't support input styling */ - height: auto; - position: absolute; - top: 0; - bottom: 0; - margin: auto 0; - border: none; /* Mobile Safari */ - -webkit-appearance: none; - /*-moz-appearance: none;*/ - -ms-appearance: none; - -o-appearance: none; - appearance: none; -} - -#todo-list li .toggle:after { - content: '✔'; - line-height: 43px; /* 40 + a couple of pixels visual adjustment */ - font-size: 20px; - color: #d9d9d9; - text-shadow: 0 -1px 0 #bfbfbf; -} - -#todo-list li .toggle:checked:after { - color: #85ada7; - text-shadow: 0 1px 0 #669991; - bottom: 1px; - position: relative; -} - -#todo-list li label { - white-space: pre; - word-break: break-word; - padding: 15px 60px 15px 15px; - margin-left: 45px; - display: block; - line-height: 1.2; - -webkit-transition: color 0.4s; - -moz-transition: color 0.4s; - -ms-transition: color 0.4s; - -o-transition: color 0.4s; - transition: color 0.4s; -} - -#todo-list li.completed label { - color: #a9a9a9; - text-decoration: line-through; -} - -#todo-list li .destroy { - display: none; - position: absolute; - top: 0; - right: 10px; - bottom: 0; - width: 40px; - height: 40px; - margin: auto 0; - font-size: 22px; - color: #a88a8a; - -webkit-transition: all 0.2s; - -moz-transition: all 0.2s; - -ms-transition: all 0.2s; - -o-transition: all 0.2s; - transition: all 0.2s; -} - -#todo-list li .destroy:hover { - text-shadow: 0 0 1px #000, - 0 0 10px rgba(199, 107, 107, 0.8); - -webkit-transform: scale(1.3); - -moz-transform: scale(1.3); - -ms-transform: scale(1.3); - -o-transform: scale(1.3); - transform: scale(1.3); -} - -#todo-list li .destroy:after { - content: '✖'; -} - -#todo-list li:hover .destroy { - display: block; -} - -#todo-list li .edit { - display: none; -} - -#todo-list li.editing:last-child { - margin-bottom: -1px; -} - -#footer { - color: #777; - padding: 0 15px; - position: absolute; - right: 0; - bottom: -31px; - left: 0; - height: 20px; - z-index: 1; - text-align: center; -} - -#footer:before { - content: ''; - position: absolute; - right: 0; - bottom: 31px; - left: 0; - height: 50px; - z-index: -1; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3), - 0 6px 0 -3px rgba(255, 255, 255, 0.8), - 0 7px 1px -3px rgba(0, 0, 0, 0.3), - 0 43px 0 -6px rgba(255, 255, 255, 0.8), - 0 44px 2px -6px rgba(0, 0, 0, 0.2); -} - -#todo-count { - float: left; - text-align: left; -} - -#filters { - margin: 0; - padding: 0; - list-style: none; - position: absolute; - right: 0; - left: 0; -} - -#filters li { - display: inline; -} - -#filters li a { - color: #83756f; - margin: 2px; - text-decoration: none; -} - -#filters li a.selected { - font-weight: bold; -} - -#clear-completed { - float: right; - position: relative; - line-height: 20px; - text-decoration: none; - background: rgba(0, 0, 0, 0.1); - font-size: 11px; - padding: 0 10px; - border-radius: 3px; - box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.2); -} - -#clear-completed:hover { - background: rgba(0, 0, 0, 0.15); - box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.3); -} - -#info { - margin: 65px auto 0; - color: #a6a6a6; - font-size: 12px; - text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); - text-align: center; -} - -#info a { - color: inherit; -} - -/* - Hack to remove background from Mobile Safari. - Can't use it globally since it destroys checkboxes in Firefox and Opera -*/ -@media screen and (-webkit-min-device-pixel-ratio:0) { - #toggle-all, - #todo-list li .toggle { - background: none; - } - - #todo-list li .toggle { - height: 40px; - } - - #toggle-all { - top: -56px; - left: -15px; - width: 65px; - height: 41px; - -webkit-transform: rotate(90deg); - transform: rotate(90deg); - -webkit-appearance: none; - appearance: none; - } -} - -.hidden { - display: none; -} - -hr { - margin: 20px 0; - border: 0; - border-top: 1px dashed #C5C5C5; - border-bottom: 1px dashed #F7F7F7; -} - -.learn a { - font-weight: normal; - text-decoration: none; - color: #b83f45; -} - -.learn a:hover { - text-decoration: underline; - color: #787e7e; -} - -.learn h3, -.learn h4, -.learn h5 { - margin: 10px 0; - font-weight: 500; - line-height: 1.2; - color: #000; -} - -.learn h3 { - font-size: 24px; -} - -.learn h4 { - font-size: 18px; -} - -.learn h5 { - margin-bottom: 0; - font-size: 14px; -} - -.learn ul { - padding: 0; - margin: 0 0 30px 25px; -} - -.learn li { - line-height: 20px; -} - -.learn p { - font-size: 15px; - font-weight: 300; - line-height: 1.3; - margin-top: 0; - margin-bottom: 0; -} - -.quote { - border: none; - margin: 20px 0 60px 0; -} - -.quote p { - font-style: italic; -} - -.quote p:before { - content: '“'; - font-size: 50px; - opacity: .15; - position: absolute; - top: -20px; - left: 3px; -} - -.quote p:after { - content: '”'; - font-size: 50px; - opacity: .15; - position: absolute; - bottom: -42px; - right: 3px; -} - -.quote footer { - position: absolute; - bottom: -40px; - right: 0; -} - -.quote footer img { - border-radius: 3px; -} - -.quote footer a { - margin-left: 5px; - vertical-align: middle; -} - -.speech-bubble { - position: relative; - padding: 10px; - background: rgba(0, 0, 0, .04); - border-radius: 5px; -} - -.speech-bubble:after { - content: ''; - position: absolute; - top: 100%; - right: 30px; - border: 13px solid transparent; - border-top-color: rgba(0, 0, 0, .04); -} - -/**body*/.learn-bar > .learn { - position: absolute; - width: 272px; - top: 8px; - left: -300px; - padding: 10px; - border-radius: 5px; - background-color: rgba(255, 255, 255, .6); - transition-property: left; - transition-duration: 500ms; -} - -@media (min-width: 899px) { - /**body*/.learn-bar { - width: auto; - margin: 0 0 0 300px; - } - /**body*/.learn-bar > .learn { - left: 8px; - } - /**body*/.learn-bar #todoapp { - width: 550px; - margin: 130px auto 40px auto; - } -} diff --git a/examples/todomvc-backbone/css/bg.png b/examples/todomvc-backbone/css/bg.png deleted file mode 100644 index b2a7600825ee11f21849ed475499c7d1ecbcc870..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2126 zcmV-U2(kBxP)+9y`=HK7nt=~3t000O5Nklm=04hVa_lXl_bm=+M;=eI<%$rO2ta`suh*Sr#POw*?adq!O!CV z*0&b)rkCCEV)1nIuiLBntUH-MJI;&qYgz|d@Nhnn_abi2g`pu4NAMVid3hS%?quz~ zjlJf(x8cj{VS zUVEP1msg9`^OFUhSO5rtXHhRlyU2i>6$BT=glG`{JlctGHrwRIm)6Buu65jLQn^H8 zvl9lZqUBA+%qvM5XC+yY@mfA(YB~XP=e|6<{%$^eU8nrK?v2ccb@Jom5CG>rKAL7J zplHEIavVp|0p1&m!G`Ti?<7iZ;}@G7#Z)}Km%2!FHnQ0*&?PLR)G!HAaHgU#c|$dz zpj#0HmeadIe>`#)=Jjkb{B=FKnU3pc-&Y@j_j6(h4Y~+Uq!^J=LHunx1xi4QXK-Y{&MoT8ky6Vb9c|WhnOwF~c=3zOy8agktliS6# z`#8F`9H)D=bmk9B5MnW&_r#)f$c+;$LSr-@^An8dhc~Iquuv>jOK7pw7LJ;&X0i1C zGMsHdP1Os@ny$$j!>XAii%7bp5k>`pyNA!~epb)()p9zR4Yl6z=U}{CIdh1z(FpAo zQIW!;0zpCyC4*7YLkZCO@cul0R_&zghsA8Ek)z%jNpKa92{@NH+SstX%@}xB*Jk!l}PZ1cClIns~}5^!RncUk*rmA z%SIVgt58EQxLJ+OiFqKkBuwquyZLUp|gr zPUbUbFbBrPd1xO`^C*r-i3p9*F#(OBh!4Wy@aC&*!|O|GXcjDA&YhF{;cD7*o(GS^ z@pQSE7)x_81=Qyje6*LQ#TXu-7(o;S8u3tpDA0_ddj%hmCspeXdhYR}-i9A=C`EoChUYuH~^x!9+|&(Pgb*>Ck<=9j|)*@xyfT zpP#+Kt<}39b|3Wl4fxT(+G?aH>gG^d@MEaUOJRfy55TtFI7^Y)VuMU=7Pp0y55jS~ z+TJ)igMyrqkX;wU8j68iIDtqJYhS_D3_Oem-@g6me_RfiQ}uT_K-A-9qG%}gk3E9c z!8`KgsMNXm)beloPfMql*|&$M>1q`i!cY)RFYnjNYu*gSv@8XebV7%}xYL>6)GJPJ zJpA7K31lcJuIFKSw-{x4FX0K2Az)~Xg<`sOu$4|^-(^XJX4YzoiNRvL zyuY7~26w-P^Zw%6F}shBwV2$02c8RsSUy6dM92diCAxiX3IUqsq5ig6>U_!Vy*q5$ zjm}16tJr+QZ&T?HkkpeIwVX-r1EI=@%Zlt;6g*mj&E!A))%gXJ=x6u#l zcKEP>bx4rqV*k`BBrZ$Mqjt{TsHcxUH>;)iAK}B(Kila&VD%b?6m&^0WK4^&EZNAI z8AMYs_%$D%|M+@+cQqL-hi4yG>h*jwdii!W1{}p>ZhwFYt_4Su1kjY9<-5`!$VNOI1y(EDSH4WpCijE_>al!Nt=^eVER#uJ1=b z;BWF2IgyF5LexV+yec$Kin;Ai@myo;G>zJ&jrdW#ecXhIZph5OYqw_PEfcF56Z5Zu_ZZE#q3Mc+N&1O^7hoh9QR7`+L$cBP5pqG=fqA0uh zUBukaxTFmH)<|Xbvp2c=HSbNkpXw73a5lv7V$jb92#yZ141@$X?F}Jt8gIU7Wm6m9 z?e_;;zsnm6`LZeP>T=$)Kr>Z?kr*UmFqR7zx0C6^bmcsc@1AGtw_rNH>-Xm$d*|Q< zn&1Ln0u7=l&ILs>%CkJp`DiG9F18x4Ne+lg<#i?e7jL%x;4ZnRkN^Mx07*qoM6N<$ Ef(>0N!2kdN diff --git a/examples/todomvc-backbone/index.html b/examples/todomvc-backbone/index.html deleted file mode 100644 index 9ed9bd7418..0000000000 --- a/examples/todomvc-backbone/index.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - React • TodoMVC - - - - -
- - - - - - - - - diff --git a/examples/todomvc-backbone/js/app.js b/examples/todomvc-backbone/js/app.js deleted file mode 100644 index 5223364556..0000000000 --- a/examples/todomvc-backbone/js/app.js +++ /dev/null @@ -1,303 +0,0 @@ -/** @jsx React.DOM */ - -var Todo = Backbone.Model.extend({ - // Default attributes for the todo - // and ensure that each todo created has `title` and `completed` keys. - defaults: { - title: '', - completed: false - }, - - // Toggle the `completed` state of this todo item. - toggle: function() { - this.save({ - completed: !this.get('completed') - }); - } -}); - -var TodoList = Backbone.Collection.extend({ - - // Reference to this collection's model. - model: Todo, - - // Save all of the todo items under the `"todos"` namespace. - localStorage: new Store('todos-react-backbone'), - - // Filter down the list of all todo items that are finished. - completed: function() { - return this.filter(function( todo ) { - return todo.get('completed'); - }); - }, - - remaining: function() { - return this.without.apply(this, this.completed()); - }, - - // We keep the Todos in sequential order, despite being saved by unordered - // GUID in the database. This generates the next order number for new items. - nextOrder: function () { - if (!this.length) { - return 1; - } - return this.last().get('order') + 1; - }, - - // Todos are sorted by their original insertion order. - comparator: function (todo) { - return todo.get('order'); - } -}); - -var Utils = { - pluralize: function( count, word ) { - return count === 1 ? word : word + 's'; - }, - - stringifyObjKeys: function(obj) { - var s = ''; - for (var key in obj) { - if (!obj.hasOwnProperty(key)) { - continue; - } - if (obj[key]) { - s += key + ' '; - } - } - return s; - } -}; - -// Begin React stuff - -var TodoItem = React.createClass({ - handleSubmit: function(event) { - var val = this.refs.editField.getDOMNode().value.trim(); - if (val) { - this.props.onSave(val); - } else { - this.props.onDestroy(); - } - return false; - }, - - onEdit: function() { - this.props.onEdit(); - this.refs.editField.getDOMNode().focus(); - }, - - render: function() { - var classes = Utils.stringifyObjKeys({ - completed: this.props.todo.get('completed'), editing: this.props.editing - }); - return ( -
  • -
    - - -
    -
    - -
    -
  • - ); - } -}); - -var TodoFooter = React.createClass({ - render: function() { - var activeTodoWord = Utils.pluralize(this.props.count, 'todo'); - var clearButton = null; - - if (this.props.completedCount > 0) { - clearButton = ( - - ); - } - - return ( -
    - - {this.props.count}{' '} - {activeTodoWord}{' '}left - - {clearButton} -
    - ); - } -}); - -// An example generic Mixin that you can add to any component that should react -// to changes in a Backbone component. The use cases we've identified thus far -// are for Collections -- since they trigger a change event whenever any of -// their constituent items are changed there's no need to reconcile for regular -// models. One caveat: this relies on getBackboneModels() to always return the -// same model instances throughout the lifecycle of the component. If you're -// using this mixin correctly (it should be near the top of your component -// hierarchy) this should not be an issue. -var BackboneMixin = { - componentDidMount: function() { - // Whenever there may be a change in the Backbone data, trigger a reconcile. - this.getBackboneModels().forEach(function(model) { - model.on('add change remove', this.forceUpdate.bind(this, null), this); - }, this); - }, - - componentWillUnmount: function() { - // Ensure that we clean up any dangling references when the component is - // destroyed. - this.getBackboneModels().forEach(function(model) { - model.off(null, null, this); - }, this); - } -}; - -var TodoApp = React.createClass({ - mixins: [BackboneMixin], - getInitialState: function() { - return {editing: null}; - }, - - componentDidMount: function() { - // Additional functionality for todomvc: fetch() the collection on init - this.props.todos.fetch(); - this.refs.newField.getDOMNode().focus(); - }, - - componentDidUpdate: function() { - // If saving were expensive we'd listen for mutation events on Backbone and - // do this manually. however, since saving isn't expensive this is an - // elegant way to keep it reactively up-to-date. - this.props.todos.forEach(function(todo) { - todo.save(); - }); - }, - - getBackboneModels: function() { - return [this.props.todos]; - }, - - handleSubmit: function(event) { - event.preventDefault(); - var val = this.refs.newField.getDOMNode().value.trim(); - if (val) { - this.props.todos.create({ - title: val, - completed: false, - order: this.props.todos.nextOrder() - }); - this.refs.newField.getDOMNode().value = ''; - } - }, - - toggleAll: function(event) { - var checked = event.nativeEvent.target.checked; - this.props.todos.forEach(function(todo) { - todo.set('completed', checked); - }); - }, - - edit: function(todo) { - this.setState({editing: todo.get('id')}); - }, - - save: function(todo, text) { - todo.set('title', text); - this.setState({editing: null}); - }, - - clearCompleted: function() { - this.props.todos.completed().forEach(function(todo) { - todo.destroy(); - }); - }, - - render: function() { - var footer = null; - var main = null; - var todoItems = this.props.todos.map(function(todo) { - return ( - - ); - }, this); - - var activeTodoCount = this.props.todos.remaining().length; - var completedCount = todoItems.length - activeTodoCount; - if (activeTodoCount || completedCount) { - footer = - ; - } - - if (todoItems.length) { - main = ( -
    - -
      - {todoItems} -
    -
    - ); - } - - return ( -
    -
    - - {main} - {footer} -
    -
    -

    Double-click to edit a todo

    -

    - Created by{' '} - petehunt -

    -

    Part of{' '}TodoMVC

    -
    -
    - ); - } -}); - -React.renderComponent( - , document.getElementById('container') -); diff --git a/examples/todomvc-backbone/js/ie.js b/examples/todomvc-backbone/js/ie.js deleted file mode 100644 index 97fcb3cfab..0000000000 --- a/examples/todomvc-backbone/js/ie.js +++ /dev/null @@ -1,34 +0,0 @@ -/*! HTML5 Shiv pre3.6 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed - Uncompressed source: https://github.com/aFarkas/html5shiv */ - (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag(); - a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x"; - c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| - "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment(); - for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d>>0;if(_toString(fun)!= -"[object Function]")throw new TypeError;while(++i>>0,result=Array(length),thisp=arguments[1];if(_toString(fun)!="[object Function]")throw new TypeError(fun+" is not a function");for(var i=0;i>>0,result=[],value,thisp=arguments[1];if(_toString(fun)!="[object Function]")throw new TypeError(fun+" is not a function");for(var i=0;i>>0,thisp=arguments[1];if(_toString(fun)!="[object Function]")throw new TypeError(fun+" is not a function");for(var i=0;i>> -0,thisp=arguments[1];if(_toString(fun)!="[object Function]")throw new TypeError(fun+" is not a function");for(var i=0;i>>0;if(_toString(fun)!="[object Function]")throw new TypeError(fun+" is not a function");if(!length&&arguments.length== -1)throw new TypeError("reduce of empty array with no initial value");var i=0;var result;if(arguments.length>=2)result=arguments[1];else{do{if(i in self){result=self[i++];break}if(++i>=length)throw new TypeError("reduce of empty array with no initial value");}while(true)}for(;i>>0;if(_toString(fun)!="[object Function]")throw new TypeError(fun+" is not a function");if(!length&&arguments.length==1)throw new TypeError("reduceRight of empty array with no initial value");var result,i=length-1;if(arguments.length>=2)result=arguments[1];else{do{if(i in self){result=self[i--];break}if(--i<0)throw new TypeError("reduceRight of empty array with no initial value");}while(true)}do if(i in this)result=fun.call(void 0,result, -self[i],i,object);while(i--);return result};if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function indexOf(sought){var self=splitString&&_toString(this)=="[object String]"?this.split(""):toObject(this),length=self.length>>>0;if(!length)return-1;var i=0;if(arguments.length>1)i=toInteger(arguments[1]);i=i>=0?i:Math.max(0,length+i);for(;i>>0;if(!length)return-1;var i=length-1;if(arguments.length>1)i=Math.min(i,toInteger(arguments[1]));i=i>=0?i:length-Math.abs(i);for(;i>=0;i--)if(i in self&&sought===self[i])return i;return-1};if(!Object.keys){var hasDontEnumBug=true,dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength= -dontEnums.length;for(var key in{"toString":null})hasDontEnumBug=false;Object.keys=function keys(object){if(typeof object!="object"&&typeof object!="function"||object===null)throw new TypeError("Object.keys called on a non-object");var keys=[];for(var name in object)if(owns(object,name))keys.push(name);if(hasDontEnumBug)for(var i=0,ii=dontEnumsLength;i9999?"+":"")+("00000"+Math.abs(year)).slice(0<=year&&year<=9999?-4:-6);length=result.length;while(length--){value=result[length];if(value<10)result[length]="0"+value}return year+"-"+result.slice(0,2).join("-")+"T"+result.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"};var dateToJSONIsSupported=false;try{dateToJSONIsSupported=Date.prototype.toJSON&&(new Date(NaN)).toJSON()===null&&(new Date(negativeDate)).toJSON().indexOf(negativeYearString)!==-1&&Date.prototype.toJSON.call({toISOString:function(){return true}})}catch(e){}if(!dateToJSONIsSupported)Date.prototype.toJSON= -function toJSON(key){var o=Object(this),tv=toPrimitive(o),toISO;if(typeof tv==="number"&&!isFinite(tv))return null;toISO=o.toISOString;if(typeof toISO!="function")throw new TypeError("toISOString property is not callable");return toISO.call(o)};if(!Date.parse||"Date.parse is buggy")Date=function(NativeDate){function Date(Y,M,D,h,m,s,ms){var length=arguments.length;if(this instanceof NativeDate){var date=length==1&&String(Y)===Y?new NativeDate(Date.parse(Y)):length>=7?new NativeDate(Y,M,D,h,m,s,ms): -length>=6?new NativeDate(Y,M,D,h,m,s):length>=5?new NativeDate(Y,M,D,h,m):length>=4?new NativeDate(Y,M,D,h):length>=3?new NativeDate(Y,M,D):length>=2?new NativeDate(Y,M):length>=1?new NativeDate(Y):new NativeDate;date.constructor=Date;return date}return NativeDate.apply(this,arguments)}var isoDateExpression=new RegExp("^"+"(\\d{4}|[+-]\\d{6})"+"(?:-(\\d{2})"+"(?:-(\\d{2})"+"(?:"+"T(\\d{2})"+":(\\d{2})"+"(?:"+":(\\d{2})"+"(?:\\.(\\d{3}))?"+")?"+"("+"Z|"+"(?:"+"([-+])"+"(\\d{2})"+":(\\d{2})"+")"+")?)?)?)?"+ -"$");var months=[0,31,59,90,120,151,181,212,243,273,304,334,365];function dayFromMonth(year,month){var t=month>1?1:0;return months[month]+Math.floor((year-1969+t)/4)-Math.floor((year-1901+t)/100)+Math.floor((year-1601+t)/400)+365*(year-1970)}for(var key in NativeDate)Date[key]=NativeDate[key];Date.now=NativeDate.now;Date.UTC=NativeDate.UTC;Date.prototype=NativeDate.prototype;Date.prototype.constructor=Date;Date.parse=function parse(string){var match=isoDateExpression.exec(string);if(match){var year= -Number(match[1]),month=Number(match[2]||1)-1,day=Number(match[3]||1)-1,hour=Number(match[4]||0),minute=Number(match[5]||0),second=Number(match[6]||0),millisecond=Number(match[7]||0),offset=!match[4]||match[8]?0:Number(new NativeDate(1970,0)),signOffset=match[9]==="-"?1:-1,hourOffset=Number(match[10]||0),minuteOffset=Number(match[11]||0),result;if(hour<(minute>0||second>0||millisecond>0?24:25)&&minute<60&&second<60&&millisecond<1E3&&month>-1&&month<12&&hourOffset<24&&minuteOffset<60&&day>-1&&day0||-1)*Math.floor(Math.abs(n));return n}function isPrimitive(input){var type=typeof input;return input===null||type==="undefined"||type==="boolean"||type=== -"number"||type==="string"}function toPrimitive(input){var val,valueOf,toString;if(isPrimitive(input))return input;valueOf=input.valueOf;if(typeof valueOf==="function"){val=valueOf.call(input);if(isPrimitive(val))return val}toString=input.toString;if(typeof toString==="function"){val=toString.call(input);if(isPrimitive(val))return val}throw new TypeError;}var toObject=function(o){if(o==null)throw new TypeError("can't convert "+o+" to object");return Object(o)}}); diff --git a/examples/todomvc-backbone/thirdparty/backbone-min.js b/examples/todomvc-backbone/thirdparty/backbone-min.js deleted file mode 100644 index 3541019c58..0000000000 --- a/examples/todomvc-backbone/thirdparty/backbone-min.js +++ /dev/null @@ -1,4 +0,0 @@ -(function(){var t=this;var e=t.Backbone;var i=[];var r=i.push;var s=i.slice;var n=i.splice;var a;if(typeof exports!=="undefined"){a=exports}else{a=t.Backbone={}}a.VERSION="1.0.0";var h=t._;if(!h&&typeof require!=="undefined")h=require("underscore");a.$=t.jQuery||t.Zepto||t.ender||t.$;a.noConflict=function(){t.Backbone=e;return this};a.emulateHTTP=false;a.emulateJSON=false;var o=a.Events={on:function(t,e,i){if(!l(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,i){if(!l(this,"once",t,[e,i])||!e)return this;var r=this;var s=h.once(function(){r.off(t,s);e.apply(this,arguments)});s._callback=e;return this.on(t,s,i)},off:function(t,e,i){var r,s,n,a,o,u,c,f;if(!this._events||!l(this,"off",t,[e,i]))return this;if(!t&&!e&&!i){this._events={};return this}a=t?[t]:h.keys(this._events);for(o=0,u=a.length;o").attr(t);this.setElement(e,false)}else{this.setElement(h.result(this,"el"),false)}}});a.sync=function(t,e,i){var r=k[t];h.defaults(i||(i={}),{emulateHTTP:a.emulateHTTP,emulateJSON:a.emulateJSON});var s={type:r,dataType:"json"};if(!i.url){s.url=h.result(e,"url")||U()}if(i.data==null&&e&&(t==="create"||t==="update"||t==="patch")){s.contentType="application/json";s.data=JSON.stringify(i.attrs||e.toJSON(i))}if(i.emulateJSON){s.contentType="application/x-www-form-urlencoded";s.data=s.data?{model:s.data}:{}}if(i.emulateHTTP&&(r==="PUT"||r==="DELETE"||r==="PATCH")){s.type="POST";if(i.emulateJSON)s.data._method=r;var n=i.beforeSend;i.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",r);if(n)return n.apply(this,arguments)}}if(s.type!=="GET"&&!i.emulateJSON){s.processData=false}if(s.type==="PATCH"&&window.ActiveXObject&&!(window.external&&window.external.msActiveXFilteringEnabled)){s.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var o=i.xhr=a.ajax(h.extend(s,i));e.trigger("request",e,o,i);return o};var k={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};a.ajax=function(){return a.$.ajax.apply(a.$,arguments)};var S=a.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var $=/\((.*?)\)/g;var T=/(\(\?)?:\w+/g;var H=/\*\w+/g;var A=/[\-{}\[\]+?.,\\\^$|#\s]/g;h.extend(S.prototype,o,{initialize:function(){},route:function(t,e,i){if(!h.isRegExp(t))t=this._routeToRegExp(t);if(h.isFunction(e)){i=e;e=""}if(!i)i=this[e];var r=this;a.history.route(t,function(s){var n=r._extractParameters(t,s);i&&i.apply(r,n);r.trigger.apply(r,["route:"+e].concat(n));r.trigger("route",e,n);a.history.trigger("route",r,e,n)});return this},navigate:function(t,e){a.history.navigate(t,e);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=h.result(this,"routes");var t,e=h.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(A,"\\$&").replace($,"(?:$1)?").replace(T,function(t,e){return e?t:"([^/]+)"}).replace(H,"(.*?)");return new RegExp("^"+t+"$")},_extractParameters:function(t,e){var i=t.exec(e).slice(1);return h.map(i,function(t){return t?decodeURIComponent(t):null})}});var I=a.History=function(){this.handlers=[];h.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var N=/^[#\/]|\s+$/g;var P=/^\/+|\/+$/g;var O=/msie [\w.]+/;var C=/\/$/;I.started=false;h.extend(I.prototype,o,{interval:50,getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=this.location.pathname;var i=this.root.replace(C,"");if(!t.indexOf(i))t=t.substr(i.length)}else{t=this.getHash()}}return t.replace(N,"")},start:function(t){if(I.started)throw new Error("Backbone.history has already been started");I.started=true;this.options=h.extend({},{root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var e=this.getFragment();var i=document.documentMode;var r=O.exec(navigator.userAgent.toLowerCase())&&(!i||i<=7);this.root=("/"+this.root+"/").replace(P,"/");if(r&&this._wantsHashChange){this.iframe=a.$('