From: <die...@us...> - 2010-02-05 08:37:50
|
Revision: 1805 http://openutils.svn.sourceforge.net/openutils/?rev=1805&view=rev Author: diego_schivo Date: 2010-02-05 08:37:43 +0000 (Fri, 05 Feb 2010) Log Message: ----------- MEDIA-64 refactoring js Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/mediafolderview.js trunk/openutils-mgnlmedia/src/main/resources/net/sourceforge/openutils/mgnlmedia/media/pages/MediaFolderViewPage.html Removed Paths: ------------- trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/mediaedit.js Deleted: trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/mediaedit.js =================================================================== --- trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/mediaedit.js 2010-02-05 08:28:20 UTC (rev 1804) +++ trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/mediaedit.js 2010-02-05 08:37:43 UTC (rev 1805) @@ -1,61 +0,0 @@ -var MediaEdit = new Class({ - - initialize: function(triggers){ - this.triggerClickHandler = this.handleTriggerClick.bindWithEvent(this); - this.popupEnterHandler = this.handlePopupEnter.bindWithEvent(this); - this.popupMoveHandler = this.handlePopupMove.bindWithEvent(this); - this.popupLeaveHandler = this.handlePopupLeave.bindWithEvent(this); - $$(triggers).each(function(item){ - item.addEvents({ - click: this.triggerClickHandler, - }); - }, this); - }, - - handleTriggerClick: function(e){ - this.timer = $clear(this.timer); - var popup = $(e.target).getNext(); - if (popup != this.popup){ - this.hide(); - popup.setStyle('display', ''); - popup.addEvents({ - mouseenter: this.popupEnterHandler, - mousemove: this.popupMoveHandler, - mouseleave: this.popupLeaveHandler - }); - this.popup = popup; - } - }, - - handlePopupEnter: function(){ - this.timer = $clear(this.timer); - }, - - handlePopupMove: function(e){ - var link = $(e.target); - if (link == this.link) return; - if (link.tagName.toLowerCase() != 'a') return; - if (this.link) this.link.setStyle('background', ''); - link.setStyle('background', '#d1e1ed'); - this.link = link; - }, - - handlePopupLeave: function(e){ - if (!this.timer) this.timer = this.hide.delay(250, this); - }, - - hide: function(){ - if (this.popup){ - this.popup.setStyle('display', 'none'); - this.popup.removeEvent('mouseenter', this.popupEnterHandler); - this.popup.removeEvent('mousemove', this.popupMoveHandler); - this.popup.removeEvent('mouseleave', this.popupLeaveHandler); - delete this.popup; - } - if (this.link){ - this.link.setStyle('background', ''); - delete this.link; - } - } - -}); Modified: trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/mediafolderview.js =================================================================== --- trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/mediafolderview.js 2010-02-05 08:28:20 UTC (rev 1804) +++ trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/mediafolderview.js 2010-02-05 08:37:43 UTC (rev 1805) @@ -1,11 +1,12 @@ var MediaFolderView = new Class({ initialize: function(){ - new MediaFolderView.InfoTooltips('li.media .image'); - var bgSelectorClickHandler = this.handleBgSelectorClick.bindWithEvent(this); $('navigation').getElements('a.bg-selector').each(function(item){ item.addEvent('click', bgSelectorClickHandler); }); + + new MediaFolderView.EditMenus('li.media .edit'); + new MediaFolderView.InfoTooltips('li.media .image'); }, handleBgSelectorClick: function(e){ @@ -14,6 +15,68 @@ } }); +MediaFolderView.EditMenus = new Class({ + + initialize: function(triggers){ + this.triggerClickHandler = this.handleTriggerClick.bindWithEvent(this); + this.popupEnterHandler = this.handlePopupEnter.bindWithEvent(this); + this.popupMoveHandler = this.handlePopupMove.bindWithEvent(this); + this.popupLeaveHandler = this.handlePopupLeave.bindWithEvent(this); + $$(triggers).each(function(item){ + item.addEvents({ + click: this.triggerClickHandler, + }); + }, this); + }, + + handleTriggerClick: function(e){ + this.timer = $clear(this.timer); + var popup = $(e.target).getNext(); + if (popup != this.popup){ + this.hide(); + popup.setStyle('display', ''); + popup.addEvents({ + mouseenter: this.popupEnterHandler, + mousemove: this.popupMoveHandler, + mouseleave: this.popupLeaveHandler + }); + this.popup = popup; + } + }, + + handlePopupEnter: function(){ + this.timer = $clear(this.timer); + }, + + handlePopupMove: function(e){ + var link = $(e.target); + if (link == this.link) return; + if (link.tagName.toLowerCase() != 'a') return; + if (this.link) this.link.setStyle('background', ''); + link.setStyle('background', '#d1e1ed'); + this.link = link; + }, + + handlePopupLeave: function(e){ + if (!this.timer) this.timer = this.hide.delay(250, this); + }, + + hide: function(){ + if (this.popup){ + this.popup.setStyle('display', 'none'); + this.popup.removeEvent('mouseenter', this.popupEnterHandler); + this.popup.removeEvent('mousemove', this.popupMoveHandler); + this.popup.removeEvent('mouseleave', this.popupLeaveHandler); + delete this.popup; + } + if (this.link){ + this.link.setStyle('background', ''); + delete this.link; + } + } + +}); + MediaFolderView.InfoTooltips = new Class({ initialize: function(triggers){ Modified: trunk/openutils-mgnlmedia/src/main/resources/net/sourceforge/openutils/mgnlmedia/media/pages/MediaFolderViewPage.html =================================================================== --- trunk/openutils-mgnlmedia/src/main/resources/net/sourceforge/openutils/mgnlmedia/media/pages/MediaFolderViewPage.html 2010-02-05 08:28:20 UTC (rev 1804) +++ trunk/openutils-mgnlmedia/src/main/resources/net/sourceforge/openutils/mgnlmedia/media/pages/MediaFolderViewPage.html 2010-02-05 08:37:43 UTC (rev 1805) @@ -13,7 +13,6 @@ <script type="text/javascript" src="${this.request.contextPath}/.resources/media/js/mootips.js"></script> <script type="text/javascript" src="${this.request.contextPath}/.resources/media/js/multibox/multibox.js"></script> <script type="text/javascript" src="${this.request.contextPath}/.resources/media/js/multibox/overlay.js"></script> - <script type="text/javascript" src="${this.request.contextPath}/.resources/media/js/mediaedit.js"></script> <script type="text/javascript" src="${this.request.contextPath}/.resources/media/js/sexy-tooltips-1.1.js"></script> <script type="text/javascript" src="${this.request.contextPath}/.resources/media/js/mediafolderview.js"></script> <script type="text/javascript"> @@ -99,7 +98,6 @@ item.addEvent('click', Tips1.elementEnter.bindWithEvent(Tips1, item)); }); - new MediaEdit('.edit'); new MediaFolderView(); }); </script> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |