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

Merge the new version of CommentCoreLibrary with enhanced APIs #63

Merged
merged 59 commits into from
Apr 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
4825af1
Working CSS only render
jabbany Nov 30, 2014
c4d57c3
Improved efficiency greatly. Uses full HW acceleration if available f…
jabbany Dec 1, 2014
041766f
Merge changes from master
jabbany Mar 12, 2015
29e1e59
add ScrollComment 'CSS animation' mode
WhiteBlue Feb 14, 2016
8bfe620
Merge branch 'WhiteBlue-dev-cssonly' into dev-cssonly
jabbany Feb 15, 2016
e3b167f
Merge cleanup
jabbany Feb 15, 2016
0b230b6
Update from master
jabbany Feb 15, 2016
d5d2397
Merge branch 'master' into dev-cssonly
jabbany May 13, 2016
66b1240
Bump version
jabbany May 13, 2016
25560c6
Merge branch 'master' into dev-cssonly
jabbany May 13, 2016
1ec6aca
Bump version after bugfix
jabbany May 13, 2016
eb8bf0d
Cleanup and add stop polyfill.
jabbany May 13, 2016
de119d3
Merge branch 'master' into dev-cssonly
jabbany Sep 26, 2016
44e6ece
New loading method
jabbany Oct 13, 2016
17a7b3d
Added some more tests to cover new comment loading system
jabbany Oct 14, 2016
25cb15e
Restructuring project
jabbany Oct 18, 2016
512452c
Fix some errors and indentation
jabbany Oct 18, 2016
903d4a9
More enhancements
jabbany Oct 19, 2016
ecd3875
Fix tests
jabbany Oct 19, 2016
56fcc9c
Working CSS only render
jabbany Nov 30, 2014
8ed9a18
Improved efficiency greatly. Uses full HW acceleration if available f…
jabbany Dec 1, 2014
70b253c
add ScrollComment 'CSS animation' mode
WhiteBlue Feb 14, 2016
23f72cb
Merge cleanup
jabbany Feb 15, 2016
89b55cf
Bump version
jabbany May 13, 2016
57ce088
Bump version after bugfix
jabbany May 13, 2016
65ba033
Cleanup and add stop polyfill.
jabbany May 13, 2016
7699890
Update URLs to not use vanity domain
jabbany Sep 22, 2016
4b3d37a
Update dependencies and use grunt-ts instead of grunt-typescript for …
jabbany Sep 26, 2016
d61d9f5
Merge branch 'dev-cssonly' of github.com:jabbany/CommentCoreLibrary i…
jabbany Oct 19, 2016
db6bd13
Merge remote-tracking branch 'origin/master' into dev-cssonly
jabbany Oct 19, 2016
eacfb36
Correctly bump version to 0.11.0 instead
jabbany Oct 19, 2016
17961b5
Various documentation fixes
jabbany Oct 19, 2016
80145ca
Merge branch 'dev-new-loader' of github.com:jabbany/CommentCoreLibrar…
jabbany Oct 19, 2016
6a2bd3a
Add tests and fix bugs found
jabbany Oct 20, 2016
6874e37
Cleanup and more tests
jabbany Oct 22, 2016
7eb76b2
Use proper promise idiom in Provider
jabbany Oct 26, 2016
06730b3
Ignore project specs if using eclipse
jabbany Nov 1, 2016
16eafd6
Formatting
jabbany Nov 7, 2016
e832a0f
Added abstraction for CommentFactory
jabbany Nov 10, 2016
03ed03b
Fix bug with mode7 being allocated into CSA
jabbany Nov 10, 2016
2b1cf3a
Added some tests
jabbany Nov 16, 2016
a183c9a
Changing compile location etc.
jabbany Nov 16, 2016
3a53b2c
Updated some code
jabbany Nov 24, 2016
3d3d0cd
Fix CommentFilter stuff
jabbany Nov 29, 2016
2469643
Removed old filter system and add version to output file
jabbany Nov 29, 2016
0319e51
Some specs for comment filter
jabbany Nov 29, 2016
da225a3
Added docs updated and fix some demo-related files
jabbany Feb 9, 2017
fefb62b
Pre-support for blendMode as it is now supported in CSS too :)
jabbany Feb 14, 2017
d0fd23e
Various fixes and reformatting for the scripter.
jabbany Mar 23, 2017
2dc8a85
Style updates
jabbany Apr 11, 2017
e3ab70b
Merge branch 'dev-cssonly' into dev-new-loader
jabbany Apr 13, 2017
9974831
Fixed error with reverse danmaku in CSS mode
jabbany Apr 14, 2017
2284bd6
Remove cruft and some small enhancements
jabbany Apr 14, 2017
57fdb60
Cleanup
jabbany Apr 18, 2017
3a95807
Stop generating source maps and compile with new TS engine
jabbany Apr 18, 2017
28e8f6a
Many changes:
jabbany Apr 21, 2017
c17c05c
Some small fixes
jabbany Apr 21, 2017
d3e62de
Multiple updates:
jabbany Apr 23, 2017
71afc6f
Modified scripting engine framework:
jabbany Apr 25, 2017
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tab_width = 2
indent_size = 2

