Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2008-07-28 03:32:54 +0400
committermatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2008-07-28 03:32:54 +0400
commit4b544aa9c09777426715b606319e54646bab5eda (patch)
treeab59bac1803b272272ca9d16ae69b65fd44a25ba /plugins/CoreHome/templates/menu.js
parente20c0f86431de3c35c3e5cf7f66d8d98c71aced7 (diff)
- end of previous commit. For some reasons Tortoise didn't see these files, bad!
Diffstat (limited to 'plugins/CoreHome/templates/menu.js')
-rw-r--r--plugins/CoreHome/templates/menu.js126
1 files changed, 126 insertions, 0 deletions
diff --git a/plugins/CoreHome/templates/menu.js b/plugins/CoreHome/templates/menu.js
new file mode 100644
index 0000000000..c87d894a05
--- /dev/null
+++ b/plugins/CoreHome/templates/menu.js
@@ -0,0 +1,126 @@
+// menu constructor
+function menu()
+{
+ this.param = new Object;
+}
+
+// this should be in the menu prototype but I couldn't figure out
+// how to use it as a callback in the jquery ajax request
+
+
+//Prototype of the DataTable object
+menu.prototype =
+{
+ menuSectionLoaded: function (content, urlLoaded)
+ {
+ if(urlLoaded == menu.prototype.lastUrlRequested)
+ {
+ $('#content').html( content ).show();
+ $('#loadingPiwik').hide();
+ menu.prototype.lastUrlRequested = null;
+ //console.log('display '+urlLoaded);
+ }
+ else
+ {
+ //console.log('loaded '+urlLoaded+' but expecting to display '+menu.prototype.lastUrlRequested);
+ }
+ },
+
+ customAjaxHandleError: function ()
+ {
+ menu.prototype.lastUrlRequested = null;
+ ajaxHandleError();
+ },
+
+ overMainLI: function ()
+ {
+ $(this).siblings().removeClass('sfHover');
+ },
+
+ outMainLI: function ()
+ {
+ },
+
+ onClickLI: function ()
+ {
+ var self = this;
+ var urlAjax = $('a',this).attr('name');
+ function menuSectionLoaded(content)
+ {
+ menu.prototype.menuSectionLoaded(content, urlAjax);
+ }
+
+ // showing loading...
+ $('#loadingPiwik').show();
+ $('#content').hide();
+
+ if(menu.prototype.lastUrlRequested == urlAjax)
+ {
+ return false;
+ }
+ menu.prototype.lastUrlRequested = urlAjax;
+
+ // we are in the SUB UL LI
+ if($(this).find('ul li').size() == 0)
+ {
+ // console.log('clicked SUB LI');
+ $(this).addClass('sfHover');
+ }
+ // we clicked on a MAIN LI
+ else
+ {
+ $(this).find('>ul li:first').addClass('sfHover');
+ }
+
+ //prepare the ajax request
+ ajaxRequest =
+ {
+ type: 'GET',
+ url: urlAjax,
+ dataType: 'html',
+ async: true,
+ error: menu.prototype.customAjaxHandleError, // Callback when the request fails
+ success: menuSectionLoaded, // Callback when the request succeeds
+ data: new Object
+ };
+ $.ajax(ajaxRequest);
+
+ return false;
+
+ },
+
+ init: function()
+ {
+ var self = this;
+ this.param.superfish = $('.nav')
+ .superfish({
+ pathClass : 'current',
+ animation : {opacity:'show'},
+ delay : 1000
+ });
+ this.param.superfish.find("li")
+ .click( self.onClickLI )
+ ;
+
+ this.param.superfish
+ .find("li:has(ul)")
+ .hover(self.overMainLI, self.outMainLI)
+ ;
+ },
+
+ loadFirstSection: function()
+ {
+ var self=this;
+ $('li:first', self.param.superfish)
+ .click()
+ .each(function(){
+ $(this).showSuperfishUl();
+ });
+ }
+}
+
+$(document).ready( function(){
+ piwikMenu = new menu();
+ piwikMenu.init();
+ piwikMenu.loadFirstSection();
+}); \ No newline at end of file