Is the modal dialog in google app script editable? - html

I'm displaying some html with the .showModalDialog function. I'd want to change some of the properties of this modal dialog, like removing the title and changing the padding, is there any way to do this?

There's some limited changes that can be made, such as setWidth() & setHeight(). There's no option to set padding or make advanced changes such as that.

Related

Generate Amazon link for open side popup with pre-applied filters

Edit: Stackoverflow modify automatically the Amazon links when you click, so for see the popup, select, copy and paste the URLs in the browser.
On Amazon there is a link to open directly a side popup, like this:
https://www.amazon.com/dp/B07FKTZC4M/#aod (#aod open the popup)
where We can enter some filters. I tried different ways with no success to generate a link that open directly the site popup with new filter pre-applied.
So i need a link that open this page with "new filter" pre-applied:
I tried different solutions, but don't work, for example:
https://www.amazon.com/dp/B07FKTZC4M/ref=aod_f_new#aod
https://www.amazon.com/dp/B07FKTZC4M/ref=new#aod
https://www.amazon.com/dp/B07FKTZC4M/#aod_f_new=true
https://www.amazon.com/dp/B07FKTZC4M/ref=aod_f_new=true#aod
https://www.amazon.com/dp/B07FKTZC4M/ref=aod_f_new?ie=UTF8&f_new=true#aod
I see some informations on source page, maybe that help:
Question: Is there a way to create a link that open directly the side popup with new filter pre-applied? Maybe adding some parameters to the URL.
You can call a function in JavaScript with which you can change the z-index of the popup.
Something like this:
<button onclick="popup()" value="open popup">
Also make the popup. I am just making a rough one:
<div id="popup" style="z-index:1000; position: absolute;">Some code</div>
Remember to set the z-index at behind and the position. Then for JS i will make it simple in case you can't code JS
function popup(){
document.getElementById("popup").style.zIndex=-1;//basically changing the popup's z-index
}
This will just change the z-index of the popup which you must create yourself

How to change styling of modal dialogue in google apps script

I want to change the position and background color of modal dialogue in google apps script for my addon
I have searched a lot but only found answers using UiApp which is now deprecated and no longer works. I found no answers for doing this using HtmlService.
Only available function in after createHtmlOutputFromFile('Index') are :
setWidth and
setHeight
which work perfectly but i need to change position of modal too.
Is there any way to do this at the moment?
Unfortunately, there is no way to change the position of the modal window. The sidebar dialog is also static. However, you can use CSS properties to control the look of everything inside the dialogs.
Here is a link to the best practices for developing add-ons: https://developers.google.com/apps-script/guides/html/best-practices

modal window to open when icon is clicked

I have a couple of form definitions in my main HTML file.
I would like to display these forms in a modal window, when the user performs certain action, such as click on an icon.
I have followed an article on how to do it for links (hrefs). But now my requirement is to get the same working for clicking on an icon.
Thank you,
Harriet
The answer is to write a java function, that will explicitly set the location of the window to where you want the url to point - example:
function openPreferences() {
window.location = '#openPreferences';
}
I think the most simple solution would be to create a LinkBlock Element and set the Background to the Icon's Image, which will allow you to turn it into a Link, thus further allowing you to open your Modal Window with it.. Simply create your Modal as Display None, and upon clicking the LinkBlock (with your Icon as the Background), make it change the Modal property to Display Block, etc.

Is there a way to change the size of the Google SaveToDrive button?

I'm using the Google SaveToDrive button on my webpage as shown here: https://developers.google.com/drive/savetodrive
However, the g-savetodrive button always shows up in a fixed size that does not match the rest of my UI/layout. Are there any parameters to it that we can change the size of the button?
I tried other possibilities that I saw in +1 and Google SignIn buttons also (like data-size, data-width, data-height), but none of them worked.
The short answer is: not easily.
The google api embeds the icon in an iframe, which means you'd have to do some fiddling with jquery to apply any style rules to the button.
see: How to apply CSS to iframe?
To make matters worse the img source is very small. Stretching it yields a very fuzzy image that I wouldn't recommend. At the very least you'll want to find a large drive image and use that instead.
I think your best bet is creating a custom button that emulates googles class and id tags. Hopefully you can reverse engineer the button click and hook your custom button up to the same functionality.

Html popup window, the parent should have no access

I'm trying to create a popup() where user clicks on button, then it triggers window where he does some edit.
While the user is editing in the child window, parent window should not be accessed, it should be blocked.
How exactly should i do this?
This is what i'm doing now.
function Popupwindow()
{
name = "Select Requestor";
url = "selectLocation.html";
options = "height=330, width=210, location=no, scrollbars=yes,menubars=yes,toolbars=yes,resizable=yes,left=0";
window.open(url,name,options);
}
So now i'm able to close parent window and even edit parent elements without closing child window.
What you want is called a modal dialog. There's no standard way to do this across multiple browsers, some don't even have anything like it. Your best bet is creating a modal dialog inside the page. Most JS frameworks/toolkits will provide dialogs.
don't use "real" popups, use javascript to "emulate" them in teh same window. take a look at jquerys dialog, where you can also set the modal-mode (example and example) - i think this is what you want.
there are a lot of standalone-js examples out thre if you're not using jquery and a lot of js-frameworks include things like this - just search for "modal dialog".