[*.js]
indent_style = tab
indent_style = space
tab_width = 2

[*.css]
Expand Down
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
/.idea
*.iml

# Eclipse
/.project

# Ignore Node Modules
/node_modules/*

Expand All @@ -11,3 +14,10 @@

# Ignore tscache
.tscache

# Ignore .baseDir related things
# These are only used as transient items due to compiling TypeScript. They may
# become useful when the project can fully move to TypeScript.
.baseDir.ts
.baseDir.js
.baseDir.js.map
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js
sudo: false
node_js:
- "6.7.0"
- "7.9.0"
before_install:
- npm install npm -g
before_script:
Expand Down
25 changes: 13 additions & 12 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Building 编译项目
==============================
本项目采用 grunt 管理编译,有关 Grunt 系统的使用请参考[官方文档](http://gruntjs.com/getting-started)
脚本弹幕部分的编译还需要 [TypeScript](http://www.typescriptlang.org/) 。这些库还会依赖于
NodeJS环境。
# Building 编译项目

### 确定你是否需要编译 (Do I need to build CCL?)
本项目采用 grunt 管理编译,有关 Grunt 系统的使用请参考
[官方文档](http://gruntjs.com/getting-started) 脚本弹幕部分的编译需要
[TypeScript](http://www.typescriptlang.org/) 。
这些库还会依赖于NodeJS环境。

### 确定你是否需要编译 Do I need to build CCL?
CommentCoreLibrary在库外提供了很多可扩展的空间,你可以相对简单的增加新的弹幕格式的支持,新的弹幕
运行模式的支持和挂载各种不同的定时元件。CCL提供了丰富的扩展支持,通过预处理过滤器和运行时过滤器可以
实现非常多的特殊功能支持。编译库意味着你可能需要一些默认环境没有的软件,比如 NodeJS 平台,为此需要
Expand All @@ -13,8 +14,8 @@ CommentCoreLibrary在库外提供了很多可扩展的空间,你可以相对
当然自己编译也会带来一些优势,比如更小的库大小和更加专注的功能支持。还有,希望帮助CCL实现更多支持的
开发者们也需要知道如何有效的编译。

### 配置编译环境(Setup Build Environment
初次编译请确保你安装了 `node>=0.8.0`,为全局系统安装 grunt 请执行:
### 配置编译环境Setup Build Environment
初次编译请确保你安装了 `node>=1.0.0`,为全局系统安装 grunt 请执行:

npm install -g grunt-cli

Expand All @@ -31,10 +32,10 @@ CommentCoreLibrary在库外提供了很多可扩展的空间,你可以相对

即可按照默认模板编译。除此之外,你还可以改变编译目标:

- build : 只编译项目,不会clean掉build文件夹下的产物
- build-core : 只编译弹幕核心,不包括Acfun和Bilibili的解析器。这个更加适用各种二次开发不需要
已有的弹幕格式的
- build-scripting : 只编译代码弹幕支持
- `build` : 只编译项目,不会clean掉build文件夹下的产物
- `build:core` : 只编译弹幕核心,不包括CommentProvider和parsers里面的解析器。
这个更加适用不需要已有的弹幕格式的各种二次开发
- `build:scripting` : 只编译代码弹幕支持

默认模式会自动看管 `src` 源码文件夹,并且在产生变化的时候自动生成新版。

Expand Down
172 changes: 93 additions & 79 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,97 +2,111 @@ module.exports = (grunt) ->
require('load-grunt-tasks') grunt , {
pattern: ['grunt-*', '!grunt-template-jasmine-istanbul']
}
grunt.file.readJSON('package.json')
# Read package.json to make sure it's there
pkg = grunt.file.readJSON('package.json')

# !! Compile configurations
License = '/*!Copyright(c) CommentCoreLibrary (//github.com/jabbany/CommentCoreLibrary) - Licensed under the MIT License */'
FilterType = "Simple" # "Comment" || "Simple"
LICENSE = '/*!Copyright(c) CommentCoreLibrary v' + pkg.version +
' (//github.com/jabbany/CommentCoreLibrary) - Licensed under the MIT License */'
# !! End of config area

