Skip to content

Commit

Permalink
Make '.add()' usable when 'length = 0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Copay committed Sep 24, 2016
1 parent 54523e2 commit 974ebef
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 18 deletions.
10 changes: 6 additions & 4 deletions demo/cplayer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion demo/cplayer.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/cplayer.min.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions dist/cplayer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/cplayer.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cplayer.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cPlayer",
"version": "2.3.6",
"version": "2.3.7",
"description": "A beautiful and clean WEB Music Player by HTML5.",
"scripts": {
"dist": "gulp compress",
Expand Down
11 changes: 6 additions & 5 deletions src/js/cplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class cPlayer {
*/
const DEFAULTS = {
"element": document.getElementById("cplayer"),
"list" : [],
"mdicon" : true
"list" : []
};
if(Object.assign !== undefined){
this.options = Object.assign({}, DEFAULTS, options);
Expand Down Expand Up @@ -67,8 +66,7 @@ class cPlayer {
}
})();


this.CBASE = new cBase(this.options.element);
this.CBASE = new cBase;
this.now = 0;
this.dragging = {contain: false, target: undefined};
//现在开始填DOM
Expand Down Expand Up @@ -169,6 +167,8 @@ class cPlayer {
cPlayer.appendChild(list);
this.options.element.appendChild(cPlayer);
})();
this.CBASE.root = this.options.element.getElementsByTagName("c-player");
this.CBASE.root = this.CBASE.root[this.CBASE.root.length-1];
//然后为DOMList填充一下吧
this.__LIST__ = {
"lyric" : this.CBASE.getByClass("lyric"),
Expand Down Expand Up @@ -472,6 +472,7 @@ class cPlayer {
div.addEventListener("click", ()=> {
this.to(ln - 1);
});
if(ln===1) this.toggle(); //刷新元素.
if(func !== undefined) func();
}

Expand Down Expand Up @@ -644,7 +645,7 @@ class cEmitter{
}
}
class cBase{
constructor(rootNode=document){
constructor(rootNode=document.documentElement){
this.root = rootNode;
for(let styleList = document.documentElement.style,i = styleList.length;i>0;i--){
if(styleList[i].indexOf("-webkit-")!==-1){
Expand Down

0 comments on commit 974ebef

Please sign in to comment.