Pale Moon: Add loop context menu to HTML5 media elements.

pull/1/head
Ascrod 4 years ago committed by Roy Tam
parent 5f10407c8c
commit 1d02d45481
  1. 5
      application/palemoon/base/content/browser-context.inc
  2. 5
      application/palemoon/base/content/nsContextMenu.js
  3. 2
      application/palemoon/locales/en-US/chrome/browser/browser.dtd

@ -99,6 +99,11 @@
oncommand="gContextMenu.mediaCommand('playbackRate', 2.0);"/>
</menupopup>
</menu>
<menuitem id="context-media-loop"
label="&mediaLoop.label;"
accesskey="&mediaLoop.accesskey;"
type="checkbox"
oncommand="gContextMenu.mediaCommand('loop');"/>
<menuitem id="context-media-showcontrols"
label="&mediaShowControls.label;"
accesskey="&mediaShowControls.accesskey;"

@ -381,6 +381,7 @@ nsContextMenu.prototype = {
this.showItem("context-media-mute", onMedia && !this.target.muted);
this.showItem("context-media-unmute", onMedia && this.target.muted);
this.showItem("context-media-playbackrate", onMedia);
this.showItem("context-media-loop", onMedia);
this.showItem("context-media-showcontrols", onMedia && !this.target.controls);
this.showItem("context-media-hidecontrols", onMedia && this.target.controls);
this.showItem("context-video-fullscreen", this.onVideo && this.target.ownerDocument.mozFullScreenElement == null);
@ -394,6 +395,7 @@ nsContextMenu.prototype = {
this.setItemAttr("context-media-playbackrate-100x", "checked", this.target.playbackRate == 1.0);
this.setItemAttr("context-media-playbackrate-150x", "checked", this.target.playbackRate == 1.5);
this.setItemAttr("context-media-playbackrate-200x", "checked", this.target.playbackRate == 2.0);
this.setItemAttr("context-media-loop", "checked", this.target.loop);
var hasError = this.target.error != null ||
this.target.networkState == this.target.NETWORK_NO_SOURCE;
this.setItemAttr("context-media-play", "disabled", hasError);
@ -1531,6 +1533,9 @@ nsContextMenu.prototype = {
case "pause":
media.pause();
break;
case "loop":
media.loop = !media.loop;
break;
case "mute":
media.muted = true;
break;

@ -433,6 +433,8 @@ fast. -->
<!-- LOCALIZATION NOTE: The access keys for "Show Controls" and
"Hide Controls" are the same because the two context-menu
items are mutually exclusive. -->
<!ENTITY mediaLoop.label "Loop">
<!ENTITY mediaLoop.accesskey "L">
<!ENTITY mediaShowControls.label "Show Controls">
<!ENTITY mediaShowControls.accesskey "C">
<!ENTITY mediaHideControls.label "Hide Controls">

Loading…
Cancel
Save