CSS = [
'src/css/base.css',
'src/css/fontalias.css'
]

SRC_CORE_CMP = [
'Comment'
'CommentSpaceAllocator'
]

SRC_CORE = [
'src/Array.js'
'src/core/CommentSpaceAllocator.js'
'src/core/Comment.js'
'src/filter/' + FilterType + 'Filter.js'
'src/CommentCoreLibrary.js'
'src/core/js/CommentUtils.js'
'src/core/js/Comment.js'
'src/core/js/css-renderer/CssComment.js'
'src/core/js/CommentFactory.js'
'src/core/js/CommentSpaceAllocator.js'
'src/CommentManager.js'
]

SRC_SCRIPTING_KAGEROU =
display: 'src/scripting/api/Display/Display.ts'
runtime: 'src/scripting/api/Runtime/Runtime.ts'
player: 'src/scripting/api/Player/Player.ts'
utils: 'src/scripting/api/Utils/Utils.ts'
tween: 'src/scripting/api/Tween/Tween.ts'

SRC_PARSER = [
'src/parsers/AcfunFormat.js'
'src/parsers/BilibiliFormat.js'
SRC_MODULES =
'filter': ['src/filter/CommentFilter.js']
'provider': ['src/CommentProvider.js', 'src/Promises.js']
'format-bilibili': ['src/parsers/BilibiliFormat.js']
'format-acfun': ['src/parsers/AcfunFormat.js']
'format-common': ['src/parsers/CommonDanmakuFormat.js']

# Typescript targets
SRC_TS_CORE = [
'src/core/Comment.ts'
'src/core/css-renderer/CssComment.ts'
'src/core/CommentFactory.ts'
'src/core/CommentSpaceAllocator.ts'
'src/core/CommentUtils.ts'
]

# !! Below are compile settings
# Dynamically generate the core ts targets
CMP_CORE_TS = { }
CMP_CORE_NAME = [ ]
for target in SRC_CORE_CMP
CMP_CORE_NAME.push ("ts:" + target)
CMP_CORE_TS[target] =
src: ["src/core/" + target + ".ts"]
out: "src/core/" + target + ".js"
SRC_TS_SCRIPTING_KAGEROU =
'Display': ['src/scripting/api/Display/Display.ts']
'Runtime': ['src/scripting/api/Runtime/Runtime.ts']
'Player': ['src/scripting/api/Player/Player.ts']
'Utils': ['src/scripting/api/Utils/Utils.ts']
'Tween': ['src/scripting/api/Tween/Tween.ts']

# ==== Below this point is logic to generate compile configurations ====
# You probably do not need to edit anything below here

# Dynamically generate the target for all
CMP_ALL = []
CMP_ALL = CMP_ALL.concat SRC_CORE
for name, source of SRC_MODULES
CMP_ALL = CMP_ALL.concat source

# Generate the core ts targets
CMP_CORE_TS =
'core':
src: SRC_TS_CORE
outDir: 'src/core/js/'
CMP_CORE_NAME = ['ts:core']

# Dynamically generate the kagerou ts targets
CMP_KAGEROU_TS = { }
CMP_KAGEROU_NAME = [ ]
for target,src of SRC_SCRIPTING_KAGEROU
CMP_KAGEROU_NAME.push ('ts:kagerou_engine_' + target)
CMP_KAGEROU_TS['kagerou_engine_' + target] =
CMP_KAGEROU_TS = {}
CMP_KAGEROU_NAME = []
for target, src of SRC_TS_SCRIPTING_KAGEROU
CMP_KAGEROU_NAME.push ('ts:kagerou_engine_' + target.toLowerCase())
CMP_KAGEROU_TS['kagerou_engine_' + target.toLowerCase()] =
src: src
out: 'build/scripting/api/' + src.split('/').pop().split('.')[0] + '.js'
out: 'dist/scripting/api/' + target + '.js'

# Append Typescript Tasks
ts_config =
ts_config =
options:
target: 'es5'
sourceMap: false
for key,value of CMP_CORE_TS
ts_config[key] = value
for key,value of CMP_KAGEROU_TS
ts_config[key] = value

# Core concatenated with libraries
# Actual concat ordering does not/should not matter
SRC_CORELIB = SRC_CORE.concat(SRC_PARSER)
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-jasmine'

grunt.loadNpmTasks('grunt-contrib-coffee')
grunt.loadNpmTasks('grunt-contrib-jasmine')
grunt.initConfig(
clean:
scripting: ['build/scripting']
build: ['build']
scripting: ['dist/scripting']
dist: ['dist']

# Concat CSS and JS files
# core_only : builds CCL without parsers
# all : builds CCL with everything
# dist_core : builds CCL with just the comment system
# dist_all : builds CCL with everything
# scripting_host : builds just the scripting host
concat:
scripting_host:
dist_core:
files:
'build/scripting/Host.js': ['src/scripting/Host.js','src/scripting/Unpacker.js']
core_only:
'dist/css/style.css': CSS
'dist/CommentCoreLibrary.js': SRC_CORE
dist_all:
files:
'build/style.css': CSS
'build/CommentCore.js': SRC_CORE
all:
'dist/css/style.css': CSS
'dist/CommentCoreLibrary.js': CMP_ALL
scripting_host:
files:
'build/style.css': CSS
'build/CommentCoreLibrary.js': SRC_CORELIB
'dist/scripting/Host.js': ['src/scripting/Host.js','src/scripting/Unpacker.js']

# Compile TypeScript
ts: ts_config
Expand All @@ -101,43 +115,42 @@ module.exports = (grunt) ->
copy:
scripting_sandbox:
files:[
{expand: true, cwd:'src/scripting/api/', src: ['*.js'], dest:'build/scripting/api/'},
{expand: true, cwd:'src/scripting/', src: ['OOAPI.js','Worker.js'], dest:'build/scripting/'}
{expand: true, cwd:'src/scripting/api/', src: ['*.js'], dest:'dist/scripting/api/'},
{expand: true, cwd:'src/scripting/', src: ['OOAPI.js','Worker.js'], dest:'dist/scripting/'}
]

# Auto-prefix CSS properties using Can I Use?
autoprefixer:
options:
browsers: ['last 3 versions', 'bb 10', 'android 3']

no_dest:
# File to output
src: 'build/style.css'
src: 'dist/css/style.css'

# Minify CSS
cssmin:
minify:
src: ['build/style.css']
dest: 'build/style.min.css'
src: ['dist/css/style.css']
dest: 'dist/css/style.min.css'

# Minify JS
uglify:
options: banner: License
core_only:
files:
'build/CommentCore.min.js': SRC_CORE
options:
banner: LICENSE
all:
files:
'build/CommentCoreLibrary.min.js': SRC_CORELIB
'dist/CommentCoreLibrary.min.js': ['dist/CommentCoreLibrary.js']

# Watch files for changes
#
watch:
all:
files: ['src/**/*', '!node_modules']

# Run concat, autoprefixer, cssmin and uglify
scripting:
files: ['src/scripting/**/*', '!node_modules']
tasks: ['build:scripting']
core:
files: ['src/**/*', '!node_modules', '!src/scripting/**/*']
tasks: ['build']

# JSHint
jshint:
options:
curly: true,
Expand All @@ -157,7 +170,6 @@ module.exports = (grunt) ->
src: ['src/*.js']

# Jasmine test

jasmine:
coverage:
src: 'src/**/*.js'
Expand All @@ -169,13 +181,14 @@ module.exports = (grunt) ->
'node_modules/jasmine-jquery/lib/jasmine-jquery.js'
'node_modules/sinon/pkg/sinon.js'
'node_modules/jasmine-sinon/lib/jasmine-sinon.js'
'node_modules/promise-polyfill/promise.js' # TODO: remove when phantomjs supports promises
]
template: require('grunt-template-jasmine-istanbul')
templateOptions:
report: 'coverage'
coverage: 'coverage/coverage.json'
ci:
src: 'build/CommentCoreLibrary.js'
src: 'dist/CommentCoreLibrary.js'
options:
specs: 'compiled_spec/*spec.js'
helpers: 'spec/*helper.js'
Expand All @@ -184,6 +197,7 @@ module.exports = (grunt) ->
'node_modules/jasmine-jquery/lib/jasmine-jquery.js'
'node_modules/sinon/pkg/sinon.js'
'node_modules/jasmine-sinon/lib/jasmine-sinon.js'
'node_modules/promise-polyfill/promise.js' # TODO: remove when phantomjs supports promises
]
template: require('grunt-template-jasmine-istanbul')
templateOptions:
Expand All @@ -202,14 +216,14 @@ module.exports = (grunt) ->
)

