kendoWindow correct library usage - kendo-window

in my application I am using:
"kendo.web.min"
"angular-kendo"
"kendo.common.min.css"
"kendo.bootstrap.min.css"
I want to add a popup window to my app, so I'm trying to follow this demo:
http://demos.telerik.com/kendo-ui/window/index
But when I'm trying to add "kendo.all.min.js" in order to use the window, the window pops up but the rest of the application doesn't work.
When I remove "kendo.all.min.js", the "kendoWindow " returns as "undefined"
var window = jQuery("#windowTests");
window.kendoWindow({.... <==== returns "undefined"
How can I use the kendoWindow in my application?
Thank you!

Related

Chromecast - sender app - Cast icon not visible HTML5/JS

The problem is that cast icon is not visible even in sample examples by Google in sender application. Month ago i had to refresh the page couple of times to get an icon back or restart the device. Now nothing is working and the icon is missing but in chrome development tools it shows that it is correctly implemented. Do you know what is the problem?
I am creating cast button by:
google-cast-launcher
there are no errors in console
PS. I do also have had implemented the library
https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1
I found a solution. You need to use https:// instead of http://
otherwise the cast icon wont be visible
I hope it helps some of you
#edit
if you have problem with not showing icon and in console it shows :
CastVideos.js:125 Uncaught ReferenceError: cast is not defined
at CastPlayer.initializeCastPlayer (CastVideos.js:125)
at window.__onGCastApiAvailable (CastVideos.js:1004)
at chrome.cast.ha (VM1365 cast_sender.js:99)
in your html put script at the beggining of head and script to framework gstatic at the end of body.
You have to delay the initialization of Cast Player
let castPlayer = new CastPlayer();
window['__onGCastApiAvailable'] = function (isAvailable) {
if (isAvailable) {
setTimeout(() => {
castPlayer.initializeCastPlayer();
}, 1000)
}
};

ZoomWindow extension breaks without GUI?

Using v2.13 of the viewer, the ZoomWindow extension relies on having the default GUI enabled. Is there a way around this? The load method is:
proto.load = function() {
var viewer = this.viewer;
var toolbar = viewer.getToolbar(true);
//var toolbar = viewer.getToolbar ? viewer.getToolbar(true) : undefined;
// Init & Register tool
this.tool = new namespace.ZoomWindowTool(viewer);
viewer.toolController.registerTool(this.tool);
// Add the ui to the viewer.
this.createUI(toolbar);
return true;
};
which fails because getToolbar is undefined.
It seems from the commented out line that this has been considered, but not implemented.
What is the best way to implement a work around - should I copy the entire extension with a new name, or can I replace the load method at runtime?
Edit: was looking to use the headless viewer, but it seems easiest just to hide the UI with css.
It's not clear to me if you are using the GuiViewer3D or want to use the Viewer3D, the viewer without Autodesk custom UI. If you use GuiViewer3D, you can simply wait for the toolbar to be loaded before loading the ZoomWindow extension, which requires the toolbar controls to be created in order to add a button to it.
viewer.addEventListener(Autodesk.Viewing.TOOLBAR_CREATED_EVENT, function () {
viewer.loadExtension('Autodesk.Viewing.ZoomWindow')
})
Here is a blogpost I wrote a while ago about using events in the viewer. It is not up-to-date with the current version but remains valid:
http://adndevblog.typepad.com/cloud_and_mobile/2015/10/event-watcher-extension-for-view-data.html
Now as Zhong mentioned, if you want to use the headless viewer with no UI and still use the extension, you may have to copy and customize it as you suggested. But an easier workaround could be to use GuiViewer3D and simply hide the existing toolbar with css, so the the js code remains valid. Set display:none on div id="guiviewer3d-toolbar", for example, or on the adsk-control class.
Hope that helps

FireFox Add-on: retrieve text from textbox in current tab gives no result

I am trying to create an add-on that gets the contents (textbox.value) from a textbox with ID = city from the current webpage and write it to a text file.
The file can be written without getting the textbox value. But, If I update the code then it writes nothing. Below is the code I used to get the textbox value.
var cityfromfield = window.content.document.getElementById('city').value;
var date = new Date();
var TimeStamp = date.toLocaleString();
var wstrtotext = TimeStamp + cityfromfield;
fos.write(wstrtotext, wstrtotext.length);
Any help would be appreciated.
Without more information, it is necessary to guess at what your problem is. The most likely issue is that you are attempting to find the textbox element with ID=city in the wrong document.
Firefox add-ons generally run in a scope where the global window object is not defined (if it is defined depends on how the portion of your code that is currently running was entered). Even if it is defined, it is often not defined as the window which you are expecting (the window of the current tab). You will probably need to obtain a reference to the window object for the most recently accessed window/tab.
If a browser window exists (in some instances you could be running where no browser window exists, yet, e.g. at start-up), you can obtain a reference to the most recent browser window, document, and gBrowser with:
if (window === null || typeof window !== "object") {
//If you do not already have a window reference, you need to obtain one:
// Add/remove a "/" to comment/un-comment the code appropriate for your add-on type.
/* Add-on SDK:
var window = require('sdk/window/utils').getMostRecentBrowserWindow();
//*/
//* Overlay and bootstrap (from almost any context/scope):
var window=Components.classes["#mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator)
.getMostRecentWindow("navigator:browser");
//*/
}
if (typeof document === "undefined") {
//If there is no document defined, get it
var document = window.content.document;
}
if (typeof gBrowser === "undefined") {
//If there is no gBrowser defined, get it
var gBrowser = window.gBrowser;
}
If you are running the code in response to an event (e.g. a button command event), you can obtain the current window with:
var window = event.view
The lack of having the global window object available, or having it reference something other than what you are expecting, is something that many people encounter as a problem when writing Firefox add-ons.
Note: If you are wanting to be natively compatible with multi-process Firefox (Electrolysis, or e10s), then gaining access to the contents of the current document is more complex. There are shims in place which should make your code continue to work with multi-process Firefox for some time, but they may/will eventually go away.
References:
nsIWindowMediator
Working with windows in chrome code
SDK: window/utils
SDK: windows
Large portions of this were copied from my earlier answers, including this link.

Create a Notification window in Adobe AIR Application

I want to create an AIR application in which i need to show the notification that when AIR application is minimize then at some interval of time message shows from the system tray similar like giving information.
I have visited this LINK, its a nice component but tutorial is not that much good as component. I need to create a component like that or source is available from this site so modification in this component will also be acceptable. so please help me.
EG: When you minimize the Yahoo Messenger and some one is sign-out or sign-in then it gives notification i want component similar like that...
Thanks in Advance
First Step, We have created a Custom Popup control for Notifications display.
In the second step, we have controlled the display of that popup using the following code
if(!this.stage.nativeWindow.visible || this.stage.nativeWindow.displayState == NativeWindowDisplayState.MINIMIZED)
{
stage.nativeWindow.alwaysInFront = true;
fadeTimer = new Timer(5000,1);
fadeTimer.start();
fadeTimer.addEventListener(TimerEvent.TIMER_COMPLETE, fadePopUp);
popUpWindow = new PopUpWindow();
popUpWindow.isAlerts = true;
popUpWindow.Message = "<b>You have "+event.numNewMessages+" new notification messages<b>";
popUpWindow.type = NativeWindowType.LIGHTWEIGHT;
popUpWindow.open(true);
popUpWindow.fadeInEffect.play();
popUpWindow.nativeWindow.x = Capabilities.screenResolutionX - popUpWindow.width - 10;
popUpWindow.nativeWindow.y = Capabilities.screenResolutionY - popUpWindow.height - 35;
}
The condition used above is what we have used to find out, whether our application window is minimized to System Tray or not. Even though it is not a perfect fix, It didn't fail me yet. It's quiet stable for my app.

How to open a sequence of small windows always in the same window?

I know how to open a small window:
function SmallWindow(theURL,winName)
{window.open(theURL,winName,'toolbar=yes,scrollbars=yes,
menubar=yes,toolbar=yes,resizable=yes,width=800,height=500,left=300,top=200');}
being called as
<a href="http://newURL.html" onclick="SmallWindow(this.href, ''); return false">
Click here</a>
The problem is that with many clicks in various links of a big window this produces a sequence of different small windows. I want all those small windows overlapping each other on the same window. I tried to give a window name, WIN
function SmallWindow(theURL,winName)
{window.open(theURL,"WIN",'toolbar=yes,scrollbars=yes,menubar=yes,toolbar=yes,
resizable=yes,width=800,height=500,left=300,top=200');
but when a new small window is opened, the browser does not jump to it, and the user does not get aware that the new small window was opened!
I could not find an answer to this problem. Thanks for any help.
The call to window.open will return a reference to the new window (or existing window in the case where a window with the same name is already open). You can then call the focus() method on that window to bring it to the front.
function SmallWindow(theURL, winName)
{
var myWindow = window.open(theURL, winName,'toolbar=yes,scrollbars=yes,menubar=yes,toolbar=yes, resizable=yes,width=800,height=500,left=300,top=200');
myWindow.focus();
}
I think you can bring the popup window to the from like this:
var newWin = window.open(url, "WIN", ...);
newWin.focus();
As you already found out, it is important to always use the same window name (e.g. "WIN"). Otherwise a new window will be opened with every window.open() call.
The focus() method will then bring the window to the front.