Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial commit #1

Merged
merged 1 commit into from
Jul 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea
public
node_modules
temp
23 changes: 23 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"boss": true,
"browser": true,
"eqnull": true,
"expr": true,
"immed": true,
"laxbreak": true,
"loopfunc": true,
"newcap": true,
"noarg": true,
"noempty": true,
"nonew": true,
"quotmark": true,
"smarttabs": true,
"strict": true,
"sub": true,
"trailing": true,
"undef": true,
"unused": true,
"globals": {
"angular": false
}
}
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules/
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
language: node_js
node_js:
- '0.10'
before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm install -g npm
- npm install -g bower grunt-cli karma
- npm install
script:
- grunt travis
branches:
only:
- master
140 changes: 140 additions & 0 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Build configurations.
module.exports = (grunt) ->

grunt.loadNpmTasks 'grunt-karma'
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-jshint'
grunt.loadNpmTasks 'grunt-contrib-concat'
grunt.loadNpmTasks 'grunt-contrib-uglify'

grunt.initConfig
connect:
app:
options:
base: './src/'
middleware: require './server/middleware'
port: 5001
watch:
options:
livereload: false
karma:
unit:
options:
autoWatch: true
colors: true
configFile: './test/karma.conf.js'
keepalive: true
port: 8081
runnerPort: 9100
travis:
options:
colors: true
configFile: './test/karma.conf.js'
runnerPort: 9100
singleRun: true

# transpile CoffeeScript (.coffee) files to JavaScript (.js).
coffee:
build:
files: [
cwd: './src'
src: '*.coffee'
dest: './temp/'
expand: true
ext: '.js'
]
options:
bare: true
#sourceMap: true

#prepend 'use strict' to the files
concat:
#usestrict:
options:
banner: '(function () {\n\'use strict\';\n'
footer: '}());'
stripBanners: true
process: (src, filepath) ->
console.log("Processing #{filepath} ...")

strings = /("(?:(?:\\")|[^"])*")/g
singleQuotes = /'/g

src.replace(strings,
(match) ->
console.log("match: " + match)
result = "'" + match.substring(1, match.length-1).replace(singleQuotes, "\\'") + "'"
console.log "replaced with: " + result
result
)

dynamic_mappings:
files:
'dist/ui-scroll.js': ['./temp/**/ui-scroll.js']
'dist/ui-scroll-jqlite.js': ['./temp/**/ui-scroll-jqlite.js']

uglify:
common:
files:
'./dist/ui-scroll.min.js': [
'./dist/ui-scroll.js'
]
'./dist/ui-scroll-jqlite.min.js': [
'./dist/ui-scroll-jqlite.js'
]

# run the linter
jshint:
dist:
files:
src: ['./dist/ui-scroll.js', './dist/ui-scroll-jqlite.js']
options: jshintrc: '.jshintrc'
test:
files:
src : [ './test/*Spec.js']
options: grunt.util._.extend({}, grunt.file.readJSON('.jshintrc'), {
node: true
globals:
angular: false
inject: false
jQuery: false
jasmine: false
afterEach: false
beforeEach: false
ddescribe: false
describe: false
expect: false
iit: false
it: false
spyOn: false
xdescribe: false
xit: false
})

# Starts a web server
# Enter the following command at the command line to execute this task:
# grunt server
grunt.registerTask 'server', [
'connect'
'watch'
]

grunt.registerTask 'default', ['server']

grunt.registerTask 'test', [
'karma:unit'
]

grunt.registerTask 'build', [
'jshint:test'
'karma:travis'
'coffee:build'
'concat'
'jshint:dist'
'uglify:common']

grunt.registerTask 'travis', [
'karma:travis'
]
22 changes: 22 additions & 0 deletions LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2013 Hill30 INC

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
30 changes: 30 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "ui-scroll",
"version": "1.2.1",
"homepage": "https://github.com/Hill30/NGScroller.git",
"description": "AngularJS infinite scrolling module",
"main": "./dist/ui-scroll.js",
"keywords": [
"ui.scroll",
"angularjs",
"ui-utils",
"ui.utils",
"infinite",
"live",
"perpetual",
"scroll",
"scroller",
"scrolling"
],
"license": "MIT",
"ignore": [
"server",
"test",
"src/examples",
"src/index.html",
"**/.*",
"Gruntfile.coffee",
"package.json",
"test.dat"
]
}
88 changes: 88 additions & 0 deletions demo/examples/adapter.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
angular.module('application', ['ui.scroll', 'ui.scroll.jqlite']).controller('mainController',
[ '$scope', '$log', '$timeout'
($scope, console, $timeout)->

# datasource implementation

datasource = {}

datasource.get = (index, count, success)->
$timeout(
->
result = []
for i in [index..index + count-1]
item = {}
item.id = i
item.content = "item #" + i
result.push item
success(result)
100
)

$scope.datasource = datasource


# 1st list adapter implementation

$scope.firstListAdapter = remain: true

$scope.updateList1 = ->
$scope.firstListAdapter.applyUpdates (item, scope) ->
item.content += ' *'

$scope.removeFromList1 = ->
$scope.firstListAdapter.applyUpdates (item, scope) ->
if scope.$index % 2 == 0
return []

idList1 = 1000

$scope.addToList1 = ->
$scope.firstListAdapter.applyUpdates (item, scope) ->
newItem = undefined
if scope.$index == 2
newItem =
id: idList1
content: 'a new one #' + idList1
idList1++
return [
item
newItem
]
return


# 2nd list adapter implementation

$scope.updateList2 = ->
$scope.second.list.adapter.applyUpdates (item, scope) ->
item.content += ' *'

$scope.removeFromList2 = ->
$scope.second.list.adapter.applyUpdates (item, scope) ->
if scope.$index % 2 != 0
return []

idList2 = 2000

$scope.addToList2 = ->
$scope.second.list.adapter.applyUpdates (item, scope) ->
newItem = undefined
if scope.$index == 4
newItem =
id: idList2
content: 'a new one #' + idList1
idList2++
return [
item
newItem
]
return

])

angular.bootstrap(document, ["application"])

###
//# sourceURL=src/adapter.js
###
Loading