# Register special compiles
grunt.registerTask 'compile-ts-kagerou', CMP_KAGEROU_NAME
grunt.registerTask 'compile-ts-core', CMP_CORE_NAME
grunt.registerTask 'compile:ts-core', CMP_CORE_NAME
grunt.registerTask 'compile:ts-kagerou', CMP_KAGEROU_NAME

# Register our tasks
grunt.registerTask 'test', ['coffee', 'jasmine:coverage']
grunt.registerTask 'build-scripting', ['clean:scripting','concat:scripting_host', 'compile-ts-kagerou', 'copy:scripting_sandbox']
grunt.registerTask 'build-core', ['compile-ts-core', 'concat:core_only', 'autoprefixer', 'cssmin', 'uglify:core_only']
grunt.registerTask 'build', ['compile-ts-core', 'concat:all', 'autoprefixer', 'cssmin', 'uglify:all']
grunt.registerTask 'build', ['compile:ts-core', 'concat:dist_all', 'autoprefixer', 'cssmin', 'uglify:all']
grunt.registerTask 'build:core', ['compile:ts-core', 'concat:dist_core', 'autoprefixer', 'cssmin', 'uglify:core']
grunt.registerTask 'build:scripting', ['clean:scripting','concat:scripting_host', 'compile:ts-kagerou', 'copy:scripting_sandbox']
grunt.registerTask 'ci', ['build', 'coffee', 'jasmine:ci']
grunt.registerTask 'default', ['clean', 'build', 'build-scripting', 'watch']

grunt.registerTask 'default', ['clean', 'build', 'build:scripting', 'watch']
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 Jim Chen
Copyright (c) 2017 Jim Chen

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,
Expand Down
Loading