Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Unified Diff: sky/examples/city-list/city-sequence.sky

Issue 980323003: Clean up examples directory (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/examples/city-list/city-list.sky ('k') | sky/examples/city-list/index.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/city-list/city-sequence.sky
diff --git a/sky/examples/city-list/city-sequence.sky b/sky/examples/city-list/city-sequence.sky
deleted file mode 100644
index 2e82825a39ea6d1346b8aedcd0b132a62ed87f05..0000000000000000000000000000000000000000
--- a/sky/examples/city-list/city-sequence.sky
+++ /dev/null
@@ -1,64 +0,0 @@
-<!--
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
--->
-<script>
-function StateHeader(state) {
- this.state = state;
- this.headerOrder = 1;
-};
-
-function LetterHeader(letter) {
- this.letter = letter;
- this.headerOrder = 2;
-}
-
-function CitySequence(cities)
-{
- this.items = [];
- this.cursor = 0;
-
- var lastState;
- var lastLetter;
-
- for (var i = 0; i < cities.length; i++) {
- var city = cities[i];
- if (!lastState || lastState.state != city.state) {
- lastState = new StateHeader(city.state);
- this.items.push(lastState);
- lastLetter = undefined;
- }
- if (!lastLetter || lastLetter.letter != city.name[0]) {
- lastLetter = new LetterHeader(city.name[0]);
- this.items.push(lastLetter);
- }
- this.items.push(city);
- }
-};
-
-CitySequence.prototype = {
- append: function(other) {
- var lastCity = this.items[this.items.length - 1];
- var firstOtherCity = other.items[2];
-
- var index = 0;
- if (firstOtherCity.state == lastCity.state) {
- // skip StateHeader
- if (firstOtherCity.name[0] == lastCity.name[0]) {
- // skip LetterHeader
- index = 2;
- } else {
- index = 1;
- }
- }
-
- for (; index < other.items.length; index++) {
- this.items.push(other.items[index]);
- }
- }
-};
-
-module.exports = CitySequence;
-
-</script>
« no previous file with comments | « sky/examples/city-list/city-list.sky ('k') | sky/examples/city-list/index.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698