plugin.id = "slide-show";
plugin.init =
function _init( glob ) {
this.major = 1; // Major version number.
this.minor = 0; // Minor version number.
this.version = this.major + "." + this.minor + " (19 Nov 2009)";
this.description = "Slide Show in Menu > View. By MakOke <gboxlan@gmail.com>";
plugin.stepDelay = 5; // Seconds. This value >1 is required.
plugin.prefary.push( ["display", true, ] ); // Msg started/stoped.
this.cmds = [
["slide-on", cmdSlideOn, CMD_CONSOLE | CMD_NO_HELP],
["slide-off", cmdSlideOff, CMD_CONSOLE | CMD_NO_HELP]
];
this.menuItems = [
["-"],
[">SlideShow"]
];
client.menuSpecs["SlideShow"] = {
label: "Slide Show",
items:
[
["slide-on", {visibleif: "typeof client.points == 'undefined'", label: "Start"}],
["slide-off", {visibleif: "typeof client.points != 'undefined'", label: "Stop"}]
]
};
this.menuNames = {
"mainmenu:view": true
};
return "OK";
}
plugin.enable =
function _enable() {
this.commands = client.commandManager.defineCommands( this.cmds );
for( var i = 0; i < this.menuItems.length; i++ ) {
this.menuItems[i].plugin = this.id;
for( var menu in this.menuNames ) {
client.menuSpecs[menu].items.push( this.menuItems[i] );
}
}
client.updateMenus();
return true;
}
plugin.disable =
function _disable() {
client.commandManager.removeCommands( this.commands );
for ( var menu in this.menuNames ) {
for ( var i = 0; i < client.menuSpecs[menu].items.length; i++ ) {
if( client.menuSpecs[menu].items[i].plugin == this.id ) {
client.menuSpecs[menu].items.splice( i--, 1 );
}
}
}
client.updateMenus();
return true;
}
function cmdSlideOn() {
if( typeof client.points == 'undefined' ) {
client.points = new Array();
for( var i = 0; i < client.tabs.itemCount; i++ )
client.points[i] = setTimeout( function() {
if( client.tabs.selectedIndex != client.tabs.itemCount-1 )
client.tabs.advanceSelectedTab();
else
dispatch( "client" );
}, plugin.stepDelay * 1000 * ( i+1 ) );
client.points[client.tabs.itemCount] = setTimeout( function() {
cmdSlideOff();
}, plugin.stepDelay * 1000 * ( client.tabs.itemCount+1 )
- ( plugin.stepDelay-1 ) * 1000 );
if( plugin.prefs["display"] )
display( "View > Slide Show is now started." );
}
}
function cmdSlideOff() {
if( typeof client.points != 'undefined' ) {
for( var i = 0; i < client.points.length; i++ )
clearTimeout( client.points[i] );
client.points = null;
delete client.points;
if( plugin.prefs["display"] )
display( "View > Slide Show is now stoped." );
}
}
Download File slide-show.js 2.7 KB