Rendering custom "Integrate with Google" button - gapi.additnow - google-api

The render method of gapi.additnow takes as the second parameter an key-value pair object.
As in the following example:
gapi.additnow.render(
"el-id",
{"param1": "value_of_param1", "param2": "value_of_param2"}
)
Where can I find the list of available parameters to use.
I'm aiming on using the params to customize the "Integrate" button.

Not sure where you can get a full list, but the docs show "width" and "theme" as params in the example code:
https://developers.google.com/apps-marketplace/button#additnow-tag-attributes

Related

Set Data Validation Display style in Apps Script

Is it possible to set the dropdown display style in apps script?
After checking the documentation it looks like the API only allows you to choose between "Arrow" and "Plain Text".
The Apps Script documentation explains how to create data validation rules with a DataValidationBuilder. Most of the methods just set different DataValidationCriteria. Among those, the methods requireValueInList() and requireValueInRange() are the only ones that have a showDropdown parameter to set a dropdown, and the parameter's values can only be true or false. The default is true, which is equivalent to "Arrow" and false is equivalent to "Plain Text". As a boolean there's no third option for "Chip". Example:
// Set the data validation for cell A1 to require "Yes" or "No", with a dropdown menu.
var cell = SpreadsheetApp.getActive().getRange('A1');
var rule = SpreadsheetApp.newDataValidation().requireValueInList(['Yes', 'No'], true).build();
cell.setDataValidation(rule);
Looking at the Sheets REST API, which Apps Script is built on, the DataValidationRule works in a similar way, but this uses showCustomUi instead of showDropDown. Still, the limitation is the same to show only the basic arrow and plain text.
It just seems like a feature that hasn't been implemented yet. Maybe the "Chip" was added a while after the basic dropdown. You can try to request it in Google's issue tracker.

How to get index of clicked input autocomplete vuetify

Sorry to post here but I'm having hard times to find out how to retrieve the index of the clicked element in vuetify autocomplete, with the goal to change one of the key of the object that match the clicked element.
I'm having a simple autocomplete with an array of items and i call a method on click
<v-autocomplete
:click="onInputClicked"
:items="items">
I used the :click of vuetify in their autocomplete API, that says :
Events >
click : Emitted when input is clicked
Then, what I would like is having the index of the element click so I could change a properties in my state that match the clicked element with index X
state.filters[index].isSelected = !state.filters[index].isSelected
What I have tried :
I tried to pass the event callback in my method and see what a event.current.target would give me, but its undefined
I looked up online for like 1 hour but I haven't find anything this :/
Pretty sure I'm missing something simple... any help would be appreciated !
Thanks in advance
You might have mixed up props and events in the v-autocomplete API.
Bound props are prefixed with : like :items in your code snippet, but to capture events you should prefix them with #. So in your case, try changing the component to:
<v-autocomplete
#click="onInputClicked"
:items="items">
then, you can access the click event by adding it as an argument to onInputClicked:
onInputClicked(myClickEvent) {
console.log(myClickEvent)
}

XPath 'list' object has no attribute 'click'

I'm trying to select a checkbox on the following public webpage using Selenium XPath from Python and click it to change the checked status.
http://simbad.u-strasbg.fr/simbad/sim-fout
For example, the checkbox that I would like to click is located under "Fluxes/Magnitudes" and is named "U".
Upon inspection of this page I built the following XPath to select the checkbox:
//*[#type ='checkbox' and #name='U']
This returns what I believe to be the correct element, however when I try to run click() on the object it fails with the exception 'list' object has no attribute 'click'
When I look at the functions for this object in a debugger it indeed does not have a click function. How can this be true for a checkbox? Is there a different element that has to be selected?
Thanks!
You didn't paste your code here, but from the error you getting it's quite clear, that you are using
driver.find_elements_by_xpath('//*[#type ='checkbox' and #name='U']')
instead of
driver.find_element_by_xpath('//*[#type ='checkbox' and #name='U']')
find_elements_by_xpath method returns a list of web elements. You can apply click() method only on a single element, that's why you should use
driver.find_element_by_xpath('//*[#type ='checkbox' and #name='U']')
or alternatively
driver.find_elements_by_xpath('//*[#type ='checkbox' and #name='U']')[0]
to get the first (single) element from the returned list

How to open and handle richtext editor in javascript in sitecore 6.5?

