--- /dev/null
+AUI().ready(\r
+\r
+ /*\r
+ This function gets loaded when all the HTML, not including the portlets, is\r
+ loaded.\r
+ */\r
+\r
+ function() {\r
+ }\r
+);\r
+\r
+Liferay.Portlet.ready(\r
+\r
+ /*\r
+ This function gets loaded after each and every portlet on the page.\r
+\r
+ portletId: the current portlet's id\r
+ node: the Alloy Node object of the current portlet\r
+ */\r
+\r
+ function(portletId, node) {\r
+ }\r
+);\r
+\r
+Liferay.on(\r
+ 'allPortletsReady',\r
+\r
+ /*\r
+ This function gets loaded when everything, including the portlets, is on\r
+ the page.\r
+ */\r
+\r
+ function() {\r
+\r
+ }\r
+);\r
+\r
+// activate cache for script import\r
+$.ajaxPrefilter('script', function(options) { options.cache = true; });\r
+\r
+function goToAdvanceSearch(searchUrl) {\r
+ var search = $("#mini_search").get(0).value;\r
+ if (search != "Recherche ...") {\r
+ searchUrl += "?keyword="+search;\r
+ }\r
+ window.location = searchUrl;\r
+}\r
+\r
+\r
+\r
+var themeDisplayActions = {\r
+ menuMargin : 235,\r
+ bodyMargin : 220,\r
+ mobileWidth : 1024,\r
+ \r
+ isMobileDisplay : function() {\r
+ var windowWidth = window.innerWidth\r
+ || document.documentElement.clientWidth\r
+ || document.body.clientWidth;\r
+ return (Liferay.Browser.isMobile() || windowWidth < this.mobileWidth);\r
+ },\r
+ \r
+ displayMenu : function() {\r
+ var sidemenu = document.getElementById('sidemenu');\r
+ var menuIcon = $("#menu-button i");\r
+ var menuLabel = $("#menu-button span");\r
+ var button = document.getElementById('menu-button');\r
+ \r
+ var body = $('#body');\r
+ var bodyLeftMargin = body.css("margin-left");\r
+\r
+ if (sidemenu.className.indexOf('close') > -1) {\r
+ sidemenu.className = 'sidemenu';\r
+ $('#sidemenu').animate({"margin-left": '+=' + this.menuMargin}, 400, function() { /*Refresh the content*/ Ext.EventManager.fireResize();});\r
+\r
+ button.style.background = "#ffffff";\r
+ menuIcon.addClass('theme-color');\r
+ menuLabel.addClass('theme-color');\r
+ \r
+ if (!this.isMobileDisplay()) {\r
+ body.animate({"margin-left": '+=' + this.bodyMargin}, 400, function() { /*Refresh the content*/ Ext.EventManager.fireResize();});\r
+ }\r
+ else if (this.isMobileDisplay() && bodyLeftMargin != "0px") {\r
+ body.animate({"margin-left": '0'}, 400, function() { /*Refresh the content*/ Ext.EventManager.fireResize();});\r
+ }\r
+ }\r
+ else {\r
+ $('#sidemenu').animate({"margin-left": '-=' + this.menuMargin}, 400, function() { /*Refresh the content*/ Ext.EventManager.fireResize();});\r
+ sidemenu.className += ' close';\r
+\r
+ button.style.background = "none";\r
+ menuIcon.removeClass('theme-color');\r
+ menuLabel.removeClass('theme-color');\r
+ \r
+ if (!this.isMobileDisplay() && bodyLeftMargin != "0px") {\r
+ body.animate({"margin-left": '-=' + this.bodyMargin}, 400, function() { /*Refresh the content*/ Ext.EventManager.fireResize();});\r
+ }\r
+ else if (this.isMobileDisplay() && bodyLeftMargin != "0px") {\r
+ body.animate({"margin-left": '0'}, 400, function() { /*Refresh the content*/ Ext.EventManager.fireResize();});\r
+ }\r
+ }\r
+ \r
+ },\r
+\r
+ displaySubMenu : function(idSubMenu, liId) {\r
+ var subMenu = document.getElementById(idSubMenu);\r
+\r
+ if (subMenu.className.indexOf('hide') > -1) {\r
+ subMenu.className = idSubMenu+' sub-menu';\r
+ $('#'+idSubMenu).animate({"opacity": '+=1'});\r
+ document.getElementById(liId).style.background = "#ffffff";\r
+\r
+ if (liId === "options-button") {\r
+ $("#"+liId+" i").toggleClass('icon-chevron-down icon-chevron-up theme-color');\r
+ }\r
+ else {\r
+ $("#"+liId+" .banner-icon i").toggleClass('theme-color not-selected');\r
+ }\r
+ }\r
+ else {\r
+ themeDisplayActions.hideSubMenus();\r
+ }\r
+ },\r
+\r
+ hideSubMenus : function(subMenuClicked, e) {\r
+ if (subMenuClicked != 'option-menu') {\r
+ var subMenu = document.getElementById('option-menu');\r
+ if (subMenu.className.indexOf('hide') == -1) {\r
+ //hide menu\r
+ $('#option-menu').animate({"opacity": '-=1'});\r
+ subMenu.className += ' hide';\r
+\r
+ //change back the button icon\r
+ document.getElementById("options-button").style.background = "none";\r
+ $('#options-button i').toggleClass('icon-chevron-down icon-chevron-up theme-color');\r
+ }\r
+ }\r
+\r
+ if (subMenuClicked != 'favorites-menu') {\r
+ subMenu = document.getElementById('favorites-menu');\r
+ if (subMenu.className.indexOf('hide') == -1) {\r
+ //hide menu\r
+ $('#favorites-menu').animate({"opacity": '-=1'});\r
+ subMenu.className += ' hide';\r
+\r
+ //change back the button icon\r
+ document.getElementById("favorites-button").style.background = "none";\r
+ $('#favorites-button .banner-icon i').toggleClass('theme-color not-selected');\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+$('html').click(function(){\r
+ themeDisplayActions.hideSubMenus();\r
+});\r
+\r
+$('.user').click(function(event){\r
+ event.stopPropagation();\r
+ themeDisplayActions.hideSubMenus('option-menu');\r
+});\r
+\r
+$('#favorites-button').click(function(event){\r
+ event.stopPropagation();\r
+ themeDisplayActions.hideSubMenus('favorites-menu');\r
+});\r