how to change the notification bottom title in chrome extension - google-chrome-extension

what key should I use in
var notification = new Notification('hi', {
icon: 'xxx.png',
body: "click me",
})
to override the bottom text on notification ?

Related

How to catch Facebook Card Response button click event in Dialogflow fulfillment

I have connected Dialogflow agent to a Facebook page, and i'm displaying Facebook card response using the fulfillment feature in Dialogflow. i can't figure out how to catch the card button click event. I need the chat to move to the next intent on button click. However button click doesn't trigger anything.
Here's the fulfillment code used to create button
function getState(agent){
state = agent.parameters.State;
return getAd()
.then(result => {
for(const item of result.result){
agent.add(new Card({
title: item.nmi,
imageUrl: 'url',
text: item.structuredAddress.singleAddressLine,
buttonText: item.nmi,
buttonUrl: 'uri'
})
);
}
})
.catch(() => {
agent.add(`I'm sorry.`);
});
}`
You can use the payload field in the postback button to send a
specific message back to dialogflow when the button is clicked.
If you combine this with the parameters, you can use them to trigger
specific intents, or just to send the information of the product
clicked
check the original answer Here

Chrome extension: Different contextMenus on whether or not a word selection is made

I am trying to display different contextMenus in my chrome extension based on whether or not text selection has been made. Any ideas on how to do this?
I want this code when no text is selected
chrome.contextMenus.create({
title: "Not selected",
contexts:["all"], // ContextType
onclick: search // A callback function
});
I want this code when text IS selected
chrome.contextMenus.create({
title: "Selected",
contexts:["all"], // ContextType
onclick: search // A callback function
});

Showing modal dialog when navigating away from a tab in TabStrip

Is there a way to display a modal dialog when user selects a tab in TabStrip component? The code below displays window.confirm, can not get modal dialog to display.
onTabSelected(e : any){
if (!window.confirm("Continue with navigation?")) {
e.prevented = true;
}
}
The dialog is not a direct substitute for window.confirm, because it cannot block the UI thread. To substitute the window.confirm with the Kendo UI dialog, you can prevent all tab selection, and wait for the dialog result:
onTabSelected(e: any) {
e.prevented = true;
this.dialogService.open({
content: "Continue with navigation?",
actions: [
{ text: "No" },
{ text: "Yes", primary: true }
]
}).result.subscribe((result) => {
if (result.primary) {
// change tab through code
this.tabStrip.selectTab(e.index);
}
});
}
See this plunkr for a working demo.
Ended up canceling the tab selection event, showing modal dialog, and resubmitting event based on the user answer.

Adding a colorbutton in tinymce dialog with api 4.x doesn't work

I'm trying to add a colorbutton in a TinyMCE dialog box to replace my old color selector which was initially created with a select input.
See : ColorButton : API 4.X
This class creates a color button control. This is a split button in which the main button has a visual representation of the currently selected color. When clicked the caret button displays a color picker, allowing the user to select a new color.
I can add and see the new colorbutton in the dialog box but it doesn't show the colorpicker when clicked.
Here is my code:
editor.windowManager.open( {
title: 'Choose color',
body: [
{
type: 'listbox',
name: 'bg-color',
label: 'Color (select)',
'values': [
{text: 'White', value: '#FFF'},
{text: 'Black', value: '#000'},
{text: 'Silver', value: 'silver'},
]
},
{
type: 'ColorButton',
name: 'bg-color2',
label: 'Color (colorpicker)',
},
],
onsubmit: function(e) {
// Do something here
}
});
And you will find a tinymce fiddle here to illustrate this issue:http://fiddle.tinymce.com/sfeaab
Since my debugger doesn't show any JS error, is there something wrong in this code or is there another way to add a colorpicker in a dialogbox?
Thanks!
#MavBzh I think you've a wrong perception on how the color button works. The ColorButton UI is only help with rendering a button which not much difference with PanelButton UI. you can see this example http://fiddle.tinymce.com/sfeaab/3 in this fiddle I use textcolor plugin example.
So, in order to use color button you're required to specify the Panel to hold the color picker.
{
type: 'colorbutton',
name: 'color',
text: 'Color',
selectcmd: 'ForeColor',
panel: {
role: 'application',
ariaRemember: true,
html: renderColorPicker,
onclick: onPanelClick
},
onclick: onButtonClick
}
then later set onclick callback action and render the color picker HTML output yourself, the renderColorPicker function is used as the panel content, then assigned onPanelClick callback to put the color to the text placeholder in the ColorButton.
PS: in the fiddle I used v4.0.21

How can I pass the selected Kendo Menu Text to Controller

How can I pass the selected Kendo Menu Text to Controller???
menu.Add()
.Text("Reports")
.Items(item =>
{
item.Add().Text("Home").Action("Index","Sample");
item.Add().Text("About Us").Action("Index", "Sample");
});
Since both the menu items call the same controller, I need to pass the Menu Items Text to the controller to identify which menu was selected...
You can use the route values:
item.Add().Text("Home").Action("Index","Sample", new { text = "home" });
item.Add().Text("About Us").Action("Index", "Sample", new { text = "about us" });

Resources