Skip to content

Commit b0e91d7

Browse files
committed
Merge pull request #1 from dhilt/init
initial commit
2 parents a0abf0a + 92b2d87 commit b0e91d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+4905
-0
lines changed

Diff for: .gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.idea
2+
public
3+
node_modules
4+
temp

Diff for: .jshintrc

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"boss": true,
3+
"browser": true,
4+
"eqnull": true,
5+
"expr": true,
6+
"immed": true,
7+
"laxbreak": true,
8+
"loopfunc": true,
9+
"newcap": true,
10+
"noarg": true,
11+
"noempty": true,
12+
"nonew": true,
13+
"quotmark": true,
14+
"smarttabs": true,
15+
"strict": true,
16+
"sub": true,
17+
"trailing": true,
18+
"undef": true,
19+
"unused": true,
20+
"globals": {
21+
"angular": false
22+
}
23+
}

Diff for: .npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules/

Diff for: .travis.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
language: node_js
3+
node_js:
4+
- '0.10'
5+
before_install:
6+
- export DISPLAY=:99.0
7+
- sh -e /etc/init.d/xvfb start
8+
- npm install -g npm
9+
- npm install -g bower grunt-cli karma
10+
- npm install
11+
script:
12+
- grunt travis
13+
branches:
14+
only:
15+
- master

Diff for: Gruntfile.coffee

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# Build configurations.
2+
module.exports = (grunt) ->
3+
4+
grunt.loadNpmTasks 'grunt-karma'
5+
grunt.loadNpmTasks 'grunt-contrib-connect'
6+
grunt.loadNpmTasks 'grunt-contrib-watch'
7+
grunt.loadNpmTasks 'grunt-contrib-coffee'
8+
grunt.loadNpmTasks 'grunt-contrib-jshint'
9+
grunt.loadNpmTasks 'grunt-contrib-concat'
10+
grunt.loadNpmTasks 'grunt-contrib-uglify'
11+
12+
grunt.initConfig
13+
connect:
14+
app:
15+
options:
16+
base: './src/'
17+
middleware: require './server/middleware'
18+
port: 5001
19+
watch:
20+
options:
21+
livereload: false
22+
karma:
23+
unit:
24+
options:
25+
autoWatch: true
26+
colors: true
27+
configFile: './test/karma.conf.js'
28+
keepalive: true
29+
port: 8081
30+
runnerPort: 9100
31+
travis:
32+
options:
33+
colors: true
34+
configFile: './test/karma.conf.js'
35+
runnerPort: 9100
36+
singleRun: true
37+
38+
# transpile CoffeeScript (.coffee) files to JavaScript (.js).
39+
coffee:
40+
build:
41+
files: [
42+
cwd: './src'
43+
src: '*.coffee'
44+
dest: './temp/'
45+
expand: true
46+
ext: '.js'
47+
]
48+
options:
49+
bare: true
50+
#sourceMap: true
51+
52+
#prepend 'use strict' to the files
53+
concat:
54+
#usestrict:
55+
options:
56+
banner: '(function () {\n\'use strict\';\n'
57+
footer: '}());'
58+
stripBanners: true
59+
process: (src, filepath) ->
60+
console.log("Processing #{filepath} ...")
61+
62+
strings = /("(?:(?:\\")|[^"])*")/g
63+
singleQuotes = /'/g
64+
65+
src.replace(strings,
66+
(match) ->
67+
console.log("match: " + match)
68+
result = "'" + match.substring(1, match.length-1).replace(singleQuotes, "\\'") + "'"
69+
console.log "replaced with: " + result
70+
result
71+
)
72+
73+
dynamic_mappings:
74+
files:
75+
'dist/ui-scroll.js': ['./temp/**/ui-scroll.js']
76+
'dist/ui-scroll-jqlite.js': ['./temp/**/ui-scroll-jqlite.js']
77+
78+
uglify:
79+
common:
80+
files:
81+
'./dist/ui-scroll.min.js': [
82+
'./dist/ui-scroll.js'
83+
]
84+
'./dist/ui-scroll-jqlite.min.js': [
85+
'./dist/ui-scroll-jqlite.js'
86+
]
87+
88+
# run the linter
89+
jshint:
90+
dist:
91+
files:
92+
src: ['./dist/ui-scroll.js', './dist/ui-scroll-jqlite.js']
93+
options: jshintrc: '.jshintrc'
94+
test:
95+
files:
96+
src : [ './test/*Spec.js']
97+
options: grunt.util._.extend({}, grunt.file.readJSON('.jshintrc'), {
98+
node: true
99+
globals:
100+
angular: false
101+
inject: false
102+
jQuery: false
103+
jasmine: false
104+
afterEach: false
105+
beforeEach: false
106+
ddescribe: false
107+
describe: false
108+
expect: false
109+
iit: false
110+
it: false
111+
spyOn: false
112+
xdescribe: false
113+
xit: false
114+
})
115+
116+
# Starts a web server
117+
# Enter the following command at the command line to execute this task:
118+
# grunt server
119+
grunt.registerTask 'server', [
120+
'connect'
121+
'watch'
122+
]
123+
124+
grunt.registerTask 'default', ['server']
125+
126+
grunt.registerTask 'test', [
127+
'karma:unit'
128+
]
129+
130+
grunt.registerTask 'build', [
131+
'jshint:test'
132+
'karma:travis'
133+
'coffee:build'
134+
'concat'
135+
'jshint:dist'
136+
'uglify:common']
137+
138+
grunt.registerTask 'travis', [
139+
'karma:travis'
140+
]

