How to give a Long number a "Nickname" in Ubiquity
How can i make a command that replaces my nickname with the "real" name, like the email command. example:
instead of writing the telephone number "12345678" i write only "Stan"
i have tried to use the noun_type_language but failed.
any suggestions?
this is my command:
CmdUtils.CreateCommand({
name: "sms",
takes: {"nummer": noun_arb_text},
modifiers: {og: noun_arb_text},
preview: function( pblock, nummer, mods ) {
var msg = 'sms "${nummer}" og ${og}.';
var subs = {nummer: nummer.text, og: mods.og.text};
pblock.innerHTML = CmdUtils.renderTemplate( msg, subs );
},
execute: function( nummer, mods ) {
var msg = "sier " + mods.og.text + " til " + nummer.text;
var url = "https://www.gulesider.no/mypage/sendSms.c?&sender=48069930&recipients=" + nummer.text + "&text=" + mods.og.text + "&submit=send";
Utils.openUrlInBrowser( url );
displayMessage( msg );
}
});
instead of writing the telephone number "12345678" i write only "Stan"
i have tried to use the noun_type_language but failed.
any suggestions?
this is my command:
CmdUtils.CreateCommand({
name: "sms",
takes: {"nummer": noun_arb_text},
modifiers: {og: noun_arb_text},
preview: function( pblock, nummer, mods ) {
var msg = 'sms "${nummer}" og ${og}.';
var subs = {nummer: nummer.text, og: mods.og.text};
pblock.innerHTML = CmdUtils.renderTemplate( msg, subs );
},
execute: function( nummer, mods ) {
var msg = "sier " + mods.og.text + " til " + nummer.text;
var url = "https://www.gulesider.no/mypage/sendSms.c?&sender=48069930&recipients=" + nummer.text + "&text=" + mods.og.text + "&submit=send";
Utils.openUrlInBrowser( url );
displayMessage( msg );
}
});
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
-
Inappropriate?If the "nummer" variable is what contains either a phone number or the name of your friend, you'll want to add this to your execute (and optionally preview) function:
if (nummer.text=='stan') nummer.text="12345678"
I’m confident
-
Inappropriate?Hi Nicolas,
Mapping of names to phone numbers would be better done as a custom nounType. Then you can have a very simple command that just uses the nounType for its argument. This is how the email contact list works -- it's noun_type_contact, defined in nountypes.js. -
Inappropriate?By the way, documentation for creating a custom nountype is here:
https://wiki.mozilla.org/Labs/Ubiquit...
Loading Profile...




