Highchart export Button menuItems got error in IE - highcharts

I created export contextButton with menuItems like this.
'exporting':{
'buttons': {
'contextButton': {
'menuItems': [ {
'text': 'Export to PNG',
'onclick': function() {
this.exportChart();
},
'separator': false
},null,null,null,null
]
}
}
}
When click the menuItem, chrome & firefox works fine but IE got following error in highcharts.js and cannot open the menu:
Invalid argument. highchart.js, line8 character56.
(function(){function N(a,b){var c;a||(a={});for(c in b)a[c]=b[c];
Any idea about this issue?
Also in chrome&firefox, "print" works fine. However any download like download png, download pdf not working. And I got below error in exporting.js when I click:
Uncaught TypeError: Cannot read property 'style' of undefined.
Any idea about this?

Related

How to debug an issue with Zendesk App as console.log is not working

topBarClient.request(settings).then(
function (data) {
console.log("data",data);
showTaskData(data);
if (data.status === 200) {
onSuccess(JSON.parse(data.responseText));
} else {
onFailure(data.status);
}
},
function (response) {
console.log("error", response);
onFailure(response.status);
}
);
onFailure is working but not able to get the error out
Is there a way to test this locally?
console.log works fine, if it's not working then it is not getting called probably due to some exception in the line above console.log.
If you face any problem you can render html component like div to dislplay the text for debugging purpose.

electron - loading page when certificate is imported

I am using https and in case of a self-signed certificate, I want to prompt the user if he wants to import the required certificate. (Practically the same thing browser does when loading page without trusted certificate)
I have found out that there is a function dialog.showCertificateTrustDialog([browserWindow, ]options, callback) in electron which works just fine. I wanted to use it in a case when a certificate-errorappears.
Something like this:
app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
dialog.showCertificateTrustDialog({certificate:certificate, message: "some msg"},
() => {
if (was certificate ok) {
event.preventDefault();
callback(true);
}
else {
callback(false);
}
}
);
});
But I have no idea how to do the was certificate ok part
Is it possible? Or do I have to for example load the page again to show it? If I run the app when the certificate is already imported, it works just fine. Otherwise, I get only a blank window.
Any help is appreciated, thank you
Currently, I have decided to use the following solution but it seems to me more like a hack. I try to load the page again after calling the showCertificateTrustDialog function again but if the certificate-error is thrown again I ignore it. I am still open to other solutions since I don't like this one
let certificateErrorRetry = false;
app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
certificateErrorRetry = !certificateErrorRetry;
if (certificateErrorRetry) {
const {dialog} = require('electron');
dialog.showCertificateTrustDialog({certificate: certificate, message: "some msg" }, () => {
myapp.win.loadURL(url);
});
}
else { show some error }
});

Rspec, Poltergeist, Capybara not working with audio files

Using rspec-rails-3.5.2, poltergeist-1.11.0, and capybara-2.10.1
I created an audio object:
Bart.pumpAudio = new Audio("assets/audio/bart/pump.mp3");
I have a button that plays a sound when pressed
<div id="pump-button" class="button">Pump</div>
$("#pump-button").click(function() {
...
Bart.pumpAudio.play();
...
});
It works when I run on a browser, but I get errors when trying to perform tests through rspec:
Testing Code:
page.find("#pump-button").trigger('click')
Testing Error:
TypeError: 'undefined' is not a function (evaluating 'Bart.pumpAudio.play()')
Any ideas on how to solve this??
Adding this to the top of my js file seemed to solve my issue
var Audio = function() {
return {
load: function() {},
play: function() {}
}
}
Source

Yeoman-angular grunt generates faulty vendor.js with animation

I've got an app that uses a javascript animation.
When I run the build, grunt minifies and uglifies the code and creates a file 'vendor.js' containing all the library js code including angular. However the code that is generated is broken when I use my animate method shown below.
The error I see in the browser console is caused by the minified and uglified vendor.js
Error: [$injector:unpr] Unknown provider: aProvider <- a
I may need to find a different approach to what I am doing, but I'd still like to address this problem specifically if possible.
In the following code I'm using angular to get access to the global rootscope as I want to trigger an action higher in the scope hierarchy than the element where the animation is registered.
Without this added behaviour, the animations are all working correctly, so there is no problem with the actual libraries that are ending up in vendor.js The answer may be to turn off uglification, or find a way to copy this specific script directly to the target instead of passing it through magnification and uglification.
angular.module('myApp').animation('.theme-content', function() {
return {
enter: function(element, done) {
var rootScope = angular.element(document).injector().invoke(function($rootScope){return $rootScope;});
rootScope.$broadcast('page-start-animation', null );
return function(cancelled) {
};
},
leave: function(element, done) { },
move: function(element, done) { },
beforeAddClass: function(element, className, done) { },
addClass: function(element, className, done) { },
beforeRemoveClass: function(element, className, done) { },
removeClass: function(element, className, done) { }
};
});

use dojo tooltipDialog for every link in the page using parameters

anyone know how to open a tooltipDialog from extlib using parameters.
in csjs I find all links in a webapage and bind them to mouseover. using a key in the link I know which link is clicked, I want to send this key to the toolTipDialog so that I can use that to find the document and display document data in the tooltipDialog.
Currently the only way I have found to open a tooltip dialog is by using XSP.openTooltipDialog("tooltipid",'linkid') which does not seem to allow parameters.
any ideas how to resolve this
Hows this?
require(["dijit/TooltipDialog", "dijit/popup",
"dojo/on", "dojo/dom", "dojo/_base/lang"],
function(ready, TooltipDialog, popup, on, dom, lang){
var myTooltipDialog = new TooltipDialog({
id: 'myTooltipDialog',
style: "width: 300px;",
contentTemplate: "<p>Key is: {key}</p>",
content: 'empty',
onMouseLeave: function(){
popup.close(myTooltipDialog);
},
onOpen: function(pos) {
this.set("content", lang.replace(this.contentTemplate, this.replaceObject));
}
});
/
query('a.hasSelectorClass').on('mouseover', function(){ //
myTooltipDialog.replaceObject = { //
key : this.innerHTML // (inner text in anchor node)
}
popup.open({
popup: myTooltipDialog,
around: this // anchor
});
});
});
Try it and tell if any errors (untested code) :)

Resources