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

Change limit #8

Open
Discartyptics opened this issue Dec 9, 2014 · 1 comment
Open

Change limit #8

Discartyptics opened this issue Dec 9, 2014 · 1 comment

Comments

@Discartyptics
Copy link

I was wondering if it might be possible to add an option to add a character prefix limit, say I always want to append 15 characters before each message so it accounts for that in the totaling.

@danxexe
Copy link
Owner

danxexe commented Dec 10, 2014

I assume you are using the jQuery plugin. Take a look at how the jQuery plugin is implemented:

CoffeeScript: https://github.com/danxexe/sms-counter/blob/master/sms_counter.js.coffee#L56-L65
JavaScript: https://github.com/danxexe/sms-counter/blob/master/sms_counter.js#L93-L109

If I understand it correctly, implementing what you want would be as simple as getting the result of SmsCounter.count(text).length and adding the length of your prefix before displaying it. You could do it by using your own keyup callback.

One way of implementing it in a generic way would be by making $.countSms receive an optional callback where you could change any of the values before displaying them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants