-
Notifications
You must be signed in to change notification settings - Fork 632
Added the possibility to specify the id of the document element that the subtitles are appended to. #383
base: master
Are you sure you want to change the base?
Conversation
…the subtitles are appended to.
@@ -39,12 +39,18 @@ | |||
parseFn, | |||
parser = {}; | |||
|
|||
parseFn = function( filename, callback ) { | |||
parseFn = function( filename, callback, target ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea, and I appreciate the patch :)
Only comment is what if we made target an options object, with keys and values.
Example:
pop.parseSRT( "my-video.srt", {
target: "my-div"
});
It works well for optional parameters because order doesn't matter. It also means in the future it is going to be easy to add other properties.
Also means custom parsers and plugins could use it for properties other than just target.
Thoughts?
No problem. Consistency is a good thing. |
|
||
if ( options && options[ "target" ] ) { | ||
sub.target = options[ "target" ]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And do you mind moving these tabs to two spaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't mind I can do it when I merge this in.
I landed this just now. Doesn't seem to be closing the pull request because I did a rebase with current master. You can see the commit on master: 5835bbf I appreciate the contribution :) The next step is to add a test and write some docs :) I'm willing to do all that if you don't mind, but you're welcome to give it go. |
I think that this fixes the issue #382