Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <xul:button type="sb-clickhold"
- id="sb-player-stop-button-stop"
- sbid="stop"
- class="sb-player-stop-button-stop sb-player-button"
- oncommand="onPlayPause(event.target);"
- delayDuration="2000"
- tooltiptext="&tooltip.control.stop;"
- xbl:inherits="label,position,disabled"
- onmenushowing="syncMenus();">
- <xul:menupopup xbl:inherits="popupanchor,popupalign">
- <xul:menuitem id="menu_play" class="menuitem-iconic" label="&menu.control.play.button;"/>
- <xul:menuitem id="menu_pause" class="menuitem-iconic" label="&menu.control.pause.button;"/>
- <xul:menuitem id="menu_stop" class="menuitem-iconic" label="&menu.control.stop.button;"/>
- </xul:menupopup>
- </xul:button>
- </xul:hbox>
- </content>
- <implementation>
- <constructor>
- <![CDATA[
- // observer for DataRemote
- this.on_state_change = {
- _that: null,
- observe: function( aSubject, aTopic, aData ) { this._that.onStateChanged(); }
- };
- this.on_state_change._that = this;
- this.remote_playing = SB_NewDataRemote("faceplate.playing", null);
- this.remote_paused = SB_NewDataRemote("faceplate.paused", null);
- this.remote_playing.bindObserver(this.on_state_change, false);
- this.remote_paused.bindObserver(this.on_state_change, false);
- this.remote_length = SBDataBindElementAttribute( "metadata.length", this, "maxpos" );
- ]]>
- </constructor>
- <destructor>
- <![CDATA[
- this.remote_playing.unbind();
- this.remote_paused.unbind();
- this.remote_length.unbind();
- ]]>
- </destructor>
- <field name="play">document.getAnonymousElementByAttribute(this, 'sbid', 'play');</field>
- <field name="pause">document.getAnonymousElementByAttribute(this, 'sbid', 'pause');</field>
- <field name="stop">document.getAnonymousElementByAttribute(this, 'sbid', 'stop');</field>
- <field name="len">0</field>
- <property name="maxpos">
- <getter>
- return this.len;
- </getter>
- <setter>
- this.len = val;
- this.onStateChanged();
- </setter>
- </property>
- <method name="onStateChanged">
- <body>
- <![CDATA[
- if (this.remote_playing.boolValue && !this.remote_paused.boolValue && this.maxpos > 0) {
- this.play.hidden = true;
- this.stop.hidden = true;
- this.pause.hidden = false;
- } else if (this.remote_playing.boolValue && this.maxpos == 0) {
- this.play.hidden = true;
- this.stop.hidden = false;
- this.pause.hidden = true;
- } else {
- this.play.hidden = false;
- this.stop.hidden = true;
- this.pause.hidden = true;
- }
- ]]>
- </body>
- </method>
Advertisement
Add Comment
Please, Sign In to add comment