How to fix Blocking screen with content On my quick app pages? - huawei-mobile-services

On my quick app pages, some
content may be blocked by the app menu. For example, the sign-in entry is blocked by the app menu in the following figure.
Although the menu is configured to be movable, users do not know that they can move it.
How can I solve this problem?

The following solutions are provided to solve your problem:
Separating the menu from any content displayed
Hiding the menu
Adding a message indicating that the menu is movable
For Detail,pls kindly refer this link : What if some content is blocked by the app menu?

You can separate the menu from any content displayed by changing the value of titleBar to true in the manifest.json file.
e.g.
"display": {
"fullScreen": false,
"titleBar": "true",
"menu": false,
"menuBarData": {
"draggable": true
},
There is a good example with other solutions. Please check link

Related

How do you focus on a panel view programmatically given an id

I'd like to be able to toggle open the panel (termainl, debug, output, etc.. area) and focus on a specific custom view given an id. I know this is possible since there are focus commands for terminal debug etc but searching them up in the vscode source code just gives string references and not publicly usable functions. Any help would be appreciated. (Please don't give shortcut answers like ctrl+j, I want to do this with code)
I tried copying the format of the focus view commands above but the focus of the custom view didn't work. Seems like its not an automatic thing.
I think you want this. Every custom TreeView or WebView gets some commands added automatically by vscode. For example, my Editor Manager ViewContainer, with this view:
"views": {
"editorManager": [
{
"id": "editor-groups",
"name": "Groups",
"size": 1,
"visibility": "visible"
}
]
}
gets these commands added automatically (they can be found in the Keyboard Shortcuts, at least when the extension is activated):
editor-groups.focus
workbench.actions.treeView.editor-groups.refresh
workbench.actions.treeView.editor-groups.collapseAll
workbench.view.extension.editorManager
workbench.view.extension.editorManager.resetViewContainerLocation
You probably want the first one to focus your view in the Panel.
vscode.commands.executeCommand("editor-groups.focus");

fancybox disable image preloading

Started to try out this fancybox3 plugin to zoom thumbnail images in our app that works perfectly on desktop and mobile browsers.
In the app where the cart has thumbnail images of the products added to it that can be purchased. If I remove a product(image of it)from the cart, it gets removed from the cart, however, if I zoom one of the remaining product images of the cart and navigate through it, still showing the removed product there. I am expecting to see only the product images present in cart.
I tried using the preload: 0 option but that does not work for me. Fancybox is initiated in following way
$('[data-fancybox="images"]').fancybox({
idleTime : false,
loop: true,
transitionEffect : "fade",
animationDuration: 333,
buttons: [
'close'
],
protect: true,
infobar: false,
preload: 0
});
Any help to make this work is really appreciated.
Thank you
Looks like you have misunderstood the concept of "preloading". The script preloads images before displaying, but what that means is that it is showing loading icon before displaying full image. If you disable preloading and provide dimensions (width/height) of full image, then the script will display thumbnail image while full image is loading. This is a great feature if you want to make your app/webpage look more interactive (e.g., user would not stare at black overlay with loading icon but will see something useful instead).
But what you have described sounds like "caching" and fancyBox is not caching dom elements. So, if you see something in the gallery, that means that corresponding element exists in your page.
So, make sure that your product is actually removed from the dom or try to tweak the selector to match only "actual" products using "selector" option, e.g., something like:
$().fancybox({
selector : '.fancybox:not(.removed)'
});
Obviously, you should tweak this to suit your needs. Since you have not provided any details, I can not create a full example.
#Janis, Thank you so much for the clarification on 'preloading' concept.
You were right about dom still holding the removed item. Upon removal, the div is simple being set as display none.
First, I added code to remove the div form the dom but that resulted in page getting refresh which we don't want.
Next tried, the selector option and it worked perfectly.
function hideCartItem(id) {
var divItem = document.getElementById("divCartItem" + id);
var elem = "#divCartItem" + id
if (divItem != null) {
$(elem).hide();
$(elem).remove();
// added code
$('[data-fancybox="images"]').fancybox({
divItem: '.fancybox:not(.removed)'
});
}
}
Thank you so mcuh for your help. Much appreciated!!

Addon SDK way to make a dialog

