Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added an option for console logging errors rather than having annoying a... #173

Closed
wants to merge 1 commit into from

2 participants

@adamwaite

Added console option to warnings rather than having the obtrusive JS alerts.

@happyworm

Thanks. I'll probably add this one in due course... I'll change the string code parts only once, not duplicated, and also check the console.log exists to stop it breaking the legacy browsers... Either making the console.log and empty function or just adding the check to the logic since it is only 2 clauses.

Cheers.

@happyworm

Been busy, but have finally got round to looking at this...
I think I'll add the logic to the _alert() method and then that will be the only method that changes. Plus it should save some bytes... And I'll put the option default in, just so it is clear the option exists... Which wastes some bytes again heh, but i like the options all being laid out stating the bleeding obvious.
Cheers.

@happyworm

Release note:
[dev] New Feature: Added consoleAlerts option (default:true) which forces the alerts generated by errorAlerts and warningAlerts to be written to the console instead. When the console is not supported and this option is enabled, no alert will occur.

I did it this way so that if the errorAlerts or warningAlerts options are left enabled, the usual benign console logging does not suddenly start causing alerts in older browsers when you leave the consoleAlerts option enabled.

@happyworm happyworm closed this
@adamwaite

Thanks, great work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 2 deletions.
  1. +13 −2 jquery.jplayer/jquery.jplayer.js
View
15 jquery.jplayer/jquery.jplayer.js
@@ -2718,18 +2718,29 @@
_error: function(error) {
this._trigger($.jPlayer.event.error, error);
if(this.options.errorAlerts) {
- this._alert("Error!" + (error.message ? "\n\n" + error.message : "") + (error.hint ? "\n\n" + error.hint : "") + "\n\nContext: " + error.context);
+ if (this.options.consoleAlerts) {
+ this._consoleMessage("Error!" + (error.message ? "\n\n" + error.message : "") + (error.hint ? "\n\n" + error.hint : "") + "\n\nContext: " + error.context);
+ } else {
+ this._alert("Error!" + (error.message ? "\n\n" + error.message : "") + (error.hint ? "\n\n" + error.hint : "") + "\n\nContext: " + error.context);
+ }
}
},
_warning: function(warning) {
this._trigger($.jPlayer.event.warning, undefined, warning);
if(this.options.warningAlerts) {
- this._alert("Warning!" + (warning.message ? "\n\n" + warning.message : "") + (warning.hint ? "\n\n" + warning.hint : "") + "\n\nContext: " + warning.context);
+ if (this.options.consoleAlerts) {
+ this._consoleMessage("Warning!" + (warning.message ? "\n\n" + warning.message : "") + (warning.hint ? "\n\n" + warning.hint : "") + "\n\nContext: " + warning.context);
+ } else {
+ this._alert("Warning!" + (warning.message ? "\n\n" + warning.message : "") + (warning.hint ? "\n\n" + warning.hint : "") + "\n\nContext: " + warning.context);
+ }
}
},
_alert: function(message) {
alert("jPlayer " + this.version.script + " : id='" + this.internal.self.id +"' : " + message);
},
+ _consoleMessage:function(message) {
+ console.log("jPlayer " + this.version.script + " : id='" + this.internal.self.id +"' : " + message);
+ },
_emulateHtmlBridge: function() {
var self = this;
Something went wrong with that request. Please try again.