Diff for: LICENSE-MIT

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2013 Hill30 INC
2+
3+
Permission is hereby granted, free of charge, to any person
4+
obtaining a copy of this software and associated documentation
5+
files (the "Software"), to deal in the Software without
6+
restriction, including without limitation the rights to use,
7+
copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the
9+
Software is furnished to do so, subject to the following
10+
conditions:
11+
12+
The above copyright notice and this permission notice shall be
13+
included in all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.

Diff for: bower.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "ui-scroll",
3+
"version": "1.2.1",
4+
"homepage": "https://github.com/Hill30/NGScroller.git",
5+
"description": "AngularJS infinite scrolling module",
6+
"main": "./dist/ui-scroll.js",
7+
"keywords": [
8+
"ui.scroll",
9+
"angularjs",
10+
"ui-utils",
11+
"ui.utils",
12+
"infinite",
13+
"live",
14+
"perpetual",
15+
"scroll",
16+
"scroller",
17+
"scrolling"
18+
],
19+
"license": "MIT",
20+
"ignore": [
21+
"server",
22+
"test",
23+
"src/examples",
24+
"src/index.html",
25+
"**/.*",
26+
"Gruntfile.coffee",
27+
"package.json",
28+
"test.dat"
29+
]
30+
}

Diff for: demo/examples/adapter.coffee

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
angular.module('application', ['ui.scroll', 'ui.scroll.jqlite']).controller('mainController',
2+
[ '$scope', '$log', '$timeout'
3+
($scope, console, $timeout)->
4+
5+
# datasource implementation
6+
7+
datasource = {}
8+
9+
datasource.get = (index, count, success)->
10+
$timeout(
11+
->
12+
result = []
13+
for i in [index..index + count-1]
14+
item = {}
15+
item.id = i
16+
item.content = "item #" + i
17+
result.push item
18+
success(result)
19+
100
20+
)
21+
22+
$scope.datasource = datasource
23+
24+
25+
# 1st list adapter implementation
26+
27+
$scope.firstListAdapter = remain: true
28+
29+
$scope.updateList1 = ->
30+
$scope.firstListAdapter.applyUpdates (item, scope) ->
31+
item.content += ' *'
32+
33+
$scope.removeFromList1 = ->
34+
$scope.firstListAdapter.applyUpdates (item, scope) ->
35+
if scope.$index % 2 == 0
36+
return []
37+
38+
idList1 = 1000
39+
40+
$scope.addToList1 = ->
41+
$scope.firstListAdapter.applyUpdates (item, scope) ->
42+
newItem = undefined
43+
if scope.$index == 2
44+
newItem =
45+
id: idList1
46+
content: 'a new one #' + idList1
47+
idList1++
48+
return [
49+
item
50+
newItem
51+
]
52+
return
53+
54+
55+
# 2nd list adapter implementation
56+
57+
$scope.updateList2 = ->
58+
$scope.second.list.adapter.applyUpdates (item, scope) ->
59+
item.content += ' *'
60+
61+
$scope.removeFromList2 = ->
62+
$scope.second.list.adapter.applyUpdates (item, scope) ->
63+
if scope.$index % 2 != 0
64+
return []
65+
66+
idList2 = 2000
67+
68+
$scope.addToList2 = ->
69+
$scope.second.list.adapter.applyUpdates (item, scope) ->
70+
newItem = undefined
71+
if scope.$index == 4
72+
newItem =
73+
id: idList2
74+
content: 'a new one #' + idList1
75+
idList2++
76+
return [
77+
item
78+
newItem
79+
]
80+
return
81+
82+
])
83+
84+
angular.bootstrap(document, ["application"])
85+
86+
###
87+
//# sourceURL=src/adapter.js
88+
###

0 commit comments

Comments
 (0)