├── .bowerrc
├── .editorconfig
├── .gitattributes
├── .gitignore
├── .jshintrc
├── .travis.yml
├── Gruntfile.js
├── LICENSE
├── README.md
├── app
├── .buildignore
├── .htaccess
├── 404.html
├── favicon.ico
├── images
│ └── yeoman.png
├── index.html
├── robots.txt
├── scripts
│ ├── app.js
│ ├── controllers
│ │ └── main.js
│ └── directives
│ │ └── ui-virtual-list.js
├── styles
│ ├── main.css
│ └── main.scss
└── views
│ ├── directives
│ └── ui-virtual-list.html
│ └── main.html
├── bower.json
├── package.json
└── test
├── .jshintrc
├── karma.conf.js
└── spec
└── controllers
├── about.js
└── main.js
/.bowerrc:
--------------------------------------------------------------------------------
1 | {
2 | "directory": "app/bower_components"
3 | }
4 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig helps developers define and maintain consistent
2 | # coding styles between different editors and IDEs
3 | # editorconfig.org
4 |
5 | root = true
6 |
7 |
8 | [*]
9 |
10 | # Change these settings to your own preference
11 | indent_style = space
12 | indent_size = 2
13 |
14 | # We recommend you to keep these unchanged
15 | end_of_line = lf
16 | charset = utf-8
17 | trim_trailing_whitespace = true
18 | insert_final_newline = true
19 |
20 | [*.md]
21 | trim_trailing_whitespace = false
22 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 | .tmp
4 | .sass-cache
5 | bower_components
6 |
--------------------------------------------------------------------------------
/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "node": true,
3 | "browser": true,
4 | "esnext": true,
5 | "bitwise": true,
6 | "camelcase": true,
7 | "curly": true,
8 | "eqeqeq": true,
9 | "immed": true,
10 | "indent": 2,
11 | "latedef": true,
12 | "newcap": true,
13 | "noarg": true,
14 | "quotmark": "single",
15 | "regexp": true,
16 | "undef": true,
17 | "unused": true,
18 | "strict": true,
19 | "trailing": true,
20 | "smarttabs": true,
21 | "globals": {
22 | "angular": false
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - '0.10'
4 | before_script:
5 | - 'npm install -g bower grunt-cli'
6 | - 'bower install'
7 |
--------------------------------------------------------------------------------
/Gruntfile.js:
--------------------------------------------------------------------------------
1 | // Generated on 2014-11-22 using generator-angular 0.9.8
2 | 'use strict';
3 |
4 | // # Globbing
5 | // for performance reasons we're only matching one level down:
6 | // 'test/spec/{,*/}*.js'
7 | // use this if you want to recursively match all subfolders:
8 | // 'test/spec/**/*.js'
9 |
10 | module.exports = function (grunt) {
11 |
12 | // Load grunt tasks automatically
13 | require('load-grunt-tasks')(grunt);
14 |
15 | // Time how long tasks take. Can help when optimizing build times
16 | require('time-grunt')(grunt);
17 |
18 | // Configurable paths for the application
19 | var appConfig = {
20 | app: require('./bower.json').appPath || 'app',
21 | dist: 'dist'
22 | };
23 |
24 | // Define the configuration for all the tasks
25 | grunt.initConfig({
26 |
27 | // Project settings
28 | yeoman: appConfig,
29 |
30 | // Watches files for changes and runs tasks based on the changed files
31 | watch: {
32 | bower: {
33 | files: ['bower.json'],
34 | tasks: ['wiredep']
35 | },
36 | js: {
37 | files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
38 | tasks: ['newer:jshint:all'],
39 | options: {
40 | livereload: '<%= connect.options.livereload %>'
41 | }
42 | },
43 | jsTest: {
44 | files: ['test/spec/{,*/}*.js'],
45 | tasks: ['newer:jshint:test', 'karma']
46 | },
47 | compass: {
48 | files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
49 | tasks: ['compass:server', 'autoprefixer']
50 | },
51 | gruntfile: {
52 | files: ['Gruntfile.js']
53 | },
54 | livereload: {
55 | options: {
56 | livereload: '<%= connect.options.livereload %>'
57 | },
58 | files: [
59 | '<%= yeoman.app %>/{,*/}*.html',
60 | '.tmp/styles/{,*/}*.css',
61 | '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
62 | ]
63 | }
64 | },
65 |
66 | // The actual grunt server settings
67 | connect: {
68 | options: {
69 | port: 9000,
70 | // Change this to '0.0.0.0' to access the server from outside.
71 | hostname: 'localhost',
72 | livereload: 35729
73 | },
74 | livereload: {
75 | options: {
76 | open: true,
77 | middleware: function (connect) {
78 | return [
79 | connect.static('.tmp'),
80 | connect().use(
81 | '/bower_components',
82 | connect.static('./bower_components')
83 | ),
84 | connect.static(appConfig.app)
85 | ];
86 | }
87 | }
88 | },
89 | test: {
90 | options: {
91 | port: 9001,
92 | middleware: function (connect) {
93 | return [
94 | connect.static('.tmp'),
95 | connect.static('test'),
96 | connect().use(
97 | '/bower_components',
98 | connect.static('./bower_components')
99 | ),
100 | connect.static(appConfig.app)
101 | ];
102 | }
103 | }
104 | },
105 | dist: {
106 | options: {
107 | open: true,
108 | base: '<%= yeoman.dist %>'
109 | }
110 | }
111 | },
112 |
113 | // Make sure code styles are up to par and there are no obvious mistakes
114 | jshint: {
115 | options: {
116 | jshintrc: '.jshintrc',
117 | reporter: require('jshint-stylish')
118 | },
119 | all: {
120 | src: [
121 | 'Gruntfile.js',
122 | '<%= yeoman.app %>/scripts/{,*/}*.js'
123 | ]
124 | },
125 | test: {
126 | options: {
127 | jshintrc: 'test/.jshintrc'
128 | },
129 | src: ['test/spec/{,*/}*.js']
130 | }
131 | },
132 |
133 | // Empties folders to start fresh
134 | clean: {
135 | dist: {
136 | files: [{
137 | dot: true,
138 | src: [
139 | '.tmp',
140 | '<%= yeoman.dist %>/{,*/}*',
141 | '!<%= yeoman.dist %>/.git*'
142 | ]
143 | }]
144 | },
145 | server: '.tmp'
146 | },
147 |
148 | // Add vendor prefixed styles
149 | autoprefixer: {
150 | options: {
151 | browsers: ['last 1 version']
152 | },
153 | dist: {
154 | files: [{
155 | expand: true,
156 | cwd: '.tmp/styles/',
157 | src: '{,*/}*.css',
158 | dest: '.tmp/styles/'
159 | }]
160 | }
161 | },
162 |
163 | // Automatically inject Bower components into the app
164 | wiredep: {
165 | app: {
166 | src: ['<%= yeoman.app %>/index.html'],
167 | ignorePath: /\.\.\//
168 | },
169 | sass: {
170 | src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
171 | ignorePath: /(\.\.\/){1,2}bower_components\//
172 | }
173 | },
174 |
175 | // Compiles Sass to CSS and generates necessary files if requested
176 | compass: {
177 | options: {
178 | sassDir: '<%= yeoman.app %>/styles',
179 | cssDir: '.tmp/styles',
180 | generatedImagesDir: '.tmp/images/generated',
181 | imagesDir: '<%= yeoman.app %>/images',
182 | javascriptsDir: '<%= yeoman.app %>/scripts',
183 | fontsDir: '<%= yeoman.app %>/styles/fonts',
184 | importPath: './bower_components',
185 | httpImagesPath: '/images',
186 | httpGeneratedImagesPath: '/images/generated',
187 | httpFontsPath: '/styles/fonts',
188 | relativeAssets: false,
189 | assetCacheBuster: false,
190 | raw: 'Sass::Script::Number.precision = 10\n'
191 | },
192 | dist: {
193 | options: {
194 | generatedImagesDir: '<%= yeoman.dist %>/images/generated'
195 | }
196 | },
197 | server: {
198 | options: {
199 | debugInfo: true
200 | }
201 | }
202 | },
203 |
204 | // Renames files for browser caching purposes
205 | filerev: {
206 | dist: {
207 | src: [
208 | '<%= yeoman.dist %>/scripts/{,*/}*.js',
209 | '<%= yeoman.dist %>/styles/{,*/}*.css',
210 | '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
211 | '<%= yeoman.dist %>/styles/fonts/*'
212 | ]
213 | }
214 | },
215 |
216 | // Reads HTML for usemin blocks to enable smart builds that automatically
217 | // concat, minify and revision files. Creates configurations in memory so
218 | // additional tasks can operate on them
219 | useminPrepare: {
220 | html: '<%= yeoman.app %>/index.html',
221 | options: {
222 | dest: '<%= yeoman.dist %>',
223 | flow: {
224 | html: {
225 | steps: {
226 | js: ['concat', 'uglifyjs'],
227 | css: ['cssmin']
228 | },
229 | post: {}
230 | }
231 | }
232 | }
233 | },
234 |
235 | // Performs rewrites based on filerev and the useminPrepare configuration
236 | usemin: {
237 | html: ['<%= yeoman.dist %>/{,*/}*.html'],
238 | css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
239 | options: {
240 | assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images']
241 | }
242 | },
243 |
244 | // The following *-min tasks will produce minified files in the dist folder
245 | // By default, your `index.html`'s will take care of
246 | // minification. These next options are pre-configured if you do not wish
247 | // to use the Usemin blocks.
248 | // cssmin: {
249 | // dist: {
250 | // files: {
251 | // '<%= yeoman.dist %>/styles/main.css': [
252 | // '.tmp/styles/{,*/}*.css'
253 | // ]
254 | // }
255 | // }
256 | // },
257 | // uglify: {
258 | // dist: {
259 | // files: {
260 | // '<%= yeoman.dist %>/scripts/scripts.js': [
261 | // '<%= yeoman.dist %>/scripts/scripts.js'
262 | // ]
263 | // }
264 | // }
265 | // },
266 | // concat: {
267 | // dist: {}
268 | // },
269 |
270 | imagemin: {
271 | dist: {
272 | files: [{
273 | expand: true,
274 | cwd: '<%= yeoman.app %>/images',
275 | src: '{,*/}*.{png,jpg,jpeg,gif}',
276 | dest: '<%= yeoman.dist %>/images'
277 | }]
278 | }
279 | },
280 |
281 | svgmin: {
282 | dist: {
283 | files: [{
284 | expand: true,
285 | cwd: '<%= yeoman.app %>/images',
286 | src: '{,*/}*.svg',
287 | dest: '<%= yeoman.dist %>/images'
288 | }]
289 | }
290 | },
291 |
292 | htmlmin: {
293 | dist: {
294 | options: {
295 | collapseWhitespace: true,
296 | conservativeCollapse: true,
297 | collapseBooleanAttributes: true,
298 | removeCommentsFromCDATA: true,
299 | removeOptionalTags: true
300 | },
301 | files: [{
302 | expand: true,
303 | cwd: '<%= yeoman.dist %>',
304 | src: ['*.html', 'views/{,*/}*.html'],
305 | dest: '<%= yeoman.dist %>'
306 | }]
307 | }
308 | },
309 |
310 | // ng-annotate tries to make the code safe for minification automatically
311 | // by using the Angular long form for dependency injection.
312 | ngAnnotate: {
313 | dist: {
314 | files: [{
315 | expand: true,
316 | cwd: '.tmp/concat/scripts',
317 | src: ['*.js', '!oldieshim.js'],
318 | dest: '.tmp/concat/scripts'
319 | }]
320 | }
321 | },
322 |
323 | // Replace Google CDN references
324 | cdnify: {
325 | dist: {
326 | html: ['<%= yeoman.dist %>/*.html']
327 | }
328 | },
329 |
330 | // Copies remaining files to places other tasks can use
331 | copy: {
332 | dist: {
333 | files: [{
334 | expand: true,
335 | dot: true,
336 | cwd: '<%= yeoman.app %>',
337 | dest: '<%= yeoman.dist %>',
338 | src: [
339 | '*.{ico,png,txt}',
340 | '.htaccess',
341 | '*.html',
342 | 'views/{,*/}*.html',
343 | 'images/{,*/}*.{webp}',
344 | 'fonts/*'
345 | ]
346 | }, {
347 | expand: true,
348 | cwd: '.tmp/images',
349 | dest: '<%= yeoman.dist %>/images',
350 | src: ['generated/*']
351 | }]
352 | },
353 | styles: {
354 | expand: true,
355 | cwd: '<%= yeoman.app %>/styles',
356 | dest: '.tmp/styles/',
357 | src: '{,*/}*.css'
358 | }
359 | },
360 |
361 | // Run some tasks in parallel to speed up the build process
362 | concurrent: {
363 | server: [
364 | 'compass:server'
365 | ],
366 | test: [
367 | 'compass'
368 | ],
369 | dist: [
370 | 'compass:dist',
371 | 'imagemin',
372 | 'svgmin'
373 | ]
374 | },
375 |
376 | // Test settings
377 | karma: {
378 | unit: {
379 | configFile: 'test/karma.conf.js',
380 | singleRun: true
381 | }
382 | }
383 | });
384 |
385 |
386 | grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
387 | if (target === 'dist') {
388 | return grunt.task.run(['build', 'connect:dist:keepalive']);
389 | }
390 |
391 | grunt.task.run([
392 | 'clean:server',
393 | 'wiredep',
394 | 'concurrent:server',
395 | 'autoprefixer',
396 | 'connect:livereload',
397 | 'watch'
398 | ]);
399 | });
400 |
401 | grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
402 | grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
403 | grunt.task.run(['serve:' + target]);
404 | });
405 |
406 | grunt.registerTask('test', [
407 | 'clean:server',
408 | 'concurrent:test',
409 | 'autoprefixer',
410 | 'connect:test',
411 | 'karma'
412 | ]);
413 |
414 | grunt.registerTask('build', [
415 | 'clean:dist',
416 | 'wiredep',
417 | 'useminPrepare',
418 | 'concurrent:dist',
419 | 'autoprefixer',
420 | 'concat',
421 | 'ngAnnotate',
422 | 'copy:dist',
423 | 'cdnify',
424 | 'cssmin',
425 | 'uglify',
426 | 'filerev',
427 | 'usemin',
428 | 'htmlmin'
429 | ]);
430 |
431 | grunt.registerTask('default', [
432 | 'newer:jshint',
433 | 'test',
434 | 'build'
435 | ]);
436 | };
437 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Two Fucking Developers
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ui-virtual-list
2 | ====================
3 |
4 | AngularJS virtualized list tutorial files.
5 |
6 | Code explanation: http://twofuckingdevelopers.com/2014/11/angularjs-virtual-list-directive-tutorial
7 |
8 | Demo: http://codepen.io/2fdevs/pen/pvvXoO
9 |
--------------------------------------------------------------------------------
/app/.buildignore:
--------------------------------------------------------------------------------
1 | *.coffee
--------------------------------------------------------------------------------
/app/.htaccess:
--------------------------------------------------------------------------------
1 | # Apache Configuration File
2 |
3 | # (!) Using `.htaccess` files slows down Apache, therefore, if you have access
4 | # to the main server config file (usually called `httpd.conf`), you should add
5 | # this logic there: http://httpd.apache.org/docs/current/howto/htaccess.html.
6 |
7 | # ##############################################################################
8 | # # CROSS-ORIGIN RESOURCE SHARING (CORS) #
9 | # ##############################################################################
10 |
11 | # ------------------------------------------------------------------------------
12 | # | Cross-domain AJAX requests |
13 | # ------------------------------------------------------------------------------
14 |
15 | # Enable cross-origin AJAX requests.
16 | # http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity
17 | # http://enable-cors.org/
18 |
19 | #
20 | # Header set Access-Control-Allow-Origin "*"
21 | #
22 |
23 | # ------------------------------------------------------------------------------
24 | # | CORS-enabled images |
25 | # ------------------------------------------------------------------------------
26 |
27 | # Send the CORS header for images when browsers request it.
28 | # https://developer.mozilla.org/en/CORS_Enabled_Image
29 | # http://blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html
30 | # http://hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/
31 |
32 |
33 |
34 |
35 | SetEnvIf Origin ":" IS_CORS
36 | Header set Access-Control-Allow-Origin "*" env=IS_CORS
37 |
38 |
39 |
40 |
41 | # ------------------------------------------------------------------------------
42 | # | Web fonts access |
43 | # ------------------------------------------------------------------------------
44 |
45 | # Allow access from all domains for web fonts
46 |
47 |
48 |
49 | Header set Access-Control-Allow-Origin "*"
50 |
51 |
52 |
53 |
54 | # ##############################################################################
55 | # # ERRORS #
56 | # ##############################################################################
57 |
58 | # ------------------------------------------------------------------------------
59 | # | 404 error prevention for non-existing redirected folders |
60 | # ------------------------------------------------------------------------------
61 |
62 | # Prevent Apache from returning a 404 error for a rewrite if a directory
63 | # with the same name does not exist.
64 | # http://httpd.apache.org/docs/current/content-negotiation.html#multiviews
65 | # http://www.webmasterworld.com/apache/3808792.htm
66 |
67 | Options -MultiViews
68 |
69 | # ------------------------------------------------------------------------------
70 | # | Custom error messages / pages |
71 | # ------------------------------------------------------------------------------
72 |
73 | # You can customize what Apache returns to the client in case of an error (see
74 | # http://httpd.apache.org/docs/current/mod/core.html#errordocument), e.g.:
75 |
76 | ErrorDocument 404 /404.html
77 |
78 |
79 | # ##############################################################################
80 | # # INTERNET EXPLORER #
81 | # ##############################################################################
82 |
83 | # ------------------------------------------------------------------------------
84 | # | Better website experience |
85 | # ------------------------------------------------------------------------------
86 |
87 | # Force IE to render pages in the highest available mode in the various
88 | # cases when it may not: http://hsivonen.iki.fi/doctype/ie-mode.pdf.
89 |
90 |
91 | Header set X-UA-Compatible "IE=edge"
92 | # `mod_headers` can't match based on the content-type, however, we only
93 | # want to send this header for HTML pages and not for the other resources
94 |
95 | Header unset X-UA-Compatible
96 |
97 |
98 |
99 | # ------------------------------------------------------------------------------
100 | # | Cookie setting from iframes |
101 | # ------------------------------------------------------------------------------
102 |
103 | # Allow cookies to be set from iframes in IE.
104 |
105 | #
106 | # Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
107 | #
108 |
109 | # ------------------------------------------------------------------------------
110 | # | Screen flicker |
111 | # ------------------------------------------------------------------------------
112 |
113 | # Stop screen flicker in IE on CSS rollovers (this only works in
114 | # combination with the `ExpiresByType` directives for images from below).
115 |
116 | # BrowserMatch "MSIE" brokenvary=1
117 | # BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
118 | # BrowserMatch "Opera" !brokenvary
119 | # SetEnvIf brokenvary 1 force-no-vary
120 |
121 |
122 | # ##############################################################################
123 | # # MIME TYPES AND ENCODING #
124 | # ##############################################################################
125 |
126 | # ------------------------------------------------------------------------------
127 | # | Proper MIME types for all files |
128 | # ------------------------------------------------------------------------------
129 |
130 |
131 |
132 | # Audio
133 | AddType audio/mp4 m4a f4a f4b
134 | AddType audio/ogg oga ogg
135 |
136 | # JavaScript
137 | # Normalize to standard type (it's sniffed in IE anyways):
138 | # http://tools.ietf.org/html/rfc4329#section-7.2
139 | AddType application/javascript js jsonp
140 | AddType application/json json
141 |
142 | # Video
143 | AddType video/mp4 mp4 m4v f4v f4p
144 | AddType video/ogg ogv
145 | AddType video/webm webm
146 | AddType video/x-flv flv
147 |
148 | # Web fonts
149 | AddType application/font-woff woff
150 | AddType application/vnd.ms-fontobject eot
151 |
152 | # Browsers usually ignore the font MIME types and sniff the content,
153 | # however, Chrome shows a warning if other MIME types are used for the
154 | # following fonts.
155 | AddType application/x-font-ttf ttc ttf
156 | AddType font/opentype otf
157 |
158 | # Make SVGZ fonts work on iPad:
159 | # https://twitter.com/FontSquirrel/status/14855840545
160 | AddType image/svg+xml svg svgz
161 | AddEncoding gzip svgz
162 |
163 | # Other
164 | AddType application/octet-stream safariextz
165 | AddType application/x-chrome-extension crx
166 | AddType application/x-opera-extension oex
167 | AddType application/x-shockwave-flash swf
168 | AddType application/x-web-app-manifest+json webapp
169 | AddType application/x-xpinstall xpi
170 | AddType application/xml atom rdf rss xml
171 | AddType image/webp webp
172 | AddType image/x-icon ico
173 | AddType text/cache-manifest appcache manifest
174 | AddType text/vtt vtt
175 | AddType text/x-component htc
176 | AddType text/x-vcard vcf
177 |
178 |
179 |
180 | # ------------------------------------------------------------------------------
181 | # | UTF-8 encoding |
182 | # ------------------------------------------------------------------------------
183 |
184 | # Use UTF-8 encoding for anything served as `text/html` or `text/plain`.
185 | AddDefaultCharset utf-8
186 |
187 | # Force UTF-8 for certain file formats.
188 |
189 | AddCharset utf-8 .atom .css .js .json .rss .vtt .webapp .xml
190 |
191 |
192 |
193 | # ##############################################################################
194 | # # URL REWRITES #
195 | # ##############################################################################
196 |
197 | # ------------------------------------------------------------------------------
198 | # | Rewrite engine |
199 | # ------------------------------------------------------------------------------
200 |
201 | # Turning on the rewrite engine and enabling the `FollowSymLinks` option is
202 | # necessary for the following directives to work.
203 |
204 | # If your web host doesn't allow the `FollowSymlinks` option, you may need to
205 | # comment it out and use `Options +SymLinksIfOwnerMatch` but, be aware of the
206 | # performance impact: http://httpd.apache.org/docs/current/misc/perf-tuning.html#symlinks
207 |
208 | # Also, some cloud hosting services require `RewriteBase` to be set:
209 | # http://www.rackspace.com/knowledge_center/frequently-asked-question/why-is-mod-rewrite-not-working-on-my-site
210 |
211 |
212 | Options +FollowSymlinks
213 | # Options +SymLinksIfOwnerMatch
214 | RewriteEngine On
215 | # RewriteBase /
216 |
217 |
218 | # ------------------------------------------------------------------------------
219 | # | Suppressing / Forcing the "www." at the beginning of URLs |
220 | # ------------------------------------------------------------------------------
221 |
222 | # The same content should never be available under two different URLs especially
223 | # not with and without "www." at the beginning. This can cause SEO problems
224 | # (duplicate content), therefore, you should choose one of the alternatives and
225 | # redirect the other one.
226 |
227 | # By default option 1 (no "www.") is activated:
228 | # http://no-www.org/faq.php?q=class_b
229 |
230 | # If you'd prefer to use option 2, just comment out all the lines from option 1
231 | # and uncomment the ones from option 2.
232 |
233 | # IMPORTANT: NEVER USE BOTH RULES AT THE SAME TIME!
234 |
235 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
236 |
237 | # Option 1: rewrite www.example.com → example.com
238 |
239 |
240 | RewriteCond %{HTTPS} !=on
241 | RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
242 | RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
243 |
244 |
245 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
246 |
247 | # Option 2: rewrite example.com → www.example.com
248 |
249 | # Be aware that the following might not be a good idea if you use "real"
250 | # subdomains for certain parts of your website.
251 |
252 | #
253 | # RewriteCond %{HTTPS} !=on
254 | # RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
255 | # RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
256 | #
257 |
258 |
259 | # ##############################################################################
260 | # # SECURITY #
261 | # ##############################################################################
262 |
263 | # ------------------------------------------------------------------------------
264 | # | Content Security Policy (CSP) |
265 | # ------------------------------------------------------------------------------
266 |
267 | # You can mitigate the risk of cross-site scripting and other content-injection
268 | # attacks by setting a Content Security Policy which whitelists trusted sources
269 | # of content for your site.
270 |
271 | # The example header below allows ONLY scripts that are loaded from the current
272 | # site's origin (no inline scripts, no CDN, etc). This almost certainly won't
273 | # work as-is for your site!
274 |
275 | # To get all the details you'll need to craft a reasonable policy for your site,
276 | # read: http://html5rocks.com/en/tutorials/security/content-security-policy (or
277 | # see the specification: http://w3.org/TR/CSP).
278 |
279 | #
280 | # Header set Content-Security-Policy "script-src 'self'; object-src 'self'"
281 | #
282 | # Header unset Content-Security-Policy
283 | #
284 | #
285 |
286 | # ------------------------------------------------------------------------------
287 | # | File access |
288 | # ------------------------------------------------------------------------------
289 |
290 | # Block access to directories without a default document.
291 | # Usually you should leave this uncommented because you shouldn't allow anyone
292 | # to surf through every directory on your server (which may includes rather
293 | # private places like the CMS's directories).
294 |
295 |
296 | Options -Indexes
297 |
298 |
299 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
300 |
301 | # Block access to hidden files and directories.
302 | # This includes directories used by version control systems such as Git and SVN.
303 |
304 |
305 | RewriteCond %{SCRIPT_FILENAME} -d [OR]
306 | RewriteCond %{SCRIPT_FILENAME} -f
307 | RewriteRule "(^|/)\." - [F]
308 |
309 |
310 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
311 |
312 | # Block access to backup and source files.
313 | # These files may be left by some text editors and can pose a great security
314 | # danger when anyone has access to them.
315 |
316 |
317 | Order allow,deny
318 | Deny from all
319 | Satisfy All
320 |
321 |
322 | # ------------------------------------------------------------------------------
323 | # | Secure Sockets Layer (SSL) |
324 | # ------------------------------------------------------------------------------
325 |
326 | # Rewrite secure requests properly to prevent SSL certificate warnings, e.g.:
327 | # prevent `https://www.example.com` when your certificate only allows
328 | # `https://secure.example.com`.
329 |
330 | #
331 | # RewriteCond %{SERVER_PORT} !^443
332 | # RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L]
333 | #
334 |
335 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
336 |
337 | # Force client-side SSL redirection.
338 |
339 | # If a user types "example.com" in his browser, the above rule will redirect him
340 | # to the secure version of the site. That still leaves a window of opportunity
341 | # (the initial HTTP connection) for an attacker to downgrade or redirect the
342 | # request. The following header ensures that browser will ONLY connect to your
343 | # server via HTTPS, regardless of what the users type in the address bar.
344 | # http://www.html5rocks.com/en/tutorials/security/transport-layer-security/
345 |
346 | #
347 | # Header set Strict-Transport-Security max-age=16070400;
348 | #
349 |
350 | # ------------------------------------------------------------------------------
351 | # | Server software information |
352 | # ------------------------------------------------------------------------------
353 |
354 | # Avoid displaying the exact Apache version number, the description of the
355 | # generic OS-type and the information about Apache's compiled-in modules.
356 |
357 | # ADD THIS DIRECTIVE IN THE `httpd.conf` AS IT WILL NOT WORK IN THE `.htaccess`!
358 |
359 | # ServerTokens Prod
360 |
361 |
362 | # ##############################################################################
363 | # # WEB PERFORMANCE #
364 | # ##############################################################################
365 |
366 | # ------------------------------------------------------------------------------
367 | # | Compression |
368 | # ------------------------------------------------------------------------------
369 |
370 |
371 |
372 | # Force compression for mangled headers.
373 | # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping
374 |
375 |
376 | SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
377 | RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
378 |
379 |
380 |
381 | # Compress all output labeled with one of the following MIME-types
382 | # (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
383 | # and can remove the `` and `` lines
384 | # as `AddOutputFilterByType` is still in the core directives).
385 |
386 | AddOutputFilterByType DEFLATE application/atom+xml \
387 | application/javascript \
388 | application/json \
389 | application/rss+xml \
390 | application/vnd.ms-fontobject \
391 | application/x-font-ttf \
392 | application/x-web-app-manifest+json \
393 | application/xhtml+xml \
394 | application/xml \
395 | font/opentype \
396 | image/svg+xml \
397 | image/x-icon \
398 | text/css \
399 | text/html \
400 | text/plain \
401 | text/x-component \
402 | text/xml
403 |
404 |
405 |
406 |
407 | # ------------------------------------------------------------------------------
408 | # | Content transformations |
409 | # ------------------------------------------------------------------------------
410 |
411 | # Prevent some of the mobile network providers from modifying the content of
412 | # your site: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.5.
413 |
414 | #
415 | # Header set Cache-Control "no-transform"
416 | #
417 |
418 | # ------------------------------------------------------------------------------
419 | # | ETag removal |
420 | # ------------------------------------------------------------------------------
421 |
422 | # Since we're sending far-future expires headers (see below), ETags can
423 | # be removed: http://developer.yahoo.com/performance/rules.html#etags.
424 |
425 | # `FileETag None` is not enough for every server.
426 |
427 | Header unset ETag
428 |
429 |
430 | FileETag None
431 |
432 | # ------------------------------------------------------------------------------
433 | # | Expires headers (for better cache control) |
434 | # ------------------------------------------------------------------------------
435 |
436 | # The following expires headers are set pretty far in the future. If you don't
437 | # control versioning with filename-based cache busting, consider lowering the
438 | # cache time for resources like CSS and JS to something like 1 week.
439 |
440 |
441 |
442 | ExpiresActive on
443 | ExpiresDefault "access plus 1 month"
444 |
445 | # CSS
446 | ExpiresByType text/css "access plus 1 year"
447 |
448 | # Data interchange
449 | ExpiresByType application/json "access plus 0 seconds"
450 | ExpiresByType application/xml "access plus 0 seconds"
451 | ExpiresByType text/xml "access plus 0 seconds"
452 |
453 | # Favicon (cannot be renamed!)
454 | ExpiresByType image/x-icon "access plus 1 week"
455 |
456 | # HTML components (HTCs)
457 | ExpiresByType text/x-component "access plus 1 month"
458 |
459 | # HTML
460 | ExpiresByType text/html "access plus 0 seconds"
461 |
462 | # JavaScript
463 | ExpiresByType application/javascript "access plus 1 year"
464 |
465 | # Manifest files
466 | ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
467 | ExpiresByType text/cache-manifest "access plus 0 seconds"
468 |
469 | # Media
470 | ExpiresByType audio/ogg "access plus 1 month"
471 | ExpiresByType image/gif "access plus 1 month"
472 | ExpiresByType image/jpeg "access plus 1 month"
473 | ExpiresByType image/png "access plus 1 month"
474 | ExpiresByType video/mp4 "access plus 1 month"
475 | ExpiresByType video/ogg "access plus 1 month"
476 | ExpiresByType video/webm "access plus 1 month"
477 |
478 | # Web feeds
479 | ExpiresByType application/atom+xml "access plus 1 hour"
480 | ExpiresByType application/rss+xml "access plus 1 hour"
481 |
482 | # Web fonts
483 | ExpiresByType application/font-woff "access plus 1 month"
484 | ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
485 | ExpiresByType application/x-font-ttf "access plus 1 month"
486 | ExpiresByType font/opentype "access plus 1 month"
487 | ExpiresByType image/svg+xml "access plus 1 month"
488 |
489 |
490 |
491 | # ------------------------------------------------------------------------------
492 | # | Filename-based cache busting |
493 | # ------------------------------------------------------------------------------
494 |
495 | # If you're not using a build process to manage your filename version revving,
496 | # you might want to consider enabling the following directives to route all
497 | # requests such as `/css/style.12345.css` to `/css/style.css`.
498 |
499 | # To understand why this is important and a better idea than `*.css?v231`, read:
500 | # http://stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring
501 |
502 | #
503 | # RewriteCond %{REQUEST_FILENAME} !-f
504 | # RewriteCond %{REQUEST_FILENAME} !-d
505 | # RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L]
506 | #
507 |
508 | # ------------------------------------------------------------------------------
509 | # | File concatenation |
510 | # ------------------------------------------------------------------------------
511 |
512 | # Allow concatenation from within specific CSS and JS files, e.g.:
513 | # Inside of `script.combined.js` you could have
514 | #
515 | #
516 | # and they would be included into this single file.
517 |
518 | #
519 | #
520 | # Options +Includes
521 | # AddOutputFilterByType INCLUDES application/javascript application/json
522 | # SetOutputFilter INCLUDES
523 | #
524 | #
525 | # Options +Includes
526 | # AddOutputFilterByType INCLUDES text/css
527 | # SetOutputFilter INCLUDES
528 | #
529 | #
530 |
531 | # ------------------------------------------------------------------------------
532 | # | Persistent connections |
533 | # ------------------------------------------------------------------------------
534 |
535 | # Allow multiple requests to be sent over the same TCP connection:
536 | # http://httpd.apache.org/docs/current/en/mod/core.html#keepalive.
537 |
538 | # Enable if you serve a lot of static content but, be aware of the
539 | # possible disadvantages!
540 |
541 | #
542 | # Header set Connection Keep-Alive
543 | #
544 |
--------------------------------------------------------------------------------
/app/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Page Not Found :(
6 |
141 |
142 |
143 |
144 |
Not found :(
145 |
Sorry, but the page you were trying to view does not exist.
146 |
It looks like this was the result of either:
147 |
148 | - a mistyped address
149 | - an out-of-date link
150 |
151 |
154 |
155 |
156 |
157 |
158 |
--------------------------------------------------------------------------------
/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2fdevs/angular-virtual-list/74c636cbba82ef0df59478b77605944f5c912697/app/favicon.ico
--------------------------------------------------------------------------------
/app/images/yeoman.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2fdevs/angular-virtual-list/74c636cbba82ef0df59478b77605944f5c912697/app/images/yeoman.png
--------------------------------------------------------------------------------
/app/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
16 |
17 |
18 |
19 |
25 |
26 |
27 |
28 |
31 |
32 |
33 |
34 |
35 |
44 |
45 |
46 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/app/robots.txt:
--------------------------------------------------------------------------------
1 | # robotstxt.org
2 |
3 | User-agent: *
4 |
--------------------------------------------------------------------------------
/app/scripts/app.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | /**
4 | * @ngdoc overview
5 | * @name virtualListApp
6 | * @description
7 | * # virtualListApp
8 | *
9 | * Main module of the application.
10 | */
11 | angular
12 | .module('virtualListApp', ['ngRoute'])
13 | .config(function ($routeProvider) {
14 | $routeProvider
15 | .when('/', {
16 | templateUrl: 'views/main.html',
17 | controllerAs: 'controller',
18 | controller: 'MainCtrl'
19 | })
20 | .otherwise({
21 | redirectTo: '/'
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/app/scripts/controllers/main.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | /**
4 | * @ngdoc function
5 | * @name virtualListApp.controller:MainCtrl
6 | * @description
7 | * # MainCtrl
8 | * Controller of the virtualListApp
9 | */
10 | angular.module('virtualListApp')
11 | .controller('MainCtrl', function () {
12 | var dp = [];
13 |
14 | for (var i=0; i<1000000; i++) {
15 | dp.push({
16 | index: i,
17 | label: "label " + i,
18 | value: "value " + i
19 | });
20 | }
21 |
22 | this.dataProvider = dp;
23 | this.selectedOption = null;
24 |
25 | this.onSelect = function(option) {
26 | console.log(option);
27 | };
28 | });
29 |
--------------------------------------------------------------------------------
/app/scripts/directives/ui-virtual-list.js:
--------------------------------------------------------------------------------
1 | angular.module('virtualListApp')
2 | .directive('uiVirtualList',
3 | [function () {
4 | 'use strict';
5 | return {
6 | restrict: 'E',
7 | require: "ngModel",
8 | templateUrl: "views/directives/ui-virtual-list.html",
9 | scope: {
10 | uiDataProvider: '=',
11 | uiOnSelect: '&'
12 | },
13 | link: function (scope, elem, attrs, ngModelCtrl) {
14 | var rowHeight = 30;
15 |
16 | scope.height = 200;
17 | scope.scrollTop = 0;
18 | scope.visibleProvider = [];
19 | scope.cellsPerPage = 0;
20 | scope.numberOfCells = 0;
21 | scope.canvasHeight = {};
22 |
23 | // Init
24 | scope.init = function () {
25 | elem[0].addEventListener('scroll', scope.onScroll);
26 | scope.cellsPerPage = Math.round(scope.height / rowHeight);
27 | scope.numberOfCells = 3 * scope.cellsPerPage;
28 | scope.canvasHeight = {
29 | height: scope.uiDataProvider.length * rowHeight + 'px'
30 | };
31 |
32 | scope.updateDisplayList();
33 | };
34 |
35 | scope.updateDisplayList = function () {
36 | var firstCell = Math.max(Math.floor(scope.scrollTop / rowHeight) - scope.cellsPerPage, 0);
37 | var cellsToCreate = Math.min(firstCell + scope.numberOfCells, scope.numberOfCells);
38 | scope.visibleProvider = scope.uiDataProvider.slice(firstCell, firstCell + cellsToCreate);
39 |
40 | for (var i = 0; i < scope.visibleProvider.length; i++) {
41 | scope.visibleProvider[i].styles = {
42 | 'top': ((firstCell + i) * rowHeight) + "px"
43 | }
44 | }
45 | };
46 |
47 | scope.onScroll = function (evt) {
48 | scope.scrollTop = elem.prop('scrollTop');
49 | scope.updateDisplayList();
50 |
51 | scope.$apply();
52 | };
53 |
54 | scope.onClickOption = function (option) {
55 | ngModelCtrl.$setViewValue(option);
56 | scope.currentOption = option;
57 | scope.uiOnSelect({"option": option});
58 | };
59 |
60 | scope.init();
61 | }
62 | };
63 | }
64 | ]);
65 |
--------------------------------------------------------------------------------
/app/styles/main.css:
--------------------------------------------------------------------------------
1 | .browsehappy {
2 | margin: 0.2em 0;
3 | background: #ccc;
4 | color: #000;
5 | padding: 0.2em 0; }
6 |
7 | /* Space out content a bit */
8 | body {
9 | padding-top: 20px;
10 | padding-bottom: 20px; }
11 |
12 | /* Everything but the jumbotron gets side spacing for mobile first views */
13 | .header,
14 | .marketing,
15 | .footer {
16 | padding-left: 15px;
17 | padding-right: 15px; }
18 |
19 | /* Custom page header */
20 | .header {
21 | border-bottom: 1px solid #e5e5e5;
22 | /* Make the masthead heading the same height as the navigation */ }
23 | .header h3 {
24 | margin-top: 0;
25 | margin-bottom: 0;
26 | line-height: 40px;
27 | padding-bottom: 19px; }
28 |
29 | /* Custom page footer */
30 | .footer {
31 | padding-top: 19px;
32 | color: #777;
33 | border-top: 1px solid #e5e5e5; }
34 |
35 | .container-narrow > hr {
36 | margin: 30px 0; }
37 |
38 | .selectedOption {
39 | width: 300px;
40 | display: inline-block; }
41 |
42 | ui-virtual-list {
43 | width: 200px;
44 | max-height: 200px;
45 | overflow-y: auto;
46 | display: block;
47 | }
48 |
49 | ui-virtual-list .canvas {
50 | background-color: #eee;
51 | position: relative;
52 | }
53 |
54 | ui-virtual-list div.renderer {
55 | display: block;
56 | width: 100%;
57 | cursor: pointer;
58 | position: absolute;
59 | height: 30px;
60 | line-height: 30px;
61 | }
62 |
63 | ui-virtual-list div.renderer span {
64 | margin-left: 10px;
65 | }
66 |
67 | ui-virtual-list div.renderer.selected {
68 | background-color: #ccc;
69 | }
70 |
71 | ui-virtual-list div.renderer:hover {
72 | background-color: #666;
73 | color: white;
74 | }
75 |
76 | /* Responsive: Portrait tablets and up */
77 | @media screen and (min-width: 768px) {
78 | .container {
79 | max-width: 730px; }
80 |
81 | /* Remove the padding we set earlier */
82 | .header,
83 | .footer {
84 | padding-left: 0;
85 | padding-right: 0; }
86 |
87 | /* Space out the masthead */
88 | .header {
89 | margin-bottom: 30px; } }
90 |
91 | /*# sourceMappingURL=main.css.map */
92 |
--------------------------------------------------------------------------------
/app/styles/main.scss:
--------------------------------------------------------------------------------
1 | // bower:scss
2 | // endbower
3 |
4 | .browsehappy {
5 | margin: 0.2em 0;
6 | background: #ccc;
7 | color: #000;
8 | padding: 0.2em 0;
9 | }
10 |
11 | /* Space out content a bit */
12 | body {
13 | padding-top: 20px;
14 | padding-bottom: 20px;
15 | }
16 |
17 | /* Everything but the jumbotron gets side spacing for mobile first views */
18 | .header,
19 | .marketing,
20 | .footer {
21 | padding-left: 15px;
22 | padding-right: 15px;
23 | }
24 |
25 | /* Custom page header */
26 | .header {
27 | border-bottom: 1px solid #e5e5e5;
28 |
29 | /* Make the masthead heading the same height as the navigation */
30 | h3 {
31 | margin-top: 0;
32 | margin-bottom: 0;
33 | line-height: 40px;
34 | padding-bottom: 19px;
35 | }
36 | }
37 |
38 | /* Custom page footer */
39 | .footer {
40 | padding-top: 19px;
41 | color: #777;
42 | border-top: 1px solid #e5e5e5;
43 | }
44 |
45 | .container-narrow > hr {
46 | margin: 30px 0;
47 | }
48 |
49 | .selectedOption {
50 | width: 300px;
51 | display: inline-block;
52 | }
53 |
54 | ui-virtual-list {
55 | width: 200px;
56 | max-height: 200px;
57 | overflow-y: auto;
58 | display: block;
59 |
60 | .canvas {
61 | background-color: #eee;
62 | position: relative;
63 | }
64 |
65 | div.renderer {
66 | display: block;
67 | width: 100%;
68 | cursor: pointer;
69 | position: absolute;
70 | height: 30px;
71 | line-height: 30px;
72 |
73 | span {
74 | margin-left: 10px;
75 | }
76 |
77 | &.selected {
78 | background-color: #ccc;
79 | }
80 |
81 | &:hover {
82 | background-color: #666;
83 | color: white;
84 | }
85 | }
86 | }
87 |
88 |
89 | /* Responsive: Portrait tablets and up */
90 | @media screen and (min-width: 768px) {
91 | .container {
92 | max-width: 730px;
93 | }
94 |
95 | /* Remove the padding we set earlier */
96 | .header,
97 | .footer {
98 | padding-left: 0;
99 | padding-right: 0;
100 | }
101 | /* Space out the masthead */
102 | .header {
103 | margin-bottom: 30px;
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/app/views/directives/ui-virtual-list.html:
--------------------------------------------------------------------------------
1 |
2 |
7 | {{item.label}}
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/views/main.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | {{controller.selectedOption | json}}
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "virtual-list",
3 | "version": "0.0.0",
4 | "dependencies": {
5 | "angular": "~1.2.0",
6 | "json3": "~3.3.1",
7 | "es5-shim": "~3.1.0",
8 | "angular-resource": "~1.2.0",
9 | "angular-cookies": "~1.2.0",
10 | "angular-sanitize": "~1.2.0",
11 | "angular-animate": "~1.2.0",
12 | "angular-touch": "~1.2.0",
13 | "angular-route": "~1.2.0",
14 | "bootstrap": "~3.3.1"
15 | },
16 | "devDependencies": {
17 | "angular-mocks": "~1.2.0",
18 | "angular-scenario": "~1.2.0"
19 | },
20 | "appPath": "app"
21 | }
22 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "virtuallist",
3 | "version": "0.0.0",
4 | "dependencies": {},
5 | "devDependencies": {
6 | "grunt": "^0.4.1",
7 | "grunt-autoprefixer": "^0.7.3",
8 | "grunt-concurrent": "^0.5.0",
9 | "grunt-contrib-clean": "^0.5.0",
10 | "grunt-contrib-compass": "^0.7.2",
11 | "grunt-contrib-concat": "^0.4.0",
12 | "grunt-contrib-connect": "^0.7.1",
13 | "grunt-contrib-copy": "^0.5.0",
14 | "grunt-contrib-cssmin": "^0.9.0",
15 | "grunt-contrib-htmlmin": "^0.3.0",
16 | "grunt-contrib-imagemin": "^0.8.1",
17 | "grunt-contrib-jshint": "^0.10.0",
18 | "grunt-contrib-uglify": "^0.4.0",
19 | "grunt-contrib-watch": "^0.6.1",
20 | "grunt-filerev": "^0.2.1",
21 | "grunt-google-cdn": "^0.4.0",
22 | "grunt-newer": "^0.7.0",
23 | "grunt-ng-annotate": "^0.3.0",
24 | "grunt-svgmin": "^0.4.0",
25 | "grunt-usemin": "^2.1.1",
26 | "grunt-wiredep": "^1.7.0",
27 | "jshint-stylish": "^0.2.0",
28 | "load-grunt-tasks": "^0.4.0",
29 | "time-grunt": "^0.3.1"
30 | },
31 | "engines": {
32 | "node": ">=0.10.0"
33 | },
34 | "scripts": {
35 | "test": "grunt test"
36 | }
37 | }
--------------------------------------------------------------------------------
/test/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "node": true,
3 | "browser": true,
4 | "esnext": true,
5 | "bitwise": true,
6 | "camelcase": true,
7 | "curly": true,
8 | "eqeqeq": true,
9 | "immed": true,
10 | "indent": 2,
11 | "latedef": true,
12 | "newcap": true,
13 | "noarg": true,
14 | "quotmark": "single",
15 | "regexp": true,
16 | "undef": true,
17 | "unused": true,
18 | "strict": true,
19 | "trailing": true,
20 | "smarttabs": true,
21 | "globals": {
22 | "after": false,
23 | "afterEach": false,
24 | "angular": false,
25 | "before": false,
26 | "beforeEach": false,
27 | "browser": false,
28 | "describe": false,
29 | "expect": false,
30 | "inject": false,
31 | "it": false,
32 | "jasmine": false,
33 | "spyOn": false
34 | }
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/test/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration
2 | // http://karma-runner.github.io/0.12/config/configuration-file.html
3 | // Generated on 2014-11-22 using
4 | // generator-karma 0.8.3
5 |
6 | module.exports = function(config) {
7 | 'use strict';
8 |
9 | config.set({
10 | // enable / disable watching file and executing tests whenever any file changes
11 | autoWatch: true,
12 |
13 | // base path, that will be used to resolve files and exclude
14 | basePath: '../',
15 |
16 | // testing framework to use (jasmine/mocha/qunit/...)
17 | frameworks: ['jasmine'],
18 |
19 | // list of files / patterns to load in the browser
20 | files: [
21 | 'bower_components/angular/angular.js',
22 | 'bower_components/angular-mocks/angular-mocks.js',
23 | 'bower_components/angular-animate/angular-animate.js',
24 | 'bower_components/angular-cookies/angular-cookies.js',
25 | 'bower_components/angular-resource/angular-resource.js',
26 | 'bower_components/angular-route/angular-route.js',
27 | 'bower_components/angular-sanitize/angular-sanitize.js',
28 | 'bower_components/angular-touch/angular-touch.js',
29 | 'app/scripts/**/*.js',
30 | 'test/mock/**/*.js',
31 | 'test/spec/**/*.js'
32 | ],
33 |
34 | // list of files / patterns to exclude
35 | exclude: [],
36 |
37 | // web server port
38 | port: 8080,
39 |
40 | // Start these browsers, currently available:
41 | // - Chrome
42 | // - ChromeCanary
43 | // - Firefox
44 | // - Opera
45 | // - Safari (only Mac)
46 | // - PhantomJS
47 | // - IE (only Windows)
48 | browsers: [
49 | 'PhantomJS'
50 | ],
51 |
52 | // Which plugins to enable
53 | plugins: [
54 | 'karma-phantomjs-launcher',
55 | 'karma-jasmine'
56 | ],
57 |
58 | // Continuous Integration mode
59 | // if true, it capture browsers, run tests and exit
60 | singleRun: false,
61 |
62 | colors: true,
63 |
64 | // level of logging
65 | // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
66 | logLevel: config.LOG_INFO,
67 |
68 | // Uncomment the following lines if you are using grunt's server to run the tests
69 | // proxies: {
70 | // '/': 'http://localhost:9000/'
71 | // },
72 | // URL root prevent conflicts with the site root
73 | // urlRoot: '_karma_'
74 | });
75 | };
76 |
--------------------------------------------------------------------------------
/test/spec/controllers/about.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | describe('Controller: AboutCtrl', function () {
4 |
5 | // load the controller's module
6 | beforeEach(module('virtualListApp'));
7 |
8 | var AboutCtrl,
9 | scope;
10 |
11 | // Initialize the controller and a mock scope
12 | beforeEach(inject(function ($controller, $rootScope) {
13 | scope = $rootScope.$new();
14 | AboutCtrl = $controller('AboutCtrl', {
15 | $scope: scope
16 | });
17 | }));
18 |
19 | it('should attach a list of awesomeThings to the scope', function () {
20 | expect(scope.awesomeThings.length).toBe(3);
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/test/spec/controllers/main.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | describe('Controller: MainCtrl', function () {
4 |
5 | // load the controller's module
6 | beforeEach(module('virtualListApp'));
7 |
8 | var MainCtrl,
9 | scope;
10 |
11 | // Initialize the controller and a mock scope
12 | beforeEach(inject(function ($controller, $rootScope) {
13 | scope = $rootScope.$new();
14 | MainCtrl = $controller('MainCtrl', {
15 | $scope: scope
16 | });
17 | }));
18 |
19 | it('should attach a list of awesomeThings to the scope', function () {
20 | expect(scope.awesomeThings.length).toBe(3);
21 | });
22 | });
23 |
--------------------------------------------------------------------------------