X-Git-Url: http://www.average.org/gitweb/?p=mkgallery.git;a=blobdiff_plain;f=include%2Fcontrols.js;h=53a060f9765dbfcbefd0c9e24bcca2a2768ec501;hp=0392bb77628584704143886b793375611d256b32;hb=b9bad7137ebc39fc083b04b3a17db5555f6b6f22;hpb=f8281d2d6eaaa20f2c65d9753a2870df1310fd1a diff --git a/include/controls.js b/include/controls.js index 0392bb7..53a060f 100644 --- a/include/controls.js +++ b/include/controls.js @@ -28,7 +28,6 @@ var Controls = new Class({ onClick: $empty, zIndex: 3, buttonClass: 'controlButton', - buttons: ['prev','stop','play','next','exit','comm'], } }, @@ -44,7 +43,8 @@ var Controls = new Class({ }).addEvent('click', function(){ this.options.onClick() }.bind(this)).injectInside(this.parent); - this.options.buttons.each(function(el){ + var buttons = ['prev','stop','play','next','exit','comm']; + buttons.each(function(el){ var sub = new Element('div'); sub.addClass(this.options.buttonClass).setProperties({ id: el, @@ -60,7 +60,7 @@ var Controls = new Class({ id: 'controlPosition', }).injectInside(this.commbox); this.refbox = new Element('a', { - href: 'javascript: void();', + href: 'javascript: void(1);', html: 'title', }).addClass('controlRef').setProperties({ id: 'controlRef', @@ -72,6 +72,7 @@ var Controls = new Class({ }, prev: function(){ + if (this.prevdisabled) { return; } if (this.show.prev) { this.show.prev() } else { alert('no method for "prev", file complaint with UN') } }, @@ -87,6 +88,7 @@ var Controls = new Class({ }, next: function(){ + if (this.nextdisabled) { return; } if (this.show.next) { this.show.next() } else { alert('no method for "next", file complaint with UN') } }, @@ -102,10 +104,24 @@ var Controls = new Class({ }, info: function(pos, max, ref, txt){ - var msg = 'pos='+pos+', max='+max+', ref='+ref+', txt='+txt; + var p1 = pos + 1; this.refbox.set('html',txt); this.refbox.set('href',ref); - this.posbox.set('text',pos+' of '+max); + this.posbox.set('text',p1+' of '+max); + if (p1 < 2) { + this.prevbox.set('id', 'prevDisabled'); + this.prevdisabled = true; + } else { + this.prevbox.set('id', 'prev'); + this.prevdisabled = false; + } + if (p1 >= max) { + this.nextbox.set('id', 'nextDisabled'); + this.nextdisabled = true; + } else { + this.nextbox.set('id', 'next'); + this.nextdisabled = false; + } }, running: function(isrunning){