Skip to content

Commit

Permalink
Added verticalVolume option (default: false) to change the volume dis…
Browse files Browse the repository at this point in the history
…play and click calculations from horizontal to vertical.
  • Loading branch information
thepag committed Aug 28, 2011
1 parent 0948e95 commit 049c210
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions jquery.jplayer/jquery.jplayer.js
Expand Up @@ -8,8 +8,8 @@
* - http://www.gnu.org/copyleft/gpl.html
*
* Author: Mark J Panaghiston
* Version: 2.0.33
* Date: 21st August 2011
* Version: 2.0.34
* Date: 28th August 2011
*/

/* Code verified using http://www.jshint.com/ */
Expand Down Expand Up @@ -233,7 +233,7 @@
$.jPlayer.prototype = {
count: 0, // Static Variable: Change it via prototype.
version: { // Static Object
script: "2.0.33",
script: "2.0.34",
needFlash: "2.0.32",
flash: "unknown"
},
Expand Down Expand Up @@ -312,6 +312,7 @@
webos: /webos/,
playbook: /playbook/
},
verticalVolume: false, // Calculate volume from the bottom of the volume bar. Default is from the left. Also volume affects either width or height.
// globalVolume: false, // Not implemented: Set to make volume changes affect all jPlayer instances
// globalMute: false, // Not implemented: Set to make mute changes affect all jPlayer instances
idPrefix: "jp", // Prefix for the ids of html elements created by jPlayer. For flash, this must not include characters: . - + * / \
Expand Down Expand Up @@ -1489,11 +1490,17 @@
},
volumeBar: function(e) { // Handles clicks on the volumeBar
if(this.css.jq.volumeBar.length) {
var offset = this.css.jq.volumeBar.offset();
var x = e.pageX - offset.left;
var w = this.css.jq.volumeBar.width();
var v = x/w;
this.volume(v);
var offset = this.css.jq.volumeBar.offset(),
x = e.pageX - offset.left,
w = this.css.jq.volumeBar.width(),
y = this.css.jq.volumeBar.height() - e.pageY + offset.top,
h = this.css.jq.volumeBar.height();

if(this.options.verticalVolume) {
this.volume(y/h);
} else {
this.volume(x/w);
}
}
if(this.options.muted) {
this._muted(false);
Expand Down Expand Up @@ -1524,7 +1531,7 @@
}
if(this.css.jq.volumeBarValue.length) {
this.css.jq.volumeBarValue.show();
this.css.jq.volumeBarValue.width((v*100)+"%");
this.css.jq.volumeBarValue[this.options.verticalVolume ? "height" : "width"]((v*100)+"%");
}
if(this.css.jq.volumeMax.length) {
this.css.jq.volumeMax.show();
Expand Down

0 comments on commit 049c210

Please sign in to comment.