What is the proper way to use the SDK to make a dialog (which is not anchored to the add-on bar, etc. but shows centered on screen)? It doesn't seem like there is any API for this important capability. I do see windows/utils has open but I have two problems with that:
The dialog opening seems to require "chrome" privs to get it to be centered on the screen (and I'd be expectant of add-on reviewers complaining of chrome privs, and even if not, I'd like to try to stick to the SDK way).
While I can get the DOM window reference of the new window/utils' open() dialog, I'm not sure how to attach a content script so I can respond to user interaction in a way that prompts (and can respond to) privileged behavior ala postMessage or port.emit (without again, directly working with chrome privs).
Ok, this answer should have been pretty obvious for anyone with a little experience with the SDK. I realized I can just use a panel. In my defense, the name "panel" is not as clear as "dialog" in conjuring up this idea, and I am so used to using panels with widgets, that it hadn't occurred to me that I could use it independently!
Edit
Unfortunately, as per Bug 595040, these dialogs are not persistent, meaning if the panel loses focus, the "dialog" is gone... So panel looks like it is not a suitable candidate after all... :(
Edit 2
I've since moved on and have gotten things working mostly to my satisfaction with sdk/window/utils and openDialog on whose returned window I add a load listener and then call tabs.activeTab.on('ready', and then set tabs.activeTab.url to my add-on local HTML file so the ready event will get a tab to which I can attach a worker. There is still the problem with chrome privs I suppose, but at least the main communications are using SDK processes.
Update to Edit 2:
Code sample provided by request:
var data = require('sdk/self').data,
tabs = require('sdk/tabs');
var win = require('sdk/window/utils').openDialog({
// No "url" supplied here in this case as we add it below (in order to have a ready listener in place before load which can give us access to the tab worker)
// For more, see https://developer.mozilla.org/en-US/docs/Web/API/window.open#Position_and_size_features
features: Object.keys({
chrome: true, // Needed for centerscreen per docs
centerscreen: true, // Doesn't seem to be working for some reason (even though it does work when calling via XPCOM)
resizable: true,
scrollbars: true
}).join() + ',width=850,height=650',
name: "My window name"
// parent:
// args:
});
win.addEventListener('load', function () {
tabs.activeTab.on('ready', function (tab) {
var worker = tab.attach({
contentScriptFile: ....
// ...
});
// Use worker.port.on, worker.port.emit, etc...
});
tabs.activeTab.url = data.url('myHTMLFile.html');
});
if the panel loses focus, the "dialog" is gone...
It doesn't get destroyed, just hides, right? If so, depending on why it's getting hidden, you can just call show() on it again.
You'd want to make sure it's not being hidden for a good reason before calling show again. If there's a specific situation in which it's losing focus where you don't want it to, create a listener for that situation, then call if (!panel.isShown) panel.show();
For example, if it's losing focus because a user clicks outside the box, then that's probably the expected behaviour and nothing should be done. If it's losing focus when the browser/tab loses focus, just register a tab.on('activate', aboveFunction)
Simply adding ",screenX=0,screenY=0" (or any values, the zeroes seem to be meaningless) to the features screen seems to fix centerscreen.

Facebook login plugin how to hide text: "[username] uses [appname]"?

Haven't found the answer to this, but I'm still looking how to remove the text.
When a user logs in, the facebook login button will turn into a logout button, but it also shows this text: http://gyazo.com/fcc1429b6f7207ffab14556384386374
"Username" uses "Appname" together with a profile pic.
(I'd also like to hide the profile pic)
Does anyone know if there's a extra secret thing for it? I know the logout button was something "secret" (it wasn't listed in the official docs) where you had to add autologoutlink="true".
So, I'm wondering if there's a thing like that to hide the text with image.
It looks like you can hide the images and the text you specified by using show-faces='false' but as for hiding just the text, it seems to be a mystery!
Source: https://developers.facebook.com/docs/reference/plugins/login/

Fancybox / How to scroll in opened div and have the background fixed?

I'm currently working on a project with some fancybox (inline content).
I'd like to have the same kind of behavior that exists on facebook: when I click, the content is displayed in the fancybox, and if I scroll, I do scroll in the fancybox, but the background has to remain fixed.
I tried to mix a couple of ideas I've found here and there, mainly:
$(".jqShowArticle, .jqShowPortfolio").fancybox({
'onStart' : function(){
$("body").css({"overflow": "hidden", "position": "fixed"});
$("#fancybox-overlay").css({"overflow": "scroll"});
},
'onClosed' : function(){
$("body").css({"overflow": "auto", "position": ""});
}
});
But it doesn't work... Here is the page: http://espresso.double-espresso.com/
You can click on every portfolio item (pictures with text appearing on hover...) or blog entry to see what it does...
Thanks a lot for your help!
There seems to be an answer on https://github.com/fancyapps/fancyBox/issues/24. I'm not sure how they do it exactly though.