I've been working on a custom field, which contains a list.
I have to be able to edit the selected item on the list in a richtext editor. (this is the only missing part).
I've read the topic on opening from c# code Opening Rich Text Editor in custom field of Sitecore Content Editor .
This works nice for the "add" button, since i have to open the RTE empty(with default text...), but not for the Edit button.
My aproaches are:
Somehow in the Edit button's message field list:edit(id=$Target) pass the selected index (like list:edit(id=$Target,index=$SelectedIndex), but i don't know how to populate $SelectedIndex
Somehow in the overridden HandleMessage method get the list's selected index. I'm able to get the selected value Sitecore.Context.ClientPage.ClientRequest.Form[ID of list], but thats alone not much of a help, since i won't be able to decide which one to edit if two listitem equals.
Do the richtext editor opening and handling fully in javascript. As i saw at some script in content editor, i tried to do that, but i can't understand it clearly:
richtext editor url:
var page = "/sitecore/shell/Controls/Rich Text Editor/EditorPage.aspx";
some params :
var params = "?da=core&id&ed=" + id + "&vs=1&la=en&fld=" + id + "&so&di=0&hdl=H14074466&us=sitecore%5cadmin&mo";
and the part where i'm not sure:
var result = scForm.browser.showModalDialog(page + params, new Array(window), "dialogHeight:650px; dialogWidth:900px;");
This way the RTE opens as expected (i guess i could get the selected index from javascript and pass it as a parameter later). However when i click ok, i get exception from EditorPage.js saveRichText function: Cannot read property 'ownerDocument' of null. Am i missing some parameter?
Either of the three aproaches is fine for me(also i'm open for new better ones) as soon as i'm able to do it.
Thanks in advance!
Tamas
I was able to enter some javascript into the message:
list:Edit(id=$Target,index='+document.getElementById(ID of the select using $Target ).selectedIndex+')
this way i got the index in HandleMessage.
I'm waiting for better solutions now.

ckeditor javascript document wrapper

I found the following answer when looking for code to navigate the editors text area elements.. The code works, the onlyu problem is i dont understand why..
var documentWrapper = editorname.document; //replace by your CKEDitor instance ID
var documentNode = documentWrapper.$; // or documentWrapper['$'] ;
The answer was got from the folloing stackOverflow link :
ckeditor scrollIntoView to a div element within the editor
In particular could someone explain to me the syntax documentWrapper.$;
Ive no idea what this means??
Thanks
#oggiemc
The "$" represents the actual DOM object that the CKEDITOR class object is pointing to.
In this case you're working with the "CKEDITOR.dom.document" class. Find the documentaion here:
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.document.html
Your object named "documentWrapper" is a CKEDITOR object. It would have any properties described in the CKEDITOR API docs for that class object. You would also use CKEDITOR methods on it.
When you work with "documentWrapper.$", you're working with a DOM object that's described in the Document Object Model Specifications. See Specs here:
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/
This object will have the properties described for this object type in the DOM specs. You wouldn't use CKEDITOR methods on this object, you would use the methods described in the DOM specs for this object type.
So the "$" is a generic representaion of whichever DOM object (document, head, body, div, span, p, etc.) the CKEDITOR class object is pointing to.
documentWrapper.someFunction(); would use a CKEDITOR method on a CKEDITOR class object.
documentWrapper.$.someFunction(); would use a DOM method on a DOM object.
Joe
Difference between editor passed as argument to plugins/dialogs and editor returned by getParentEditor().
They would usually be the same object. But if you have multiple editor instances on one page, you need to use getParentEditor to make sure you're working with the correct editor instance.
Especially if multiple editors are sharing one toobar: How Do I Get Multiple CKEditor Instances to Share the Same Toolbar?
http://docs.cksource.com/CKEditor_3.x/Howto/Shared_Toolbar
You can take a look at the code for dialog radio buttons in the CKEditor directory:
ckeditor\_source\plugins\forms\dialogs\radio.js
Or on the docs site:
http://docs.cksource.com/ckeditor_api/symbols/src/plugins_forms_dialogs_radio.js.html
When the plugin is loaded it uses the active editor instance to load the text for the title and labels because they will be the same for all the instances sharing the toolbar:
ckeditor_source\plugins\forms\dialogs\radio.js(5):
CKEDITOR.dialog.add( 'radio', function( editor )
(42) label : editor.lang.checkboxAndRadio.radioTitle,
(43) title : editor.lang.checkboxAndRadio.radioTitle,
But for the methods used in the dialog, it uses getParentEditor(), so that the actions will be performed on the correct editor instance:
ckeditor_source\plugins\forms\dialogs\radio.js(30):
editor = this.getParentEditor();
(22) onOk : function() ........ editor = this.getParentEditor();
Joe

Resources