2
var ai = [{ url: "http://www.ubuntu.com", title:"Ubuntu" },
3
{ url: "http://community.ubuntu.com/", title:"Community" },
4
{ url: "http://askubuntu.com", title:"Ask!" },
5
{ url: "http://developer.ubuntu.com", title:"Developer" },
6
{ url: "https://design.ubuntu.com", title:"Design" },
7
{ url: "http://discourse.ubuntu.com", title:"Discourse" },
8
{ url: "http://www.ubuntu.com/certification", title:"Hardware" },
9
{ url: "https://insights.ubuntu.com", title:"Insights" },
10
{ url: "https://jujucharms.com", title:"Juju" },
11
{ url: "http://partners.ubuntu.com", title:"Partners" },
12
{ url: "http://shop.ubuntu.com", title:"Shop" }];
14
var more = [{ url: "http://apps.ubuntu.com", title:"Apps" },
15
{ url: "https://help.ubuntu.com", title:"Help" },
16
{ url: "http://ubuntuforums.org", title:"Forum" },
17
{ url: "http://www.launchpad.net", title:"Launchpad" },
18
{ url: "http://maas.ubuntu.com", title:"MAAS" },
19
{ url: "http://www.canonical.com", title:"Canonical" }];
22
if(!core){ var core = {}; }
24
core.setupGlobalNav = function () {
25
core.deployNav(core.getNav());
29
core.getNav = function() {
30
var begin = '<nav role="navigation" id="nav-global"><div class="nav-global-wrapper"><ul>';
31
var end = '</ul></div></nav>';
34
while(i < ai.length) {
35
mu += '<li><a href="' + ai[i].url + '" ' + core.getActive(ai[i].url) + '>' + ai[i].title + '</a></li>';
40
mu += '<li class="more"><a href="#">More <span>›</span></a><ul>';
41
while(i < more.length) { mu += '<li><a href="'+ more[i].url +'">' + more[i].title + '</a></li>'; i++; }
44
return begin + mu + end;
46
core.deployNav = function(mu) {
48
if(core.globalPrepend) {
49
gI = core.globalPrepend;
51
YUI().use('node', function(Y) {
52
Y.one(gI).prepend(mu);
53
var ml = Y.one('#nav-global .more');
55
ml.on('click',function(e){
58
this.toggleClass('open');
61
ml.one('span').on('click',function(e){
65
ml.one('ul').on('click',function(e){ e.stopPropagation(); });
67
Y.one('body').on('click', function(e){
68
var ml = Y.one('#nav-global .more');
69
if(ml.hasClass('open')){
70
ml.removeClass('open');
76
core.getActive = function(link) {
77
var fullurl = core.getURL();
78
var url = fullurl.substr(0,link.length);
80
if(link == 'http://www.ubuntu.com') {
81
if(fullurl.substr(0,35) == 'http://www.ubuntu.com/certification' ){
85
return (url == link)?'class="active"':'';
89
core.getURL = function(){
90
var url = document.URL;
91
url = url.replace('https://developer.ubuntu.com','http://developer.ubuntu.com');
95
core.trackClicks = function() {
96
YUI().use('node', function(Y) {
97
Y.all('#nav-global a').on('click',function(e) {
100
_gaq.push(['_trackEvent', 'Global bar click', e.target.get('text'), core.getURL()]);
102
setTimeout(function() {
103
document.location.href = e.target.get('href');
109
if(!core.globalPrepend) {
110
core.setupGlobalNav();
b'\\ No newline at end of file'