jyoungblood / smoke.js

framework-agnostic styled alert system for javascript
http://smoke.js.org/
930 stars 107 forks source link

Default value for "ok" and "cancel" button #37

Closed billmn closed 11 years ago

billmn commented 11 years ago

Is it possibile to set a default value for "ok" and "cancel" buttons?

I notice that in your code ( https://github.com/hxgf/smoke.js/blob/master/smoke.js#L52 ) you have "OK" and "Cancel" labels, is it possible to overwrite this?

jyoungblood commented 11 years ago

yeah absolutely:

smoke.alert("Can I ask you a question?", function(e){

}, {
    ok: "Yep",
    cancel: "Nope"
});

several methods have other extra customization options as well, all of which are outlined in the documentation here: http://smoke-js.com/docs/.

billmn commented 11 years ago

I'm not explained well ... I would set labels "ok" and "cancel" for all alerts without having to specify the array :

{
    ok: "Yep",
    cancel: "Nope"
}

Is it possible ovverride "OK" and "Cancel" labels globally?

jyoungblood commented 11 years ago

i mean, not w/ the plugin, but yah just set a global var and reference it in the config obj. something like

var ok_label = "yuh yuh";
var cancel_label = "nah, bro";

smoke.alert("Can I ask you a question?", function(e){

}, {
    ok: ok_label,
    cancel: cancel_label
});